Clean up some minor white space issues in trans-decl.c and trans-expr.c
[official-gcc.git] / gcc / gimple.h
blobb30a9b8b4552384abb2f0f4adfe9625c69a4094a
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_TASK_TASKLOOP = 1 << 0,
150 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
151 GF_OMP_FOR_KIND_FOR = 0,
152 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
153 GF_OMP_FOR_KIND_TASKLOOP = 2,
154 GF_OMP_FOR_KIND_CILKFOR = 3,
155 GF_OMP_FOR_KIND_OACC_LOOP = 4,
156 /* Flag for SIMD variants of OMP_FOR kinds. */
157 GF_OMP_FOR_SIMD = 1 << 3,
158 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
159 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
160 GF_OMP_FOR_COMBINED = 1 << 4,
161 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
162 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
163 GF_OMP_TARGET_KIND_REGION = 0,
164 GF_OMP_TARGET_KIND_DATA = 1,
165 GF_OMP_TARGET_KIND_UPDATE = 2,
166 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
167 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
168 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
169 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
170 GF_OMP_TARGET_KIND_OACC_DATA = 7,
171 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
172 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
173 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
174 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
176 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
177 a thread synchronization via some sort of barrier. The exact barrier
178 that would otherwise be emitted is dependent on the OMP statement with
179 which this return is associated. */
180 GF_OMP_RETURN_NOWAIT = 1 << 0,
182 GF_OMP_SECTION_LAST = 1 << 0,
183 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
184 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
185 GF_PREDICT_TAKEN = 1 << 15
188 /* Currently, there are only two types of gimple debug stmt. Others are
189 envisioned, for example, to enable the generation of is_stmt notes
190 in line number information, to mark sequence points, etc. This
191 subcode is to be used to tell them apart. */
192 enum gimple_debug_subcode {
193 GIMPLE_DEBUG_BIND = 0,
194 GIMPLE_DEBUG_SOURCE_BIND = 1
197 /* Masks for selecting a pass local flag (PLF) to work on. These
198 masks are used by gimple_set_plf and gimple_plf. */
199 enum plf_mask {
200 GF_PLF_1 = 1 << 0,
201 GF_PLF_2 = 1 << 1
204 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
205 are for 64 bit hosts. */
207 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
208 chain_next ("%h.next"), variable_size))
209 gimple
211 /* [ WORD 1 ]
212 Main identifying code for a tuple. */
213 ENUM_BITFIELD(gimple_code) code : 8;
215 /* Nonzero if a warning should not be emitted on this tuple. */
216 unsigned int no_warning : 1;
218 /* Nonzero if this tuple has been visited. Passes are responsible
219 for clearing this bit before using it. */
220 unsigned int visited : 1;
222 /* Nonzero if this tuple represents a non-temporal move. */
223 unsigned int nontemporal_move : 1;
225 /* Pass local flags. These flags are free for any pass to use as
226 they see fit. Passes should not assume that these flags contain
227 any useful value when the pass starts. Any initial state that
228 the pass requires should be set on entry to the pass. See
229 gimple_set_plf and gimple_plf for usage. */
230 unsigned int plf : 2;
232 /* Nonzero if this statement has been modified and needs to have its
233 operands rescanned. */
234 unsigned modified : 1;
236 /* Nonzero if this statement contains volatile operands. */
237 unsigned has_volatile_ops : 1;
239 /* Padding to get subcode to 16 bit alignment. */
240 unsigned pad : 1;
242 /* The SUBCODE field can be used for tuple-specific flags for tuples
243 that do not require subcodes. Note that SUBCODE should be at
244 least as wide as tree codes, as several tuples store tree codes
245 in there. */
246 unsigned int subcode : 16;
248 /* UID of this statement. This is used by passes that want to
249 assign IDs to statements. It must be assigned and used by each
250 pass. By default it should be assumed to contain garbage. */
251 unsigned uid;
253 /* [ WORD 2 ]
254 Locus information for debug info. */
255 location_t location;
257 /* Number of operands in this tuple. */
258 unsigned num_ops;
260 /* [ WORD 3 ]
261 Basic block holding this statement. */
262 basic_block bb;
264 /* [ WORD 4-5 ]
265 Linked lists of gimple statements. The next pointers form
266 a NULL terminated list, the prev pointers are a cyclic list.
267 A gimple statement is hence also a double-ended list of
268 statements, with the pointer itself being the first element,
269 and the prev pointer being the last. */
270 gimple *next;
271 gimple *GTY((skip)) prev;
275 /* Base structure for tuples with operands. */
277 /* This gimple subclass has no tag value. */
278 struct GTY(())
279 gimple_statement_with_ops_base : public gimple
281 /* [ WORD 1-6 ] : base class */
283 /* [ WORD 7 ]
284 SSA operand vectors. NOTE: It should be possible to
285 amalgamate these vectors with the operand vector OP. However,
286 the SSA operand vectors are organized differently and contain
287 more information (like immediate use chaining). */
288 struct use_optype_d GTY((skip (""))) *use_ops;
292 /* Statements that take register operands. */
294 struct GTY((tag("GSS_WITH_OPS")))
295 gimple_statement_with_ops : public gimple_statement_with_ops_base
297 /* [ WORD 1-7 ] : base class */
299 /* [ WORD 8 ]
300 Operand vector. NOTE! This must always be the last field
301 of this structure. In particular, this means that this
302 structure cannot be embedded inside another one. */
303 tree GTY((length ("%h.num_ops"))) op[1];
307 /* Base for statements that take both memory and register operands. */
309 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
310 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
312 /* [ WORD 1-7 ] : base class */
314 /* [ WORD 8-9 ]
315 Virtual operands for this statement. The GC will pick them
316 up via the ssa_names array. */
317 tree GTY((skip (""))) vdef;
318 tree GTY((skip (""))) vuse;
322 /* Statements that take both memory and register operands. */
324 struct GTY((tag("GSS_WITH_MEM_OPS")))
325 gimple_statement_with_memory_ops :
326 public gimple_statement_with_memory_ops_base
328 /* [ WORD 1-9 ] : base class */
330 /* [ WORD 10 ]
331 Operand vector. NOTE! This must always be the last field
332 of this structure. In particular, this means that this
333 structure cannot be embedded inside another one. */
334 tree GTY((length ("%h.num_ops"))) op[1];
338 /* Call statements that take both memory and register operands. */
340 struct GTY((tag("GSS_CALL")))
341 gcall : public gimple_statement_with_memory_ops_base
343 /* [ WORD 1-9 ] : base class */
345 /* [ WORD 10-13 ] */
346 struct pt_solution call_used;
347 struct pt_solution call_clobbered;
349 /* [ WORD 14 ] */
350 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
351 tree GTY ((tag ("0"))) fntype;
352 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
353 } u;
355 /* [ WORD 15 ]
356 Operand vector. NOTE! This must always be the last field
357 of this structure. In particular, this means that this
358 structure cannot be embedded inside another one. */
359 tree GTY((length ("%h.num_ops"))) op[1];
361 static const enum gimple_code code_ = GIMPLE_CALL;
365 /* OMP statements. */
367 struct GTY((tag("GSS_OMP")))
368 gimple_statement_omp : public gimple
370 /* [ WORD 1-6 ] : base class */
372 /* [ WORD 7 ] */
373 gimple_seq body;
377 /* GIMPLE_BIND */
379 struct GTY((tag("GSS_BIND")))
380 gbind : public gimple
382 /* [ WORD 1-6 ] : base class */
384 /* [ WORD 7 ]
385 Variables declared in this scope. */
386 tree vars;
388 /* [ WORD 8 ]
389 This is different than the BLOCK field in gimple,
390 which is analogous to TREE_BLOCK (i.e., the lexical block holding
391 this statement). This field is the equivalent of BIND_EXPR_BLOCK
392 in tree land (i.e., the lexical scope defined by this bind). See
393 gimple-low.c. */
394 tree block;
396 /* [ WORD 9 ] */
397 gimple_seq body;
401 /* GIMPLE_CATCH */
403 struct GTY((tag("GSS_CATCH")))
404 gcatch : public gimple
406 /* [ WORD 1-6 ] : base class */
408 /* [ WORD 7 ] */
409 tree types;
411 /* [ WORD 8 ] */
412 gimple_seq handler;
416 /* GIMPLE_EH_FILTER */
418 struct GTY((tag("GSS_EH_FILTER")))
419 geh_filter : public gimple
421 /* [ WORD 1-6 ] : base class */
423 /* [ WORD 7 ]
424 Filter types. */
425 tree types;
427 /* [ WORD 8 ]
428 Failure actions. */
429 gimple_seq failure;
432 /* GIMPLE_EH_ELSE */
434 struct GTY((tag("GSS_EH_ELSE")))
435 geh_else : public gimple
437 /* [ WORD 1-6 ] : base class */
439 /* [ WORD 7,8 ] */
440 gimple_seq n_body, e_body;
443 /* GIMPLE_EH_MUST_NOT_THROW */
445 struct GTY((tag("GSS_EH_MNT")))
446 geh_mnt : public gimple
448 /* [ WORD 1-6 ] : base class */
450 /* [ WORD 7 ] Abort function decl. */
451 tree fndecl;
454 /* GIMPLE_PHI */
456 struct GTY((tag("GSS_PHI")))
457 gphi : public gimple
459 /* [ WORD 1-6 ] : base class */
461 /* [ WORD 7 ] */
462 unsigned capacity;
463 unsigned nargs;
465 /* [ WORD 8 ] */
466 tree result;
468 /* [ WORD 9 ] */
469 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
473 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
475 struct GTY((tag("GSS_EH_CTRL")))
476 gimple_statement_eh_ctrl : public gimple
478 /* [ WORD 1-6 ] : base class */
480 /* [ WORD 7 ]
481 Exception region number. */
482 int region;
485 struct GTY((tag("GSS_EH_CTRL")))
486 gresx : public gimple_statement_eh_ctrl
488 /* No extra fields; adds invariant:
489 stmt->code == GIMPLE_RESX. */
492 struct GTY((tag("GSS_EH_CTRL")))
493 geh_dispatch : public gimple_statement_eh_ctrl
495 /* No extra fields; adds invariant:
496 stmt->code == GIMPLE_EH_DISPATH. */
500 /* GIMPLE_TRY */
502 struct GTY((tag("GSS_TRY")))
503 gtry : public gimple
505 /* [ WORD 1-6 ] : base class */
507 /* [ WORD 7 ]
508 Expression to evaluate. */
509 gimple_seq eval;
511 /* [ WORD 8 ]
512 Cleanup expression. */
513 gimple_seq cleanup;
516 /* Kind of GIMPLE_TRY statements. */
517 enum gimple_try_flags
519 /* A try/catch. */
520 GIMPLE_TRY_CATCH = 1 << 0,
522 /* A try/finally. */
523 GIMPLE_TRY_FINALLY = 1 << 1,
524 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
526 /* Analogous to TRY_CATCH_IS_CLEANUP. */
527 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
530 /* GIMPLE_WITH_CLEANUP_EXPR */
532 struct GTY((tag("GSS_WCE")))
533 gimple_statement_wce : public gimple
535 /* [ WORD 1-6 ] : base class */
537 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
538 executed if an exception is thrown, not on normal exit of its
539 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
540 in TARGET_EXPRs. */
542 /* [ WORD 7 ]
543 Cleanup expression. */
544 gimple_seq cleanup;
548 /* GIMPLE_ASM */
550 struct GTY((tag("GSS_ASM")))
551 gasm : public gimple_statement_with_memory_ops_base
553 /* [ WORD 1-9 ] : base class */
555 /* [ WORD 10 ]
556 __asm__ statement. */
557 const char *string;
559 /* [ WORD 11 ]
560 Number of inputs, outputs, clobbers, labels. */
561 unsigned char ni;
562 unsigned char no;
563 unsigned char nc;
564 unsigned char nl;
566 /* [ WORD 12 ]
567 Operand vector. NOTE! This must always be the last field
568 of this structure. In particular, this means that this
569 structure cannot be embedded inside another one. */
570 tree GTY((length ("%h.num_ops"))) op[1];
573 /* GIMPLE_OMP_CRITICAL */
575 struct GTY((tag("GSS_OMP_CRITICAL")))
576 gomp_critical : public gimple_statement_omp
578 /* [ WORD 1-7 ] : base class */
580 /* [ WORD 8 ] */
581 tree clauses;
583 /* [ WORD 9 ]
584 Critical section name. */
585 tree name;
589 struct GTY(()) gimple_omp_for_iter {
590 /* Condition code. */
591 enum tree_code cond;
593 /* Index variable. */
594 tree index;
596 /* Initial value. */
597 tree initial;
599 /* Final value. */
600 tree final;
602 /* Increment. */
603 tree incr;
606 /* GIMPLE_OMP_FOR */
608 struct GTY((tag("GSS_OMP_FOR")))
609 gomp_for : public gimple_statement_omp
611 /* [ WORD 1-7 ] : base class */
613 /* [ WORD 8 ] */
614 tree clauses;
616 /* [ WORD 9 ]
617 Number of elements in iter array. */
618 size_t collapse;
620 /* [ WORD 10 ] */
621 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
623 /* [ WORD 11 ]
624 Pre-body evaluated before the loop body begins. */
625 gimple_seq pre_body;
629 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
631 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
632 gimple_statement_omp_parallel_layout : public gimple_statement_omp
634 /* [ WORD 1-7 ] : base class */
636 /* [ WORD 8 ]
637 Clauses. */
638 tree clauses;
640 /* [ WORD 9 ]
641 Child function holding the body of the parallel region. */
642 tree child_fn;
644 /* [ WORD 10 ]
645 Shared data argument. */
646 tree data_arg;
649 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
650 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
651 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
653 /* No extra fields; adds invariant:
654 stmt->code == GIMPLE_OMP_PARALLEL
655 || stmt->code == GIMPLE_OMP_TASK. */
658 /* GIMPLE_OMP_PARALLEL */
659 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
660 gomp_parallel : public gimple_statement_omp_taskreg
662 /* No extra fields; adds invariant:
663 stmt->code == GIMPLE_OMP_PARALLEL. */
666 /* GIMPLE_OMP_TARGET */
667 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
668 gomp_target : public gimple_statement_omp_parallel_layout
670 /* No extra fields; adds invariant:
671 stmt->code == GIMPLE_OMP_TARGET. */
674 /* GIMPLE_OMP_TASK */
676 struct GTY((tag("GSS_OMP_TASK")))
677 gomp_task : public gimple_statement_omp_taskreg
679 /* [ WORD 1-10 ] : base class */
681 /* [ WORD 11 ]
682 Child function holding firstprivate initialization if needed. */
683 tree copy_fn;
685 /* [ WORD 12-13 ]
686 Size and alignment in bytes of the argument data block. */
687 tree arg_size;
688 tree arg_align;
692 /* GIMPLE_OMP_SECTION */
693 /* Uses struct gimple_statement_omp. */
696 /* GIMPLE_OMP_SECTIONS */
698 struct GTY((tag("GSS_OMP_SECTIONS")))
699 gomp_sections : public gimple_statement_omp
701 /* [ WORD 1-7 ] : base class */
703 /* [ WORD 8 ] */
704 tree clauses;
706 /* [ WORD 9 ]
707 The control variable used for deciding which of the sections to
708 execute. */
709 tree control;
712 /* GIMPLE_OMP_CONTINUE.
714 Note: This does not inherit from gimple_statement_omp, because we
715 do not need the body field. */
717 struct GTY((tag("GSS_OMP_CONTINUE")))
718 gomp_continue : public gimple
720 /* [ WORD 1-6 ] : base class */
722 /* [ WORD 7 ] */
723 tree control_def;
725 /* [ WORD 8 ] */
726 tree control_use;
729 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
731 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
732 gimple_statement_omp_single_layout : public gimple_statement_omp
734 /* [ WORD 1-7 ] : base class */
736 /* [ WORD 7 ] */
737 tree clauses;
740 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
741 gomp_single : public gimple_statement_omp_single_layout
743 /* No extra fields; adds invariant:
744 stmt->code == GIMPLE_OMP_SINGLE. */
747 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
748 gomp_teams : public gimple_statement_omp_single_layout
750 /* No extra fields; adds invariant:
751 stmt->code == GIMPLE_OMP_TEAMS. */
754 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
755 gomp_ordered : public gimple_statement_omp_single_layout
757 /* No extra fields; adds invariant:
758 stmt->code == GIMPLE_OMP_ORDERED. */
762 /* GIMPLE_OMP_ATOMIC_LOAD.
763 Note: This is based on gimple, not g_s_omp, because g_s_omp
764 contains a sequence, which we don't need here. */
766 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
767 gomp_atomic_load : public gimple
769 /* [ WORD 1-6 ] : base class */
771 /* [ WORD 7-8 ] */
772 tree rhs, lhs;
775 /* GIMPLE_OMP_ATOMIC_STORE.
776 See note on GIMPLE_OMP_ATOMIC_LOAD. */
778 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
779 gimple_statement_omp_atomic_store_layout : public gimple
781 /* [ WORD 1-6 ] : base class */
783 /* [ WORD 7 ] */
784 tree val;
787 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
788 gomp_atomic_store :
789 public gimple_statement_omp_atomic_store_layout
791 /* No extra fields; adds invariant:
792 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
795 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
796 gimple_statement_omp_return :
797 public gimple_statement_omp_atomic_store_layout
799 /* No extra fields; adds invariant:
800 stmt->code == GIMPLE_OMP_RETURN. */
803 /* GIMPLE_TRANSACTION. */
805 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
807 /* The __transaction_atomic was declared [[outer]] or it is
808 __transaction_relaxed. */
809 #define GTMA_IS_OUTER (1u << 0)
810 #define GTMA_IS_RELAXED (1u << 1)
811 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
813 /* The transaction is seen to not have an abort. */
814 #define GTMA_HAVE_ABORT (1u << 2)
815 /* The transaction is seen to have loads or stores. */
816 #define GTMA_HAVE_LOAD (1u << 3)
817 #define GTMA_HAVE_STORE (1u << 4)
818 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
819 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
820 /* The transaction WILL enter serial irrevocable mode.
821 An irrevocable block post-dominates the entire transaction, such
822 that all invocations of the transaction will go serial-irrevocable.
823 In such case, we don't bother instrumenting the transaction, and
824 tell the runtime that it should begin the transaction in
825 serial-irrevocable mode. */
826 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
827 /* The transaction contains no instrumentation code whatsover, most
828 likely because it is guaranteed to go irrevocable upon entry. */
829 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
831 struct GTY((tag("GSS_TRANSACTION")))
832 gtransaction : public gimple_statement_with_memory_ops_base
834 /* [ WORD 1-9 ] : base class */
836 /* [ WORD 10 ] */
837 gimple_seq body;
839 /* [ WORD 11-13 ] */
840 tree label_norm;
841 tree label_uninst;
842 tree label_over;
845 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
846 enum gimple_statement_structure_enum {
847 #include "gsstruct.def"
848 LAST_GSS_ENUM
850 #undef DEFGSSTRUCT
852 /* A statement with the invariant that
853 stmt->code == GIMPLE_COND
854 i.e. a conditional jump statement. */
856 struct GTY((tag("GSS_WITH_OPS")))
857 gcond : public gimple_statement_with_ops
859 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
860 static const enum gimple_code code_ = GIMPLE_COND;
863 /* A statement with the invariant that
864 stmt->code == GIMPLE_DEBUG
865 i.e. a debug statement. */
867 struct GTY((tag("GSS_WITH_OPS")))
868 gdebug : public gimple_statement_with_ops
870 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
873 /* A statement with the invariant that
874 stmt->code == GIMPLE_GOTO
875 i.e. a goto statement. */
877 struct GTY((tag("GSS_WITH_OPS")))
878 ggoto : public gimple_statement_with_ops
880 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
883 /* A statement with the invariant that
884 stmt->code == GIMPLE_LABEL
885 i.e. a label statement. */
887 struct GTY((tag("GSS_WITH_OPS")))
888 glabel : public gimple_statement_with_ops
890 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
893 /* A statement with the invariant that
894 stmt->code == GIMPLE_SWITCH
895 i.e. a switch statement. */
897 struct GTY((tag("GSS_WITH_OPS")))
898 gswitch : public gimple_statement_with_ops
900 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
903 /* A statement with the invariant that
904 stmt->code == GIMPLE_ASSIGN
905 i.e. an assignment statement. */
907 struct GTY((tag("GSS_WITH_MEM_OPS")))
908 gassign : public gimple_statement_with_memory_ops
910 static const enum gimple_code code_ = GIMPLE_ASSIGN;
911 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
914 /* A statement with the invariant that
915 stmt->code == GIMPLE_RETURN
916 i.e. a return statement. */
918 struct GTY((tag("GSS_WITH_MEM_OPS")))
919 greturn : public gimple_statement_with_memory_ops
921 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
924 template <>
925 template <>
926 inline bool
927 is_a_helper <gasm *>::test (gimple *gs)
929 return gs->code == GIMPLE_ASM;
932 template <>
933 template <>
934 inline bool
935 is_a_helper <gassign *>::test (gimple *gs)
937 return gs->code == GIMPLE_ASSIGN;
940 template <>
941 template <>
942 inline bool
943 is_a_helper <const gassign *>::test (const gimple *gs)
945 return gs->code == GIMPLE_ASSIGN;
948 template <>
949 template <>
950 inline bool
951 is_a_helper <gbind *>::test (gimple *gs)
953 return gs->code == GIMPLE_BIND;
956 template <>
957 template <>
958 inline bool
959 is_a_helper <gcall *>::test (gimple *gs)
961 return gs->code == GIMPLE_CALL;
964 template <>
965 template <>
966 inline bool
967 is_a_helper <gcatch *>::test (gimple *gs)
969 return gs->code == GIMPLE_CATCH;
972 template <>
973 template <>
974 inline bool
975 is_a_helper <gcond *>::test (gimple *gs)
977 return gs->code == GIMPLE_COND;
980 template <>
981 template <>
982 inline bool
983 is_a_helper <const gcond *>::test (const gimple *gs)
985 return gs->code == GIMPLE_COND;
988 template <>
989 template <>
990 inline bool
991 is_a_helper <gdebug *>::test (gimple *gs)
993 return gs->code == GIMPLE_DEBUG;
996 template <>
997 template <>
998 inline bool
999 is_a_helper <ggoto *>::test (gimple *gs)
1001 return gs->code == GIMPLE_GOTO;
1004 template <>
1005 template <>
1006 inline bool
1007 is_a_helper <glabel *>::test (gimple *gs)
1009 return gs->code == GIMPLE_LABEL;
1012 template <>
1013 template <>
1014 inline bool
1015 is_a_helper <gresx *>::test (gimple *gs)
1017 return gs->code == GIMPLE_RESX;
1020 template <>
1021 template <>
1022 inline bool
1023 is_a_helper <geh_dispatch *>::test (gimple *gs)
1025 return gs->code == GIMPLE_EH_DISPATCH;
1028 template <>
1029 template <>
1030 inline bool
1031 is_a_helper <geh_else *>::test (gimple *gs)
1033 return gs->code == GIMPLE_EH_ELSE;
1036 template <>
1037 template <>
1038 inline bool
1039 is_a_helper <geh_filter *>::test (gimple *gs)
1041 return gs->code == GIMPLE_EH_FILTER;
1044 template <>
1045 template <>
1046 inline bool
1047 is_a_helper <geh_mnt *>::test (gimple *gs)
1049 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1052 template <>
1053 template <>
1054 inline bool
1055 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1057 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1060 template <>
1061 template <>
1062 inline bool
1063 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1065 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1068 template <>
1069 template <>
1070 inline bool
1071 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1073 return gs->code == GIMPLE_OMP_RETURN;
1076 template <>
1077 template <>
1078 inline bool
1079 is_a_helper <gomp_continue *>::test (gimple *gs)
1081 return gs->code == GIMPLE_OMP_CONTINUE;
1084 template <>
1085 template <>
1086 inline bool
1087 is_a_helper <gomp_critical *>::test (gimple *gs)
1089 return gs->code == GIMPLE_OMP_CRITICAL;
1092 template <>
1093 template <>
1094 inline bool
1095 is_a_helper <gomp_ordered *>::test (gimple *gs)
1097 return gs->code == GIMPLE_OMP_ORDERED;
1100 template <>
1101 template <>
1102 inline bool
1103 is_a_helper <gomp_for *>::test (gimple *gs)
1105 return gs->code == GIMPLE_OMP_FOR;
1108 template <>
1109 template <>
1110 inline bool
1111 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1113 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1116 template <>
1117 template <>
1118 inline bool
1119 is_a_helper <gomp_parallel *>::test (gimple *gs)
1121 return gs->code == GIMPLE_OMP_PARALLEL;
1124 template <>
1125 template <>
1126 inline bool
1127 is_a_helper <gomp_target *>::test (gimple *gs)
1129 return gs->code == GIMPLE_OMP_TARGET;
1132 template <>
1133 template <>
1134 inline bool
1135 is_a_helper <gomp_sections *>::test (gimple *gs)
1137 return gs->code == GIMPLE_OMP_SECTIONS;
1140 template <>
1141 template <>
1142 inline bool
1143 is_a_helper <gomp_single *>::test (gimple *gs)
1145 return gs->code == GIMPLE_OMP_SINGLE;
1148 template <>
1149 template <>
1150 inline bool
1151 is_a_helper <gomp_teams *>::test (gimple *gs)
1153 return gs->code == GIMPLE_OMP_TEAMS;
1156 template <>
1157 template <>
1158 inline bool
1159 is_a_helper <gomp_task *>::test (gimple *gs)
1161 return gs->code == GIMPLE_OMP_TASK;
1164 template <>
1165 template <>
1166 inline bool
1167 is_a_helper <gphi *>::test (gimple *gs)
1169 return gs->code == GIMPLE_PHI;
1172 template <>
1173 template <>
1174 inline bool
1175 is_a_helper <greturn *>::test (gimple *gs)
1177 return gs->code == GIMPLE_RETURN;
1180 template <>
1181 template <>
1182 inline bool
1183 is_a_helper <gswitch *>::test (gimple *gs)
1185 return gs->code == GIMPLE_SWITCH;
1188 template <>
1189 template <>
1190 inline bool
1191 is_a_helper <gtransaction *>::test (gimple *gs)
1193 return gs->code == GIMPLE_TRANSACTION;
1196 template <>
1197 template <>
1198 inline bool
1199 is_a_helper <gtry *>::test (gimple *gs)
1201 return gs->code == GIMPLE_TRY;
1204 template <>
1205 template <>
1206 inline bool
1207 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1209 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1212 template <>
1213 template <>
1214 inline bool
1215 is_a_helper <const gasm *>::test (const gimple *gs)
1217 return gs->code == GIMPLE_ASM;
1220 template <>
1221 template <>
1222 inline bool
1223 is_a_helper <const gbind *>::test (const gimple *gs)
1225 return gs->code == GIMPLE_BIND;
1228 template <>
1229 template <>
1230 inline bool
1231 is_a_helper <const gcall *>::test (const gimple *gs)
1233 return gs->code == GIMPLE_CALL;
1236 template <>
1237 template <>
1238 inline bool
1239 is_a_helper <const gcatch *>::test (const gimple *gs)
1241 return gs->code == GIMPLE_CATCH;
1244 template <>
1245 template <>
1246 inline bool
1247 is_a_helper <const gresx *>::test (const gimple *gs)
1249 return gs->code == GIMPLE_RESX;
1252 template <>
1253 template <>
1254 inline bool
1255 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1257 return gs->code == GIMPLE_EH_DISPATCH;
1260 template <>
1261 template <>
1262 inline bool
1263 is_a_helper <const geh_filter *>::test (const gimple *gs)
1265 return gs->code == GIMPLE_EH_FILTER;
1268 template <>
1269 template <>
1270 inline bool
1271 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1273 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1276 template <>
1277 template <>
1278 inline bool
1279 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1281 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1284 template <>
1285 template <>
1286 inline bool
1287 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1289 return gs->code == GIMPLE_OMP_RETURN;
1292 template <>
1293 template <>
1294 inline bool
1295 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1297 return gs->code == GIMPLE_OMP_CONTINUE;
1300 template <>
1301 template <>
1302 inline bool
1303 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1305 return gs->code == GIMPLE_OMP_CRITICAL;
1308 template <>
1309 template <>
1310 inline bool
1311 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1313 return gs->code == GIMPLE_OMP_ORDERED;
1316 template <>
1317 template <>
1318 inline bool
1319 is_a_helper <const gomp_for *>::test (const gimple *gs)
1321 return gs->code == GIMPLE_OMP_FOR;
1324 template <>
1325 template <>
1326 inline bool
1327 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1329 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1332 template <>
1333 template <>
1334 inline bool
1335 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1337 return gs->code == GIMPLE_OMP_PARALLEL;
1340 template <>
1341 template <>
1342 inline bool
1343 is_a_helper <const gomp_target *>::test (const gimple *gs)
1345 return gs->code == GIMPLE_OMP_TARGET;
1348 template <>
1349 template <>
1350 inline bool
1351 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1353 return gs->code == GIMPLE_OMP_SECTIONS;
1356 template <>
1357 template <>
1358 inline bool
1359 is_a_helper <const gomp_single *>::test (const gimple *gs)
1361 return gs->code == GIMPLE_OMP_SINGLE;
1364 template <>
1365 template <>
1366 inline bool
1367 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1369 return gs->code == GIMPLE_OMP_TEAMS;
1372 template <>
1373 template <>
1374 inline bool
1375 is_a_helper <const gomp_task *>::test (const gimple *gs)
1377 return gs->code == GIMPLE_OMP_TASK;
1380 template <>
1381 template <>
1382 inline bool
1383 is_a_helper <const gphi *>::test (const gimple *gs)
1385 return gs->code == GIMPLE_PHI;
1388 template <>
1389 template <>
1390 inline bool
1391 is_a_helper <const gtransaction *>::test (const gimple *gs)
1393 return gs->code == GIMPLE_TRANSACTION;
1396 /* Offset in bytes to the location of the operand vector.
1397 Zero if there is no operand vector for this tuple structure. */
1398 extern size_t const gimple_ops_offset_[];
1400 /* Map GIMPLE codes to GSS codes. */
1401 extern enum gimple_statement_structure_enum const gss_for_code_[];
1403 /* This variable holds the currently expanded gimple statement for purposes
1404 of comminucating the profile info to the builtin expanders. */
1405 extern gimple *currently_expanding_gimple_stmt;
1407 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1408 gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1409 greturn *gimple_build_return (tree);
1410 void gimple_call_reset_alias_info (gcall *);
1411 gcall *gimple_build_call_vec (tree, vec<tree> );
1412 gcall *gimple_build_call (tree, unsigned, ...);
1413 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1414 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1415 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1416 gcall *gimple_build_call_from_tree (tree);
1417 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1418 gassign *gimple_build_assign (tree, enum tree_code,
1419 tree, tree, tree CXX_MEM_STAT_INFO);
1420 gassign *gimple_build_assign (tree, enum tree_code,
1421 tree, tree CXX_MEM_STAT_INFO);
1422 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1423 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1424 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1425 void gimple_cond_set_condition_from_tree (gcond *, tree);
1426 glabel *gimple_build_label (tree label);
1427 ggoto *gimple_build_goto (tree dest);
1428 gimple *gimple_build_nop (void);
1429 gbind *gimple_build_bind (tree, gimple_seq, tree);
1430 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1431 vec<tree, va_gc> *, vec<tree, va_gc> *,
1432 vec<tree, va_gc> *);
1433 gcatch *gimple_build_catch (tree, gimple_seq);
1434 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1435 geh_mnt *gimple_build_eh_must_not_throw (tree);
1436 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1437 gtry *gimple_build_try (gimple_seq, gimple_seq,
1438 enum gimple_try_flags);
1439 gimple *gimple_build_wce (gimple_seq);
1440 gresx *gimple_build_resx (int);
1441 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1442 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1443 geh_dispatch *gimple_build_eh_dispatch (int);
1444 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1445 #define gimple_build_debug_bind(var,val,stmt) \
1446 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1447 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1448 #define gimple_build_debug_source_bind(var,val,stmt) \
1449 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1450 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1451 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1452 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1453 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1454 tree, tree);
1455 gimple *gimple_build_omp_section (gimple_seq);
1456 gimple *gimple_build_omp_master (gimple_seq);
1457 gimple *gimple_build_omp_taskgroup (gimple_seq);
1458 gomp_continue *gimple_build_omp_continue (tree, tree);
1459 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1460 gimple *gimple_build_omp_return (bool);
1461 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1462 gimple *gimple_build_omp_sections_switch (void);
1463 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1464 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1465 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1466 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1467 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1468 gtransaction *gimple_build_transaction (gimple_seq);
1469 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1470 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1471 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1472 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1473 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1474 location_t);
1475 extern void annotate_all_with_location (gimple_seq, location_t);
1476 bool empty_body_p (gimple_seq);
1477 gimple_seq gimple_seq_copy (gimple_seq);
1478 bool gimple_call_same_target_p (const gimple *, const gimple *);
1479 int gimple_call_flags (const gimple *);
1480 int gimple_call_arg_flags (const gcall *, unsigned);
1481 int gimple_call_return_flags (const gcall *);
1482 bool gimple_assign_copy_p (gimple *);
1483 bool gimple_assign_ssa_name_copy_p (gimple *);
1484 bool gimple_assign_unary_nop_p (gimple *);
1485 void gimple_set_bb (gimple *, basic_block);
1486 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1487 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1488 tree, tree, tree);
1489 tree gimple_get_lhs (const gimple *);
1490 void gimple_set_lhs (gimple *, tree);
1491 gimple *gimple_copy (gimple *);
1492 bool gimple_has_side_effects (const gimple *);
1493 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1494 bool gimple_could_trap_p (gimple *);
1495 bool gimple_assign_rhs_could_trap_p (gimple *);
1496 extern void dump_gimple_statistics (void);
1497 unsigned get_gimple_rhs_num_ops (enum tree_code);
1498 extern tree canonicalize_cond_expr_cond (tree);
1499 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1500 extern bool gimple_compare_field_offset (tree, tree);
1501 extern tree gimple_unsigned_type (tree);
1502 extern tree gimple_signed_type (tree);
1503 extern alias_set_type gimple_get_alias_set (tree);
1504 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1505 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1506 extern combined_fn gimple_call_combined_fn (const gimple *);
1507 extern bool gimple_call_builtin_p (const gimple *);
1508 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1509 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1510 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1511 extern void dump_decl_set (FILE *, bitmap);
1512 extern bool nonfreeing_call_p (gimple *);
1513 extern bool nonbarrier_call_p (gimple *);
1514 extern bool infer_nonnull_range (gimple *, tree);
1515 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1516 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1517 extern void sort_case_labels (vec<tree>);
1518 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1519 extern void gimple_seq_set_location (gimple_seq, location_t);
1520 extern void gimple_seq_discard (gimple_seq);
1521 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1523 /* Formal (expression) temporary table handling: multiple occurrences of
1524 the same scalar expression are evaluated into the same temporary. */
1526 typedef struct gimple_temp_hash_elt
1528 tree val; /* Key */
1529 tree temp; /* Value */
1530 } elt_t;
1532 /* Get the number of the next statement uid to be allocated. */
1533 static inline unsigned int
1534 gimple_stmt_max_uid (struct function *fn)
1536 return fn->last_stmt_uid;
1539 /* Set the number of the next statement uid to be allocated. */
1540 static inline void
1541 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1543 fn->last_stmt_uid = maxid;
1546 /* Set the number of the next statement uid to be allocated. */
1547 static inline unsigned int
1548 inc_gimple_stmt_max_uid (struct function *fn)
1550 return fn->last_stmt_uid++;
1553 /* Return the first node in GIMPLE sequence S. */
1555 static inline gimple_seq_node
1556 gimple_seq_first (gimple_seq s)
1558 return s;
1562 /* Return the first statement in GIMPLE sequence S. */
1564 static inline gimple *
1565 gimple_seq_first_stmt (gimple_seq s)
1567 gimple_seq_node n = gimple_seq_first (s);
1568 return n;
1571 /* Return the first statement in GIMPLE sequence S as a gbind *,
1572 verifying that it has code GIMPLE_BIND in a checked build. */
1574 static inline gbind *
1575 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1577 gimple_seq_node n = gimple_seq_first (s);
1578 return as_a <gbind *> (n);
1582 /* Return the last node in GIMPLE sequence S. */
1584 static inline gimple_seq_node
1585 gimple_seq_last (gimple_seq s)
1587 return s ? s->prev : NULL;
1591 /* Return the last statement in GIMPLE sequence S. */
1593 static inline gimple *
1594 gimple_seq_last_stmt (gimple_seq s)
1596 gimple_seq_node n = gimple_seq_last (s);
1597 return n;
1601 /* Set the last node in GIMPLE sequence *PS to LAST. */
1603 static inline void
1604 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1606 (*ps)->prev = last;
1610 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1612 static inline void
1613 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1615 *ps = first;
1619 /* Return true if GIMPLE sequence S is empty. */
1621 static inline bool
1622 gimple_seq_empty_p (gimple_seq s)
1624 return s == NULL;
1627 /* Allocate a new sequence and initialize its first element with STMT. */
1629 static inline gimple_seq
1630 gimple_seq_alloc_with_stmt (gimple *stmt)
1632 gimple_seq seq = NULL;
1633 gimple_seq_add_stmt (&seq, stmt);
1634 return seq;
1638 /* Returns the sequence of statements in BB. */
1640 static inline gimple_seq
1641 bb_seq (const_basic_block bb)
1643 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1646 static inline gimple_seq *
1647 bb_seq_addr (basic_block bb)
1649 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1652 /* Sets the sequence of statements in BB to SEQ. */
1654 static inline void
1655 set_bb_seq (basic_block bb, gimple_seq seq)
1657 gcc_checking_assert (!(bb->flags & BB_RTL));
1658 bb->il.gimple.seq = seq;
1662 /* Return the code for GIMPLE statement G. */
1664 static inline enum gimple_code
1665 gimple_code (const gimple *g)
1667 return g->code;
1671 /* Return the GSS code used by a GIMPLE code. */
1673 static inline enum gimple_statement_structure_enum
1674 gss_for_code (enum gimple_code code)
1676 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1677 return gss_for_code_[code];
1681 /* Return which GSS code is used by GS. */
1683 static inline enum gimple_statement_structure_enum
1684 gimple_statement_structure (gimple *gs)
1686 return gss_for_code (gimple_code (gs));
1690 /* Return true if statement G has sub-statements. This is only true for
1691 High GIMPLE statements. */
1693 static inline bool
1694 gimple_has_substatements (gimple *g)
1696 switch (gimple_code (g))
1698 case GIMPLE_BIND:
1699 case GIMPLE_CATCH:
1700 case GIMPLE_EH_FILTER:
1701 case GIMPLE_EH_ELSE:
1702 case GIMPLE_TRY:
1703 case GIMPLE_OMP_FOR:
1704 case GIMPLE_OMP_MASTER:
1705 case GIMPLE_OMP_TASKGROUP:
1706 case GIMPLE_OMP_ORDERED:
1707 case GIMPLE_OMP_SECTION:
1708 case GIMPLE_OMP_PARALLEL:
1709 case GIMPLE_OMP_TASK:
1710 case GIMPLE_OMP_SECTIONS:
1711 case GIMPLE_OMP_SINGLE:
1712 case GIMPLE_OMP_TARGET:
1713 case GIMPLE_OMP_TEAMS:
1714 case GIMPLE_OMP_CRITICAL:
1715 case GIMPLE_WITH_CLEANUP_EXPR:
1716 case GIMPLE_TRANSACTION:
1717 return true;
1719 default:
1720 return false;
1725 /* Return the basic block holding statement G. */
1727 static inline basic_block
1728 gimple_bb (const gimple *g)
1730 return g->bb;
1734 /* Return the lexical scope block holding statement G. */
1736 static inline tree
1737 gimple_block (const gimple *g)
1739 return LOCATION_BLOCK (g->location);
1743 /* Set BLOCK to be the lexical scope block holding statement G. */
1745 static inline void
1746 gimple_set_block (gimple *g, tree block)
1748 g->location = set_block (g->location, block);
1752 /* Return location information for statement G. */
1754 static inline location_t
1755 gimple_location (const gimple *g)
1757 return g->location;
1760 /* Return location information for statement G if g is not NULL.
1761 Otherwise, UNKNOWN_LOCATION is returned. */
1763 static inline location_t
1764 gimple_location_safe (const gimple *g)
1766 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1769 /* Set location information for statement G. */
1771 static inline void
1772 gimple_set_location (gimple *g, location_t location)
1774 g->location = location;
1778 /* Return true if G contains location information. */
1780 static inline bool
1781 gimple_has_location (const gimple *g)
1783 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1787 /* Return the file name of the location of STMT. */
1789 static inline const char *
1790 gimple_filename (const gimple *stmt)
1792 return LOCATION_FILE (gimple_location (stmt));
1796 /* Return the line number of the location of STMT. */
1798 static inline int
1799 gimple_lineno (const gimple *stmt)
1801 return LOCATION_LINE (gimple_location (stmt));
1805 /* Determine whether SEQ is a singleton. */
1807 static inline bool
1808 gimple_seq_singleton_p (gimple_seq seq)
1810 return ((gimple_seq_first (seq) != NULL)
1811 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1814 /* Return true if no warnings should be emitted for statement STMT. */
1816 static inline bool
1817 gimple_no_warning_p (const gimple *stmt)
1819 return stmt->no_warning;
1822 /* Set the no_warning flag of STMT to NO_WARNING. */
1824 static inline void
1825 gimple_set_no_warning (gimple *stmt, bool no_warning)
1827 stmt->no_warning = (unsigned) no_warning;
1830 /* Set the visited status on statement STMT to VISITED_P.
1832 Please note that this 'visited' property of the gimple statement is
1833 supposed to be undefined at pass boundaries. This means that a
1834 given pass should not assume it contains any useful value when the
1835 pass starts and thus can set it to any value it sees fit.
1837 You can learn more about the visited property of the gimple
1838 statement by reading the comments of the 'visited' data member of
1839 struct gimple.
1842 static inline void
1843 gimple_set_visited (gimple *stmt, bool visited_p)
1845 stmt->visited = (unsigned) visited_p;
1849 /* Return the visited status for statement STMT.
1851 Please note that this 'visited' property of the gimple statement is
1852 supposed to be undefined at pass boundaries. This means that a
1853 given pass should not assume it contains any useful value when the
1854 pass starts and thus can set it to any value it sees fit.
1856 You can learn more about the visited property of the gimple
1857 statement by reading the comments of the 'visited' data member of
1858 struct gimple. */
1860 static inline bool
1861 gimple_visited_p (gimple *stmt)
1863 return stmt->visited;
1867 /* Set pass local flag PLF on statement STMT to VAL_P.
1869 Please note that this PLF property of the gimple statement is
1870 supposed to be undefined at pass boundaries. This means that a
1871 given pass should not assume it contains any useful value when the
1872 pass starts and thus can set it to any value it sees fit.
1874 You can learn more about the PLF property by reading the comment of
1875 the 'plf' data member of struct gimple_statement_structure. */
1877 static inline void
1878 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1880 if (val_p)
1881 stmt->plf |= (unsigned int) plf;
1882 else
1883 stmt->plf &= ~((unsigned int) plf);
1887 /* Return the value of pass local flag PLF on statement STMT.
1889 Please note that this 'plf' property of the gimple statement is
1890 supposed to be undefined at pass boundaries. This means that a
1891 given pass should not assume it contains any useful value when the
1892 pass starts and thus can set it to any value it sees fit.
1894 You can learn more about the plf property by reading the comment of
1895 the 'plf' data member of struct gimple_statement_structure. */
1897 static inline unsigned int
1898 gimple_plf (gimple *stmt, enum plf_mask plf)
1900 return stmt->plf & ((unsigned int) plf);
1904 /* Set the UID of statement.
1906 Please note that this UID property is supposed to be undefined at
1907 pass boundaries. This means that a given pass should not assume it
1908 contains any useful value when the pass starts and thus can set it
1909 to any value it sees fit. */
1911 static inline void
1912 gimple_set_uid (gimple *g, unsigned uid)
1914 g->uid = uid;
1918 /* Return the UID of statement.
1920 Please note that this UID property is supposed to be undefined at
1921 pass boundaries. This means that a given pass should not assume it
1922 contains any useful value when the pass starts and thus can set it
1923 to any value it sees fit. */
1925 static inline unsigned
1926 gimple_uid (const gimple *g)
1928 return g->uid;
1932 /* Make statement G a singleton sequence. */
1934 static inline void
1935 gimple_init_singleton (gimple *g)
1937 g->next = NULL;
1938 g->prev = g;
1942 /* Return true if GIMPLE statement G has register or memory operands. */
1944 static inline bool
1945 gimple_has_ops (const gimple *g)
1947 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1950 template <>
1951 template <>
1952 inline bool
1953 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1955 return gimple_has_ops (gs);
1958 template <>
1959 template <>
1960 inline bool
1961 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1963 return gimple_has_ops (gs);
1966 /* Return true if GIMPLE statement G has memory operands. */
1968 static inline bool
1969 gimple_has_mem_ops (const gimple *g)
1971 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1974 template <>
1975 template <>
1976 inline bool
1977 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1979 return gimple_has_mem_ops (gs);
1982 template <>
1983 template <>
1984 inline bool
1985 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1987 return gimple_has_mem_ops (gs);
1990 /* Return the set of USE operands for statement G. */
1992 static inline struct use_optype_d *
1993 gimple_use_ops (const gimple *g)
1995 const gimple_statement_with_ops *ops_stmt =
1996 dyn_cast <const gimple_statement_with_ops *> (g);
1997 if (!ops_stmt)
1998 return NULL;
1999 return ops_stmt->use_ops;
2003 /* Set USE to be the set of USE operands for statement G. */
2005 static inline void
2006 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2008 gimple_statement_with_ops *ops_stmt =
2009 as_a <gimple_statement_with_ops *> (g);
2010 ops_stmt->use_ops = use;
2014 /* Return the single VUSE operand of the statement G. */
2016 static inline tree
2017 gimple_vuse (const gimple *g)
2019 const gimple_statement_with_memory_ops *mem_ops_stmt =
2020 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2021 if (!mem_ops_stmt)
2022 return NULL_TREE;
2023 return mem_ops_stmt->vuse;
2026 /* Return the single VDEF operand of the statement G. */
2028 static inline tree
2029 gimple_vdef (const gimple *g)
2031 const gimple_statement_with_memory_ops *mem_ops_stmt =
2032 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2033 if (!mem_ops_stmt)
2034 return NULL_TREE;
2035 return mem_ops_stmt->vdef;
2038 /* Return the single VUSE operand of the statement G. */
2040 static inline tree *
2041 gimple_vuse_ptr (gimple *g)
2043 gimple_statement_with_memory_ops *mem_ops_stmt =
2044 dyn_cast <gimple_statement_with_memory_ops *> (g);
2045 if (!mem_ops_stmt)
2046 return NULL;
2047 return &mem_ops_stmt->vuse;
2050 /* Return the single VDEF operand of the statement G. */
2052 static inline tree *
2053 gimple_vdef_ptr (gimple *g)
2055 gimple_statement_with_memory_ops *mem_ops_stmt =
2056 dyn_cast <gimple_statement_with_memory_ops *> (g);
2057 if (!mem_ops_stmt)
2058 return NULL;
2059 return &mem_ops_stmt->vdef;
2062 /* Set the single VUSE operand of the statement G. */
2064 static inline void
2065 gimple_set_vuse (gimple *g, tree vuse)
2067 gimple_statement_with_memory_ops *mem_ops_stmt =
2068 as_a <gimple_statement_with_memory_ops *> (g);
2069 mem_ops_stmt->vuse = vuse;
2072 /* Set the single VDEF operand of the statement G. */
2074 static inline void
2075 gimple_set_vdef (gimple *g, tree vdef)
2077 gimple_statement_with_memory_ops *mem_ops_stmt =
2078 as_a <gimple_statement_with_memory_ops *> (g);
2079 mem_ops_stmt->vdef = vdef;
2083 /* Return true if statement G has operands and the modified field has
2084 been set. */
2086 static inline bool
2087 gimple_modified_p (const gimple *g)
2089 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2093 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2094 a MODIFIED field. */
2096 static inline void
2097 gimple_set_modified (gimple *s, bool modifiedp)
2099 if (gimple_has_ops (s))
2100 s->modified = (unsigned) modifiedp;
2104 /* Return the tree code for the expression computed by STMT. This is
2105 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2106 GIMPLE_CALL, return CALL_EXPR as the expression code for
2107 consistency. This is useful when the caller needs to deal with the
2108 three kinds of computation that GIMPLE supports. */
2110 static inline enum tree_code
2111 gimple_expr_code (const gimple *stmt)
2113 enum gimple_code code = gimple_code (stmt);
2114 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2115 return (enum tree_code) stmt->subcode;
2116 else
2118 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2119 return CALL_EXPR;
2124 /* Return true if statement STMT contains volatile operands. */
2126 static inline bool
2127 gimple_has_volatile_ops (const gimple *stmt)
2129 if (gimple_has_mem_ops (stmt))
2130 return stmt->has_volatile_ops;
2131 else
2132 return false;
2136 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2138 static inline void
2139 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2141 if (gimple_has_mem_ops (stmt))
2142 stmt->has_volatile_ops = (unsigned) volatilep;
2145 /* Return true if STMT is in a transaction. */
2147 static inline bool
2148 gimple_in_transaction (const gimple *stmt)
2150 return bb_in_transaction (gimple_bb (stmt));
2153 /* Return true if statement STMT may access memory. */
2155 static inline bool
2156 gimple_references_memory_p (gimple *stmt)
2158 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2162 /* Return the subcode for OMP statement S. */
2164 static inline unsigned
2165 gimple_omp_subcode (const gimple *s)
2167 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2168 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2169 return s->subcode;
2172 /* Set the subcode for OMP statement S to SUBCODE. */
2174 static inline void
2175 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2177 /* We only have 16 bits for the subcode. Assert that we are not
2178 overflowing it. */
2179 gcc_gimple_checking_assert (subcode < (1 << 16));
2180 s->subcode = subcode;
2183 /* Set the nowait flag on OMP_RETURN statement S. */
2185 static inline void
2186 gimple_omp_return_set_nowait (gimple *s)
2188 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2189 s->subcode |= GF_OMP_RETURN_NOWAIT;
2193 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2194 flag set. */
2196 static inline bool
2197 gimple_omp_return_nowait_p (const gimple *g)
2199 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2200 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2204 /* Set the LHS of OMP return. */
2206 static inline void
2207 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2209 gimple_statement_omp_return *omp_return_stmt =
2210 as_a <gimple_statement_omp_return *> (g);
2211 omp_return_stmt->val = lhs;
2215 /* Get the LHS of OMP return. */
2217 static inline tree
2218 gimple_omp_return_lhs (const gimple *g)
2220 const gimple_statement_omp_return *omp_return_stmt =
2221 as_a <const gimple_statement_omp_return *> (g);
2222 return omp_return_stmt->val;
2226 /* Return a pointer to the LHS of OMP return. */
2228 static inline tree *
2229 gimple_omp_return_lhs_ptr (gimple *g)
2231 gimple_statement_omp_return *omp_return_stmt =
2232 as_a <gimple_statement_omp_return *> (g);
2233 return &omp_return_stmt->val;
2237 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2238 flag set. */
2240 static inline bool
2241 gimple_omp_section_last_p (const gimple *g)
2243 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2244 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2248 /* Set the GF_OMP_SECTION_LAST flag on G. */
2250 static inline void
2251 gimple_omp_section_set_last (gimple *g)
2253 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2254 g->subcode |= GF_OMP_SECTION_LAST;
2258 /* Return true if OMP parallel statement G has the
2259 GF_OMP_PARALLEL_COMBINED flag set. */
2261 static inline bool
2262 gimple_omp_parallel_combined_p (const gimple *g)
2264 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2265 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2269 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2270 value of COMBINED_P. */
2272 static inline void
2273 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2275 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2276 if (combined_p)
2277 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2278 else
2279 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2283 /* Return true if OMP atomic load/store statement G has the
2284 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2286 static inline bool
2287 gimple_omp_atomic_need_value_p (const gimple *g)
2289 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2290 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2291 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2295 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2297 static inline void
2298 gimple_omp_atomic_set_need_value (gimple *g)
2300 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2301 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2302 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2306 /* Return true if OMP atomic load/store statement G has the
2307 GF_OMP_ATOMIC_SEQ_CST flag set. */
2309 static inline bool
2310 gimple_omp_atomic_seq_cst_p (const gimple *g)
2312 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2313 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2314 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2318 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2320 static inline void
2321 gimple_omp_atomic_set_seq_cst (gimple *g)
2323 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2324 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2325 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2329 /* Return the number of operands for statement GS. */
2331 static inline unsigned
2332 gimple_num_ops (const gimple *gs)
2334 return gs->num_ops;
2338 /* Set the number of operands for statement GS. */
2340 static inline void
2341 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2343 gs->num_ops = num_ops;
2347 /* Return the array of operands for statement GS. */
2349 static inline tree *
2350 gimple_ops (gimple *gs)
2352 size_t off;
2354 /* All the tuples have their operand vector at the very bottom
2355 of the structure. Note that those structures that do not
2356 have an operand vector have a zero offset. */
2357 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2358 gcc_gimple_checking_assert (off != 0);
2360 return (tree *) ((char *) gs + off);
2364 /* Return operand I for statement GS. */
2366 static inline tree
2367 gimple_op (const gimple *gs, unsigned i)
2369 if (gimple_has_ops (gs))
2371 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2372 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2374 else
2375 return NULL_TREE;
2378 /* Return a pointer to operand I for statement GS. */
2380 static inline tree *
2381 gimple_op_ptr (gimple *gs, unsigned i)
2383 if (gimple_has_ops (gs))
2385 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2386 return gimple_ops (gs) + i;
2388 else
2389 return NULL;
2392 /* Set operand I of statement GS to OP. */
2394 static inline void
2395 gimple_set_op (gimple *gs, unsigned i, tree op)
2397 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2399 /* Note. It may be tempting to assert that OP matches
2400 is_gimple_operand, but that would be wrong. Different tuples
2401 accept slightly different sets of tree operands. Each caller
2402 should perform its own validation. */
2403 gimple_ops (gs)[i] = op;
2406 /* Return true if GS is a GIMPLE_ASSIGN. */
2408 static inline bool
2409 is_gimple_assign (const gimple *gs)
2411 return gimple_code (gs) == GIMPLE_ASSIGN;
2414 /* Determine if expression CODE is one of the valid expressions that can
2415 be used on the RHS of GIMPLE assignments. */
2417 static inline enum gimple_rhs_class
2418 get_gimple_rhs_class (enum tree_code code)
2420 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2423 /* Return the LHS of assignment statement GS. */
2425 static inline tree
2426 gimple_assign_lhs (const gassign *gs)
2428 return gs->op[0];
2431 static inline tree
2432 gimple_assign_lhs (const gimple *gs)
2434 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2435 return gimple_assign_lhs (ass);
2439 /* Return a pointer to the LHS of assignment statement GS. */
2441 static inline tree *
2442 gimple_assign_lhs_ptr (gassign *gs)
2444 return &gs->op[0];
2447 static inline tree *
2448 gimple_assign_lhs_ptr (gimple *gs)
2450 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2451 return gimple_assign_lhs_ptr (ass);
2455 /* Set LHS to be the LHS operand of assignment statement GS. */
2457 static inline void
2458 gimple_assign_set_lhs (gassign *gs, tree lhs)
2460 gs->op[0] = lhs;
2462 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2463 SSA_NAME_DEF_STMT (lhs) = gs;
2466 static inline void
2467 gimple_assign_set_lhs (gimple *gs, tree lhs)
2469 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2470 gimple_assign_set_lhs (ass, lhs);
2474 /* Return the first operand on the RHS of assignment statement GS. */
2476 static inline tree
2477 gimple_assign_rhs1 (const gassign *gs)
2479 return gs->op[1];
2482 static inline tree
2483 gimple_assign_rhs1 (const gimple *gs)
2485 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2486 return gimple_assign_rhs1 (ass);
2490 /* Return a pointer to the first operand on the RHS of assignment
2491 statement GS. */
2493 static inline tree *
2494 gimple_assign_rhs1_ptr (gassign *gs)
2496 return &gs->op[1];
2499 static inline tree *
2500 gimple_assign_rhs1_ptr (gimple *gs)
2502 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2503 return gimple_assign_rhs1_ptr (ass);
2506 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2508 static inline void
2509 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2511 gs->op[1] = rhs;
2514 static inline void
2515 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2517 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2518 gimple_assign_set_rhs1 (ass, rhs);
2522 /* Return the second operand on the RHS of assignment statement GS.
2523 If GS does not have two operands, NULL is returned instead. */
2525 static inline tree
2526 gimple_assign_rhs2 (const gassign *gs)
2528 if (gimple_num_ops (gs) >= 3)
2529 return gs->op[2];
2530 else
2531 return NULL_TREE;
2534 static inline tree
2535 gimple_assign_rhs2 (const gimple *gs)
2537 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2538 return gimple_assign_rhs2 (ass);
2542 /* Return a pointer to the second operand on the RHS of assignment
2543 statement GS. */
2545 static inline tree *
2546 gimple_assign_rhs2_ptr (gassign *gs)
2548 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2549 return &gs->op[2];
2552 static inline tree *
2553 gimple_assign_rhs2_ptr (gimple *gs)
2555 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2556 return gimple_assign_rhs2_ptr (ass);
2560 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2562 static inline void
2563 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2565 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2566 gs->op[2] = rhs;
2569 static inline void
2570 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2572 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2573 return gimple_assign_set_rhs2 (ass, rhs);
2576 /* Return the third operand on the RHS of assignment statement GS.
2577 If GS does not have two operands, NULL is returned instead. */
2579 static inline tree
2580 gimple_assign_rhs3 (const gassign *gs)
2582 if (gimple_num_ops (gs) >= 4)
2583 return gs->op[3];
2584 else
2585 return NULL_TREE;
2588 static inline tree
2589 gimple_assign_rhs3 (const gimple *gs)
2591 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2592 return gimple_assign_rhs3 (ass);
2595 /* Return a pointer to the third operand on the RHS of assignment
2596 statement GS. */
2598 static inline tree *
2599 gimple_assign_rhs3_ptr (gimple *gs)
2601 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2602 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2603 return &ass->op[3];
2607 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2609 static inline void
2610 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2612 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2613 gs->op[3] = rhs;
2616 static inline void
2617 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2619 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2620 gimple_assign_set_rhs3 (ass, rhs);
2624 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2625 which expect to see only two operands. */
2627 static inline void
2628 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2629 tree op1, tree op2)
2631 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2634 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2635 which expect to see only one operands. */
2637 static inline void
2638 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2639 tree op1)
2641 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2644 /* Returns true if GS is a nontemporal move. */
2646 static inline bool
2647 gimple_assign_nontemporal_move_p (const gassign *gs)
2649 return gs->nontemporal_move;
2652 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2654 static inline void
2655 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2657 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2658 gs->nontemporal_move = nontemporal;
2662 /* Return the code of the expression computed on the rhs of assignment
2663 statement GS. In case that the RHS is a single object, returns the
2664 tree code of the object. */
2666 static inline enum tree_code
2667 gimple_assign_rhs_code (const gassign *gs)
2669 enum tree_code code = (enum tree_code) gs->subcode;
2670 /* While we initially set subcode to the TREE_CODE of the rhs for
2671 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2672 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2673 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2674 code = TREE_CODE (gs->op[1]);
2676 return code;
2679 static inline enum tree_code
2680 gimple_assign_rhs_code (const gimple *gs)
2682 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2683 return gimple_assign_rhs_code (ass);
2687 /* Set CODE to be the code for the expression computed on the RHS of
2688 assignment S. */
2690 static inline void
2691 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2693 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2694 s->subcode = code;
2698 /* Return the gimple rhs class of the code of the expression computed on
2699 the rhs of assignment statement GS.
2700 This will never return GIMPLE_INVALID_RHS. */
2702 static inline enum gimple_rhs_class
2703 gimple_assign_rhs_class (const gimple *gs)
2705 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2708 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2709 there is no operator associated with the assignment itself.
2710 Unlike gimple_assign_copy_p, this predicate returns true for
2711 any RHS operand, including those that perform an operation
2712 and do not have the semantics of a copy, such as COND_EXPR. */
2714 static inline bool
2715 gimple_assign_single_p (const gimple *gs)
2717 return (is_gimple_assign (gs)
2718 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2721 /* Return true if GS performs a store to its lhs. */
2723 static inline bool
2724 gimple_store_p (const gimple *gs)
2726 tree lhs = gimple_get_lhs (gs);
2727 return lhs && !is_gimple_reg (lhs);
2730 /* Return true if GS is an assignment that loads from its rhs1. */
2732 static inline bool
2733 gimple_assign_load_p (const gimple *gs)
2735 tree rhs;
2736 if (!gimple_assign_single_p (gs))
2737 return false;
2738 rhs = gimple_assign_rhs1 (gs);
2739 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2740 return true;
2741 rhs = get_base_address (rhs);
2742 return (DECL_P (rhs)
2743 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2747 /* Return true if S is a type-cast assignment. */
2749 static inline bool
2750 gimple_assign_cast_p (const gimple *s)
2752 if (is_gimple_assign (s))
2754 enum tree_code sc = gimple_assign_rhs_code (s);
2755 return CONVERT_EXPR_CODE_P (sc)
2756 || sc == VIEW_CONVERT_EXPR
2757 || sc == FIX_TRUNC_EXPR;
2760 return false;
2763 /* Return true if S is a clobber statement. */
2765 static inline bool
2766 gimple_clobber_p (const gimple *s)
2768 return gimple_assign_single_p (s)
2769 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2772 /* Return true if GS is a GIMPLE_CALL. */
2774 static inline bool
2775 is_gimple_call (const gimple *gs)
2777 return gimple_code (gs) == GIMPLE_CALL;
2780 /* Return the LHS of call statement GS. */
2782 static inline tree
2783 gimple_call_lhs (const gcall *gs)
2785 return gs->op[0];
2788 static inline tree
2789 gimple_call_lhs (const gimple *gs)
2791 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2792 return gimple_call_lhs (gc);
2796 /* Return a pointer to the LHS of call statement GS. */
2798 static inline tree *
2799 gimple_call_lhs_ptr (gcall *gs)
2801 return &gs->op[0];
2804 static inline tree *
2805 gimple_call_lhs_ptr (gimple *gs)
2807 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2808 return gimple_call_lhs_ptr (gc);
2812 /* Set LHS to be the LHS operand of call statement GS. */
2814 static inline void
2815 gimple_call_set_lhs (gcall *gs, tree lhs)
2817 gs->op[0] = lhs;
2818 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2819 SSA_NAME_DEF_STMT (lhs) = gs;
2822 static inline void
2823 gimple_call_set_lhs (gimple *gs, tree lhs)
2825 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2826 gimple_call_set_lhs (gc, lhs);
2830 /* Return true if call GS calls an internal-only function, as enumerated
2831 by internal_fn. */
2833 static inline bool
2834 gimple_call_internal_p (const gcall *gs)
2836 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2839 static inline bool
2840 gimple_call_internal_p (const gimple *gs)
2842 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2843 return gimple_call_internal_p (gc);
2847 /* Return true if call GS is marked as instrumented by
2848 Pointer Bounds Checker. */
2850 static inline bool
2851 gimple_call_with_bounds_p (const gcall *gs)
2853 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2856 static inline bool
2857 gimple_call_with_bounds_p (const gimple *gs)
2859 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2860 return gimple_call_with_bounds_p (gc);
2864 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2865 Pointer Bounds Checker. */
2867 static inline void
2868 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2870 if (with_bounds)
2871 gs->subcode |= GF_CALL_WITH_BOUNDS;
2872 else
2873 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2876 static inline void
2877 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2879 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2880 gimple_call_set_with_bounds (gc, with_bounds);
2884 /* Return the target of internal call GS. */
2886 static inline enum internal_fn
2887 gimple_call_internal_fn (const gcall *gs)
2889 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2890 return gs->u.internal_fn;
2893 static inline enum internal_fn
2894 gimple_call_internal_fn (const gimple *gs)
2896 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2897 return gimple_call_internal_fn (gc);
2900 /* Return true, if this internal gimple call is unique. */
2902 static inline bool
2903 gimple_call_internal_unique_p (const gcall *gs)
2905 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2908 static inline bool
2909 gimple_call_internal_unique_p (const gimple *gs)
2911 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2912 return gimple_call_internal_unique_p (gc);
2915 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2916 that could alter control flow. */
2918 static inline void
2919 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2921 if (ctrl_altering_p)
2922 s->subcode |= GF_CALL_CTRL_ALTERING;
2923 else
2924 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2927 static inline void
2928 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2930 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2931 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2934 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2935 flag is set. Such call could not be a stmt in the middle of a bb. */
2937 static inline bool
2938 gimple_call_ctrl_altering_p (const gcall *gs)
2940 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2943 static inline bool
2944 gimple_call_ctrl_altering_p (const gimple *gs)
2946 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2947 return gimple_call_ctrl_altering_p (gc);
2951 /* Return the function type of the function called by GS. */
2953 static inline tree
2954 gimple_call_fntype (const gcall *gs)
2956 if (gimple_call_internal_p (gs))
2957 return NULL_TREE;
2958 return gs->u.fntype;
2961 static inline tree
2962 gimple_call_fntype (const gimple *gs)
2964 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2965 return gimple_call_fntype (call_stmt);
2968 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2970 static inline void
2971 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2973 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2974 call_stmt->u.fntype = fntype;
2978 /* Return the tree node representing the function called by call
2979 statement GS. */
2981 static inline tree
2982 gimple_call_fn (const gcall *gs)
2984 return gs->op[1];
2987 static inline tree
2988 gimple_call_fn (const gimple *gs)
2990 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2991 return gimple_call_fn (gc);
2994 /* Return a pointer to the tree node representing the function called by call
2995 statement GS. */
2997 static inline tree *
2998 gimple_call_fn_ptr (gcall *gs)
3000 return &gs->op[1];
3003 static inline tree *
3004 gimple_call_fn_ptr (gimple *gs)
3006 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3007 return gimple_call_fn_ptr (gc);
3011 /* Set FN to be the function called by call statement GS. */
3013 static inline void
3014 gimple_call_set_fn (gcall *gs, tree fn)
3016 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3017 gs->op[1] = fn;
3021 /* Set FNDECL to be the function called by call statement GS. */
3023 static inline void
3024 gimple_call_set_fndecl (gcall *gs, tree decl)
3026 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3027 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3028 build_pointer_type (TREE_TYPE (decl)), decl);
3031 static inline void
3032 gimple_call_set_fndecl (gimple *gs, tree decl)
3034 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3035 gimple_call_set_fndecl (gc, decl);
3039 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3041 static inline void
3042 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3044 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3045 call_stmt->u.internal_fn = fn;
3049 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3050 Otherwise return NULL. This function is analogous to
3051 get_callee_fndecl in tree land. */
3053 static inline tree
3054 gimple_call_fndecl (const gcall *gs)
3056 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3059 static inline tree
3060 gimple_call_fndecl (const gimple *gs)
3062 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3063 return gimple_call_fndecl (gc);
3067 /* Return the type returned by call statement GS. */
3069 static inline tree
3070 gimple_call_return_type (const gcall *gs)
3072 tree type = gimple_call_fntype (gs);
3074 if (type == NULL_TREE)
3075 return TREE_TYPE (gimple_call_lhs (gs));
3077 /* The type returned by a function is the type of its
3078 function type. */
3079 return TREE_TYPE (type);
3083 /* Return the static chain for call statement GS. */
3085 static inline tree
3086 gimple_call_chain (const gcall *gs)
3088 return gs->op[2];
3091 static inline tree
3092 gimple_call_chain (const gimple *gs)
3094 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3095 return gimple_call_chain (gc);
3099 /* Return a pointer to the static chain for call statement CALL_STMT. */
3101 static inline tree *
3102 gimple_call_chain_ptr (gcall *call_stmt)
3104 return &call_stmt->op[2];
3107 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3109 static inline void
3110 gimple_call_set_chain (gcall *call_stmt, tree chain)
3112 call_stmt->op[2] = chain;
3116 /* Return the number of arguments used by call statement GS. */
3118 static inline unsigned
3119 gimple_call_num_args (const gcall *gs)
3121 return gimple_num_ops (gs) - 3;
3124 static inline unsigned
3125 gimple_call_num_args (const gimple *gs)
3127 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3128 return gimple_call_num_args (gc);
3132 /* Return the argument at position INDEX for call statement GS. */
3134 static inline tree
3135 gimple_call_arg (const gcall *gs, unsigned index)
3137 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3138 return gs->op[index + 3];
3141 static inline tree
3142 gimple_call_arg (const gimple *gs, unsigned index)
3144 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3145 return gimple_call_arg (gc, index);
3149 /* Return a pointer to the argument at position INDEX for call
3150 statement GS. */
3152 static inline tree *
3153 gimple_call_arg_ptr (gcall *gs, unsigned index)
3155 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3156 return &gs->op[index + 3];
3159 static inline tree *
3160 gimple_call_arg_ptr (gimple *gs, unsigned index)
3162 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3163 return gimple_call_arg_ptr (gc, index);
3167 /* Set ARG to be the argument at position INDEX for call statement GS. */
3169 static inline void
3170 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3172 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3173 gs->op[index + 3] = arg;
3176 static inline void
3177 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3179 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3180 gimple_call_set_arg (gc, index, arg);
3184 /* If TAIL_P is true, mark call statement S as being a tail call
3185 (i.e., a call just before the exit of a function). These calls are
3186 candidate for tail call optimization. */
3188 static inline void
3189 gimple_call_set_tail (gcall *s, bool tail_p)
3191 if (tail_p)
3192 s->subcode |= GF_CALL_TAILCALL;
3193 else
3194 s->subcode &= ~GF_CALL_TAILCALL;
3198 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3200 static inline bool
3201 gimple_call_tail_p (gcall *s)
3203 return (s->subcode & GF_CALL_TAILCALL) != 0;
3207 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3208 slot optimization. This transformation uses the target of the call
3209 expansion as the return slot for calls that return in memory. */
3211 static inline void
3212 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3214 if (return_slot_opt_p)
3215 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3216 else
3217 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3221 /* Return true if S is marked for return slot optimization. */
3223 static inline bool
3224 gimple_call_return_slot_opt_p (gcall *s)
3226 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3230 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3231 thunk to the thunked-to function. */
3233 static inline void
3234 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3236 if (from_thunk_p)
3237 s->subcode |= GF_CALL_FROM_THUNK;
3238 else
3239 s->subcode &= ~GF_CALL_FROM_THUNK;
3243 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3245 static inline bool
3246 gimple_call_from_thunk_p (gcall *s)
3248 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3252 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3253 argument pack in its argument list. */
3255 static inline void
3256 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3258 if (pass_arg_pack_p)
3259 s->subcode |= GF_CALL_VA_ARG_PACK;
3260 else
3261 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3265 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3266 argument pack in its argument list. */
3268 static inline bool
3269 gimple_call_va_arg_pack_p (gcall *s)
3271 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3275 /* Return true if S is a noreturn call. */
3277 static inline bool
3278 gimple_call_noreturn_p (const gcall *s)
3280 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3283 static inline bool
3284 gimple_call_noreturn_p (const gimple *s)
3286 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3287 return gimple_call_noreturn_p (gc);
3291 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3292 even if the called function can throw in other cases. */
3294 static inline void
3295 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3297 if (nothrow_p)
3298 s->subcode |= GF_CALL_NOTHROW;
3299 else
3300 s->subcode &= ~GF_CALL_NOTHROW;
3303 /* Return true if S is a nothrow call. */
3305 static inline bool
3306 gimple_call_nothrow_p (gcall *s)
3308 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3311 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3312 is known to be emitted for VLA objects. Those are wrapped by
3313 stack_save/stack_restore calls and hence can't lead to unbounded
3314 stack growth even when they occur in loops. */
3316 static inline void
3317 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3319 if (for_var)
3320 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3321 else
3322 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3325 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3327 static inline bool
3328 gimple_call_alloca_for_var_p (gcall *s)
3330 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3333 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3335 static inline void
3336 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3338 dest_call->subcode = orig_call->subcode;
3342 /* Return a pointer to the points-to solution for the set of call-used
3343 variables of the call CALL_STMT. */
3345 static inline struct pt_solution *
3346 gimple_call_use_set (gcall *call_stmt)
3348 return &call_stmt->call_used;
3352 /* Return a pointer to the points-to solution for the set of call-used
3353 variables of the call CALL_STMT. */
3355 static inline struct pt_solution *
3356 gimple_call_clobber_set (gcall *call_stmt)
3358 return &call_stmt->call_clobbered;
3362 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3363 non-NULL lhs. */
3365 static inline bool
3366 gimple_has_lhs (gimple *stmt)
3368 if (is_gimple_assign (stmt))
3369 return true;
3370 if (gcall *call = dyn_cast <gcall *> (stmt))
3371 return gimple_call_lhs (call) != NULL_TREE;
3372 return false;
3376 /* Return the code of the predicate computed by conditional statement GS. */
3378 static inline enum tree_code
3379 gimple_cond_code (const gcond *gs)
3381 return (enum tree_code) gs->subcode;
3384 static inline enum tree_code
3385 gimple_cond_code (const gimple *gs)
3387 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3388 return gimple_cond_code (gc);
3392 /* Set CODE to be the predicate code for the conditional statement GS. */
3394 static inline void
3395 gimple_cond_set_code (gcond *gs, enum tree_code code)
3397 gs->subcode = code;
3401 /* Return the LHS of the predicate computed by conditional statement GS. */
3403 static inline tree
3404 gimple_cond_lhs (const gcond *gs)
3406 return gs->op[0];
3409 static inline tree
3410 gimple_cond_lhs (const gimple *gs)
3412 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3413 return gimple_cond_lhs (gc);
3416 /* Return the pointer to the LHS of the predicate computed by conditional
3417 statement GS. */
3419 static inline tree *
3420 gimple_cond_lhs_ptr (gcond *gs)
3422 return &gs->op[0];
3425 /* Set LHS to be the LHS operand of the predicate computed by
3426 conditional statement GS. */
3428 static inline void
3429 gimple_cond_set_lhs (gcond *gs, tree lhs)
3431 gs->op[0] = lhs;
3435 /* Return the RHS operand of the predicate computed by conditional GS. */
3437 static inline tree
3438 gimple_cond_rhs (const gcond *gs)
3440 return gs->op[1];
3443 static inline tree
3444 gimple_cond_rhs (const gimple *gs)
3446 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3447 return gimple_cond_rhs (gc);
3450 /* Return the pointer to the RHS operand of the predicate computed by
3451 conditional GS. */
3453 static inline tree *
3454 gimple_cond_rhs_ptr (gcond *gs)
3456 return &gs->op[1];
3460 /* Set RHS to be the RHS operand of the predicate computed by
3461 conditional statement GS. */
3463 static inline void
3464 gimple_cond_set_rhs (gcond *gs, tree rhs)
3466 gs->op[1] = rhs;
3470 /* Return the label used by conditional statement GS when its
3471 predicate evaluates to true. */
3473 static inline tree
3474 gimple_cond_true_label (const gcond *gs)
3476 return gs->op[2];
3480 /* Set LABEL to be the label used by conditional statement GS when its
3481 predicate evaluates to true. */
3483 static inline void
3484 gimple_cond_set_true_label (gcond *gs, tree label)
3486 gs->op[2] = label;
3490 /* Set LABEL to be the label used by conditional statement GS when its
3491 predicate evaluates to false. */
3493 static inline void
3494 gimple_cond_set_false_label (gcond *gs, tree label)
3496 gs->op[3] = label;
3500 /* Return the label used by conditional statement GS when its
3501 predicate evaluates to false. */
3503 static inline tree
3504 gimple_cond_false_label (const gcond *gs)
3506 return gs->op[3];
3510 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3512 static inline void
3513 gimple_cond_make_false (gcond *gs)
3515 gimple_cond_set_lhs (gs, boolean_false_node);
3516 gimple_cond_set_rhs (gs, boolean_false_node);
3517 gs->subcode = NE_EXPR;
3521 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3523 static inline void
3524 gimple_cond_make_true (gcond *gs)
3526 gimple_cond_set_lhs (gs, boolean_true_node);
3527 gimple_cond_set_rhs (gs, boolean_false_node);
3528 gs->subcode = NE_EXPR;
3531 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3532 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3534 static inline bool
3535 gimple_cond_true_p (const gcond *gs)
3537 tree lhs = gimple_cond_lhs (gs);
3538 tree rhs = gimple_cond_rhs (gs);
3539 enum tree_code code = gimple_cond_code (gs);
3541 if (lhs != boolean_true_node && lhs != boolean_false_node)
3542 return false;
3544 if (rhs != boolean_true_node && rhs != boolean_false_node)
3545 return false;
3547 if (code == NE_EXPR && lhs != rhs)
3548 return true;
3550 if (code == EQ_EXPR && lhs == rhs)
3551 return true;
3553 return false;
3556 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3557 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3559 static inline bool
3560 gimple_cond_false_p (const gcond *gs)
3562 tree lhs = gimple_cond_lhs (gs);
3563 tree rhs = gimple_cond_rhs (gs);
3564 enum tree_code code = gimple_cond_code (gs);
3566 if (lhs != boolean_true_node && lhs != boolean_false_node)
3567 return false;
3569 if (rhs != boolean_true_node && rhs != boolean_false_node)
3570 return false;
3572 if (code == NE_EXPR && lhs == rhs)
3573 return true;
3575 if (code == EQ_EXPR && lhs != rhs)
3576 return true;
3578 return false;
3581 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3583 static inline void
3584 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3585 tree rhs)
3587 gimple_cond_set_code (stmt, code);
3588 gimple_cond_set_lhs (stmt, lhs);
3589 gimple_cond_set_rhs (stmt, rhs);
3592 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3594 static inline tree
3595 gimple_label_label (const glabel *gs)
3597 return gs->op[0];
3601 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3602 GS. */
3604 static inline void
3605 gimple_label_set_label (glabel *gs, tree label)
3607 gs->op[0] = label;
3611 /* Return the destination of the unconditional jump GS. */
3613 static inline tree
3614 gimple_goto_dest (const gimple *gs)
3616 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3617 return gimple_op (gs, 0);
3621 /* Set DEST to be the destination of the unconditonal jump GS. */
3623 static inline void
3624 gimple_goto_set_dest (ggoto *gs, tree dest)
3626 gs->op[0] = dest;
3630 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3632 static inline tree
3633 gimple_bind_vars (const gbind *bind_stmt)
3635 return bind_stmt->vars;
3639 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3640 statement GS. */
3642 static inline void
3643 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3645 bind_stmt->vars = vars;
3649 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3650 statement GS. */
3652 static inline void
3653 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3655 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3659 static inline gimple_seq *
3660 gimple_bind_body_ptr (gbind *bind_stmt)
3662 return &bind_stmt->body;
3665 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3667 static inline gimple_seq
3668 gimple_bind_body (gbind *gs)
3670 return *gimple_bind_body_ptr (gs);
3674 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3675 statement GS. */
3677 static inline void
3678 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3680 bind_stmt->body = seq;
3684 /* Append a statement to the end of a GIMPLE_BIND's body. */
3686 static inline void
3687 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3689 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3693 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3695 static inline void
3696 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3698 gimple_seq_add_seq (&bind_stmt->body, seq);
3702 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3703 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3705 static inline tree
3706 gimple_bind_block (const gbind *bind_stmt)
3708 return bind_stmt->block;
3712 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3713 statement GS. */
3715 static inline void
3716 gimple_bind_set_block (gbind *bind_stmt, tree block)
3718 gcc_gimple_checking_assert (block == NULL_TREE
3719 || TREE_CODE (block) == BLOCK);
3720 bind_stmt->block = block;
3724 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3726 static inline unsigned
3727 gimple_asm_ninputs (const gasm *asm_stmt)
3729 return asm_stmt->ni;
3733 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3735 static inline unsigned
3736 gimple_asm_noutputs (const gasm *asm_stmt)
3738 return asm_stmt->no;
3742 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3744 static inline unsigned
3745 gimple_asm_nclobbers (const gasm *asm_stmt)
3747 return asm_stmt->nc;
3750 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3752 static inline unsigned
3753 gimple_asm_nlabels (const gasm *asm_stmt)
3755 return asm_stmt->nl;
3758 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3760 static inline tree
3761 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3763 gcc_gimple_checking_assert (index < asm_stmt->ni);
3764 return asm_stmt->op[index + asm_stmt->no];
3767 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3769 static inline void
3770 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3772 gcc_gimple_checking_assert (index < asm_stmt->ni
3773 && TREE_CODE (in_op) == TREE_LIST);
3774 asm_stmt->op[index + asm_stmt->no] = in_op;
3778 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3780 static inline tree
3781 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3783 gcc_gimple_checking_assert (index < asm_stmt->no);
3784 return asm_stmt->op[index];
3787 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3789 static inline void
3790 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3792 gcc_gimple_checking_assert (index < asm_stmt->no
3793 && TREE_CODE (out_op) == TREE_LIST);
3794 asm_stmt->op[index] = out_op;
3798 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3800 static inline tree
3801 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3803 gcc_gimple_checking_assert (index < asm_stmt->nc);
3804 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3808 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3810 static inline void
3811 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3813 gcc_gimple_checking_assert (index < asm_stmt->nc
3814 && TREE_CODE (clobber_op) == TREE_LIST);
3815 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3818 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3820 static inline tree
3821 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3823 gcc_gimple_checking_assert (index < asm_stmt->nl);
3824 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3827 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3829 static inline void
3830 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3832 gcc_gimple_checking_assert (index < asm_stmt->nl
3833 && TREE_CODE (label_op) == TREE_LIST);
3834 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3837 /* Return the string representing the assembly instruction in
3838 GIMPLE_ASM ASM_STMT. */
3840 static inline const char *
3841 gimple_asm_string (const gasm *asm_stmt)
3843 return asm_stmt->string;
3847 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3849 static inline bool
3850 gimple_asm_volatile_p (const gasm *asm_stmt)
3852 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3856 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3858 static inline void
3859 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3861 if (volatile_p)
3862 asm_stmt->subcode |= GF_ASM_VOLATILE;
3863 else
3864 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3868 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3870 static inline void
3871 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3873 if (input_p)
3874 asm_stmt->subcode |= GF_ASM_INPUT;
3875 else
3876 asm_stmt->subcode &= ~GF_ASM_INPUT;
3880 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3882 static inline bool
3883 gimple_asm_input_p (const gasm *asm_stmt)
3885 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3889 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3891 static inline tree
3892 gimple_catch_types (const gcatch *catch_stmt)
3894 return catch_stmt->types;
3898 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3900 static inline tree *
3901 gimple_catch_types_ptr (gcatch *catch_stmt)
3903 return &catch_stmt->types;
3907 /* Return a pointer to the GIMPLE sequence representing the body of
3908 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3910 static inline gimple_seq *
3911 gimple_catch_handler_ptr (gcatch *catch_stmt)
3913 return &catch_stmt->handler;
3917 /* Return the GIMPLE sequence representing the body of the handler of
3918 GIMPLE_CATCH statement CATCH_STMT. */
3920 static inline gimple_seq
3921 gimple_catch_handler (gcatch *catch_stmt)
3923 return *gimple_catch_handler_ptr (catch_stmt);
3927 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3929 static inline void
3930 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3932 catch_stmt->types = t;
3936 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3938 static inline void
3939 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3941 catch_stmt->handler = handler;
3945 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3947 static inline tree
3948 gimple_eh_filter_types (const gimple *gs)
3950 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3951 return eh_filter_stmt->types;
3955 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3956 GS. */
3958 static inline tree *
3959 gimple_eh_filter_types_ptr (gimple *gs)
3961 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3962 return &eh_filter_stmt->types;
3966 /* Return a pointer to the sequence of statement to execute when
3967 GIMPLE_EH_FILTER statement fails. */
3969 static inline gimple_seq *
3970 gimple_eh_filter_failure_ptr (gimple *gs)
3972 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3973 return &eh_filter_stmt->failure;
3977 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3978 statement fails. */
3980 static inline gimple_seq
3981 gimple_eh_filter_failure (gimple *gs)
3983 return *gimple_eh_filter_failure_ptr (gs);
3987 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3988 EH_FILTER_STMT. */
3990 static inline void
3991 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3993 eh_filter_stmt->types = types;
3997 /* Set FAILURE to be the sequence of statements to execute on failure
3998 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4000 static inline void
4001 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4002 gimple_seq failure)
4004 eh_filter_stmt->failure = failure;
4007 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4009 static inline tree
4010 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4012 return eh_mnt_stmt->fndecl;
4015 /* Set the function decl to be called by GS to DECL. */
4017 static inline void
4018 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4019 tree decl)
4021 eh_mnt_stmt->fndecl = decl;
4024 /* GIMPLE_EH_ELSE accessors. */
4026 static inline gimple_seq *
4027 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4029 return &eh_else_stmt->n_body;
4032 static inline gimple_seq
4033 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4035 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4038 static inline gimple_seq *
4039 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4041 return &eh_else_stmt->e_body;
4044 static inline gimple_seq
4045 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4047 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4050 static inline void
4051 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4053 eh_else_stmt->n_body = seq;
4056 static inline void
4057 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4059 eh_else_stmt->e_body = seq;
4062 /* GIMPLE_TRY accessors. */
4064 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4065 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4067 static inline enum gimple_try_flags
4068 gimple_try_kind (const gimple *gs)
4070 GIMPLE_CHECK (gs, GIMPLE_TRY);
4071 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4075 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4077 static inline void
4078 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4080 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4081 || kind == GIMPLE_TRY_FINALLY);
4082 if (gimple_try_kind (gs) != kind)
4083 gs->subcode = (unsigned int) kind;
4087 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4089 static inline bool
4090 gimple_try_catch_is_cleanup (const gimple *gs)
4092 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4093 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4097 /* Return a pointer to the sequence of statements used as the
4098 body for GIMPLE_TRY GS. */
4100 static inline gimple_seq *
4101 gimple_try_eval_ptr (gimple *gs)
4103 gtry *try_stmt = as_a <gtry *> (gs);
4104 return &try_stmt->eval;
4108 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4110 static inline gimple_seq
4111 gimple_try_eval (gimple *gs)
4113 return *gimple_try_eval_ptr (gs);
4117 /* Return a pointer to the sequence of statements used as the cleanup body for
4118 GIMPLE_TRY GS. */
4120 static inline gimple_seq *
4121 gimple_try_cleanup_ptr (gimple *gs)
4123 gtry *try_stmt = as_a <gtry *> (gs);
4124 return &try_stmt->cleanup;
4128 /* Return the sequence of statements used as the cleanup body for
4129 GIMPLE_TRY GS. */
4131 static inline gimple_seq
4132 gimple_try_cleanup (gimple *gs)
4134 return *gimple_try_cleanup_ptr (gs);
4138 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4140 static inline void
4141 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4143 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4144 if (catch_is_cleanup)
4145 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4146 else
4147 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4151 /* Set EVAL to be the sequence of statements to use as the body for
4152 GIMPLE_TRY TRY_STMT. */
4154 static inline void
4155 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4157 try_stmt->eval = eval;
4161 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4162 body for GIMPLE_TRY TRY_STMT. */
4164 static inline void
4165 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4167 try_stmt->cleanup = cleanup;
4171 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4173 static inline gimple_seq *
4174 gimple_wce_cleanup_ptr (gimple *gs)
4176 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4177 return &wce_stmt->cleanup;
4181 /* Return the cleanup sequence for cleanup statement GS. */
4183 static inline gimple_seq
4184 gimple_wce_cleanup (gimple *gs)
4186 return *gimple_wce_cleanup_ptr (gs);
4190 /* Set CLEANUP to be the cleanup sequence for GS. */
4192 static inline void
4193 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4195 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4196 wce_stmt->cleanup = cleanup;
4200 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4202 static inline bool
4203 gimple_wce_cleanup_eh_only (const gimple *gs)
4205 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4206 return gs->subcode != 0;
4210 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4212 static inline void
4213 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4215 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4216 gs->subcode = (unsigned int) eh_only_p;
4220 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4222 static inline unsigned
4223 gimple_phi_capacity (const gimple *gs)
4225 const gphi *phi_stmt = as_a <const gphi *> (gs);
4226 return phi_stmt->capacity;
4230 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4231 be exactly the number of incoming edges for the basic block holding
4232 GS. */
4234 static inline unsigned
4235 gimple_phi_num_args (const gimple *gs)
4237 const gphi *phi_stmt = as_a <const gphi *> (gs);
4238 return phi_stmt->nargs;
4242 /* Return the SSA name created by GIMPLE_PHI GS. */
4244 static inline tree
4245 gimple_phi_result (const gimple *gs)
4247 const gphi *phi_stmt = as_a <const gphi *> (gs);
4248 return phi_stmt->result;
4251 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4253 static inline tree *
4254 gimple_phi_result_ptr (gimple *gs)
4256 gphi *phi_stmt = as_a <gphi *> (gs);
4257 return &phi_stmt->result;
4260 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4262 static inline void
4263 gimple_phi_set_result (gphi *phi, tree result)
4265 phi->result = result;
4266 if (result && TREE_CODE (result) == SSA_NAME)
4267 SSA_NAME_DEF_STMT (result) = phi;
4271 /* Return the PHI argument corresponding to incoming edge INDEX for
4272 GIMPLE_PHI GS. */
4274 static inline struct phi_arg_d *
4275 gimple_phi_arg (gimple *gs, unsigned index)
4277 gphi *phi_stmt = as_a <gphi *> (gs);
4278 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4279 return &(phi_stmt->args[index]);
4282 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4283 for GIMPLE_PHI PHI. */
4285 static inline void
4286 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4288 gcc_gimple_checking_assert (index <= phi->nargs);
4289 phi->args[index] = *phiarg;
4292 /* Return the PHI nodes for basic block BB, or NULL if there are no
4293 PHI nodes. */
4295 static inline gimple_seq
4296 phi_nodes (const_basic_block bb)
4298 gcc_checking_assert (!(bb->flags & BB_RTL));
4299 return bb->il.gimple.phi_nodes;
4302 /* Return a pointer to the PHI nodes for basic block BB. */
4304 static inline gimple_seq *
4305 phi_nodes_ptr (basic_block bb)
4307 gcc_checking_assert (!(bb->flags & BB_RTL));
4308 return &bb->il.gimple.phi_nodes;
4311 /* Return the tree operand for argument I of PHI node GS. */
4313 static inline tree
4314 gimple_phi_arg_def (gimple *gs, size_t index)
4316 return gimple_phi_arg (gs, index)->def;
4320 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4322 static inline tree *
4323 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4325 return &gimple_phi_arg (phi, index)->def;
4328 /* Return the edge associated with argument I of phi node PHI. */
4330 static inline edge
4331 gimple_phi_arg_edge (gphi *phi, size_t i)
4333 return EDGE_PRED (gimple_bb (phi), i);
4336 /* Return the source location of gimple argument I of phi node PHI. */
4338 static inline source_location
4339 gimple_phi_arg_location (gphi *phi, size_t i)
4341 return gimple_phi_arg (phi, i)->locus;
4344 /* Return the source location of the argument on edge E of phi node PHI. */
4346 static inline source_location
4347 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4349 return gimple_phi_arg (phi, e->dest_idx)->locus;
4352 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4354 static inline void
4355 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4357 gimple_phi_arg (phi, i)->locus = loc;
4360 /* Return TRUE if argument I of phi node PHI has a location record. */
4362 static inline bool
4363 gimple_phi_arg_has_location (gphi *phi, size_t i)
4365 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4369 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4371 static inline int
4372 gimple_resx_region (const gresx *resx_stmt)
4374 return resx_stmt->region;
4377 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4379 static inline void
4380 gimple_resx_set_region (gresx *resx_stmt, int region)
4382 resx_stmt->region = region;
4385 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4387 static inline int
4388 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4390 return eh_dispatch_stmt->region;
4393 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4394 EH_DISPATCH_STMT. */
4396 static inline void
4397 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4399 eh_dispatch_stmt->region = region;
4402 /* Return the number of labels associated with the switch statement GS. */
4404 static inline unsigned
4405 gimple_switch_num_labels (const gswitch *gs)
4407 unsigned num_ops;
4408 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4409 num_ops = gimple_num_ops (gs);
4410 gcc_gimple_checking_assert (num_ops > 1);
4411 return num_ops - 1;
4415 /* Set NLABELS to be the number of labels for the switch statement GS. */
4417 static inline void
4418 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4420 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4421 gimple_set_num_ops (g, nlabels + 1);
4425 /* Return the index variable used by the switch statement GS. */
4427 static inline tree
4428 gimple_switch_index (const gswitch *gs)
4430 return gs->op[0];
4434 /* Return a pointer to the index variable for the switch statement GS. */
4436 static inline tree *
4437 gimple_switch_index_ptr (gswitch *gs)
4439 return &gs->op[0];
4443 /* Set INDEX to be the index variable for switch statement GS. */
4445 static inline void
4446 gimple_switch_set_index (gswitch *gs, tree index)
4448 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4449 gs->op[0] = index;
4453 /* Return the label numbered INDEX. The default label is 0, followed by any
4454 labels in a switch statement. */
4456 static inline tree
4457 gimple_switch_label (const gswitch *gs, unsigned index)
4459 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4460 return gs->op[index + 1];
4463 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4465 static inline void
4466 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4468 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4469 && (label == NULL_TREE
4470 || TREE_CODE (label) == CASE_LABEL_EXPR));
4471 gs->op[index + 1] = label;
4474 /* Return the default label for a switch statement. */
4476 static inline tree
4477 gimple_switch_default_label (const gswitch *gs)
4479 tree label = gimple_switch_label (gs, 0);
4480 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4481 return label;
4484 /* Set the default label for a switch statement. */
4486 static inline void
4487 gimple_switch_set_default_label (gswitch *gs, tree label)
4489 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4490 gimple_switch_set_label (gs, 0, label);
4493 /* Return true if GS is a GIMPLE_DEBUG statement. */
4495 static inline bool
4496 is_gimple_debug (const gimple *gs)
4498 return gimple_code (gs) == GIMPLE_DEBUG;
4501 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4503 static inline bool
4504 gimple_debug_bind_p (const gimple *s)
4506 if (is_gimple_debug (s))
4507 return s->subcode == GIMPLE_DEBUG_BIND;
4509 return false;
4512 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4514 static inline tree
4515 gimple_debug_bind_get_var (gimple *dbg)
4517 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4518 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4519 return gimple_op (dbg, 0);
4522 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4523 statement. */
4525 static inline tree
4526 gimple_debug_bind_get_value (gimple *dbg)
4528 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4529 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4530 return gimple_op (dbg, 1);
4533 /* Return a pointer to the value bound to the variable in a
4534 GIMPLE_DEBUG bind statement. */
4536 static inline tree *
4537 gimple_debug_bind_get_value_ptr (gimple *dbg)
4539 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4540 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4541 return gimple_op_ptr (dbg, 1);
4544 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4546 static inline void
4547 gimple_debug_bind_set_var (gimple *dbg, tree var)
4549 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4550 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4551 gimple_set_op (dbg, 0, var);
4554 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4555 statement. */
4557 static inline void
4558 gimple_debug_bind_set_value (gimple *dbg, tree value)
4560 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4561 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4562 gimple_set_op (dbg, 1, value);
4565 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4566 optimized away. */
4567 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4569 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4570 statement. */
4572 static inline void
4573 gimple_debug_bind_reset_value (gimple *dbg)
4575 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4576 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4577 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4580 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4581 value. */
4583 static inline bool
4584 gimple_debug_bind_has_value_p (gimple *dbg)
4586 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4587 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4588 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4591 #undef GIMPLE_DEBUG_BIND_NOVALUE
4593 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4595 static inline bool
4596 gimple_debug_source_bind_p (const gimple *s)
4598 if (is_gimple_debug (s))
4599 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4601 return false;
4604 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4606 static inline tree
4607 gimple_debug_source_bind_get_var (gimple *dbg)
4609 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4610 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4611 return gimple_op (dbg, 0);
4614 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4615 statement. */
4617 static inline tree
4618 gimple_debug_source_bind_get_value (gimple *dbg)
4620 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4621 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4622 return gimple_op (dbg, 1);
4625 /* Return a pointer to the value bound to the variable in a
4626 GIMPLE_DEBUG source bind statement. */
4628 static inline tree *
4629 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4631 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4632 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4633 return gimple_op_ptr (dbg, 1);
4636 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4638 static inline void
4639 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4641 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4642 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4643 gimple_set_op (dbg, 0, var);
4646 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4647 statement. */
4649 static inline void
4650 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4652 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4653 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4654 gimple_set_op (dbg, 1, value);
4657 /* Return the line number for EXPR, or return -1 if we have no line
4658 number information for it. */
4659 static inline int
4660 get_lineno (const gimple *stmt)
4662 location_t loc;
4664 if (!stmt)
4665 return -1;
4667 loc = gimple_location (stmt);
4668 if (loc == UNKNOWN_LOCATION)
4669 return -1;
4671 return LOCATION_LINE (loc);
4674 /* Return a pointer to the body for the OMP statement GS. */
4676 static inline gimple_seq *
4677 gimple_omp_body_ptr (gimple *gs)
4679 return &static_cast <gimple_statement_omp *> (gs)->body;
4682 /* Return the body for the OMP statement GS. */
4684 static inline gimple_seq
4685 gimple_omp_body (gimple *gs)
4687 return *gimple_omp_body_ptr (gs);
4690 /* Set BODY to be the body for the OMP statement GS. */
4692 static inline void
4693 gimple_omp_set_body (gimple *gs, gimple_seq body)
4695 static_cast <gimple_statement_omp *> (gs)->body = body;
4699 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4701 static inline tree
4702 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4704 return crit_stmt->name;
4708 /* Return a pointer to the name associated with OMP critical statement
4709 CRIT_STMT. */
4711 static inline tree *
4712 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4714 return &crit_stmt->name;
4718 /* Set NAME to be the name associated with OMP critical statement
4719 CRIT_STMT. */
4721 static inline void
4722 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4724 crit_stmt->name = name;
4728 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4730 static inline tree
4731 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4733 return crit_stmt->clauses;
4737 /* Return a pointer to the clauses associated with OMP critical statement
4738 CRIT_STMT. */
4740 static inline tree *
4741 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4743 return &crit_stmt->clauses;
4747 /* Set CLAUSES to be the clauses associated with OMP critical statement
4748 CRIT_STMT. */
4750 static inline void
4751 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4753 crit_stmt->clauses = clauses;
4757 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4759 static inline tree
4760 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4762 return ord_stmt->clauses;
4766 /* Return a pointer to the clauses associated with OMP ordered statement
4767 ORD_STMT. */
4769 static inline tree *
4770 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4772 return &ord_stmt->clauses;
4776 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4777 ORD_STMT. */
4779 static inline void
4780 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4782 ord_stmt->clauses = clauses;
4786 /* Return the kind of the OMP_FOR statemement G. */
4788 static inline int
4789 gimple_omp_for_kind (const gimple *g)
4791 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4792 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4796 /* Set the kind of the OMP_FOR statement G. */
4798 static inline void
4799 gimple_omp_for_set_kind (gomp_for *g, int kind)
4801 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4802 | (kind & GF_OMP_FOR_KIND_MASK);
4806 /* Return true if OMP_FOR statement G has the
4807 GF_OMP_FOR_COMBINED flag set. */
4809 static inline bool
4810 gimple_omp_for_combined_p (const gimple *g)
4812 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4813 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4817 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4818 the boolean value of COMBINED_P. */
4820 static inline void
4821 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4823 if (combined_p)
4824 g->subcode |= GF_OMP_FOR_COMBINED;
4825 else
4826 g->subcode &= ~GF_OMP_FOR_COMBINED;
4830 /* Return true if the OMP_FOR statement G has the
4831 GF_OMP_FOR_COMBINED_INTO flag set. */
4833 static inline bool
4834 gimple_omp_for_combined_into_p (const gimple *g)
4836 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4837 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4841 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4842 on the boolean value of COMBINED_P. */
4844 static inline void
4845 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4847 if (combined_p)
4848 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4849 else
4850 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4854 /* Return the clauses associated with the OMP_FOR statement GS. */
4856 static inline tree
4857 gimple_omp_for_clauses (const gimple *gs)
4859 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4860 return omp_for_stmt->clauses;
4864 /* Return a pointer to the clauses associated with the OMP_FOR statement
4865 GS. */
4867 static inline tree *
4868 gimple_omp_for_clauses_ptr (gimple *gs)
4870 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4871 return &omp_for_stmt->clauses;
4875 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4876 GS. */
4878 static inline void
4879 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4881 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4882 omp_for_stmt->clauses = clauses;
4886 /* Get the collapse count of the OMP_FOR statement GS. */
4888 static inline size_t
4889 gimple_omp_for_collapse (gimple *gs)
4891 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4892 return omp_for_stmt->collapse;
4896 /* Return the condition code associated with the OMP_FOR statement GS. */
4898 static inline enum tree_code
4899 gimple_omp_for_cond (const gimple *gs, size_t i)
4901 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4902 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4903 return omp_for_stmt->iter[i].cond;
4907 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4909 static inline void
4910 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4912 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4913 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4914 && i < omp_for_stmt->collapse);
4915 omp_for_stmt->iter[i].cond = cond;
4919 /* Return the index variable for the OMP_FOR statement GS. */
4921 static inline tree
4922 gimple_omp_for_index (const gimple *gs, size_t i)
4924 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4925 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4926 return omp_for_stmt->iter[i].index;
4930 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4932 static inline tree *
4933 gimple_omp_for_index_ptr (gimple *gs, size_t i)
4935 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4936 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4937 return &omp_for_stmt->iter[i].index;
4941 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4943 static inline void
4944 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
4946 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4947 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4948 omp_for_stmt->iter[i].index = index;
4952 /* Return the initial value for the OMP_FOR statement GS. */
4954 static inline tree
4955 gimple_omp_for_initial (const gimple *gs, size_t i)
4957 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4958 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4959 return omp_for_stmt->iter[i].initial;
4963 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4965 static inline tree *
4966 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
4968 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4969 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4970 return &omp_for_stmt->iter[i].initial;
4974 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4976 static inline void
4977 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
4979 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4980 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4981 omp_for_stmt->iter[i].initial = initial;
4985 /* Return the final value for the OMP_FOR statement GS. */
4987 static inline tree
4988 gimple_omp_for_final (const gimple *gs, size_t i)
4990 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4991 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4992 return omp_for_stmt->iter[i].final;
4996 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4998 static inline tree *
4999 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5001 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5002 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5003 return &omp_for_stmt->iter[i].final;
5007 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5009 static inline void
5010 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5012 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5013 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5014 omp_for_stmt->iter[i].final = final;
5018 /* Return the increment value for the OMP_FOR statement GS. */
5020 static inline tree
5021 gimple_omp_for_incr (const gimple *gs, size_t i)
5023 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5024 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5025 return omp_for_stmt->iter[i].incr;
5029 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5031 static inline tree *
5032 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5034 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5035 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5036 return &omp_for_stmt->iter[i].incr;
5040 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5042 static inline void
5043 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5045 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5046 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5047 omp_for_stmt->iter[i].incr = incr;
5051 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5052 statement GS starts. */
5054 static inline gimple_seq *
5055 gimple_omp_for_pre_body_ptr (gimple *gs)
5057 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5058 return &omp_for_stmt->pre_body;
5062 /* Return the sequence of statements to execute before the OMP_FOR
5063 statement GS starts. */
5065 static inline gimple_seq
5066 gimple_omp_for_pre_body (gimple *gs)
5068 return *gimple_omp_for_pre_body_ptr (gs);
5072 /* Set PRE_BODY to be the sequence of statements to execute before the
5073 OMP_FOR statement GS starts. */
5075 static inline void
5076 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5078 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5079 omp_for_stmt->pre_body = pre_body;
5083 /* Return the clauses associated with OMP_PARALLEL GS. */
5085 static inline tree
5086 gimple_omp_parallel_clauses (const gimple *gs)
5088 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5089 return omp_parallel_stmt->clauses;
5093 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5095 static inline tree *
5096 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5098 return &omp_parallel_stmt->clauses;
5102 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5104 static inline void
5105 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5106 tree clauses)
5108 omp_parallel_stmt->clauses = clauses;
5112 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5114 static inline tree
5115 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5117 return omp_parallel_stmt->child_fn;
5120 /* Return a pointer to the child function used to hold the body of
5121 OMP_PARALLEL_STMT. */
5123 static inline tree *
5124 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5126 return &omp_parallel_stmt->child_fn;
5130 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5132 static inline void
5133 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5134 tree child_fn)
5136 omp_parallel_stmt->child_fn = child_fn;
5140 /* Return the artificial argument used to send variables and values
5141 from the parent to the children threads in OMP_PARALLEL_STMT. */
5143 static inline tree
5144 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5146 return omp_parallel_stmt->data_arg;
5150 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5152 static inline tree *
5153 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5155 return &omp_parallel_stmt->data_arg;
5159 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5161 static inline void
5162 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5163 tree data_arg)
5165 omp_parallel_stmt->data_arg = data_arg;
5169 /* Return the clauses associated with OMP_TASK GS. */
5171 static inline tree
5172 gimple_omp_task_clauses (const gimple *gs)
5174 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5175 return omp_task_stmt->clauses;
5179 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5181 static inline tree *
5182 gimple_omp_task_clauses_ptr (gimple *gs)
5184 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5185 return &omp_task_stmt->clauses;
5189 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5190 GS. */
5192 static inline void
5193 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5195 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5196 omp_task_stmt->clauses = clauses;
5200 /* Return true if OMP task statement G has the
5201 GF_OMP_TASK_TASKLOOP flag set. */
5203 static inline bool
5204 gimple_omp_task_taskloop_p (const gimple *g)
5206 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5207 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5211 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5212 value of TASKLOOP_P. */
5214 static inline void
5215 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5217 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5218 if (taskloop_p)
5219 g->subcode |= GF_OMP_TASK_TASKLOOP;
5220 else
5221 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5225 /* Return the child function used to hold the body of OMP_TASK GS. */
5227 static inline tree
5228 gimple_omp_task_child_fn (const gimple *gs)
5230 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5231 return omp_task_stmt->child_fn;
5234 /* Return a pointer to the child function used to hold the body of
5235 OMP_TASK GS. */
5237 static inline tree *
5238 gimple_omp_task_child_fn_ptr (gimple *gs)
5240 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5241 return &omp_task_stmt->child_fn;
5245 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5247 static inline void
5248 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5250 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5251 omp_task_stmt->child_fn = child_fn;
5255 /* Return the artificial argument used to send variables and values
5256 from the parent to the children threads in OMP_TASK GS. */
5258 static inline tree
5259 gimple_omp_task_data_arg (const gimple *gs)
5261 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5262 return omp_task_stmt->data_arg;
5266 /* Return a pointer to the data argument for OMP_TASK GS. */
5268 static inline tree *
5269 gimple_omp_task_data_arg_ptr (gimple *gs)
5271 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5272 return &omp_task_stmt->data_arg;
5276 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5278 static inline void
5279 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5281 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5282 omp_task_stmt->data_arg = data_arg;
5286 /* Return the clauses associated with OMP_TASK GS. */
5288 static inline tree
5289 gimple_omp_taskreg_clauses (const gimple *gs)
5291 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5292 = as_a <const gimple_statement_omp_taskreg *> (gs);
5293 return omp_taskreg_stmt->clauses;
5297 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5299 static inline tree *
5300 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5302 gimple_statement_omp_taskreg *omp_taskreg_stmt
5303 = as_a <gimple_statement_omp_taskreg *> (gs);
5304 return &omp_taskreg_stmt->clauses;
5308 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5309 GS. */
5311 static inline void
5312 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5314 gimple_statement_omp_taskreg *omp_taskreg_stmt
5315 = as_a <gimple_statement_omp_taskreg *> (gs);
5316 omp_taskreg_stmt->clauses = clauses;
5320 /* Return the child function used to hold the body of OMP_TASK GS. */
5322 static inline tree
5323 gimple_omp_taskreg_child_fn (const gimple *gs)
5325 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5326 = as_a <const gimple_statement_omp_taskreg *> (gs);
5327 return omp_taskreg_stmt->child_fn;
5330 /* Return a pointer to the child function used to hold the body of
5331 OMP_TASK GS. */
5333 static inline tree *
5334 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5336 gimple_statement_omp_taskreg *omp_taskreg_stmt
5337 = as_a <gimple_statement_omp_taskreg *> (gs);
5338 return &omp_taskreg_stmt->child_fn;
5342 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5344 static inline void
5345 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5347 gimple_statement_omp_taskreg *omp_taskreg_stmt
5348 = as_a <gimple_statement_omp_taskreg *> (gs);
5349 omp_taskreg_stmt->child_fn = child_fn;
5353 /* Return the artificial argument used to send variables and values
5354 from the parent to the children threads in OMP_TASK GS. */
5356 static inline tree
5357 gimple_omp_taskreg_data_arg (const gimple *gs)
5359 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5360 = as_a <const gimple_statement_omp_taskreg *> (gs);
5361 return omp_taskreg_stmt->data_arg;
5365 /* Return a pointer to the data argument for OMP_TASK GS. */
5367 static inline tree *
5368 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5370 gimple_statement_omp_taskreg *omp_taskreg_stmt
5371 = as_a <gimple_statement_omp_taskreg *> (gs);
5372 return &omp_taskreg_stmt->data_arg;
5376 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5378 static inline void
5379 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5381 gimple_statement_omp_taskreg *omp_taskreg_stmt
5382 = as_a <gimple_statement_omp_taskreg *> (gs);
5383 omp_taskreg_stmt->data_arg = data_arg;
5387 /* Return the copy function used to hold the body of OMP_TASK GS. */
5389 static inline tree
5390 gimple_omp_task_copy_fn (const gimple *gs)
5392 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5393 return omp_task_stmt->copy_fn;
5396 /* Return a pointer to the copy function used to hold the body of
5397 OMP_TASK GS. */
5399 static inline tree *
5400 gimple_omp_task_copy_fn_ptr (gimple *gs)
5402 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5403 return &omp_task_stmt->copy_fn;
5407 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5409 static inline void
5410 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5412 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5413 omp_task_stmt->copy_fn = copy_fn;
5417 /* Return size of the data block in bytes in OMP_TASK GS. */
5419 static inline tree
5420 gimple_omp_task_arg_size (const gimple *gs)
5422 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5423 return omp_task_stmt->arg_size;
5427 /* Return a pointer to the data block size for OMP_TASK GS. */
5429 static inline tree *
5430 gimple_omp_task_arg_size_ptr (gimple *gs)
5432 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5433 return &omp_task_stmt->arg_size;
5437 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5439 static inline void
5440 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5442 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5443 omp_task_stmt->arg_size = arg_size;
5447 /* Return align of the data block in bytes in OMP_TASK GS. */
5449 static inline tree
5450 gimple_omp_task_arg_align (const gimple *gs)
5452 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5453 return omp_task_stmt->arg_align;
5457 /* Return a pointer to the data block align for OMP_TASK GS. */
5459 static inline tree *
5460 gimple_omp_task_arg_align_ptr (gimple *gs)
5462 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5463 return &omp_task_stmt->arg_align;
5467 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5469 static inline void
5470 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5472 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5473 omp_task_stmt->arg_align = arg_align;
5477 /* Return the clauses associated with OMP_SINGLE GS. */
5479 static inline tree
5480 gimple_omp_single_clauses (const gimple *gs)
5482 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5483 return omp_single_stmt->clauses;
5487 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5489 static inline tree *
5490 gimple_omp_single_clauses_ptr (gimple *gs)
5492 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5493 return &omp_single_stmt->clauses;
5497 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5499 static inline void
5500 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5502 omp_single_stmt->clauses = clauses;
5506 /* Return the clauses associated with OMP_TARGET GS. */
5508 static inline tree
5509 gimple_omp_target_clauses (const gimple *gs)
5511 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5512 return omp_target_stmt->clauses;
5516 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5518 static inline tree *
5519 gimple_omp_target_clauses_ptr (gimple *gs)
5521 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5522 return &omp_target_stmt->clauses;
5526 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5528 static inline void
5529 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5530 tree clauses)
5532 omp_target_stmt->clauses = clauses;
5536 /* Return the kind of the OMP_TARGET G. */
5538 static inline int
5539 gimple_omp_target_kind (const gimple *g)
5541 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5542 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5546 /* Set the kind of the OMP_TARGET G. */
5548 static inline void
5549 gimple_omp_target_set_kind (gomp_target *g, int kind)
5551 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5552 | (kind & GF_OMP_TARGET_KIND_MASK);
5556 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5558 static inline tree
5559 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5561 return omp_target_stmt->child_fn;
5564 /* Return a pointer to the child function used to hold the body of
5565 OMP_TARGET_STMT. */
5567 static inline tree *
5568 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5570 return &omp_target_stmt->child_fn;
5574 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5576 static inline void
5577 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5578 tree child_fn)
5580 omp_target_stmt->child_fn = child_fn;
5584 /* Return the artificial argument used to send variables and values
5585 from the parent to the children threads in OMP_TARGET_STMT. */
5587 static inline tree
5588 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5590 return omp_target_stmt->data_arg;
5594 /* Return a pointer to the data argument for OMP_TARGET GS. */
5596 static inline tree *
5597 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5599 return &omp_target_stmt->data_arg;
5603 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5605 static inline void
5606 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5607 tree data_arg)
5609 omp_target_stmt->data_arg = data_arg;
5613 /* Return the clauses associated with OMP_TEAMS GS. */
5615 static inline tree
5616 gimple_omp_teams_clauses (const gimple *gs)
5618 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5619 return omp_teams_stmt->clauses;
5623 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5625 static inline tree *
5626 gimple_omp_teams_clauses_ptr (gimple *gs)
5628 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5629 return &omp_teams_stmt->clauses;
5633 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5635 static inline void
5636 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5638 omp_teams_stmt->clauses = clauses;
5642 /* Return the clauses associated with OMP_SECTIONS GS. */
5644 static inline tree
5645 gimple_omp_sections_clauses (const gimple *gs)
5647 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5648 return omp_sections_stmt->clauses;
5652 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5654 static inline tree *
5655 gimple_omp_sections_clauses_ptr (gimple *gs)
5657 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5658 return &omp_sections_stmt->clauses;
5662 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5663 GS. */
5665 static inline void
5666 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5668 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5669 omp_sections_stmt->clauses = clauses;
5673 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5674 in GS. */
5676 static inline tree
5677 gimple_omp_sections_control (const gimple *gs)
5679 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5680 return omp_sections_stmt->control;
5684 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5685 GS. */
5687 static inline tree *
5688 gimple_omp_sections_control_ptr (gimple *gs)
5690 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5691 return &omp_sections_stmt->control;
5695 /* Set CONTROL to be the set of clauses associated with the
5696 GIMPLE_OMP_SECTIONS in GS. */
5698 static inline void
5699 gimple_omp_sections_set_control (gimple *gs, tree control)
5701 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5702 omp_sections_stmt->control = control;
5706 /* Set the value being stored in an atomic store. */
5708 static inline void
5709 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5711 store_stmt->val = val;
5715 /* Return the value being stored in an atomic store. */
5717 static inline tree
5718 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5720 return store_stmt->val;
5724 /* Return a pointer to the value being stored in an atomic store. */
5726 static inline tree *
5727 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5729 return &store_stmt->val;
5733 /* Set the LHS of an atomic load. */
5735 static inline void
5736 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5738 load_stmt->lhs = lhs;
5742 /* Get the LHS of an atomic load. */
5744 static inline tree
5745 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5747 return load_stmt->lhs;
5751 /* Return a pointer to the LHS of an atomic load. */
5753 static inline tree *
5754 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5756 return &load_stmt->lhs;
5760 /* Set the RHS of an atomic load. */
5762 static inline void
5763 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5765 load_stmt->rhs = rhs;
5769 /* Get the RHS of an atomic load. */
5771 static inline tree
5772 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5774 return load_stmt->rhs;
5778 /* Return a pointer to the RHS of an atomic load. */
5780 static inline tree *
5781 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5783 return &load_stmt->rhs;
5787 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5789 static inline tree
5790 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5792 return cont_stmt->control_def;
5795 /* The same as above, but return the address. */
5797 static inline tree *
5798 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5800 return &cont_stmt->control_def;
5803 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5805 static inline void
5806 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5808 cont_stmt->control_def = def;
5812 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5814 static inline tree
5815 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5817 return cont_stmt->control_use;
5821 /* The same as above, but return the address. */
5823 static inline tree *
5824 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5826 return &cont_stmt->control_use;
5830 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5832 static inline void
5833 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5835 cont_stmt->control_use = use;
5838 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5839 TRANSACTION_STMT. */
5841 static inline gimple_seq *
5842 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5844 return &transaction_stmt->body;
5847 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5849 static inline gimple_seq
5850 gimple_transaction_body (gtransaction *transaction_stmt)
5852 return transaction_stmt->body;
5855 /* Return the label associated with a GIMPLE_TRANSACTION. */
5857 static inline tree
5858 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
5860 return transaction_stmt->label_norm;
5863 static inline tree *
5864 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
5866 return &transaction_stmt->label_norm;
5869 static inline tree
5870 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
5872 return transaction_stmt->label_uninst;
5875 static inline tree *
5876 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
5878 return &transaction_stmt->label_uninst;
5881 static inline tree
5882 gimple_transaction_label_over (const gtransaction *transaction_stmt)
5884 return transaction_stmt->label_over;
5887 static inline tree *
5888 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
5890 return &transaction_stmt->label_over;
5893 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5895 static inline unsigned int
5896 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5898 return transaction_stmt->subcode;
5901 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5902 TRANSACTION_STMT. */
5904 static inline void
5905 gimple_transaction_set_body (gtransaction *transaction_stmt,
5906 gimple_seq body)
5908 transaction_stmt->body = body;
5911 /* Set the label associated with a GIMPLE_TRANSACTION. */
5913 static inline void
5914 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
5916 transaction_stmt->label_norm = label;
5919 static inline void
5920 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
5922 transaction_stmt->label_uninst = label;
5925 static inline void
5926 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
5928 transaction_stmt->label_over = label;
5931 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5933 static inline void
5934 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5935 unsigned int subcode)
5937 transaction_stmt->subcode = subcode;
5940 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5942 static inline tree *
5943 gimple_return_retval_ptr (greturn *gs)
5945 return &gs->op[0];
5948 /* Return the return value for GIMPLE_RETURN GS. */
5950 static inline tree
5951 gimple_return_retval (const greturn *gs)
5953 return gs->op[0];
5957 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5959 static inline void
5960 gimple_return_set_retval (greturn *gs, tree retval)
5962 gs->op[0] = retval;
5966 /* Return the return bounds for GIMPLE_RETURN GS. */
5968 static inline tree
5969 gimple_return_retbnd (const gimple *gs)
5971 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5972 return gimple_op (gs, 1);
5976 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5978 static inline void
5979 gimple_return_set_retbnd (gimple *gs, tree retval)
5981 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5982 gimple_set_op (gs, 1, retval);
5986 /* Returns true when the gimple statement STMT is any of the OMP types. */
5988 #define CASE_GIMPLE_OMP \
5989 case GIMPLE_OMP_PARALLEL: \
5990 case GIMPLE_OMP_TASK: \
5991 case GIMPLE_OMP_FOR: \
5992 case GIMPLE_OMP_SECTIONS: \
5993 case GIMPLE_OMP_SECTIONS_SWITCH: \
5994 case GIMPLE_OMP_SINGLE: \
5995 case GIMPLE_OMP_TARGET: \
5996 case GIMPLE_OMP_TEAMS: \
5997 case GIMPLE_OMP_SECTION: \
5998 case GIMPLE_OMP_MASTER: \
5999 case GIMPLE_OMP_TASKGROUP: \
6000 case GIMPLE_OMP_ORDERED: \
6001 case GIMPLE_OMP_CRITICAL: \
6002 case GIMPLE_OMP_RETURN: \
6003 case GIMPLE_OMP_ATOMIC_LOAD: \
6004 case GIMPLE_OMP_ATOMIC_STORE: \
6005 case GIMPLE_OMP_CONTINUE
6007 static inline bool
6008 is_gimple_omp (const gimple *stmt)
6010 switch (gimple_code (stmt))
6012 CASE_GIMPLE_OMP:
6013 return true;
6014 default:
6015 return false;
6019 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6020 specifically. */
6022 static inline bool
6023 is_gimple_omp_oacc (const gimple *stmt)
6025 gcc_assert (is_gimple_omp (stmt));
6026 switch (gimple_code (stmt))
6028 case GIMPLE_OMP_FOR:
6029 switch (gimple_omp_for_kind (stmt))
6031 case GF_OMP_FOR_KIND_OACC_LOOP:
6032 return true;
6033 default:
6034 return false;
6036 case GIMPLE_OMP_TARGET:
6037 switch (gimple_omp_target_kind (stmt))
6039 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6040 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6041 case GF_OMP_TARGET_KIND_OACC_DATA:
6042 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6043 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6044 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6045 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6046 return true;
6047 default:
6048 return false;
6050 default:
6051 return false;
6056 /* Return true if the OMP gimple statement STMT is offloaded. */
6058 static inline bool
6059 is_gimple_omp_offloaded (const gimple *stmt)
6061 gcc_assert (is_gimple_omp (stmt));
6062 switch (gimple_code (stmt))
6064 case GIMPLE_OMP_TARGET:
6065 switch (gimple_omp_target_kind (stmt))
6067 case GF_OMP_TARGET_KIND_REGION:
6068 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6069 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6070 return true;
6071 default:
6072 return false;
6074 default:
6075 return false;
6080 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6082 static inline bool
6083 gimple_nop_p (const gimple *g)
6085 return gimple_code (g) == GIMPLE_NOP;
6089 /* Return true if GS is a GIMPLE_RESX. */
6091 static inline bool
6092 is_gimple_resx (const gimple *gs)
6094 return gimple_code (gs) == GIMPLE_RESX;
6097 /* Return the type of the main expression computed by STMT. Return
6098 void_type_node if the statement computes nothing. */
6100 static inline tree
6101 gimple_expr_type (const gimple *stmt)
6103 enum gimple_code code = gimple_code (stmt);
6104 /* In general we want to pass out a type that can be substituted
6105 for both the RHS and the LHS types if there is a possibly
6106 useless conversion involved. That means returning the
6107 original RHS type as far as we can reconstruct it. */
6108 if (code == GIMPLE_CALL)
6110 const gcall *call_stmt = as_a <const gcall *> (stmt);
6111 if (gimple_call_internal_p (call_stmt)
6112 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6113 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6114 else
6115 return gimple_call_return_type (call_stmt);
6117 else if (code == GIMPLE_ASSIGN)
6119 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6120 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6121 else
6122 /* As fallback use the type of the LHS. */
6123 return TREE_TYPE (gimple_get_lhs (stmt));
6125 else if (code == GIMPLE_COND)
6126 return boolean_type_node;
6127 else
6128 return void_type_node;
6131 /* Enum and arrays used for allocation stats. Keep in sync with
6132 gimple.c:gimple_alloc_kind_names. */
6133 enum gimple_alloc_kind
6135 gimple_alloc_kind_assign, /* Assignments. */
6136 gimple_alloc_kind_phi, /* PHI nodes. */
6137 gimple_alloc_kind_cond, /* Conditionals. */
6138 gimple_alloc_kind_rest, /* Everything else. */
6139 gimple_alloc_kind_all
6142 extern int gimple_alloc_counts[];
6143 extern int gimple_alloc_sizes[];
6145 /* Return the allocation kind for a given stmt CODE. */
6146 static inline enum gimple_alloc_kind
6147 gimple_alloc_kind (enum gimple_code code)
6149 switch (code)
6151 case GIMPLE_ASSIGN:
6152 return gimple_alloc_kind_assign;
6153 case GIMPLE_PHI:
6154 return gimple_alloc_kind_phi;
6155 case GIMPLE_COND:
6156 return gimple_alloc_kind_cond;
6157 default:
6158 return gimple_alloc_kind_rest;
6162 /* Return true if a location should not be emitted for this statement
6163 by annotate_all_with_location. */
6165 static inline bool
6166 gimple_do_not_emit_location_p (gimple *g)
6168 return gimple_plf (g, GF_PLF_1);
6171 /* Mark statement G so a location will not be emitted by
6172 annotate_one_with_location. */
6174 static inline void
6175 gimple_set_do_not_emit_location (gimple *g)
6177 /* The PLF flags are initialized to 0 when a new tuple is created,
6178 so no need to initialize it anywhere. */
6179 gimple_set_plf (g, GF_PLF_1, true);
6183 /* Macros for showing usage statistics. */
6184 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6185 ? (x) \
6186 : ((x) < 1024*1024*10 \
6187 ? (x) / 1024 \
6188 : (x) / (1024*1024))))
6190 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6192 #endif /* GCC_GIMPLE_H */