PR middle-end/83164
[official-gcc.git] / gcc / gimple.h
blob0fcdd05aaba684f775954401152a817be66f1594
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2017 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN \
50 ATTRIBUTE_COLD;
52 #define GIMPLE_CHECK(GS, CODE) \
53 do { \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
58 } while (0)
59 template <typename T>
60 static inline T
61 GIMPLE_CHECK2(const gimple *gs,
62 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file = __builtin_FILE (),
64 int line = __builtin_LINE (),
65 const char *fun = __builtin_FUNCTION ())
66 #else
67 const char *file = __FILE__,
68 int line = __LINE__,
69 const char *fun = NULL)
70 #endif
72 T ret = dyn_cast <T> (gs);
73 if (!ret)
74 gimple_check_failed (gs, file, line, fun,
75 remove_pointer<T>::type::code_, ERROR_MARK);
76 return ret;
78 template <typename T>
79 static inline T
80 GIMPLE_CHECK2(gimple *gs,
81 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file = __builtin_FILE (),
83 int line = __builtin_LINE (),
84 const char *fun = __builtin_FUNCTION ())
85 #else
86 const char *file = __FILE__,
87 int line = __LINE__,
88 const char *fun = NULL)
89 #endif
91 T ret = dyn_cast <T> (gs);
92 if (!ret)
93 gimple_check_failed (gs, file, line, fun,
94 remove_pointer<T>::type::code_, ERROR_MARK);
95 return ret;
97 #else /* not ENABLE_GIMPLE_CHECKING */
98 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 #define GIMPLE_CHECK(GS, CODE) (void)0
100 template <typename T>
101 static inline T
102 GIMPLE_CHECK2(gimple *gs)
104 return as_a <T> (gs);
106 template <typename T>
107 static inline T
108 GIMPLE_CHECK2(const gimple *gs)
110 return as_a <T> (gs);
112 #endif
114 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
116 enum gimple_rhs_class
118 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
126 /* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
136 Keep this list sorted. */
137 enum gf_mask {
138 GF_ASM_INPUT = 1 << 0,
139 GF_ASM_VOLATILE = 1 << 1,
140 GF_CALL_FROM_THUNK = 1 << 0,
141 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
142 GF_CALL_TAILCALL = 1 << 2,
143 GF_CALL_VA_ARG_PACK = 1 << 3,
144 GF_CALL_NOTHROW = 1 << 4,
145 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
146 GF_CALL_INTERNAL = 1 << 6,
147 GF_CALL_CTRL_ALTERING = 1 << 7,
148 GF_CALL_WITH_BOUNDS = 1 << 8,
149 GF_CALL_MUST_TAIL_CALL = 1 << 9,
150 GF_CALL_BY_DESCRIPTOR = 1 << 10,
151 GF_CALL_NOCF_CHECK = 1 << 11,
152 GF_OMP_PARALLEL_COMBINED = 1 << 0,
153 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
154 GF_OMP_TASK_TASKLOOP = 1 << 0,
155 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
156 GF_OMP_FOR_KIND_FOR = 0,
157 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
158 GF_OMP_FOR_KIND_TASKLOOP = 2,
159 GF_OMP_FOR_KIND_OACC_LOOP = 4,
160 GF_OMP_FOR_KIND_GRID_LOOP = 5,
161 /* Flag for SIMD variants of OMP_FOR kinds. */
162 GF_OMP_FOR_SIMD = 1 << 3,
163 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
164 GF_OMP_FOR_COMBINED = 1 << 4,
165 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
166 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
167 statements. */
168 GF_OMP_FOR_GRID_PHONY = 1 << 6,
169 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
170 loop statements. */
171 GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6,
172 GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7,
173 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
174 GF_OMP_TARGET_KIND_REGION = 0,
175 GF_OMP_TARGET_KIND_DATA = 1,
176 GF_OMP_TARGET_KIND_UPDATE = 2,
177 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
178 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
179 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
180 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
181 GF_OMP_TARGET_KIND_OACC_DATA = 7,
182 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
183 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
184 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
185 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
186 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
188 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
189 a thread synchronization via some sort of barrier. The exact barrier
190 that would otherwise be emitted is dependent on the OMP statement with
191 which this return is associated. */
192 GF_OMP_RETURN_NOWAIT = 1 << 0,
194 GF_OMP_SECTION_LAST = 1 << 0,
195 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
196 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
197 GF_PREDICT_TAKEN = 1 << 15
200 /* Currently, there are only two types of gimple debug stmt. Others are
201 envisioned, for example, to enable the generation of is_stmt notes
202 in line number information, to mark sequence points, etc. This
203 subcode is to be used to tell them apart. */
204 enum gimple_debug_subcode {
205 GIMPLE_DEBUG_BIND = 0,
206 GIMPLE_DEBUG_SOURCE_BIND = 1
209 /* Masks for selecting a pass local flag (PLF) to work on. These
210 masks are used by gimple_set_plf and gimple_plf. */
211 enum plf_mask {
212 GF_PLF_1 = 1 << 0,
213 GF_PLF_2 = 1 << 1
216 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
217 are for 64 bit hosts. */
219 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
220 chain_next ("%h.next"), variable_size))
221 gimple
223 /* [ WORD 1 ]
224 Main identifying code for a tuple. */
225 ENUM_BITFIELD(gimple_code) code : 8;
227 /* Nonzero if a warning should not be emitted on this tuple. */
228 unsigned int no_warning : 1;
230 /* Nonzero if this tuple has been visited. Passes are responsible
231 for clearing this bit before using it. */
232 unsigned int visited : 1;
234 /* Nonzero if this tuple represents a non-temporal move. */
235 unsigned int nontemporal_move : 1;
237 /* Pass local flags. These flags are free for any pass to use as
238 they see fit. Passes should not assume that these flags contain
239 any useful value when the pass starts. Any initial state that
240 the pass requires should be set on entry to the pass. See
241 gimple_set_plf and gimple_plf for usage. */
242 unsigned int plf : 2;
244 /* Nonzero if this statement has been modified and needs to have its
245 operands rescanned. */
246 unsigned modified : 1;
248 /* Nonzero if this statement contains volatile operands. */
249 unsigned has_volatile_ops : 1;
251 /* Padding to get subcode to 16 bit alignment. */
252 unsigned pad : 1;
254 /* The SUBCODE field can be used for tuple-specific flags for tuples
255 that do not require subcodes. Note that SUBCODE should be at
256 least as wide as tree codes, as several tuples store tree codes
257 in there. */
258 unsigned int subcode : 16;
260 /* UID of this statement. This is used by passes that want to
261 assign IDs to statements. It must be assigned and used by each
262 pass. By default it should be assumed to contain garbage. */
263 unsigned uid;
265 /* [ WORD 2 ]
266 Locus information for debug info. */
267 location_t location;
269 /* Number of operands in this tuple. */
270 unsigned num_ops;
272 /* [ WORD 3 ]
273 Basic block holding this statement. */
274 basic_block bb;
276 /* [ WORD 4-5 ]
277 Linked lists of gimple statements. The next pointers form
278 a NULL terminated list, the prev pointers are a cyclic list.
279 A gimple statement is hence also a double-ended list of
280 statements, with the pointer itself being the first element,
281 and the prev pointer being the last. */
282 gimple *next;
283 gimple *GTY((skip)) prev;
287 /* Base structure for tuples with operands. */
289 /* This gimple subclass has no tag value. */
290 struct GTY(())
291 gimple_statement_with_ops_base : public gimple
293 /* [ WORD 1-6 ] : base class */
295 /* [ WORD 7 ]
296 SSA operand vectors. NOTE: It should be possible to
297 amalgamate these vectors with the operand vector OP. However,
298 the SSA operand vectors are organized differently and contain
299 more information (like immediate use chaining). */
300 struct use_optype_d GTY((skip (""))) *use_ops;
304 /* Statements that take register operands. */
306 struct GTY((tag("GSS_WITH_OPS")))
307 gimple_statement_with_ops : public gimple_statement_with_ops_base
309 /* [ WORD 1-7 ] : base class */
311 /* [ WORD 8 ]
312 Operand vector. NOTE! This must always be the last field
313 of this structure. In particular, this means that this
314 structure cannot be embedded inside another one. */
315 tree GTY((length ("%h.num_ops"))) op[1];
319 /* Base for statements that take both memory and register operands. */
321 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
322 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
324 /* [ WORD 1-7 ] : base class */
326 /* [ WORD 8-9 ]
327 Virtual operands for this statement. The GC will pick them
328 up via the ssa_names array. */
329 tree GTY((skip (""))) vdef;
330 tree GTY((skip (""))) vuse;
334 /* Statements that take both memory and register operands. */
336 struct GTY((tag("GSS_WITH_MEM_OPS")))
337 gimple_statement_with_memory_ops :
338 public gimple_statement_with_memory_ops_base
340 /* [ WORD 1-9 ] : base class */
342 /* [ WORD 10 ]
343 Operand vector. NOTE! This must always be the last field
344 of this structure. In particular, this means that this
345 structure cannot be embedded inside another one. */
346 tree GTY((length ("%h.num_ops"))) op[1];
350 /* Call statements that take both memory and register operands. */
352 struct GTY((tag("GSS_CALL")))
353 gcall : public gimple_statement_with_memory_ops_base
355 /* [ WORD 1-9 ] : base class */
357 /* [ WORD 10-13 ] */
358 struct pt_solution call_used;
359 struct pt_solution call_clobbered;
361 /* [ WORD 14 ] */
362 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
363 tree GTY ((tag ("0"))) fntype;
364 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
365 } u;
367 /* [ WORD 15 ]
368 Operand vector. NOTE! This must always be the last field
369 of this structure. In particular, this means that this
370 structure cannot be embedded inside another one. */
371 tree GTY((length ("%h.num_ops"))) op[1];
373 static const enum gimple_code code_ = GIMPLE_CALL;
377 /* OMP statements. */
379 struct GTY((tag("GSS_OMP")))
380 gimple_statement_omp : public gimple
382 /* [ WORD 1-6 ] : base class */
384 /* [ WORD 7 ] */
385 gimple_seq body;
389 /* GIMPLE_BIND */
391 struct GTY((tag("GSS_BIND")))
392 gbind : public gimple
394 /* [ WORD 1-6 ] : base class */
396 /* [ WORD 7 ]
397 Variables declared in this scope. */
398 tree vars;
400 /* [ WORD 8 ]
401 This is different than the BLOCK field in gimple,
402 which is analogous to TREE_BLOCK (i.e., the lexical block holding
403 this statement). This field is the equivalent of BIND_EXPR_BLOCK
404 in tree land (i.e., the lexical scope defined by this bind). See
405 gimple-low.c. */
406 tree block;
408 /* [ WORD 9 ] */
409 gimple_seq body;
413 /* GIMPLE_CATCH */
415 struct GTY((tag("GSS_CATCH")))
416 gcatch : public gimple
418 /* [ WORD 1-6 ] : base class */
420 /* [ WORD 7 ] */
421 tree types;
423 /* [ WORD 8 ] */
424 gimple_seq handler;
428 /* GIMPLE_EH_FILTER */
430 struct GTY((tag("GSS_EH_FILTER")))
431 geh_filter : public gimple
433 /* [ WORD 1-6 ] : base class */
435 /* [ WORD 7 ]
436 Filter types. */
437 tree types;
439 /* [ WORD 8 ]
440 Failure actions. */
441 gimple_seq failure;
444 /* GIMPLE_EH_ELSE */
446 struct GTY((tag("GSS_EH_ELSE")))
447 geh_else : public gimple
449 /* [ WORD 1-6 ] : base class */
451 /* [ WORD 7,8 ] */
452 gimple_seq n_body, e_body;
455 /* GIMPLE_EH_MUST_NOT_THROW */
457 struct GTY((tag("GSS_EH_MNT")))
458 geh_mnt : public gimple
460 /* [ WORD 1-6 ] : base class */
462 /* [ WORD 7 ] Abort function decl. */
463 tree fndecl;
466 /* GIMPLE_PHI */
468 struct GTY((tag("GSS_PHI")))
469 gphi : public gimple
471 /* [ WORD 1-6 ] : base class */
473 /* [ WORD 7 ] */
474 unsigned capacity;
475 unsigned nargs;
477 /* [ WORD 8 ] */
478 tree result;
480 /* [ WORD 9 ] */
481 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
485 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
487 struct GTY((tag("GSS_EH_CTRL")))
488 gimple_statement_eh_ctrl : public gimple
490 /* [ WORD 1-6 ] : base class */
492 /* [ WORD 7 ]
493 Exception region number. */
494 int region;
497 struct GTY((tag("GSS_EH_CTRL")))
498 gresx : public gimple_statement_eh_ctrl
500 /* No extra fields; adds invariant:
501 stmt->code == GIMPLE_RESX. */
504 struct GTY((tag("GSS_EH_CTRL")))
505 geh_dispatch : public gimple_statement_eh_ctrl
507 /* No extra fields; adds invariant:
508 stmt->code == GIMPLE_EH_DISPATH. */
512 /* GIMPLE_TRY */
514 struct GTY((tag("GSS_TRY")))
515 gtry : public gimple
517 /* [ WORD 1-6 ] : base class */
519 /* [ WORD 7 ]
520 Expression to evaluate. */
521 gimple_seq eval;
523 /* [ WORD 8 ]
524 Cleanup expression. */
525 gimple_seq cleanup;
528 /* Kind of GIMPLE_TRY statements. */
529 enum gimple_try_flags
531 /* A try/catch. */
532 GIMPLE_TRY_CATCH = 1 << 0,
534 /* A try/finally. */
535 GIMPLE_TRY_FINALLY = 1 << 1,
536 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
538 /* Analogous to TRY_CATCH_IS_CLEANUP. */
539 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
542 /* GIMPLE_WITH_CLEANUP_EXPR */
544 struct GTY((tag("GSS_WCE")))
545 gimple_statement_wce : public gimple
547 /* [ WORD 1-6 ] : base class */
549 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
550 executed if an exception is thrown, not on normal exit of its
551 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
552 in TARGET_EXPRs. */
554 /* [ WORD 7 ]
555 Cleanup expression. */
556 gimple_seq cleanup;
560 /* GIMPLE_ASM */
562 struct GTY((tag("GSS_ASM")))
563 gasm : public gimple_statement_with_memory_ops_base
565 /* [ WORD 1-9 ] : base class */
567 /* [ WORD 10 ]
568 __asm__ statement. */
569 const char *string;
571 /* [ WORD 11 ]
572 Number of inputs, outputs, clobbers, labels. */
573 unsigned char ni;
574 unsigned char no;
575 unsigned char nc;
576 unsigned char nl;
578 /* [ WORD 12 ]
579 Operand vector. NOTE! This must always be the last field
580 of this structure. In particular, this means that this
581 structure cannot be embedded inside another one. */
582 tree GTY((length ("%h.num_ops"))) op[1];
585 /* GIMPLE_OMP_CRITICAL */
587 struct GTY((tag("GSS_OMP_CRITICAL")))
588 gomp_critical : public gimple_statement_omp
590 /* [ WORD 1-7 ] : base class */
592 /* [ WORD 8 ] */
593 tree clauses;
595 /* [ WORD 9 ]
596 Critical section name. */
597 tree name;
601 struct GTY(()) gimple_omp_for_iter {
602 /* Condition code. */
603 enum tree_code cond;
605 /* Index variable. */
606 tree index;
608 /* Initial value. */
609 tree initial;
611 /* Final value. */
612 tree final;
614 /* Increment. */
615 tree incr;
618 /* GIMPLE_OMP_FOR */
620 struct GTY((tag("GSS_OMP_FOR")))
621 gomp_for : public gimple_statement_omp
623 /* [ WORD 1-7 ] : base class */
625 /* [ WORD 8 ] */
626 tree clauses;
628 /* [ WORD 9 ]
629 Number of elements in iter array. */
630 size_t collapse;
632 /* [ WORD 10 ] */
633 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
635 /* [ WORD 11 ]
636 Pre-body evaluated before the loop body begins. */
637 gimple_seq pre_body;
641 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
643 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
644 gimple_statement_omp_parallel_layout : public gimple_statement_omp
646 /* [ WORD 1-7 ] : base class */
648 /* [ WORD 8 ]
649 Clauses. */
650 tree clauses;
652 /* [ WORD 9 ]
653 Child function holding the body of the parallel region. */
654 tree child_fn;
656 /* [ WORD 10 ]
657 Shared data argument. */
658 tree data_arg;
661 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
662 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
663 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
665 /* No extra fields; adds invariant:
666 stmt->code == GIMPLE_OMP_PARALLEL
667 || stmt->code == GIMPLE_OMP_TASK. */
670 /* GIMPLE_OMP_PARALLEL */
671 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
672 gomp_parallel : public gimple_statement_omp_taskreg
674 /* No extra fields; adds invariant:
675 stmt->code == GIMPLE_OMP_PARALLEL. */
678 /* GIMPLE_OMP_TARGET */
679 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
680 gomp_target : public gimple_statement_omp_parallel_layout
682 /* No extra fields; adds invariant:
683 stmt->code == GIMPLE_OMP_TARGET. */
686 /* GIMPLE_OMP_TASK */
688 struct GTY((tag("GSS_OMP_TASK")))
689 gomp_task : public gimple_statement_omp_taskreg
691 /* [ WORD 1-10 ] : base class */
693 /* [ WORD 11 ]
694 Child function holding firstprivate initialization if needed. */
695 tree copy_fn;
697 /* [ WORD 12-13 ]
698 Size and alignment in bytes of the argument data block. */
699 tree arg_size;
700 tree arg_align;
704 /* GIMPLE_OMP_SECTION */
705 /* Uses struct gimple_statement_omp. */
708 /* GIMPLE_OMP_SECTIONS */
710 struct GTY((tag("GSS_OMP_SECTIONS")))
711 gomp_sections : public gimple_statement_omp
713 /* [ WORD 1-7 ] : base class */
715 /* [ WORD 8 ] */
716 tree clauses;
718 /* [ WORD 9 ]
719 The control variable used for deciding which of the sections to
720 execute. */
721 tree control;
724 /* GIMPLE_OMP_CONTINUE.
726 Note: This does not inherit from gimple_statement_omp, because we
727 do not need the body field. */
729 struct GTY((tag("GSS_OMP_CONTINUE")))
730 gomp_continue : public gimple
732 /* [ WORD 1-6 ] : base class */
734 /* [ WORD 7 ] */
735 tree control_def;
737 /* [ WORD 8 ] */
738 tree control_use;
741 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
743 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
744 gimple_statement_omp_single_layout : public gimple_statement_omp
746 /* [ WORD 1-7 ] : base class */
748 /* [ WORD 8 ] */
749 tree clauses;
752 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
753 gomp_single : public gimple_statement_omp_single_layout
755 /* No extra fields; adds invariant:
756 stmt->code == GIMPLE_OMP_SINGLE. */
759 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
760 gomp_teams : public gimple_statement_omp_single_layout
762 /* No extra fields; adds invariant:
763 stmt->code == GIMPLE_OMP_TEAMS. */
766 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
767 gomp_ordered : public gimple_statement_omp_single_layout
769 /* No extra fields; adds invariant:
770 stmt->code == GIMPLE_OMP_ORDERED. */
774 /* GIMPLE_OMP_ATOMIC_LOAD.
775 Note: This is based on gimple, not g_s_omp, because g_s_omp
776 contains a sequence, which we don't need here. */
778 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
779 gomp_atomic_load : public gimple
781 /* [ WORD 1-6 ] : base class */
783 /* [ WORD 7-8 ] */
784 tree rhs, lhs;
787 /* GIMPLE_OMP_ATOMIC_STORE.
788 See note on GIMPLE_OMP_ATOMIC_LOAD. */
790 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
791 gimple_statement_omp_atomic_store_layout : public gimple
793 /* [ WORD 1-6 ] : base class */
795 /* [ WORD 7 ] */
796 tree val;
799 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
800 gomp_atomic_store :
801 public gimple_statement_omp_atomic_store_layout
803 /* No extra fields; adds invariant:
804 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
807 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
808 gimple_statement_omp_return :
809 public gimple_statement_omp_atomic_store_layout
811 /* No extra fields; adds invariant:
812 stmt->code == GIMPLE_OMP_RETURN. */
815 /* GIMPLE_TRANSACTION. */
817 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
819 /* The __transaction_atomic was declared [[outer]] or it is
820 __transaction_relaxed. */
821 #define GTMA_IS_OUTER (1u << 0)
822 #define GTMA_IS_RELAXED (1u << 1)
823 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
825 /* The transaction is seen to not have an abort. */
826 #define GTMA_HAVE_ABORT (1u << 2)
827 /* The transaction is seen to have loads or stores. */
828 #define GTMA_HAVE_LOAD (1u << 3)
829 #define GTMA_HAVE_STORE (1u << 4)
830 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
831 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
832 /* The transaction WILL enter serial irrevocable mode.
833 An irrevocable block post-dominates the entire transaction, such
834 that all invocations of the transaction will go serial-irrevocable.
835 In such case, we don't bother instrumenting the transaction, and
836 tell the runtime that it should begin the transaction in
837 serial-irrevocable mode. */
838 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
839 /* The transaction contains no instrumentation code whatsover, most
840 likely because it is guaranteed to go irrevocable upon entry. */
841 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
843 struct GTY((tag("GSS_TRANSACTION")))
844 gtransaction : public gimple_statement_with_memory_ops_base
846 /* [ WORD 1-9 ] : base class */
848 /* [ WORD 10 ] */
849 gimple_seq body;
851 /* [ WORD 11-13 ] */
852 tree label_norm;
853 tree label_uninst;
854 tree label_over;
857 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
858 enum gimple_statement_structure_enum {
859 #include "gsstruct.def"
860 LAST_GSS_ENUM
862 #undef DEFGSSTRUCT
864 /* A statement with the invariant that
865 stmt->code == GIMPLE_COND
866 i.e. a conditional jump statement. */
868 struct GTY((tag("GSS_WITH_OPS")))
869 gcond : public gimple_statement_with_ops
871 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
872 static const enum gimple_code code_ = GIMPLE_COND;
875 /* A statement with the invariant that
876 stmt->code == GIMPLE_DEBUG
877 i.e. a debug statement. */
879 struct GTY((tag("GSS_WITH_OPS")))
880 gdebug : public gimple_statement_with_ops
882 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
885 /* A statement with the invariant that
886 stmt->code == GIMPLE_GOTO
887 i.e. a goto statement. */
889 struct GTY((tag("GSS_WITH_OPS")))
890 ggoto : public gimple_statement_with_ops
892 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
895 /* A statement with the invariant that
896 stmt->code == GIMPLE_LABEL
897 i.e. a label statement. */
899 struct GTY((tag("GSS_WITH_OPS")))
900 glabel : public gimple_statement_with_ops
902 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
905 /* A statement with the invariant that
906 stmt->code == GIMPLE_SWITCH
907 i.e. a switch statement. */
909 struct GTY((tag("GSS_WITH_OPS")))
910 gswitch : public gimple_statement_with_ops
912 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
915 /* A statement with the invariant that
916 stmt->code == GIMPLE_ASSIGN
917 i.e. an assignment statement. */
919 struct GTY((tag("GSS_WITH_MEM_OPS")))
920 gassign : public gimple_statement_with_memory_ops
922 static const enum gimple_code code_ = GIMPLE_ASSIGN;
923 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
926 /* A statement with the invariant that
927 stmt->code == GIMPLE_RETURN
928 i.e. a return statement. */
930 struct GTY((tag("GSS_WITH_MEM_OPS")))
931 greturn : public gimple_statement_with_memory_ops
933 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
936 template <>
937 template <>
938 inline bool
939 is_a_helper <gasm *>::test (gimple *gs)
941 return gs->code == GIMPLE_ASM;
944 template <>
945 template <>
946 inline bool
947 is_a_helper <gassign *>::test (gimple *gs)
949 return gs->code == GIMPLE_ASSIGN;
952 template <>
953 template <>
954 inline bool
955 is_a_helper <const gassign *>::test (const gimple *gs)
957 return gs->code == GIMPLE_ASSIGN;
960 template <>
961 template <>
962 inline bool
963 is_a_helper <gbind *>::test (gimple *gs)
965 return gs->code == GIMPLE_BIND;
968 template <>
969 template <>
970 inline bool
971 is_a_helper <gcall *>::test (gimple *gs)
973 return gs->code == GIMPLE_CALL;
976 template <>
977 template <>
978 inline bool
979 is_a_helper <gcatch *>::test (gimple *gs)
981 return gs->code == GIMPLE_CATCH;
984 template <>
985 template <>
986 inline bool
987 is_a_helper <gcond *>::test (gimple *gs)
989 return gs->code == GIMPLE_COND;
992 template <>
993 template <>
994 inline bool
995 is_a_helper <const gcond *>::test (const gimple *gs)
997 return gs->code == GIMPLE_COND;
1000 template <>
1001 template <>
1002 inline bool
1003 is_a_helper <gdebug *>::test (gimple *gs)
1005 return gs->code == GIMPLE_DEBUG;
1008 template <>
1009 template <>
1010 inline bool
1011 is_a_helper <ggoto *>::test (gimple *gs)
1013 return gs->code == GIMPLE_GOTO;
1016 template <>
1017 template <>
1018 inline bool
1019 is_a_helper <glabel *>::test (gimple *gs)
1021 return gs->code == GIMPLE_LABEL;
1024 template <>
1025 template <>
1026 inline bool
1027 is_a_helper <gresx *>::test (gimple *gs)
1029 return gs->code == GIMPLE_RESX;
1032 template <>
1033 template <>
1034 inline bool
1035 is_a_helper <geh_dispatch *>::test (gimple *gs)
1037 return gs->code == GIMPLE_EH_DISPATCH;
1040 template <>
1041 template <>
1042 inline bool
1043 is_a_helper <geh_else *>::test (gimple *gs)
1045 return gs->code == GIMPLE_EH_ELSE;
1048 template <>
1049 template <>
1050 inline bool
1051 is_a_helper <geh_filter *>::test (gimple *gs)
1053 return gs->code == GIMPLE_EH_FILTER;
1056 template <>
1057 template <>
1058 inline bool
1059 is_a_helper <geh_mnt *>::test (gimple *gs)
1061 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1064 template <>
1065 template <>
1066 inline bool
1067 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1069 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1072 template <>
1073 template <>
1074 inline bool
1075 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1077 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1080 template <>
1081 template <>
1082 inline bool
1083 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1085 return gs->code == GIMPLE_OMP_RETURN;
1088 template <>
1089 template <>
1090 inline bool
1091 is_a_helper <gomp_continue *>::test (gimple *gs)
1093 return gs->code == GIMPLE_OMP_CONTINUE;
1096 template <>
1097 template <>
1098 inline bool
1099 is_a_helper <gomp_critical *>::test (gimple *gs)
1101 return gs->code == GIMPLE_OMP_CRITICAL;
1104 template <>
1105 template <>
1106 inline bool
1107 is_a_helper <gomp_ordered *>::test (gimple *gs)
1109 return gs->code == GIMPLE_OMP_ORDERED;
1112 template <>
1113 template <>
1114 inline bool
1115 is_a_helper <gomp_for *>::test (gimple *gs)
1117 return gs->code == GIMPLE_OMP_FOR;
1120 template <>
1121 template <>
1122 inline bool
1123 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1125 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1128 template <>
1129 template <>
1130 inline bool
1131 is_a_helper <gomp_parallel *>::test (gimple *gs)
1133 return gs->code == GIMPLE_OMP_PARALLEL;
1136 template <>
1137 template <>
1138 inline bool
1139 is_a_helper <gomp_target *>::test (gimple *gs)
1141 return gs->code == GIMPLE_OMP_TARGET;
1144 template <>
1145 template <>
1146 inline bool
1147 is_a_helper <gomp_sections *>::test (gimple *gs)
1149 return gs->code == GIMPLE_OMP_SECTIONS;
1152 template <>
1153 template <>
1154 inline bool
1155 is_a_helper <gomp_single *>::test (gimple *gs)
1157 return gs->code == GIMPLE_OMP_SINGLE;
1160 template <>
1161 template <>
1162 inline bool
1163 is_a_helper <gomp_teams *>::test (gimple *gs)
1165 return gs->code == GIMPLE_OMP_TEAMS;
1168 template <>
1169 template <>
1170 inline bool
1171 is_a_helper <gomp_task *>::test (gimple *gs)
1173 return gs->code == GIMPLE_OMP_TASK;
1176 template <>
1177 template <>
1178 inline bool
1179 is_a_helper <gphi *>::test (gimple *gs)
1181 return gs->code == GIMPLE_PHI;
1184 template <>
1185 template <>
1186 inline bool
1187 is_a_helper <greturn *>::test (gimple *gs)
1189 return gs->code == GIMPLE_RETURN;
1192 template <>
1193 template <>
1194 inline bool
1195 is_a_helper <gswitch *>::test (gimple *gs)
1197 return gs->code == GIMPLE_SWITCH;
1200 template <>
1201 template <>
1202 inline bool
1203 is_a_helper <gtransaction *>::test (gimple *gs)
1205 return gs->code == GIMPLE_TRANSACTION;
1208 template <>
1209 template <>
1210 inline bool
1211 is_a_helper <gtry *>::test (gimple *gs)
1213 return gs->code == GIMPLE_TRY;
1216 template <>
1217 template <>
1218 inline bool
1219 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1221 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1224 template <>
1225 template <>
1226 inline bool
1227 is_a_helper <const gasm *>::test (const gimple *gs)
1229 return gs->code == GIMPLE_ASM;
1232 template <>
1233 template <>
1234 inline bool
1235 is_a_helper <const gbind *>::test (const gimple *gs)
1237 return gs->code == GIMPLE_BIND;
1240 template <>
1241 template <>
1242 inline bool
1243 is_a_helper <const gcall *>::test (const gimple *gs)
1245 return gs->code == GIMPLE_CALL;
1248 template <>
1249 template <>
1250 inline bool
1251 is_a_helper <const gcatch *>::test (const gimple *gs)
1253 return gs->code == GIMPLE_CATCH;
1256 template <>
1257 template <>
1258 inline bool
1259 is_a_helper <const gresx *>::test (const gimple *gs)
1261 return gs->code == GIMPLE_RESX;
1264 template <>
1265 template <>
1266 inline bool
1267 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1269 return gs->code == GIMPLE_EH_DISPATCH;
1272 template <>
1273 template <>
1274 inline bool
1275 is_a_helper <const geh_filter *>::test (const gimple *gs)
1277 return gs->code == GIMPLE_EH_FILTER;
1280 template <>
1281 template <>
1282 inline bool
1283 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1285 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1288 template <>
1289 template <>
1290 inline bool
1291 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1293 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1296 template <>
1297 template <>
1298 inline bool
1299 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1301 return gs->code == GIMPLE_OMP_RETURN;
1304 template <>
1305 template <>
1306 inline bool
1307 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1309 return gs->code == GIMPLE_OMP_CONTINUE;
1312 template <>
1313 template <>
1314 inline bool
1315 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1317 return gs->code == GIMPLE_OMP_CRITICAL;
1320 template <>
1321 template <>
1322 inline bool
1323 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1325 return gs->code == GIMPLE_OMP_ORDERED;
1328 template <>
1329 template <>
1330 inline bool
1331 is_a_helper <const gomp_for *>::test (const gimple *gs)
1333 return gs->code == GIMPLE_OMP_FOR;
1336 template <>
1337 template <>
1338 inline bool
1339 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1341 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1344 template <>
1345 template <>
1346 inline bool
1347 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1349 return gs->code == GIMPLE_OMP_PARALLEL;
1352 template <>
1353 template <>
1354 inline bool
1355 is_a_helper <const gomp_target *>::test (const gimple *gs)
1357 return gs->code == GIMPLE_OMP_TARGET;
1360 template <>
1361 template <>
1362 inline bool
1363 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1365 return gs->code == GIMPLE_OMP_SECTIONS;
1368 template <>
1369 template <>
1370 inline bool
1371 is_a_helper <const gomp_single *>::test (const gimple *gs)
1373 return gs->code == GIMPLE_OMP_SINGLE;
1376 template <>
1377 template <>
1378 inline bool
1379 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1381 return gs->code == GIMPLE_OMP_TEAMS;
1384 template <>
1385 template <>
1386 inline bool
1387 is_a_helper <const gomp_task *>::test (const gimple *gs)
1389 return gs->code == GIMPLE_OMP_TASK;
1392 template <>
1393 template <>
1394 inline bool
1395 is_a_helper <const gphi *>::test (const gimple *gs)
1397 return gs->code == GIMPLE_PHI;
1400 template <>
1401 template <>
1402 inline bool
1403 is_a_helper <const gtransaction *>::test (const gimple *gs)
1405 return gs->code == GIMPLE_TRANSACTION;
1408 /* Offset in bytes to the location of the operand vector.
1409 Zero if there is no operand vector for this tuple structure. */
1410 extern size_t const gimple_ops_offset_[];
1412 /* Map GIMPLE codes to GSS codes. */
1413 extern enum gimple_statement_structure_enum const gss_for_code_[];
1415 /* This variable holds the currently expanded gimple statement for purposes
1416 of comminucating the profile info to the builtin expanders. */
1417 extern gimple *currently_expanding_gimple_stmt;
1419 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1420 greturn *gimple_build_return (tree);
1421 void gimple_call_reset_alias_info (gcall *);
1422 gcall *gimple_build_call_vec (tree, vec<tree> );
1423 gcall *gimple_build_call (tree, unsigned, ...);
1424 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1425 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1426 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1427 gcall *gimple_build_call_from_tree (tree, tree);
1428 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1429 gassign *gimple_build_assign (tree, enum tree_code,
1430 tree, tree, tree CXX_MEM_STAT_INFO);
1431 gassign *gimple_build_assign (tree, enum tree_code,
1432 tree, tree CXX_MEM_STAT_INFO);
1433 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1434 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1435 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1436 void gimple_cond_set_condition_from_tree (gcond *, tree);
1437 glabel *gimple_build_label (tree label);
1438 ggoto *gimple_build_goto (tree dest);
1439 gimple *gimple_build_nop (void);
1440 gbind *gimple_build_bind (tree, gimple_seq, tree);
1441 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1442 vec<tree, va_gc> *, vec<tree, va_gc> *,
1443 vec<tree, va_gc> *);
1444 gcatch *gimple_build_catch (tree, gimple_seq);
1445 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1446 geh_mnt *gimple_build_eh_must_not_throw (tree);
1447 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1448 gtry *gimple_build_try (gimple_seq, gimple_seq,
1449 enum gimple_try_flags);
1450 gimple *gimple_build_wce (gimple_seq);
1451 gresx *gimple_build_resx (int);
1452 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1453 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1454 geh_dispatch *gimple_build_eh_dispatch (int);
1455 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1456 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1457 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1458 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1459 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1460 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1461 tree, tree);
1462 gimple *gimple_build_omp_section (gimple_seq);
1463 gimple *gimple_build_omp_master (gimple_seq);
1464 gimple *gimple_build_omp_grid_body (gimple_seq);
1465 gimple *gimple_build_omp_taskgroup (gimple_seq);
1466 gomp_continue *gimple_build_omp_continue (tree, tree);
1467 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1468 gimple *gimple_build_omp_return (bool);
1469 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1470 gimple *gimple_build_omp_sections_switch (void);
1471 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1472 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1473 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1474 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1475 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1476 gtransaction *gimple_build_transaction (gimple_seq);
1477 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1478 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1479 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1480 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1481 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1482 location_t);
1483 extern void annotate_all_with_location (gimple_seq, location_t);
1484 bool empty_body_p (gimple_seq);
1485 gimple_seq gimple_seq_copy (gimple_seq);
1486 bool gimple_call_same_target_p (const gimple *, const gimple *);
1487 int gimple_call_flags (const gimple *);
1488 int gimple_call_arg_flags (const gcall *, unsigned);
1489 int gimple_call_return_flags (const gcall *);
1490 bool gimple_assign_copy_p (gimple *);
1491 bool gimple_assign_ssa_name_copy_p (gimple *);
1492 bool gimple_assign_unary_nop_p (gimple *);
1493 void gimple_set_bb (gimple *, basic_block);
1494 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1495 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1496 tree, tree, tree);
1497 tree gimple_get_lhs (const gimple *);
1498 void gimple_set_lhs (gimple *, tree);
1499 gimple *gimple_copy (gimple *);
1500 bool gimple_has_side_effects (const gimple *);
1501 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1502 bool gimple_could_trap_p (gimple *);
1503 bool gimple_assign_rhs_could_trap_p (gimple *);
1504 extern void dump_gimple_statistics (void);
1505 unsigned get_gimple_rhs_num_ops (enum tree_code);
1506 extern tree canonicalize_cond_expr_cond (tree);
1507 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1508 extern bool gimple_compare_field_offset (tree, tree);
1509 extern tree gimple_unsigned_type (tree);
1510 extern tree gimple_signed_type (tree);
1511 extern alias_set_type gimple_get_alias_set (tree);
1512 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1513 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1514 extern combined_fn gimple_call_combined_fn (const gimple *);
1515 extern bool gimple_call_builtin_p (const gimple *);
1516 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1517 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1518 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1519 extern void dump_decl_set (FILE *, bitmap);
1520 extern bool nonfreeing_call_p (gimple *);
1521 extern bool nonbarrier_call_p (gimple *);
1522 extern bool infer_nonnull_range (gimple *, tree);
1523 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1524 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1525 extern void sort_case_labels (vec<tree>);
1526 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1527 extern void gimple_seq_set_location (gimple_seq, location_t);
1528 extern void gimple_seq_discard (gimple_seq);
1529 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1530 extern bool gimple_inexpensive_call_p (gcall *);
1531 extern bool stmt_can_terminate_bb_p (gimple *);
1533 /* Formal (expression) temporary table handling: multiple occurrences of
1534 the same scalar expression are evaluated into the same temporary. */
1536 typedef struct gimple_temp_hash_elt
1538 tree val; /* Key */
1539 tree temp; /* Value */
1540 } elt_t;
1542 /* Get the number of the next statement uid to be allocated. */
1543 static inline unsigned int
1544 gimple_stmt_max_uid (struct function *fn)
1546 return fn->last_stmt_uid;
1549 /* Set the number of the next statement uid to be allocated. */
1550 static inline void
1551 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1553 fn->last_stmt_uid = maxid;
1556 /* Set the number of the next statement uid to be allocated. */
1557 static inline unsigned int
1558 inc_gimple_stmt_max_uid (struct function *fn)
1560 return fn->last_stmt_uid++;
1563 /* Return the first node in GIMPLE sequence S. */
1565 static inline gimple_seq_node
1566 gimple_seq_first (gimple_seq s)
1568 return s;
1572 /* Return the first statement in GIMPLE sequence S. */
1574 static inline gimple *
1575 gimple_seq_first_stmt (gimple_seq s)
1577 gimple_seq_node n = gimple_seq_first (s);
1578 return n;
1581 /* Return the first statement in GIMPLE sequence S as a gbind *,
1582 verifying that it has code GIMPLE_BIND in a checked build. */
1584 static inline gbind *
1585 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1587 gimple_seq_node n = gimple_seq_first (s);
1588 return as_a <gbind *> (n);
1592 /* Return the last node in GIMPLE sequence S. */
1594 static inline gimple_seq_node
1595 gimple_seq_last (gimple_seq s)
1597 return s ? s->prev : NULL;
1601 /* Return the last statement in GIMPLE sequence S. */
1603 static inline gimple *
1604 gimple_seq_last_stmt (gimple_seq s)
1606 gimple_seq_node n = gimple_seq_last (s);
1607 return n;
1611 /* Set the last node in GIMPLE sequence *PS to LAST. */
1613 static inline void
1614 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1616 (*ps)->prev = last;
1620 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1622 static inline void
1623 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1625 *ps = first;
1629 /* Return true if GIMPLE sequence S is empty. */
1631 static inline bool
1632 gimple_seq_empty_p (gimple_seq s)
1634 return s == NULL;
1637 /* Allocate a new sequence and initialize its first element with STMT. */
1639 static inline gimple_seq
1640 gimple_seq_alloc_with_stmt (gimple *stmt)
1642 gimple_seq seq = NULL;
1643 gimple_seq_add_stmt (&seq, stmt);
1644 return seq;
1648 /* Returns the sequence of statements in BB. */
1650 static inline gimple_seq
1651 bb_seq (const_basic_block bb)
1653 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1656 static inline gimple_seq *
1657 bb_seq_addr (basic_block bb)
1659 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1662 /* Sets the sequence of statements in BB to SEQ. */
1664 static inline void
1665 set_bb_seq (basic_block bb, gimple_seq seq)
1667 gcc_checking_assert (!(bb->flags & BB_RTL));
1668 bb->il.gimple.seq = seq;
1672 /* Return the code for GIMPLE statement G. */
1674 static inline enum gimple_code
1675 gimple_code (const gimple *g)
1677 return g->code;
1681 /* Return the GSS code used by a GIMPLE code. */
1683 static inline enum gimple_statement_structure_enum
1684 gss_for_code (enum gimple_code code)
1686 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1687 return gss_for_code_[code];
1691 /* Return which GSS code is used by GS. */
1693 static inline enum gimple_statement_structure_enum
1694 gimple_statement_structure (gimple *gs)
1696 return gss_for_code (gimple_code (gs));
1700 /* Return true if statement G has sub-statements. This is only true for
1701 High GIMPLE statements. */
1703 static inline bool
1704 gimple_has_substatements (gimple *g)
1706 switch (gimple_code (g))
1708 case GIMPLE_BIND:
1709 case GIMPLE_CATCH:
1710 case GIMPLE_EH_FILTER:
1711 case GIMPLE_EH_ELSE:
1712 case GIMPLE_TRY:
1713 case GIMPLE_OMP_FOR:
1714 case GIMPLE_OMP_MASTER:
1715 case GIMPLE_OMP_TASKGROUP:
1716 case GIMPLE_OMP_ORDERED:
1717 case GIMPLE_OMP_SECTION:
1718 case GIMPLE_OMP_PARALLEL:
1719 case GIMPLE_OMP_TASK:
1720 case GIMPLE_OMP_SECTIONS:
1721 case GIMPLE_OMP_SINGLE:
1722 case GIMPLE_OMP_TARGET:
1723 case GIMPLE_OMP_TEAMS:
1724 case GIMPLE_OMP_CRITICAL:
1725 case GIMPLE_WITH_CLEANUP_EXPR:
1726 case GIMPLE_TRANSACTION:
1727 case GIMPLE_OMP_GRID_BODY:
1728 return true;
1730 default:
1731 return false;
1736 /* Return the basic block holding statement G. */
1738 static inline basic_block
1739 gimple_bb (const gimple *g)
1741 return g->bb;
1745 /* Return the lexical scope block holding statement G. */
1747 static inline tree
1748 gimple_block (const gimple *g)
1750 return LOCATION_BLOCK (g->location);
1754 /* Set BLOCK to be the lexical scope block holding statement G. */
1756 static inline void
1757 gimple_set_block (gimple *g, tree block)
1759 g->location = set_block (g->location, block);
1763 /* Return location information for statement G. */
1765 static inline location_t
1766 gimple_location (const gimple *g)
1768 return g->location;
1771 /* Return location information for statement G if g is not NULL.
1772 Otherwise, UNKNOWN_LOCATION is returned. */
1774 static inline location_t
1775 gimple_location_safe (const gimple *g)
1777 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1780 /* Set location information for statement G. */
1782 static inline void
1783 gimple_set_location (gimple *g, location_t location)
1785 g->location = location;
1789 /* Return true if G contains location information. */
1791 static inline bool
1792 gimple_has_location (const gimple *g)
1794 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1798 /* Return the file name of the location of STMT. */
1800 static inline const char *
1801 gimple_filename (const gimple *stmt)
1803 return LOCATION_FILE (gimple_location (stmt));
1807 /* Return the line number of the location of STMT. */
1809 static inline int
1810 gimple_lineno (const gimple *stmt)
1812 return LOCATION_LINE (gimple_location (stmt));
1816 /* Determine whether SEQ is a singleton. */
1818 static inline bool
1819 gimple_seq_singleton_p (gimple_seq seq)
1821 return ((gimple_seq_first (seq) != NULL)
1822 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1825 /* Return true if no warnings should be emitted for statement STMT. */
1827 static inline bool
1828 gimple_no_warning_p (const gimple *stmt)
1830 return stmt->no_warning;
1833 /* Set the no_warning flag of STMT to NO_WARNING. */
1835 static inline void
1836 gimple_set_no_warning (gimple *stmt, bool no_warning)
1838 stmt->no_warning = (unsigned) no_warning;
1841 /* Set the visited status on statement STMT to VISITED_P.
1843 Please note that this 'visited' property of the gimple statement is
1844 supposed to be undefined at pass boundaries. This means that a
1845 given pass should not assume it contains any useful value when the
1846 pass starts and thus can set it to any value it sees fit.
1848 You can learn more about the visited property of the gimple
1849 statement by reading the comments of the 'visited' data member of
1850 struct gimple.
1853 static inline void
1854 gimple_set_visited (gimple *stmt, bool visited_p)
1856 stmt->visited = (unsigned) visited_p;
1860 /* Return the visited status for statement STMT.
1862 Please note that this 'visited' property of the gimple statement is
1863 supposed to be undefined at pass boundaries. This means that a
1864 given pass should not assume it contains any useful value when the
1865 pass starts and thus can set it to any value it sees fit.
1867 You can learn more about the visited property of the gimple
1868 statement by reading the comments of the 'visited' data member of
1869 struct gimple. */
1871 static inline bool
1872 gimple_visited_p (gimple *stmt)
1874 return stmt->visited;
1878 /* Set pass local flag PLF on statement STMT to VAL_P.
1880 Please note that this PLF property of the gimple statement is
1881 supposed to be undefined at pass boundaries. This means that a
1882 given pass should not assume it contains any useful value when the
1883 pass starts and thus can set it to any value it sees fit.
1885 You can learn more about the PLF property by reading the comment of
1886 the 'plf' data member of struct gimple_statement_structure. */
1888 static inline void
1889 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1891 if (val_p)
1892 stmt->plf |= (unsigned int) plf;
1893 else
1894 stmt->plf &= ~((unsigned int) plf);
1898 /* Return the value of pass local flag PLF on statement STMT.
1900 Please note that this 'plf' property of the gimple statement is
1901 supposed to be undefined at pass boundaries. This means that a
1902 given pass should not assume it contains any useful value when the
1903 pass starts and thus can set it to any value it sees fit.
1905 You can learn more about the plf property by reading the comment of
1906 the 'plf' data member of struct gimple_statement_structure. */
1908 static inline unsigned int
1909 gimple_plf (gimple *stmt, enum plf_mask plf)
1911 return stmt->plf & ((unsigned int) plf);
1915 /* Set the UID of statement.
1917 Please note that this UID property is supposed to be undefined at
1918 pass boundaries. This means that a given pass should not assume it
1919 contains any useful value when the pass starts and thus can set it
1920 to any value it sees fit. */
1922 static inline void
1923 gimple_set_uid (gimple *g, unsigned uid)
1925 g->uid = uid;
1929 /* Return the UID of statement.
1931 Please note that this UID property is supposed to be undefined at
1932 pass boundaries. This means that a given pass should not assume it
1933 contains any useful value when the pass starts and thus can set it
1934 to any value it sees fit. */
1936 static inline unsigned
1937 gimple_uid (const gimple *g)
1939 return g->uid;
1943 /* Make statement G a singleton sequence. */
1945 static inline void
1946 gimple_init_singleton (gimple *g)
1948 g->next = NULL;
1949 g->prev = g;
1953 /* Return true if GIMPLE statement G has register or memory operands. */
1955 static inline bool
1956 gimple_has_ops (const gimple *g)
1958 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1961 template <>
1962 template <>
1963 inline bool
1964 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1966 return gimple_has_ops (gs);
1969 template <>
1970 template <>
1971 inline bool
1972 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1974 return gimple_has_ops (gs);
1977 /* Return true if GIMPLE statement G has memory operands. */
1979 static inline bool
1980 gimple_has_mem_ops (const gimple *g)
1982 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1985 template <>
1986 template <>
1987 inline bool
1988 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1990 return gimple_has_mem_ops (gs);
1993 template <>
1994 template <>
1995 inline bool
1996 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1998 return gimple_has_mem_ops (gs);
2001 /* Return the set of USE operands for statement G. */
2003 static inline struct use_optype_d *
2004 gimple_use_ops (const gimple *g)
2006 const gimple_statement_with_ops *ops_stmt =
2007 dyn_cast <const gimple_statement_with_ops *> (g);
2008 if (!ops_stmt)
2009 return NULL;
2010 return ops_stmt->use_ops;
2014 /* Set USE to be the set of USE operands for statement G. */
2016 static inline void
2017 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2019 gimple_statement_with_ops *ops_stmt =
2020 as_a <gimple_statement_with_ops *> (g);
2021 ops_stmt->use_ops = use;
2025 /* Return the single VUSE operand of the statement G. */
2027 static inline tree
2028 gimple_vuse (const gimple *g)
2030 const gimple_statement_with_memory_ops *mem_ops_stmt =
2031 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2032 if (!mem_ops_stmt)
2033 return NULL_TREE;
2034 return mem_ops_stmt->vuse;
2037 /* Return the single VDEF operand of the statement G. */
2039 static inline tree
2040 gimple_vdef (const gimple *g)
2042 const gimple_statement_with_memory_ops *mem_ops_stmt =
2043 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2044 if (!mem_ops_stmt)
2045 return NULL_TREE;
2046 return mem_ops_stmt->vdef;
2049 /* Return the single VUSE operand of the statement G. */
2051 static inline tree *
2052 gimple_vuse_ptr (gimple *g)
2054 gimple_statement_with_memory_ops *mem_ops_stmt =
2055 dyn_cast <gimple_statement_with_memory_ops *> (g);
2056 if (!mem_ops_stmt)
2057 return NULL;
2058 return &mem_ops_stmt->vuse;
2061 /* Return the single VDEF operand of the statement G. */
2063 static inline tree *
2064 gimple_vdef_ptr (gimple *g)
2066 gimple_statement_with_memory_ops *mem_ops_stmt =
2067 dyn_cast <gimple_statement_with_memory_ops *> (g);
2068 if (!mem_ops_stmt)
2069 return NULL;
2070 return &mem_ops_stmt->vdef;
2073 /* Set the single VUSE operand of the statement G. */
2075 static inline void
2076 gimple_set_vuse (gimple *g, tree vuse)
2078 gimple_statement_with_memory_ops *mem_ops_stmt =
2079 as_a <gimple_statement_with_memory_ops *> (g);
2080 mem_ops_stmt->vuse = vuse;
2083 /* Set the single VDEF operand of the statement G. */
2085 static inline void
2086 gimple_set_vdef (gimple *g, tree vdef)
2088 gimple_statement_with_memory_ops *mem_ops_stmt =
2089 as_a <gimple_statement_with_memory_ops *> (g);
2090 mem_ops_stmt->vdef = vdef;
2094 /* Return true if statement G has operands and the modified field has
2095 been set. */
2097 static inline bool
2098 gimple_modified_p (const gimple *g)
2100 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2104 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2105 a MODIFIED field. */
2107 static inline void
2108 gimple_set_modified (gimple *s, bool modifiedp)
2110 if (gimple_has_ops (s))
2111 s->modified = (unsigned) modifiedp;
2115 /* Return the tree code for the expression computed by STMT. This is
2116 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2117 GIMPLE_CALL, return CALL_EXPR as the expression code for
2118 consistency. This is useful when the caller needs to deal with the
2119 three kinds of computation that GIMPLE supports. */
2121 static inline enum tree_code
2122 gimple_expr_code (const gimple *stmt)
2124 enum gimple_code code = gimple_code (stmt);
2125 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2126 return (enum tree_code) stmt->subcode;
2127 else
2129 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2130 return CALL_EXPR;
2135 /* Return true if statement STMT contains volatile operands. */
2137 static inline bool
2138 gimple_has_volatile_ops (const gimple *stmt)
2140 if (gimple_has_mem_ops (stmt))
2141 return stmt->has_volatile_ops;
2142 else
2143 return false;
2147 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2149 static inline void
2150 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2152 if (gimple_has_mem_ops (stmt))
2153 stmt->has_volatile_ops = (unsigned) volatilep;
2156 /* Return true if STMT is in a transaction. */
2158 static inline bool
2159 gimple_in_transaction (const gimple *stmt)
2161 return bb_in_transaction (gimple_bb (stmt));
2164 /* Return true if statement STMT may access memory. */
2166 static inline bool
2167 gimple_references_memory_p (gimple *stmt)
2169 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2173 /* Return the subcode for OMP statement S. */
2175 static inline unsigned
2176 gimple_omp_subcode (const gimple *s)
2178 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2179 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2180 return s->subcode;
2183 /* Set the subcode for OMP statement S to SUBCODE. */
2185 static inline void
2186 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2188 /* We only have 16 bits for the subcode. Assert that we are not
2189 overflowing it. */
2190 gcc_gimple_checking_assert (subcode < (1 << 16));
2191 s->subcode = subcode;
2194 /* Set the nowait flag on OMP_RETURN statement S. */
2196 static inline void
2197 gimple_omp_return_set_nowait (gimple *s)
2199 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2200 s->subcode |= GF_OMP_RETURN_NOWAIT;
2204 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2205 flag set. */
2207 static inline bool
2208 gimple_omp_return_nowait_p (const gimple *g)
2210 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2211 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2215 /* Set the LHS of OMP return. */
2217 static inline void
2218 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2220 gimple_statement_omp_return *omp_return_stmt =
2221 as_a <gimple_statement_omp_return *> (g);
2222 omp_return_stmt->val = lhs;
2226 /* Get the LHS of OMP return. */
2228 static inline tree
2229 gimple_omp_return_lhs (const gimple *g)
2231 const gimple_statement_omp_return *omp_return_stmt =
2232 as_a <const gimple_statement_omp_return *> (g);
2233 return omp_return_stmt->val;
2237 /* Return a pointer to the LHS of OMP return. */
2239 static inline tree *
2240 gimple_omp_return_lhs_ptr (gimple *g)
2242 gimple_statement_omp_return *omp_return_stmt =
2243 as_a <gimple_statement_omp_return *> (g);
2244 return &omp_return_stmt->val;
2248 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2249 flag set. */
2251 static inline bool
2252 gimple_omp_section_last_p (const gimple *g)
2254 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2255 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2259 /* Set the GF_OMP_SECTION_LAST flag on G. */
2261 static inline void
2262 gimple_omp_section_set_last (gimple *g)
2264 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2265 g->subcode |= GF_OMP_SECTION_LAST;
2269 /* Return true if OMP parallel statement G has the
2270 GF_OMP_PARALLEL_COMBINED flag set. */
2272 static inline bool
2273 gimple_omp_parallel_combined_p (const gimple *g)
2275 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2276 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2280 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2281 value of COMBINED_P. */
2283 static inline void
2284 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2286 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2287 if (combined_p)
2288 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2289 else
2290 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2294 /* Return true if OMP atomic load/store statement G has the
2295 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2297 static inline bool
2298 gimple_omp_atomic_need_value_p (const gimple *g)
2300 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2301 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2302 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2306 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2308 static inline void
2309 gimple_omp_atomic_set_need_value (gimple *g)
2311 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2312 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2313 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2317 /* Return true if OMP atomic load/store statement G has the
2318 GF_OMP_ATOMIC_SEQ_CST flag set. */
2320 static inline bool
2321 gimple_omp_atomic_seq_cst_p (const gimple *g)
2323 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2324 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2325 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2329 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2331 static inline void
2332 gimple_omp_atomic_set_seq_cst (gimple *g)
2334 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2335 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2336 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2340 /* Return the number of operands for statement GS. */
2342 static inline unsigned
2343 gimple_num_ops (const gimple *gs)
2345 return gs->num_ops;
2349 /* Set the number of operands for statement GS. */
2351 static inline void
2352 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2354 gs->num_ops = num_ops;
2358 /* Return the array of operands for statement GS. */
2360 static inline tree *
2361 gimple_ops (gimple *gs)
2363 size_t off;
2365 /* All the tuples have their operand vector at the very bottom
2366 of the structure. Note that those structures that do not
2367 have an operand vector have a zero offset. */
2368 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2369 gcc_gimple_checking_assert (off != 0);
2371 return (tree *) ((char *) gs + off);
2375 /* Return operand I for statement GS. */
2377 static inline tree
2378 gimple_op (const gimple *gs, unsigned i)
2380 if (gimple_has_ops (gs))
2382 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2383 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2385 else
2386 return NULL_TREE;
2389 /* Return a pointer to operand I for statement GS. */
2391 static inline tree *
2392 gimple_op_ptr (gimple *gs, unsigned i)
2394 if (gimple_has_ops (gs))
2396 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2397 return gimple_ops (gs) + i;
2399 else
2400 return NULL;
2403 /* Set operand I of statement GS to OP. */
2405 static inline void
2406 gimple_set_op (gimple *gs, unsigned i, tree op)
2408 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2410 /* Note. It may be tempting to assert that OP matches
2411 is_gimple_operand, but that would be wrong. Different tuples
2412 accept slightly different sets of tree operands. Each caller
2413 should perform its own validation. */
2414 gimple_ops (gs)[i] = op;
2417 /* Return true if GS is a GIMPLE_ASSIGN. */
2419 static inline bool
2420 is_gimple_assign (const gimple *gs)
2422 return gimple_code (gs) == GIMPLE_ASSIGN;
2425 /* Determine if expression CODE is one of the valid expressions that can
2426 be used on the RHS of GIMPLE assignments. */
2428 static inline enum gimple_rhs_class
2429 get_gimple_rhs_class (enum tree_code code)
2431 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2434 /* Return the LHS of assignment statement GS. */
2436 static inline tree
2437 gimple_assign_lhs (const gassign *gs)
2439 return gs->op[0];
2442 static inline tree
2443 gimple_assign_lhs (const gimple *gs)
2445 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2446 return gimple_assign_lhs (ass);
2450 /* Return a pointer to the LHS of assignment statement GS. */
2452 static inline tree *
2453 gimple_assign_lhs_ptr (gassign *gs)
2455 return &gs->op[0];
2458 static inline tree *
2459 gimple_assign_lhs_ptr (gimple *gs)
2461 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2462 return gimple_assign_lhs_ptr (ass);
2466 /* Set LHS to be the LHS operand of assignment statement GS. */
2468 static inline void
2469 gimple_assign_set_lhs (gassign *gs, tree lhs)
2471 gs->op[0] = lhs;
2473 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2474 SSA_NAME_DEF_STMT (lhs) = gs;
2477 static inline void
2478 gimple_assign_set_lhs (gimple *gs, tree lhs)
2480 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2481 gimple_assign_set_lhs (ass, lhs);
2485 /* Return the first operand on the RHS of assignment statement GS. */
2487 static inline tree
2488 gimple_assign_rhs1 (const gassign *gs)
2490 return gs->op[1];
2493 static inline tree
2494 gimple_assign_rhs1 (const gimple *gs)
2496 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2497 return gimple_assign_rhs1 (ass);
2501 /* Return a pointer to the first operand on the RHS of assignment
2502 statement GS. */
2504 static inline tree *
2505 gimple_assign_rhs1_ptr (gassign *gs)
2507 return &gs->op[1];
2510 static inline tree *
2511 gimple_assign_rhs1_ptr (gimple *gs)
2513 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2514 return gimple_assign_rhs1_ptr (ass);
2517 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2519 static inline void
2520 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2522 gs->op[1] = rhs;
2525 static inline void
2526 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2528 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2529 gimple_assign_set_rhs1 (ass, rhs);
2533 /* Return the second operand on the RHS of assignment statement GS.
2534 If GS does not have two operands, NULL is returned instead. */
2536 static inline tree
2537 gimple_assign_rhs2 (const gassign *gs)
2539 if (gimple_num_ops (gs) >= 3)
2540 return gs->op[2];
2541 else
2542 return NULL_TREE;
2545 static inline tree
2546 gimple_assign_rhs2 (const gimple *gs)
2548 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2549 return gimple_assign_rhs2 (ass);
2553 /* Return a pointer to the second operand on the RHS of assignment
2554 statement GS. */
2556 static inline tree *
2557 gimple_assign_rhs2_ptr (gassign *gs)
2559 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2560 return &gs->op[2];
2563 static inline tree *
2564 gimple_assign_rhs2_ptr (gimple *gs)
2566 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2567 return gimple_assign_rhs2_ptr (ass);
2571 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2573 static inline void
2574 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2576 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2577 gs->op[2] = rhs;
2580 static inline void
2581 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2583 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2584 return gimple_assign_set_rhs2 (ass, rhs);
2587 /* Return the third operand on the RHS of assignment statement GS.
2588 If GS does not have two operands, NULL is returned instead. */
2590 static inline tree
2591 gimple_assign_rhs3 (const gassign *gs)
2593 if (gimple_num_ops (gs) >= 4)
2594 return gs->op[3];
2595 else
2596 return NULL_TREE;
2599 static inline tree
2600 gimple_assign_rhs3 (const gimple *gs)
2602 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2603 return gimple_assign_rhs3 (ass);
2606 /* Return a pointer to the third operand on the RHS of assignment
2607 statement GS. */
2609 static inline tree *
2610 gimple_assign_rhs3_ptr (gimple *gs)
2612 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2613 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2614 return &ass->op[3];
2618 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2620 static inline void
2621 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2623 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2624 gs->op[3] = rhs;
2627 static inline void
2628 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2630 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2631 gimple_assign_set_rhs3 (ass, rhs);
2635 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2636 which expect to see only two operands. */
2638 static inline void
2639 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2640 tree op1, tree op2)
2642 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2645 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2646 which expect to see only one operands. */
2648 static inline void
2649 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2650 tree op1)
2652 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2655 /* Returns true if GS is a nontemporal move. */
2657 static inline bool
2658 gimple_assign_nontemporal_move_p (const gassign *gs)
2660 return gs->nontemporal_move;
2663 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2665 static inline void
2666 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2668 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2669 gs->nontemporal_move = nontemporal;
2673 /* Return the code of the expression computed on the rhs of assignment
2674 statement GS. In case that the RHS is a single object, returns the
2675 tree code of the object. */
2677 static inline enum tree_code
2678 gimple_assign_rhs_code (const gassign *gs)
2680 enum tree_code code = (enum tree_code) gs->subcode;
2681 /* While we initially set subcode to the TREE_CODE of the rhs for
2682 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2683 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2684 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2685 code = TREE_CODE (gs->op[1]);
2687 return code;
2690 static inline enum tree_code
2691 gimple_assign_rhs_code (const gimple *gs)
2693 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2694 return gimple_assign_rhs_code (ass);
2698 /* Set CODE to be the code for the expression computed on the RHS of
2699 assignment S. */
2701 static inline void
2702 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2704 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2705 s->subcode = code;
2709 /* Return the gimple rhs class of the code of the expression computed on
2710 the rhs of assignment statement GS.
2711 This will never return GIMPLE_INVALID_RHS. */
2713 static inline enum gimple_rhs_class
2714 gimple_assign_rhs_class (const gimple *gs)
2716 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2719 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2720 there is no operator associated with the assignment itself.
2721 Unlike gimple_assign_copy_p, this predicate returns true for
2722 any RHS operand, including those that perform an operation
2723 and do not have the semantics of a copy, such as COND_EXPR. */
2725 static inline bool
2726 gimple_assign_single_p (const gimple *gs)
2728 return (is_gimple_assign (gs)
2729 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2732 /* Return true if GS performs a store to its lhs. */
2734 static inline bool
2735 gimple_store_p (const gimple *gs)
2737 tree lhs = gimple_get_lhs (gs);
2738 return lhs && !is_gimple_reg (lhs);
2741 /* Return true if GS is an assignment that loads from its rhs1. */
2743 static inline bool
2744 gimple_assign_load_p (const gimple *gs)
2746 tree rhs;
2747 if (!gimple_assign_single_p (gs))
2748 return false;
2749 rhs = gimple_assign_rhs1 (gs);
2750 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2751 return true;
2752 rhs = get_base_address (rhs);
2753 return (DECL_P (rhs)
2754 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2758 /* Return true if S is a type-cast assignment. */
2760 static inline bool
2761 gimple_assign_cast_p (const gimple *s)
2763 if (is_gimple_assign (s))
2765 enum tree_code sc = gimple_assign_rhs_code (s);
2766 return CONVERT_EXPR_CODE_P (sc)
2767 || sc == VIEW_CONVERT_EXPR
2768 || sc == FIX_TRUNC_EXPR;
2771 return false;
2774 /* Return true if S is a clobber statement. */
2776 static inline bool
2777 gimple_clobber_p (const gimple *s)
2779 return gimple_assign_single_p (s)
2780 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2783 /* Return true if GS is a GIMPLE_CALL. */
2785 static inline bool
2786 is_gimple_call (const gimple *gs)
2788 return gimple_code (gs) == GIMPLE_CALL;
2791 /* Return the LHS of call statement GS. */
2793 static inline tree
2794 gimple_call_lhs (const gcall *gs)
2796 return gs->op[0];
2799 static inline tree
2800 gimple_call_lhs (const gimple *gs)
2802 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2803 return gimple_call_lhs (gc);
2807 /* Return a pointer to the LHS of call statement GS. */
2809 static inline tree *
2810 gimple_call_lhs_ptr (gcall *gs)
2812 return &gs->op[0];
2815 static inline tree *
2816 gimple_call_lhs_ptr (gimple *gs)
2818 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2819 return gimple_call_lhs_ptr (gc);
2823 /* Set LHS to be the LHS operand of call statement GS. */
2825 static inline void
2826 gimple_call_set_lhs (gcall *gs, tree lhs)
2828 gs->op[0] = lhs;
2829 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2830 SSA_NAME_DEF_STMT (lhs) = gs;
2833 static inline void
2834 gimple_call_set_lhs (gimple *gs, tree lhs)
2836 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2837 gimple_call_set_lhs (gc, lhs);
2841 /* Return true if call GS calls an internal-only function, as enumerated
2842 by internal_fn. */
2844 static inline bool
2845 gimple_call_internal_p (const gcall *gs)
2847 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2850 static inline bool
2851 gimple_call_internal_p (const gimple *gs)
2853 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2854 return gimple_call_internal_p (gc);
2858 /* Return true if call GS is marked as instrumented by
2859 Pointer Bounds Checker. */
2861 static inline bool
2862 gimple_call_with_bounds_p (const gcall *gs)
2864 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2867 static inline bool
2868 gimple_call_with_bounds_p (const gimple *gs)
2870 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2871 return gimple_call_with_bounds_p (gc);
2875 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2876 Pointer Bounds Checker. */
2878 static inline void
2879 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2881 if (with_bounds)
2882 gs->subcode |= GF_CALL_WITH_BOUNDS;
2883 else
2884 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2887 static inline void
2888 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2890 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2891 gimple_call_set_with_bounds (gc, with_bounds);
2895 /* Return true if call GS is marked as nocf_check. */
2897 static inline bool
2898 gimple_call_nocf_check_p (const gcall *gs)
2900 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
2903 /* Mark statement GS as nocf_check call. */
2905 static inline void
2906 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
2908 if (nocf_check)
2909 gs->subcode |= GF_CALL_NOCF_CHECK;
2910 else
2911 gs->subcode &= ~GF_CALL_NOCF_CHECK;
2914 /* Return the target of internal call GS. */
2916 static inline enum internal_fn
2917 gimple_call_internal_fn (const gcall *gs)
2919 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2920 return gs->u.internal_fn;
2923 static inline enum internal_fn
2924 gimple_call_internal_fn (const gimple *gs)
2926 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2927 return gimple_call_internal_fn (gc);
2930 /* Return true, if this internal gimple call is unique. */
2932 static inline bool
2933 gimple_call_internal_unique_p (const gcall *gs)
2935 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2938 static inline bool
2939 gimple_call_internal_unique_p (const gimple *gs)
2941 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2942 return gimple_call_internal_unique_p (gc);
2945 /* Return true if GS is an internal function FN. */
2947 static inline bool
2948 gimple_call_internal_p (const gimple *gs, internal_fn fn)
2950 return (is_gimple_call (gs)
2951 && gimple_call_internal_p (gs)
2952 && gimple_call_internal_fn (gs) == fn);
2955 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2956 that could alter control flow. */
2958 static inline void
2959 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2961 if (ctrl_altering_p)
2962 s->subcode |= GF_CALL_CTRL_ALTERING;
2963 else
2964 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2967 static inline void
2968 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2970 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2971 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2974 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2975 flag is set. Such call could not be a stmt in the middle of a bb. */
2977 static inline bool
2978 gimple_call_ctrl_altering_p (const gcall *gs)
2980 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2983 static inline bool
2984 gimple_call_ctrl_altering_p (const gimple *gs)
2986 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2987 return gimple_call_ctrl_altering_p (gc);
2991 /* Return the function type of the function called by GS. */
2993 static inline tree
2994 gimple_call_fntype (const gcall *gs)
2996 if (gimple_call_internal_p (gs))
2997 return NULL_TREE;
2998 return gs->u.fntype;
3001 static inline tree
3002 gimple_call_fntype (const gimple *gs)
3004 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3005 return gimple_call_fntype (call_stmt);
3008 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3010 static inline void
3011 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3013 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3014 call_stmt->u.fntype = fntype;
3018 /* Return the tree node representing the function called by call
3019 statement GS. */
3021 static inline tree
3022 gimple_call_fn (const gcall *gs)
3024 return gs->op[1];
3027 static inline tree
3028 gimple_call_fn (const gimple *gs)
3030 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3031 return gimple_call_fn (gc);
3034 /* Return a pointer to the tree node representing the function called by call
3035 statement GS. */
3037 static inline tree *
3038 gimple_call_fn_ptr (gcall *gs)
3040 return &gs->op[1];
3043 static inline tree *
3044 gimple_call_fn_ptr (gimple *gs)
3046 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3047 return gimple_call_fn_ptr (gc);
3051 /* Set FN to be the function called by call statement GS. */
3053 static inline void
3054 gimple_call_set_fn (gcall *gs, tree fn)
3056 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3057 gs->op[1] = fn;
3061 /* Set FNDECL to be the function called by call statement GS. */
3063 static inline void
3064 gimple_call_set_fndecl (gcall *gs, tree decl)
3066 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3067 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3068 build_pointer_type (TREE_TYPE (decl)), decl);
3071 static inline void
3072 gimple_call_set_fndecl (gimple *gs, tree decl)
3074 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3075 gimple_call_set_fndecl (gc, decl);
3079 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3081 static inline void
3082 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3084 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3085 call_stmt->u.internal_fn = fn;
3089 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3090 Otherwise return NULL. This function is analogous to
3091 get_callee_fndecl in tree land. */
3093 static inline tree
3094 gimple_call_fndecl (const gcall *gs)
3096 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3099 static inline tree
3100 gimple_call_fndecl (const gimple *gs)
3102 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3103 return gimple_call_fndecl (gc);
3107 /* Return the type returned by call statement GS. */
3109 static inline tree
3110 gimple_call_return_type (const gcall *gs)
3112 tree type = gimple_call_fntype (gs);
3114 if (type == NULL_TREE)
3115 return TREE_TYPE (gimple_call_lhs (gs));
3117 /* The type returned by a function is the type of its
3118 function type. */
3119 return TREE_TYPE (type);
3123 /* Return the static chain for call statement GS. */
3125 static inline tree
3126 gimple_call_chain (const gcall *gs)
3128 return gs->op[2];
3131 static inline tree
3132 gimple_call_chain (const gimple *gs)
3134 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3135 return gimple_call_chain (gc);
3139 /* Return a pointer to the static chain for call statement CALL_STMT. */
3141 static inline tree *
3142 gimple_call_chain_ptr (gcall *call_stmt)
3144 return &call_stmt->op[2];
3147 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3149 static inline void
3150 gimple_call_set_chain (gcall *call_stmt, tree chain)
3152 call_stmt->op[2] = chain;
3156 /* Return the number of arguments used by call statement GS. */
3158 static inline unsigned
3159 gimple_call_num_args (const gcall *gs)
3161 return gimple_num_ops (gs) - 3;
3164 static inline unsigned
3165 gimple_call_num_args (const gimple *gs)
3167 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3168 return gimple_call_num_args (gc);
3172 /* Return the argument at position INDEX for call statement GS. */
3174 static inline tree
3175 gimple_call_arg (const gcall *gs, unsigned index)
3177 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3178 return gs->op[index + 3];
3181 static inline tree
3182 gimple_call_arg (const gimple *gs, unsigned index)
3184 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3185 return gimple_call_arg (gc, index);
3189 /* Return a pointer to the argument at position INDEX for call
3190 statement GS. */
3192 static inline tree *
3193 gimple_call_arg_ptr (gcall *gs, unsigned index)
3195 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3196 return &gs->op[index + 3];
3199 static inline tree *
3200 gimple_call_arg_ptr (gimple *gs, unsigned index)
3202 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3203 return gimple_call_arg_ptr (gc, index);
3207 /* Set ARG to be the argument at position INDEX for call statement GS. */
3209 static inline void
3210 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3212 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3213 gs->op[index + 3] = arg;
3216 static inline void
3217 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3219 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3220 gimple_call_set_arg (gc, index, arg);
3224 /* If TAIL_P is true, mark call statement S as being a tail call
3225 (i.e., a call just before the exit of a function). These calls are
3226 candidate for tail call optimization. */
3228 static inline void
3229 gimple_call_set_tail (gcall *s, bool tail_p)
3231 if (tail_p)
3232 s->subcode |= GF_CALL_TAILCALL;
3233 else
3234 s->subcode &= ~GF_CALL_TAILCALL;
3238 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3240 static inline bool
3241 gimple_call_tail_p (gcall *s)
3243 return (s->subcode & GF_CALL_TAILCALL) != 0;
3246 /* Mark (or clear) call statement S as requiring tail call optimization. */
3248 static inline void
3249 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3251 if (must_tail_p)
3252 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3253 else
3254 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3257 /* Return true if call statement has been marked as requiring
3258 tail call optimization. */
3260 static inline bool
3261 gimple_call_must_tail_p (const gcall *s)
3263 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3266 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3267 slot optimization. This transformation uses the target of the call
3268 expansion as the return slot for calls that return in memory. */
3270 static inline void
3271 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3273 if (return_slot_opt_p)
3274 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3275 else
3276 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3280 /* Return true if S is marked for return slot optimization. */
3282 static inline bool
3283 gimple_call_return_slot_opt_p (gcall *s)
3285 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3289 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3290 thunk to the thunked-to function. */
3292 static inline void
3293 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3295 if (from_thunk_p)
3296 s->subcode |= GF_CALL_FROM_THUNK;
3297 else
3298 s->subcode &= ~GF_CALL_FROM_THUNK;
3302 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3304 static inline bool
3305 gimple_call_from_thunk_p (gcall *s)
3307 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3311 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3312 argument pack in its argument list. */
3314 static inline void
3315 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3317 if (pass_arg_pack_p)
3318 s->subcode |= GF_CALL_VA_ARG_PACK;
3319 else
3320 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3324 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3325 argument pack in its argument list. */
3327 static inline bool
3328 gimple_call_va_arg_pack_p (gcall *s)
3330 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3334 /* Return true if S is a noreturn call. */
3336 static inline bool
3337 gimple_call_noreturn_p (const gcall *s)
3339 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3342 static inline bool
3343 gimple_call_noreturn_p (const gimple *s)
3345 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3346 return gimple_call_noreturn_p (gc);
3350 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3351 even if the called function can throw in other cases. */
3353 static inline void
3354 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3356 if (nothrow_p)
3357 s->subcode |= GF_CALL_NOTHROW;
3358 else
3359 s->subcode &= ~GF_CALL_NOTHROW;
3362 /* Return true if S is a nothrow call. */
3364 static inline bool
3365 gimple_call_nothrow_p (gcall *s)
3367 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3370 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3371 is known to be emitted for VLA objects. Those are wrapped by
3372 stack_save/stack_restore calls and hence can't lead to unbounded
3373 stack growth even when they occur in loops. */
3375 static inline void
3376 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3378 if (for_var)
3379 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3380 else
3381 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3384 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3386 static inline bool
3387 gimple_call_alloca_for_var_p (gcall *s)
3389 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3392 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3393 pointers to nested function are descriptors instead of trampolines. */
3395 static inline void
3396 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3398 if (by_descriptor_p)
3399 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3400 else
3401 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3404 /* Return true if S is a by-descriptor call. */
3406 static inline bool
3407 gimple_call_by_descriptor_p (gcall *s)
3409 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3412 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3414 static inline void
3415 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3417 dest_call->subcode = orig_call->subcode;
3421 /* Return a pointer to the points-to solution for the set of call-used
3422 variables of the call CALL_STMT. */
3424 static inline struct pt_solution *
3425 gimple_call_use_set (gcall *call_stmt)
3427 return &call_stmt->call_used;
3431 /* Return a pointer to the points-to solution for the set of call-used
3432 variables of the call CALL_STMT. */
3434 static inline struct pt_solution *
3435 gimple_call_clobber_set (gcall *call_stmt)
3437 return &call_stmt->call_clobbered;
3441 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3442 non-NULL lhs. */
3444 static inline bool
3445 gimple_has_lhs (gimple *stmt)
3447 if (is_gimple_assign (stmt))
3448 return true;
3449 if (gcall *call = dyn_cast <gcall *> (stmt))
3450 return gimple_call_lhs (call) != NULL_TREE;
3451 return false;
3455 /* Return the code of the predicate computed by conditional statement GS. */
3457 static inline enum tree_code
3458 gimple_cond_code (const gcond *gs)
3460 return (enum tree_code) gs->subcode;
3463 static inline enum tree_code
3464 gimple_cond_code (const gimple *gs)
3466 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3467 return gimple_cond_code (gc);
3471 /* Set CODE to be the predicate code for the conditional statement GS. */
3473 static inline void
3474 gimple_cond_set_code (gcond *gs, enum tree_code code)
3476 gs->subcode = code;
3480 /* Return the LHS of the predicate computed by conditional statement GS. */
3482 static inline tree
3483 gimple_cond_lhs (const gcond *gs)
3485 return gs->op[0];
3488 static inline tree
3489 gimple_cond_lhs (const gimple *gs)
3491 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3492 return gimple_cond_lhs (gc);
3495 /* Return the pointer to the LHS of the predicate computed by conditional
3496 statement GS. */
3498 static inline tree *
3499 gimple_cond_lhs_ptr (gcond *gs)
3501 return &gs->op[0];
3504 /* Set LHS to be the LHS operand of the predicate computed by
3505 conditional statement GS. */
3507 static inline void
3508 gimple_cond_set_lhs (gcond *gs, tree lhs)
3510 gs->op[0] = lhs;
3514 /* Return the RHS operand of the predicate computed by conditional GS. */
3516 static inline tree
3517 gimple_cond_rhs (const gcond *gs)
3519 return gs->op[1];
3522 static inline tree
3523 gimple_cond_rhs (const gimple *gs)
3525 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3526 return gimple_cond_rhs (gc);
3529 /* Return the pointer to the RHS operand of the predicate computed by
3530 conditional GS. */
3532 static inline tree *
3533 gimple_cond_rhs_ptr (gcond *gs)
3535 return &gs->op[1];
3539 /* Set RHS to be the RHS operand of the predicate computed by
3540 conditional statement GS. */
3542 static inline void
3543 gimple_cond_set_rhs (gcond *gs, tree rhs)
3545 gs->op[1] = rhs;
3549 /* Return the label used by conditional statement GS when its
3550 predicate evaluates to true. */
3552 static inline tree
3553 gimple_cond_true_label (const gcond *gs)
3555 return gs->op[2];
3559 /* Set LABEL to be the label used by conditional statement GS when its
3560 predicate evaluates to true. */
3562 static inline void
3563 gimple_cond_set_true_label (gcond *gs, tree label)
3565 gs->op[2] = label;
3569 /* Set LABEL to be the label used by conditional statement GS when its
3570 predicate evaluates to false. */
3572 static inline void
3573 gimple_cond_set_false_label (gcond *gs, tree label)
3575 gs->op[3] = label;
3579 /* Return the label used by conditional statement GS when its
3580 predicate evaluates to false. */
3582 static inline tree
3583 gimple_cond_false_label (const gcond *gs)
3585 return gs->op[3];
3589 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3591 static inline void
3592 gimple_cond_make_false (gcond *gs)
3594 gimple_cond_set_lhs (gs, boolean_false_node);
3595 gimple_cond_set_rhs (gs, boolean_false_node);
3596 gs->subcode = NE_EXPR;
3600 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3602 static inline void
3603 gimple_cond_make_true (gcond *gs)
3605 gimple_cond_set_lhs (gs, boolean_true_node);
3606 gimple_cond_set_rhs (gs, boolean_false_node);
3607 gs->subcode = NE_EXPR;
3610 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3611 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3613 static inline bool
3614 gimple_cond_true_p (const gcond *gs)
3616 tree lhs = gimple_cond_lhs (gs);
3617 tree rhs = gimple_cond_rhs (gs);
3618 enum tree_code code = gimple_cond_code (gs);
3620 if (lhs != boolean_true_node && lhs != boolean_false_node)
3621 return false;
3623 if (rhs != boolean_true_node && rhs != boolean_false_node)
3624 return false;
3626 if (code == NE_EXPR && lhs != rhs)
3627 return true;
3629 if (code == EQ_EXPR && lhs == rhs)
3630 return true;
3632 return false;
3635 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3636 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3638 static inline bool
3639 gimple_cond_false_p (const gcond *gs)
3641 tree lhs = gimple_cond_lhs (gs);
3642 tree rhs = gimple_cond_rhs (gs);
3643 enum tree_code code = gimple_cond_code (gs);
3645 if (lhs != boolean_true_node && lhs != boolean_false_node)
3646 return false;
3648 if (rhs != boolean_true_node && rhs != boolean_false_node)
3649 return false;
3651 if (code == NE_EXPR && lhs == rhs)
3652 return true;
3654 if (code == EQ_EXPR && lhs != rhs)
3655 return true;
3657 return false;
3660 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3662 static inline void
3663 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3664 tree rhs)
3666 gimple_cond_set_code (stmt, code);
3667 gimple_cond_set_lhs (stmt, lhs);
3668 gimple_cond_set_rhs (stmt, rhs);
3671 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3673 static inline tree
3674 gimple_label_label (const glabel *gs)
3676 return gs->op[0];
3680 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3681 GS. */
3683 static inline void
3684 gimple_label_set_label (glabel *gs, tree label)
3686 gs->op[0] = label;
3690 /* Return the destination of the unconditional jump GS. */
3692 static inline tree
3693 gimple_goto_dest (const gimple *gs)
3695 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3696 return gimple_op (gs, 0);
3700 /* Set DEST to be the destination of the unconditonal jump GS. */
3702 static inline void
3703 gimple_goto_set_dest (ggoto *gs, tree dest)
3705 gs->op[0] = dest;
3709 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3711 static inline tree
3712 gimple_bind_vars (const gbind *bind_stmt)
3714 return bind_stmt->vars;
3718 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3719 statement GS. */
3721 static inline void
3722 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3724 bind_stmt->vars = vars;
3728 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3729 statement GS. */
3731 static inline void
3732 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3734 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3738 static inline gimple_seq *
3739 gimple_bind_body_ptr (gbind *bind_stmt)
3741 return &bind_stmt->body;
3744 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3746 static inline gimple_seq
3747 gimple_bind_body (gbind *gs)
3749 return *gimple_bind_body_ptr (gs);
3753 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3754 statement GS. */
3756 static inline void
3757 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3759 bind_stmt->body = seq;
3763 /* Append a statement to the end of a GIMPLE_BIND's body. */
3765 static inline void
3766 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3768 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3772 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3774 static inline void
3775 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3777 gimple_seq_add_seq (&bind_stmt->body, seq);
3781 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3782 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3784 static inline tree
3785 gimple_bind_block (const gbind *bind_stmt)
3787 return bind_stmt->block;
3791 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3792 statement GS. */
3794 static inline void
3795 gimple_bind_set_block (gbind *bind_stmt, tree block)
3797 gcc_gimple_checking_assert (block == NULL_TREE
3798 || TREE_CODE (block) == BLOCK);
3799 bind_stmt->block = block;
3803 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3805 static inline unsigned
3806 gimple_asm_ninputs (const gasm *asm_stmt)
3808 return asm_stmt->ni;
3812 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3814 static inline unsigned
3815 gimple_asm_noutputs (const gasm *asm_stmt)
3817 return asm_stmt->no;
3821 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3823 static inline unsigned
3824 gimple_asm_nclobbers (const gasm *asm_stmt)
3826 return asm_stmt->nc;
3829 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3831 static inline unsigned
3832 gimple_asm_nlabels (const gasm *asm_stmt)
3834 return asm_stmt->nl;
3837 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3839 static inline tree
3840 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3842 gcc_gimple_checking_assert (index < asm_stmt->ni);
3843 return asm_stmt->op[index + asm_stmt->no];
3846 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3848 static inline void
3849 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3851 gcc_gimple_checking_assert (index < asm_stmt->ni
3852 && TREE_CODE (in_op) == TREE_LIST);
3853 asm_stmt->op[index + asm_stmt->no] = in_op;
3857 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3859 static inline tree
3860 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3862 gcc_gimple_checking_assert (index < asm_stmt->no);
3863 return asm_stmt->op[index];
3866 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3868 static inline void
3869 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3871 gcc_gimple_checking_assert (index < asm_stmt->no
3872 && TREE_CODE (out_op) == TREE_LIST);
3873 asm_stmt->op[index] = out_op;
3877 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3879 static inline tree
3880 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3882 gcc_gimple_checking_assert (index < asm_stmt->nc);
3883 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3887 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3889 static inline void
3890 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3892 gcc_gimple_checking_assert (index < asm_stmt->nc
3893 && TREE_CODE (clobber_op) == TREE_LIST);
3894 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3897 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3899 static inline tree
3900 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3902 gcc_gimple_checking_assert (index < asm_stmt->nl);
3903 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3906 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3908 static inline void
3909 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3911 gcc_gimple_checking_assert (index < asm_stmt->nl
3912 && TREE_CODE (label_op) == TREE_LIST);
3913 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3916 /* Return the string representing the assembly instruction in
3917 GIMPLE_ASM ASM_STMT. */
3919 static inline const char *
3920 gimple_asm_string (const gasm *asm_stmt)
3922 return asm_stmt->string;
3926 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3928 static inline bool
3929 gimple_asm_volatile_p (const gasm *asm_stmt)
3931 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3935 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3937 static inline void
3938 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3940 if (volatile_p)
3941 asm_stmt->subcode |= GF_ASM_VOLATILE;
3942 else
3943 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3947 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3949 static inline void
3950 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3952 if (input_p)
3953 asm_stmt->subcode |= GF_ASM_INPUT;
3954 else
3955 asm_stmt->subcode &= ~GF_ASM_INPUT;
3959 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3961 static inline bool
3962 gimple_asm_input_p (const gasm *asm_stmt)
3964 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3968 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3970 static inline tree
3971 gimple_catch_types (const gcatch *catch_stmt)
3973 return catch_stmt->types;
3977 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3979 static inline tree *
3980 gimple_catch_types_ptr (gcatch *catch_stmt)
3982 return &catch_stmt->types;
3986 /* Return a pointer to the GIMPLE sequence representing the body of
3987 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3989 static inline gimple_seq *
3990 gimple_catch_handler_ptr (gcatch *catch_stmt)
3992 return &catch_stmt->handler;
3996 /* Return the GIMPLE sequence representing the body of the handler of
3997 GIMPLE_CATCH statement CATCH_STMT. */
3999 static inline gimple_seq
4000 gimple_catch_handler (gcatch *catch_stmt)
4002 return *gimple_catch_handler_ptr (catch_stmt);
4006 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4008 static inline void
4009 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4011 catch_stmt->types = t;
4015 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4017 static inline void
4018 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4020 catch_stmt->handler = handler;
4024 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4026 static inline tree
4027 gimple_eh_filter_types (const gimple *gs)
4029 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4030 return eh_filter_stmt->types;
4034 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4035 GS. */
4037 static inline tree *
4038 gimple_eh_filter_types_ptr (gimple *gs)
4040 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4041 return &eh_filter_stmt->types;
4045 /* Return a pointer to the sequence of statement to execute when
4046 GIMPLE_EH_FILTER statement fails. */
4048 static inline gimple_seq *
4049 gimple_eh_filter_failure_ptr (gimple *gs)
4051 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4052 return &eh_filter_stmt->failure;
4056 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4057 statement fails. */
4059 static inline gimple_seq
4060 gimple_eh_filter_failure (gimple *gs)
4062 return *gimple_eh_filter_failure_ptr (gs);
4066 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4067 EH_FILTER_STMT. */
4069 static inline void
4070 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4072 eh_filter_stmt->types = types;
4076 /* Set FAILURE to be the sequence of statements to execute on failure
4077 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4079 static inline void
4080 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4081 gimple_seq failure)
4083 eh_filter_stmt->failure = failure;
4086 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4088 static inline tree
4089 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4091 return eh_mnt_stmt->fndecl;
4094 /* Set the function decl to be called by GS to DECL. */
4096 static inline void
4097 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4098 tree decl)
4100 eh_mnt_stmt->fndecl = decl;
4103 /* GIMPLE_EH_ELSE accessors. */
4105 static inline gimple_seq *
4106 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4108 return &eh_else_stmt->n_body;
4111 static inline gimple_seq
4112 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4114 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4117 static inline gimple_seq *
4118 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4120 return &eh_else_stmt->e_body;
4123 static inline gimple_seq
4124 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4126 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4129 static inline void
4130 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4132 eh_else_stmt->n_body = seq;
4135 static inline void
4136 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4138 eh_else_stmt->e_body = seq;
4141 /* GIMPLE_TRY accessors. */
4143 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4144 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4146 static inline enum gimple_try_flags
4147 gimple_try_kind (const gimple *gs)
4149 GIMPLE_CHECK (gs, GIMPLE_TRY);
4150 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4154 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4156 static inline void
4157 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4159 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4160 || kind == GIMPLE_TRY_FINALLY);
4161 if (gimple_try_kind (gs) != kind)
4162 gs->subcode = (unsigned int) kind;
4166 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4168 static inline bool
4169 gimple_try_catch_is_cleanup (const gimple *gs)
4171 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4172 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4176 /* Return a pointer to the sequence of statements used as the
4177 body for GIMPLE_TRY GS. */
4179 static inline gimple_seq *
4180 gimple_try_eval_ptr (gimple *gs)
4182 gtry *try_stmt = as_a <gtry *> (gs);
4183 return &try_stmt->eval;
4187 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4189 static inline gimple_seq
4190 gimple_try_eval (gimple *gs)
4192 return *gimple_try_eval_ptr (gs);
4196 /* Return a pointer to the sequence of statements used as the cleanup body for
4197 GIMPLE_TRY GS. */
4199 static inline gimple_seq *
4200 gimple_try_cleanup_ptr (gimple *gs)
4202 gtry *try_stmt = as_a <gtry *> (gs);
4203 return &try_stmt->cleanup;
4207 /* Return the sequence of statements used as the cleanup body for
4208 GIMPLE_TRY GS. */
4210 static inline gimple_seq
4211 gimple_try_cleanup (gimple *gs)
4213 return *gimple_try_cleanup_ptr (gs);
4217 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4219 static inline void
4220 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4222 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4223 if (catch_is_cleanup)
4224 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4225 else
4226 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4230 /* Set EVAL to be the sequence of statements to use as the body for
4231 GIMPLE_TRY TRY_STMT. */
4233 static inline void
4234 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4236 try_stmt->eval = eval;
4240 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4241 body for GIMPLE_TRY TRY_STMT. */
4243 static inline void
4244 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4246 try_stmt->cleanup = cleanup;
4250 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4252 static inline gimple_seq *
4253 gimple_wce_cleanup_ptr (gimple *gs)
4255 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4256 return &wce_stmt->cleanup;
4260 /* Return the cleanup sequence for cleanup statement GS. */
4262 static inline gimple_seq
4263 gimple_wce_cleanup (gimple *gs)
4265 return *gimple_wce_cleanup_ptr (gs);
4269 /* Set CLEANUP to be the cleanup sequence for GS. */
4271 static inline void
4272 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4274 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4275 wce_stmt->cleanup = cleanup;
4279 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4281 static inline bool
4282 gimple_wce_cleanup_eh_only (const gimple *gs)
4284 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4285 return gs->subcode != 0;
4289 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4291 static inline void
4292 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4294 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4295 gs->subcode = (unsigned int) eh_only_p;
4299 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4301 static inline unsigned
4302 gimple_phi_capacity (const gimple *gs)
4304 const gphi *phi_stmt = as_a <const gphi *> (gs);
4305 return phi_stmt->capacity;
4309 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4310 be exactly the number of incoming edges for the basic block holding
4311 GS. */
4313 static inline unsigned
4314 gimple_phi_num_args (const gimple *gs)
4316 const gphi *phi_stmt = as_a <const gphi *> (gs);
4317 return phi_stmt->nargs;
4321 /* Return the SSA name created by GIMPLE_PHI GS. */
4323 static inline tree
4324 gimple_phi_result (const gphi *gs)
4326 return gs->result;
4329 static inline tree
4330 gimple_phi_result (const gimple *gs)
4332 const gphi *phi_stmt = as_a <const gphi *> (gs);
4333 return gimple_phi_result (phi_stmt);
4336 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4338 static inline tree *
4339 gimple_phi_result_ptr (gphi *gs)
4341 return &gs->result;
4344 static inline tree *
4345 gimple_phi_result_ptr (gimple *gs)
4347 gphi *phi_stmt = as_a <gphi *> (gs);
4348 return gimple_phi_result_ptr (phi_stmt);
4351 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4353 static inline void
4354 gimple_phi_set_result (gphi *phi, tree result)
4356 phi->result = result;
4357 if (result && TREE_CODE (result) == SSA_NAME)
4358 SSA_NAME_DEF_STMT (result) = phi;
4362 /* Return the PHI argument corresponding to incoming edge INDEX for
4363 GIMPLE_PHI GS. */
4365 static inline struct phi_arg_d *
4366 gimple_phi_arg (gphi *gs, unsigned index)
4368 gcc_gimple_checking_assert (index < gs->nargs);
4369 return &(gs->args[index]);
4372 static inline struct phi_arg_d *
4373 gimple_phi_arg (gimple *gs, unsigned index)
4375 gphi *phi_stmt = as_a <gphi *> (gs);
4376 return gimple_phi_arg (phi_stmt, index);
4379 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4380 for GIMPLE_PHI PHI. */
4382 static inline void
4383 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4385 gcc_gimple_checking_assert (index < phi->nargs);
4386 phi->args[index] = *phiarg;
4389 /* Return the PHI nodes for basic block BB, or NULL if there are no
4390 PHI nodes. */
4392 static inline gimple_seq
4393 phi_nodes (const_basic_block bb)
4395 gcc_checking_assert (!(bb->flags & BB_RTL));
4396 return bb->il.gimple.phi_nodes;
4399 /* Return a pointer to the PHI nodes for basic block BB. */
4401 static inline gimple_seq *
4402 phi_nodes_ptr (basic_block bb)
4404 gcc_checking_assert (!(bb->flags & BB_RTL));
4405 return &bb->il.gimple.phi_nodes;
4408 /* Return the tree operand for argument I of PHI node GS. */
4410 static inline tree
4411 gimple_phi_arg_def (gphi *gs, size_t index)
4413 return gimple_phi_arg (gs, index)->def;
4416 static inline tree
4417 gimple_phi_arg_def (gimple *gs, size_t index)
4419 return gimple_phi_arg (gs, index)->def;
4423 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4425 static inline tree *
4426 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4428 return &gimple_phi_arg (phi, index)->def;
4431 /* Return the edge associated with argument I of phi node PHI. */
4433 static inline edge
4434 gimple_phi_arg_edge (gphi *phi, size_t i)
4436 return EDGE_PRED (gimple_bb (phi), i);
4439 /* Return the source location of gimple argument I of phi node PHI. */
4441 static inline source_location
4442 gimple_phi_arg_location (gphi *phi, size_t i)
4444 return gimple_phi_arg (phi, i)->locus;
4447 /* Return the source location of the argument on edge E of phi node PHI. */
4449 static inline source_location
4450 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4452 return gimple_phi_arg (phi, e->dest_idx)->locus;
4455 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4457 static inline void
4458 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4460 gimple_phi_arg (phi, i)->locus = loc;
4463 /* Return TRUE if argument I of phi node PHI has a location record. */
4465 static inline bool
4466 gimple_phi_arg_has_location (gphi *phi, size_t i)
4468 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4472 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4474 static inline int
4475 gimple_resx_region (const gresx *resx_stmt)
4477 return resx_stmt->region;
4480 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4482 static inline void
4483 gimple_resx_set_region (gresx *resx_stmt, int region)
4485 resx_stmt->region = region;
4488 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4490 static inline int
4491 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4493 return eh_dispatch_stmt->region;
4496 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4497 EH_DISPATCH_STMT. */
4499 static inline void
4500 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4502 eh_dispatch_stmt->region = region;
4505 /* Return the number of labels associated with the switch statement GS. */
4507 static inline unsigned
4508 gimple_switch_num_labels (const gswitch *gs)
4510 unsigned num_ops;
4511 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4512 num_ops = gimple_num_ops (gs);
4513 gcc_gimple_checking_assert (num_ops > 1);
4514 return num_ops - 1;
4518 /* Set NLABELS to be the number of labels for the switch statement GS. */
4520 static inline void
4521 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4523 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4524 gimple_set_num_ops (g, nlabels + 1);
4528 /* Return the index variable used by the switch statement GS. */
4530 static inline tree
4531 gimple_switch_index (const gswitch *gs)
4533 return gs->op[0];
4537 /* Return a pointer to the index variable for the switch statement GS. */
4539 static inline tree *
4540 gimple_switch_index_ptr (gswitch *gs)
4542 return &gs->op[0];
4546 /* Set INDEX to be the index variable for switch statement GS. */
4548 static inline void
4549 gimple_switch_set_index (gswitch *gs, tree index)
4551 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4552 gs->op[0] = index;
4556 /* Return the label numbered INDEX. The default label is 0, followed by any
4557 labels in a switch statement. */
4559 static inline tree
4560 gimple_switch_label (const gswitch *gs, unsigned index)
4562 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4563 return gs->op[index + 1];
4566 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4568 static inline void
4569 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4571 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4572 && (label == NULL_TREE
4573 || TREE_CODE (label) == CASE_LABEL_EXPR));
4574 gs->op[index + 1] = label;
4577 /* Return the default label for a switch statement. */
4579 static inline tree
4580 gimple_switch_default_label (const gswitch *gs)
4582 tree label = gimple_switch_label (gs, 0);
4583 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4584 return label;
4587 /* Set the default label for a switch statement. */
4589 static inline void
4590 gimple_switch_set_default_label (gswitch *gs, tree label)
4592 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4593 gimple_switch_set_label (gs, 0, label);
4596 /* Return true if GS is a GIMPLE_DEBUG statement. */
4598 static inline bool
4599 is_gimple_debug (const gimple *gs)
4601 return gimple_code (gs) == GIMPLE_DEBUG;
4604 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4606 static inline bool
4607 gimple_debug_bind_p (const gimple *s)
4609 if (is_gimple_debug (s))
4610 return s->subcode == GIMPLE_DEBUG_BIND;
4612 return false;
4615 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4617 static inline tree
4618 gimple_debug_bind_get_var (gimple *dbg)
4620 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4621 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4622 return gimple_op (dbg, 0);
4625 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4626 statement. */
4628 static inline tree
4629 gimple_debug_bind_get_value (gimple *dbg)
4631 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4632 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4633 return gimple_op (dbg, 1);
4636 /* Return a pointer to the value bound to the variable in a
4637 GIMPLE_DEBUG bind statement. */
4639 static inline tree *
4640 gimple_debug_bind_get_value_ptr (gimple *dbg)
4642 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4643 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4644 return gimple_op_ptr (dbg, 1);
4647 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4649 static inline void
4650 gimple_debug_bind_set_var (gimple *dbg, tree var)
4652 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4653 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4654 gimple_set_op (dbg, 0, var);
4657 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4658 statement. */
4660 static inline void
4661 gimple_debug_bind_set_value (gimple *dbg, tree value)
4663 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4664 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4665 gimple_set_op (dbg, 1, value);
4668 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4669 optimized away. */
4670 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4672 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4673 statement. */
4675 static inline void
4676 gimple_debug_bind_reset_value (gimple *dbg)
4678 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4679 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4680 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4683 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4684 value. */
4686 static inline bool
4687 gimple_debug_bind_has_value_p (gimple *dbg)
4689 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4690 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4691 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4694 #undef GIMPLE_DEBUG_BIND_NOVALUE
4696 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4698 static inline bool
4699 gimple_debug_source_bind_p (const gimple *s)
4701 if (is_gimple_debug (s))
4702 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4704 return false;
4707 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4709 static inline tree
4710 gimple_debug_source_bind_get_var (gimple *dbg)
4712 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4713 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4714 return gimple_op (dbg, 0);
4717 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4718 statement. */
4720 static inline tree
4721 gimple_debug_source_bind_get_value (gimple *dbg)
4723 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4724 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4725 return gimple_op (dbg, 1);
4728 /* Return a pointer to the value bound to the variable in a
4729 GIMPLE_DEBUG source bind statement. */
4731 static inline tree *
4732 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4734 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4735 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4736 return gimple_op_ptr (dbg, 1);
4739 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4741 static inline void
4742 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4744 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4745 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4746 gimple_set_op (dbg, 0, var);
4749 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4750 statement. */
4752 static inline void
4753 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4755 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4756 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4757 gimple_set_op (dbg, 1, value);
4760 /* Return the line number for EXPR, or return -1 if we have no line
4761 number information for it. */
4762 static inline int
4763 get_lineno (const gimple *stmt)
4765 location_t loc;
4767 if (!stmt)
4768 return -1;
4770 loc = gimple_location (stmt);
4771 if (loc == UNKNOWN_LOCATION)
4772 return -1;
4774 return LOCATION_LINE (loc);
4777 /* Return a pointer to the body for the OMP statement GS. */
4779 static inline gimple_seq *
4780 gimple_omp_body_ptr (gimple *gs)
4782 return &static_cast <gimple_statement_omp *> (gs)->body;
4785 /* Return the body for the OMP statement GS. */
4787 static inline gimple_seq
4788 gimple_omp_body (gimple *gs)
4790 return *gimple_omp_body_ptr (gs);
4793 /* Set BODY to be the body for the OMP statement GS. */
4795 static inline void
4796 gimple_omp_set_body (gimple *gs, gimple_seq body)
4798 static_cast <gimple_statement_omp *> (gs)->body = body;
4802 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4804 static inline tree
4805 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4807 return crit_stmt->name;
4811 /* Return a pointer to the name associated with OMP critical statement
4812 CRIT_STMT. */
4814 static inline tree *
4815 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4817 return &crit_stmt->name;
4821 /* Set NAME to be the name associated with OMP critical statement
4822 CRIT_STMT. */
4824 static inline void
4825 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4827 crit_stmt->name = name;
4831 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4833 static inline tree
4834 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4836 return crit_stmt->clauses;
4840 /* Return a pointer to the clauses associated with OMP critical statement
4841 CRIT_STMT. */
4843 static inline tree *
4844 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4846 return &crit_stmt->clauses;
4850 /* Set CLAUSES to be the clauses associated with OMP critical statement
4851 CRIT_STMT. */
4853 static inline void
4854 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4856 crit_stmt->clauses = clauses;
4860 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4862 static inline tree
4863 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4865 return ord_stmt->clauses;
4869 /* Return a pointer to the clauses associated with OMP ordered statement
4870 ORD_STMT. */
4872 static inline tree *
4873 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4875 return &ord_stmt->clauses;
4879 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4880 ORD_STMT. */
4882 static inline void
4883 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4885 ord_stmt->clauses = clauses;
4889 /* Return the kind of the OMP_FOR statemement G. */
4891 static inline int
4892 gimple_omp_for_kind (const gimple *g)
4894 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4895 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4899 /* Set the kind of the OMP_FOR statement G. */
4901 static inline void
4902 gimple_omp_for_set_kind (gomp_for *g, int kind)
4904 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4905 | (kind & GF_OMP_FOR_KIND_MASK);
4909 /* Return true if OMP_FOR statement G has the
4910 GF_OMP_FOR_COMBINED flag set. */
4912 static inline bool
4913 gimple_omp_for_combined_p (const gimple *g)
4915 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4916 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4920 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4921 the boolean value of COMBINED_P. */
4923 static inline void
4924 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4926 if (combined_p)
4927 g->subcode |= GF_OMP_FOR_COMBINED;
4928 else
4929 g->subcode &= ~GF_OMP_FOR_COMBINED;
4933 /* Return true if the OMP_FOR statement G has the
4934 GF_OMP_FOR_COMBINED_INTO flag set. */
4936 static inline bool
4937 gimple_omp_for_combined_into_p (const gimple *g)
4939 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4940 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4944 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4945 on the boolean value of COMBINED_P. */
4947 static inline void
4948 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4950 if (combined_p)
4951 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4952 else
4953 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4957 /* Return the clauses associated with the OMP_FOR statement GS. */
4959 static inline tree
4960 gimple_omp_for_clauses (const gimple *gs)
4962 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4963 return omp_for_stmt->clauses;
4967 /* Return a pointer to the clauses associated with the OMP_FOR statement
4968 GS. */
4970 static inline tree *
4971 gimple_omp_for_clauses_ptr (gimple *gs)
4973 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4974 return &omp_for_stmt->clauses;
4978 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4979 GS. */
4981 static inline void
4982 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4984 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4985 omp_for_stmt->clauses = clauses;
4989 /* Get the collapse count of the OMP_FOR statement GS. */
4991 static inline size_t
4992 gimple_omp_for_collapse (gimple *gs)
4994 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4995 return omp_for_stmt->collapse;
4999 /* Return the condition code associated with the OMP_FOR statement GS. */
5001 static inline enum tree_code
5002 gimple_omp_for_cond (const gimple *gs, size_t i)
5004 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5005 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5006 return omp_for_stmt->iter[i].cond;
5010 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5012 static inline void
5013 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5015 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5016 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5017 && i < omp_for_stmt->collapse);
5018 omp_for_stmt->iter[i].cond = cond;
5022 /* Return the index variable for the OMP_FOR statement GS. */
5024 static inline tree
5025 gimple_omp_for_index (const gimple *gs, size_t i)
5027 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5028 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5029 return omp_for_stmt->iter[i].index;
5033 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5035 static inline tree *
5036 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5038 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5039 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5040 return &omp_for_stmt->iter[i].index;
5044 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5046 static inline void
5047 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5049 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5050 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5051 omp_for_stmt->iter[i].index = index;
5055 /* Return the initial value for the OMP_FOR statement GS. */
5057 static inline tree
5058 gimple_omp_for_initial (const gimple *gs, size_t i)
5060 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5061 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5062 return omp_for_stmt->iter[i].initial;
5066 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5068 static inline tree *
5069 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5071 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5072 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5073 return &omp_for_stmt->iter[i].initial;
5077 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5079 static inline void
5080 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5082 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5083 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5084 omp_for_stmt->iter[i].initial = initial;
5088 /* Return the final value for the OMP_FOR statement GS. */
5090 static inline tree
5091 gimple_omp_for_final (const gimple *gs, size_t i)
5093 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5094 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5095 return omp_for_stmt->iter[i].final;
5099 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5101 static inline tree *
5102 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5104 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5105 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5106 return &omp_for_stmt->iter[i].final;
5110 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5112 static inline void
5113 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5115 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5116 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5117 omp_for_stmt->iter[i].final = final;
5121 /* Return the increment value for the OMP_FOR statement GS. */
5123 static inline tree
5124 gimple_omp_for_incr (const gimple *gs, size_t i)
5126 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5127 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5128 return omp_for_stmt->iter[i].incr;
5132 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5134 static inline tree *
5135 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5137 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5138 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5139 return &omp_for_stmt->iter[i].incr;
5143 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5145 static inline void
5146 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5148 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5149 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5150 omp_for_stmt->iter[i].incr = incr;
5154 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5155 statement GS starts. */
5157 static inline gimple_seq *
5158 gimple_omp_for_pre_body_ptr (gimple *gs)
5160 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5161 return &omp_for_stmt->pre_body;
5165 /* Return the sequence of statements to execute before the OMP_FOR
5166 statement GS starts. */
5168 static inline gimple_seq
5169 gimple_omp_for_pre_body (gimple *gs)
5171 return *gimple_omp_for_pre_body_ptr (gs);
5175 /* Set PRE_BODY to be the sequence of statements to execute before the
5176 OMP_FOR statement GS starts. */
5178 static inline void
5179 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5181 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5182 omp_for_stmt->pre_body = pre_body;
5185 /* Return the kernel_phony of OMP_FOR statement. */
5187 static inline bool
5188 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5190 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5191 != GF_OMP_FOR_KIND_GRID_LOOP);
5192 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5195 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5197 static inline void
5198 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5200 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5201 != GF_OMP_FOR_KIND_GRID_LOOP);
5202 if (value)
5203 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5204 else
5205 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5208 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5210 static inline bool
5211 gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5213 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5214 == GF_OMP_FOR_KIND_GRID_LOOP);
5215 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5218 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5220 static inline void
5221 gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5223 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5224 == GF_OMP_FOR_KIND_GRID_LOOP);
5225 if (value)
5226 omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5227 else
5228 omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5231 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5232 groups. */
5234 static inline bool
5235 gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5237 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5238 == GF_OMP_FOR_KIND_GRID_LOOP);
5239 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5242 /* Set group_iter flag of OMP_FOR to VALUE. */
5244 static inline void
5245 gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5247 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5248 == GF_OMP_FOR_KIND_GRID_LOOP);
5249 if (value)
5250 omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5251 else
5252 omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5255 /* Return the clauses associated with OMP_PARALLEL GS. */
5257 static inline tree
5258 gimple_omp_parallel_clauses (const gimple *gs)
5260 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5261 return omp_parallel_stmt->clauses;
5265 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5267 static inline tree *
5268 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5270 return &omp_parallel_stmt->clauses;
5274 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5276 static inline void
5277 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5278 tree clauses)
5280 omp_parallel_stmt->clauses = clauses;
5284 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5286 static inline tree
5287 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5289 return omp_parallel_stmt->child_fn;
5292 /* Return a pointer to the child function used to hold the body of
5293 OMP_PARALLEL_STMT. */
5295 static inline tree *
5296 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5298 return &omp_parallel_stmt->child_fn;
5302 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5304 static inline void
5305 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5306 tree child_fn)
5308 omp_parallel_stmt->child_fn = child_fn;
5312 /* Return the artificial argument used to send variables and values
5313 from the parent to the children threads in OMP_PARALLEL_STMT. */
5315 static inline tree
5316 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5318 return omp_parallel_stmt->data_arg;
5322 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5324 static inline tree *
5325 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5327 return &omp_parallel_stmt->data_arg;
5331 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5333 static inline void
5334 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5335 tree data_arg)
5337 omp_parallel_stmt->data_arg = data_arg;
5340 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5342 static inline bool
5343 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5345 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5348 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5350 static inline void
5351 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5353 if (value)
5354 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5355 else
5356 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5359 /* Return the clauses associated with OMP_TASK GS. */
5361 static inline tree
5362 gimple_omp_task_clauses (const gimple *gs)
5364 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5365 return omp_task_stmt->clauses;
5369 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5371 static inline tree *
5372 gimple_omp_task_clauses_ptr (gimple *gs)
5374 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5375 return &omp_task_stmt->clauses;
5379 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5380 GS. */
5382 static inline void
5383 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5385 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5386 omp_task_stmt->clauses = clauses;
5390 /* Return true if OMP task statement G has the
5391 GF_OMP_TASK_TASKLOOP flag set. */
5393 static inline bool
5394 gimple_omp_task_taskloop_p (const gimple *g)
5396 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5397 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5401 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5402 value of TASKLOOP_P. */
5404 static inline void
5405 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5407 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5408 if (taskloop_p)
5409 g->subcode |= GF_OMP_TASK_TASKLOOP;
5410 else
5411 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5415 /* Return the child function used to hold the body of OMP_TASK GS. */
5417 static inline tree
5418 gimple_omp_task_child_fn (const gimple *gs)
5420 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5421 return omp_task_stmt->child_fn;
5424 /* Return a pointer to the child function used to hold the body of
5425 OMP_TASK GS. */
5427 static inline tree *
5428 gimple_omp_task_child_fn_ptr (gimple *gs)
5430 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5431 return &omp_task_stmt->child_fn;
5435 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5437 static inline void
5438 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5440 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5441 omp_task_stmt->child_fn = child_fn;
5445 /* Return the artificial argument used to send variables and values
5446 from the parent to the children threads in OMP_TASK GS. */
5448 static inline tree
5449 gimple_omp_task_data_arg (const gimple *gs)
5451 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5452 return omp_task_stmt->data_arg;
5456 /* Return a pointer to the data argument for OMP_TASK GS. */
5458 static inline tree *
5459 gimple_omp_task_data_arg_ptr (gimple *gs)
5461 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5462 return &omp_task_stmt->data_arg;
5466 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5468 static inline void
5469 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5471 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5472 omp_task_stmt->data_arg = data_arg;
5476 /* Return the clauses associated with OMP_TASK GS. */
5478 static inline tree
5479 gimple_omp_taskreg_clauses (const gimple *gs)
5481 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5482 = as_a <const gimple_statement_omp_taskreg *> (gs);
5483 return omp_taskreg_stmt->clauses;
5487 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5489 static inline tree *
5490 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5492 gimple_statement_omp_taskreg *omp_taskreg_stmt
5493 = as_a <gimple_statement_omp_taskreg *> (gs);
5494 return &omp_taskreg_stmt->clauses;
5498 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5499 GS. */
5501 static inline void
5502 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5504 gimple_statement_omp_taskreg *omp_taskreg_stmt
5505 = as_a <gimple_statement_omp_taskreg *> (gs);
5506 omp_taskreg_stmt->clauses = clauses;
5510 /* Return the child function used to hold the body of OMP_TASK GS. */
5512 static inline tree
5513 gimple_omp_taskreg_child_fn (const gimple *gs)
5515 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5516 = as_a <const gimple_statement_omp_taskreg *> (gs);
5517 return omp_taskreg_stmt->child_fn;
5520 /* Return a pointer to the child function used to hold the body of
5521 OMP_TASK GS. */
5523 static inline tree *
5524 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5526 gimple_statement_omp_taskreg *omp_taskreg_stmt
5527 = as_a <gimple_statement_omp_taskreg *> (gs);
5528 return &omp_taskreg_stmt->child_fn;
5532 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5534 static inline void
5535 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5537 gimple_statement_omp_taskreg *omp_taskreg_stmt
5538 = as_a <gimple_statement_omp_taskreg *> (gs);
5539 omp_taskreg_stmt->child_fn = child_fn;
5543 /* Return the artificial argument used to send variables and values
5544 from the parent to the children threads in OMP_TASK GS. */
5546 static inline tree
5547 gimple_omp_taskreg_data_arg (const gimple *gs)
5549 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5550 = as_a <const gimple_statement_omp_taskreg *> (gs);
5551 return omp_taskreg_stmt->data_arg;
5555 /* Return a pointer to the data argument for OMP_TASK GS. */
5557 static inline tree *
5558 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5560 gimple_statement_omp_taskreg *omp_taskreg_stmt
5561 = as_a <gimple_statement_omp_taskreg *> (gs);
5562 return &omp_taskreg_stmt->data_arg;
5566 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5568 static inline void
5569 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5571 gimple_statement_omp_taskreg *omp_taskreg_stmt
5572 = as_a <gimple_statement_omp_taskreg *> (gs);
5573 omp_taskreg_stmt->data_arg = data_arg;
5577 /* Return the copy function used to hold the body of OMP_TASK GS. */
5579 static inline tree
5580 gimple_omp_task_copy_fn (const gimple *gs)
5582 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5583 return omp_task_stmt->copy_fn;
5586 /* Return a pointer to the copy function used to hold the body of
5587 OMP_TASK GS. */
5589 static inline tree *
5590 gimple_omp_task_copy_fn_ptr (gimple *gs)
5592 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5593 return &omp_task_stmt->copy_fn;
5597 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5599 static inline void
5600 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5602 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5603 omp_task_stmt->copy_fn = copy_fn;
5607 /* Return size of the data block in bytes in OMP_TASK GS. */
5609 static inline tree
5610 gimple_omp_task_arg_size (const gimple *gs)
5612 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5613 return omp_task_stmt->arg_size;
5617 /* Return a pointer to the data block size for OMP_TASK GS. */
5619 static inline tree *
5620 gimple_omp_task_arg_size_ptr (gimple *gs)
5622 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5623 return &omp_task_stmt->arg_size;
5627 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5629 static inline void
5630 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5632 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5633 omp_task_stmt->arg_size = arg_size;
5637 /* Return align of the data block in bytes in OMP_TASK GS. */
5639 static inline tree
5640 gimple_omp_task_arg_align (const gimple *gs)
5642 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5643 return omp_task_stmt->arg_align;
5647 /* Return a pointer to the data block align for OMP_TASK GS. */
5649 static inline tree *
5650 gimple_omp_task_arg_align_ptr (gimple *gs)
5652 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5653 return &omp_task_stmt->arg_align;
5657 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5659 static inline void
5660 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5662 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5663 omp_task_stmt->arg_align = arg_align;
5667 /* Return the clauses associated with OMP_SINGLE GS. */
5669 static inline tree
5670 gimple_omp_single_clauses (const gimple *gs)
5672 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5673 return omp_single_stmt->clauses;
5677 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5679 static inline tree *
5680 gimple_omp_single_clauses_ptr (gimple *gs)
5682 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5683 return &omp_single_stmt->clauses;
5687 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5689 static inline void
5690 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5692 omp_single_stmt->clauses = clauses;
5696 /* Return the clauses associated with OMP_TARGET GS. */
5698 static inline tree
5699 gimple_omp_target_clauses (const gimple *gs)
5701 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5702 return omp_target_stmt->clauses;
5706 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5708 static inline tree *
5709 gimple_omp_target_clauses_ptr (gimple *gs)
5711 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5712 return &omp_target_stmt->clauses;
5716 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5718 static inline void
5719 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5720 tree clauses)
5722 omp_target_stmt->clauses = clauses;
5726 /* Return the kind of the OMP_TARGET G. */
5728 static inline int
5729 gimple_omp_target_kind (const gimple *g)
5731 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5732 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5736 /* Set the kind of the OMP_TARGET G. */
5738 static inline void
5739 gimple_omp_target_set_kind (gomp_target *g, int kind)
5741 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5742 | (kind & GF_OMP_TARGET_KIND_MASK);
5746 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5748 static inline tree
5749 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5751 return omp_target_stmt->child_fn;
5754 /* Return a pointer to the child function used to hold the body of
5755 OMP_TARGET_STMT. */
5757 static inline tree *
5758 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5760 return &omp_target_stmt->child_fn;
5764 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5766 static inline void
5767 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5768 tree child_fn)
5770 omp_target_stmt->child_fn = child_fn;
5774 /* Return the artificial argument used to send variables and values
5775 from the parent to the children threads in OMP_TARGET_STMT. */
5777 static inline tree
5778 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5780 return omp_target_stmt->data_arg;
5784 /* Return a pointer to the data argument for OMP_TARGET GS. */
5786 static inline tree *
5787 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5789 return &omp_target_stmt->data_arg;
5793 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5795 static inline void
5796 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5797 tree data_arg)
5799 omp_target_stmt->data_arg = data_arg;
5803 /* Return the clauses associated with OMP_TEAMS GS. */
5805 static inline tree
5806 gimple_omp_teams_clauses (const gimple *gs)
5808 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5809 return omp_teams_stmt->clauses;
5813 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5815 static inline tree *
5816 gimple_omp_teams_clauses_ptr (gimple *gs)
5818 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5819 return &omp_teams_stmt->clauses;
5823 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5825 static inline void
5826 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5828 omp_teams_stmt->clauses = clauses;
5831 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5833 static inline bool
5834 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5836 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5839 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5841 static inline void
5842 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5844 if (value)
5845 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5846 else
5847 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5850 /* Return the clauses associated with OMP_SECTIONS GS. */
5852 static inline tree
5853 gimple_omp_sections_clauses (const gimple *gs)
5855 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5856 return omp_sections_stmt->clauses;
5860 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5862 static inline tree *
5863 gimple_omp_sections_clauses_ptr (gimple *gs)
5865 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5866 return &omp_sections_stmt->clauses;
5870 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5871 GS. */
5873 static inline void
5874 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5876 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5877 omp_sections_stmt->clauses = clauses;
5881 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5882 in GS. */
5884 static inline tree
5885 gimple_omp_sections_control (const gimple *gs)
5887 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5888 return omp_sections_stmt->control;
5892 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5893 GS. */
5895 static inline tree *
5896 gimple_omp_sections_control_ptr (gimple *gs)
5898 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5899 return &omp_sections_stmt->control;
5903 /* Set CONTROL to be the set of clauses associated with the
5904 GIMPLE_OMP_SECTIONS in GS. */
5906 static inline void
5907 gimple_omp_sections_set_control (gimple *gs, tree control)
5909 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5910 omp_sections_stmt->control = control;
5914 /* Set the value being stored in an atomic store. */
5916 static inline void
5917 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5919 store_stmt->val = val;
5923 /* Return the value being stored in an atomic store. */
5925 static inline tree
5926 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5928 return store_stmt->val;
5932 /* Return a pointer to the value being stored in an atomic store. */
5934 static inline tree *
5935 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5937 return &store_stmt->val;
5941 /* Set the LHS of an atomic load. */
5943 static inline void
5944 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5946 load_stmt->lhs = lhs;
5950 /* Get the LHS of an atomic load. */
5952 static inline tree
5953 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5955 return load_stmt->lhs;
5959 /* Return a pointer to the LHS of an atomic load. */
5961 static inline tree *
5962 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5964 return &load_stmt->lhs;
5968 /* Set the RHS of an atomic load. */
5970 static inline void
5971 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5973 load_stmt->rhs = rhs;
5977 /* Get the RHS of an atomic load. */
5979 static inline tree
5980 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5982 return load_stmt->rhs;
5986 /* Return a pointer to the RHS of an atomic load. */
5988 static inline tree *
5989 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5991 return &load_stmt->rhs;
5995 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5997 static inline tree
5998 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6000 return cont_stmt->control_def;
6003 /* The same as above, but return the address. */
6005 static inline tree *
6006 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6008 return &cont_stmt->control_def;
6011 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6013 static inline void
6014 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6016 cont_stmt->control_def = def;
6020 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6022 static inline tree
6023 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6025 return cont_stmt->control_use;
6029 /* The same as above, but return the address. */
6031 static inline tree *
6032 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6034 return &cont_stmt->control_use;
6038 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6040 static inline void
6041 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6043 cont_stmt->control_use = use;
6046 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6047 TRANSACTION_STMT. */
6049 static inline gimple_seq *
6050 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6052 return &transaction_stmt->body;
6055 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6057 static inline gimple_seq
6058 gimple_transaction_body (gtransaction *transaction_stmt)
6060 return transaction_stmt->body;
6063 /* Return the label associated with a GIMPLE_TRANSACTION. */
6065 static inline tree
6066 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6068 return transaction_stmt->label_norm;
6071 static inline tree *
6072 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6074 return &transaction_stmt->label_norm;
6077 static inline tree
6078 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6080 return transaction_stmt->label_uninst;
6083 static inline tree *
6084 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6086 return &transaction_stmt->label_uninst;
6089 static inline tree
6090 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6092 return transaction_stmt->label_over;
6095 static inline tree *
6096 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6098 return &transaction_stmt->label_over;
6101 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6103 static inline unsigned int
6104 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6106 return transaction_stmt->subcode;
6109 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6110 TRANSACTION_STMT. */
6112 static inline void
6113 gimple_transaction_set_body (gtransaction *transaction_stmt,
6114 gimple_seq body)
6116 transaction_stmt->body = body;
6119 /* Set the label associated with a GIMPLE_TRANSACTION. */
6121 static inline void
6122 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6124 transaction_stmt->label_norm = label;
6127 static inline void
6128 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6130 transaction_stmt->label_uninst = label;
6133 static inline void
6134 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6136 transaction_stmt->label_over = label;
6139 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6141 static inline void
6142 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6143 unsigned int subcode)
6145 transaction_stmt->subcode = subcode;
6148 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6150 static inline tree *
6151 gimple_return_retval_ptr (greturn *gs)
6153 return &gs->op[0];
6156 /* Return the return value for GIMPLE_RETURN GS. */
6158 static inline tree
6159 gimple_return_retval (const greturn *gs)
6161 return gs->op[0];
6165 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6167 static inline void
6168 gimple_return_set_retval (greturn *gs, tree retval)
6170 gs->op[0] = retval;
6174 /* Return the return bounds for GIMPLE_RETURN GS. */
6176 static inline tree
6177 gimple_return_retbnd (const gimple *gs)
6179 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6180 return gimple_op (gs, 1);
6184 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6186 static inline void
6187 gimple_return_set_retbnd (gimple *gs, tree retval)
6189 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6190 gimple_set_op (gs, 1, retval);
6194 /* Returns true when the gimple statement STMT is any of the OMP types. */
6196 #define CASE_GIMPLE_OMP \
6197 case GIMPLE_OMP_PARALLEL: \
6198 case GIMPLE_OMP_TASK: \
6199 case GIMPLE_OMP_FOR: \
6200 case GIMPLE_OMP_SECTIONS: \
6201 case GIMPLE_OMP_SECTIONS_SWITCH: \
6202 case GIMPLE_OMP_SINGLE: \
6203 case GIMPLE_OMP_TARGET: \
6204 case GIMPLE_OMP_TEAMS: \
6205 case GIMPLE_OMP_SECTION: \
6206 case GIMPLE_OMP_MASTER: \
6207 case GIMPLE_OMP_TASKGROUP: \
6208 case GIMPLE_OMP_ORDERED: \
6209 case GIMPLE_OMP_CRITICAL: \
6210 case GIMPLE_OMP_RETURN: \
6211 case GIMPLE_OMP_ATOMIC_LOAD: \
6212 case GIMPLE_OMP_ATOMIC_STORE: \
6213 case GIMPLE_OMP_CONTINUE: \
6214 case GIMPLE_OMP_GRID_BODY
6216 static inline bool
6217 is_gimple_omp (const gimple *stmt)
6219 switch (gimple_code (stmt))
6221 CASE_GIMPLE_OMP:
6222 return true;
6223 default:
6224 return false;
6228 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6229 specifically. */
6231 static inline bool
6232 is_gimple_omp_oacc (const gimple *stmt)
6234 gcc_assert (is_gimple_omp (stmt));
6235 switch (gimple_code (stmt))
6237 case GIMPLE_OMP_FOR:
6238 switch (gimple_omp_for_kind (stmt))
6240 case GF_OMP_FOR_KIND_OACC_LOOP:
6241 return true;
6242 default:
6243 return false;
6245 case GIMPLE_OMP_TARGET:
6246 switch (gimple_omp_target_kind (stmt))
6248 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6249 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6250 case GF_OMP_TARGET_KIND_OACC_DATA:
6251 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6252 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6253 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6254 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6255 return true;
6256 default:
6257 return false;
6259 default:
6260 return false;
6265 /* Return true if the OMP gimple statement STMT is offloaded. */
6267 static inline bool
6268 is_gimple_omp_offloaded (const gimple *stmt)
6270 gcc_assert (is_gimple_omp (stmt));
6271 switch (gimple_code (stmt))
6273 case GIMPLE_OMP_TARGET:
6274 switch (gimple_omp_target_kind (stmt))
6276 case GF_OMP_TARGET_KIND_REGION:
6277 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6278 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6279 return true;
6280 default:
6281 return false;
6283 default:
6284 return false;
6289 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6291 static inline bool
6292 gimple_nop_p (const gimple *g)
6294 return gimple_code (g) == GIMPLE_NOP;
6298 /* Return true if GS is a GIMPLE_RESX. */
6300 static inline bool
6301 is_gimple_resx (const gimple *gs)
6303 return gimple_code (gs) == GIMPLE_RESX;
6306 /* Return the type of the main expression computed by STMT. Return
6307 void_type_node if the statement computes nothing. */
6309 static inline tree
6310 gimple_expr_type (const gimple *stmt)
6312 enum gimple_code code = gimple_code (stmt);
6313 /* In general we want to pass out a type that can be substituted
6314 for both the RHS and the LHS types if there is a possibly
6315 useless conversion involved. That means returning the
6316 original RHS type as far as we can reconstruct it. */
6317 if (code == GIMPLE_CALL)
6319 const gcall *call_stmt = as_a <const gcall *> (stmt);
6320 if (gimple_call_internal_p (call_stmt)
6321 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6322 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6323 else
6324 return gimple_call_return_type (call_stmt);
6326 else if (code == GIMPLE_ASSIGN)
6328 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6329 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6330 else
6331 /* As fallback use the type of the LHS. */
6332 return TREE_TYPE (gimple_get_lhs (stmt));
6334 else if (code == GIMPLE_COND)
6335 return boolean_type_node;
6336 else
6337 return void_type_node;
6340 /* Enum and arrays used for allocation stats. Keep in sync with
6341 gimple.c:gimple_alloc_kind_names. */
6342 enum gimple_alloc_kind
6344 gimple_alloc_kind_assign, /* Assignments. */
6345 gimple_alloc_kind_phi, /* PHI nodes. */
6346 gimple_alloc_kind_cond, /* Conditionals. */
6347 gimple_alloc_kind_rest, /* Everything else. */
6348 gimple_alloc_kind_all
6351 extern int gimple_alloc_counts[];
6352 extern int gimple_alloc_sizes[];
6354 /* Return the allocation kind for a given stmt CODE. */
6355 static inline enum gimple_alloc_kind
6356 gimple_alloc_kind (enum gimple_code code)
6358 switch (code)
6360 case GIMPLE_ASSIGN:
6361 return gimple_alloc_kind_assign;
6362 case GIMPLE_PHI:
6363 return gimple_alloc_kind_phi;
6364 case GIMPLE_COND:
6365 return gimple_alloc_kind_cond;
6366 default:
6367 return gimple_alloc_kind_rest;
6371 /* Return true if a location should not be emitted for this statement
6372 by annotate_all_with_location. */
6374 static inline bool
6375 gimple_do_not_emit_location_p (gimple *g)
6377 return gimple_plf (g, GF_PLF_1);
6380 /* Mark statement G so a location will not be emitted by
6381 annotate_one_with_location. */
6383 static inline void
6384 gimple_set_do_not_emit_location (gimple *g)
6386 /* The PLF flags are initialized to 0 when a new tuple is created,
6387 so no need to initialize it anywhere. */
6388 gimple_set_plf (g, GF_PLF_1, true);
6392 /* Macros for showing usage statistics. */
6393 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6394 ? (x) \
6395 : ((x) < 1024*1024*10 \
6396 ? (x) / 1024 \
6397 : (x) / (1024*1024))))
6399 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6401 #endif /* GCC_GIMPLE_H */