Daily bump.
[official-gcc.git] / gcc / gimple.h
blob6d15dab5120e0b24294dff506d6ea3396a0fa04f
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2016 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN;
51 #define GIMPLE_CHECK(GS, CODE) \
52 do { \
53 const gimple *__gs = (GS); \
54 if (gimple_code (__gs) != (CODE)) \
55 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
56 (CODE), ERROR_MARK); \
57 } while (0)
58 template <typename T>
59 static inline T
60 GIMPLE_CHECK2(const gimple *gs,
61 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
62 const char *file = __builtin_FILE (),
63 int line = __builtin_LINE (),
64 const char *fun = __builtin_FUNCTION ())
65 #else
66 const char *file = __FILE__,
67 int line = __LINE__,
68 const char *fun = NULL)
69 #endif
71 T ret = dyn_cast <T> (gs);
72 if (!ret)
73 gimple_check_failed (gs, file, line, fun,
74 remove_pointer<T>::type::code_, ERROR_MARK);
75 return ret;
77 template <typename T>
78 static inline T
79 GIMPLE_CHECK2(gimple *gs,
80 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
81 const char *file = __builtin_FILE (),
82 int line = __builtin_LINE (),
83 const char *fun = __builtin_FUNCTION ())
84 #else
85 const char *file = __FILE__,
86 int line = __LINE__,
87 const char *fun = NULL)
88 #endif
90 T ret = dyn_cast <T> (gs);
91 if (!ret)
92 gimple_check_failed (gs, file, line, fun,
93 remove_pointer<T>::type::code_, ERROR_MARK);
94 return ret;
96 #else /* not ENABLE_GIMPLE_CHECKING */
97 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
98 #define GIMPLE_CHECK(GS, CODE) (void)0
99 template <typename T>
100 static inline T
101 GIMPLE_CHECK2(gimple *gs)
103 return as_a <T> (gs);
105 template <typename T>
106 static inline T
107 GIMPLE_CHECK2(const gimple *gs)
109 return as_a <T> (gs);
111 #endif
113 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
114 get_gimple_rhs_class. */
115 enum gimple_rhs_class
117 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
118 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
119 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
120 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
121 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
122 name, a _DECL, a _REF, etc. */
125 /* Specific flags for individual GIMPLE statements. These flags are
126 always stored in gimple.subcode and they may only be
127 defined for statement codes that do not use subcodes.
129 Values for the masks can overlap as long as the overlapping values
130 are never used in the same statement class.
132 The maximum mask value that can be defined is 1 << 15 (i.e., each
133 statement code can hold up to 16 bitflags).
135 Keep this list sorted. */
136 enum gf_mask {
137 GF_ASM_INPUT = 1 << 0,
138 GF_ASM_VOLATILE = 1 << 1,
139 GF_CALL_FROM_THUNK = 1 << 0,
140 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
141 GF_CALL_TAILCALL = 1 << 2,
142 GF_CALL_VA_ARG_PACK = 1 << 3,
143 GF_CALL_NOTHROW = 1 << 4,
144 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
145 GF_CALL_INTERNAL = 1 << 6,
146 GF_CALL_CTRL_ALTERING = 1 << 7,
147 GF_CALL_WITH_BOUNDS = 1 << 8,
148 GF_OMP_PARALLEL_COMBINED = 1 << 0,
149 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
150 GF_OMP_TASK_TASKLOOP = 1 << 0,
151 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
152 GF_OMP_FOR_KIND_FOR = 0,
153 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
154 GF_OMP_FOR_KIND_TASKLOOP = 2,
155 GF_OMP_FOR_KIND_CILKFOR = 3,
156 GF_OMP_FOR_KIND_OACC_LOOP = 4,
157 GF_OMP_FOR_KIND_GRID_LOOP = 5,
158 /* Flag for SIMD variants of OMP_FOR kinds. */
159 GF_OMP_FOR_SIMD = 1 << 3,
160 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
161 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
162 GF_OMP_FOR_COMBINED = 1 << 4,
163 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
164 GF_OMP_FOR_GRID_PHONY = 1 << 6,
165 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
166 GF_OMP_TARGET_KIND_REGION = 0,
167 GF_OMP_TARGET_KIND_DATA = 1,
168 GF_OMP_TARGET_KIND_UPDATE = 2,
169 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
170 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
171 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
172 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
173 GF_OMP_TARGET_KIND_OACC_DATA = 7,
174 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
175 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
176 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
177 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
178 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
180 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
181 a thread synchronization via some sort of barrier. The exact barrier
182 that would otherwise be emitted is dependent on the OMP statement with
183 which this return is associated. */
184 GF_OMP_RETURN_NOWAIT = 1 << 0,
186 GF_OMP_SECTION_LAST = 1 << 0,
187 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
188 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
189 GF_PREDICT_TAKEN = 1 << 15
192 /* Currently, there are only two types of gimple debug stmt. Others are
193 envisioned, for example, to enable the generation of is_stmt notes
194 in line number information, to mark sequence points, etc. This
195 subcode is to be used to tell them apart. */
196 enum gimple_debug_subcode {
197 GIMPLE_DEBUG_BIND = 0,
198 GIMPLE_DEBUG_SOURCE_BIND = 1
201 /* Masks for selecting a pass local flag (PLF) to work on. These
202 masks are used by gimple_set_plf and gimple_plf. */
203 enum plf_mask {
204 GF_PLF_1 = 1 << 0,
205 GF_PLF_2 = 1 << 1
208 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
209 are for 64 bit hosts. */
211 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
212 chain_next ("%h.next"), variable_size))
213 gimple
215 /* [ WORD 1 ]
216 Main identifying code for a tuple. */
217 ENUM_BITFIELD(gimple_code) code : 8;
219 /* Nonzero if a warning should not be emitted on this tuple. */
220 unsigned int no_warning : 1;
222 /* Nonzero if this tuple has been visited. Passes are responsible
223 for clearing this bit before using it. */
224 unsigned int visited : 1;
226 /* Nonzero if this tuple represents a non-temporal move. */
227 unsigned int nontemporal_move : 1;
229 /* Pass local flags. These flags are free for any pass to use as
230 they see fit. Passes should not assume that these flags contain
231 any useful value when the pass starts. Any initial state that
232 the pass requires should be set on entry to the pass. See
233 gimple_set_plf and gimple_plf for usage. */
234 unsigned int plf : 2;
236 /* Nonzero if this statement has been modified and needs to have its
237 operands rescanned. */
238 unsigned modified : 1;
240 /* Nonzero if this statement contains volatile operands. */
241 unsigned has_volatile_ops : 1;
243 /* Padding to get subcode to 16 bit alignment. */
244 unsigned pad : 1;
246 /* The SUBCODE field can be used for tuple-specific flags for tuples
247 that do not require subcodes. Note that SUBCODE should be at
248 least as wide as tree codes, as several tuples store tree codes
249 in there. */
250 unsigned int subcode : 16;
252 /* UID of this statement. This is used by passes that want to
253 assign IDs to statements. It must be assigned and used by each
254 pass. By default it should be assumed to contain garbage. */
255 unsigned uid;
257 /* [ WORD 2 ]
258 Locus information for debug info. */
259 location_t location;
261 /* Number of operands in this tuple. */
262 unsigned num_ops;
264 /* [ WORD 3 ]
265 Basic block holding this statement. */
266 basic_block bb;
268 /* [ WORD 4-5 ]
269 Linked lists of gimple statements. The next pointers form
270 a NULL terminated list, the prev pointers are a cyclic list.
271 A gimple statement is hence also a double-ended list of
272 statements, with the pointer itself being the first element,
273 and the prev pointer being the last. */
274 gimple *next;
275 gimple *GTY((skip)) prev;
279 /* Base structure for tuples with operands. */
281 /* This gimple subclass has no tag value. */
282 struct GTY(())
283 gimple_statement_with_ops_base : public gimple
285 /* [ WORD 1-6 ] : base class */
287 /* [ WORD 7 ]
288 SSA operand vectors. NOTE: It should be possible to
289 amalgamate these vectors with the operand vector OP. However,
290 the SSA operand vectors are organized differently and contain
291 more information (like immediate use chaining). */
292 struct use_optype_d GTY((skip (""))) *use_ops;
296 /* Statements that take register operands. */
298 struct GTY((tag("GSS_WITH_OPS")))
299 gimple_statement_with_ops : public gimple_statement_with_ops_base
301 /* [ WORD 1-7 ] : base class */
303 /* [ WORD 8 ]
304 Operand vector. NOTE! This must always be the last field
305 of this structure. In particular, this means that this
306 structure cannot be embedded inside another one. */
307 tree GTY((length ("%h.num_ops"))) op[1];
311 /* Base for statements that take both memory and register operands. */
313 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
314 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
316 /* [ WORD 1-7 ] : base class */
318 /* [ WORD 8-9 ]
319 Virtual operands for this statement. The GC will pick them
320 up via the ssa_names array. */
321 tree GTY((skip (""))) vdef;
322 tree GTY((skip (""))) vuse;
326 /* Statements that take both memory and register operands. */
328 struct GTY((tag("GSS_WITH_MEM_OPS")))
329 gimple_statement_with_memory_ops :
330 public gimple_statement_with_memory_ops_base
332 /* [ WORD 1-9 ] : base class */
334 /* [ WORD 10 ]
335 Operand vector. NOTE! This must always be the last field
336 of this structure. In particular, this means that this
337 structure cannot be embedded inside another one. */
338 tree GTY((length ("%h.num_ops"))) op[1];
342 /* Call statements that take both memory and register operands. */
344 struct GTY((tag("GSS_CALL")))
345 gcall : public gimple_statement_with_memory_ops_base
347 /* [ WORD 1-9 ] : base class */
349 /* [ WORD 10-13 ] */
350 struct pt_solution call_used;
351 struct pt_solution call_clobbered;
353 /* [ WORD 14 ] */
354 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
355 tree GTY ((tag ("0"))) fntype;
356 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
357 } u;
359 /* [ WORD 15 ]
360 Operand vector. NOTE! This must always be the last field
361 of this structure. In particular, this means that this
362 structure cannot be embedded inside another one. */
363 tree GTY((length ("%h.num_ops"))) op[1];
365 static const enum gimple_code code_ = GIMPLE_CALL;
369 /* OMP statements. */
371 struct GTY((tag("GSS_OMP")))
372 gimple_statement_omp : public gimple
374 /* [ WORD 1-6 ] : base class */
376 /* [ WORD 7 ] */
377 gimple_seq body;
381 /* GIMPLE_BIND */
383 struct GTY((tag("GSS_BIND")))
384 gbind : public gimple
386 /* [ WORD 1-6 ] : base class */
388 /* [ WORD 7 ]
389 Variables declared in this scope. */
390 tree vars;
392 /* [ WORD 8 ]
393 This is different than the BLOCK field in gimple,
394 which is analogous to TREE_BLOCK (i.e., the lexical block holding
395 this statement). This field is the equivalent of BIND_EXPR_BLOCK
396 in tree land (i.e., the lexical scope defined by this bind). See
397 gimple-low.c. */
398 tree block;
400 /* [ WORD 9 ] */
401 gimple_seq body;
405 /* GIMPLE_CATCH */
407 struct GTY((tag("GSS_CATCH")))
408 gcatch : public gimple
410 /* [ WORD 1-6 ] : base class */
412 /* [ WORD 7 ] */
413 tree types;
415 /* [ WORD 8 ] */
416 gimple_seq handler;
420 /* GIMPLE_EH_FILTER */
422 struct GTY((tag("GSS_EH_FILTER")))
423 geh_filter : public gimple
425 /* [ WORD 1-6 ] : base class */
427 /* [ WORD 7 ]
428 Filter types. */
429 tree types;
431 /* [ WORD 8 ]
432 Failure actions. */
433 gimple_seq failure;
436 /* GIMPLE_EH_ELSE */
438 struct GTY((tag("GSS_EH_ELSE")))
439 geh_else : public gimple
441 /* [ WORD 1-6 ] : base class */
443 /* [ WORD 7,8 ] */
444 gimple_seq n_body, e_body;
447 /* GIMPLE_EH_MUST_NOT_THROW */
449 struct GTY((tag("GSS_EH_MNT")))
450 geh_mnt : public gimple
452 /* [ WORD 1-6 ] : base class */
454 /* [ WORD 7 ] Abort function decl. */
455 tree fndecl;
458 /* GIMPLE_PHI */
460 struct GTY((tag("GSS_PHI")))
461 gphi : public gimple
463 /* [ WORD 1-6 ] : base class */
465 /* [ WORD 7 ] */
466 unsigned capacity;
467 unsigned nargs;
469 /* [ WORD 8 ] */
470 tree result;
472 /* [ WORD 9 ] */
473 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
477 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
479 struct GTY((tag("GSS_EH_CTRL")))
480 gimple_statement_eh_ctrl : public gimple
482 /* [ WORD 1-6 ] : base class */
484 /* [ WORD 7 ]
485 Exception region number. */
486 int region;
489 struct GTY((tag("GSS_EH_CTRL")))
490 gresx : public gimple_statement_eh_ctrl
492 /* No extra fields; adds invariant:
493 stmt->code == GIMPLE_RESX. */
496 struct GTY((tag("GSS_EH_CTRL")))
497 geh_dispatch : public gimple_statement_eh_ctrl
499 /* No extra fields; adds invariant:
500 stmt->code == GIMPLE_EH_DISPATH. */
504 /* GIMPLE_TRY */
506 struct GTY((tag("GSS_TRY")))
507 gtry : public gimple
509 /* [ WORD 1-6 ] : base class */
511 /* [ WORD 7 ]
512 Expression to evaluate. */
513 gimple_seq eval;
515 /* [ WORD 8 ]
516 Cleanup expression. */
517 gimple_seq cleanup;
520 /* Kind of GIMPLE_TRY statements. */
521 enum gimple_try_flags
523 /* A try/catch. */
524 GIMPLE_TRY_CATCH = 1 << 0,
526 /* A try/finally. */
527 GIMPLE_TRY_FINALLY = 1 << 1,
528 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
530 /* Analogous to TRY_CATCH_IS_CLEANUP. */
531 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
534 /* GIMPLE_WITH_CLEANUP_EXPR */
536 struct GTY((tag("GSS_WCE")))
537 gimple_statement_wce : public gimple
539 /* [ WORD 1-6 ] : base class */
541 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
542 executed if an exception is thrown, not on normal exit of its
543 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
544 in TARGET_EXPRs. */
546 /* [ WORD 7 ]
547 Cleanup expression. */
548 gimple_seq cleanup;
552 /* GIMPLE_ASM */
554 struct GTY((tag("GSS_ASM")))
555 gasm : public gimple_statement_with_memory_ops_base
557 /* [ WORD 1-9 ] : base class */
559 /* [ WORD 10 ]
560 __asm__ statement. */
561 const char *string;
563 /* [ WORD 11 ]
564 Number of inputs, outputs, clobbers, labels. */
565 unsigned char ni;
566 unsigned char no;
567 unsigned char nc;
568 unsigned char nl;
570 /* [ WORD 12 ]
571 Operand vector. NOTE! This must always be the last field
572 of this structure. In particular, this means that this
573 structure cannot be embedded inside another one. */
574 tree GTY((length ("%h.num_ops"))) op[1];
577 /* GIMPLE_OMP_CRITICAL */
579 struct GTY((tag("GSS_OMP_CRITICAL")))
580 gomp_critical : public gimple_statement_omp
582 /* [ WORD 1-7 ] : base class */
584 /* [ WORD 8 ] */
585 tree clauses;
587 /* [ WORD 9 ]
588 Critical section name. */
589 tree name;
593 struct GTY(()) gimple_omp_for_iter {
594 /* Condition code. */
595 enum tree_code cond;
597 /* Index variable. */
598 tree index;
600 /* Initial value. */
601 tree initial;
603 /* Final value. */
604 tree final;
606 /* Increment. */
607 tree incr;
610 /* GIMPLE_OMP_FOR */
612 struct GTY((tag("GSS_OMP_FOR")))
613 gomp_for : public gimple_statement_omp
615 /* [ WORD 1-7 ] : base class */
617 /* [ WORD 8 ] */
618 tree clauses;
620 /* [ WORD 9 ]
621 Number of elements in iter array. */
622 size_t collapse;
624 /* [ WORD 10 ] */
625 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
627 /* [ WORD 11 ]
628 Pre-body evaluated before the loop body begins. */
629 gimple_seq pre_body;
633 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
635 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
636 gimple_statement_omp_parallel_layout : public gimple_statement_omp
638 /* [ WORD 1-7 ] : base class */
640 /* [ WORD 8 ]
641 Clauses. */
642 tree clauses;
644 /* [ WORD 9 ]
645 Child function holding the body of the parallel region. */
646 tree child_fn;
648 /* [ WORD 10 ]
649 Shared data argument. */
650 tree data_arg;
653 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
654 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
655 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
657 /* No extra fields; adds invariant:
658 stmt->code == GIMPLE_OMP_PARALLEL
659 || stmt->code == GIMPLE_OMP_TASK. */
662 /* GIMPLE_OMP_PARALLEL */
663 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
664 gomp_parallel : public gimple_statement_omp_taskreg
666 /* No extra fields; adds invariant:
667 stmt->code == GIMPLE_OMP_PARALLEL. */
670 /* GIMPLE_OMP_TARGET */
671 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
672 gomp_target : public gimple_statement_omp_parallel_layout
674 /* No extra fields; adds invariant:
675 stmt->code == GIMPLE_OMP_TARGET. */
678 /* GIMPLE_OMP_TASK */
680 struct GTY((tag("GSS_OMP_TASK")))
681 gomp_task : public gimple_statement_omp_taskreg
683 /* [ WORD 1-10 ] : base class */
685 /* [ WORD 11 ]
686 Child function holding firstprivate initialization if needed. */
687 tree copy_fn;
689 /* [ WORD 12-13 ]
690 Size and alignment in bytes of the argument data block. */
691 tree arg_size;
692 tree arg_align;
696 /* GIMPLE_OMP_SECTION */
697 /* Uses struct gimple_statement_omp. */
700 /* GIMPLE_OMP_SECTIONS */
702 struct GTY((tag("GSS_OMP_SECTIONS")))
703 gomp_sections : public gimple_statement_omp
705 /* [ WORD 1-7 ] : base class */
707 /* [ WORD 8 ] */
708 tree clauses;
710 /* [ WORD 9 ]
711 The control variable used for deciding which of the sections to
712 execute. */
713 tree control;
716 /* GIMPLE_OMP_CONTINUE.
718 Note: This does not inherit from gimple_statement_omp, because we
719 do not need the body field. */
721 struct GTY((tag("GSS_OMP_CONTINUE")))
722 gomp_continue : public gimple
724 /* [ WORD 1-6 ] : base class */
726 /* [ WORD 7 ] */
727 tree control_def;
729 /* [ WORD 8 ] */
730 tree control_use;
733 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
735 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
736 gimple_statement_omp_single_layout : public gimple_statement_omp
738 /* [ WORD 1-7 ] : base class */
740 /* [ WORD 8 ] */
741 tree clauses;
744 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
745 gomp_single : public gimple_statement_omp_single_layout
747 /* No extra fields; adds invariant:
748 stmt->code == GIMPLE_OMP_SINGLE. */
751 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
752 gomp_teams : public gimple_statement_omp_single_layout
754 /* No extra fields; adds invariant:
755 stmt->code == GIMPLE_OMP_TEAMS. */
758 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
759 gomp_ordered : public gimple_statement_omp_single_layout
761 /* No extra fields; adds invariant:
762 stmt->code == GIMPLE_OMP_ORDERED. */
766 /* GIMPLE_OMP_ATOMIC_LOAD.
767 Note: This is based on gimple, not g_s_omp, because g_s_omp
768 contains a sequence, which we don't need here. */
770 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
771 gomp_atomic_load : public gimple
773 /* [ WORD 1-6 ] : base class */
775 /* [ WORD 7-8 ] */
776 tree rhs, lhs;
779 /* GIMPLE_OMP_ATOMIC_STORE.
780 See note on GIMPLE_OMP_ATOMIC_LOAD. */
782 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
783 gimple_statement_omp_atomic_store_layout : public gimple
785 /* [ WORD 1-6 ] : base class */
787 /* [ WORD 7 ] */
788 tree val;
791 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
792 gomp_atomic_store :
793 public gimple_statement_omp_atomic_store_layout
795 /* No extra fields; adds invariant:
796 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
799 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
800 gimple_statement_omp_return :
801 public gimple_statement_omp_atomic_store_layout
803 /* No extra fields; adds invariant:
804 stmt->code == GIMPLE_OMP_RETURN. */
807 /* GIMPLE_TRANSACTION. */
809 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
811 /* The __transaction_atomic was declared [[outer]] or it is
812 __transaction_relaxed. */
813 #define GTMA_IS_OUTER (1u << 0)
814 #define GTMA_IS_RELAXED (1u << 1)
815 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
817 /* The transaction is seen to not have an abort. */
818 #define GTMA_HAVE_ABORT (1u << 2)
819 /* The transaction is seen to have loads or stores. */
820 #define GTMA_HAVE_LOAD (1u << 3)
821 #define GTMA_HAVE_STORE (1u << 4)
822 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
823 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
824 /* The transaction WILL enter serial irrevocable mode.
825 An irrevocable block post-dominates the entire transaction, such
826 that all invocations of the transaction will go serial-irrevocable.
827 In such case, we don't bother instrumenting the transaction, and
828 tell the runtime that it should begin the transaction in
829 serial-irrevocable mode. */
830 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
831 /* The transaction contains no instrumentation code whatsover, most
832 likely because it is guaranteed to go irrevocable upon entry. */
833 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
835 struct GTY((tag("GSS_TRANSACTION")))
836 gtransaction : public gimple_statement_with_memory_ops_base
838 /* [ WORD 1-9 ] : base class */
840 /* [ WORD 10 ] */
841 gimple_seq body;
843 /* [ WORD 11-13 ] */
844 tree label_norm;
845 tree label_uninst;
846 tree label_over;
849 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
850 enum gimple_statement_structure_enum {
851 #include "gsstruct.def"
852 LAST_GSS_ENUM
854 #undef DEFGSSTRUCT
856 /* A statement with the invariant that
857 stmt->code == GIMPLE_COND
858 i.e. a conditional jump statement. */
860 struct GTY((tag("GSS_WITH_OPS")))
861 gcond : public gimple_statement_with_ops
863 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
864 static const enum gimple_code code_ = GIMPLE_COND;
867 /* A statement with the invariant that
868 stmt->code == GIMPLE_DEBUG
869 i.e. a debug statement. */
871 struct GTY((tag("GSS_WITH_OPS")))
872 gdebug : public gimple_statement_with_ops
874 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
877 /* A statement with the invariant that
878 stmt->code == GIMPLE_GOTO
879 i.e. a goto statement. */
881 struct GTY((tag("GSS_WITH_OPS")))
882 ggoto : public gimple_statement_with_ops
884 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
887 /* A statement with the invariant that
888 stmt->code == GIMPLE_LABEL
889 i.e. a label statement. */
891 struct GTY((tag("GSS_WITH_OPS")))
892 glabel : public gimple_statement_with_ops
894 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
897 /* A statement with the invariant that
898 stmt->code == GIMPLE_SWITCH
899 i.e. a switch statement. */
901 struct GTY((tag("GSS_WITH_OPS")))
902 gswitch : public gimple_statement_with_ops
904 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
907 /* A statement with the invariant that
908 stmt->code == GIMPLE_ASSIGN
909 i.e. an assignment statement. */
911 struct GTY((tag("GSS_WITH_MEM_OPS")))
912 gassign : public gimple_statement_with_memory_ops
914 static const enum gimple_code code_ = GIMPLE_ASSIGN;
915 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
918 /* A statement with the invariant that
919 stmt->code == GIMPLE_RETURN
920 i.e. a return statement. */
922 struct GTY((tag("GSS_WITH_MEM_OPS")))
923 greturn : public gimple_statement_with_memory_ops
925 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
928 template <>
929 template <>
930 inline bool
931 is_a_helper <gasm *>::test (gimple *gs)
933 return gs->code == GIMPLE_ASM;
936 template <>
937 template <>
938 inline bool
939 is_a_helper <gassign *>::test (gimple *gs)
941 return gs->code == GIMPLE_ASSIGN;
944 template <>
945 template <>
946 inline bool
947 is_a_helper <const gassign *>::test (const gimple *gs)
949 return gs->code == GIMPLE_ASSIGN;
952 template <>
953 template <>
954 inline bool
955 is_a_helper <gbind *>::test (gimple *gs)
957 return gs->code == GIMPLE_BIND;
960 template <>
961 template <>
962 inline bool
963 is_a_helper <gcall *>::test (gimple *gs)
965 return gs->code == GIMPLE_CALL;
968 template <>
969 template <>
970 inline bool
971 is_a_helper <gcatch *>::test (gimple *gs)
973 return gs->code == GIMPLE_CATCH;
976 template <>
977 template <>
978 inline bool
979 is_a_helper <gcond *>::test (gimple *gs)
981 return gs->code == GIMPLE_COND;
984 template <>
985 template <>
986 inline bool
987 is_a_helper <const gcond *>::test (const gimple *gs)
989 return gs->code == GIMPLE_COND;
992 template <>
993 template <>
994 inline bool
995 is_a_helper <gdebug *>::test (gimple *gs)
997 return gs->code == GIMPLE_DEBUG;
1000 template <>
1001 template <>
1002 inline bool
1003 is_a_helper <ggoto *>::test (gimple *gs)
1005 return gs->code == GIMPLE_GOTO;
1008 template <>
1009 template <>
1010 inline bool
1011 is_a_helper <glabel *>::test (gimple *gs)
1013 return gs->code == GIMPLE_LABEL;
1016 template <>
1017 template <>
1018 inline bool
1019 is_a_helper <gresx *>::test (gimple *gs)
1021 return gs->code == GIMPLE_RESX;
1024 template <>
1025 template <>
1026 inline bool
1027 is_a_helper <geh_dispatch *>::test (gimple *gs)
1029 return gs->code == GIMPLE_EH_DISPATCH;
1032 template <>
1033 template <>
1034 inline bool
1035 is_a_helper <geh_else *>::test (gimple *gs)
1037 return gs->code == GIMPLE_EH_ELSE;
1040 template <>
1041 template <>
1042 inline bool
1043 is_a_helper <geh_filter *>::test (gimple *gs)
1045 return gs->code == GIMPLE_EH_FILTER;
1048 template <>
1049 template <>
1050 inline bool
1051 is_a_helper <geh_mnt *>::test (gimple *gs)
1053 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1056 template <>
1057 template <>
1058 inline bool
1059 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1061 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1064 template <>
1065 template <>
1066 inline bool
1067 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1069 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1072 template <>
1073 template <>
1074 inline bool
1075 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1077 return gs->code == GIMPLE_OMP_RETURN;
1080 template <>
1081 template <>
1082 inline bool
1083 is_a_helper <gomp_continue *>::test (gimple *gs)
1085 return gs->code == GIMPLE_OMP_CONTINUE;
1088 template <>
1089 template <>
1090 inline bool
1091 is_a_helper <gomp_critical *>::test (gimple *gs)
1093 return gs->code == GIMPLE_OMP_CRITICAL;
1096 template <>
1097 template <>
1098 inline bool
1099 is_a_helper <gomp_ordered *>::test (gimple *gs)
1101 return gs->code == GIMPLE_OMP_ORDERED;
1104 template <>
1105 template <>
1106 inline bool
1107 is_a_helper <gomp_for *>::test (gimple *gs)
1109 return gs->code == GIMPLE_OMP_FOR;
1112 template <>
1113 template <>
1114 inline bool
1115 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1117 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1120 template <>
1121 template <>
1122 inline bool
1123 is_a_helper <gomp_parallel *>::test (gimple *gs)
1125 return gs->code == GIMPLE_OMP_PARALLEL;
1128 template <>
1129 template <>
1130 inline bool
1131 is_a_helper <gomp_target *>::test (gimple *gs)
1133 return gs->code == GIMPLE_OMP_TARGET;
1136 template <>
1137 template <>
1138 inline bool
1139 is_a_helper <gomp_sections *>::test (gimple *gs)
1141 return gs->code == GIMPLE_OMP_SECTIONS;
1144 template <>
1145 template <>
1146 inline bool
1147 is_a_helper <gomp_single *>::test (gimple *gs)
1149 return gs->code == GIMPLE_OMP_SINGLE;
1152 template <>
1153 template <>
1154 inline bool
1155 is_a_helper <gomp_teams *>::test (gimple *gs)
1157 return gs->code == GIMPLE_OMP_TEAMS;
1160 template <>
1161 template <>
1162 inline bool
1163 is_a_helper <gomp_task *>::test (gimple *gs)
1165 return gs->code == GIMPLE_OMP_TASK;
1168 template <>
1169 template <>
1170 inline bool
1171 is_a_helper <gphi *>::test (gimple *gs)
1173 return gs->code == GIMPLE_PHI;
1176 template <>
1177 template <>
1178 inline bool
1179 is_a_helper <greturn *>::test (gimple *gs)
1181 return gs->code == GIMPLE_RETURN;
1184 template <>
1185 template <>
1186 inline bool
1187 is_a_helper <gswitch *>::test (gimple *gs)
1189 return gs->code == GIMPLE_SWITCH;
1192 template <>
1193 template <>
1194 inline bool
1195 is_a_helper <gtransaction *>::test (gimple *gs)
1197 return gs->code == GIMPLE_TRANSACTION;
1200 template <>
1201 template <>
1202 inline bool
1203 is_a_helper <gtry *>::test (gimple *gs)
1205 return gs->code == GIMPLE_TRY;
1208 template <>
1209 template <>
1210 inline bool
1211 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1213 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1216 template <>
1217 template <>
1218 inline bool
1219 is_a_helper <const gasm *>::test (const gimple *gs)
1221 return gs->code == GIMPLE_ASM;
1224 template <>
1225 template <>
1226 inline bool
1227 is_a_helper <const gbind *>::test (const gimple *gs)
1229 return gs->code == GIMPLE_BIND;
1232 template <>
1233 template <>
1234 inline bool
1235 is_a_helper <const gcall *>::test (const gimple *gs)
1237 return gs->code == GIMPLE_CALL;
1240 template <>
1241 template <>
1242 inline bool
1243 is_a_helper <const gcatch *>::test (const gimple *gs)
1245 return gs->code == GIMPLE_CATCH;
1248 template <>
1249 template <>
1250 inline bool
1251 is_a_helper <const gresx *>::test (const gimple *gs)
1253 return gs->code == GIMPLE_RESX;
1256 template <>
1257 template <>
1258 inline bool
1259 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1261 return gs->code == GIMPLE_EH_DISPATCH;
1264 template <>
1265 template <>
1266 inline bool
1267 is_a_helper <const geh_filter *>::test (const gimple *gs)
1269 return gs->code == GIMPLE_EH_FILTER;
1272 template <>
1273 template <>
1274 inline bool
1275 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1277 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1280 template <>
1281 template <>
1282 inline bool
1283 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1285 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1288 template <>
1289 template <>
1290 inline bool
1291 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1293 return gs->code == GIMPLE_OMP_RETURN;
1296 template <>
1297 template <>
1298 inline bool
1299 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1301 return gs->code == GIMPLE_OMP_CONTINUE;
1304 template <>
1305 template <>
1306 inline bool
1307 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1309 return gs->code == GIMPLE_OMP_CRITICAL;
1312 template <>
1313 template <>
1314 inline bool
1315 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1317 return gs->code == GIMPLE_OMP_ORDERED;
1320 template <>
1321 template <>
1322 inline bool
1323 is_a_helper <const gomp_for *>::test (const gimple *gs)
1325 return gs->code == GIMPLE_OMP_FOR;
1328 template <>
1329 template <>
1330 inline bool
1331 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1333 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1336 template <>
1337 template <>
1338 inline bool
1339 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1341 return gs->code == GIMPLE_OMP_PARALLEL;
1344 template <>
1345 template <>
1346 inline bool
1347 is_a_helper <const gomp_target *>::test (const gimple *gs)
1349 return gs->code == GIMPLE_OMP_TARGET;
1352 template <>
1353 template <>
1354 inline bool
1355 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1357 return gs->code == GIMPLE_OMP_SECTIONS;
1360 template <>
1361 template <>
1362 inline bool
1363 is_a_helper <const gomp_single *>::test (const gimple *gs)
1365 return gs->code == GIMPLE_OMP_SINGLE;
1368 template <>
1369 template <>
1370 inline bool
1371 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1373 return gs->code == GIMPLE_OMP_TEAMS;
1376 template <>
1377 template <>
1378 inline bool
1379 is_a_helper <const gomp_task *>::test (const gimple *gs)
1381 return gs->code == GIMPLE_OMP_TASK;
1384 template <>
1385 template <>
1386 inline bool
1387 is_a_helper <const gphi *>::test (const gimple *gs)
1389 return gs->code == GIMPLE_PHI;
1392 template <>
1393 template <>
1394 inline bool
1395 is_a_helper <const gtransaction *>::test (const gimple *gs)
1397 return gs->code == GIMPLE_TRANSACTION;
1400 /* Offset in bytes to the location of the operand vector.
1401 Zero if there is no operand vector for this tuple structure. */
1402 extern size_t const gimple_ops_offset_[];
1404 /* Map GIMPLE codes to GSS codes. */
1405 extern enum gimple_statement_structure_enum const gss_for_code_[];
1407 /* This variable holds the currently expanded gimple statement for purposes
1408 of comminucating the profile info to the builtin expanders. */
1409 extern gimple *currently_expanding_gimple_stmt;
1411 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1412 gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1413 greturn *gimple_build_return (tree);
1414 void gimple_call_reset_alias_info (gcall *);
1415 gcall *gimple_build_call_vec (tree, vec<tree> );
1416 gcall *gimple_build_call (tree, unsigned, ...);
1417 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1418 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1419 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1420 gcall *gimple_build_call_from_tree (tree);
1421 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1422 gassign *gimple_build_assign (tree, enum tree_code,
1423 tree, tree, tree CXX_MEM_STAT_INFO);
1424 gassign *gimple_build_assign (tree, enum tree_code,
1425 tree, tree CXX_MEM_STAT_INFO);
1426 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1427 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1428 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1429 void gimple_cond_set_condition_from_tree (gcond *, tree);
1430 glabel *gimple_build_label (tree label);
1431 ggoto *gimple_build_goto (tree dest);
1432 gimple *gimple_build_nop (void);
1433 gbind *gimple_build_bind (tree, gimple_seq, tree);
1434 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1435 vec<tree, va_gc> *, vec<tree, va_gc> *,
1436 vec<tree, va_gc> *);
1437 gcatch *gimple_build_catch (tree, gimple_seq);
1438 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1439 geh_mnt *gimple_build_eh_must_not_throw (tree);
1440 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1441 gtry *gimple_build_try (gimple_seq, gimple_seq,
1442 enum gimple_try_flags);
1443 gimple *gimple_build_wce (gimple_seq);
1444 gresx *gimple_build_resx (int);
1445 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1446 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1447 geh_dispatch *gimple_build_eh_dispatch (int);
1448 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1449 #define gimple_build_debug_bind(var,val,stmt) \
1450 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1451 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1452 #define gimple_build_debug_source_bind(var,val,stmt) \
1453 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1454 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1455 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1456 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1457 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1458 tree, tree);
1459 gimple *gimple_build_omp_section (gimple_seq);
1460 gimple *gimple_build_omp_master (gimple_seq);
1461 gimple *gimple_build_omp_grid_body (gimple_seq);
1462 gimple *gimple_build_omp_taskgroup (gimple_seq);
1463 gomp_continue *gimple_build_omp_continue (tree, tree);
1464 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1465 gimple *gimple_build_omp_return (bool);
1466 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1467 gimple *gimple_build_omp_sections_switch (void);
1468 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1469 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1470 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1471 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1472 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1473 gtransaction *gimple_build_transaction (gimple_seq);
1474 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1475 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1476 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1477 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1478 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1479 location_t);
1480 extern void annotate_all_with_location (gimple_seq, location_t);
1481 bool empty_body_p (gimple_seq);
1482 gimple_seq gimple_seq_copy (gimple_seq);
1483 bool gimple_call_same_target_p (const gimple *, const gimple *);
1484 int gimple_call_flags (const gimple *);
1485 int gimple_call_arg_flags (const gcall *, unsigned);
1486 int gimple_call_return_flags (const gcall *);
1487 bool gimple_assign_copy_p (gimple *);
1488 bool gimple_assign_ssa_name_copy_p (gimple *);
1489 bool gimple_assign_unary_nop_p (gimple *);
1490 void gimple_set_bb (gimple *, basic_block);
1491 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1492 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1493 tree, tree, tree);
1494 tree gimple_get_lhs (const gimple *);
1495 void gimple_set_lhs (gimple *, tree);
1496 gimple *gimple_copy (gimple *);
1497 bool gimple_has_side_effects (const gimple *);
1498 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1499 bool gimple_could_trap_p (gimple *);
1500 bool gimple_assign_rhs_could_trap_p (gimple *);
1501 extern void dump_gimple_statistics (void);
1502 unsigned get_gimple_rhs_num_ops (enum tree_code);
1503 extern tree canonicalize_cond_expr_cond (tree);
1504 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1505 extern bool gimple_compare_field_offset (tree, tree);
1506 extern tree gimple_unsigned_type (tree);
1507 extern tree gimple_signed_type (tree);
1508 extern alias_set_type gimple_get_alias_set (tree);
1509 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1510 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1511 extern combined_fn gimple_call_combined_fn (const gimple *);
1512 extern bool gimple_call_builtin_p (const gimple *);
1513 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1514 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1515 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1516 extern void dump_decl_set (FILE *, bitmap);
1517 extern bool nonfreeing_call_p (gimple *);
1518 extern bool nonbarrier_call_p (gimple *);
1519 extern bool infer_nonnull_range (gimple *, tree);
1520 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1521 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1522 extern void sort_case_labels (vec<tree>);
1523 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1524 extern void gimple_seq_set_location (gimple_seq, location_t);
1525 extern void gimple_seq_discard (gimple_seq);
1526 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1528 /* Formal (expression) temporary table handling: multiple occurrences of
1529 the same scalar expression are evaluated into the same temporary. */
1531 typedef struct gimple_temp_hash_elt
1533 tree val; /* Key */
1534 tree temp; /* Value */
1535 } elt_t;
1537 /* Get the number of the next statement uid to be allocated. */
1538 static inline unsigned int
1539 gimple_stmt_max_uid (struct function *fn)
1541 return fn->last_stmt_uid;
1544 /* Set the number of the next statement uid to be allocated. */
1545 static inline void
1546 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1548 fn->last_stmt_uid = maxid;
1551 /* Set the number of the next statement uid to be allocated. */
1552 static inline unsigned int
1553 inc_gimple_stmt_max_uid (struct function *fn)
1555 return fn->last_stmt_uid++;
1558 /* Return the first node in GIMPLE sequence S. */
1560 static inline gimple_seq_node
1561 gimple_seq_first (gimple_seq s)
1563 return s;
1567 /* Return the first statement in GIMPLE sequence S. */
1569 static inline gimple *
1570 gimple_seq_first_stmt (gimple_seq s)
1572 gimple_seq_node n = gimple_seq_first (s);
1573 return n;
1576 /* Return the first statement in GIMPLE sequence S as a gbind *,
1577 verifying that it has code GIMPLE_BIND in a checked build. */
1579 static inline gbind *
1580 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1582 gimple_seq_node n = gimple_seq_first (s);
1583 return as_a <gbind *> (n);
1587 /* Return the last node in GIMPLE sequence S. */
1589 static inline gimple_seq_node
1590 gimple_seq_last (gimple_seq s)
1592 return s ? s->prev : NULL;
1596 /* Return the last statement in GIMPLE sequence S. */
1598 static inline gimple *
1599 gimple_seq_last_stmt (gimple_seq s)
1601 gimple_seq_node n = gimple_seq_last (s);
1602 return n;
1606 /* Set the last node in GIMPLE sequence *PS to LAST. */
1608 static inline void
1609 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1611 (*ps)->prev = last;
1615 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1617 static inline void
1618 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1620 *ps = first;
1624 /* Return true if GIMPLE sequence S is empty. */
1626 static inline bool
1627 gimple_seq_empty_p (gimple_seq s)
1629 return s == NULL;
1632 /* Allocate a new sequence and initialize its first element with STMT. */
1634 static inline gimple_seq
1635 gimple_seq_alloc_with_stmt (gimple *stmt)
1637 gimple_seq seq = NULL;
1638 gimple_seq_add_stmt (&seq, stmt);
1639 return seq;
1643 /* Returns the sequence of statements in BB. */
1645 static inline gimple_seq
1646 bb_seq (const_basic_block bb)
1648 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1651 static inline gimple_seq *
1652 bb_seq_addr (basic_block bb)
1654 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1657 /* Sets the sequence of statements in BB to SEQ. */
1659 static inline void
1660 set_bb_seq (basic_block bb, gimple_seq seq)
1662 gcc_checking_assert (!(bb->flags & BB_RTL));
1663 bb->il.gimple.seq = seq;
1667 /* Return the code for GIMPLE statement G. */
1669 static inline enum gimple_code
1670 gimple_code (const gimple *g)
1672 return g->code;
1676 /* Return the GSS code used by a GIMPLE code. */
1678 static inline enum gimple_statement_structure_enum
1679 gss_for_code (enum gimple_code code)
1681 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1682 return gss_for_code_[code];
1686 /* Return which GSS code is used by GS. */
1688 static inline enum gimple_statement_structure_enum
1689 gimple_statement_structure (gimple *gs)
1691 return gss_for_code (gimple_code (gs));
1695 /* Return true if statement G has sub-statements. This is only true for
1696 High GIMPLE statements. */
1698 static inline bool
1699 gimple_has_substatements (gimple *g)
1701 switch (gimple_code (g))
1703 case GIMPLE_BIND:
1704 case GIMPLE_CATCH:
1705 case GIMPLE_EH_FILTER:
1706 case GIMPLE_EH_ELSE:
1707 case GIMPLE_TRY:
1708 case GIMPLE_OMP_FOR:
1709 case GIMPLE_OMP_MASTER:
1710 case GIMPLE_OMP_TASKGROUP:
1711 case GIMPLE_OMP_ORDERED:
1712 case GIMPLE_OMP_SECTION:
1713 case GIMPLE_OMP_PARALLEL:
1714 case GIMPLE_OMP_TASK:
1715 case GIMPLE_OMP_SECTIONS:
1716 case GIMPLE_OMP_SINGLE:
1717 case GIMPLE_OMP_TARGET:
1718 case GIMPLE_OMP_TEAMS:
1719 case GIMPLE_OMP_CRITICAL:
1720 case GIMPLE_WITH_CLEANUP_EXPR:
1721 case GIMPLE_TRANSACTION:
1722 case GIMPLE_OMP_GRID_BODY:
1723 return true;
1725 default:
1726 return false;
1731 /* Return the basic block holding statement G. */
1733 static inline basic_block
1734 gimple_bb (const gimple *g)
1736 return g->bb;
1740 /* Return the lexical scope block holding statement G. */
1742 static inline tree
1743 gimple_block (const gimple *g)
1745 return LOCATION_BLOCK (g->location);
1749 /* Set BLOCK to be the lexical scope block holding statement G. */
1751 static inline void
1752 gimple_set_block (gimple *g, tree block)
1754 g->location = set_block (g->location, block);
1758 /* Return location information for statement G. */
1760 static inline location_t
1761 gimple_location (const gimple *g)
1763 return g->location;
1766 /* Return location information for statement G if g is not NULL.
1767 Otherwise, UNKNOWN_LOCATION is returned. */
1769 static inline location_t
1770 gimple_location_safe (const gimple *g)
1772 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1775 /* Set location information for statement G. */
1777 static inline void
1778 gimple_set_location (gimple *g, location_t location)
1780 g->location = location;
1784 /* Return true if G contains location information. */
1786 static inline bool
1787 gimple_has_location (const gimple *g)
1789 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1793 /* Return the file name of the location of STMT. */
1795 static inline const char *
1796 gimple_filename (const gimple *stmt)
1798 return LOCATION_FILE (gimple_location (stmt));
1802 /* Return the line number of the location of STMT. */
1804 static inline int
1805 gimple_lineno (const gimple *stmt)
1807 return LOCATION_LINE (gimple_location (stmt));
1811 /* Determine whether SEQ is a singleton. */
1813 static inline bool
1814 gimple_seq_singleton_p (gimple_seq seq)
1816 return ((gimple_seq_first (seq) != NULL)
1817 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1820 /* Return true if no warnings should be emitted for statement STMT. */
1822 static inline bool
1823 gimple_no_warning_p (const gimple *stmt)
1825 return stmt->no_warning;
1828 /* Set the no_warning flag of STMT to NO_WARNING. */
1830 static inline void
1831 gimple_set_no_warning (gimple *stmt, bool no_warning)
1833 stmt->no_warning = (unsigned) no_warning;
1836 /* Set the visited status on statement STMT to VISITED_P.
1838 Please note that this 'visited' property of the gimple statement is
1839 supposed to be undefined at pass boundaries. This means that a
1840 given pass should not assume it contains any useful value when the
1841 pass starts and thus can set it to any value it sees fit.
1843 You can learn more about the visited property of the gimple
1844 statement by reading the comments of the 'visited' data member of
1845 struct gimple.
1848 static inline void
1849 gimple_set_visited (gimple *stmt, bool visited_p)
1851 stmt->visited = (unsigned) visited_p;
1855 /* Return the visited status for statement STMT.
1857 Please note that this 'visited' property of the gimple statement is
1858 supposed to be undefined at pass boundaries. This means that a
1859 given pass should not assume it contains any useful value when the
1860 pass starts and thus can set it to any value it sees fit.
1862 You can learn more about the visited property of the gimple
1863 statement by reading the comments of the 'visited' data member of
1864 struct gimple. */
1866 static inline bool
1867 gimple_visited_p (gimple *stmt)
1869 return stmt->visited;
1873 /* Set pass local flag PLF on statement STMT to VAL_P.
1875 Please note that this PLF property of the gimple statement is
1876 supposed to be undefined at pass boundaries. This means that a
1877 given pass should not assume it contains any useful value when the
1878 pass starts and thus can set it to any value it sees fit.
1880 You can learn more about the PLF property by reading the comment of
1881 the 'plf' data member of struct gimple_statement_structure. */
1883 static inline void
1884 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1886 if (val_p)
1887 stmt->plf |= (unsigned int) plf;
1888 else
1889 stmt->plf &= ~((unsigned int) plf);
1893 /* Return the value of pass local flag PLF on statement STMT.
1895 Please note that this 'plf' property of the gimple statement is
1896 supposed to be undefined at pass boundaries. This means that a
1897 given pass should not assume it contains any useful value when the
1898 pass starts and thus can set it to any value it sees fit.
1900 You can learn more about the plf property by reading the comment of
1901 the 'plf' data member of struct gimple_statement_structure. */
1903 static inline unsigned int
1904 gimple_plf (gimple *stmt, enum plf_mask plf)
1906 return stmt->plf & ((unsigned int) plf);
1910 /* Set the UID of statement.
1912 Please note that this UID property is supposed to be undefined at
1913 pass boundaries. This means that a given pass should not assume it
1914 contains any useful value when the pass starts and thus can set it
1915 to any value it sees fit. */
1917 static inline void
1918 gimple_set_uid (gimple *g, unsigned uid)
1920 g->uid = uid;
1924 /* Return the UID of statement.
1926 Please note that this UID property is supposed to be undefined at
1927 pass boundaries. This means that a given pass should not assume it
1928 contains any useful value when the pass starts and thus can set it
1929 to any value it sees fit. */
1931 static inline unsigned
1932 gimple_uid (const gimple *g)
1934 return g->uid;
1938 /* Make statement G a singleton sequence. */
1940 static inline void
1941 gimple_init_singleton (gimple *g)
1943 g->next = NULL;
1944 g->prev = g;
1948 /* Return true if GIMPLE statement G has register or memory operands. */
1950 static inline bool
1951 gimple_has_ops (const gimple *g)
1953 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1956 template <>
1957 template <>
1958 inline bool
1959 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1961 return gimple_has_ops (gs);
1964 template <>
1965 template <>
1966 inline bool
1967 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1969 return gimple_has_ops (gs);
1972 /* Return true if GIMPLE statement G has memory operands. */
1974 static inline bool
1975 gimple_has_mem_ops (const gimple *g)
1977 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1980 template <>
1981 template <>
1982 inline bool
1983 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1985 return gimple_has_mem_ops (gs);
1988 template <>
1989 template <>
1990 inline bool
1991 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1993 return gimple_has_mem_ops (gs);
1996 /* Return the set of USE operands for statement G. */
1998 static inline struct use_optype_d *
1999 gimple_use_ops (const gimple *g)
2001 const gimple_statement_with_ops *ops_stmt =
2002 dyn_cast <const gimple_statement_with_ops *> (g);
2003 if (!ops_stmt)
2004 return NULL;
2005 return ops_stmt->use_ops;
2009 /* Set USE to be the set of USE operands for statement G. */
2011 static inline void
2012 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2014 gimple_statement_with_ops *ops_stmt =
2015 as_a <gimple_statement_with_ops *> (g);
2016 ops_stmt->use_ops = use;
2020 /* Return the single VUSE operand of the statement G. */
2022 static inline tree
2023 gimple_vuse (const gimple *g)
2025 const gimple_statement_with_memory_ops *mem_ops_stmt =
2026 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2027 if (!mem_ops_stmt)
2028 return NULL_TREE;
2029 return mem_ops_stmt->vuse;
2032 /* Return the single VDEF operand of the statement G. */
2034 static inline tree
2035 gimple_vdef (const gimple *g)
2037 const gimple_statement_with_memory_ops *mem_ops_stmt =
2038 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2039 if (!mem_ops_stmt)
2040 return NULL_TREE;
2041 return mem_ops_stmt->vdef;
2044 /* Return the single VUSE operand of the statement G. */
2046 static inline tree *
2047 gimple_vuse_ptr (gimple *g)
2049 gimple_statement_with_memory_ops *mem_ops_stmt =
2050 dyn_cast <gimple_statement_with_memory_ops *> (g);
2051 if (!mem_ops_stmt)
2052 return NULL;
2053 return &mem_ops_stmt->vuse;
2056 /* Return the single VDEF operand of the statement G. */
2058 static inline tree *
2059 gimple_vdef_ptr (gimple *g)
2061 gimple_statement_with_memory_ops *mem_ops_stmt =
2062 dyn_cast <gimple_statement_with_memory_ops *> (g);
2063 if (!mem_ops_stmt)
2064 return NULL;
2065 return &mem_ops_stmt->vdef;
2068 /* Set the single VUSE operand of the statement G. */
2070 static inline void
2071 gimple_set_vuse (gimple *g, tree vuse)
2073 gimple_statement_with_memory_ops *mem_ops_stmt =
2074 as_a <gimple_statement_with_memory_ops *> (g);
2075 mem_ops_stmt->vuse = vuse;
2078 /* Set the single VDEF operand of the statement G. */
2080 static inline void
2081 gimple_set_vdef (gimple *g, tree vdef)
2083 gimple_statement_with_memory_ops *mem_ops_stmt =
2084 as_a <gimple_statement_with_memory_ops *> (g);
2085 mem_ops_stmt->vdef = vdef;
2089 /* Return true if statement G has operands and the modified field has
2090 been set. */
2092 static inline bool
2093 gimple_modified_p (const gimple *g)
2095 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2099 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2100 a MODIFIED field. */
2102 static inline void
2103 gimple_set_modified (gimple *s, bool modifiedp)
2105 if (gimple_has_ops (s))
2106 s->modified = (unsigned) modifiedp;
2110 /* Return the tree code for the expression computed by STMT. This is
2111 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2112 GIMPLE_CALL, return CALL_EXPR as the expression code for
2113 consistency. This is useful when the caller needs to deal with the
2114 three kinds of computation that GIMPLE supports. */
2116 static inline enum tree_code
2117 gimple_expr_code (const gimple *stmt)
2119 enum gimple_code code = gimple_code (stmt);
2120 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2121 return (enum tree_code) stmt->subcode;
2122 else
2124 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2125 return CALL_EXPR;
2130 /* Return true if statement STMT contains volatile operands. */
2132 static inline bool
2133 gimple_has_volatile_ops (const gimple *stmt)
2135 if (gimple_has_mem_ops (stmt))
2136 return stmt->has_volatile_ops;
2137 else
2138 return false;
2142 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2144 static inline void
2145 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2147 if (gimple_has_mem_ops (stmt))
2148 stmt->has_volatile_ops = (unsigned) volatilep;
2151 /* Return true if STMT is in a transaction. */
2153 static inline bool
2154 gimple_in_transaction (const gimple *stmt)
2156 return bb_in_transaction (gimple_bb (stmt));
2159 /* Return true if statement STMT may access memory. */
2161 static inline bool
2162 gimple_references_memory_p (gimple *stmt)
2164 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2168 /* Return the subcode for OMP statement S. */
2170 static inline unsigned
2171 gimple_omp_subcode (const gimple *s)
2173 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2174 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2175 return s->subcode;
2178 /* Set the subcode for OMP statement S to SUBCODE. */
2180 static inline void
2181 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2183 /* We only have 16 bits for the subcode. Assert that we are not
2184 overflowing it. */
2185 gcc_gimple_checking_assert (subcode < (1 << 16));
2186 s->subcode = subcode;
2189 /* Set the nowait flag on OMP_RETURN statement S. */
2191 static inline void
2192 gimple_omp_return_set_nowait (gimple *s)
2194 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2195 s->subcode |= GF_OMP_RETURN_NOWAIT;
2199 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2200 flag set. */
2202 static inline bool
2203 gimple_omp_return_nowait_p (const gimple *g)
2205 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2206 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2210 /* Set the LHS of OMP return. */
2212 static inline void
2213 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2215 gimple_statement_omp_return *omp_return_stmt =
2216 as_a <gimple_statement_omp_return *> (g);
2217 omp_return_stmt->val = lhs;
2221 /* Get the LHS of OMP return. */
2223 static inline tree
2224 gimple_omp_return_lhs (const gimple *g)
2226 const gimple_statement_omp_return *omp_return_stmt =
2227 as_a <const gimple_statement_omp_return *> (g);
2228 return omp_return_stmt->val;
2232 /* Return a pointer to the LHS of OMP return. */
2234 static inline tree *
2235 gimple_omp_return_lhs_ptr (gimple *g)
2237 gimple_statement_omp_return *omp_return_stmt =
2238 as_a <gimple_statement_omp_return *> (g);
2239 return &omp_return_stmt->val;
2243 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2244 flag set. */
2246 static inline bool
2247 gimple_omp_section_last_p (const gimple *g)
2249 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2250 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2254 /* Set the GF_OMP_SECTION_LAST flag on G. */
2256 static inline void
2257 gimple_omp_section_set_last (gimple *g)
2259 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2260 g->subcode |= GF_OMP_SECTION_LAST;
2264 /* Return true if OMP parallel statement G has the
2265 GF_OMP_PARALLEL_COMBINED flag set. */
2267 static inline bool
2268 gimple_omp_parallel_combined_p (const gimple *g)
2270 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2271 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2275 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2276 value of COMBINED_P. */
2278 static inline void
2279 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2281 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2282 if (combined_p)
2283 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2284 else
2285 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2289 /* Return true if OMP atomic load/store statement G has the
2290 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2292 static inline bool
2293 gimple_omp_atomic_need_value_p (const gimple *g)
2295 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2296 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2297 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2301 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2303 static inline void
2304 gimple_omp_atomic_set_need_value (gimple *g)
2306 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2307 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2308 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2312 /* Return true if OMP atomic load/store statement G has the
2313 GF_OMP_ATOMIC_SEQ_CST flag set. */
2315 static inline bool
2316 gimple_omp_atomic_seq_cst_p (const gimple *g)
2318 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2319 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2320 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2324 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2326 static inline void
2327 gimple_omp_atomic_set_seq_cst (gimple *g)
2329 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2330 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2331 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2335 /* Return the number of operands for statement GS. */
2337 static inline unsigned
2338 gimple_num_ops (const gimple *gs)
2340 return gs->num_ops;
2344 /* Set the number of operands for statement GS. */
2346 static inline void
2347 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2349 gs->num_ops = num_ops;
2353 /* Return the array of operands for statement GS. */
2355 static inline tree *
2356 gimple_ops (gimple *gs)
2358 size_t off;
2360 /* All the tuples have their operand vector at the very bottom
2361 of the structure. Note that those structures that do not
2362 have an operand vector have a zero offset. */
2363 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2364 gcc_gimple_checking_assert (off != 0);
2366 return (tree *) ((char *) gs + off);
2370 /* Return operand I for statement GS. */
2372 static inline tree
2373 gimple_op (const gimple *gs, unsigned i)
2375 if (gimple_has_ops (gs))
2377 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2378 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2380 else
2381 return NULL_TREE;
2384 /* Return a pointer to operand I for statement GS. */
2386 static inline tree *
2387 gimple_op_ptr (gimple *gs, unsigned i)
2389 if (gimple_has_ops (gs))
2391 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2392 return gimple_ops (gs) + i;
2394 else
2395 return NULL;
2398 /* Set operand I of statement GS to OP. */
2400 static inline void
2401 gimple_set_op (gimple *gs, unsigned i, tree op)
2403 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2405 /* Note. It may be tempting to assert that OP matches
2406 is_gimple_operand, but that would be wrong. Different tuples
2407 accept slightly different sets of tree operands. Each caller
2408 should perform its own validation. */
2409 gimple_ops (gs)[i] = op;
2412 /* Return true if GS is a GIMPLE_ASSIGN. */
2414 static inline bool
2415 is_gimple_assign (const gimple *gs)
2417 return gimple_code (gs) == GIMPLE_ASSIGN;
2420 /* Determine if expression CODE is one of the valid expressions that can
2421 be used on the RHS of GIMPLE assignments. */
2423 static inline enum gimple_rhs_class
2424 get_gimple_rhs_class (enum tree_code code)
2426 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2429 /* Return the LHS of assignment statement GS. */
2431 static inline tree
2432 gimple_assign_lhs (const gassign *gs)
2434 return gs->op[0];
2437 static inline tree
2438 gimple_assign_lhs (const gimple *gs)
2440 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2441 return gimple_assign_lhs (ass);
2445 /* Return a pointer to the LHS of assignment statement GS. */
2447 static inline tree *
2448 gimple_assign_lhs_ptr (gassign *gs)
2450 return &gs->op[0];
2453 static inline tree *
2454 gimple_assign_lhs_ptr (gimple *gs)
2456 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2457 return gimple_assign_lhs_ptr (ass);
2461 /* Set LHS to be the LHS operand of assignment statement GS. */
2463 static inline void
2464 gimple_assign_set_lhs (gassign *gs, tree lhs)
2466 gs->op[0] = lhs;
2468 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2469 SSA_NAME_DEF_STMT (lhs) = gs;
2472 static inline void
2473 gimple_assign_set_lhs (gimple *gs, tree lhs)
2475 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2476 gimple_assign_set_lhs (ass, lhs);
2480 /* Return the first operand on the RHS of assignment statement GS. */
2482 static inline tree
2483 gimple_assign_rhs1 (const gassign *gs)
2485 return gs->op[1];
2488 static inline tree
2489 gimple_assign_rhs1 (const gimple *gs)
2491 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2492 return gimple_assign_rhs1 (ass);
2496 /* Return a pointer to the first operand on the RHS of assignment
2497 statement GS. */
2499 static inline tree *
2500 gimple_assign_rhs1_ptr (gassign *gs)
2502 return &gs->op[1];
2505 static inline tree *
2506 gimple_assign_rhs1_ptr (gimple *gs)
2508 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2509 return gimple_assign_rhs1_ptr (ass);
2512 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2514 static inline void
2515 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2517 gs->op[1] = rhs;
2520 static inline void
2521 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2523 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2524 gimple_assign_set_rhs1 (ass, rhs);
2528 /* Return the second operand on the RHS of assignment statement GS.
2529 If GS does not have two operands, NULL is returned instead. */
2531 static inline tree
2532 gimple_assign_rhs2 (const gassign *gs)
2534 if (gimple_num_ops (gs) >= 3)
2535 return gs->op[2];
2536 else
2537 return NULL_TREE;
2540 static inline tree
2541 gimple_assign_rhs2 (const gimple *gs)
2543 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2544 return gimple_assign_rhs2 (ass);
2548 /* Return a pointer to the second operand on the RHS of assignment
2549 statement GS. */
2551 static inline tree *
2552 gimple_assign_rhs2_ptr (gassign *gs)
2554 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2555 return &gs->op[2];
2558 static inline tree *
2559 gimple_assign_rhs2_ptr (gimple *gs)
2561 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2562 return gimple_assign_rhs2_ptr (ass);
2566 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2568 static inline void
2569 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2571 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2572 gs->op[2] = rhs;
2575 static inline void
2576 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2578 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2579 return gimple_assign_set_rhs2 (ass, rhs);
2582 /* Return the third operand on the RHS of assignment statement GS.
2583 If GS does not have two operands, NULL is returned instead. */
2585 static inline tree
2586 gimple_assign_rhs3 (const gassign *gs)
2588 if (gimple_num_ops (gs) >= 4)
2589 return gs->op[3];
2590 else
2591 return NULL_TREE;
2594 static inline tree
2595 gimple_assign_rhs3 (const gimple *gs)
2597 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2598 return gimple_assign_rhs3 (ass);
2601 /* Return a pointer to the third operand on the RHS of assignment
2602 statement GS. */
2604 static inline tree *
2605 gimple_assign_rhs3_ptr (gimple *gs)
2607 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2608 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2609 return &ass->op[3];
2613 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2615 static inline void
2616 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2618 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2619 gs->op[3] = rhs;
2622 static inline void
2623 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2625 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2626 gimple_assign_set_rhs3 (ass, rhs);
2630 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2631 which expect to see only two operands. */
2633 static inline void
2634 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2635 tree op1, tree op2)
2637 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2640 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2641 which expect to see only one operands. */
2643 static inline void
2644 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2645 tree op1)
2647 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2650 /* Returns true if GS is a nontemporal move. */
2652 static inline bool
2653 gimple_assign_nontemporal_move_p (const gassign *gs)
2655 return gs->nontemporal_move;
2658 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2660 static inline void
2661 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2663 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2664 gs->nontemporal_move = nontemporal;
2668 /* Return the code of the expression computed on the rhs of assignment
2669 statement GS. In case that the RHS is a single object, returns the
2670 tree code of the object. */
2672 static inline enum tree_code
2673 gimple_assign_rhs_code (const gassign *gs)
2675 enum tree_code code = (enum tree_code) gs->subcode;
2676 /* While we initially set subcode to the TREE_CODE of the rhs for
2677 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2678 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2679 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2680 code = TREE_CODE (gs->op[1]);
2682 return code;
2685 static inline enum tree_code
2686 gimple_assign_rhs_code (const gimple *gs)
2688 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2689 return gimple_assign_rhs_code (ass);
2693 /* Set CODE to be the code for the expression computed on the RHS of
2694 assignment S. */
2696 static inline void
2697 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2699 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2700 s->subcode = code;
2704 /* Return the gimple rhs class of the code of the expression computed on
2705 the rhs of assignment statement GS.
2706 This will never return GIMPLE_INVALID_RHS. */
2708 static inline enum gimple_rhs_class
2709 gimple_assign_rhs_class (const gimple *gs)
2711 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2714 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2715 there is no operator associated with the assignment itself.
2716 Unlike gimple_assign_copy_p, this predicate returns true for
2717 any RHS operand, including those that perform an operation
2718 and do not have the semantics of a copy, such as COND_EXPR. */
2720 static inline bool
2721 gimple_assign_single_p (const gimple *gs)
2723 return (is_gimple_assign (gs)
2724 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2727 /* Return true if GS performs a store to its lhs. */
2729 static inline bool
2730 gimple_store_p (const gimple *gs)
2732 tree lhs = gimple_get_lhs (gs);
2733 return lhs && !is_gimple_reg (lhs);
2736 /* Return true if GS is an assignment that loads from its rhs1. */
2738 static inline bool
2739 gimple_assign_load_p (const gimple *gs)
2741 tree rhs;
2742 if (!gimple_assign_single_p (gs))
2743 return false;
2744 rhs = gimple_assign_rhs1 (gs);
2745 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2746 return true;
2747 rhs = get_base_address (rhs);
2748 return (DECL_P (rhs)
2749 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2753 /* Return true if S is a type-cast assignment. */
2755 static inline bool
2756 gimple_assign_cast_p (const gimple *s)
2758 if (is_gimple_assign (s))
2760 enum tree_code sc = gimple_assign_rhs_code (s);
2761 return CONVERT_EXPR_CODE_P (sc)
2762 || sc == VIEW_CONVERT_EXPR
2763 || sc == FIX_TRUNC_EXPR;
2766 return false;
2769 /* Return true if S is a clobber statement. */
2771 static inline bool
2772 gimple_clobber_p (const gimple *s)
2774 return gimple_assign_single_p (s)
2775 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2778 /* Return true if GS is a GIMPLE_CALL. */
2780 static inline bool
2781 is_gimple_call (const gimple *gs)
2783 return gimple_code (gs) == GIMPLE_CALL;
2786 /* Return the LHS of call statement GS. */
2788 static inline tree
2789 gimple_call_lhs (const gcall *gs)
2791 return gs->op[0];
2794 static inline tree
2795 gimple_call_lhs (const gimple *gs)
2797 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2798 return gimple_call_lhs (gc);
2802 /* Return a pointer to the LHS of call statement GS. */
2804 static inline tree *
2805 gimple_call_lhs_ptr (gcall *gs)
2807 return &gs->op[0];
2810 static inline tree *
2811 gimple_call_lhs_ptr (gimple *gs)
2813 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2814 return gimple_call_lhs_ptr (gc);
2818 /* Set LHS to be the LHS operand of call statement GS. */
2820 static inline void
2821 gimple_call_set_lhs (gcall *gs, tree lhs)
2823 gs->op[0] = lhs;
2824 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2825 SSA_NAME_DEF_STMT (lhs) = gs;
2828 static inline void
2829 gimple_call_set_lhs (gimple *gs, tree lhs)
2831 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2832 gimple_call_set_lhs (gc, lhs);
2836 /* Return true if call GS calls an internal-only function, as enumerated
2837 by internal_fn. */
2839 static inline bool
2840 gimple_call_internal_p (const gcall *gs)
2842 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2845 static inline bool
2846 gimple_call_internal_p (const gimple *gs)
2848 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2849 return gimple_call_internal_p (gc);
2853 /* Return true if call GS is marked as instrumented by
2854 Pointer Bounds Checker. */
2856 static inline bool
2857 gimple_call_with_bounds_p (const gcall *gs)
2859 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2862 static inline bool
2863 gimple_call_with_bounds_p (const gimple *gs)
2865 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2866 return gimple_call_with_bounds_p (gc);
2870 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2871 Pointer Bounds Checker. */
2873 static inline void
2874 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2876 if (with_bounds)
2877 gs->subcode |= GF_CALL_WITH_BOUNDS;
2878 else
2879 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2882 static inline void
2883 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2885 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2886 gimple_call_set_with_bounds (gc, with_bounds);
2890 /* Return the target of internal call GS. */
2892 static inline enum internal_fn
2893 gimple_call_internal_fn (const gcall *gs)
2895 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2896 return gs->u.internal_fn;
2899 static inline enum internal_fn
2900 gimple_call_internal_fn (const gimple *gs)
2902 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2903 return gimple_call_internal_fn (gc);
2906 /* Return true, if this internal gimple call is unique. */
2908 static inline bool
2909 gimple_call_internal_unique_p (const gcall *gs)
2911 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2914 static inline bool
2915 gimple_call_internal_unique_p (const gimple *gs)
2917 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2918 return gimple_call_internal_unique_p (gc);
2921 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2922 that could alter control flow. */
2924 static inline void
2925 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2927 if (ctrl_altering_p)
2928 s->subcode |= GF_CALL_CTRL_ALTERING;
2929 else
2930 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2933 static inline void
2934 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2936 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2937 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2940 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2941 flag is set. Such call could not be a stmt in the middle of a bb. */
2943 static inline bool
2944 gimple_call_ctrl_altering_p (const gcall *gs)
2946 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2949 static inline bool
2950 gimple_call_ctrl_altering_p (const gimple *gs)
2952 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2953 return gimple_call_ctrl_altering_p (gc);
2957 /* Return the function type of the function called by GS. */
2959 static inline tree
2960 gimple_call_fntype (const gcall *gs)
2962 if (gimple_call_internal_p (gs))
2963 return NULL_TREE;
2964 return gs->u.fntype;
2967 static inline tree
2968 gimple_call_fntype (const gimple *gs)
2970 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2971 return gimple_call_fntype (call_stmt);
2974 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2976 static inline void
2977 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2979 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2980 call_stmt->u.fntype = fntype;
2984 /* Return the tree node representing the function called by call
2985 statement GS. */
2987 static inline tree
2988 gimple_call_fn (const gcall *gs)
2990 return gs->op[1];
2993 static inline tree
2994 gimple_call_fn (const gimple *gs)
2996 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2997 return gimple_call_fn (gc);
3000 /* Return a pointer to the tree node representing the function called by call
3001 statement GS. */
3003 static inline tree *
3004 gimple_call_fn_ptr (gcall *gs)
3006 return &gs->op[1];
3009 static inline tree *
3010 gimple_call_fn_ptr (gimple *gs)
3012 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3013 return gimple_call_fn_ptr (gc);
3017 /* Set FN to be the function called by call statement GS. */
3019 static inline void
3020 gimple_call_set_fn (gcall *gs, tree fn)
3022 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3023 gs->op[1] = fn;
3027 /* Set FNDECL to be the function called by call statement GS. */
3029 static inline void
3030 gimple_call_set_fndecl (gcall *gs, tree decl)
3032 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3033 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3034 build_pointer_type (TREE_TYPE (decl)), decl);
3037 static inline void
3038 gimple_call_set_fndecl (gimple *gs, tree decl)
3040 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3041 gimple_call_set_fndecl (gc, decl);
3045 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3047 static inline void
3048 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3050 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3051 call_stmt->u.internal_fn = fn;
3055 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3056 Otherwise return NULL. This function is analogous to
3057 get_callee_fndecl in tree land. */
3059 static inline tree
3060 gimple_call_fndecl (const gcall *gs)
3062 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3065 static inline tree
3066 gimple_call_fndecl (const gimple *gs)
3068 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3069 return gimple_call_fndecl (gc);
3073 /* Return the type returned by call statement GS. */
3075 static inline tree
3076 gimple_call_return_type (const gcall *gs)
3078 tree type = gimple_call_fntype (gs);
3080 if (type == NULL_TREE)
3081 return TREE_TYPE (gimple_call_lhs (gs));
3083 /* The type returned by a function is the type of its
3084 function type. */
3085 return TREE_TYPE (type);
3089 /* Return the static chain for call statement GS. */
3091 static inline tree
3092 gimple_call_chain (const gcall *gs)
3094 return gs->op[2];
3097 static inline tree
3098 gimple_call_chain (const gimple *gs)
3100 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3101 return gimple_call_chain (gc);
3105 /* Return a pointer to the static chain for call statement CALL_STMT. */
3107 static inline tree *
3108 gimple_call_chain_ptr (gcall *call_stmt)
3110 return &call_stmt->op[2];
3113 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3115 static inline void
3116 gimple_call_set_chain (gcall *call_stmt, tree chain)
3118 call_stmt->op[2] = chain;
3122 /* Return the number of arguments used by call statement GS. */
3124 static inline unsigned
3125 gimple_call_num_args (const gcall *gs)
3127 return gimple_num_ops (gs) - 3;
3130 static inline unsigned
3131 gimple_call_num_args (const gimple *gs)
3133 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3134 return gimple_call_num_args (gc);
3138 /* Return the argument at position INDEX for call statement GS. */
3140 static inline tree
3141 gimple_call_arg (const gcall *gs, unsigned index)
3143 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3144 return gs->op[index + 3];
3147 static inline tree
3148 gimple_call_arg (const gimple *gs, unsigned index)
3150 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3151 return gimple_call_arg (gc, index);
3155 /* Return a pointer to the argument at position INDEX for call
3156 statement GS. */
3158 static inline tree *
3159 gimple_call_arg_ptr (gcall *gs, unsigned index)
3161 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3162 return &gs->op[index + 3];
3165 static inline tree *
3166 gimple_call_arg_ptr (gimple *gs, unsigned index)
3168 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3169 return gimple_call_arg_ptr (gc, index);
3173 /* Set ARG to be the argument at position INDEX for call statement GS. */
3175 static inline void
3176 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3178 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3179 gs->op[index + 3] = arg;
3182 static inline void
3183 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3185 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3186 gimple_call_set_arg (gc, index, arg);
3190 /* If TAIL_P is true, mark call statement S as being a tail call
3191 (i.e., a call just before the exit of a function). These calls are
3192 candidate for tail call optimization. */
3194 static inline void
3195 gimple_call_set_tail (gcall *s, bool tail_p)
3197 if (tail_p)
3198 s->subcode |= GF_CALL_TAILCALL;
3199 else
3200 s->subcode &= ~GF_CALL_TAILCALL;
3204 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3206 static inline bool
3207 gimple_call_tail_p (gcall *s)
3209 return (s->subcode & GF_CALL_TAILCALL) != 0;
3213 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3214 slot optimization. This transformation uses the target of the call
3215 expansion as the return slot for calls that return in memory. */
3217 static inline void
3218 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3220 if (return_slot_opt_p)
3221 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3222 else
3223 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3227 /* Return true if S is marked for return slot optimization. */
3229 static inline bool
3230 gimple_call_return_slot_opt_p (gcall *s)
3232 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3236 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3237 thunk to the thunked-to function. */
3239 static inline void
3240 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3242 if (from_thunk_p)
3243 s->subcode |= GF_CALL_FROM_THUNK;
3244 else
3245 s->subcode &= ~GF_CALL_FROM_THUNK;
3249 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3251 static inline bool
3252 gimple_call_from_thunk_p (gcall *s)
3254 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3258 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3259 argument pack in its argument list. */
3261 static inline void
3262 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3264 if (pass_arg_pack_p)
3265 s->subcode |= GF_CALL_VA_ARG_PACK;
3266 else
3267 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3271 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3272 argument pack in its argument list. */
3274 static inline bool
3275 gimple_call_va_arg_pack_p (gcall *s)
3277 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3281 /* Return true if S is a noreturn call. */
3283 static inline bool
3284 gimple_call_noreturn_p (const gcall *s)
3286 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3289 static inline bool
3290 gimple_call_noreturn_p (const gimple *s)
3292 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3293 return gimple_call_noreturn_p (gc);
3297 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3298 even if the called function can throw in other cases. */
3300 static inline void
3301 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3303 if (nothrow_p)
3304 s->subcode |= GF_CALL_NOTHROW;
3305 else
3306 s->subcode &= ~GF_CALL_NOTHROW;
3309 /* Return true if S is a nothrow call. */
3311 static inline bool
3312 gimple_call_nothrow_p (gcall *s)
3314 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3317 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3318 is known to be emitted for VLA objects. Those are wrapped by
3319 stack_save/stack_restore calls and hence can't lead to unbounded
3320 stack growth even when they occur in loops. */
3322 static inline void
3323 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3325 if (for_var)
3326 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3327 else
3328 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3331 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3333 static inline bool
3334 gimple_call_alloca_for_var_p (gcall *s)
3336 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3339 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3341 static inline void
3342 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3344 dest_call->subcode = orig_call->subcode;
3348 /* Return a pointer to the points-to solution for the set of call-used
3349 variables of the call CALL_STMT. */
3351 static inline struct pt_solution *
3352 gimple_call_use_set (gcall *call_stmt)
3354 return &call_stmt->call_used;
3358 /* Return a pointer to the points-to solution for the set of call-used
3359 variables of the call CALL_STMT. */
3361 static inline struct pt_solution *
3362 gimple_call_clobber_set (gcall *call_stmt)
3364 return &call_stmt->call_clobbered;
3368 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3369 non-NULL lhs. */
3371 static inline bool
3372 gimple_has_lhs (gimple *stmt)
3374 if (is_gimple_assign (stmt))
3375 return true;
3376 if (gcall *call = dyn_cast <gcall *> (stmt))
3377 return gimple_call_lhs (call) != NULL_TREE;
3378 return false;
3382 /* Return the code of the predicate computed by conditional statement GS. */
3384 static inline enum tree_code
3385 gimple_cond_code (const gcond *gs)
3387 return (enum tree_code) gs->subcode;
3390 static inline enum tree_code
3391 gimple_cond_code (const gimple *gs)
3393 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3394 return gimple_cond_code (gc);
3398 /* Set CODE to be the predicate code for the conditional statement GS. */
3400 static inline void
3401 gimple_cond_set_code (gcond *gs, enum tree_code code)
3403 gs->subcode = code;
3407 /* Return the LHS of the predicate computed by conditional statement GS. */
3409 static inline tree
3410 gimple_cond_lhs (const gcond *gs)
3412 return gs->op[0];
3415 static inline tree
3416 gimple_cond_lhs (const gimple *gs)
3418 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3419 return gimple_cond_lhs (gc);
3422 /* Return the pointer to the LHS of the predicate computed by conditional
3423 statement GS. */
3425 static inline tree *
3426 gimple_cond_lhs_ptr (gcond *gs)
3428 return &gs->op[0];
3431 /* Set LHS to be the LHS operand of the predicate computed by
3432 conditional statement GS. */
3434 static inline void
3435 gimple_cond_set_lhs (gcond *gs, tree lhs)
3437 gs->op[0] = lhs;
3441 /* Return the RHS operand of the predicate computed by conditional GS. */
3443 static inline tree
3444 gimple_cond_rhs (const gcond *gs)
3446 return gs->op[1];
3449 static inline tree
3450 gimple_cond_rhs (const gimple *gs)
3452 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3453 return gimple_cond_rhs (gc);
3456 /* Return the pointer to the RHS operand of the predicate computed by
3457 conditional GS. */
3459 static inline tree *
3460 gimple_cond_rhs_ptr (gcond *gs)
3462 return &gs->op[1];
3466 /* Set RHS to be the RHS operand of the predicate computed by
3467 conditional statement GS. */
3469 static inline void
3470 gimple_cond_set_rhs (gcond *gs, tree rhs)
3472 gs->op[1] = rhs;
3476 /* Return the label used by conditional statement GS when its
3477 predicate evaluates to true. */
3479 static inline tree
3480 gimple_cond_true_label (const gcond *gs)
3482 return gs->op[2];
3486 /* Set LABEL to be the label used by conditional statement GS when its
3487 predicate evaluates to true. */
3489 static inline void
3490 gimple_cond_set_true_label (gcond *gs, tree label)
3492 gs->op[2] = label;
3496 /* Set LABEL to be the label used by conditional statement GS when its
3497 predicate evaluates to false. */
3499 static inline void
3500 gimple_cond_set_false_label (gcond *gs, tree label)
3502 gs->op[3] = label;
3506 /* Return the label used by conditional statement GS when its
3507 predicate evaluates to false. */
3509 static inline tree
3510 gimple_cond_false_label (const gcond *gs)
3512 return gs->op[3];
3516 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3518 static inline void
3519 gimple_cond_make_false (gcond *gs)
3521 gimple_cond_set_lhs (gs, boolean_false_node);
3522 gimple_cond_set_rhs (gs, boolean_false_node);
3523 gs->subcode = NE_EXPR;
3527 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3529 static inline void
3530 gimple_cond_make_true (gcond *gs)
3532 gimple_cond_set_lhs (gs, boolean_true_node);
3533 gimple_cond_set_rhs (gs, boolean_false_node);
3534 gs->subcode = NE_EXPR;
3537 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3538 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3540 static inline bool
3541 gimple_cond_true_p (const gcond *gs)
3543 tree lhs = gimple_cond_lhs (gs);
3544 tree rhs = gimple_cond_rhs (gs);
3545 enum tree_code code = gimple_cond_code (gs);
3547 if (lhs != boolean_true_node && lhs != boolean_false_node)
3548 return false;
3550 if (rhs != boolean_true_node && rhs != boolean_false_node)
3551 return false;
3553 if (code == NE_EXPR && lhs != rhs)
3554 return true;
3556 if (code == EQ_EXPR && lhs == rhs)
3557 return true;
3559 return false;
3562 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3563 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3565 static inline bool
3566 gimple_cond_false_p (const gcond *gs)
3568 tree lhs = gimple_cond_lhs (gs);
3569 tree rhs = gimple_cond_rhs (gs);
3570 enum tree_code code = gimple_cond_code (gs);
3572 if (lhs != boolean_true_node && lhs != boolean_false_node)
3573 return false;
3575 if (rhs != boolean_true_node && rhs != boolean_false_node)
3576 return false;
3578 if (code == NE_EXPR && lhs == rhs)
3579 return true;
3581 if (code == EQ_EXPR && lhs != rhs)
3582 return true;
3584 return false;
3587 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3589 static inline void
3590 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3591 tree rhs)
3593 gimple_cond_set_code (stmt, code);
3594 gimple_cond_set_lhs (stmt, lhs);
3595 gimple_cond_set_rhs (stmt, rhs);
3598 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3600 static inline tree
3601 gimple_label_label (const glabel *gs)
3603 return gs->op[0];
3607 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3608 GS. */
3610 static inline void
3611 gimple_label_set_label (glabel *gs, tree label)
3613 gs->op[0] = label;
3617 /* Return the destination of the unconditional jump GS. */
3619 static inline tree
3620 gimple_goto_dest (const gimple *gs)
3622 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3623 return gimple_op (gs, 0);
3627 /* Set DEST to be the destination of the unconditonal jump GS. */
3629 static inline void
3630 gimple_goto_set_dest (ggoto *gs, tree dest)
3632 gs->op[0] = dest;
3636 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3638 static inline tree
3639 gimple_bind_vars (const gbind *bind_stmt)
3641 return bind_stmt->vars;
3645 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3646 statement GS. */
3648 static inline void
3649 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3651 bind_stmt->vars = vars;
3655 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3656 statement GS. */
3658 static inline void
3659 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3661 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3665 static inline gimple_seq *
3666 gimple_bind_body_ptr (gbind *bind_stmt)
3668 return &bind_stmt->body;
3671 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3673 static inline gimple_seq
3674 gimple_bind_body (gbind *gs)
3676 return *gimple_bind_body_ptr (gs);
3680 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3681 statement GS. */
3683 static inline void
3684 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3686 bind_stmt->body = seq;
3690 /* Append a statement to the end of a GIMPLE_BIND's body. */
3692 static inline void
3693 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3695 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3699 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3701 static inline void
3702 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3704 gimple_seq_add_seq (&bind_stmt->body, seq);
3708 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3709 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3711 static inline tree
3712 gimple_bind_block (const gbind *bind_stmt)
3714 return bind_stmt->block;
3718 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3719 statement GS. */
3721 static inline void
3722 gimple_bind_set_block (gbind *bind_stmt, tree block)
3724 gcc_gimple_checking_assert (block == NULL_TREE
3725 || TREE_CODE (block) == BLOCK);
3726 bind_stmt->block = block;
3730 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3732 static inline unsigned
3733 gimple_asm_ninputs (const gasm *asm_stmt)
3735 return asm_stmt->ni;
3739 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3741 static inline unsigned
3742 gimple_asm_noutputs (const gasm *asm_stmt)
3744 return asm_stmt->no;
3748 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3750 static inline unsigned
3751 gimple_asm_nclobbers (const gasm *asm_stmt)
3753 return asm_stmt->nc;
3756 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3758 static inline unsigned
3759 gimple_asm_nlabels (const gasm *asm_stmt)
3761 return asm_stmt->nl;
3764 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3766 static inline tree
3767 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3769 gcc_gimple_checking_assert (index < asm_stmt->ni);
3770 return asm_stmt->op[index + asm_stmt->no];
3773 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3775 static inline void
3776 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3778 gcc_gimple_checking_assert (index < asm_stmt->ni
3779 && TREE_CODE (in_op) == TREE_LIST);
3780 asm_stmt->op[index + asm_stmt->no] = in_op;
3784 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3786 static inline tree
3787 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3789 gcc_gimple_checking_assert (index < asm_stmt->no);
3790 return asm_stmt->op[index];
3793 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3795 static inline void
3796 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3798 gcc_gimple_checking_assert (index < asm_stmt->no
3799 && TREE_CODE (out_op) == TREE_LIST);
3800 asm_stmt->op[index] = out_op;
3804 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3806 static inline tree
3807 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3809 gcc_gimple_checking_assert (index < asm_stmt->nc);
3810 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3814 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3816 static inline void
3817 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3819 gcc_gimple_checking_assert (index < asm_stmt->nc
3820 && TREE_CODE (clobber_op) == TREE_LIST);
3821 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3824 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3826 static inline tree
3827 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3829 gcc_gimple_checking_assert (index < asm_stmt->nl);
3830 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3833 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3835 static inline void
3836 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3838 gcc_gimple_checking_assert (index < asm_stmt->nl
3839 && TREE_CODE (label_op) == TREE_LIST);
3840 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3843 /* Return the string representing the assembly instruction in
3844 GIMPLE_ASM ASM_STMT. */
3846 static inline const char *
3847 gimple_asm_string (const gasm *asm_stmt)
3849 return asm_stmt->string;
3853 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3855 static inline bool
3856 gimple_asm_volatile_p (const gasm *asm_stmt)
3858 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3862 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3864 static inline void
3865 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3867 if (volatile_p)
3868 asm_stmt->subcode |= GF_ASM_VOLATILE;
3869 else
3870 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3874 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3876 static inline void
3877 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3879 if (input_p)
3880 asm_stmt->subcode |= GF_ASM_INPUT;
3881 else
3882 asm_stmt->subcode &= ~GF_ASM_INPUT;
3886 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3888 static inline bool
3889 gimple_asm_input_p (const gasm *asm_stmt)
3891 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3895 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3897 static inline tree
3898 gimple_catch_types (const gcatch *catch_stmt)
3900 return catch_stmt->types;
3904 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3906 static inline tree *
3907 gimple_catch_types_ptr (gcatch *catch_stmt)
3909 return &catch_stmt->types;
3913 /* Return a pointer to the GIMPLE sequence representing the body of
3914 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3916 static inline gimple_seq *
3917 gimple_catch_handler_ptr (gcatch *catch_stmt)
3919 return &catch_stmt->handler;
3923 /* Return the GIMPLE sequence representing the body of the handler of
3924 GIMPLE_CATCH statement CATCH_STMT. */
3926 static inline gimple_seq
3927 gimple_catch_handler (gcatch *catch_stmt)
3929 return *gimple_catch_handler_ptr (catch_stmt);
3933 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3935 static inline void
3936 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3938 catch_stmt->types = t;
3942 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3944 static inline void
3945 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3947 catch_stmt->handler = handler;
3951 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3953 static inline tree
3954 gimple_eh_filter_types (const gimple *gs)
3956 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3957 return eh_filter_stmt->types;
3961 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3962 GS. */
3964 static inline tree *
3965 gimple_eh_filter_types_ptr (gimple *gs)
3967 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3968 return &eh_filter_stmt->types;
3972 /* Return a pointer to the sequence of statement to execute when
3973 GIMPLE_EH_FILTER statement fails. */
3975 static inline gimple_seq *
3976 gimple_eh_filter_failure_ptr (gimple *gs)
3978 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3979 return &eh_filter_stmt->failure;
3983 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3984 statement fails. */
3986 static inline gimple_seq
3987 gimple_eh_filter_failure (gimple *gs)
3989 return *gimple_eh_filter_failure_ptr (gs);
3993 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3994 EH_FILTER_STMT. */
3996 static inline void
3997 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3999 eh_filter_stmt->types = types;
4003 /* Set FAILURE to be the sequence of statements to execute on failure
4004 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4006 static inline void
4007 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4008 gimple_seq failure)
4010 eh_filter_stmt->failure = failure;
4013 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4015 static inline tree
4016 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4018 return eh_mnt_stmt->fndecl;
4021 /* Set the function decl to be called by GS to DECL. */
4023 static inline void
4024 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4025 tree decl)
4027 eh_mnt_stmt->fndecl = decl;
4030 /* GIMPLE_EH_ELSE accessors. */
4032 static inline gimple_seq *
4033 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4035 return &eh_else_stmt->n_body;
4038 static inline gimple_seq
4039 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4041 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4044 static inline gimple_seq *
4045 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4047 return &eh_else_stmt->e_body;
4050 static inline gimple_seq
4051 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4053 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4056 static inline void
4057 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4059 eh_else_stmt->n_body = seq;
4062 static inline void
4063 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4065 eh_else_stmt->e_body = seq;
4068 /* GIMPLE_TRY accessors. */
4070 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4071 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4073 static inline enum gimple_try_flags
4074 gimple_try_kind (const gimple *gs)
4076 GIMPLE_CHECK (gs, GIMPLE_TRY);
4077 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4081 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4083 static inline void
4084 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4086 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4087 || kind == GIMPLE_TRY_FINALLY);
4088 if (gimple_try_kind (gs) != kind)
4089 gs->subcode = (unsigned int) kind;
4093 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4095 static inline bool
4096 gimple_try_catch_is_cleanup (const gimple *gs)
4098 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4099 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4103 /* Return a pointer to the sequence of statements used as the
4104 body for GIMPLE_TRY GS. */
4106 static inline gimple_seq *
4107 gimple_try_eval_ptr (gimple *gs)
4109 gtry *try_stmt = as_a <gtry *> (gs);
4110 return &try_stmt->eval;
4114 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4116 static inline gimple_seq
4117 gimple_try_eval (gimple *gs)
4119 return *gimple_try_eval_ptr (gs);
4123 /* Return a pointer to the sequence of statements used as the cleanup body for
4124 GIMPLE_TRY GS. */
4126 static inline gimple_seq *
4127 gimple_try_cleanup_ptr (gimple *gs)
4129 gtry *try_stmt = as_a <gtry *> (gs);
4130 return &try_stmt->cleanup;
4134 /* Return the sequence of statements used as the cleanup body for
4135 GIMPLE_TRY GS. */
4137 static inline gimple_seq
4138 gimple_try_cleanup (gimple *gs)
4140 return *gimple_try_cleanup_ptr (gs);
4144 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4146 static inline void
4147 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4149 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4150 if (catch_is_cleanup)
4151 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4152 else
4153 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4157 /* Set EVAL to be the sequence of statements to use as the body for
4158 GIMPLE_TRY TRY_STMT. */
4160 static inline void
4161 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4163 try_stmt->eval = eval;
4167 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4168 body for GIMPLE_TRY TRY_STMT. */
4170 static inline void
4171 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4173 try_stmt->cleanup = cleanup;
4177 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4179 static inline gimple_seq *
4180 gimple_wce_cleanup_ptr (gimple *gs)
4182 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4183 return &wce_stmt->cleanup;
4187 /* Return the cleanup sequence for cleanup statement GS. */
4189 static inline gimple_seq
4190 gimple_wce_cleanup (gimple *gs)
4192 return *gimple_wce_cleanup_ptr (gs);
4196 /* Set CLEANUP to be the cleanup sequence for GS. */
4198 static inline void
4199 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4201 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4202 wce_stmt->cleanup = cleanup;
4206 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4208 static inline bool
4209 gimple_wce_cleanup_eh_only (const gimple *gs)
4211 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4212 return gs->subcode != 0;
4216 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4218 static inline void
4219 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4221 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4222 gs->subcode = (unsigned int) eh_only_p;
4226 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4228 static inline unsigned
4229 gimple_phi_capacity (const gimple *gs)
4231 const gphi *phi_stmt = as_a <const gphi *> (gs);
4232 return phi_stmt->capacity;
4236 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4237 be exactly the number of incoming edges for the basic block holding
4238 GS. */
4240 static inline unsigned
4241 gimple_phi_num_args (const gimple *gs)
4243 const gphi *phi_stmt = as_a <const gphi *> (gs);
4244 return phi_stmt->nargs;
4248 /* Return the SSA name created by GIMPLE_PHI GS. */
4250 static inline tree
4251 gimple_phi_result (const gimple *gs)
4253 const gphi *phi_stmt = as_a <const gphi *> (gs);
4254 return phi_stmt->result;
4257 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4259 static inline tree *
4260 gimple_phi_result_ptr (gimple *gs)
4262 gphi *phi_stmt = as_a <gphi *> (gs);
4263 return &phi_stmt->result;
4266 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4268 static inline void
4269 gimple_phi_set_result (gphi *phi, tree result)
4271 phi->result = result;
4272 if (result && TREE_CODE (result) == SSA_NAME)
4273 SSA_NAME_DEF_STMT (result) = phi;
4277 /* Return the PHI argument corresponding to incoming edge INDEX for
4278 GIMPLE_PHI GS. */
4280 static inline struct phi_arg_d *
4281 gimple_phi_arg (gimple *gs, unsigned index)
4283 gphi *phi_stmt = as_a <gphi *> (gs);
4284 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4285 return &(phi_stmt->args[index]);
4288 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4289 for GIMPLE_PHI PHI. */
4291 static inline void
4292 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4294 gcc_gimple_checking_assert (index <= phi->nargs);
4295 phi->args[index] = *phiarg;
4298 /* Return the PHI nodes for basic block BB, or NULL if there are no
4299 PHI nodes. */
4301 static inline gimple_seq
4302 phi_nodes (const_basic_block bb)
4304 gcc_checking_assert (!(bb->flags & BB_RTL));
4305 return bb->il.gimple.phi_nodes;
4308 /* Return a pointer to the PHI nodes for basic block BB. */
4310 static inline gimple_seq *
4311 phi_nodes_ptr (basic_block bb)
4313 gcc_checking_assert (!(bb->flags & BB_RTL));
4314 return &bb->il.gimple.phi_nodes;
4317 /* Return the tree operand for argument I of PHI node GS. */
4319 static inline tree
4320 gimple_phi_arg_def (gimple *gs, size_t index)
4322 return gimple_phi_arg (gs, index)->def;
4326 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4328 static inline tree *
4329 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4331 return &gimple_phi_arg (phi, index)->def;
4334 /* Return the edge associated with argument I of phi node PHI. */
4336 static inline edge
4337 gimple_phi_arg_edge (gphi *phi, size_t i)
4339 return EDGE_PRED (gimple_bb (phi), i);
4342 /* Return the source location of gimple argument I of phi node PHI. */
4344 static inline source_location
4345 gimple_phi_arg_location (gphi *phi, size_t i)
4347 return gimple_phi_arg (phi, i)->locus;
4350 /* Return the source location of the argument on edge E of phi node PHI. */
4352 static inline source_location
4353 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4355 return gimple_phi_arg (phi, e->dest_idx)->locus;
4358 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4360 static inline void
4361 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4363 gimple_phi_arg (phi, i)->locus = loc;
4366 /* Return TRUE if argument I of phi node PHI has a location record. */
4368 static inline bool
4369 gimple_phi_arg_has_location (gphi *phi, size_t i)
4371 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4375 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4377 static inline int
4378 gimple_resx_region (const gresx *resx_stmt)
4380 return resx_stmt->region;
4383 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4385 static inline void
4386 gimple_resx_set_region (gresx *resx_stmt, int region)
4388 resx_stmt->region = region;
4391 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4393 static inline int
4394 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4396 return eh_dispatch_stmt->region;
4399 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4400 EH_DISPATCH_STMT. */
4402 static inline void
4403 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4405 eh_dispatch_stmt->region = region;
4408 /* Return the number of labels associated with the switch statement GS. */
4410 static inline unsigned
4411 gimple_switch_num_labels (const gswitch *gs)
4413 unsigned num_ops;
4414 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4415 num_ops = gimple_num_ops (gs);
4416 gcc_gimple_checking_assert (num_ops > 1);
4417 return num_ops - 1;
4421 /* Set NLABELS to be the number of labels for the switch statement GS. */
4423 static inline void
4424 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4426 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4427 gimple_set_num_ops (g, nlabels + 1);
4431 /* Return the index variable used by the switch statement GS. */
4433 static inline tree
4434 gimple_switch_index (const gswitch *gs)
4436 return gs->op[0];
4440 /* Return a pointer to the index variable for the switch statement GS. */
4442 static inline tree *
4443 gimple_switch_index_ptr (gswitch *gs)
4445 return &gs->op[0];
4449 /* Set INDEX to be the index variable for switch statement GS. */
4451 static inline void
4452 gimple_switch_set_index (gswitch *gs, tree index)
4454 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4455 gs->op[0] = index;
4459 /* Return the label numbered INDEX. The default label is 0, followed by any
4460 labels in a switch statement. */
4462 static inline tree
4463 gimple_switch_label (const gswitch *gs, unsigned index)
4465 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4466 return gs->op[index + 1];
4469 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4471 static inline void
4472 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4474 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4475 && (label == NULL_TREE
4476 || TREE_CODE (label) == CASE_LABEL_EXPR));
4477 gs->op[index + 1] = label;
4480 /* Return the default label for a switch statement. */
4482 static inline tree
4483 gimple_switch_default_label (const gswitch *gs)
4485 tree label = gimple_switch_label (gs, 0);
4486 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4487 return label;
4490 /* Set the default label for a switch statement. */
4492 static inline void
4493 gimple_switch_set_default_label (gswitch *gs, tree label)
4495 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4496 gimple_switch_set_label (gs, 0, label);
4499 /* Return true if GS is a GIMPLE_DEBUG statement. */
4501 static inline bool
4502 is_gimple_debug (const gimple *gs)
4504 return gimple_code (gs) == GIMPLE_DEBUG;
4507 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4509 static inline bool
4510 gimple_debug_bind_p (const gimple *s)
4512 if (is_gimple_debug (s))
4513 return s->subcode == GIMPLE_DEBUG_BIND;
4515 return false;
4518 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4520 static inline tree
4521 gimple_debug_bind_get_var (gimple *dbg)
4523 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4524 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4525 return gimple_op (dbg, 0);
4528 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4529 statement. */
4531 static inline tree
4532 gimple_debug_bind_get_value (gimple *dbg)
4534 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4535 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4536 return gimple_op (dbg, 1);
4539 /* Return a pointer to the value bound to the variable in a
4540 GIMPLE_DEBUG bind statement. */
4542 static inline tree *
4543 gimple_debug_bind_get_value_ptr (gimple *dbg)
4545 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4546 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4547 return gimple_op_ptr (dbg, 1);
4550 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4552 static inline void
4553 gimple_debug_bind_set_var (gimple *dbg, tree var)
4555 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4556 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4557 gimple_set_op (dbg, 0, var);
4560 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4561 statement. */
4563 static inline void
4564 gimple_debug_bind_set_value (gimple *dbg, tree value)
4566 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4567 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4568 gimple_set_op (dbg, 1, value);
4571 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4572 optimized away. */
4573 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4575 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4576 statement. */
4578 static inline void
4579 gimple_debug_bind_reset_value (gimple *dbg)
4581 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4582 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4583 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4586 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4587 value. */
4589 static inline bool
4590 gimple_debug_bind_has_value_p (gimple *dbg)
4592 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4593 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4594 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4597 #undef GIMPLE_DEBUG_BIND_NOVALUE
4599 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4601 static inline bool
4602 gimple_debug_source_bind_p (const gimple *s)
4604 if (is_gimple_debug (s))
4605 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4607 return false;
4610 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4612 static inline tree
4613 gimple_debug_source_bind_get_var (gimple *dbg)
4615 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4616 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4617 return gimple_op (dbg, 0);
4620 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4621 statement. */
4623 static inline tree
4624 gimple_debug_source_bind_get_value (gimple *dbg)
4626 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4627 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4628 return gimple_op (dbg, 1);
4631 /* Return a pointer to the value bound to the variable in a
4632 GIMPLE_DEBUG source bind statement. */
4634 static inline tree *
4635 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4637 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4638 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4639 return gimple_op_ptr (dbg, 1);
4642 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4644 static inline void
4645 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4647 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4648 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4649 gimple_set_op (dbg, 0, var);
4652 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4653 statement. */
4655 static inline void
4656 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4658 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4659 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4660 gimple_set_op (dbg, 1, value);
4663 /* Return the line number for EXPR, or return -1 if we have no line
4664 number information for it. */
4665 static inline int
4666 get_lineno (const gimple *stmt)
4668 location_t loc;
4670 if (!stmt)
4671 return -1;
4673 loc = gimple_location (stmt);
4674 if (loc == UNKNOWN_LOCATION)
4675 return -1;
4677 return LOCATION_LINE (loc);
4680 /* Return a pointer to the body for the OMP statement GS. */
4682 static inline gimple_seq *
4683 gimple_omp_body_ptr (gimple *gs)
4685 return &static_cast <gimple_statement_omp *> (gs)->body;
4688 /* Return the body for the OMP statement GS. */
4690 static inline gimple_seq
4691 gimple_omp_body (gimple *gs)
4693 return *gimple_omp_body_ptr (gs);
4696 /* Set BODY to be the body for the OMP statement GS. */
4698 static inline void
4699 gimple_omp_set_body (gimple *gs, gimple_seq body)
4701 static_cast <gimple_statement_omp *> (gs)->body = body;
4705 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4707 static inline tree
4708 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4710 return crit_stmt->name;
4714 /* Return a pointer to the name associated with OMP critical statement
4715 CRIT_STMT. */
4717 static inline tree *
4718 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4720 return &crit_stmt->name;
4724 /* Set NAME to be the name associated with OMP critical statement
4725 CRIT_STMT. */
4727 static inline void
4728 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4730 crit_stmt->name = name;
4734 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4736 static inline tree
4737 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4739 return crit_stmt->clauses;
4743 /* Return a pointer to the clauses associated with OMP critical statement
4744 CRIT_STMT. */
4746 static inline tree *
4747 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4749 return &crit_stmt->clauses;
4753 /* Set CLAUSES to be the clauses associated with OMP critical statement
4754 CRIT_STMT. */
4756 static inline void
4757 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4759 crit_stmt->clauses = clauses;
4763 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4765 static inline tree
4766 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4768 return ord_stmt->clauses;
4772 /* Return a pointer to the clauses associated with OMP ordered statement
4773 ORD_STMT. */
4775 static inline tree *
4776 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4778 return &ord_stmt->clauses;
4782 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4783 ORD_STMT. */
4785 static inline void
4786 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4788 ord_stmt->clauses = clauses;
4792 /* Return the kind of the OMP_FOR statemement G. */
4794 static inline int
4795 gimple_omp_for_kind (const gimple *g)
4797 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4798 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4802 /* Set the kind of the OMP_FOR statement G. */
4804 static inline void
4805 gimple_omp_for_set_kind (gomp_for *g, int kind)
4807 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4808 | (kind & GF_OMP_FOR_KIND_MASK);
4812 /* Return true if OMP_FOR statement G has the
4813 GF_OMP_FOR_COMBINED flag set. */
4815 static inline bool
4816 gimple_omp_for_combined_p (const gimple *g)
4818 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4819 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4823 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4824 the boolean value of COMBINED_P. */
4826 static inline void
4827 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4829 if (combined_p)
4830 g->subcode |= GF_OMP_FOR_COMBINED;
4831 else
4832 g->subcode &= ~GF_OMP_FOR_COMBINED;
4836 /* Return true if the OMP_FOR statement G has the
4837 GF_OMP_FOR_COMBINED_INTO flag set. */
4839 static inline bool
4840 gimple_omp_for_combined_into_p (const gimple *g)
4842 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4843 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4847 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4848 on the boolean value of COMBINED_P. */
4850 static inline void
4851 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4853 if (combined_p)
4854 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4855 else
4856 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4860 /* Return the clauses associated with the OMP_FOR statement GS. */
4862 static inline tree
4863 gimple_omp_for_clauses (const gimple *gs)
4865 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4866 return omp_for_stmt->clauses;
4870 /* Return a pointer to the clauses associated with the OMP_FOR statement
4871 GS. */
4873 static inline tree *
4874 gimple_omp_for_clauses_ptr (gimple *gs)
4876 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4877 return &omp_for_stmt->clauses;
4881 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4882 GS. */
4884 static inline void
4885 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4887 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4888 omp_for_stmt->clauses = clauses;
4892 /* Get the collapse count of the OMP_FOR statement GS. */
4894 static inline size_t
4895 gimple_omp_for_collapse (gimple *gs)
4897 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4898 return omp_for_stmt->collapse;
4902 /* Return the condition code associated with the OMP_FOR statement GS. */
4904 static inline enum tree_code
4905 gimple_omp_for_cond (const gimple *gs, size_t i)
4907 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4908 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4909 return omp_for_stmt->iter[i].cond;
4913 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4915 static inline void
4916 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4918 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4919 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4920 && i < omp_for_stmt->collapse);
4921 omp_for_stmt->iter[i].cond = cond;
4925 /* Return the index variable for the OMP_FOR statement GS. */
4927 static inline tree
4928 gimple_omp_for_index (const gimple *gs, size_t i)
4930 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4931 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4932 return omp_for_stmt->iter[i].index;
4936 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4938 static inline tree *
4939 gimple_omp_for_index_ptr (gimple *gs, size_t i)
4941 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4942 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4943 return &omp_for_stmt->iter[i].index;
4947 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4949 static inline void
4950 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
4952 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4953 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4954 omp_for_stmt->iter[i].index = index;
4958 /* Return the initial value for the OMP_FOR statement GS. */
4960 static inline tree
4961 gimple_omp_for_initial (const gimple *gs, size_t i)
4963 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4964 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4965 return omp_for_stmt->iter[i].initial;
4969 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4971 static inline tree *
4972 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
4974 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4975 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4976 return &omp_for_stmt->iter[i].initial;
4980 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4982 static inline void
4983 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
4985 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4986 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4987 omp_for_stmt->iter[i].initial = initial;
4991 /* Return the final value for the OMP_FOR statement GS. */
4993 static inline tree
4994 gimple_omp_for_final (const gimple *gs, size_t i)
4996 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4997 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4998 return omp_for_stmt->iter[i].final;
5002 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5004 static inline tree *
5005 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5007 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5008 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5009 return &omp_for_stmt->iter[i].final;
5013 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5015 static inline void
5016 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5018 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5019 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5020 omp_for_stmt->iter[i].final = final;
5024 /* Return the increment value for the OMP_FOR statement GS. */
5026 static inline tree
5027 gimple_omp_for_incr (const gimple *gs, size_t i)
5029 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5030 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5031 return omp_for_stmt->iter[i].incr;
5035 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5037 static inline tree *
5038 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5040 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5041 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5042 return &omp_for_stmt->iter[i].incr;
5046 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5048 static inline void
5049 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5051 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5052 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5053 omp_for_stmt->iter[i].incr = incr;
5057 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5058 statement GS starts. */
5060 static inline gimple_seq *
5061 gimple_omp_for_pre_body_ptr (gimple *gs)
5063 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5064 return &omp_for_stmt->pre_body;
5068 /* Return the sequence of statements to execute before the OMP_FOR
5069 statement GS starts. */
5071 static inline gimple_seq
5072 gimple_omp_for_pre_body (gimple *gs)
5074 return *gimple_omp_for_pre_body_ptr (gs);
5078 /* Set PRE_BODY to be the sequence of statements to execute before the
5079 OMP_FOR statement GS starts. */
5081 static inline void
5082 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5084 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5085 omp_for_stmt->pre_body = pre_body;
5088 /* Return the kernel_phony of OMP_FOR statement. */
5090 static inline bool
5091 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5093 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5096 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5098 static inline void
5099 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5101 if (value)
5102 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5103 else
5104 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5107 /* Return the clauses associated with OMP_PARALLEL GS. */
5109 static inline tree
5110 gimple_omp_parallel_clauses (const gimple *gs)
5112 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5113 return omp_parallel_stmt->clauses;
5117 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5119 static inline tree *
5120 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5122 return &omp_parallel_stmt->clauses;
5126 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5128 static inline void
5129 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5130 tree clauses)
5132 omp_parallel_stmt->clauses = clauses;
5136 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5138 static inline tree
5139 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5141 return omp_parallel_stmt->child_fn;
5144 /* Return a pointer to the child function used to hold the body of
5145 OMP_PARALLEL_STMT. */
5147 static inline tree *
5148 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5150 return &omp_parallel_stmt->child_fn;
5154 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5156 static inline void
5157 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5158 tree child_fn)
5160 omp_parallel_stmt->child_fn = child_fn;
5164 /* Return the artificial argument used to send variables and values
5165 from the parent to the children threads in OMP_PARALLEL_STMT. */
5167 static inline tree
5168 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5170 return omp_parallel_stmt->data_arg;
5174 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5176 static inline tree *
5177 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5179 return &omp_parallel_stmt->data_arg;
5183 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5185 static inline void
5186 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5187 tree data_arg)
5189 omp_parallel_stmt->data_arg = data_arg;
5192 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5194 static inline bool
5195 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5197 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5200 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5202 static inline void
5203 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5205 if (value)
5206 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5207 else
5208 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5211 /* Return the clauses associated with OMP_TASK GS. */
5213 static inline tree
5214 gimple_omp_task_clauses (const gimple *gs)
5216 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5217 return omp_task_stmt->clauses;
5221 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5223 static inline tree *
5224 gimple_omp_task_clauses_ptr (gimple *gs)
5226 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5227 return &omp_task_stmt->clauses;
5231 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5232 GS. */
5234 static inline void
5235 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5237 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5238 omp_task_stmt->clauses = clauses;
5242 /* Return true if OMP task statement G has the
5243 GF_OMP_TASK_TASKLOOP flag set. */
5245 static inline bool
5246 gimple_omp_task_taskloop_p (const gimple *g)
5248 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5249 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5253 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5254 value of TASKLOOP_P. */
5256 static inline void
5257 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5259 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5260 if (taskloop_p)
5261 g->subcode |= GF_OMP_TASK_TASKLOOP;
5262 else
5263 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5267 /* Return the child function used to hold the body of OMP_TASK GS. */
5269 static inline tree
5270 gimple_omp_task_child_fn (const gimple *gs)
5272 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5273 return omp_task_stmt->child_fn;
5276 /* Return a pointer to the child function used to hold the body of
5277 OMP_TASK GS. */
5279 static inline tree *
5280 gimple_omp_task_child_fn_ptr (gimple *gs)
5282 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5283 return &omp_task_stmt->child_fn;
5287 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5289 static inline void
5290 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5292 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5293 omp_task_stmt->child_fn = child_fn;
5297 /* Return the artificial argument used to send variables and values
5298 from the parent to the children threads in OMP_TASK GS. */
5300 static inline tree
5301 gimple_omp_task_data_arg (const gimple *gs)
5303 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5304 return omp_task_stmt->data_arg;
5308 /* Return a pointer to the data argument for OMP_TASK GS. */
5310 static inline tree *
5311 gimple_omp_task_data_arg_ptr (gimple *gs)
5313 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5314 return &omp_task_stmt->data_arg;
5318 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5320 static inline void
5321 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5323 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5324 omp_task_stmt->data_arg = data_arg;
5328 /* Return the clauses associated with OMP_TASK GS. */
5330 static inline tree
5331 gimple_omp_taskreg_clauses (const gimple *gs)
5333 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5334 = as_a <const gimple_statement_omp_taskreg *> (gs);
5335 return omp_taskreg_stmt->clauses;
5339 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5341 static inline tree *
5342 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5344 gimple_statement_omp_taskreg *omp_taskreg_stmt
5345 = as_a <gimple_statement_omp_taskreg *> (gs);
5346 return &omp_taskreg_stmt->clauses;
5350 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5351 GS. */
5353 static inline void
5354 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5356 gimple_statement_omp_taskreg *omp_taskreg_stmt
5357 = as_a <gimple_statement_omp_taskreg *> (gs);
5358 omp_taskreg_stmt->clauses = clauses;
5362 /* Return the child function used to hold the body of OMP_TASK GS. */
5364 static inline tree
5365 gimple_omp_taskreg_child_fn (const gimple *gs)
5367 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5368 = as_a <const gimple_statement_omp_taskreg *> (gs);
5369 return omp_taskreg_stmt->child_fn;
5372 /* Return a pointer to the child function used to hold the body of
5373 OMP_TASK GS. */
5375 static inline tree *
5376 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5378 gimple_statement_omp_taskreg *omp_taskreg_stmt
5379 = as_a <gimple_statement_omp_taskreg *> (gs);
5380 return &omp_taskreg_stmt->child_fn;
5384 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5386 static inline void
5387 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5389 gimple_statement_omp_taskreg *omp_taskreg_stmt
5390 = as_a <gimple_statement_omp_taskreg *> (gs);
5391 omp_taskreg_stmt->child_fn = child_fn;
5395 /* Return the artificial argument used to send variables and values
5396 from the parent to the children threads in OMP_TASK GS. */
5398 static inline tree
5399 gimple_omp_taskreg_data_arg (const gimple *gs)
5401 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5402 = as_a <const gimple_statement_omp_taskreg *> (gs);
5403 return omp_taskreg_stmt->data_arg;
5407 /* Return a pointer to the data argument for OMP_TASK GS. */
5409 static inline tree *
5410 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5412 gimple_statement_omp_taskreg *omp_taskreg_stmt
5413 = as_a <gimple_statement_omp_taskreg *> (gs);
5414 return &omp_taskreg_stmt->data_arg;
5418 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5420 static inline void
5421 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5423 gimple_statement_omp_taskreg *omp_taskreg_stmt
5424 = as_a <gimple_statement_omp_taskreg *> (gs);
5425 omp_taskreg_stmt->data_arg = data_arg;
5429 /* Return the copy function used to hold the body of OMP_TASK GS. */
5431 static inline tree
5432 gimple_omp_task_copy_fn (const gimple *gs)
5434 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5435 return omp_task_stmt->copy_fn;
5438 /* Return a pointer to the copy function used to hold the body of
5439 OMP_TASK GS. */
5441 static inline tree *
5442 gimple_omp_task_copy_fn_ptr (gimple *gs)
5444 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5445 return &omp_task_stmt->copy_fn;
5449 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5451 static inline void
5452 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5454 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5455 omp_task_stmt->copy_fn = copy_fn;
5459 /* Return size of the data block in bytes in OMP_TASK GS. */
5461 static inline tree
5462 gimple_omp_task_arg_size (const gimple *gs)
5464 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5465 return omp_task_stmt->arg_size;
5469 /* Return a pointer to the data block size for OMP_TASK GS. */
5471 static inline tree *
5472 gimple_omp_task_arg_size_ptr (gimple *gs)
5474 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5475 return &omp_task_stmt->arg_size;
5479 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5481 static inline void
5482 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5484 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5485 omp_task_stmt->arg_size = arg_size;
5489 /* Return align of the data block in bytes in OMP_TASK GS. */
5491 static inline tree
5492 gimple_omp_task_arg_align (const gimple *gs)
5494 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5495 return omp_task_stmt->arg_align;
5499 /* Return a pointer to the data block align for OMP_TASK GS. */
5501 static inline tree *
5502 gimple_omp_task_arg_align_ptr (gimple *gs)
5504 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5505 return &omp_task_stmt->arg_align;
5509 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5511 static inline void
5512 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5514 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5515 omp_task_stmt->arg_align = arg_align;
5519 /* Return the clauses associated with OMP_SINGLE GS. */
5521 static inline tree
5522 gimple_omp_single_clauses (const gimple *gs)
5524 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5525 return omp_single_stmt->clauses;
5529 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5531 static inline tree *
5532 gimple_omp_single_clauses_ptr (gimple *gs)
5534 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5535 return &omp_single_stmt->clauses;
5539 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5541 static inline void
5542 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5544 omp_single_stmt->clauses = clauses;
5548 /* Return the clauses associated with OMP_TARGET GS. */
5550 static inline tree
5551 gimple_omp_target_clauses (const gimple *gs)
5553 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5554 return omp_target_stmt->clauses;
5558 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5560 static inline tree *
5561 gimple_omp_target_clauses_ptr (gimple *gs)
5563 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5564 return &omp_target_stmt->clauses;
5568 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5570 static inline void
5571 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5572 tree clauses)
5574 omp_target_stmt->clauses = clauses;
5578 /* Return the kind of the OMP_TARGET G. */
5580 static inline int
5581 gimple_omp_target_kind (const gimple *g)
5583 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5584 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5588 /* Set the kind of the OMP_TARGET G. */
5590 static inline void
5591 gimple_omp_target_set_kind (gomp_target *g, int kind)
5593 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5594 | (kind & GF_OMP_TARGET_KIND_MASK);
5598 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5600 static inline tree
5601 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5603 return omp_target_stmt->child_fn;
5606 /* Return a pointer to the child function used to hold the body of
5607 OMP_TARGET_STMT. */
5609 static inline tree *
5610 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5612 return &omp_target_stmt->child_fn;
5616 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5618 static inline void
5619 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5620 tree child_fn)
5622 omp_target_stmt->child_fn = child_fn;
5626 /* Return the artificial argument used to send variables and values
5627 from the parent to the children threads in OMP_TARGET_STMT. */
5629 static inline tree
5630 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5632 return omp_target_stmt->data_arg;
5636 /* Return a pointer to the data argument for OMP_TARGET GS. */
5638 static inline tree *
5639 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5641 return &omp_target_stmt->data_arg;
5645 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5647 static inline void
5648 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5649 tree data_arg)
5651 omp_target_stmt->data_arg = data_arg;
5655 /* Return the clauses associated with OMP_TEAMS GS. */
5657 static inline tree
5658 gimple_omp_teams_clauses (const gimple *gs)
5660 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5661 return omp_teams_stmt->clauses;
5665 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5667 static inline tree *
5668 gimple_omp_teams_clauses_ptr (gimple *gs)
5670 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5671 return &omp_teams_stmt->clauses;
5675 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5677 static inline void
5678 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5680 omp_teams_stmt->clauses = clauses;
5683 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5685 static inline bool
5686 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5688 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5691 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5693 static inline void
5694 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5696 if (value)
5697 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5698 else
5699 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5702 /* Return the clauses associated with OMP_SECTIONS GS. */
5704 static inline tree
5705 gimple_omp_sections_clauses (const gimple *gs)
5707 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5708 return omp_sections_stmt->clauses;
5712 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5714 static inline tree *
5715 gimple_omp_sections_clauses_ptr (gimple *gs)
5717 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5718 return &omp_sections_stmt->clauses;
5722 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5723 GS. */
5725 static inline void
5726 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5728 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5729 omp_sections_stmt->clauses = clauses;
5733 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5734 in GS. */
5736 static inline tree
5737 gimple_omp_sections_control (const gimple *gs)
5739 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5740 return omp_sections_stmt->control;
5744 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5745 GS. */
5747 static inline tree *
5748 gimple_omp_sections_control_ptr (gimple *gs)
5750 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5751 return &omp_sections_stmt->control;
5755 /* Set CONTROL to be the set of clauses associated with the
5756 GIMPLE_OMP_SECTIONS in GS. */
5758 static inline void
5759 gimple_omp_sections_set_control (gimple *gs, tree control)
5761 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5762 omp_sections_stmt->control = control;
5766 /* Set the value being stored in an atomic store. */
5768 static inline void
5769 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5771 store_stmt->val = val;
5775 /* Return the value being stored in an atomic store. */
5777 static inline tree
5778 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5780 return store_stmt->val;
5784 /* Return a pointer to the value being stored in an atomic store. */
5786 static inline tree *
5787 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5789 return &store_stmt->val;
5793 /* Set the LHS of an atomic load. */
5795 static inline void
5796 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5798 load_stmt->lhs = lhs;
5802 /* Get the LHS of an atomic load. */
5804 static inline tree
5805 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5807 return load_stmt->lhs;
5811 /* Return a pointer to the LHS of an atomic load. */
5813 static inline tree *
5814 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5816 return &load_stmt->lhs;
5820 /* Set the RHS of an atomic load. */
5822 static inline void
5823 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5825 load_stmt->rhs = rhs;
5829 /* Get the RHS of an atomic load. */
5831 static inline tree
5832 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5834 return load_stmt->rhs;
5838 /* Return a pointer to the RHS of an atomic load. */
5840 static inline tree *
5841 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5843 return &load_stmt->rhs;
5847 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5849 static inline tree
5850 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5852 return cont_stmt->control_def;
5855 /* The same as above, but return the address. */
5857 static inline tree *
5858 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5860 return &cont_stmt->control_def;
5863 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5865 static inline void
5866 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5868 cont_stmt->control_def = def;
5872 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5874 static inline tree
5875 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5877 return cont_stmt->control_use;
5881 /* The same as above, but return the address. */
5883 static inline tree *
5884 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5886 return &cont_stmt->control_use;
5890 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5892 static inline void
5893 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5895 cont_stmt->control_use = use;
5898 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5899 TRANSACTION_STMT. */
5901 static inline gimple_seq *
5902 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5904 return &transaction_stmt->body;
5907 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5909 static inline gimple_seq
5910 gimple_transaction_body (gtransaction *transaction_stmt)
5912 return transaction_stmt->body;
5915 /* Return the label associated with a GIMPLE_TRANSACTION. */
5917 static inline tree
5918 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
5920 return transaction_stmt->label_norm;
5923 static inline tree *
5924 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
5926 return &transaction_stmt->label_norm;
5929 static inline tree
5930 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
5932 return transaction_stmt->label_uninst;
5935 static inline tree *
5936 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
5938 return &transaction_stmt->label_uninst;
5941 static inline tree
5942 gimple_transaction_label_over (const gtransaction *transaction_stmt)
5944 return transaction_stmt->label_over;
5947 static inline tree *
5948 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
5950 return &transaction_stmt->label_over;
5953 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5955 static inline unsigned int
5956 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5958 return transaction_stmt->subcode;
5961 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5962 TRANSACTION_STMT. */
5964 static inline void
5965 gimple_transaction_set_body (gtransaction *transaction_stmt,
5966 gimple_seq body)
5968 transaction_stmt->body = body;
5971 /* Set the label associated with a GIMPLE_TRANSACTION. */
5973 static inline void
5974 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
5976 transaction_stmt->label_norm = label;
5979 static inline void
5980 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
5982 transaction_stmt->label_uninst = label;
5985 static inline void
5986 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
5988 transaction_stmt->label_over = label;
5991 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5993 static inline void
5994 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5995 unsigned int subcode)
5997 transaction_stmt->subcode = subcode;
6000 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6002 static inline tree *
6003 gimple_return_retval_ptr (greturn *gs)
6005 return &gs->op[0];
6008 /* Return the return value for GIMPLE_RETURN GS. */
6010 static inline tree
6011 gimple_return_retval (const greturn *gs)
6013 return gs->op[0];
6017 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6019 static inline void
6020 gimple_return_set_retval (greturn *gs, tree retval)
6022 gs->op[0] = retval;
6026 /* Return the return bounds for GIMPLE_RETURN GS. */
6028 static inline tree
6029 gimple_return_retbnd (const gimple *gs)
6031 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6032 return gimple_op (gs, 1);
6036 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6038 static inline void
6039 gimple_return_set_retbnd (gimple *gs, tree retval)
6041 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6042 gimple_set_op (gs, 1, retval);
6046 /* Returns true when the gimple statement STMT is any of the OMP types. */
6048 #define CASE_GIMPLE_OMP \
6049 case GIMPLE_OMP_PARALLEL: \
6050 case GIMPLE_OMP_TASK: \
6051 case GIMPLE_OMP_FOR: \
6052 case GIMPLE_OMP_SECTIONS: \
6053 case GIMPLE_OMP_SECTIONS_SWITCH: \
6054 case GIMPLE_OMP_SINGLE: \
6055 case GIMPLE_OMP_TARGET: \
6056 case GIMPLE_OMP_TEAMS: \
6057 case GIMPLE_OMP_SECTION: \
6058 case GIMPLE_OMP_MASTER: \
6059 case GIMPLE_OMP_TASKGROUP: \
6060 case GIMPLE_OMP_ORDERED: \
6061 case GIMPLE_OMP_CRITICAL: \
6062 case GIMPLE_OMP_RETURN: \
6063 case GIMPLE_OMP_ATOMIC_LOAD: \
6064 case GIMPLE_OMP_ATOMIC_STORE: \
6065 case GIMPLE_OMP_CONTINUE: \
6066 case GIMPLE_OMP_GRID_BODY
6068 static inline bool
6069 is_gimple_omp (const gimple *stmt)
6071 switch (gimple_code (stmt))
6073 CASE_GIMPLE_OMP:
6074 return true;
6075 default:
6076 return false;
6080 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6081 specifically. */
6083 static inline bool
6084 is_gimple_omp_oacc (const gimple *stmt)
6086 gcc_assert (is_gimple_omp (stmt));
6087 switch (gimple_code (stmt))
6089 case GIMPLE_OMP_FOR:
6090 switch (gimple_omp_for_kind (stmt))
6092 case GF_OMP_FOR_KIND_OACC_LOOP:
6093 return true;
6094 default:
6095 return false;
6097 case GIMPLE_OMP_TARGET:
6098 switch (gimple_omp_target_kind (stmt))
6100 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6101 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6102 case GF_OMP_TARGET_KIND_OACC_DATA:
6103 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6104 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6105 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6106 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6107 return true;
6108 default:
6109 return false;
6111 default:
6112 return false;
6117 /* Return true if the OMP gimple statement STMT is offloaded. */
6119 static inline bool
6120 is_gimple_omp_offloaded (const gimple *stmt)
6122 gcc_assert (is_gimple_omp (stmt));
6123 switch (gimple_code (stmt))
6125 case GIMPLE_OMP_TARGET:
6126 switch (gimple_omp_target_kind (stmt))
6128 case GF_OMP_TARGET_KIND_REGION:
6129 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6130 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6131 return true;
6132 default:
6133 return false;
6135 default:
6136 return false;
6141 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6143 static inline bool
6144 gimple_nop_p (const gimple *g)
6146 return gimple_code (g) == GIMPLE_NOP;
6150 /* Return true if GS is a GIMPLE_RESX. */
6152 static inline bool
6153 is_gimple_resx (const gimple *gs)
6155 return gimple_code (gs) == GIMPLE_RESX;
6158 /* Return the type of the main expression computed by STMT. Return
6159 void_type_node if the statement computes nothing. */
6161 static inline tree
6162 gimple_expr_type (const gimple *stmt)
6164 enum gimple_code code = gimple_code (stmt);
6165 /* In general we want to pass out a type that can be substituted
6166 for both the RHS and the LHS types if there is a possibly
6167 useless conversion involved. That means returning the
6168 original RHS type as far as we can reconstruct it. */
6169 if (code == GIMPLE_CALL)
6171 const gcall *call_stmt = as_a <const gcall *> (stmt);
6172 if (gimple_call_internal_p (call_stmt)
6173 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6174 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6175 else
6176 return gimple_call_return_type (call_stmt);
6178 else if (code == GIMPLE_ASSIGN)
6180 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6181 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6182 else
6183 /* As fallback use the type of the LHS. */
6184 return TREE_TYPE (gimple_get_lhs (stmt));
6186 else if (code == GIMPLE_COND)
6187 return boolean_type_node;
6188 else
6189 return void_type_node;
6192 /* Enum and arrays used for allocation stats. Keep in sync with
6193 gimple.c:gimple_alloc_kind_names. */
6194 enum gimple_alloc_kind
6196 gimple_alloc_kind_assign, /* Assignments. */
6197 gimple_alloc_kind_phi, /* PHI nodes. */
6198 gimple_alloc_kind_cond, /* Conditionals. */
6199 gimple_alloc_kind_rest, /* Everything else. */
6200 gimple_alloc_kind_all
6203 extern int gimple_alloc_counts[];
6204 extern int gimple_alloc_sizes[];
6206 /* Return the allocation kind for a given stmt CODE. */
6207 static inline enum gimple_alloc_kind
6208 gimple_alloc_kind (enum gimple_code code)
6210 switch (code)
6212 case GIMPLE_ASSIGN:
6213 return gimple_alloc_kind_assign;
6214 case GIMPLE_PHI:
6215 return gimple_alloc_kind_phi;
6216 case GIMPLE_COND:
6217 return gimple_alloc_kind_cond;
6218 default:
6219 return gimple_alloc_kind_rest;
6223 /* Return true if a location should not be emitted for this statement
6224 by annotate_all_with_location. */
6226 static inline bool
6227 gimple_do_not_emit_location_p (gimple *g)
6229 return gimple_plf (g, GF_PLF_1);
6232 /* Mark statement G so a location will not be emitted by
6233 annotate_one_with_location. */
6235 static inline void
6236 gimple_set_do_not_emit_location (gimple *g)
6238 /* The PLF flags are initialized to 0 when a new tuple is created,
6239 so no need to initialize it anywhere. */
6240 gimple_set_plf (g, GF_PLF_1, true);
6244 /* Macros for showing usage statistics. */
6245 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6246 ? (x) \
6247 : ((x) < 1024*1024*10 \
6248 ? (x) / 1024 \
6249 : (x) / (1024*1024))))
6251 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6253 #endif /* GCC_GIMPLE_H */