PR c/70883 - inconsistent error message for calls to __builtin_add_overflow
[official-gcc.git] / gcc / gimple.h
blob1da719c52e074be2daa6ceff1e8e2af93b96e0c7
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2016 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN;
51 #define GIMPLE_CHECK(GS, CODE) \
52 do { \
53 const gimple *__gs = (GS); \
54 if (gimple_code (__gs) != (CODE)) \
55 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
56 (CODE), ERROR_MARK); \
57 } while (0)
58 template <typename T>
59 static inline T
60 GIMPLE_CHECK2(const gimple *gs,
61 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
62 const char *file = __builtin_FILE (),
63 int line = __builtin_LINE (),
64 const char *fun = __builtin_FUNCTION ())
65 #else
66 const char *file = __FILE__,
67 int line = __LINE__,
68 const char *fun = NULL)
69 #endif
71 T ret = dyn_cast <T> (gs);
72 if (!ret)
73 gimple_check_failed (gs, file, line, fun,
74 remove_pointer<T>::type::code_, ERROR_MARK);
75 return ret;
77 template <typename T>
78 static inline T
79 GIMPLE_CHECK2(gimple *gs,
80 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
81 const char *file = __builtin_FILE (),
82 int line = __builtin_LINE (),
83 const char *fun = __builtin_FUNCTION ())
84 #else
85 const char *file = __FILE__,
86 int line = __LINE__,
87 const char *fun = NULL)
88 #endif
90 T ret = dyn_cast <T> (gs);
91 if (!ret)
92 gimple_check_failed (gs, file, line, fun,
93 remove_pointer<T>::type::code_, ERROR_MARK);
94 return ret;
96 #else /* not ENABLE_GIMPLE_CHECKING */
97 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
98 #define GIMPLE_CHECK(GS, CODE) (void)0
99 template <typename T>
100 static inline T
101 GIMPLE_CHECK2(gimple *gs)
103 return as_a <T> (gs);
105 template <typename T>
106 static inline T
107 GIMPLE_CHECK2(const gimple *gs)
109 return as_a <T> (gs);
111 #endif
113 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
114 get_gimple_rhs_class. */
115 enum gimple_rhs_class
117 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
118 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
119 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
120 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
121 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
122 name, a _DECL, a _REF, etc. */
125 /* Specific flags for individual GIMPLE statements. These flags are
126 always stored in gimple.subcode and they may only be
127 defined for statement codes that do not use subcodes.
129 Values for the masks can overlap as long as the overlapping values
130 are never used in the same statement class.
132 The maximum mask value that can be defined is 1 << 15 (i.e., each
133 statement code can hold up to 16 bitflags).
135 Keep this list sorted. */
136 enum gf_mask {
137 GF_ASM_INPUT = 1 << 0,
138 GF_ASM_VOLATILE = 1 << 1,
139 GF_CALL_FROM_THUNK = 1 << 0,
140 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
141 GF_CALL_TAILCALL = 1 << 2,
142 GF_CALL_VA_ARG_PACK = 1 << 3,
143 GF_CALL_NOTHROW = 1 << 4,
144 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
145 GF_CALL_INTERNAL = 1 << 6,
146 GF_CALL_CTRL_ALTERING = 1 << 7,
147 GF_CALL_WITH_BOUNDS = 1 << 8,
148 GF_CALL_MUST_TAIL_CALL = 1 << 9,
149 GF_OMP_PARALLEL_COMBINED = 1 << 0,
150 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
151 GF_OMP_TASK_TASKLOOP = 1 << 0,
152 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
153 GF_OMP_FOR_KIND_FOR = 0,
154 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
155 GF_OMP_FOR_KIND_TASKLOOP = 2,
156 GF_OMP_FOR_KIND_CILKFOR = 3,
157 GF_OMP_FOR_KIND_OACC_LOOP = 4,
158 GF_OMP_FOR_KIND_GRID_LOOP = 5,
159 /* Flag for SIMD variants of OMP_FOR kinds. */
160 GF_OMP_FOR_SIMD = 1 << 3,
161 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
162 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
163 GF_OMP_FOR_COMBINED = 1 << 4,
164 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
165 GF_OMP_FOR_GRID_PHONY = 1 << 6,
166 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
167 GF_OMP_TARGET_KIND_REGION = 0,
168 GF_OMP_TARGET_KIND_DATA = 1,
169 GF_OMP_TARGET_KIND_UPDATE = 2,
170 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
171 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
172 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
173 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
174 GF_OMP_TARGET_KIND_OACC_DATA = 7,
175 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
176 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
177 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
178 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
179 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
181 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
182 a thread synchronization via some sort of barrier. The exact barrier
183 that would otherwise be emitted is dependent on the OMP statement with
184 which this return is associated. */
185 GF_OMP_RETURN_NOWAIT = 1 << 0,
187 GF_OMP_SECTION_LAST = 1 << 0,
188 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
189 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
190 GF_PREDICT_TAKEN = 1 << 15
193 /* Currently, there are only two types of gimple debug stmt. Others are
194 envisioned, for example, to enable the generation of is_stmt notes
195 in line number information, to mark sequence points, etc. This
196 subcode is to be used to tell them apart. */
197 enum gimple_debug_subcode {
198 GIMPLE_DEBUG_BIND = 0,
199 GIMPLE_DEBUG_SOURCE_BIND = 1
202 /* Masks for selecting a pass local flag (PLF) to work on. These
203 masks are used by gimple_set_plf and gimple_plf. */
204 enum plf_mask {
205 GF_PLF_1 = 1 << 0,
206 GF_PLF_2 = 1 << 1
209 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
210 are for 64 bit hosts. */
212 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
213 chain_next ("%h.next"), variable_size))
214 gimple
216 /* [ WORD 1 ]
217 Main identifying code for a tuple. */
218 ENUM_BITFIELD(gimple_code) code : 8;
220 /* Nonzero if a warning should not be emitted on this tuple. */
221 unsigned int no_warning : 1;
223 /* Nonzero if this tuple has been visited. Passes are responsible
224 for clearing this bit before using it. */
225 unsigned int visited : 1;
227 /* Nonzero if this tuple represents a non-temporal move. */
228 unsigned int nontemporal_move : 1;
230 /* Pass local flags. These flags are free for any pass to use as
231 they see fit. Passes should not assume that these flags contain
232 any useful value when the pass starts. Any initial state that
233 the pass requires should be set on entry to the pass. See
234 gimple_set_plf and gimple_plf for usage. */
235 unsigned int plf : 2;
237 /* Nonzero if this statement has been modified and needs to have its
238 operands rescanned. */
239 unsigned modified : 1;
241 /* Nonzero if this statement contains volatile operands. */
242 unsigned has_volatile_ops : 1;
244 /* Padding to get subcode to 16 bit alignment. */
245 unsigned pad : 1;
247 /* The SUBCODE field can be used for tuple-specific flags for tuples
248 that do not require subcodes. Note that SUBCODE should be at
249 least as wide as tree codes, as several tuples store tree codes
250 in there. */
251 unsigned int subcode : 16;
253 /* UID of this statement. This is used by passes that want to
254 assign IDs to statements. It must be assigned and used by each
255 pass. By default it should be assumed to contain garbage. */
256 unsigned uid;
258 /* [ WORD 2 ]
259 Locus information for debug info. */
260 location_t location;
262 /* Number of operands in this tuple. */
263 unsigned num_ops;
265 /* [ WORD 3 ]
266 Basic block holding this statement. */
267 basic_block bb;
269 /* [ WORD 4-5 ]
270 Linked lists of gimple statements. The next pointers form
271 a NULL terminated list, the prev pointers are a cyclic list.
272 A gimple statement is hence also a double-ended list of
273 statements, with the pointer itself being the first element,
274 and the prev pointer being the last. */
275 gimple *next;
276 gimple *GTY((skip)) prev;
280 /* Base structure for tuples with operands. */
282 /* This gimple subclass has no tag value. */
283 struct GTY(())
284 gimple_statement_with_ops_base : public gimple
286 /* [ WORD 1-6 ] : base class */
288 /* [ WORD 7 ]
289 SSA operand vectors. NOTE: It should be possible to
290 amalgamate these vectors with the operand vector OP. However,
291 the SSA operand vectors are organized differently and contain
292 more information (like immediate use chaining). */
293 struct use_optype_d GTY((skip (""))) *use_ops;
297 /* Statements that take register operands. */
299 struct GTY((tag("GSS_WITH_OPS")))
300 gimple_statement_with_ops : public gimple_statement_with_ops_base
302 /* [ WORD 1-7 ] : base class */
304 /* [ WORD 8 ]
305 Operand vector. NOTE! This must always be the last field
306 of this structure. In particular, this means that this
307 structure cannot be embedded inside another one. */
308 tree GTY((length ("%h.num_ops"))) op[1];
312 /* Base for statements that take both memory and register operands. */
314 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
315 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
317 /* [ WORD 1-7 ] : base class */
319 /* [ WORD 8-9 ]
320 Virtual operands for this statement. The GC will pick them
321 up via the ssa_names array. */
322 tree GTY((skip (""))) vdef;
323 tree GTY((skip (""))) vuse;
327 /* Statements that take both memory and register operands. */
329 struct GTY((tag("GSS_WITH_MEM_OPS")))
330 gimple_statement_with_memory_ops :
331 public gimple_statement_with_memory_ops_base
333 /* [ WORD 1-9 ] : base class */
335 /* [ WORD 10 ]
336 Operand vector. NOTE! This must always be the last field
337 of this structure. In particular, this means that this
338 structure cannot be embedded inside another one. */
339 tree GTY((length ("%h.num_ops"))) op[1];
343 /* Call statements that take both memory and register operands. */
345 struct GTY((tag("GSS_CALL")))
346 gcall : public gimple_statement_with_memory_ops_base
348 /* [ WORD 1-9 ] : base class */
350 /* [ WORD 10-13 ] */
351 struct pt_solution call_used;
352 struct pt_solution call_clobbered;
354 /* [ WORD 14 ] */
355 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
356 tree GTY ((tag ("0"))) fntype;
357 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
358 } u;
360 /* [ WORD 15 ]
361 Operand vector. NOTE! This must always be the last field
362 of this structure. In particular, this means that this
363 structure cannot be embedded inside another one. */
364 tree GTY((length ("%h.num_ops"))) op[1];
366 static const enum gimple_code code_ = GIMPLE_CALL;
370 /* OMP statements. */
372 struct GTY((tag("GSS_OMP")))
373 gimple_statement_omp : public gimple
375 /* [ WORD 1-6 ] : base class */
377 /* [ WORD 7 ] */
378 gimple_seq body;
382 /* GIMPLE_BIND */
384 struct GTY((tag("GSS_BIND")))
385 gbind : public gimple
387 /* [ WORD 1-6 ] : base class */
389 /* [ WORD 7 ]
390 Variables declared in this scope. */
391 tree vars;
393 /* [ WORD 8 ]
394 This is different than the BLOCK field in gimple,
395 which is analogous to TREE_BLOCK (i.e., the lexical block holding
396 this statement). This field is the equivalent of BIND_EXPR_BLOCK
397 in tree land (i.e., the lexical scope defined by this bind). See
398 gimple-low.c. */
399 tree block;
401 /* [ WORD 9 ] */
402 gimple_seq body;
406 /* GIMPLE_CATCH */
408 struct GTY((tag("GSS_CATCH")))
409 gcatch : public gimple
411 /* [ WORD 1-6 ] : base class */
413 /* [ WORD 7 ] */
414 tree types;
416 /* [ WORD 8 ] */
417 gimple_seq handler;
421 /* GIMPLE_EH_FILTER */
423 struct GTY((tag("GSS_EH_FILTER")))
424 geh_filter : public gimple
426 /* [ WORD 1-6 ] : base class */
428 /* [ WORD 7 ]
429 Filter types. */
430 tree types;
432 /* [ WORD 8 ]
433 Failure actions. */
434 gimple_seq failure;
437 /* GIMPLE_EH_ELSE */
439 struct GTY((tag("GSS_EH_ELSE")))
440 geh_else : public gimple
442 /* [ WORD 1-6 ] : base class */
444 /* [ WORD 7,8 ] */
445 gimple_seq n_body, e_body;
448 /* GIMPLE_EH_MUST_NOT_THROW */
450 struct GTY((tag("GSS_EH_MNT")))
451 geh_mnt : public gimple
453 /* [ WORD 1-6 ] : base class */
455 /* [ WORD 7 ] Abort function decl. */
456 tree fndecl;
459 /* GIMPLE_PHI */
461 struct GTY((tag("GSS_PHI")))
462 gphi : public gimple
464 /* [ WORD 1-6 ] : base class */
466 /* [ WORD 7 ] */
467 unsigned capacity;
468 unsigned nargs;
470 /* [ WORD 8 ] */
471 tree result;
473 /* [ WORD 9 ] */
474 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
478 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
480 struct GTY((tag("GSS_EH_CTRL")))
481 gimple_statement_eh_ctrl : public gimple
483 /* [ WORD 1-6 ] : base class */
485 /* [ WORD 7 ]
486 Exception region number. */
487 int region;
490 struct GTY((tag("GSS_EH_CTRL")))
491 gresx : public gimple_statement_eh_ctrl
493 /* No extra fields; adds invariant:
494 stmt->code == GIMPLE_RESX. */
497 struct GTY((tag("GSS_EH_CTRL")))
498 geh_dispatch : public gimple_statement_eh_ctrl
500 /* No extra fields; adds invariant:
501 stmt->code == GIMPLE_EH_DISPATH. */
505 /* GIMPLE_TRY */
507 struct GTY((tag("GSS_TRY")))
508 gtry : public gimple
510 /* [ WORD 1-6 ] : base class */
512 /* [ WORD 7 ]
513 Expression to evaluate. */
514 gimple_seq eval;
516 /* [ WORD 8 ]
517 Cleanup expression. */
518 gimple_seq cleanup;
521 /* Kind of GIMPLE_TRY statements. */
522 enum gimple_try_flags
524 /* A try/catch. */
525 GIMPLE_TRY_CATCH = 1 << 0,
527 /* A try/finally. */
528 GIMPLE_TRY_FINALLY = 1 << 1,
529 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
531 /* Analogous to TRY_CATCH_IS_CLEANUP. */
532 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
535 /* GIMPLE_WITH_CLEANUP_EXPR */
537 struct GTY((tag("GSS_WCE")))
538 gimple_statement_wce : public gimple
540 /* [ WORD 1-6 ] : base class */
542 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
543 executed if an exception is thrown, not on normal exit of its
544 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
545 in TARGET_EXPRs. */
547 /* [ WORD 7 ]
548 Cleanup expression. */
549 gimple_seq cleanup;
553 /* GIMPLE_ASM */
555 struct GTY((tag("GSS_ASM")))
556 gasm : public gimple_statement_with_memory_ops_base
558 /* [ WORD 1-9 ] : base class */
560 /* [ WORD 10 ]
561 __asm__ statement. */
562 const char *string;
564 /* [ WORD 11 ]
565 Number of inputs, outputs, clobbers, labels. */
566 unsigned char ni;
567 unsigned char no;
568 unsigned char nc;
569 unsigned char nl;
571 /* [ WORD 12 ]
572 Operand vector. NOTE! This must always be the last field
573 of this structure. In particular, this means that this
574 structure cannot be embedded inside another one. */
575 tree GTY((length ("%h.num_ops"))) op[1];
578 /* GIMPLE_OMP_CRITICAL */
580 struct GTY((tag("GSS_OMP_CRITICAL")))
581 gomp_critical : public gimple_statement_omp
583 /* [ WORD 1-7 ] : base class */
585 /* [ WORD 8 ] */
586 tree clauses;
588 /* [ WORD 9 ]
589 Critical section name. */
590 tree name;
594 struct GTY(()) gimple_omp_for_iter {
595 /* Condition code. */
596 enum tree_code cond;
598 /* Index variable. */
599 tree index;
601 /* Initial value. */
602 tree initial;
604 /* Final value. */
605 tree final;
607 /* Increment. */
608 tree incr;
611 /* GIMPLE_OMP_FOR */
613 struct GTY((tag("GSS_OMP_FOR")))
614 gomp_for : public gimple_statement_omp
616 /* [ WORD 1-7 ] : base class */
618 /* [ WORD 8 ] */
619 tree clauses;
621 /* [ WORD 9 ]
622 Number of elements in iter array. */
623 size_t collapse;
625 /* [ WORD 10 ] */
626 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
628 /* [ WORD 11 ]
629 Pre-body evaluated before the loop body begins. */
630 gimple_seq pre_body;
634 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
636 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
637 gimple_statement_omp_parallel_layout : public gimple_statement_omp
639 /* [ WORD 1-7 ] : base class */
641 /* [ WORD 8 ]
642 Clauses. */
643 tree clauses;
645 /* [ WORD 9 ]
646 Child function holding the body of the parallel region. */
647 tree child_fn;
649 /* [ WORD 10 ]
650 Shared data argument. */
651 tree data_arg;
654 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
655 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
656 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
658 /* No extra fields; adds invariant:
659 stmt->code == GIMPLE_OMP_PARALLEL
660 || stmt->code == GIMPLE_OMP_TASK. */
663 /* GIMPLE_OMP_PARALLEL */
664 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
665 gomp_parallel : public gimple_statement_omp_taskreg
667 /* No extra fields; adds invariant:
668 stmt->code == GIMPLE_OMP_PARALLEL. */
671 /* GIMPLE_OMP_TARGET */
672 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
673 gomp_target : public gimple_statement_omp_parallel_layout
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_TARGET. */
679 /* GIMPLE_OMP_TASK */
681 struct GTY((tag("GSS_OMP_TASK")))
682 gomp_task : public gimple_statement_omp_taskreg
684 /* [ WORD 1-10 ] : base class */
686 /* [ WORD 11 ]
687 Child function holding firstprivate initialization if needed. */
688 tree copy_fn;
690 /* [ WORD 12-13 ]
691 Size and alignment in bytes of the argument data block. */
692 tree arg_size;
693 tree arg_align;
697 /* GIMPLE_OMP_SECTION */
698 /* Uses struct gimple_statement_omp. */
701 /* GIMPLE_OMP_SECTIONS */
703 struct GTY((tag("GSS_OMP_SECTIONS")))
704 gomp_sections : public gimple_statement_omp
706 /* [ WORD 1-7 ] : base class */
708 /* [ WORD 8 ] */
709 tree clauses;
711 /* [ WORD 9 ]
712 The control variable used for deciding which of the sections to
713 execute. */
714 tree control;
717 /* GIMPLE_OMP_CONTINUE.
719 Note: This does not inherit from gimple_statement_omp, because we
720 do not need the body field. */
722 struct GTY((tag("GSS_OMP_CONTINUE")))
723 gomp_continue : public gimple
725 /* [ WORD 1-6 ] : base class */
727 /* [ WORD 7 ] */
728 tree control_def;
730 /* [ WORD 8 ] */
731 tree control_use;
734 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
736 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
737 gimple_statement_omp_single_layout : public gimple_statement_omp
739 /* [ WORD 1-7 ] : base class */
741 /* [ WORD 8 ] */
742 tree clauses;
745 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
746 gomp_single : public gimple_statement_omp_single_layout
748 /* No extra fields; adds invariant:
749 stmt->code == GIMPLE_OMP_SINGLE. */
752 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
753 gomp_teams : public gimple_statement_omp_single_layout
755 /* No extra fields; adds invariant:
756 stmt->code == GIMPLE_OMP_TEAMS. */
759 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
760 gomp_ordered : public gimple_statement_omp_single_layout
762 /* No extra fields; adds invariant:
763 stmt->code == GIMPLE_OMP_ORDERED. */
767 /* GIMPLE_OMP_ATOMIC_LOAD.
768 Note: This is based on gimple, not g_s_omp, because g_s_omp
769 contains a sequence, which we don't need here. */
771 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
772 gomp_atomic_load : public gimple
774 /* [ WORD 1-6 ] : base class */
776 /* [ WORD 7-8 ] */
777 tree rhs, lhs;
780 /* GIMPLE_OMP_ATOMIC_STORE.
781 See note on GIMPLE_OMP_ATOMIC_LOAD. */
783 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
784 gimple_statement_omp_atomic_store_layout : public gimple
786 /* [ WORD 1-6 ] : base class */
788 /* [ WORD 7 ] */
789 tree val;
792 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
793 gomp_atomic_store :
794 public gimple_statement_omp_atomic_store_layout
796 /* No extra fields; adds invariant:
797 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
800 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
801 gimple_statement_omp_return :
802 public gimple_statement_omp_atomic_store_layout
804 /* No extra fields; adds invariant:
805 stmt->code == GIMPLE_OMP_RETURN. */
808 /* GIMPLE_TRANSACTION. */
810 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
812 /* The __transaction_atomic was declared [[outer]] or it is
813 __transaction_relaxed. */
814 #define GTMA_IS_OUTER (1u << 0)
815 #define GTMA_IS_RELAXED (1u << 1)
816 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
818 /* The transaction is seen to not have an abort. */
819 #define GTMA_HAVE_ABORT (1u << 2)
820 /* The transaction is seen to have loads or stores. */
821 #define GTMA_HAVE_LOAD (1u << 3)
822 #define GTMA_HAVE_STORE (1u << 4)
823 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
824 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
825 /* The transaction WILL enter serial irrevocable mode.
826 An irrevocable block post-dominates the entire transaction, such
827 that all invocations of the transaction will go serial-irrevocable.
828 In such case, we don't bother instrumenting the transaction, and
829 tell the runtime that it should begin the transaction in
830 serial-irrevocable mode. */
831 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
832 /* The transaction contains no instrumentation code whatsover, most
833 likely because it is guaranteed to go irrevocable upon entry. */
834 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
836 struct GTY((tag("GSS_TRANSACTION")))
837 gtransaction : public gimple_statement_with_memory_ops_base
839 /* [ WORD 1-9 ] : base class */
841 /* [ WORD 10 ] */
842 gimple_seq body;
844 /* [ WORD 11-13 ] */
845 tree label_norm;
846 tree label_uninst;
847 tree label_over;
850 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
851 enum gimple_statement_structure_enum {
852 #include "gsstruct.def"
853 LAST_GSS_ENUM
855 #undef DEFGSSTRUCT
857 /* A statement with the invariant that
858 stmt->code == GIMPLE_COND
859 i.e. a conditional jump statement. */
861 struct GTY((tag("GSS_WITH_OPS")))
862 gcond : public gimple_statement_with_ops
864 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
865 static const enum gimple_code code_ = GIMPLE_COND;
868 /* A statement with the invariant that
869 stmt->code == GIMPLE_DEBUG
870 i.e. a debug statement. */
872 struct GTY((tag("GSS_WITH_OPS")))
873 gdebug : public gimple_statement_with_ops
875 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
878 /* A statement with the invariant that
879 stmt->code == GIMPLE_GOTO
880 i.e. a goto statement. */
882 struct GTY((tag("GSS_WITH_OPS")))
883 ggoto : public gimple_statement_with_ops
885 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
888 /* A statement with the invariant that
889 stmt->code == GIMPLE_LABEL
890 i.e. a label statement. */
892 struct GTY((tag("GSS_WITH_OPS")))
893 glabel : public gimple_statement_with_ops
895 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
898 /* A statement with the invariant that
899 stmt->code == GIMPLE_SWITCH
900 i.e. a switch statement. */
902 struct GTY((tag("GSS_WITH_OPS")))
903 gswitch : public gimple_statement_with_ops
905 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
908 /* A statement with the invariant that
909 stmt->code == GIMPLE_ASSIGN
910 i.e. an assignment statement. */
912 struct GTY((tag("GSS_WITH_MEM_OPS")))
913 gassign : public gimple_statement_with_memory_ops
915 static const enum gimple_code code_ = GIMPLE_ASSIGN;
916 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
919 /* A statement with the invariant that
920 stmt->code == GIMPLE_RETURN
921 i.e. a return statement. */
923 struct GTY((tag("GSS_WITH_MEM_OPS")))
924 greturn : public gimple_statement_with_memory_ops
926 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
929 template <>
930 template <>
931 inline bool
932 is_a_helper <gasm *>::test (gimple *gs)
934 return gs->code == GIMPLE_ASM;
937 template <>
938 template <>
939 inline bool
940 is_a_helper <gassign *>::test (gimple *gs)
942 return gs->code == GIMPLE_ASSIGN;
945 template <>
946 template <>
947 inline bool
948 is_a_helper <const gassign *>::test (const gimple *gs)
950 return gs->code == GIMPLE_ASSIGN;
953 template <>
954 template <>
955 inline bool
956 is_a_helper <gbind *>::test (gimple *gs)
958 return gs->code == GIMPLE_BIND;
961 template <>
962 template <>
963 inline bool
964 is_a_helper <gcall *>::test (gimple *gs)
966 return gs->code == GIMPLE_CALL;
969 template <>
970 template <>
971 inline bool
972 is_a_helper <gcatch *>::test (gimple *gs)
974 return gs->code == GIMPLE_CATCH;
977 template <>
978 template <>
979 inline bool
980 is_a_helper <gcond *>::test (gimple *gs)
982 return gs->code == GIMPLE_COND;
985 template <>
986 template <>
987 inline bool
988 is_a_helper <const gcond *>::test (const gimple *gs)
990 return gs->code == GIMPLE_COND;
993 template <>
994 template <>
995 inline bool
996 is_a_helper <gdebug *>::test (gimple *gs)
998 return gs->code == GIMPLE_DEBUG;
1001 template <>
1002 template <>
1003 inline bool
1004 is_a_helper <ggoto *>::test (gimple *gs)
1006 return gs->code == GIMPLE_GOTO;
1009 template <>
1010 template <>
1011 inline bool
1012 is_a_helper <glabel *>::test (gimple *gs)
1014 return gs->code == GIMPLE_LABEL;
1017 template <>
1018 template <>
1019 inline bool
1020 is_a_helper <gresx *>::test (gimple *gs)
1022 return gs->code == GIMPLE_RESX;
1025 template <>
1026 template <>
1027 inline bool
1028 is_a_helper <geh_dispatch *>::test (gimple *gs)
1030 return gs->code == GIMPLE_EH_DISPATCH;
1033 template <>
1034 template <>
1035 inline bool
1036 is_a_helper <geh_else *>::test (gimple *gs)
1038 return gs->code == GIMPLE_EH_ELSE;
1041 template <>
1042 template <>
1043 inline bool
1044 is_a_helper <geh_filter *>::test (gimple *gs)
1046 return gs->code == GIMPLE_EH_FILTER;
1049 template <>
1050 template <>
1051 inline bool
1052 is_a_helper <geh_mnt *>::test (gimple *gs)
1054 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1057 template <>
1058 template <>
1059 inline bool
1060 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1062 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1065 template <>
1066 template <>
1067 inline bool
1068 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1070 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1073 template <>
1074 template <>
1075 inline bool
1076 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1078 return gs->code == GIMPLE_OMP_RETURN;
1081 template <>
1082 template <>
1083 inline bool
1084 is_a_helper <gomp_continue *>::test (gimple *gs)
1086 return gs->code == GIMPLE_OMP_CONTINUE;
1089 template <>
1090 template <>
1091 inline bool
1092 is_a_helper <gomp_critical *>::test (gimple *gs)
1094 return gs->code == GIMPLE_OMP_CRITICAL;
1097 template <>
1098 template <>
1099 inline bool
1100 is_a_helper <gomp_ordered *>::test (gimple *gs)
1102 return gs->code == GIMPLE_OMP_ORDERED;
1105 template <>
1106 template <>
1107 inline bool
1108 is_a_helper <gomp_for *>::test (gimple *gs)
1110 return gs->code == GIMPLE_OMP_FOR;
1113 template <>
1114 template <>
1115 inline bool
1116 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1118 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1121 template <>
1122 template <>
1123 inline bool
1124 is_a_helper <gomp_parallel *>::test (gimple *gs)
1126 return gs->code == GIMPLE_OMP_PARALLEL;
1129 template <>
1130 template <>
1131 inline bool
1132 is_a_helper <gomp_target *>::test (gimple *gs)
1134 return gs->code == GIMPLE_OMP_TARGET;
1137 template <>
1138 template <>
1139 inline bool
1140 is_a_helper <gomp_sections *>::test (gimple *gs)
1142 return gs->code == GIMPLE_OMP_SECTIONS;
1145 template <>
1146 template <>
1147 inline bool
1148 is_a_helper <gomp_single *>::test (gimple *gs)
1150 return gs->code == GIMPLE_OMP_SINGLE;
1153 template <>
1154 template <>
1155 inline bool
1156 is_a_helper <gomp_teams *>::test (gimple *gs)
1158 return gs->code == GIMPLE_OMP_TEAMS;
1161 template <>
1162 template <>
1163 inline bool
1164 is_a_helper <gomp_task *>::test (gimple *gs)
1166 return gs->code == GIMPLE_OMP_TASK;
1169 template <>
1170 template <>
1171 inline bool
1172 is_a_helper <gphi *>::test (gimple *gs)
1174 return gs->code == GIMPLE_PHI;
1177 template <>
1178 template <>
1179 inline bool
1180 is_a_helper <greturn *>::test (gimple *gs)
1182 return gs->code == GIMPLE_RETURN;
1185 template <>
1186 template <>
1187 inline bool
1188 is_a_helper <gswitch *>::test (gimple *gs)
1190 return gs->code == GIMPLE_SWITCH;
1193 template <>
1194 template <>
1195 inline bool
1196 is_a_helper <gtransaction *>::test (gimple *gs)
1198 return gs->code == GIMPLE_TRANSACTION;
1201 template <>
1202 template <>
1203 inline bool
1204 is_a_helper <gtry *>::test (gimple *gs)
1206 return gs->code == GIMPLE_TRY;
1209 template <>
1210 template <>
1211 inline bool
1212 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1214 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1217 template <>
1218 template <>
1219 inline bool
1220 is_a_helper <const gasm *>::test (const gimple *gs)
1222 return gs->code == GIMPLE_ASM;
1225 template <>
1226 template <>
1227 inline bool
1228 is_a_helper <const gbind *>::test (const gimple *gs)
1230 return gs->code == GIMPLE_BIND;
1233 template <>
1234 template <>
1235 inline bool
1236 is_a_helper <const gcall *>::test (const gimple *gs)
1238 return gs->code == GIMPLE_CALL;
1241 template <>
1242 template <>
1243 inline bool
1244 is_a_helper <const gcatch *>::test (const gimple *gs)
1246 return gs->code == GIMPLE_CATCH;
1249 template <>
1250 template <>
1251 inline bool
1252 is_a_helper <const gresx *>::test (const gimple *gs)
1254 return gs->code == GIMPLE_RESX;
1257 template <>
1258 template <>
1259 inline bool
1260 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1262 return gs->code == GIMPLE_EH_DISPATCH;
1265 template <>
1266 template <>
1267 inline bool
1268 is_a_helper <const geh_filter *>::test (const gimple *gs)
1270 return gs->code == GIMPLE_EH_FILTER;
1273 template <>
1274 template <>
1275 inline bool
1276 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1278 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1281 template <>
1282 template <>
1283 inline bool
1284 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1286 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1289 template <>
1290 template <>
1291 inline bool
1292 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1294 return gs->code == GIMPLE_OMP_RETURN;
1297 template <>
1298 template <>
1299 inline bool
1300 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1302 return gs->code == GIMPLE_OMP_CONTINUE;
1305 template <>
1306 template <>
1307 inline bool
1308 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1310 return gs->code == GIMPLE_OMP_CRITICAL;
1313 template <>
1314 template <>
1315 inline bool
1316 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1318 return gs->code == GIMPLE_OMP_ORDERED;
1321 template <>
1322 template <>
1323 inline bool
1324 is_a_helper <const gomp_for *>::test (const gimple *gs)
1326 return gs->code == GIMPLE_OMP_FOR;
1329 template <>
1330 template <>
1331 inline bool
1332 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1334 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1337 template <>
1338 template <>
1339 inline bool
1340 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1342 return gs->code == GIMPLE_OMP_PARALLEL;
1345 template <>
1346 template <>
1347 inline bool
1348 is_a_helper <const gomp_target *>::test (const gimple *gs)
1350 return gs->code == GIMPLE_OMP_TARGET;
1353 template <>
1354 template <>
1355 inline bool
1356 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1358 return gs->code == GIMPLE_OMP_SECTIONS;
1361 template <>
1362 template <>
1363 inline bool
1364 is_a_helper <const gomp_single *>::test (const gimple *gs)
1366 return gs->code == GIMPLE_OMP_SINGLE;
1369 template <>
1370 template <>
1371 inline bool
1372 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1374 return gs->code == GIMPLE_OMP_TEAMS;
1377 template <>
1378 template <>
1379 inline bool
1380 is_a_helper <const gomp_task *>::test (const gimple *gs)
1382 return gs->code == GIMPLE_OMP_TASK;
1385 template <>
1386 template <>
1387 inline bool
1388 is_a_helper <const gphi *>::test (const gimple *gs)
1390 return gs->code == GIMPLE_PHI;
1393 template <>
1394 template <>
1395 inline bool
1396 is_a_helper <const gtransaction *>::test (const gimple *gs)
1398 return gs->code == GIMPLE_TRANSACTION;
1401 /* Offset in bytes to the location of the operand vector.
1402 Zero if there is no operand vector for this tuple structure. */
1403 extern size_t const gimple_ops_offset_[];
1405 /* Map GIMPLE codes to GSS codes. */
1406 extern enum gimple_statement_structure_enum const gss_for_code_[];
1408 /* This variable holds the currently expanded gimple statement for purposes
1409 of comminucating the profile info to the builtin expanders. */
1410 extern gimple *currently_expanding_gimple_stmt;
1412 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1413 gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1414 greturn *gimple_build_return (tree);
1415 void gimple_call_reset_alias_info (gcall *);
1416 gcall *gimple_build_call_vec (tree, vec<tree> );
1417 gcall *gimple_build_call (tree, unsigned, ...);
1418 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1419 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1420 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1421 gcall *gimple_build_call_from_tree (tree);
1422 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1423 gassign *gimple_build_assign (tree, enum tree_code,
1424 tree, tree, tree CXX_MEM_STAT_INFO);
1425 gassign *gimple_build_assign (tree, enum tree_code,
1426 tree, tree CXX_MEM_STAT_INFO);
1427 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1428 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1429 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1430 void gimple_cond_set_condition_from_tree (gcond *, tree);
1431 glabel *gimple_build_label (tree label);
1432 ggoto *gimple_build_goto (tree dest);
1433 gimple *gimple_build_nop (void);
1434 gbind *gimple_build_bind (tree, gimple_seq, tree);
1435 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1436 vec<tree, va_gc> *, vec<tree, va_gc> *,
1437 vec<tree, va_gc> *);
1438 gcatch *gimple_build_catch (tree, gimple_seq);
1439 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1440 geh_mnt *gimple_build_eh_must_not_throw (tree);
1441 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1442 gtry *gimple_build_try (gimple_seq, gimple_seq,
1443 enum gimple_try_flags);
1444 gimple *gimple_build_wce (gimple_seq);
1445 gresx *gimple_build_resx (int);
1446 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1447 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1448 geh_dispatch *gimple_build_eh_dispatch (int);
1449 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1450 #define gimple_build_debug_bind(var,val,stmt) \
1451 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1452 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1453 #define gimple_build_debug_source_bind(var,val,stmt) \
1454 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1455 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1456 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1457 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1458 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1459 tree, tree);
1460 gimple *gimple_build_omp_section (gimple_seq);
1461 gimple *gimple_build_omp_master (gimple_seq);
1462 gimple *gimple_build_omp_grid_body (gimple_seq);
1463 gimple *gimple_build_omp_taskgroup (gimple_seq);
1464 gomp_continue *gimple_build_omp_continue (tree, tree);
1465 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1466 gimple *gimple_build_omp_return (bool);
1467 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1468 gimple *gimple_build_omp_sections_switch (void);
1469 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1470 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1471 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1472 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1473 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1474 gtransaction *gimple_build_transaction (gimple_seq);
1475 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1476 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1477 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1478 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1479 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1480 location_t);
1481 extern void annotate_all_with_location (gimple_seq, location_t);
1482 bool empty_body_p (gimple_seq);
1483 gimple_seq gimple_seq_copy (gimple_seq);
1484 bool gimple_call_same_target_p (const gimple *, const gimple *);
1485 int gimple_call_flags (const gimple *);
1486 int gimple_call_arg_flags (const gcall *, unsigned);
1487 int gimple_call_return_flags (const gcall *);
1488 bool gimple_assign_copy_p (gimple *);
1489 bool gimple_assign_ssa_name_copy_p (gimple *);
1490 bool gimple_assign_unary_nop_p (gimple *);
1491 void gimple_set_bb (gimple *, basic_block);
1492 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1493 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1494 tree, tree, tree);
1495 tree gimple_get_lhs (const gimple *);
1496 void gimple_set_lhs (gimple *, tree);
1497 gimple *gimple_copy (gimple *);
1498 bool gimple_has_side_effects (const gimple *);
1499 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1500 bool gimple_could_trap_p (gimple *);
1501 bool gimple_assign_rhs_could_trap_p (gimple *);
1502 extern void dump_gimple_statistics (void);
1503 unsigned get_gimple_rhs_num_ops (enum tree_code);
1504 extern tree canonicalize_cond_expr_cond (tree);
1505 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1506 extern bool gimple_compare_field_offset (tree, tree);
1507 extern tree gimple_unsigned_type (tree);
1508 extern tree gimple_signed_type (tree);
1509 extern alias_set_type gimple_get_alias_set (tree);
1510 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1511 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1512 extern combined_fn gimple_call_combined_fn (const gimple *);
1513 extern bool gimple_call_builtin_p (const gimple *);
1514 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1515 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1516 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1517 extern void dump_decl_set (FILE *, bitmap);
1518 extern bool nonfreeing_call_p (gimple *);
1519 extern bool nonbarrier_call_p (gimple *);
1520 extern bool infer_nonnull_range (gimple *, tree);
1521 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1522 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1523 extern void sort_case_labels (vec<tree>);
1524 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1525 extern void gimple_seq_set_location (gimple_seq, location_t);
1526 extern void gimple_seq_discard (gimple_seq);
1527 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1528 extern bool gimple_inexpensive_call_p (gcall *);
1530 /* Formal (expression) temporary table handling: multiple occurrences of
1531 the same scalar expression are evaluated into the same temporary. */
1533 typedef struct gimple_temp_hash_elt
1535 tree val; /* Key */
1536 tree temp; /* Value */
1537 } elt_t;
1539 /* Get the number of the next statement uid to be allocated. */
1540 static inline unsigned int
1541 gimple_stmt_max_uid (struct function *fn)
1543 return fn->last_stmt_uid;
1546 /* Set the number of the next statement uid to be allocated. */
1547 static inline void
1548 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1550 fn->last_stmt_uid = maxid;
1553 /* Set the number of the next statement uid to be allocated. */
1554 static inline unsigned int
1555 inc_gimple_stmt_max_uid (struct function *fn)
1557 return fn->last_stmt_uid++;
1560 /* Return the first node in GIMPLE sequence S. */
1562 static inline gimple_seq_node
1563 gimple_seq_first (gimple_seq s)
1565 return s;
1569 /* Return the first statement in GIMPLE sequence S. */
1571 static inline gimple *
1572 gimple_seq_first_stmt (gimple_seq s)
1574 gimple_seq_node n = gimple_seq_first (s);
1575 return n;
1578 /* Return the first statement in GIMPLE sequence S as a gbind *,
1579 verifying that it has code GIMPLE_BIND in a checked build. */
1581 static inline gbind *
1582 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1584 gimple_seq_node n = gimple_seq_first (s);
1585 return as_a <gbind *> (n);
1589 /* Return the last node in GIMPLE sequence S. */
1591 static inline gimple_seq_node
1592 gimple_seq_last (gimple_seq s)
1594 return s ? s->prev : NULL;
1598 /* Return the last statement in GIMPLE sequence S. */
1600 static inline gimple *
1601 gimple_seq_last_stmt (gimple_seq s)
1603 gimple_seq_node n = gimple_seq_last (s);
1604 return n;
1608 /* Set the last node in GIMPLE sequence *PS to LAST. */
1610 static inline void
1611 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1613 (*ps)->prev = last;
1617 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1619 static inline void
1620 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1622 *ps = first;
1626 /* Return true if GIMPLE sequence S is empty. */
1628 static inline bool
1629 gimple_seq_empty_p (gimple_seq s)
1631 return s == NULL;
1634 /* Allocate a new sequence and initialize its first element with STMT. */
1636 static inline gimple_seq
1637 gimple_seq_alloc_with_stmt (gimple *stmt)
1639 gimple_seq seq = NULL;
1640 gimple_seq_add_stmt (&seq, stmt);
1641 return seq;
1645 /* Returns the sequence of statements in BB. */
1647 static inline gimple_seq
1648 bb_seq (const_basic_block bb)
1650 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1653 static inline gimple_seq *
1654 bb_seq_addr (basic_block bb)
1656 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1659 /* Sets the sequence of statements in BB to SEQ. */
1661 static inline void
1662 set_bb_seq (basic_block bb, gimple_seq seq)
1664 gcc_checking_assert (!(bb->flags & BB_RTL));
1665 bb->il.gimple.seq = seq;
1669 /* Return the code for GIMPLE statement G. */
1671 static inline enum gimple_code
1672 gimple_code (const gimple *g)
1674 return g->code;
1678 /* Return the GSS code used by a GIMPLE code. */
1680 static inline enum gimple_statement_structure_enum
1681 gss_for_code (enum gimple_code code)
1683 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1684 return gss_for_code_[code];
1688 /* Return which GSS code is used by GS. */
1690 static inline enum gimple_statement_structure_enum
1691 gimple_statement_structure (gimple *gs)
1693 return gss_for_code (gimple_code (gs));
1697 /* Return true if statement G has sub-statements. This is only true for
1698 High GIMPLE statements. */
1700 static inline bool
1701 gimple_has_substatements (gimple *g)
1703 switch (gimple_code (g))
1705 case GIMPLE_BIND:
1706 case GIMPLE_CATCH:
1707 case GIMPLE_EH_FILTER:
1708 case GIMPLE_EH_ELSE:
1709 case GIMPLE_TRY:
1710 case GIMPLE_OMP_FOR:
1711 case GIMPLE_OMP_MASTER:
1712 case GIMPLE_OMP_TASKGROUP:
1713 case GIMPLE_OMP_ORDERED:
1714 case GIMPLE_OMP_SECTION:
1715 case GIMPLE_OMP_PARALLEL:
1716 case GIMPLE_OMP_TASK:
1717 case GIMPLE_OMP_SECTIONS:
1718 case GIMPLE_OMP_SINGLE:
1719 case GIMPLE_OMP_TARGET:
1720 case GIMPLE_OMP_TEAMS:
1721 case GIMPLE_OMP_CRITICAL:
1722 case GIMPLE_WITH_CLEANUP_EXPR:
1723 case GIMPLE_TRANSACTION:
1724 case GIMPLE_OMP_GRID_BODY:
1725 return true;
1727 default:
1728 return false;
1733 /* Return the basic block holding statement G. */
1735 static inline basic_block
1736 gimple_bb (const gimple *g)
1738 return g->bb;
1742 /* Return the lexical scope block holding statement G. */
1744 static inline tree
1745 gimple_block (const gimple *g)
1747 return LOCATION_BLOCK (g->location);
1751 /* Set BLOCK to be the lexical scope block holding statement G. */
1753 static inline void
1754 gimple_set_block (gimple *g, tree block)
1756 g->location = set_block (g->location, block);
1760 /* Return location information for statement G. */
1762 static inline location_t
1763 gimple_location (const gimple *g)
1765 return g->location;
1768 /* Return location information for statement G if g is not NULL.
1769 Otherwise, UNKNOWN_LOCATION is returned. */
1771 static inline location_t
1772 gimple_location_safe (const gimple *g)
1774 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1777 /* Set location information for statement G. */
1779 static inline void
1780 gimple_set_location (gimple *g, location_t location)
1782 g->location = location;
1786 /* Return true if G contains location information. */
1788 static inline bool
1789 gimple_has_location (const gimple *g)
1791 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1795 /* Return the file name of the location of STMT. */
1797 static inline const char *
1798 gimple_filename (const gimple *stmt)
1800 return LOCATION_FILE (gimple_location (stmt));
1804 /* Return the line number of the location of STMT. */
1806 static inline int
1807 gimple_lineno (const gimple *stmt)
1809 return LOCATION_LINE (gimple_location (stmt));
1813 /* Determine whether SEQ is a singleton. */
1815 static inline bool
1816 gimple_seq_singleton_p (gimple_seq seq)
1818 return ((gimple_seq_first (seq) != NULL)
1819 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1822 /* Return true if no warnings should be emitted for statement STMT. */
1824 static inline bool
1825 gimple_no_warning_p (const gimple *stmt)
1827 return stmt->no_warning;
1830 /* Set the no_warning flag of STMT to NO_WARNING. */
1832 static inline void
1833 gimple_set_no_warning (gimple *stmt, bool no_warning)
1835 stmt->no_warning = (unsigned) no_warning;
1838 /* Set the visited status on statement STMT to VISITED_P.
1840 Please note that this 'visited' property of the gimple statement is
1841 supposed to be undefined at pass boundaries. This means that a
1842 given pass should not assume it contains any useful value when the
1843 pass starts and thus can set it to any value it sees fit.
1845 You can learn more about the visited property of the gimple
1846 statement by reading the comments of the 'visited' data member of
1847 struct gimple.
1850 static inline void
1851 gimple_set_visited (gimple *stmt, bool visited_p)
1853 stmt->visited = (unsigned) visited_p;
1857 /* Return the visited status for statement STMT.
1859 Please note that this 'visited' property of the gimple statement is
1860 supposed to be undefined at pass boundaries. This means that a
1861 given pass should not assume it contains any useful value when the
1862 pass starts and thus can set it to any value it sees fit.
1864 You can learn more about the visited property of the gimple
1865 statement by reading the comments of the 'visited' data member of
1866 struct gimple. */
1868 static inline bool
1869 gimple_visited_p (gimple *stmt)
1871 return stmt->visited;
1875 /* Set pass local flag PLF on statement STMT to VAL_P.
1877 Please note that this PLF property of the gimple statement is
1878 supposed to be undefined at pass boundaries. This means that a
1879 given pass should not assume it contains any useful value when the
1880 pass starts and thus can set it to any value it sees fit.
1882 You can learn more about the PLF property by reading the comment of
1883 the 'plf' data member of struct gimple_statement_structure. */
1885 static inline void
1886 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1888 if (val_p)
1889 stmt->plf |= (unsigned int) plf;
1890 else
1891 stmt->plf &= ~((unsigned int) plf);
1895 /* Return the value of pass local flag PLF on statement STMT.
1897 Please note that this 'plf' property of the gimple statement is
1898 supposed to be undefined at pass boundaries. This means that a
1899 given pass should not assume it contains any useful value when the
1900 pass starts and thus can set it to any value it sees fit.
1902 You can learn more about the plf property by reading the comment of
1903 the 'plf' data member of struct gimple_statement_structure. */
1905 static inline unsigned int
1906 gimple_plf (gimple *stmt, enum plf_mask plf)
1908 return stmt->plf & ((unsigned int) plf);
1912 /* Set the UID of statement.
1914 Please note that this UID property is supposed to be undefined at
1915 pass boundaries. This means that a given pass should not assume it
1916 contains any useful value when the pass starts and thus can set it
1917 to any value it sees fit. */
1919 static inline void
1920 gimple_set_uid (gimple *g, unsigned uid)
1922 g->uid = uid;
1926 /* Return the UID of statement.
1928 Please note that this UID property is supposed to be undefined at
1929 pass boundaries. This means that a given pass should not assume it
1930 contains any useful value when the pass starts and thus can set it
1931 to any value it sees fit. */
1933 static inline unsigned
1934 gimple_uid (const gimple *g)
1936 return g->uid;
1940 /* Make statement G a singleton sequence. */
1942 static inline void
1943 gimple_init_singleton (gimple *g)
1945 g->next = NULL;
1946 g->prev = g;
1950 /* Return true if GIMPLE statement G has register or memory operands. */
1952 static inline bool
1953 gimple_has_ops (const gimple *g)
1955 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1958 template <>
1959 template <>
1960 inline bool
1961 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1963 return gimple_has_ops (gs);
1966 template <>
1967 template <>
1968 inline bool
1969 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1971 return gimple_has_ops (gs);
1974 /* Return true if GIMPLE statement G has memory operands. */
1976 static inline bool
1977 gimple_has_mem_ops (const gimple *g)
1979 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1982 template <>
1983 template <>
1984 inline bool
1985 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1987 return gimple_has_mem_ops (gs);
1990 template <>
1991 template <>
1992 inline bool
1993 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1995 return gimple_has_mem_ops (gs);
1998 /* Return the set of USE operands for statement G. */
2000 static inline struct use_optype_d *
2001 gimple_use_ops (const gimple *g)
2003 const gimple_statement_with_ops *ops_stmt =
2004 dyn_cast <const gimple_statement_with_ops *> (g);
2005 if (!ops_stmt)
2006 return NULL;
2007 return ops_stmt->use_ops;
2011 /* Set USE to be the set of USE operands for statement G. */
2013 static inline void
2014 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2016 gimple_statement_with_ops *ops_stmt =
2017 as_a <gimple_statement_with_ops *> (g);
2018 ops_stmt->use_ops = use;
2022 /* Return the single VUSE operand of the statement G. */
2024 static inline tree
2025 gimple_vuse (const gimple *g)
2027 const gimple_statement_with_memory_ops *mem_ops_stmt =
2028 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2029 if (!mem_ops_stmt)
2030 return NULL_TREE;
2031 return mem_ops_stmt->vuse;
2034 /* Return the single VDEF operand of the statement G. */
2036 static inline tree
2037 gimple_vdef (const gimple *g)
2039 const gimple_statement_with_memory_ops *mem_ops_stmt =
2040 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2041 if (!mem_ops_stmt)
2042 return NULL_TREE;
2043 return mem_ops_stmt->vdef;
2046 /* Return the single VUSE operand of the statement G. */
2048 static inline tree *
2049 gimple_vuse_ptr (gimple *g)
2051 gimple_statement_with_memory_ops *mem_ops_stmt =
2052 dyn_cast <gimple_statement_with_memory_ops *> (g);
2053 if (!mem_ops_stmt)
2054 return NULL;
2055 return &mem_ops_stmt->vuse;
2058 /* Return the single VDEF operand of the statement G. */
2060 static inline tree *
2061 gimple_vdef_ptr (gimple *g)
2063 gimple_statement_with_memory_ops *mem_ops_stmt =
2064 dyn_cast <gimple_statement_with_memory_ops *> (g);
2065 if (!mem_ops_stmt)
2066 return NULL;
2067 return &mem_ops_stmt->vdef;
2070 /* Set the single VUSE operand of the statement G. */
2072 static inline void
2073 gimple_set_vuse (gimple *g, tree vuse)
2075 gimple_statement_with_memory_ops *mem_ops_stmt =
2076 as_a <gimple_statement_with_memory_ops *> (g);
2077 mem_ops_stmt->vuse = vuse;
2080 /* Set the single VDEF operand of the statement G. */
2082 static inline void
2083 gimple_set_vdef (gimple *g, tree vdef)
2085 gimple_statement_with_memory_ops *mem_ops_stmt =
2086 as_a <gimple_statement_with_memory_ops *> (g);
2087 mem_ops_stmt->vdef = vdef;
2091 /* Return true if statement G has operands and the modified field has
2092 been set. */
2094 static inline bool
2095 gimple_modified_p (const gimple *g)
2097 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2101 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2102 a MODIFIED field. */
2104 static inline void
2105 gimple_set_modified (gimple *s, bool modifiedp)
2107 if (gimple_has_ops (s))
2108 s->modified = (unsigned) modifiedp;
2112 /* Return the tree code for the expression computed by STMT. This is
2113 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2114 GIMPLE_CALL, return CALL_EXPR as the expression code for
2115 consistency. This is useful when the caller needs to deal with the
2116 three kinds of computation that GIMPLE supports. */
2118 static inline enum tree_code
2119 gimple_expr_code (const gimple *stmt)
2121 enum gimple_code code = gimple_code (stmt);
2122 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2123 return (enum tree_code) stmt->subcode;
2124 else
2126 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2127 return CALL_EXPR;
2132 /* Return true if statement STMT contains volatile operands. */
2134 static inline bool
2135 gimple_has_volatile_ops (const gimple *stmt)
2137 if (gimple_has_mem_ops (stmt))
2138 return stmt->has_volatile_ops;
2139 else
2140 return false;
2144 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2146 static inline void
2147 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2149 if (gimple_has_mem_ops (stmt))
2150 stmt->has_volatile_ops = (unsigned) volatilep;
2153 /* Return true if STMT is in a transaction. */
2155 static inline bool
2156 gimple_in_transaction (const gimple *stmt)
2158 return bb_in_transaction (gimple_bb (stmt));
2161 /* Return true if statement STMT may access memory. */
2163 static inline bool
2164 gimple_references_memory_p (gimple *stmt)
2166 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2170 /* Return the subcode for OMP statement S. */
2172 static inline unsigned
2173 gimple_omp_subcode (const gimple *s)
2175 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2176 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2177 return s->subcode;
2180 /* Set the subcode for OMP statement S to SUBCODE. */
2182 static inline void
2183 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2185 /* We only have 16 bits for the subcode. Assert that we are not
2186 overflowing it. */
2187 gcc_gimple_checking_assert (subcode < (1 << 16));
2188 s->subcode = subcode;
2191 /* Set the nowait flag on OMP_RETURN statement S. */
2193 static inline void
2194 gimple_omp_return_set_nowait (gimple *s)
2196 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2197 s->subcode |= GF_OMP_RETURN_NOWAIT;
2201 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2202 flag set. */
2204 static inline bool
2205 gimple_omp_return_nowait_p (const gimple *g)
2207 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2208 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2212 /* Set the LHS of OMP return. */
2214 static inline void
2215 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2217 gimple_statement_omp_return *omp_return_stmt =
2218 as_a <gimple_statement_omp_return *> (g);
2219 omp_return_stmt->val = lhs;
2223 /* Get the LHS of OMP return. */
2225 static inline tree
2226 gimple_omp_return_lhs (const gimple *g)
2228 const gimple_statement_omp_return *omp_return_stmt =
2229 as_a <const gimple_statement_omp_return *> (g);
2230 return omp_return_stmt->val;
2234 /* Return a pointer to the LHS of OMP return. */
2236 static inline tree *
2237 gimple_omp_return_lhs_ptr (gimple *g)
2239 gimple_statement_omp_return *omp_return_stmt =
2240 as_a <gimple_statement_omp_return *> (g);
2241 return &omp_return_stmt->val;
2245 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2246 flag set. */
2248 static inline bool
2249 gimple_omp_section_last_p (const gimple *g)
2251 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2252 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2256 /* Set the GF_OMP_SECTION_LAST flag on G. */
2258 static inline void
2259 gimple_omp_section_set_last (gimple *g)
2261 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2262 g->subcode |= GF_OMP_SECTION_LAST;
2266 /* Return true if OMP parallel statement G has the
2267 GF_OMP_PARALLEL_COMBINED flag set. */
2269 static inline bool
2270 gimple_omp_parallel_combined_p (const gimple *g)
2272 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2273 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2277 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2278 value of COMBINED_P. */
2280 static inline void
2281 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2283 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2284 if (combined_p)
2285 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2286 else
2287 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2291 /* Return true if OMP atomic load/store statement G has the
2292 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2294 static inline bool
2295 gimple_omp_atomic_need_value_p (const gimple *g)
2297 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2298 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2299 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2303 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2305 static inline void
2306 gimple_omp_atomic_set_need_value (gimple *g)
2308 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2309 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2310 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2314 /* Return true if OMP atomic load/store statement G has the
2315 GF_OMP_ATOMIC_SEQ_CST flag set. */
2317 static inline bool
2318 gimple_omp_atomic_seq_cst_p (const gimple *g)
2320 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2321 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2322 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2326 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2328 static inline void
2329 gimple_omp_atomic_set_seq_cst (gimple *g)
2331 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2332 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2333 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2337 /* Return the number of operands for statement GS. */
2339 static inline unsigned
2340 gimple_num_ops (const gimple *gs)
2342 return gs->num_ops;
2346 /* Set the number of operands for statement GS. */
2348 static inline void
2349 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2351 gs->num_ops = num_ops;
2355 /* Return the array of operands for statement GS. */
2357 static inline tree *
2358 gimple_ops (gimple *gs)
2360 size_t off;
2362 /* All the tuples have their operand vector at the very bottom
2363 of the structure. Note that those structures that do not
2364 have an operand vector have a zero offset. */
2365 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2366 gcc_gimple_checking_assert (off != 0);
2368 return (tree *) ((char *) gs + off);
2372 /* Return operand I for statement GS. */
2374 static inline tree
2375 gimple_op (const gimple *gs, unsigned i)
2377 if (gimple_has_ops (gs))
2379 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2380 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2382 else
2383 return NULL_TREE;
2386 /* Return a pointer to operand I for statement GS. */
2388 static inline tree *
2389 gimple_op_ptr (gimple *gs, unsigned i)
2391 if (gimple_has_ops (gs))
2393 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2394 return gimple_ops (gs) + i;
2396 else
2397 return NULL;
2400 /* Set operand I of statement GS to OP. */
2402 static inline void
2403 gimple_set_op (gimple *gs, unsigned i, tree op)
2405 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2407 /* Note. It may be tempting to assert that OP matches
2408 is_gimple_operand, but that would be wrong. Different tuples
2409 accept slightly different sets of tree operands. Each caller
2410 should perform its own validation. */
2411 gimple_ops (gs)[i] = op;
2414 /* Return true if GS is a GIMPLE_ASSIGN. */
2416 static inline bool
2417 is_gimple_assign (const gimple *gs)
2419 return gimple_code (gs) == GIMPLE_ASSIGN;
2422 /* Determine if expression CODE is one of the valid expressions that can
2423 be used on the RHS of GIMPLE assignments. */
2425 static inline enum gimple_rhs_class
2426 get_gimple_rhs_class (enum tree_code code)
2428 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2431 /* Return the LHS of assignment statement GS. */
2433 static inline tree
2434 gimple_assign_lhs (const gassign *gs)
2436 return gs->op[0];
2439 static inline tree
2440 gimple_assign_lhs (const gimple *gs)
2442 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2443 return gimple_assign_lhs (ass);
2447 /* Return a pointer to the LHS of assignment statement GS. */
2449 static inline tree *
2450 gimple_assign_lhs_ptr (gassign *gs)
2452 return &gs->op[0];
2455 static inline tree *
2456 gimple_assign_lhs_ptr (gimple *gs)
2458 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2459 return gimple_assign_lhs_ptr (ass);
2463 /* Set LHS to be the LHS operand of assignment statement GS. */
2465 static inline void
2466 gimple_assign_set_lhs (gassign *gs, tree lhs)
2468 gs->op[0] = lhs;
2470 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2471 SSA_NAME_DEF_STMT (lhs) = gs;
2474 static inline void
2475 gimple_assign_set_lhs (gimple *gs, tree lhs)
2477 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2478 gimple_assign_set_lhs (ass, lhs);
2482 /* Return the first operand on the RHS of assignment statement GS. */
2484 static inline tree
2485 gimple_assign_rhs1 (const gassign *gs)
2487 return gs->op[1];
2490 static inline tree
2491 gimple_assign_rhs1 (const gimple *gs)
2493 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2494 return gimple_assign_rhs1 (ass);
2498 /* Return a pointer to the first operand on the RHS of assignment
2499 statement GS. */
2501 static inline tree *
2502 gimple_assign_rhs1_ptr (gassign *gs)
2504 return &gs->op[1];
2507 static inline tree *
2508 gimple_assign_rhs1_ptr (gimple *gs)
2510 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2511 return gimple_assign_rhs1_ptr (ass);
2514 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2516 static inline void
2517 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2519 gs->op[1] = rhs;
2522 static inline void
2523 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2525 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2526 gimple_assign_set_rhs1 (ass, rhs);
2530 /* Return the second operand on the RHS of assignment statement GS.
2531 If GS does not have two operands, NULL is returned instead. */
2533 static inline tree
2534 gimple_assign_rhs2 (const gassign *gs)
2536 if (gimple_num_ops (gs) >= 3)
2537 return gs->op[2];
2538 else
2539 return NULL_TREE;
2542 static inline tree
2543 gimple_assign_rhs2 (const gimple *gs)
2545 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2546 return gimple_assign_rhs2 (ass);
2550 /* Return a pointer to the second operand on the RHS of assignment
2551 statement GS. */
2553 static inline tree *
2554 gimple_assign_rhs2_ptr (gassign *gs)
2556 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2557 return &gs->op[2];
2560 static inline tree *
2561 gimple_assign_rhs2_ptr (gimple *gs)
2563 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2564 return gimple_assign_rhs2_ptr (ass);
2568 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2570 static inline void
2571 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2573 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2574 gs->op[2] = rhs;
2577 static inline void
2578 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2580 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2581 return gimple_assign_set_rhs2 (ass, rhs);
2584 /* Return the third operand on the RHS of assignment statement GS.
2585 If GS does not have two operands, NULL is returned instead. */
2587 static inline tree
2588 gimple_assign_rhs3 (const gassign *gs)
2590 if (gimple_num_ops (gs) >= 4)
2591 return gs->op[3];
2592 else
2593 return NULL_TREE;
2596 static inline tree
2597 gimple_assign_rhs3 (const gimple *gs)
2599 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2600 return gimple_assign_rhs3 (ass);
2603 /* Return a pointer to the third operand on the RHS of assignment
2604 statement GS. */
2606 static inline tree *
2607 gimple_assign_rhs3_ptr (gimple *gs)
2609 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2610 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2611 return &ass->op[3];
2615 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2617 static inline void
2618 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2620 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2621 gs->op[3] = rhs;
2624 static inline void
2625 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2627 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2628 gimple_assign_set_rhs3 (ass, rhs);
2632 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2633 which expect to see only two operands. */
2635 static inline void
2636 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2637 tree op1, tree op2)
2639 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2642 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2643 which expect to see only one operands. */
2645 static inline void
2646 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2647 tree op1)
2649 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2652 /* Returns true if GS is a nontemporal move. */
2654 static inline bool
2655 gimple_assign_nontemporal_move_p (const gassign *gs)
2657 return gs->nontemporal_move;
2660 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2662 static inline void
2663 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2665 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2666 gs->nontemporal_move = nontemporal;
2670 /* Return the code of the expression computed on the rhs of assignment
2671 statement GS. In case that the RHS is a single object, returns the
2672 tree code of the object. */
2674 static inline enum tree_code
2675 gimple_assign_rhs_code (const gassign *gs)
2677 enum tree_code code = (enum tree_code) gs->subcode;
2678 /* While we initially set subcode to the TREE_CODE of the rhs for
2679 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2680 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2681 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2682 code = TREE_CODE (gs->op[1]);
2684 return code;
2687 static inline enum tree_code
2688 gimple_assign_rhs_code (const gimple *gs)
2690 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2691 return gimple_assign_rhs_code (ass);
2695 /* Set CODE to be the code for the expression computed on the RHS of
2696 assignment S. */
2698 static inline void
2699 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2701 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2702 s->subcode = code;
2706 /* Return the gimple rhs class of the code of the expression computed on
2707 the rhs of assignment statement GS.
2708 This will never return GIMPLE_INVALID_RHS. */
2710 static inline enum gimple_rhs_class
2711 gimple_assign_rhs_class (const gimple *gs)
2713 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2716 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2717 there is no operator associated with the assignment itself.
2718 Unlike gimple_assign_copy_p, this predicate returns true for
2719 any RHS operand, including those that perform an operation
2720 and do not have the semantics of a copy, such as COND_EXPR. */
2722 static inline bool
2723 gimple_assign_single_p (const gimple *gs)
2725 return (is_gimple_assign (gs)
2726 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2729 /* Return true if GS performs a store to its lhs. */
2731 static inline bool
2732 gimple_store_p (const gimple *gs)
2734 tree lhs = gimple_get_lhs (gs);
2735 return lhs && !is_gimple_reg (lhs);
2738 /* Return true if GS is an assignment that loads from its rhs1. */
2740 static inline bool
2741 gimple_assign_load_p (const gimple *gs)
2743 tree rhs;
2744 if (!gimple_assign_single_p (gs))
2745 return false;
2746 rhs = gimple_assign_rhs1 (gs);
2747 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2748 return true;
2749 rhs = get_base_address (rhs);
2750 return (DECL_P (rhs)
2751 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2755 /* Return true if S is a type-cast assignment. */
2757 static inline bool
2758 gimple_assign_cast_p (const gimple *s)
2760 if (is_gimple_assign (s))
2762 enum tree_code sc = gimple_assign_rhs_code (s);
2763 return CONVERT_EXPR_CODE_P (sc)
2764 || sc == VIEW_CONVERT_EXPR
2765 || sc == FIX_TRUNC_EXPR;
2768 return false;
2771 /* Return true if S is a clobber statement. */
2773 static inline bool
2774 gimple_clobber_p (const gimple *s)
2776 return gimple_assign_single_p (s)
2777 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2780 /* Return true if GS is a GIMPLE_CALL. */
2782 static inline bool
2783 is_gimple_call (const gimple *gs)
2785 return gimple_code (gs) == GIMPLE_CALL;
2788 /* Return the LHS of call statement GS. */
2790 static inline tree
2791 gimple_call_lhs (const gcall *gs)
2793 return gs->op[0];
2796 static inline tree
2797 gimple_call_lhs (const gimple *gs)
2799 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2800 return gimple_call_lhs (gc);
2804 /* Return a pointer to the LHS of call statement GS. */
2806 static inline tree *
2807 gimple_call_lhs_ptr (gcall *gs)
2809 return &gs->op[0];
2812 static inline tree *
2813 gimple_call_lhs_ptr (gimple *gs)
2815 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2816 return gimple_call_lhs_ptr (gc);
2820 /* Set LHS to be the LHS operand of call statement GS. */
2822 static inline void
2823 gimple_call_set_lhs (gcall *gs, tree lhs)
2825 gs->op[0] = lhs;
2826 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2827 SSA_NAME_DEF_STMT (lhs) = gs;
2830 static inline void
2831 gimple_call_set_lhs (gimple *gs, tree lhs)
2833 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2834 gimple_call_set_lhs (gc, lhs);
2838 /* Return true if call GS calls an internal-only function, as enumerated
2839 by internal_fn. */
2841 static inline bool
2842 gimple_call_internal_p (const gcall *gs)
2844 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2847 static inline bool
2848 gimple_call_internal_p (const gimple *gs)
2850 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2851 return gimple_call_internal_p (gc);
2855 /* Return true if call GS is marked as instrumented by
2856 Pointer Bounds Checker. */
2858 static inline bool
2859 gimple_call_with_bounds_p (const gcall *gs)
2861 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2864 static inline bool
2865 gimple_call_with_bounds_p (const gimple *gs)
2867 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2868 return gimple_call_with_bounds_p (gc);
2872 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2873 Pointer Bounds Checker. */
2875 static inline void
2876 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2878 if (with_bounds)
2879 gs->subcode |= GF_CALL_WITH_BOUNDS;
2880 else
2881 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2884 static inline void
2885 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2887 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2888 gimple_call_set_with_bounds (gc, with_bounds);
2892 /* Return the target of internal call GS. */
2894 static inline enum internal_fn
2895 gimple_call_internal_fn (const gcall *gs)
2897 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2898 return gs->u.internal_fn;
2901 static inline enum internal_fn
2902 gimple_call_internal_fn (const gimple *gs)
2904 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2905 return gimple_call_internal_fn (gc);
2908 /* Return true, if this internal gimple call is unique. */
2910 static inline bool
2911 gimple_call_internal_unique_p (const gcall *gs)
2913 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2916 static inline bool
2917 gimple_call_internal_unique_p (const gimple *gs)
2919 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2920 return gimple_call_internal_unique_p (gc);
2923 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2924 that could alter control flow. */
2926 static inline void
2927 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2929 if (ctrl_altering_p)
2930 s->subcode |= GF_CALL_CTRL_ALTERING;
2931 else
2932 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2935 static inline void
2936 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2938 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2939 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2942 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2943 flag is set. Such call could not be a stmt in the middle of a bb. */
2945 static inline bool
2946 gimple_call_ctrl_altering_p (const gcall *gs)
2948 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2951 static inline bool
2952 gimple_call_ctrl_altering_p (const gimple *gs)
2954 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2955 return gimple_call_ctrl_altering_p (gc);
2959 /* Return the function type of the function called by GS. */
2961 static inline tree
2962 gimple_call_fntype (const gcall *gs)
2964 if (gimple_call_internal_p (gs))
2965 return NULL_TREE;
2966 return gs->u.fntype;
2969 static inline tree
2970 gimple_call_fntype (const gimple *gs)
2972 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2973 return gimple_call_fntype (call_stmt);
2976 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2978 static inline void
2979 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2981 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2982 call_stmt->u.fntype = fntype;
2986 /* Return the tree node representing the function called by call
2987 statement GS. */
2989 static inline tree
2990 gimple_call_fn (const gcall *gs)
2992 return gs->op[1];
2995 static inline tree
2996 gimple_call_fn (const gimple *gs)
2998 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2999 return gimple_call_fn (gc);
3002 /* Return a pointer to the tree node representing the function called by call
3003 statement GS. */
3005 static inline tree *
3006 gimple_call_fn_ptr (gcall *gs)
3008 return &gs->op[1];
3011 static inline tree *
3012 gimple_call_fn_ptr (gimple *gs)
3014 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3015 return gimple_call_fn_ptr (gc);
3019 /* Set FN to be the function called by call statement GS. */
3021 static inline void
3022 gimple_call_set_fn (gcall *gs, tree fn)
3024 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3025 gs->op[1] = fn;
3029 /* Set FNDECL to be the function called by call statement GS. */
3031 static inline void
3032 gimple_call_set_fndecl (gcall *gs, tree decl)
3034 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3035 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3036 build_pointer_type (TREE_TYPE (decl)), decl);
3039 static inline void
3040 gimple_call_set_fndecl (gimple *gs, tree decl)
3042 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3043 gimple_call_set_fndecl (gc, decl);
3047 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3049 static inline void
3050 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3052 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3053 call_stmt->u.internal_fn = fn;
3057 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3058 Otherwise return NULL. This function is analogous to
3059 get_callee_fndecl in tree land. */
3061 static inline tree
3062 gimple_call_fndecl (const gcall *gs)
3064 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3067 static inline tree
3068 gimple_call_fndecl (const gimple *gs)
3070 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3071 return gimple_call_fndecl (gc);
3075 /* Return the type returned by call statement GS. */
3077 static inline tree
3078 gimple_call_return_type (const gcall *gs)
3080 tree type = gimple_call_fntype (gs);
3082 if (type == NULL_TREE)
3083 return TREE_TYPE (gimple_call_lhs (gs));
3085 /* The type returned by a function is the type of its
3086 function type. */
3087 return TREE_TYPE (type);
3091 /* Return the static chain for call statement GS. */
3093 static inline tree
3094 gimple_call_chain (const gcall *gs)
3096 return gs->op[2];
3099 static inline tree
3100 gimple_call_chain (const gimple *gs)
3102 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3103 return gimple_call_chain (gc);
3107 /* Return a pointer to the static chain for call statement CALL_STMT. */
3109 static inline tree *
3110 gimple_call_chain_ptr (gcall *call_stmt)
3112 return &call_stmt->op[2];
3115 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3117 static inline void
3118 gimple_call_set_chain (gcall *call_stmt, tree chain)
3120 call_stmt->op[2] = chain;
3124 /* Return the number of arguments used by call statement GS. */
3126 static inline unsigned
3127 gimple_call_num_args (const gcall *gs)
3129 return gimple_num_ops (gs) - 3;
3132 static inline unsigned
3133 gimple_call_num_args (const gimple *gs)
3135 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3136 return gimple_call_num_args (gc);
3140 /* Return the argument at position INDEX for call statement GS. */
3142 static inline tree
3143 gimple_call_arg (const gcall *gs, unsigned index)
3145 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3146 return gs->op[index + 3];
3149 static inline tree
3150 gimple_call_arg (const gimple *gs, unsigned index)
3152 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3153 return gimple_call_arg (gc, index);
3157 /* Return a pointer to the argument at position INDEX for call
3158 statement GS. */
3160 static inline tree *
3161 gimple_call_arg_ptr (gcall *gs, unsigned index)
3163 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3164 return &gs->op[index + 3];
3167 static inline tree *
3168 gimple_call_arg_ptr (gimple *gs, unsigned index)
3170 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3171 return gimple_call_arg_ptr (gc, index);
3175 /* Set ARG to be the argument at position INDEX for call statement GS. */
3177 static inline void
3178 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3180 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3181 gs->op[index + 3] = arg;
3184 static inline void
3185 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3187 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3188 gimple_call_set_arg (gc, index, arg);
3192 /* If TAIL_P is true, mark call statement S as being a tail call
3193 (i.e., a call just before the exit of a function). These calls are
3194 candidate for tail call optimization. */
3196 static inline void
3197 gimple_call_set_tail (gcall *s, bool tail_p)
3199 if (tail_p)
3200 s->subcode |= GF_CALL_TAILCALL;
3201 else
3202 s->subcode &= ~GF_CALL_TAILCALL;
3206 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3208 static inline bool
3209 gimple_call_tail_p (gcall *s)
3211 return (s->subcode & GF_CALL_TAILCALL) != 0;
3214 /* Mark (or clear) call statement S as requiring tail call optimization. */
3216 static inline void
3217 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3219 if (must_tail_p)
3220 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3221 else
3222 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3225 /* Return true if call statement has been marked as requiring
3226 tail call optimization. */
3228 static inline bool
3229 gimple_call_must_tail_p (const gcall *s)
3231 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3234 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3235 slot optimization. This transformation uses the target of the call
3236 expansion as the return slot for calls that return in memory. */
3238 static inline void
3239 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3241 if (return_slot_opt_p)
3242 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3243 else
3244 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3248 /* Return true if S is marked for return slot optimization. */
3250 static inline bool
3251 gimple_call_return_slot_opt_p (gcall *s)
3253 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3257 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3258 thunk to the thunked-to function. */
3260 static inline void
3261 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3263 if (from_thunk_p)
3264 s->subcode |= GF_CALL_FROM_THUNK;
3265 else
3266 s->subcode &= ~GF_CALL_FROM_THUNK;
3270 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3272 static inline bool
3273 gimple_call_from_thunk_p (gcall *s)
3275 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3279 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3280 argument pack in its argument list. */
3282 static inline void
3283 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3285 if (pass_arg_pack_p)
3286 s->subcode |= GF_CALL_VA_ARG_PACK;
3287 else
3288 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3292 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3293 argument pack in its argument list. */
3295 static inline bool
3296 gimple_call_va_arg_pack_p (gcall *s)
3298 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3302 /* Return true if S is a noreturn call. */
3304 static inline bool
3305 gimple_call_noreturn_p (const gcall *s)
3307 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3310 static inline bool
3311 gimple_call_noreturn_p (const gimple *s)
3313 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3314 return gimple_call_noreturn_p (gc);
3318 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3319 even if the called function can throw in other cases. */
3321 static inline void
3322 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3324 if (nothrow_p)
3325 s->subcode |= GF_CALL_NOTHROW;
3326 else
3327 s->subcode &= ~GF_CALL_NOTHROW;
3330 /* Return true if S is a nothrow call. */
3332 static inline bool
3333 gimple_call_nothrow_p (gcall *s)
3335 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3338 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3339 is known to be emitted for VLA objects. Those are wrapped by
3340 stack_save/stack_restore calls and hence can't lead to unbounded
3341 stack growth even when they occur in loops. */
3343 static inline void
3344 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3346 if (for_var)
3347 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3348 else
3349 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3352 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3354 static inline bool
3355 gimple_call_alloca_for_var_p (gcall *s)
3357 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3360 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3362 static inline void
3363 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3365 dest_call->subcode = orig_call->subcode;
3369 /* Return a pointer to the points-to solution for the set of call-used
3370 variables of the call CALL_STMT. */
3372 static inline struct pt_solution *
3373 gimple_call_use_set (gcall *call_stmt)
3375 return &call_stmt->call_used;
3379 /* Return a pointer to the points-to solution for the set of call-used
3380 variables of the call CALL_STMT. */
3382 static inline struct pt_solution *
3383 gimple_call_clobber_set (gcall *call_stmt)
3385 return &call_stmt->call_clobbered;
3389 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3390 non-NULL lhs. */
3392 static inline bool
3393 gimple_has_lhs (gimple *stmt)
3395 if (is_gimple_assign (stmt))
3396 return true;
3397 if (gcall *call = dyn_cast <gcall *> (stmt))
3398 return gimple_call_lhs (call) != NULL_TREE;
3399 return false;
3403 /* Return the code of the predicate computed by conditional statement GS. */
3405 static inline enum tree_code
3406 gimple_cond_code (const gcond *gs)
3408 return (enum tree_code) gs->subcode;
3411 static inline enum tree_code
3412 gimple_cond_code (const gimple *gs)
3414 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3415 return gimple_cond_code (gc);
3419 /* Set CODE to be the predicate code for the conditional statement GS. */
3421 static inline void
3422 gimple_cond_set_code (gcond *gs, enum tree_code code)
3424 gs->subcode = code;
3428 /* Return the LHS of the predicate computed by conditional statement GS. */
3430 static inline tree
3431 gimple_cond_lhs (const gcond *gs)
3433 return gs->op[0];
3436 static inline tree
3437 gimple_cond_lhs (const gimple *gs)
3439 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3440 return gimple_cond_lhs (gc);
3443 /* Return the pointer to the LHS of the predicate computed by conditional
3444 statement GS. */
3446 static inline tree *
3447 gimple_cond_lhs_ptr (gcond *gs)
3449 return &gs->op[0];
3452 /* Set LHS to be the LHS operand of the predicate computed by
3453 conditional statement GS. */
3455 static inline void
3456 gimple_cond_set_lhs (gcond *gs, tree lhs)
3458 gs->op[0] = lhs;
3462 /* Return the RHS operand of the predicate computed by conditional GS. */
3464 static inline tree
3465 gimple_cond_rhs (const gcond *gs)
3467 return gs->op[1];
3470 static inline tree
3471 gimple_cond_rhs (const gimple *gs)
3473 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3474 return gimple_cond_rhs (gc);
3477 /* Return the pointer to the RHS operand of the predicate computed by
3478 conditional GS. */
3480 static inline tree *
3481 gimple_cond_rhs_ptr (gcond *gs)
3483 return &gs->op[1];
3487 /* Set RHS to be the RHS operand of the predicate computed by
3488 conditional statement GS. */
3490 static inline void
3491 gimple_cond_set_rhs (gcond *gs, tree rhs)
3493 gs->op[1] = rhs;
3497 /* Return the label used by conditional statement GS when its
3498 predicate evaluates to true. */
3500 static inline tree
3501 gimple_cond_true_label (const gcond *gs)
3503 return gs->op[2];
3507 /* Set LABEL to be the label used by conditional statement GS when its
3508 predicate evaluates to true. */
3510 static inline void
3511 gimple_cond_set_true_label (gcond *gs, tree label)
3513 gs->op[2] = label;
3517 /* Set LABEL to be the label used by conditional statement GS when its
3518 predicate evaluates to false. */
3520 static inline void
3521 gimple_cond_set_false_label (gcond *gs, tree label)
3523 gs->op[3] = label;
3527 /* Return the label used by conditional statement GS when its
3528 predicate evaluates to false. */
3530 static inline tree
3531 gimple_cond_false_label (const gcond *gs)
3533 return gs->op[3];
3537 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3539 static inline void
3540 gimple_cond_make_false (gcond *gs)
3542 gimple_cond_set_lhs (gs, boolean_false_node);
3543 gimple_cond_set_rhs (gs, boolean_false_node);
3544 gs->subcode = NE_EXPR;
3548 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3550 static inline void
3551 gimple_cond_make_true (gcond *gs)
3553 gimple_cond_set_lhs (gs, boolean_true_node);
3554 gimple_cond_set_rhs (gs, boolean_false_node);
3555 gs->subcode = NE_EXPR;
3558 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3559 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3561 static inline bool
3562 gimple_cond_true_p (const gcond *gs)
3564 tree lhs = gimple_cond_lhs (gs);
3565 tree rhs = gimple_cond_rhs (gs);
3566 enum tree_code code = gimple_cond_code (gs);
3568 if (lhs != boolean_true_node && lhs != boolean_false_node)
3569 return false;
3571 if (rhs != boolean_true_node && rhs != boolean_false_node)
3572 return false;
3574 if (code == NE_EXPR && lhs != rhs)
3575 return true;
3577 if (code == EQ_EXPR && lhs == rhs)
3578 return true;
3580 return false;
3583 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3584 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3586 static inline bool
3587 gimple_cond_false_p (const gcond *gs)
3589 tree lhs = gimple_cond_lhs (gs);
3590 tree rhs = gimple_cond_rhs (gs);
3591 enum tree_code code = gimple_cond_code (gs);
3593 if (lhs != boolean_true_node && lhs != boolean_false_node)
3594 return false;
3596 if (rhs != boolean_true_node && rhs != boolean_false_node)
3597 return false;
3599 if (code == NE_EXPR && lhs == rhs)
3600 return true;
3602 if (code == EQ_EXPR && lhs != rhs)
3603 return true;
3605 return false;
3608 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3610 static inline void
3611 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3612 tree rhs)
3614 gimple_cond_set_code (stmt, code);
3615 gimple_cond_set_lhs (stmt, lhs);
3616 gimple_cond_set_rhs (stmt, rhs);
3619 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3621 static inline tree
3622 gimple_label_label (const glabel *gs)
3624 return gs->op[0];
3628 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3629 GS. */
3631 static inline void
3632 gimple_label_set_label (glabel *gs, tree label)
3634 gs->op[0] = label;
3638 /* Return the destination of the unconditional jump GS. */
3640 static inline tree
3641 gimple_goto_dest (const gimple *gs)
3643 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3644 return gimple_op (gs, 0);
3648 /* Set DEST to be the destination of the unconditonal jump GS. */
3650 static inline void
3651 gimple_goto_set_dest (ggoto *gs, tree dest)
3653 gs->op[0] = dest;
3657 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3659 static inline tree
3660 gimple_bind_vars (const gbind *bind_stmt)
3662 return bind_stmt->vars;
3666 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3667 statement GS. */
3669 static inline void
3670 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3672 bind_stmt->vars = vars;
3676 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3677 statement GS. */
3679 static inline void
3680 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3682 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3686 static inline gimple_seq *
3687 gimple_bind_body_ptr (gbind *bind_stmt)
3689 return &bind_stmt->body;
3692 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3694 static inline gimple_seq
3695 gimple_bind_body (gbind *gs)
3697 return *gimple_bind_body_ptr (gs);
3701 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3702 statement GS. */
3704 static inline void
3705 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3707 bind_stmt->body = seq;
3711 /* Append a statement to the end of a GIMPLE_BIND's body. */
3713 static inline void
3714 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3716 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3720 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3722 static inline void
3723 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3725 gimple_seq_add_seq (&bind_stmt->body, seq);
3729 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3730 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3732 static inline tree
3733 gimple_bind_block (const gbind *bind_stmt)
3735 return bind_stmt->block;
3739 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3740 statement GS. */
3742 static inline void
3743 gimple_bind_set_block (gbind *bind_stmt, tree block)
3745 gcc_gimple_checking_assert (block == NULL_TREE
3746 || TREE_CODE (block) == BLOCK);
3747 bind_stmt->block = block;
3751 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3753 static inline unsigned
3754 gimple_asm_ninputs (const gasm *asm_stmt)
3756 return asm_stmt->ni;
3760 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3762 static inline unsigned
3763 gimple_asm_noutputs (const gasm *asm_stmt)
3765 return asm_stmt->no;
3769 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3771 static inline unsigned
3772 gimple_asm_nclobbers (const gasm *asm_stmt)
3774 return asm_stmt->nc;
3777 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3779 static inline unsigned
3780 gimple_asm_nlabels (const gasm *asm_stmt)
3782 return asm_stmt->nl;
3785 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3787 static inline tree
3788 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3790 gcc_gimple_checking_assert (index < asm_stmt->ni);
3791 return asm_stmt->op[index + asm_stmt->no];
3794 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3796 static inline void
3797 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3799 gcc_gimple_checking_assert (index < asm_stmt->ni
3800 && TREE_CODE (in_op) == TREE_LIST);
3801 asm_stmt->op[index + asm_stmt->no] = in_op;
3805 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3807 static inline tree
3808 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3810 gcc_gimple_checking_assert (index < asm_stmt->no);
3811 return asm_stmt->op[index];
3814 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3816 static inline void
3817 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3819 gcc_gimple_checking_assert (index < asm_stmt->no
3820 && TREE_CODE (out_op) == TREE_LIST);
3821 asm_stmt->op[index] = out_op;
3825 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3827 static inline tree
3828 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3830 gcc_gimple_checking_assert (index < asm_stmt->nc);
3831 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3835 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3837 static inline void
3838 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3840 gcc_gimple_checking_assert (index < asm_stmt->nc
3841 && TREE_CODE (clobber_op) == TREE_LIST);
3842 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3845 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3847 static inline tree
3848 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3850 gcc_gimple_checking_assert (index < asm_stmt->nl);
3851 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3854 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3856 static inline void
3857 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3859 gcc_gimple_checking_assert (index < asm_stmt->nl
3860 && TREE_CODE (label_op) == TREE_LIST);
3861 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3864 /* Return the string representing the assembly instruction in
3865 GIMPLE_ASM ASM_STMT. */
3867 static inline const char *
3868 gimple_asm_string (const gasm *asm_stmt)
3870 return asm_stmt->string;
3874 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3876 static inline bool
3877 gimple_asm_volatile_p (const gasm *asm_stmt)
3879 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3883 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3885 static inline void
3886 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3888 if (volatile_p)
3889 asm_stmt->subcode |= GF_ASM_VOLATILE;
3890 else
3891 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3895 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3897 static inline void
3898 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3900 if (input_p)
3901 asm_stmt->subcode |= GF_ASM_INPUT;
3902 else
3903 asm_stmt->subcode &= ~GF_ASM_INPUT;
3907 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3909 static inline bool
3910 gimple_asm_input_p (const gasm *asm_stmt)
3912 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3916 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3918 static inline tree
3919 gimple_catch_types (const gcatch *catch_stmt)
3921 return catch_stmt->types;
3925 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3927 static inline tree *
3928 gimple_catch_types_ptr (gcatch *catch_stmt)
3930 return &catch_stmt->types;
3934 /* Return a pointer to the GIMPLE sequence representing the body of
3935 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3937 static inline gimple_seq *
3938 gimple_catch_handler_ptr (gcatch *catch_stmt)
3940 return &catch_stmt->handler;
3944 /* Return the GIMPLE sequence representing the body of the handler of
3945 GIMPLE_CATCH statement CATCH_STMT. */
3947 static inline gimple_seq
3948 gimple_catch_handler (gcatch *catch_stmt)
3950 return *gimple_catch_handler_ptr (catch_stmt);
3954 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3956 static inline void
3957 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3959 catch_stmt->types = t;
3963 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3965 static inline void
3966 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3968 catch_stmt->handler = handler;
3972 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3974 static inline tree
3975 gimple_eh_filter_types (const gimple *gs)
3977 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3978 return eh_filter_stmt->types;
3982 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3983 GS. */
3985 static inline tree *
3986 gimple_eh_filter_types_ptr (gimple *gs)
3988 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3989 return &eh_filter_stmt->types;
3993 /* Return a pointer to the sequence of statement to execute when
3994 GIMPLE_EH_FILTER statement fails. */
3996 static inline gimple_seq *
3997 gimple_eh_filter_failure_ptr (gimple *gs)
3999 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4000 return &eh_filter_stmt->failure;
4004 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4005 statement fails. */
4007 static inline gimple_seq
4008 gimple_eh_filter_failure (gimple *gs)
4010 return *gimple_eh_filter_failure_ptr (gs);
4014 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4015 EH_FILTER_STMT. */
4017 static inline void
4018 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4020 eh_filter_stmt->types = types;
4024 /* Set FAILURE to be the sequence of statements to execute on failure
4025 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4027 static inline void
4028 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4029 gimple_seq failure)
4031 eh_filter_stmt->failure = failure;
4034 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4036 static inline tree
4037 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4039 return eh_mnt_stmt->fndecl;
4042 /* Set the function decl to be called by GS to DECL. */
4044 static inline void
4045 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4046 tree decl)
4048 eh_mnt_stmt->fndecl = decl;
4051 /* GIMPLE_EH_ELSE accessors. */
4053 static inline gimple_seq *
4054 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4056 return &eh_else_stmt->n_body;
4059 static inline gimple_seq
4060 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4062 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4065 static inline gimple_seq *
4066 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4068 return &eh_else_stmt->e_body;
4071 static inline gimple_seq
4072 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4074 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4077 static inline void
4078 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4080 eh_else_stmt->n_body = seq;
4083 static inline void
4084 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4086 eh_else_stmt->e_body = seq;
4089 /* GIMPLE_TRY accessors. */
4091 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4092 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4094 static inline enum gimple_try_flags
4095 gimple_try_kind (const gimple *gs)
4097 GIMPLE_CHECK (gs, GIMPLE_TRY);
4098 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4102 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4104 static inline void
4105 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4107 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4108 || kind == GIMPLE_TRY_FINALLY);
4109 if (gimple_try_kind (gs) != kind)
4110 gs->subcode = (unsigned int) kind;
4114 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4116 static inline bool
4117 gimple_try_catch_is_cleanup (const gimple *gs)
4119 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4120 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4124 /* Return a pointer to the sequence of statements used as the
4125 body for GIMPLE_TRY GS. */
4127 static inline gimple_seq *
4128 gimple_try_eval_ptr (gimple *gs)
4130 gtry *try_stmt = as_a <gtry *> (gs);
4131 return &try_stmt->eval;
4135 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4137 static inline gimple_seq
4138 gimple_try_eval (gimple *gs)
4140 return *gimple_try_eval_ptr (gs);
4144 /* Return a pointer to the sequence of statements used as the cleanup body for
4145 GIMPLE_TRY GS. */
4147 static inline gimple_seq *
4148 gimple_try_cleanup_ptr (gimple *gs)
4150 gtry *try_stmt = as_a <gtry *> (gs);
4151 return &try_stmt->cleanup;
4155 /* Return the sequence of statements used as the cleanup body for
4156 GIMPLE_TRY GS. */
4158 static inline gimple_seq
4159 gimple_try_cleanup (gimple *gs)
4161 return *gimple_try_cleanup_ptr (gs);
4165 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4167 static inline void
4168 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4170 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4171 if (catch_is_cleanup)
4172 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4173 else
4174 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4178 /* Set EVAL to be the sequence of statements to use as the body for
4179 GIMPLE_TRY TRY_STMT. */
4181 static inline void
4182 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4184 try_stmt->eval = eval;
4188 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4189 body for GIMPLE_TRY TRY_STMT. */
4191 static inline void
4192 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4194 try_stmt->cleanup = cleanup;
4198 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4200 static inline gimple_seq *
4201 gimple_wce_cleanup_ptr (gimple *gs)
4203 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4204 return &wce_stmt->cleanup;
4208 /* Return the cleanup sequence for cleanup statement GS. */
4210 static inline gimple_seq
4211 gimple_wce_cleanup (gimple *gs)
4213 return *gimple_wce_cleanup_ptr (gs);
4217 /* Set CLEANUP to be the cleanup sequence for GS. */
4219 static inline void
4220 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4222 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4223 wce_stmt->cleanup = cleanup;
4227 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4229 static inline bool
4230 gimple_wce_cleanup_eh_only (const gimple *gs)
4232 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4233 return gs->subcode != 0;
4237 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4239 static inline void
4240 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4242 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4243 gs->subcode = (unsigned int) eh_only_p;
4247 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4249 static inline unsigned
4250 gimple_phi_capacity (const gimple *gs)
4252 const gphi *phi_stmt = as_a <const gphi *> (gs);
4253 return phi_stmt->capacity;
4257 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4258 be exactly the number of incoming edges for the basic block holding
4259 GS. */
4261 static inline unsigned
4262 gimple_phi_num_args (const gimple *gs)
4264 const gphi *phi_stmt = as_a <const gphi *> (gs);
4265 return phi_stmt->nargs;
4269 /* Return the SSA name created by GIMPLE_PHI GS. */
4271 static inline tree
4272 gimple_phi_result (const gimple *gs)
4274 const gphi *phi_stmt = as_a <const gphi *> (gs);
4275 return phi_stmt->result;
4278 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4280 static inline tree *
4281 gimple_phi_result_ptr (gimple *gs)
4283 gphi *phi_stmt = as_a <gphi *> (gs);
4284 return &phi_stmt->result;
4287 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4289 static inline void
4290 gimple_phi_set_result (gphi *phi, tree result)
4292 phi->result = result;
4293 if (result && TREE_CODE (result) == SSA_NAME)
4294 SSA_NAME_DEF_STMT (result) = phi;
4298 /* Return the PHI argument corresponding to incoming edge INDEX for
4299 GIMPLE_PHI GS. */
4301 static inline struct phi_arg_d *
4302 gimple_phi_arg (gimple *gs, unsigned index)
4304 gphi *phi_stmt = as_a <gphi *> (gs);
4305 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4306 return &(phi_stmt->args[index]);
4309 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4310 for GIMPLE_PHI PHI. */
4312 static inline void
4313 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4315 gcc_gimple_checking_assert (index <= phi->nargs);
4316 phi->args[index] = *phiarg;
4319 /* Return the PHI nodes for basic block BB, or NULL if there are no
4320 PHI nodes. */
4322 static inline gimple_seq
4323 phi_nodes (const_basic_block bb)
4325 gcc_checking_assert (!(bb->flags & BB_RTL));
4326 return bb->il.gimple.phi_nodes;
4329 /* Return a pointer to the PHI nodes for basic block BB. */
4331 static inline gimple_seq *
4332 phi_nodes_ptr (basic_block bb)
4334 gcc_checking_assert (!(bb->flags & BB_RTL));
4335 return &bb->il.gimple.phi_nodes;
4338 /* Return the tree operand for argument I of PHI node GS. */
4340 static inline tree
4341 gimple_phi_arg_def (gimple *gs, size_t index)
4343 return gimple_phi_arg (gs, index)->def;
4347 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4349 static inline tree *
4350 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4352 return &gimple_phi_arg (phi, index)->def;
4355 /* Return the edge associated with argument I of phi node PHI. */
4357 static inline edge
4358 gimple_phi_arg_edge (gphi *phi, size_t i)
4360 return EDGE_PRED (gimple_bb (phi), i);
4363 /* Return the source location of gimple argument I of phi node PHI. */
4365 static inline source_location
4366 gimple_phi_arg_location (gphi *phi, size_t i)
4368 return gimple_phi_arg (phi, i)->locus;
4371 /* Return the source location of the argument on edge E of phi node PHI. */
4373 static inline source_location
4374 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4376 return gimple_phi_arg (phi, e->dest_idx)->locus;
4379 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4381 static inline void
4382 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4384 gimple_phi_arg (phi, i)->locus = loc;
4387 /* Return TRUE if argument I of phi node PHI has a location record. */
4389 static inline bool
4390 gimple_phi_arg_has_location (gphi *phi, size_t i)
4392 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4396 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4398 static inline int
4399 gimple_resx_region (const gresx *resx_stmt)
4401 return resx_stmt->region;
4404 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4406 static inline void
4407 gimple_resx_set_region (gresx *resx_stmt, int region)
4409 resx_stmt->region = region;
4412 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4414 static inline int
4415 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4417 return eh_dispatch_stmt->region;
4420 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4421 EH_DISPATCH_STMT. */
4423 static inline void
4424 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4426 eh_dispatch_stmt->region = region;
4429 /* Return the number of labels associated with the switch statement GS. */
4431 static inline unsigned
4432 gimple_switch_num_labels (const gswitch *gs)
4434 unsigned num_ops;
4435 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4436 num_ops = gimple_num_ops (gs);
4437 gcc_gimple_checking_assert (num_ops > 1);
4438 return num_ops - 1;
4442 /* Set NLABELS to be the number of labels for the switch statement GS. */
4444 static inline void
4445 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4447 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4448 gimple_set_num_ops (g, nlabels + 1);
4452 /* Return the index variable used by the switch statement GS. */
4454 static inline tree
4455 gimple_switch_index (const gswitch *gs)
4457 return gs->op[0];
4461 /* Return a pointer to the index variable for the switch statement GS. */
4463 static inline tree *
4464 gimple_switch_index_ptr (gswitch *gs)
4466 return &gs->op[0];
4470 /* Set INDEX to be the index variable for switch statement GS. */
4472 static inline void
4473 gimple_switch_set_index (gswitch *gs, tree index)
4475 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4476 gs->op[0] = index;
4480 /* Return the label numbered INDEX. The default label is 0, followed by any
4481 labels in a switch statement. */
4483 static inline tree
4484 gimple_switch_label (const gswitch *gs, unsigned index)
4486 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4487 return gs->op[index + 1];
4490 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4492 static inline void
4493 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4495 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4496 && (label == NULL_TREE
4497 || TREE_CODE (label) == CASE_LABEL_EXPR));
4498 gs->op[index + 1] = label;
4501 /* Return the default label for a switch statement. */
4503 static inline tree
4504 gimple_switch_default_label (const gswitch *gs)
4506 tree label = gimple_switch_label (gs, 0);
4507 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4508 return label;
4511 /* Set the default label for a switch statement. */
4513 static inline void
4514 gimple_switch_set_default_label (gswitch *gs, tree label)
4516 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4517 gimple_switch_set_label (gs, 0, label);
4520 /* Return true if GS is a GIMPLE_DEBUG statement. */
4522 static inline bool
4523 is_gimple_debug (const gimple *gs)
4525 return gimple_code (gs) == GIMPLE_DEBUG;
4528 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4530 static inline bool
4531 gimple_debug_bind_p (const gimple *s)
4533 if (is_gimple_debug (s))
4534 return s->subcode == GIMPLE_DEBUG_BIND;
4536 return false;
4539 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4541 static inline tree
4542 gimple_debug_bind_get_var (gimple *dbg)
4544 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4545 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4546 return gimple_op (dbg, 0);
4549 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4550 statement. */
4552 static inline tree
4553 gimple_debug_bind_get_value (gimple *dbg)
4555 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4556 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4557 return gimple_op (dbg, 1);
4560 /* Return a pointer to the value bound to the variable in a
4561 GIMPLE_DEBUG bind statement. */
4563 static inline tree *
4564 gimple_debug_bind_get_value_ptr (gimple *dbg)
4566 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4567 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4568 return gimple_op_ptr (dbg, 1);
4571 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4573 static inline void
4574 gimple_debug_bind_set_var (gimple *dbg, tree var)
4576 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4577 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4578 gimple_set_op (dbg, 0, var);
4581 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4582 statement. */
4584 static inline void
4585 gimple_debug_bind_set_value (gimple *dbg, tree value)
4587 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4588 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4589 gimple_set_op (dbg, 1, value);
4592 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4593 optimized away. */
4594 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4596 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4597 statement. */
4599 static inline void
4600 gimple_debug_bind_reset_value (gimple *dbg)
4602 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4603 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4604 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4607 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4608 value. */
4610 static inline bool
4611 gimple_debug_bind_has_value_p (gimple *dbg)
4613 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4614 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4615 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4618 #undef GIMPLE_DEBUG_BIND_NOVALUE
4620 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4622 static inline bool
4623 gimple_debug_source_bind_p (const gimple *s)
4625 if (is_gimple_debug (s))
4626 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4628 return false;
4631 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4633 static inline tree
4634 gimple_debug_source_bind_get_var (gimple *dbg)
4636 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4637 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4638 return gimple_op (dbg, 0);
4641 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4642 statement. */
4644 static inline tree
4645 gimple_debug_source_bind_get_value (gimple *dbg)
4647 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4648 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4649 return gimple_op (dbg, 1);
4652 /* Return a pointer to the value bound to the variable in a
4653 GIMPLE_DEBUG source bind statement. */
4655 static inline tree *
4656 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4658 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4659 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4660 return gimple_op_ptr (dbg, 1);
4663 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4665 static inline void
4666 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4668 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4669 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4670 gimple_set_op (dbg, 0, var);
4673 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4674 statement. */
4676 static inline void
4677 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4679 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4680 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4681 gimple_set_op (dbg, 1, value);
4684 /* Return the line number for EXPR, or return -1 if we have no line
4685 number information for it. */
4686 static inline int
4687 get_lineno (const gimple *stmt)
4689 location_t loc;
4691 if (!stmt)
4692 return -1;
4694 loc = gimple_location (stmt);
4695 if (loc == UNKNOWN_LOCATION)
4696 return -1;
4698 return LOCATION_LINE (loc);
4701 /* Return a pointer to the body for the OMP statement GS. */
4703 static inline gimple_seq *
4704 gimple_omp_body_ptr (gimple *gs)
4706 return &static_cast <gimple_statement_omp *> (gs)->body;
4709 /* Return the body for the OMP statement GS. */
4711 static inline gimple_seq
4712 gimple_omp_body (gimple *gs)
4714 return *gimple_omp_body_ptr (gs);
4717 /* Set BODY to be the body for the OMP statement GS. */
4719 static inline void
4720 gimple_omp_set_body (gimple *gs, gimple_seq body)
4722 static_cast <gimple_statement_omp *> (gs)->body = body;
4726 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4728 static inline tree
4729 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4731 return crit_stmt->name;
4735 /* Return a pointer to the name associated with OMP critical statement
4736 CRIT_STMT. */
4738 static inline tree *
4739 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4741 return &crit_stmt->name;
4745 /* Set NAME to be the name associated with OMP critical statement
4746 CRIT_STMT. */
4748 static inline void
4749 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4751 crit_stmt->name = name;
4755 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4757 static inline tree
4758 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4760 return crit_stmt->clauses;
4764 /* Return a pointer to the clauses associated with OMP critical statement
4765 CRIT_STMT. */
4767 static inline tree *
4768 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4770 return &crit_stmt->clauses;
4774 /* Set CLAUSES to be the clauses associated with OMP critical statement
4775 CRIT_STMT. */
4777 static inline void
4778 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4780 crit_stmt->clauses = clauses;
4784 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4786 static inline tree
4787 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4789 return ord_stmt->clauses;
4793 /* Return a pointer to the clauses associated with OMP ordered statement
4794 ORD_STMT. */
4796 static inline tree *
4797 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4799 return &ord_stmt->clauses;
4803 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4804 ORD_STMT. */
4806 static inline void
4807 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4809 ord_stmt->clauses = clauses;
4813 /* Return the kind of the OMP_FOR statemement G. */
4815 static inline int
4816 gimple_omp_for_kind (const gimple *g)
4818 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4819 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4823 /* Set the kind of the OMP_FOR statement G. */
4825 static inline void
4826 gimple_omp_for_set_kind (gomp_for *g, int kind)
4828 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4829 | (kind & GF_OMP_FOR_KIND_MASK);
4833 /* Return true if OMP_FOR statement G has the
4834 GF_OMP_FOR_COMBINED flag set. */
4836 static inline bool
4837 gimple_omp_for_combined_p (const gimple *g)
4839 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4840 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4844 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4845 the boolean value of COMBINED_P. */
4847 static inline void
4848 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4850 if (combined_p)
4851 g->subcode |= GF_OMP_FOR_COMBINED;
4852 else
4853 g->subcode &= ~GF_OMP_FOR_COMBINED;
4857 /* Return true if the OMP_FOR statement G has the
4858 GF_OMP_FOR_COMBINED_INTO flag set. */
4860 static inline bool
4861 gimple_omp_for_combined_into_p (const gimple *g)
4863 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4864 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4868 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4869 on the boolean value of COMBINED_P. */
4871 static inline void
4872 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4874 if (combined_p)
4875 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4876 else
4877 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4881 /* Return the clauses associated with the OMP_FOR statement GS. */
4883 static inline tree
4884 gimple_omp_for_clauses (const gimple *gs)
4886 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4887 return omp_for_stmt->clauses;
4891 /* Return a pointer to the clauses associated with the OMP_FOR statement
4892 GS. */
4894 static inline tree *
4895 gimple_omp_for_clauses_ptr (gimple *gs)
4897 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4898 return &omp_for_stmt->clauses;
4902 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4903 GS. */
4905 static inline void
4906 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4908 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4909 omp_for_stmt->clauses = clauses;
4913 /* Get the collapse count of the OMP_FOR statement GS. */
4915 static inline size_t
4916 gimple_omp_for_collapse (gimple *gs)
4918 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4919 return omp_for_stmt->collapse;
4923 /* Return the condition code associated with the OMP_FOR statement GS. */
4925 static inline enum tree_code
4926 gimple_omp_for_cond (const gimple *gs, size_t i)
4928 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4929 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4930 return omp_for_stmt->iter[i].cond;
4934 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4936 static inline void
4937 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4939 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4940 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4941 && i < omp_for_stmt->collapse);
4942 omp_for_stmt->iter[i].cond = cond;
4946 /* Return the index variable for the OMP_FOR statement GS. */
4948 static inline tree
4949 gimple_omp_for_index (const gimple *gs, size_t i)
4951 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4952 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4953 return omp_for_stmt->iter[i].index;
4957 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4959 static inline tree *
4960 gimple_omp_for_index_ptr (gimple *gs, size_t i)
4962 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4963 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4964 return &omp_for_stmt->iter[i].index;
4968 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4970 static inline void
4971 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
4973 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4974 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4975 omp_for_stmt->iter[i].index = index;
4979 /* Return the initial value for the OMP_FOR statement GS. */
4981 static inline tree
4982 gimple_omp_for_initial (const gimple *gs, size_t i)
4984 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4985 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4986 return omp_for_stmt->iter[i].initial;
4990 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4992 static inline tree *
4993 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
4995 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4996 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4997 return &omp_for_stmt->iter[i].initial;
5001 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5003 static inline void
5004 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5006 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5007 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5008 omp_for_stmt->iter[i].initial = initial;
5012 /* Return the final value for the OMP_FOR statement GS. */
5014 static inline tree
5015 gimple_omp_for_final (const gimple *gs, size_t i)
5017 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5018 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5019 return omp_for_stmt->iter[i].final;
5023 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5025 static inline tree *
5026 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5028 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5029 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5030 return &omp_for_stmt->iter[i].final;
5034 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5036 static inline void
5037 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5039 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5040 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5041 omp_for_stmt->iter[i].final = final;
5045 /* Return the increment value for the OMP_FOR statement GS. */
5047 static inline tree
5048 gimple_omp_for_incr (const gimple *gs, size_t i)
5050 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5051 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5052 return omp_for_stmt->iter[i].incr;
5056 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5058 static inline tree *
5059 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5061 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5062 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5063 return &omp_for_stmt->iter[i].incr;
5067 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5069 static inline void
5070 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5072 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5073 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5074 omp_for_stmt->iter[i].incr = incr;
5078 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5079 statement GS starts. */
5081 static inline gimple_seq *
5082 gimple_omp_for_pre_body_ptr (gimple *gs)
5084 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5085 return &omp_for_stmt->pre_body;
5089 /* Return the sequence of statements to execute before the OMP_FOR
5090 statement GS starts. */
5092 static inline gimple_seq
5093 gimple_omp_for_pre_body (gimple *gs)
5095 return *gimple_omp_for_pre_body_ptr (gs);
5099 /* Set PRE_BODY to be the sequence of statements to execute before the
5100 OMP_FOR statement GS starts. */
5102 static inline void
5103 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5105 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5106 omp_for_stmt->pre_body = pre_body;
5109 /* Return the kernel_phony of OMP_FOR statement. */
5111 static inline bool
5112 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5114 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5117 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5119 static inline void
5120 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5122 if (value)
5123 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5124 else
5125 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5128 /* Return the clauses associated with OMP_PARALLEL GS. */
5130 static inline tree
5131 gimple_omp_parallel_clauses (const gimple *gs)
5133 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5134 return omp_parallel_stmt->clauses;
5138 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5140 static inline tree *
5141 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5143 return &omp_parallel_stmt->clauses;
5147 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5149 static inline void
5150 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5151 tree clauses)
5153 omp_parallel_stmt->clauses = clauses;
5157 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5159 static inline tree
5160 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5162 return omp_parallel_stmt->child_fn;
5165 /* Return a pointer to the child function used to hold the body of
5166 OMP_PARALLEL_STMT. */
5168 static inline tree *
5169 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5171 return &omp_parallel_stmt->child_fn;
5175 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5177 static inline void
5178 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5179 tree child_fn)
5181 omp_parallel_stmt->child_fn = child_fn;
5185 /* Return the artificial argument used to send variables and values
5186 from the parent to the children threads in OMP_PARALLEL_STMT. */
5188 static inline tree
5189 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5191 return omp_parallel_stmt->data_arg;
5195 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5197 static inline tree *
5198 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5200 return &omp_parallel_stmt->data_arg;
5204 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5206 static inline void
5207 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5208 tree data_arg)
5210 omp_parallel_stmt->data_arg = data_arg;
5213 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5215 static inline bool
5216 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5218 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5221 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5223 static inline void
5224 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5226 if (value)
5227 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5228 else
5229 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5232 /* Return the clauses associated with OMP_TASK GS. */
5234 static inline tree
5235 gimple_omp_task_clauses (const gimple *gs)
5237 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5238 return omp_task_stmt->clauses;
5242 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5244 static inline tree *
5245 gimple_omp_task_clauses_ptr (gimple *gs)
5247 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5248 return &omp_task_stmt->clauses;
5252 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5253 GS. */
5255 static inline void
5256 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5258 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5259 omp_task_stmt->clauses = clauses;
5263 /* Return true if OMP task statement G has the
5264 GF_OMP_TASK_TASKLOOP flag set. */
5266 static inline bool
5267 gimple_omp_task_taskloop_p (const gimple *g)
5269 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5270 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5274 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5275 value of TASKLOOP_P. */
5277 static inline void
5278 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5280 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5281 if (taskloop_p)
5282 g->subcode |= GF_OMP_TASK_TASKLOOP;
5283 else
5284 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5288 /* Return the child function used to hold the body of OMP_TASK GS. */
5290 static inline tree
5291 gimple_omp_task_child_fn (const gimple *gs)
5293 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5294 return omp_task_stmt->child_fn;
5297 /* Return a pointer to the child function used to hold the body of
5298 OMP_TASK GS. */
5300 static inline tree *
5301 gimple_omp_task_child_fn_ptr (gimple *gs)
5303 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5304 return &omp_task_stmt->child_fn;
5308 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5310 static inline void
5311 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5313 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5314 omp_task_stmt->child_fn = child_fn;
5318 /* Return the artificial argument used to send variables and values
5319 from the parent to the children threads in OMP_TASK GS. */
5321 static inline tree
5322 gimple_omp_task_data_arg (const gimple *gs)
5324 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5325 return omp_task_stmt->data_arg;
5329 /* Return a pointer to the data argument for OMP_TASK GS. */
5331 static inline tree *
5332 gimple_omp_task_data_arg_ptr (gimple *gs)
5334 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5335 return &omp_task_stmt->data_arg;
5339 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5341 static inline void
5342 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5344 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5345 omp_task_stmt->data_arg = data_arg;
5349 /* Return the clauses associated with OMP_TASK GS. */
5351 static inline tree
5352 gimple_omp_taskreg_clauses (const gimple *gs)
5354 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5355 = as_a <const gimple_statement_omp_taskreg *> (gs);
5356 return omp_taskreg_stmt->clauses;
5360 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5362 static inline tree *
5363 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5365 gimple_statement_omp_taskreg *omp_taskreg_stmt
5366 = as_a <gimple_statement_omp_taskreg *> (gs);
5367 return &omp_taskreg_stmt->clauses;
5371 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5372 GS. */
5374 static inline void
5375 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5377 gimple_statement_omp_taskreg *omp_taskreg_stmt
5378 = as_a <gimple_statement_omp_taskreg *> (gs);
5379 omp_taskreg_stmt->clauses = clauses;
5383 /* Return the child function used to hold the body of OMP_TASK GS. */
5385 static inline tree
5386 gimple_omp_taskreg_child_fn (const gimple *gs)
5388 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5389 = as_a <const gimple_statement_omp_taskreg *> (gs);
5390 return omp_taskreg_stmt->child_fn;
5393 /* Return a pointer to the child function used to hold the body of
5394 OMP_TASK GS. */
5396 static inline tree *
5397 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5399 gimple_statement_omp_taskreg *omp_taskreg_stmt
5400 = as_a <gimple_statement_omp_taskreg *> (gs);
5401 return &omp_taskreg_stmt->child_fn;
5405 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5407 static inline void
5408 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5410 gimple_statement_omp_taskreg *omp_taskreg_stmt
5411 = as_a <gimple_statement_omp_taskreg *> (gs);
5412 omp_taskreg_stmt->child_fn = child_fn;
5416 /* Return the artificial argument used to send variables and values
5417 from the parent to the children threads in OMP_TASK GS. */
5419 static inline tree
5420 gimple_omp_taskreg_data_arg (const gimple *gs)
5422 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5423 = as_a <const gimple_statement_omp_taskreg *> (gs);
5424 return omp_taskreg_stmt->data_arg;
5428 /* Return a pointer to the data argument for OMP_TASK GS. */
5430 static inline tree *
5431 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5433 gimple_statement_omp_taskreg *omp_taskreg_stmt
5434 = as_a <gimple_statement_omp_taskreg *> (gs);
5435 return &omp_taskreg_stmt->data_arg;
5439 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5441 static inline void
5442 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5444 gimple_statement_omp_taskreg *omp_taskreg_stmt
5445 = as_a <gimple_statement_omp_taskreg *> (gs);
5446 omp_taskreg_stmt->data_arg = data_arg;
5450 /* Return the copy function used to hold the body of OMP_TASK GS. */
5452 static inline tree
5453 gimple_omp_task_copy_fn (const gimple *gs)
5455 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5456 return omp_task_stmt->copy_fn;
5459 /* Return a pointer to the copy function used to hold the body of
5460 OMP_TASK GS. */
5462 static inline tree *
5463 gimple_omp_task_copy_fn_ptr (gimple *gs)
5465 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5466 return &omp_task_stmt->copy_fn;
5470 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5472 static inline void
5473 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5475 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5476 omp_task_stmt->copy_fn = copy_fn;
5480 /* Return size of the data block in bytes in OMP_TASK GS. */
5482 static inline tree
5483 gimple_omp_task_arg_size (const gimple *gs)
5485 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5486 return omp_task_stmt->arg_size;
5490 /* Return a pointer to the data block size for OMP_TASK GS. */
5492 static inline tree *
5493 gimple_omp_task_arg_size_ptr (gimple *gs)
5495 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5496 return &omp_task_stmt->arg_size;
5500 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5502 static inline void
5503 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5505 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5506 omp_task_stmt->arg_size = arg_size;
5510 /* Return align of the data block in bytes in OMP_TASK GS. */
5512 static inline tree
5513 gimple_omp_task_arg_align (const gimple *gs)
5515 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5516 return omp_task_stmt->arg_align;
5520 /* Return a pointer to the data block align for OMP_TASK GS. */
5522 static inline tree *
5523 gimple_omp_task_arg_align_ptr (gimple *gs)
5525 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5526 return &omp_task_stmt->arg_align;
5530 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5532 static inline void
5533 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5535 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5536 omp_task_stmt->arg_align = arg_align;
5540 /* Return the clauses associated with OMP_SINGLE GS. */
5542 static inline tree
5543 gimple_omp_single_clauses (const gimple *gs)
5545 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5546 return omp_single_stmt->clauses;
5550 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5552 static inline tree *
5553 gimple_omp_single_clauses_ptr (gimple *gs)
5555 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5556 return &omp_single_stmt->clauses;
5560 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5562 static inline void
5563 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5565 omp_single_stmt->clauses = clauses;
5569 /* Return the clauses associated with OMP_TARGET GS. */
5571 static inline tree
5572 gimple_omp_target_clauses (const gimple *gs)
5574 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5575 return omp_target_stmt->clauses;
5579 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5581 static inline tree *
5582 gimple_omp_target_clauses_ptr (gimple *gs)
5584 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5585 return &omp_target_stmt->clauses;
5589 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5591 static inline void
5592 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5593 tree clauses)
5595 omp_target_stmt->clauses = clauses;
5599 /* Return the kind of the OMP_TARGET G. */
5601 static inline int
5602 gimple_omp_target_kind (const gimple *g)
5604 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5605 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5609 /* Set the kind of the OMP_TARGET G. */
5611 static inline void
5612 gimple_omp_target_set_kind (gomp_target *g, int kind)
5614 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5615 | (kind & GF_OMP_TARGET_KIND_MASK);
5619 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5621 static inline tree
5622 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5624 return omp_target_stmt->child_fn;
5627 /* Return a pointer to the child function used to hold the body of
5628 OMP_TARGET_STMT. */
5630 static inline tree *
5631 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5633 return &omp_target_stmt->child_fn;
5637 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5639 static inline void
5640 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5641 tree child_fn)
5643 omp_target_stmt->child_fn = child_fn;
5647 /* Return the artificial argument used to send variables and values
5648 from the parent to the children threads in OMP_TARGET_STMT. */
5650 static inline tree
5651 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5653 return omp_target_stmt->data_arg;
5657 /* Return a pointer to the data argument for OMP_TARGET GS. */
5659 static inline tree *
5660 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5662 return &omp_target_stmt->data_arg;
5666 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5668 static inline void
5669 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5670 tree data_arg)
5672 omp_target_stmt->data_arg = data_arg;
5676 /* Return the clauses associated with OMP_TEAMS GS. */
5678 static inline tree
5679 gimple_omp_teams_clauses (const gimple *gs)
5681 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5682 return omp_teams_stmt->clauses;
5686 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5688 static inline tree *
5689 gimple_omp_teams_clauses_ptr (gimple *gs)
5691 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5692 return &omp_teams_stmt->clauses;
5696 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5698 static inline void
5699 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5701 omp_teams_stmt->clauses = clauses;
5704 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5706 static inline bool
5707 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5709 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5712 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5714 static inline void
5715 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5717 if (value)
5718 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5719 else
5720 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5723 /* Return the clauses associated with OMP_SECTIONS GS. */
5725 static inline tree
5726 gimple_omp_sections_clauses (const gimple *gs)
5728 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5729 return omp_sections_stmt->clauses;
5733 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5735 static inline tree *
5736 gimple_omp_sections_clauses_ptr (gimple *gs)
5738 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5739 return &omp_sections_stmt->clauses;
5743 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5744 GS. */
5746 static inline void
5747 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5749 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5750 omp_sections_stmt->clauses = clauses;
5754 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5755 in GS. */
5757 static inline tree
5758 gimple_omp_sections_control (const gimple *gs)
5760 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5761 return omp_sections_stmt->control;
5765 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5766 GS. */
5768 static inline tree *
5769 gimple_omp_sections_control_ptr (gimple *gs)
5771 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5772 return &omp_sections_stmt->control;
5776 /* Set CONTROL to be the set of clauses associated with the
5777 GIMPLE_OMP_SECTIONS in GS. */
5779 static inline void
5780 gimple_omp_sections_set_control (gimple *gs, tree control)
5782 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5783 omp_sections_stmt->control = control;
5787 /* Set the value being stored in an atomic store. */
5789 static inline void
5790 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5792 store_stmt->val = val;
5796 /* Return the value being stored in an atomic store. */
5798 static inline tree
5799 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5801 return store_stmt->val;
5805 /* Return a pointer to the value being stored in an atomic store. */
5807 static inline tree *
5808 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5810 return &store_stmt->val;
5814 /* Set the LHS of an atomic load. */
5816 static inline void
5817 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5819 load_stmt->lhs = lhs;
5823 /* Get the LHS of an atomic load. */
5825 static inline tree
5826 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5828 return load_stmt->lhs;
5832 /* Return a pointer to the LHS of an atomic load. */
5834 static inline tree *
5835 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5837 return &load_stmt->lhs;
5841 /* Set the RHS of an atomic load. */
5843 static inline void
5844 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5846 load_stmt->rhs = rhs;
5850 /* Get the RHS of an atomic load. */
5852 static inline tree
5853 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5855 return load_stmt->rhs;
5859 /* Return a pointer to the RHS of an atomic load. */
5861 static inline tree *
5862 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5864 return &load_stmt->rhs;
5868 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5870 static inline tree
5871 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5873 return cont_stmt->control_def;
5876 /* The same as above, but return the address. */
5878 static inline tree *
5879 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5881 return &cont_stmt->control_def;
5884 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5886 static inline void
5887 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5889 cont_stmt->control_def = def;
5893 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5895 static inline tree
5896 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5898 return cont_stmt->control_use;
5902 /* The same as above, but return the address. */
5904 static inline tree *
5905 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5907 return &cont_stmt->control_use;
5911 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5913 static inline void
5914 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5916 cont_stmt->control_use = use;
5919 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5920 TRANSACTION_STMT. */
5922 static inline gimple_seq *
5923 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5925 return &transaction_stmt->body;
5928 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5930 static inline gimple_seq
5931 gimple_transaction_body (gtransaction *transaction_stmt)
5933 return transaction_stmt->body;
5936 /* Return the label associated with a GIMPLE_TRANSACTION. */
5938 static inline tree
5939 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
5941 return transaction_stmt->label_norm;
5944 static inline tree *
5945 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
5947 return &transaction_stmt->label_norm;
5950 static inline tree
5951 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
5953 return transaction_stmt->label_uninst;
5956 static inline tree *
5957 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
5959 return &transaction_stmt->label_uninst;
5962 static inline tree
5963 gimple_transaction_label_over (const gtransaction *transaction_stmt)
5965 return transaction_stmt->label_over;
5968 static inline tree *
5969 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
5971 return &transaction_stmt->label_over;
5974 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5976 static inline unsigned int
5977 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5979 return transaction_stmt->subcode;
5982 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5983 TRANSACTION_STMT. */
5985 static inline void
5986 gimple_transaction_set_body (gtransaction *transaction_stmt,
5987 gimple_seq body)
5989 transaction_stmt->body = body;
5992 /* Set the label associated with a GIMPLE_TRANSACTION. */
5994 static inline void
5995 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
5997 transaction_stmt->label_norm = label;
6000 static inline void
6001 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6003 transaction_stmt->label_uninst = label;
6006 static inline void
6007 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6009 transaction_stmt->label_over = label;
6012 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6014 static inline void
6015 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6016 unsigned int subcode)
6018 transaction_stmt->subcode = subcode;
6021 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6023 static inline tree *
6024 gimple_return_retval_ptr (greturn *gs)
6026 return &gs->op[0];
6029 /* Return the return value for GIMPLE_RETURN GS. */
6031 static inline tree
6032 gimple_return_retval (const greturn *gs)
6034 return gs->op[0];
6038 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6040 static inline void
6041 gimple_return_set_retval (greturn *gs, tree retval)
6043 gs->op[0] = retval;
6047 /* Return the return bounds for GIMPLE_RETURN GS. */
6049 static inline tree
6050 gimple_return_retbnd (const gimple *gs)
6052 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6053 return gimple_op (gs, 1);
6057 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6059 static inline void
6060 gimple_return_set_retbnd (gimple *gs, tree retval)
6062 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6063 gimple_set_op (gs, 1, retval);
6067 /* Returns true when the gimple statement STMT is any of the OMP types. */
6069 #define CASE_GIMPLE_OMP \
6070 case GIMPLE_OMP_PARALLEL: \
6071 case GIMPLE_OMP_TASK: \
6072 case GIMPLE_OMP_FOR: \
6073 case GIMPLE_OMP_SECTIONS: \
6074 case GIMPLE_OMP_SECTIONS_SWITCH: \
6075 case GIMPLE_OMP_SINGLE: \
6076 case GIMPLE_OMP_TARGET: \
6077 case GIMPLE_OMP_TEAMS: \
6078 case GIMPLE_OMP_SECTION: \
6079 case GIMPLE_OMP_MASTER: \
6080 case GIMPLE_OMP_TASKGROUP: \
6081 case GIMPLE_OMP_ORDERED: \
6082 case GIMPLE_OMP_CRITICAL: \
6083 case GIMPLE_OMP_RETURN: \
6084 case GIMPLE_OMP_ATOMIC_LOAD: \
6085 case GIMPLE_OMP_ATOMIC_STORE: \
6086 case GIMPLE_OMP_CONTINUE: \
6087 case GIMPLE_OMP_GRID_BODY
6089 static inline bool
6090 is_gimple_omp (const gimple *stmt)
6092 switch (gimple_code (stmt))
6094 CASE_GIMPLE_OMP:
6095 return true;
6096 default:
6097 return false;
6101 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6102 specifically. */
6104 static inline bool
6105 is_gimple_omp_oacc (const gimple *stmt)
6107 gcc_assert (is_gimple_omp (stmt));
6108 switch (gimple_code (stmt))
6110 case GIMPLE_OMP_FOR:
6111 switch (gimple_omp_for_kind (stmt))
6113 case GF_OMP_FOR_KIND_OACC_LOOP:
6114 return true;
6115 default:
6116 return false;
6118 case GIMPLE_OMP_TARGET:
6119 switch (gimple_omp_target_kind (stmt))
6121 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6122 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6123 case GF_OMP_TARGET_KIND_OACC_DATA:
6124 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6125 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6126 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6127 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6128 return true;
6129 default:
6130 return false;
6132 default:
6133 return false;
6138 /* Return true if the OMP gimple statement STMT is offloaded. */
6140 static inline bool
6141 is_gimple_omp_offloaded (const gimple *stmt)
6143 gcc_assert (is_gimple_omp (stmt));
6144 switch (gimple_code (stmt))
6146 case GIMPLE_OMP_TARGET:
6147 switch (gimple_omp_target_kind (stmt))
6149 case GF_OMP_TARGET_KIND_REGION:
6150 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6151 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6152 return true;
6153 default:
6154 return false;
6156 default:
6157 return false;
6162 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6164 static inline bool
6165 gimple_nop_p (const gimple *g)
6167 return gimple_code (g) == GIMPLE_NOP;
6171 /* Return true if GS is a GIMPLE_RESX. */
6173 static inline bool
6174 is_gimple_resx (const gimple *gs)
6176 return gimple_code (gs) == GIMPLE_RESX;
6179 /* Return the type of the main expression computed by STMT. Return
6180 void_type_node if the statement computes nothing. */
6182 static inline tree
6183 gimple_expr_type (const gimple *stmt)
6185 enum gimple_code code = gimple_code (stmt);
6186 /* In general we want to pass out a type that can be substituted
6187 for both the RHS and the LHS types if there is a possibly
6188 useless conversion involved. That means returning the
6189 original RHS type as far as we can reconstruct it. */
6190 if (code == GIMPLE_CALL)
6192 const gcall *call_stmt = as_a <const gcall *> (stmt);
6193 if (gimple_call_internal_p (call_stmt)
6194 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6195 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6196 else
6197 return gimple_call_return_type (call_stmt);
6199 else if (code == GIMPLE_ASSIGN)
6201 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6202 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6203 else
6204 /* As fallback use the type of the LHS. */
6205 return TREE_TYPE (gimple_get_lhs (stmt));
6207 else if (code == GIMPLE_COND)
6208 return boolean_type_node;
6209 else
6210 return void_type_node;
6213 /* Enum and arrays used for allocation stats. Keep in sync with
6214 gimple.c:gimple_alloc_kind_names. */
6215 enum gimple_alloc_kind
6217 gimple_alloc_kind_assign, /* Assignments. */
6218 gimple_alloc_kind_phi, /* PHI nodes. */
6219 gimple_alloc_kind_cond, /* Conditionals. */
6220 gimple_alloc_kind_rest, /* Everything else. */
6221 gimple_alloc_kind_all
6224 extern int gimple_alloc_counts[];
6225 extern int gimple_alloc_sizes[];
6227 /* Return the allocation kind for a given stmt CODE. */
6228 static inline enum gimple_alloc_kind
6229 gimple_alloc_kind (enum gimple_code code)
6231 switch (code)
6233 case GIMPLE_ASSIGN:
6234 return gimple_alloc_kind_assign;
6235 case GIMPLE_PHI:
6236 return gimple_alloc_kind_phi;
6237 case GIMPLE_COND:
6238 return gimple_alloc_kind_cond;
6239 default:
6240 return gimple_alloc_kind_rest;
6244 /* Return true if a location should not be emitted for this statement
6245 by annotate_all_with_location. */
6247 static inline bool
6248 gimple_do_not_emit_location_p (gimple *g)
6250 return gimple_plf (g, GF_PLF_1);
6253 /* Mark statement G so a location will not be emitted by
6254 annotate_one_with_location. */
6256 static inline void
6257 gimple_set_do_not_emit_location (gimple *g)
6259 /* The PLF flags are initialized to 0 when a new tuple is created,
6260 so no need to initialize it anywhere. */
6261 gimple_set_plf (g, GF_PLF_1, true);
6265 /* Macros for showing usage statistics. */
6266 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6267 ? (x) \
6268 : ((x) < 1024*1024*10 \
6269 ? (x) / 1024 \
6270 : (x) / (1024*1024))))
6272 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6274 #endif /* GCC_GIMPLE_H */