2016-10-26 François Dumont <fdumont@gcc.gnu.org>
[official-gcc.git] / gcc / gimple.h
blob0eafada61b46039df0b1e981e4e91fcccc485d51
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2016 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN;
51 #define GIMPLE_CHECK(GS, CODE) \
52 do { \
53 const gimple *__gs = (GS); \
54 if (gimple_code (__gs) != (CODE)) \
55 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
56 (CODE), ERROR_MARK); \
57 } while (0)
58 template <typename T>
59 static inline T
60 GIMPLE_CHECK2(const gimple *gs,
61 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
62 const char *file = __builtin_FILE (),
63 int line = __builtin_LINE (),
64 const char *fun = __builtin_FUNCTION ())
65 #else
66 const char *file = __FILE__,
67 int line = __LINE__,
68 const char *fun = NULL)
69 #endif
71 T ret = dyn_cast <T> (gs);
72 if (!ret)
73 gimple_check_failed (gs, file, line, fun,
74 remove_pointer<T>::type::code_, ERROR_MARK);
75 return ret;
77 template <typename T>
78 static inline T
79 GIMPLE_CHECK2(gimple *gs,
80 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
81 const char *file = __builtin_FILE (),
82 int line = __builtin_LINE (),
83 const char *fun = __builtin_FUNCTION ())
84 #else
85 const char *file = __FILE__,
86 int line = __LINE__,
87 const char *fun = NULL)
88 #endif
90 T ret = dyn_cast <T> (gs);
91 if (!ret)
92 gimple_check_failed (gs, file, line, fun,
93 remove_pointer<T>::type::code_, ERROR_MARK);
94 return ret;
96 #else /* not ENABLE_GIMPLE_CHECKING */
97 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
98 #define GIMPLE_CHECK(GS, CODE) (void)0
99 template <typename T>
100 static inline T
101 GIMPLE_CHECK2(gimple *gs)
103 return as_a <T> (gs);
105 template <typename T>
106 static inline T
107 GIMPLE_CHECK2(const gimple *gs)
109 return as_a <T> (gs);
111 #endif
113 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
114 get_gimple_rhs_class. */
115 enum gimple_rhs_class
117 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
118 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
119 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
120 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
121 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
122 name, a _DECL, a _REF, etc. */
125 /* Specific flags for individual GIMPLE statements. These flags are
126 always stored in gimple.subcode and they may only be
127 defined for statement codes that do not use subcodes.
129 Values for the masks can overlap as long as the overlapping values
130 are never used in the same statement class.
132 The maximum mask value that can be defined is 1 << 15 (i.e., each
133 statement code can hold up to 16 bitflags).
135 Keep this list sorted. */
136 enum gf_mask {
137 GF_ASM_INPUT = 1 << 0,
138 GF_ASM_VOLATILE = 1 << 1,
139 GF_CALL_FROM_THUNK = 1 << 0,
140 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
141 GF_CALL_TAILCALL = 1 << 2,
142 GF_CALL_VA_ARG_PACK = 1 << 3,
143 GF_CALL_NOTHROW = 1 << 4,
144 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
145 GF_CALL_INTERNAL = 1 << 6,
146 GF_CALL_CTRL_ALTERING = 1 << 7,
147 GF_CALL_WITH_BOUNDS = 1 << 8,
148 GF_CALL_MUST_TAIL_CALL = 1 << 9,
149 GF_CALL_BY_DESCRIPTOR = 1 << 10,
150 GF_OMP_PARALLEL_COMBINED = 1 << 0,
151 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
152 GF_OMP_TASK_TASKLOOP = 1 << 0,
153 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
154 GF_OMP_FOR_KIND_FOR = 0,
155 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
156 GF_OMP_FOR_KIND_TASKLOOP = 2,
157 GF_OMP_FOR_KIND_CILKFOR = 3,
158 GF_OMP_FOR_KIND_OACC_LOOP = 4,
159 GF_OMP_FOR_KIND_GRID_LOOP = 5,
160 /* Flag for SIMD variants of OMP_FOR kinds. */
161 GF_OMP_FOR_SIMD = 1 << 3,
162 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
163 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
164 GF_OMP_FOR_COMBINED = 1 << 4,
165 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
166 GF_OMP_FOR_GRID_PHONY = 1 << 6,
167 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
168 GF_OMP_TARGET_KIND_REGION = 0,
169 GF_OMP_TARGET_KIND_DATA = 1,
170 GF_OMP_TARGET_KIND_UPDATE = 2,
171 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
172 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
173 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
174 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
175 GF_OMP_TARGET_KIND_OACC_DATA = 7,
176 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
177 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
178 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
179 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
180 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
182 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
183 a thread synchronization via some sort of barrier. The exact barrier
184 that would otherwise be emitted is dependent on the OMP statement with
185 which this return is associated. */
186 GF_OMP_RETURN_NOWAIT = 1 << 0,
188 GF_OMP_SECTION_LAST = 1 << 0,
189 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
190 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
191 GF_PREDICT_TAKEN = 1 << 15
194 /* Currently, there are only two types of gimple debug stmt. Others are
195 envisioned, for example, to enable the generation of is_stmt notes
196 in line number information, to mark sequence points, etc. This
197 subcode is to be used to tell them apart. */
198 enum gimple_debug_subcode {
199 GIMPLE_DEBUG_BIND = 0,
200 GIMPLE_DEBUG_SOURCE_BIND = 1
203 /* Masks for selecting a pass local flag (PLF) to work on. These
204 masks are used by gimple_set_plf and gimple_plf. */
205 enum plf_mask {
206 GF_PLF_1 = 1 << 0,
207 GF_PLF_2 = 1 << 1
210 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
211 are for 64 bit hosts. */
213 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
214 chain_next ("%h.next"), variable_size))
215 gimple
217 /* [ WORD 1 ]
218 Main identifying code for a tuple. */
219 ENUM_BITFIELD(gimple_code) code : 8;
221 /* Nonzero if a warning should not be emitted on this tuple. */
222 unsigned int no_warning : 1;
224 /* Nonzero if this tuple has been visited. Passes are responsible
225 for clearing this bit before using it. */
226 unsigned int visited : 1;
228 /* Nonzero if this tuple represents a non-temporal move. */
229 unsigned int nontemporal_move : 1;
231 /* Pass local flags. These flags are free for any pass to use as
232 they see fit. Passes should not assume that these flags contain
233 any useful value when the pass starts. Any initial state that
234 the pass requires should be set on entry to the pass. See
235 gimple_set_plf and gimple_plf for usage. */
236 unsigned int plf : 2;
238 /* Nonzero if this statement has been modified and needs to have its
239 operands rescanned. */
240 unsigned modified : 1;
242 /* Nonzero if this statement contains volatile operands. */
243 unsigned has_volatile_ops : 1;
245 /* Padding to get subcode to 16 bit alignment. */
246 unsigned pad : 1;
248 /* The SUBCODE field can be used for tuple-specific flags for tuples
249 that do not require subcodes. Note that SUBCODE should be at
250 least as wide as tree codes, as several tuples store tree codes
251 in there. */
252 unsigned int subcode : 16;
254 /* UID of this statement. This is used by passes that want to
255 assign IDs to statements. It must be assigned and used by each
256 pass. By default it should be assumed to contain garbage. */
257 unsigned uid;
259 /* [ WORD 2 ]
260 Locus information for debug info. */
261 location_t location;
263 /* Number of operands in this tuple. */
264 unsigned num_ops;
266 /* [ WORD 3 ]
267 Basic block holding this statement. */
268 basic_block bb;
270 /* [ WORD 4-5 ]
271 Linked lists of gimple statements. The next pointers form
272 a NULL terminated list, the prev pointers are a cyclic list.
273 A gimple statement is hence also a double-ended list of
274 statements, with the pointer itself being the first element,
275 and the prev pointer being the last. */
276 gimple *next;
277 gimple *GTY((skip)) prev;
281 /* Base structure for tuples with operands. */
283 /* This gimple subclass has no tag value. */
284 struct GTY(())
285 gimple_statement_with_ops_base : public gimple
287 /* [ WORD 1-6 ] : base class */
289 /* [ WORD 7 ]
290 SSA operand vectors. NOTE: It should be possible to
291 amalgamate these vectors with the operand vector OP. However,
292 the SSA operand vectors are organized differently and contain
293 more information (like immediate use chaining). */
294 struct use_optype_d GTY((skip (""))) *use_ops;
298 /* Statements that take register operands. */
300 struct GTY((tag("GSS_WITH_OPS")))
301 gimple_statement_with_ops : public gimple_statement_with_ops_base
303 /* [ WORD 1-7 ] : base class */
305 /* [ WORD 8 ]
306 Operand vector. NOTE! This must always be the last field
307 of this structure. In particular, this means that this
308 structure cannot be embedded inside another one. */
309 tree GTY((length ("%h.num_ops"))) op[1];
313 /* Base for statements that take both memory and register operands. */
315 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
316 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
318 /* [ WORD 1-7 ] : base class */
320 /* [ WORD 8-9 ]
321 Virtual operands for this statement. The GC will pick them
322 up via the ssa_names array. */
323 tree GTY((skip (""))) vdef;
324 tree GTY((skip (""))) vuse;
328 /* Statements that take both memory and register operands. */
330 struct GTY((tag("GSS_WITH_MEM_OPS")))
331 gimple_statement_with_memory_ops :
332 public gimple_statement_with_memory_ops_base
334 /* [ WORD 1-9 ] : base class */
336 /* [ WORD 10 ]
337 Operand vector. NOTE! This must always be the last field
338 of this structure. In particular, this means that this
339 structure cannot be embedded inside another one. */
340 tree GTY((length ("%h.num_ops"))) op[1];
344 /* Call statements that take both memory and register operands. */
346 struct GTY((tag("GSS_CALL")))
347 gcall : public gimple_statement_with_memory_ops_base
349 /* [ WORD 1-9 ] : base class */
351 /* [ WORD 10-13 ] */
352 struct pt_solution call_used;
353 struct pt_solution call_clobbered;
355 /* [ WORD 14 ] */
356 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
357 tree GTY ((tag ("0"))) fntype;
358 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
359 } u;
361 /* [ WORD 15 ]
362 Operand vector. NOTE! This must always be the last field
363 of this structure. In particular, this means that this
364 structure cannot be embedded inside another one. */
365 tree GTY((length ("%h.num_ops"))) op[1];
367 static const enum gimple_code code_ = GIMPLE_CALL;
371 /* OMP statements. */
373 struct GTY((tag("GSS_OMP")))
374 gimple_statement_omp : public gimple
376 /* [ WORD 1-6 ] : base class */
378 /* [ WORD 7 ] */
379 gimple_seq body;
383 /* GIMPLE_BIND */
385 struct GTY((tag("GSS_BIND")))
386 gbind : public gimple
388 /* [ WORD 1-6 ] : base class */
390 /* [ WORD 7 ]
391 Variables declared in this scope. */
392 tree vars;
394 /* [ WORD 8 ]
395 This is different than the BLOCK field in gimple,
396 which is analogous to TREE_BLOCK (i.e., the lexical block holding
397 this statement). This field is the equivalent of BIND_EXPR_BLOCK
398 in tree land (i.e., the lexical scope defined by this bind). See
399 gimple-low.c. */
400 tree block;
402 /* [ WORD 9 ] */
403 gimple_seq body;
407 /* GIMPLE_CATCH */
409 struct GTY((tag("GSS_CATCH")))
410 gcatch : public gimple
412 /* [ WORD 1-6 ] : base class */
414 /* [ WORD 7 ] */
415 tree types;
417 /* [ WORD 8 ] */
418 gimple_seq handler;
422 /* GIMPLE_EH_FILTER */
424 struct GTY((tag("GSS_EH_FILTER")))
425 geh_filter : public gimple
427 /* [ WORD 1-6 ] : base class */
429 /* [ WORD 7 ]
430 Filter types. */
431 tree types;
433 /* [ WORD 8 ]
434 Failure actions. */
435 gimple_seq failure;
438 /* GIMPLE_EH_ELSE */
440 struct GTY((tag("GSS_EH_ELSE")))
441 geh_else : public gimple
443 /* [ WORD 1-6 ] : base class */
445 /* [ WORD 7,8 ] */
446 gimple_seq n_body, e_body;
449 /* GIMPLE_EH_MUST_NOT_THROW */
451 struct GTY((tag("GSS_EH_MNT")))
452 geh_mnt : public gimple
454 /* [ WORD 1-6 ] : base class */
456 /* [ WORD 7 ] Abort function decl. */
457 tree fndecl;
460 /* GIMPLE_PHI */
462 struct GTY((tag("GSS_PHI")))
463 gphi : public gimple
465 /* [ WORD 1-6 ] : base class */
467 /* [ WORD 7 ] */
468 unsigned capacity;
469 unsigned nargs;
471 /* [ WORD 8 ] */
472 tree result;
474 /* [ WORD 9 ] */
475 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
479 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
481 struct GTY((tag("GSS_EH_CTRL")))
482 gimple_statement_eh_ctrl : public gimple
484 /* [ WORD 1-6 ] : base class */
486 /* [ WORD 7 ]
487 Exception region number. */
488 int region;
491 struct GTY((tag("GSS_EH_CTRL")))
492 gresx : public gimple_statement_eh_ctrl
494 /* No extra fields; adds invariant:
495 stmt->code == GIMPLE_RESX. */
498 struct GTY((tag("GSS_EH_CTRL")))
499 geh_dispatch : public gimple_statement_eh_ctrl
501 /* No extra fields; adds invariant:
502 stmt->code == GIMPLE_EH_DISPATH. */
506 /* GIMPLE_TRY */
508 struct GTY((tag("GSS_TRY")))
509 gtry : public gimple
511 /* [ WORD 1-6 ] : base class */
513 /* [ WORD 7 ]
514 Expression to evaluate. */
515 gimple_seq eval;
517 /* [ WORD 8 ]
518 Cleanup expression. */
519 gimple_seq cleanup;
522 /* Kind of GIMPLE_TRY statements. */
523 enum gimple_try_flags
525 /* A try/catch. */
526 GIMPLE_TRY_CATCH = 1 << 0,
528 /* A try/finally. */
529 GIMPLE_TRY_FINALLY = 1 << 1,
530 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
532 /* Analogous to TRY_CATCH_IS_CLEANUP. */
533 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
536 /* GIMPLE_WITH_CLEANUP_EXPR */
538 struct GTY((tag("GSS_WCE")))
539 gimple_statement_wce : public gimple
541 /* [ WORD 1-6 ] : base class */
543 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
544 executed if an exception is thrown, not on normal exit of its
545 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
546 in TARGET_EXPRs. */
548 /* [ WORD 7 ]
549 Cleanup expression. */
550 gimple_seq cleanup;
554 /* GIMPLE_ASM */
556 struct GTY((tag("GSS_ASM")))
557 gasm : public gimple_statement_with_memory_ops_base
559 /* [ WORD 1-9 ] : base class */
561 /* [ WORD 10 ]
562 __asm__ statement. */
563 const char *string;
565 /* [ WORD 11 ]
566 Number of inputs, outputs, clobbers, labels. */
567 unsigned char ni;
568 unsigned char no;
569 unsigned char nc;
570 unsigned char nl;
572 /* [ WORD 12 ]
573 Operand vector. NOTE! This must always be the last field
574 of this structure. In particular, this means that this
575 structure cannot be embedded inside another one. */
576 tree GTY((length ("%h.num_ops"))) op[1];
579 /* GIMPLE_OMP_CRITICAL */
581 struct GTY((tag("GSS_OMP_CRITICAL")))
582 gomp_critical : public gimple_statement_omp
584 /* [ WORD 1-7 ] : base class */
586 /* [ WORD 8 ] */
587 tree clauses;
589 /* [ WORD 9 ]
590 Critical section name. */
591 tree name;
595 struct GTY(()) gimple_omp_for_iter {
596 /* Condition code. */
597 enum tree_code cond;
599 /* Index variable. */
600 tree index;
602 /* Initial value. */
603 tree initial;
605 /* Final value. */
606 tree final;
608 /* Increment. */
609 tree incr;
612 /* GIMPLE_OMP_FOR */
614 struct GTY((tag("GSS_OMP_FOR")))
615 gomp_for : public gimple_statement_omp
617 /* [ WORD 1-7 ] : base class */
619 /* [ WORD 8 ] */
620 tree clauses;
622 /* [ WORD 9 ]
623 Number of elements in iter array. */
624 size_t collapse;
626 /* [ WORD 10 ] */
627 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
629 /* [ WORD 11 ]
630 Pre-body evaluated before the loop body begins. */
631 gimple_seq pre_body;
635 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
637 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
638 gimple_statement_omp_parallel_layout : public gimple_statement_omp
640 /* [ WORD 1-7 ] : base class */
642 /* [ WORD 8 ]
643 Clauses. */
644 tree clauses;
646 /* [ WORD 9 ]
647 Child function holding the body of the parallel region. */
648 tree child_fn;
650 /* [ WORD 10 ]
651 Shared data argument. */
652 tree data_arg;
655 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
656 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
657 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
659 /* No extra fields; adds invariant:
660 stmt->code == GIMPLE_OMP_PARALLEL
661 || stmt->code == GIMPLE_OMP_TASK. */
664 /* GIMPLE_OMP_PARALLEL */
665 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
666 gomp_parallel : public gimple_statement_omp_taskreg
668 /* No extra fields; adds invariant:
669 stmt->code == GIMPLE_OMP_PARALLEL. */
672 /* GIMPLE_OMP_TARGET */
673 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
674 gomp_target : public gimple_statement_omp_parallel_layout
676 /* No extra fields; adds invariant:
677 stmt->code == GIMPLE_OMP_TARGET. */
680 /* GIMPLE_OMP_TASK */
682 struct GTY((tag("GSS_OMP_TASK")))
683 gomp_task : public gimple_statement_omp_taskreg
685 /* [ WORD 1-10 ] : base class */
687 /* [ WORD 11 ]
688 Child function holding firstprivate initialization if needed. */
689 tree copy_fn;
691 /* [ WORD 12-13 ]
692 Size and alignment in bytes of the argument data block. */
693 tree arg_size;
694 tree arg_align;
698 /* GIMPLE_OMP_SECTION */
699 /* Uses struct gimple_statement_omp. */
702 /* GIMPLE_OMP_SECTIONS */
704 struct GTY((tag("GSS_OMP_SECTIONS")))
705 gomp_sections : public gimple_statement_omp
707 /* [ WORD 1-7 ] : base class */
709 /* [ WORD 8 ] */
710 tree clauses;
712 /* [ WORD 9 ]
713 The control variable used for deciding which of the sections to
714 execute. */
715 tree control;
718 /* GIMPLE_OMP_CONTINUE.
720 Note: This does not inherit from gimple_statement_omp, because we
721 do not need the body field. */
723 struct GTY((tag("GSS_OMP_CONTINUE")))
724 gomp_continue : public gimple
726 /* [ WORD 1-6 ] : base class */
728 /* [ WORD 7 ] */
729 tree control_def;
731 /* [ WORD 8 ] */
732 tree control_use;
735 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
737 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
738 gimple_statement_omp_single_layout : public gimple_statement_omp
740 /* [ WORD 1-7 ] : base class */
742 /* [ WORD 8 ] */
743 tree clauses;
746 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
747 gomp_single : public gimple_statement_omp_single_layout
749 /* No extra fields; adds invariant:
750 stmt->code == GIMPLE_OMP_SINGLE. */
753 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
754 gomp_teams : public gimple_statement_omp_single_layout
756 /* No extra fields; adds invariant:
757 stmt->code == GIMPLE_OMP_TEAMS. */
760 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
761 gomp_ordered : public gimple_statement_omp_single_layout
763 /* No extra fields; adds invariant:
764 stmt->code == GIMPLE_OMP_ORDERED. */
768 /* GIMPLE_OMP_ATOMIC_LOAD.
769 Note: This is based on gimple, not g_s_omp, because g_s_omp
770 contains a sequence, which we don't need here. */
772 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
773 gomp_atomic_load : public gimple
775 /* [ WORD 1-6 ] : base class */
777 /* [ WORD 7-8 ] */
778 tree rhs, lhs;
781 /* GIMPLE_OMP_ATOMIC_STORE.
782 See note on GIMPLE_OMP_ATOMIC_LOAD. */
784 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
785 gimple_statement_omp_atomic_store_layout : public gimple
787 /* [ WORD 1-6 ] : base class */
789 /* [ WORD 7 ] */
790 tree val;
793 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
794 gomp_atomic_store :
795 public gimple_statement_omp_atomic_store_layout
797 /* No extra fields; adds invariant:
798 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
801 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
802 gimple_statement_omp_return :
803 public gimple_statement_omp_atomic_store_layout
805 /* No extra fields; adds invariant:
806 stmt->code == GIMPLE_OMP_RETURN. */
809 /* GIMPLE_TRANSACTION. */
811 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
813 /* The __transaction_atomic was declared [[outer]] or it is
814 __transaction_relaxed. */
815 #define GTMA_IS_OUTER (1u << 0)
816 #define GTMA_IS_RELAXED (1u << 1)
817 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
819 /* The transaction is seen to not have an abort. */
820 #define GTMA_HAVE_ABORT (1u << 2)
821 /* The transaction is seen to have loads or stores. */
822 #define GTMA_HAVE_LOAD (1u << 3)
823 #define GTMA_HAVE_STORE (1u << 4)
824 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
825 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
826 /* The transaction WILL enter serial irrevocable mode.
827 An irrevocable block post-dominates the entire transaction, such
828 that all invocations of the transaction will go serial-irrevocable.
829 In such case, we don't bother instrumenting the transaction, and
830 tell the runtime that it should begin the transaction in
831 serial-irrevocable mode. */
832 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
833 /* The transaction contains no instrumentation code whatsover, most
834 likely because it is guaranteed to go irrevocable upon entry. */
835 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
837 struct GTY((tag("GSS_TRANSACTION")))
838 gtransaction : public gimple_statement_with_memory_ops_base
840 /* [ WORD 1-9 ] : base class */
842 /* [ WORD 10 ] */
843 gimple_seq body;
845 /* [ WORD 11-13 ] */
846 tree label_norm;
847 tree label_uninst;
848 tree label_over;
851 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
852 enum gimple_statement_structure_enum {
853 #include "gsstruct.def"
854 LAST_GSS_ENUM
856 #undef DEFGSSTRUCT
858 /* A statement with the invariant that
859 stmt->code == GIMPLE_COND
860 i.e. a conditional jump statement. */
862 struct GTY((tag("GSS_WITH_OPS")))
863 gcond : public gimple_statement_with_ops
865 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
866 static const enum gimple_code code_ = GIMPLE_COND;
869 /* A statement with the invariant that
870 stmt->code == GIMPLE_DEBUG
871 i.e. a debug statement. */
873 struct GTY((tag("GSS_WITH_OPS")))
874 gdebug : public gimple_statement_with_ops
876 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
879 /* A statement with the invariant that
880 stmt->code == GIMPLE_GOTO
881 i.e. a goto statement. */
883 struct GTY((tag("GSS_WITH_OPS")))
884 ggoto : public gimple_statement_with_ops
886 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
889 /* A statement with the invariant that
890 stmt->code == GIMPLE_LABEL
891 i.e. a label statement. */
893 struct GTY((tag("GSS_WITH_OPS")))
894 glabel : public gimple_statement_with_ops
896 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
899 /* A statement with the invariant that
900 stmt->code == GIMPLE_SWITCH
901 i.e. a switch statement. */
903 struct GTY((tag("GSS_WITH_OPS")))
904 gswitch : public gimple_statement_with_ops
906 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
909 /* A statement with the invariant that
910 stmt->code == GIMPLE_ASSIGN
911 i.e. an assignment statement. */
913 struct GTY((tag("GSS_WITH_MEM_OPS")))
914 gassign : public gimple_statement_with_memory_ops
916 static const enum gimple_code code_ = GIMPLE_ASSIGN;
917 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
920 /* A statement with the invariant that
921 stmt->code == GIMPLE_RETURN
922 i.e. a return statement. */
924 struct GTY((tag("GSS_WITH_MEM_OPS")))
925 greturn : public gimple_statement_with_memory_ops
927 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
930 template <>
931 template <>
932 inline bool
933 is_a_helper <gasm *>::test (gimple *gs)
935 return gs->code == GIMPLE_ASM;
938 template <>
939 template <>
940 inline bool
941 is_a_helper <gassign *>::test (gimple *gs)
943 return gs->code == GIMPLE_ASSIGN;
946 template <>
947 template <>
948 inline bool
949 is_a_helper <const gassign *>::test (const gimple *gs)
951 return gs->code == GIMPLE_ASSIGN;
954 template <>
955 template <>
956 inline bool
957 is_a_helper <gbind *>::test (gimple *gs)
959 return gs->code == GIMPLE_BIND;
962 template <>
963 template <>
964 inline bool
965 is_a_helper <gcall *>::test (gimple *gs)
967 return gs->code == GIMPLE_CALL;
970 template <>
971 template <>
972 inline bool
973 is_a_helper <gcatch *>::test (gimple *gs)
975 return gs->code == GIMPLE_CATCH;
978 template <>
979 template <>
980 inline bool
981 is_a_helper <gcond *>::test (gimple *gs)
983 return gs->code == GIMPLE_COND;
986 template <>
987 template <>
988 inline bool
989 is_a_helper <const gcond *>::test (const gimple *gs)
991 return gs->code == GIMPLE_COND;
994 template <>
995 template <>
996 inline bool
997 is_a_helper <gdebug *>::test (gimple *gs)
999 return gs->code == GIMPLE_DEBUG;
1002 template <>
1003 template <>
1004 inline bool
1005 is_a_helper <ggoto *>::test (gimple *gs)
1007 return gs->code == GIMPLE_GOTO;
1010 template <>
1011 template <>
1012 inline bool
1013 is_a_helper <glabel *>::test (gimple *gs)
1015 return gs->code == GIMPLE_LABEL;
1018 template <>
1019 template <>
1020 inline bool
1021 is_a_helper <gresx *>::test (gimple *gs)
1023 return gs->code == GIMPLE_RESX;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <geh_dispatch *>::test (gimple *gs)
1031 return gs->code == GIMPLE_EH_DISPATCH;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <geh_else *>::test (gimple *gs)
1039 return gs->code == GIMPLE_EH_ELSE;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <geh_filter *>::test (gimple *gs)
1047 return gs->code == GIMPLE_EH_FILTER;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <geh_mnt *>::test (gimple *gs)
1055 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1063 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1071 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1079 return gs->code == GIMPLE_OMP_RETURN;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <gomp_continue *>::test (gimple *gs)
1087 return gs->code == GIMPLE_OMP_CONTINUE;
1090 template <>
1091 template <>
1092 inline bool
1093 is_a_helper <gomp_critical *>::test (gimple *gs)
1095 return gs->code == GIMPLE_OMP_CRITICAL;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <gomp_ordered *>::test (gimple *gs)
1103 return gs->code == GIMPLE_OMP_ORDERED;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <gomp_for *>::test (gimple *gs)
1111 return gs->code == GIMPLE_OMP_FOR;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1119 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <gomp_parallel *>::test (gimple *gs)
1127 return gs->code == GIMPLE_OMP_PARALLEL;
1130 template <>
1131 template <>
1132 inline bool
1133 is_a_helper <gomp_target *>::test (gimple *gs)
1135 return gs->code == GIMPLE_OMP_TARGET;
1138 template <>
1139 template <>
1140 inline bool
1141 is_a_helper <gomp_sections *>::test (gimple *gs)
1143 return gs->code == GIMPLE_OMP_SECTIONS;
1146 template <>
1147 template <>
1148 inline bool
1149 is_a_helper <gomp_single *>::test (gimple *gs)
1151 return gs->code == GIMPLE_OMP_SINGLE;
1154 template <>
1155 template <>
1156 inline bool
1157 is_a_helper <gomp_teams *>::test (gimple *gs)
1159 return gs->code == GIMPLE_OMP_TEAMS;
1162 template <>
1163 template <>
1164 inline bool
1165 is_a_helper <gomp_task *>::test (gimple *gs)
1167 return gs->code == GIMPLE_OMP_TASK;
1170 template <>
1171 template <>
1172 inline bool
1173 is_a_helper <gphi *>::test (gimple *gs)
1175 return gs->code == GIMPLE_PHI;
1178 template <>
1179 template <>
1180 inline bool
1181 is_a_helper <greturn *>::test (gimple *gs)
1183 return gs->code == GIMPLE_RETURN;
1186 template <>
1187 template <>
1188 inline bool
1189 is_a_helper <gswitch *>::test (gimple *gs)
1191 return gs->code == GIMPLE_SWITCH;
1194 template <>
1195 template <>
1196 inline bool
1197 is_a_helper <gtransaction *>::test (gimple *gs)
1199 return gs->code == GIMPLE_TRANSACTION;
1202 template <>
1203 template <>
1204 inline bool
1205 is_a_helper <gtry *>::test (gimple *gs)
1207 return gs->code == GIMPLE_TRY;
1210 template <>
1211 template <>
1212 inline bool
1213 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1215 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1218 template <>
1219 template <>
1220 inline bool
1221 is_a_helper <const gasm *>::test (const gimple *gs)
1223 return gs->code == GIMPLE_ASM;
1226 template <>
1227 template <>
1228 inline bool
1229 is_a_helper <const gbind *>::test (const gimple *gs)
1231 return gs->code == GIMPLE_BIND;
1234 template <>
1235 template <>
1236 inline bool
1237 is_a_helper <const gcall *>::test (const gimple *gs)
1239 return gs->code == GIMPLE_CALL;
1242 template <>
1243 template <>
1244 inline bool
1245 is_a_helper <const gcatch *>::test (const gimple *gs)
1247 return gs->code == GIMPLE_CATCH;
1250 template <>
1251 template <>
1252 inline bool
1253 is_a_helper <const gresx *>::test (const gimple *gs)
1255 return gs->code == GIMPLE_RESX;
1258 template <>
1259 template <>
1260 inline bool
1261 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1263 return gs->code == GIMPLE_EH_DISPATCH;
1266 template <>
1267 template <>
1268 inline bool
1269 is_a_helper <const geh_filter *>::test (const gimple *gs)
1271 return gs->code == GIMPLE_EH_FILTER;
1274 template <>
1275 template <>
1276 inline bool
1277 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1279 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1282 template <>
1283 template <>
1284 inline bool
1285 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1287 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1290 template <>
1291 template <>
1292 inline bool
1293 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1295 return gs->code == GIMPLE_OMP_RETURN;
1298 template <>
1299 template <>
1300 inline bool
1301 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1303 return gs->code == GIMPLE_OMP_CONTINUE;
1306 template <>
1307 template <>
1308 inline bool
1309 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1311 return gs->code == GIMPLE_OMP_CRITICAL;
1314 template <>
1315 template <>
1316 inline bool
1317 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1319 return gs->code == GIMPLE_OMP_ORDERED;
1322 template <>
1323 template <>
1324 inline bool
1325 is_a_helper <const gomp_for *>::test (const gimple *gs)
1327 return gs->code == GIMPLE_OMP_FOR;
1330 template <>
1331 template <>
1332 inline bool
1333 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1335 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1338 template <>
1339 template <>
1340 inline bool
1341 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1343 return gs->code == GIMPLE_OMP_PARALLEL;
1346 template <>
1347 template <>
1348 inline bool
1349 is_a_helper <const gomp_target *>::test (const gimple *gs)
1351 return gs->code == GIMPLE_OMP_TARGET;
1354 template <>
1355 template <>
1356 inline bool
1357 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1359 return gs->code == GIMPLE_OMP_SECTIONS;
1362 template <>
1363 template <>
1364 inline bool
1365 is_a_helper <const gomp_single *>::test (const gimple *gs)
1367 return gs->code == GIMPLE_OMP_SINGLE;
1370 template <>
1371 template <>
1372 inline bool
1373 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1375 return gs->code == GIMPLE_OMP_TEAMS;
1378 template <>
1379 template <>
1380 inline bool
1381 is_a_helper <const gomp_task *>::test (const gimple *gs)
1383 return gs->code == GIMPLE_OMP_TASK;
1386 template <>
1387 template <>
1388 inline bool
1389 is_a_helper <const gphi *>::test (const gimple *gs)
1391 return gs->code == GIMPLE_PHI;
1394 template <>
1395 template <>
1396 inline bool
1397 is_a_helper <const gtransaction *>::test (const gimple *gs)
1399 return gs->code == GIMPLE_TRANSACTION;
1402 /* Offset in bytes to the location of the operand vector.
1403 Zero if there is no operand vector for this tuple structure. */
1404 extern size_t const gimple_ops_offset_[];
1406 /* Map GIMPLE codes to GSS codes. */
1407 extern enum gimple_statement_structure_enum const gss_for_code_[];
1409 /* This variable holds the currently expanded gimple statement for purposes
1410 of comminucating the profile info to the builtin expanders. */
1411 extern gimple *currently_expanding_gimple_stmt;
1413 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1414 gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1415 greturn *gimple_build_return (tree);
1416 void gimple_call_reset_alias_info (gcall *);
1417 gcall *gimple_build_call_vec (tree, vec<tree> );
1418 gcall *gimple_build_call (tree, unsigned, ...);
1419 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1420 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1421 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1422 gcall *gimple_build_call_from_tree (tree);
1423 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1424 gassign *gimple_build_assign (tree, enum tree_code,
1425 tree, tree, tree CXX_MEM_STAT_INFO);
1426 gassign *gimple_build_assign (tree, enum tree_code,
1427 tree, tree CXX_MEM_STAT_INFO);
1428 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1429 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1430 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1431 void gimple_cond_set_condition_from_tree (gcond *, tree);
1432 glabel *gimple_build_label (tree label);
1433 ggoto *gimple_build_goto (tree dest);
1434 gimple *gimple_build_nop (void);
1435 gbind *gimple_build_bind (tree, gimple_seq, tree);
1436 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1437 vec<tree, va_gc> *, vec<tree, va_gc> *,
1438 vec<tree, va_gc> *);
1439 gcatch *gimple_build_catch (tree, gimple_seq);
1440 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1441 geh_mnt *gimple_build_eh_must_not_throw (tree);
1442 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1443 gtry *gimple_build_try (gimple_seq, gimple_seq,
1444 enum gimple_try_flags);
1445 gimple *gimple_build_wce (gimple_seq);
1446 gresx *gimple_build_resx (int);
1447 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1448 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1449 geh_dispatch *gimple_build_eh_dispatch (int);
1450 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1451 #define gimple_build_debug_bind(var,val,stmt) \
1452 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1453 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1454 #define gimple_build_debug_source_bind(var,val,stmt) \
1455 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1456 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1457 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1458 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1459 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1460 tree, tree);
1461 gimple *gimple_build_omp_section (gimple_seq);
1462 gimple *gimple_build_omp_master (gimple_seq);
1463 gimple *gimple_build_omp_grid_body (gimple_seq);
1464 gimple *gimple_build_omp_taskgroup (gimple_seq);
1465 gomp_continue *gimple_build_omp_continue (tree, tree);
1466 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1467 gimple *gimple_build_omp_return (bool);
1468 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1469 gimple *gimple_build_omp_sections_switch (void);
1470 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1471 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1472 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1473 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1474 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1475 gtransaction *gimple_build_transaction (gimple_seq);
1476 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1477 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1478 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1479 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1480 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1481 location_t);
1482 extern void annotate_all_with_location (gimple_seq, location_t);
1483 bool empty_body_p (gimple_seq);
1484 gimple_seq gimple_seq_copy (gimple_seq);
1485 bool gimple_call_same_target_p (const gimple *, const gimple *);
1486 int gimple_call_flags (const gimple *);
1487 int gimple_call_arg_flags (const gcall *, unsigned);
1488 int gimple_call_return_flags (const gcall *);
1489 bool gimple_assign_copy_p (gimple *);
1490 bool gimple_assign_ssa_name_copy_p (gimple *);
1491 bool gimple_assign_unary_nop_p (gimple *);
1492 void gimple_set_bb (gimple *, basic_block);
1493 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1494 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1495 tree, tree, tree);
1496 tree gimple_get_lhs (const gimple *);
1497 void gimple_set_lhs (gimple *, tree);
1498 gimple *gimple_copy (gimple *);
1499 bool gimple_has_side_effects (const gimple *);
1500 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1501 bool gimple_could_trap_p (gimple *);
1502 bool gimple_assign_rhs_could_trap_p (gimple *);
1503 extern void dump_gimple_statistics (void);
1504 unsigned get_gimple_rhs_num_ops (enum tree_code);
1505 extern tree canonicalize_cond_expr_cond (tree);
1506 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1507 extern bool gimple_compare_field_offset (tree, tree);
1508 extern tree gimple_unsigned_type (tree);
1509 extern tree gimple_signed_type (tree);
1510 extern alias_set_type gimple_get_alias_set (tree);
1511 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1512 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1513 extern combined_fn gimple_call_combined_fn (const gimple *);
1514 extern bool gimple_call_builtin_p (const gimple *);
1515 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1516 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1517 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1518 extern void dump_decl_set (FILE *, bitmap);
1519 extern bool nonfreeing_call_p (gimple *);
1520 extern bool nonbarrier_call_p (gimple *);
1521 extern bool infer_nonnull_range (gimple *, tree);
1522 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1523 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1524 extern void sort_case_labels (vec<tree>);
1525 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1526 extern void gimple_seq_set_location (gimple_seq, location_t);
1527 extern void gimple_seq_discard (gimple_seq);
1528 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1529 extern bool gimple_inexpensive_call_p (gcall *);
1530 extern bool stmt_can_terminate_bb_p (gimple *);
1532 /* Formal (expression) temporary table handling: multiple occurrences of
1533 the same scalar expression are evaluated into the same temporary. */
1535 typedef struct gimple_temp_hash_elt
1537 tree val; /* Key */
1538 tree temp; /* Value */
1539 } elt_t;
1541 /* Get the number of the next statement uid to be allocated. */
1542 static inline unsigned int
1543 gimple_stmt_max_uid (struct function *fn)
1545 return fn->last_stmt_uid;
1548 /* Set the number of the next statement uid to be allocated. */
1549 static inline void
1550 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1552 fn->last_stmt_uid = maxid;
1555 /* Set the number of the next statement uid to be allocated. */
1556 static inline unsigned int
1557 inc_gimple_stmt_max_uid (struct function *fn)
1559 return fn->last_stmt_uid++;
1562 /* Return the first node in GIMPLE sequence S. */
1564 static inline gimple_seq_node
1565 gimple_seq_first (gimple_seq s)
1567 return s;
1571 /* Return the first statement in GIMPLE sequence S. */
1573 static inline gimple *
1574 gimple_seq_first_stmt (gimple_seq s)
1576 gimple_seq_node n = gimple_seq_first (s);
1577 return n;
1580 /* Return the first statement in GIMPLE sequence S as a gbind *,
1581 verifying that it has code GIMPLE_BIND in a checked build. */
1583 static inline gbind *
1584 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1586 gimple_seq_node n = gimple_seq_first (s);
1587 return as_a <gbind *> (n);
1591 /* Return the last node in GIMPLE sequence S. */
1593 static inline gimple_seq_node
1594 gimple_seq_last (gimple_seq s)
1596 return s ? s->prev : NULL;
1600 /* Return the last statement in GIMPLE sequence S. */
1602 static inline gimple *
1603 gimple_seq_last_stmt (gimple_seq s)
1605 gimple_seq_node n = gimple_seq_last (s);
1606 return n;
1610 /* Set the last node in GIMPLE sequence *PS to LAST. */
1612 static inline void
1613 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1615 (*ps)->prev = last;
1619 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1621 static inline void
1622 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1624 *ps = first;
1628 /* Return true if GIMPLE sequence S is empty. */
1630 static inline bool
1631 gimple_seq_empty_p (gimple_seq s)
1633 return s == NULL;
1636 /* Allocate a new sequence and initialize its first element with STMT. */
1638 static inline gimple_seq
1639 gimple_seq_alloc_with_stmt (gimple *stmt)
1641 gimple_seq seq = NULL;
1642 gimple_seq_add_stmt (&seq, stmt);
1643 return seq;
1647 /* Returns the sequence of statements in BB. */
1649 static inline gimple_seq
1650 bb_seq (const_basic_block bb)
1652 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1655 static inline gimple_seq *
1656 bb_seq_addr (basic_block bb)
1658 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1661 /* Sets the sequence of statements in BB to SEQ. */
1663 static inline void
1664 set_bb_seq (basic_block bb, gimple_seq seq)
1666 gcc_checking_assert (!(bb->flags & BB_RTL));
1667 bb->il.gimple.seq = seq;
1671 /* Return the code for GIMPLE statement G. */
1673 static inline enum gimple_code
1674 gimple_code (const gimple *g)
1676 return g->code;
1680 /* Return the GSS code used by a GIMPLE code. */
1682 static inline enum gimple_statement_structure_enum
1683 gss_for_code (enum gimple_code code)
1685 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1686 return gss_for_code_[code];
1690 /* Return which GSS code is used by GS. */
1692 static inline enum gimple_statement_structure_enum
1693 gimple_statement_structure (gimple *gs)
1695 return gss_for_code (gimple_code (gs));
1699 /* Return true if statement G has sub-statements. This is only true for
1700 High GIMPLE statements. */
1702 static inline bool
1703 gimple_has_substatements (gimple *g)
1705 switch (gimple_code (g))
1707 case GIMPLE_BIND:
1708 case GIMPLE_CATCH:
1709 case GIMPLE_EH_FILTER:
1710 case GIMPLE_EH_ELSE:
1711 case GIMPLE_TRY:
1712 case GIMPLE_OMP_FOR:
1713 case GIMPLE_OMP_MASTER:
1714 case GIMPLE_OMP_TASKGROUP:
1715 case GIMPLE_OMP_ORDERED:
1716 case GIMPLE_OMP_SECTION:
1717 case GIMPLE_OMP_PARALLEL:
1718 case GIMPLE_OMP_TASK:
1719 case GIMPLE_OMP_SECTIONS:
1720 case GIMPLE_OMP_SINGLE:
1721 case GIMPLE_OMP_TARGET:
1722 case GIMPLE_OMP_TEAMS:
1723 case GIMPLE_OMP_CRITICAL:
1724 case GIMPLE_WITH_CLEANUP_EXPR:
1725 case GIMPLE_TRANSACTION:
1726 case GIMPLE_OMP_GRID_BODY:
1727 return true;
1729 default:
1730 return false;
1735 /* Return the basic block holding statement G. */
1737 static inline basic_block
1738 gimple_bb (const gimple *g)
1740 return g->bb;
1744 /* Return the lexical scope block holding statement G. */
1746 static inline tree
1747 gimple_block (const gimple *g)
1749 return LOCATION_BLOCK (g->location);
1753 /* Set BLOCK to be the lexical scope block holding statement G. */
1755 static inline void
1756 gimple_set_block (gimple *g, tree block)
1758 g->location = set_block (g->location, block);
1762 /* Return location information for statement G. */
1764 static inline location_t
1765 gimple_location (const gimple *g)
1767 return g->location;
1770 /* Return location information for statement G if g is not NULL.
1771 Otherwise, UNKNOWN_LOCATION is returned. */
1773 static inline location_t
1774 gimple_location_safe (const gimple *g)
1776 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1779 /* Set location information for statement G. */
1781 static inline void
1782 gimple_set_location (gimple *g, location_t location)
1784 g->location = location;
1788 /* Return true if G contains location information. */
1790 static inline bool
1791 gimple_has_location (const gimple *g)
1793 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1797 /* Return the file name of the location of STMT. */
1799 static inline const char *
1800 gimple_filename (const gimple *stmt)
1802 return LOCATION_FILE (gimple_location (stmt));
1806 /* Return the line number of the location of STMT. */
1808 static inline int
1809 gimple_lineno (const gimple *stmt)
1811 return LOCATION_LINE (gimple_location (stmt));
1815 /* Determine whether SEQ is a singleton. */
1817 static inline bool
1818 gimple_seq_singleton_p (gimple_seq seq)
1820 return ((gimple_seq_first (seq) != NULL)
1821 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1824 /* Return true if no warnings should be emitted for statement STMT. */
1826 static inline bool
1827 gimple_no_warning_p (const gimple *stmt)
1829 return stmt->no_warning;
1832 /* Set the no_warning flag of STMT to NO_WARNING. */
1834 static inline void
1835 gimple_set_no_warning (gimple *stmt, bool no_warning)
1837 stmt->no_warning = (unsigned) no_warning;
1840 /* Set the visited status on statement STMT to VISITED_P.
1842 Please note that this 'visited' property of the gimple statement is
1843 supposed to be undefined at pass boundaries. This means that a
1844 given pass should not assume it contains any useful value when the
1845 pass starts and thus can set it to any value it sees fit.
1847 You can learn more about the visited property of the gimple
1848 statement by reading the comments of the 'visited' data member of
1849 struct gimple.
1852 static inline void
1853 gimple_set_visited (gimple *stmt, bool visited_p)
1855 stmt->visited = (unsigned) visited_p;
1859 /* Return the visited status for statement STMT.
1861 Please note that this 'visited' property of the gimple statement is
1862 supposed to be undefined at pass boundaries. This means that a
1863 given pass should not assume it contains any useful value when the
1864 pass starts and thus can set it to any value it sees fit.
1866 You can learn more about the visited property of the gimple
1867 statement by reading the comments of the 'visited' data member of
1868 struct gimple. */
1870 static inline bool
1871 gimple_visited_p (gimple *stmt)
1873 return stmt->visited;
1877 /* Set pass local flag PLF on statement STMT to VAL_P.
1879 Please note that this PLF property of the gimple statement is
1880 supposed to be undefined at pass boundaries. This means that a
1881 given pass should not assume it contains any useful value when the
1882 pass starts and thus can set it to any value it sees fit.
1884 You can learn more about the PLF property by reading the comment of
1885 the 'plf' data member of struct gimple_statement_structure. */
1887 static inline void
1888 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1890 if (val_p)
1891 stmt->plf |= (unsigned int) plf;
1892 else
1893 stmt->plf &= ~((unsigned int) plf);
1897 /* Return the value of pass local flag PLF on statement STMT.
1899 Please note that this 'plf' property of the gimple statement is
1900 supposed to be undefined at pass boundaries. This means that a
1901 given pass should not assume it contains any useful value when the
1902 pass starts and thus can set it to any value it sees fit.
1904 You can learn more about the plf property by reading the comment of
1905 the 'plf' data member of struct gimple_statement_structure. */
1907 static inline unsigned int
1908 gimple_plf (gimple *stmt, enum plf_mask plf)
1910 return stmt->plf & ((unsigned int) plf);
1914 /* Set the UID of statement.
1916 Please note that this UID property is supposed to be undefined at
1917 pass boundaries. This means that a given pass should not assume it
1918 contains any useful value when the pass starts and thus can set it
1919 to any value it sees fit. */
1921 static inline void
1922 gimple_set_uid (gimple *g, unsigned uid)
1924 g->uid = uid;
1928 /* Return the UID of statement.
1930 Please note that this UID property is supposed to be undefined at
1931 pass boundaries. This means that a given pass should not assume it
1932 contains any useful value when the pass starts and thus can set it
1933 to any value it sees fit. */
1935 static inline unsigned
1936 gimple_uid (const gimple *g)
1938 return g->uid;
1942 /* Make statement G a singleton sequence. */
1944 static inline void
1945 gimple_init_singleton (gimple *g)
1947 g->next = NULL;
1948 g->prev = g;
1952 /* Return true if GIMPLE statement G has register or memory operands. */
1954 static inline bool
1955 gimple_has_ops (const gimple *g)
1957 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1960 template <>
1961 template <>
1962 inline bool
1963 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1965 return gimple_has_ops (gs);
1968 template <>
1969 template <>
1970 inline bool
1971 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1973 return gimple_has_ops (gs);
1976 /* Return true if GIMPLE statement G has memory operands. */
1978 static inline bool
1979 gimple_has_mem_ops (const gimple *g)
1981 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1984 template <>
1985 template <>
1986 inline bool
1987 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1989 return gimple_has_mem_ops (gs);
1992 template <>
1993 template <>
1994 inline bool
1995 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1997 return gimple_has_mem_ops (gs);
2000 /* Return the set of USE operands for statement G. */
2002 static inline struct use_optype_d *
2003 gimple_use_ops (const gimple *g)
2005 const gimple_statement_with_ops *ops_stmt =
2006 dyn_cast <const gimple_statement_with_ops *> (g);
2007 if (!ops_stmt)
2008 return NULL;
2009 return ops_stmt->use_ops;
2013 /* Set USE to be the set of USE operands for statement G. */
2015 static inline void
2016 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2018 gimple_statement_with_ops *ops_stmt =
2019 as_a <gimple_statement_with_ops *> (g);
2020 ops_stmt->use_ops = use;
2024 /* Return the single VUSE operand of the statement G. */
2026 static inline tree
2027 gimple_vuse (const gimple *g)
2029 const gimple_statement_with_memory_ops *mem_ops_stmt =
2030 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2031 if (!mem_ops_stmt)
2032 return NULL_TREE;
2033 return mem_ops_stmt->vuse;
2036 /* Return the single VDEF operand of the statement G. */
2038 static inline tree
2039 gimple_vdef (const gimple *g)
2041 const gimple_statement_with_memory_ops *mem_ops_stmt =
2042 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2043 if (!mem_ops_stmt)
2044 return NULL_TREE;
2045 return mem_ops_stmt->vdef;
2048 /* Return the single VUSE operand of the statement G. */
2050 static inline tree *
2051 gimple_vuse_ptr (gimple *g)
2053 gimple_statement_with_memory_ops *mem_ops_stmt =
2054 dyn_cast <gimple_statement_with_memory_ops *> (g);
2055 if (!mem_ops_stmt)
2056 return NULL;
2057 return &mem_ops_stmt->vuse;
2060 /* Return the single VDEF operand of the statement G. */
2062 static inline tree *
2063 gimple_vdef_ptr (gimple *g)
2065 gimple_statement_with_memory_ops *mem_ops_stmt =
2066 dyn_cast <gimple_statement_with_memory_ops *> (g);
2067 if (!mem_ops_stmt)
2068 return NULL;
2069 return &mem_ops_stmt->vdef;
2072 /* Set the single VUSE operand of the statement G. */
2074 static inline void
2075 gimple_set_vuse (gimple *g, tree vuse)
2077 gimple_statement_with_memory_ops *mem_ops_stmt =
2078 as_a <gimple_statement_with_memory_ops *> (g);
2079 mem_ops_stmt->vuse = vuse;
2082 /* Set the single VDEF operand of the statement G. */
2084 static inline void
2085 gimple_set_vdef (gimple *g, tree vdef)
2087 gimple_statement_with_memory_ops *mem_ops_stmt =
2088 as_a <gimple_statement_with_memory_ops *> (g);
2089 mem_ops_stmt->vdef = vdef;
2093 /* Return true if statement G has operands and the modified field has
2094 been set. */
2096 static inline bool
2097 gimple_modified_p (const gimple *g)
2099 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2103 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2104 a MODIFIED field. */
2106 static inline void
2107 gimple_set_modified (gimple *s, bool modifiedp)
2109 if (gimple_has_ops (s))
2110 s->modified = (unsigned) modifiedp;
2114 /* Return the tree code for the expression computed by STMT. This is
2115 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2116 GIMPLE_CALL, return CALL_EXPR as the expression code for
2117 consistency. This is useful when the caller needs to deal with the
2118 three kinds of computation that GIMPLE supports. */
2120 static inline enum tree_code
2121 gimple_expr_code (const gimple *stmt)
2123 enum gimple_code code = gimple_code (stmt);
2124 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2125 return (enum tree_code) stmt->subcode;
2126 else
2128 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2129 return CALL_EXPR;
2134 /* Return true if statement STMT contains volatile operands. */
2136 static inline bool
2137 gimple_has_volatile_ops (const gimple *stmt)
2139 if (gimple_has_mem_ops (stmt))
2140 return stmt->has_volatile_ops;
2141 else
2142 return false;
2146 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2148 static inline void
2149 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2151 if (gimple_has_mem_ops (stmt))
2152 stmt->has_volatile_ops = (unsigned) volatilep;
2155 /* Return true if STMT is in a transaction. */
2157 static inline bool
2158 gimple_in_transaction (const gimple *stmt)
2160 return bb_in_transaction (gimple_bb (stmt));
2163 /* Return true if statement STMT may access memory. */
2165 static inline bool
2166 gimple_references_memory_p (gimple *stmt)
2168 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2172 /* Return the subcode for OMP statement S. */
2174 static inline unsigned
2175 gimple_omp_subcode (const gimple *s)
2177 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2178 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2179 return s->subcode;
2182 /* Set the subcode for OMP statement S to SUBCODE. */
2184 static inline void
2185 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2187 /* We only have 16 bits for the subcode. Assert that we are not
2188 overflowing it. */
2189 gcc_gimple_checking_assert (subcode < (1 << 16));
2190 s->subcode = subcode;
2193 /* Set the nowait flag on OMP_RETURN statement S. */
2195 static inline void
2196 gimple_omp_return_set_nowait (gimple *s)
2198 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2199 s->subcode |= GF_OMP_RETURN_NOWAIT;
2203 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2204 flag set. */
2206 static inline bool
2207 gimple_omp_return_nowait_p (const gimple *g)
2209 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2210 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2214 /* Set the LHS of OMP return. */
2216 static inline void
2217 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2219 gimple_statement_omp_return *omp_return_stmt =
2220 as_a <gimple_statement_omp_return *> (g);
2221 omp_return_stmt->val = lhs;
2225 /* Get the LHS of OMP return. */
2227 static inline tree
2228 gimple_omp_return_lhs (const gimple *g)
2230 const gimple_statement_omp_return *omp_return_stmt =
2231 as_a <const gimple_statement_omp_return *> (g);
2232 return omp_return_stmt->val;
2236 /* Return a pointer to the LHS of OMP return. */
2238 static inline tree *
2239 gimple_omp_return_lhs_ptr (gimple *g)
2241 gimple_statement_omp_return *omp_return_stmt =
2242 as_a <gimple_statement_omp_return *> (g);
2243 return &omp_return_stmt->val;
2247 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2248 flag set. */
2250 static inline bool
2251 gimple_omp_section_last_p (const gimple *g)
2253 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2254 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2258 /* Set the GF_OMP_SECTION_LAST flag on G. */
2260 static inline void
2261 gimple_omp_section_set_last (gimple *g)
2263 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2264 g->subcode |= GF_OMP_SECTION_LAST;
2268 /* Return true if OMP parallel statement G has the
2269 GF_OMP_PARALLEL_COMBINED flag set. */
2271 static inline bool
2272 gimple_omp_parallel_combined_p (const gimple *g)
2274 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2275 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2279 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2280 value of COMBINED_P. */
2282 static inline void
2283 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2285 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2286 if (combined_p)
2287 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2288 else
2289 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2293 /* Return true if OMP atomic load/store statement G has the
2294 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2296 static inline bool
2297 gimple_omp_atomic_need_value_p (const gimple *g)
2299 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2300 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2301 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2305 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2307 static inline void
2308 gimple_omp_atomic_set_need_value (gimple *g)
2310 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2311 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2312 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2316 /* Return true if OMP atomic load/store statement G has the
2317 GF_OMP_ATOMIC_SEQ_CST flag set. */
2319 static inline bool
2320 gimple_omp_atomic_seq_cst_p (const gimple *g)
2322 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2323 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2324 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2328 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2330 static inline void
2331 gimple_omp_atomic_set_seq_cst (gimple *g)
2333 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2334 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2335 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2339 /* Return the number of operands for statement GS. */
2341 static inline unsigned
2342 gimple_num_ops (const gimple *gs)
2344 return gs->num_ops;
2348 /* Set the number of operands for statement GS. */
2350 static inline void
2351 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2353 gs->num_ops = num_ops;
2357 /* Return the array of operands for statement GS. */
2359 static inline tree *
2360 gimple_ops (gimple *gs)
2362 size_t off;
2364 /* All the tuples have their operand vector at the very bottom
2365 of the structure. Note that those structures that do not
2366 have an operand vector have a zero offset. */
2367 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2368 gcc_gimple_checking_assert (off != 0);
2370 return (tree *) ((char *) gs + off);
2374 /* Return operand I for statement GS. */
2376 static inline tree
2377 gimple_op (const gimple *gs, unsigned i)
2379 if (gimple_has_ops (gs))
2381 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2382 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2384 else
2385 return NULL_TREE;
2388 /* Return a pointer to operand I for statement GS. */
2390 static inline tree *
2391 gimple_op_ptr (gimple *gs, unsigned i)
2393 if (gimple_has_ops (gs))
2395 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2396 return gimple_ops (gs) + i;
2398 else
2399 return NULL;
2402 /* Set operand I of statement GS to OP. */
2404 static inline void
2405 gimple_set_op (gimple *gs, unsigned i, tree op)
2407 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2409 /* Note. It may be tempting to assert that OP matches
2410 is_gimple_operand, but that would be wrong. Different tuples
2411 accept slightly different sets of tree operands. Each caller
2412 should perform its own validation. */
2413 gimple_ops (gs)[i] = op;
2416 /* Return true if GS is a GIMPLE_ASSIGN. */
2418 static inline bool
2419 is_gimple_assign (const gimple *gs)
2421 return gimple_code (gs) == GIMPLE_ASSIGN;
2424 /* Determine if expression CODE is one of the valid expressions that can
2425 be used on the RHS of GIMPLE assignments. */
2427 static inline enum gimple_rhs_class
2428 get_gimple_rhs_class (enum tree_code code)
2430 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2433 /* Return the LHS of assignment statement GS. */
2435 static inline tree
2436 gimple_assign_lhs (const gassign *gs)
2438 return gs->op[0];
2441 static inline tree
2442 gimple_assign_lhs (const gimple *gs)
2444 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2445 return gimple_assign_lhs (ass);
2449 /* Return a pointer to the LHS of assignment statement GS. */
2451 static inline tree *
2452 gimple_assign_lhs_ptr (gassign *gs)
2454 return &gs->op[0];
2457 static inline tree *
2458 gimple_assign_lhs_ptr (gimple *gs)
2460 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2461 return gimple_assign_lhs_ptr (ass);
2465 /* Set LHS to be the LHS operand of assignment statement GS. */
2467 static inline void
2468 gimple_assign_set_lhs (gassign *gs, tree lhs)
2470 gs->op[0] = lhs;
2472 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2473 SSA_NAME_DEF_STMT (lhs) = gs;
2476 static inline void
2477 gimple_assign_set_lhs (gimple *gs, tree lhs)
2479 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2480 gimple_assign_set_lhs (ass, lhs);
2484 /* Return the first operand on the RHS of assignment statement GS. */
2486 static inline tree
2487 gimple_assign_rhs1 (const gassign *gs)
2489 return gs->op[1];
2492 static inline tree
2493 gimple_assign_rhs1 (const gimple *gs)
2495 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2496 return gimple_assign_rhs1 (ass);
2500 /* Return a pointer to the first operand on the RHS of assignment
2501 statement GS. */
2503 static inline tree *
2504 gimple_assign_rhs1_ptr (gassign *gs)
2506 return &gs->op[1];
2509 static inline tree *
2510 gimple_assign_rhs1_ptr (gimple *gs)
2512 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2513 return gimple_assign_rhs1_ptr (ass);
2516 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2518 static inline void
2519 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2521 gs->op[1] = rhs;
2524 static inline void
2525 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2527 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2528 gimple_assign_set_rhs1 (ass, rhs);
2532 /* Return the second operand on the RHS of assignment statement GS.
2533 If GS does not have two operands, NULL is returned instead. */
2535 static inline tree
2536 gimple_assign_rhs2 (const gassign *gs)
2538 if (gimple_num_ops (gs) >= 3)
2539 return gs->op[2];
2540 else
2541 return NULL_TREE;
2544 static inline tree
2545 gimple_assign_rhs2 (const gimple *gs)
2547 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2548 return gimple_assign_rhs2 (ass);
2552 /* Return a pointer to the second operand on the RHS of assignment
2553 statement GS. */
2555 static inline tree *
2556 gimple_assign_rhs2_ptr (gassign *gs)
2558 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2559 return &gs->op[2];
2562 static inline tree *
2563 gimple_assign_rhs2_ptr (gimple *gs)
2565 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2566 return gimple_assign_rhs2_ptr (ass);
2570 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2572 static inline void
2573 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2575 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2576 gs->op[2] = rhs;
2579 static inline void
2580 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2582 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2583 return gimple_assign_set_rhs2 (ass, rhs);
2586 /* Return the third operand on the RHS of assignment statement GS.
2587 If GS does not have two operands, NULL is returned instead. */
2589 static inline tree
2590 gimple_assign_rhs3 (const gassign *gs)
2592 if (gimple_num_ops (gs) >= 4)
2593 return gs->op[3];
2594 else
2595 return NULL_TREE;
2598 static inline tree
2599 gimple_assign_rhs3 (const gimple *gs)
2601 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2602 return gimple_assign_rhs3 (ass);
2605 /* Return a pointer to the third operand on the RHS of assignment
2606 statement GS. */
2608 static inline tree *
2609 gimple_assign_rhs3_ptr (gimple *gs)
2611 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2612 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2613 return &ass->op[3];
2617 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2619 static inline void
2620 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2622 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2623 gs->op[3] = rhs;
2626 static inline void
2627 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2629 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2630 gimple_assign_set_rhs3 (ass, rhs);
2634 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2635 which expect to see only two operands. */
2637 static inline void
2638 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2639 tree op1, tree op2)
2641 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2644 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2645 which expect to see only one operands. */
2647 static inline void
2648 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2649 tree op1)
2651 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2654 /* Returns true if GS is a nontemporal move. */
2656 static inline bool
2657 gimple_assign_nontemporal_move_p (const gassign *gs)
2659 return gs->nontemporal_move;
2662 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2664 static inline void
2665 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2667 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2668 gs->nontemporal_move = nontemporal;
2672 /* Return the code of the expression computed on the rhs of assignment
2673 statement GS. In case that the RHS is a single object, returns the
2674 tree code of the object. */
2676 static inline enum tree_code
2677 gimple_assign_rhs_code (const gassign *gs)
2679 enum tree_code code = (enum tree_code) gs->subcode;
2680 /* While we initially set subcode to the TREE_CODE of the rhs for
2681 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2682 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2683 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2684 code = TREE_CODE (gs->op[1]);
2686 return code;
2689 static inline enum tree_code
2690 gimple_assign_rhs_code (const gimple *gs)
2692 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2693 return gimple_assign_rhs_code (ass);
2697 /* Set CODE to be the code for the expression computed on the RHS of
2698 assignment S. */
2700 static inline void
2701 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2703 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2704 s->subcode = code;
2708 /* Return the gimple rhs class of the code of the expression computed on
2709 the rhs of assignment statement GS.
2710 This will never return GIMPLE_INVALID_RHS. */
2712 static inline enum gimple_rhs_class
2713 gimple_assign_rhs_class (const gimple *gs)
2715 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2718 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2719 there is no operator associated with the assignment itself.
2720 Unlike gimple_assign_copy_p, this predicate returns true for
2721 any RHS operand, including those that perform an operation
2722 and do not have the semantics of a copy, such as COND_EXPR. */
2724 static inline bool
2725 gimple_assign_single_p (const gimple *gs)
2727 return (is_gimple_assign (gs)
2728 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2731 /* Return true if GS performs a store to its lhs. */
2733 static inline bool
2734 gimple_store_p (const gimple *gs)
2736 tree lhs = gimple_get_lhs (gs);
2737 return lhs && !is_gimple_reg (lhs);
2740 /* Return true if GS is an assignment that loads from its rhs1. */
2742 static inline bool
2743 gimple_assign_load_p (const gimple *gs)
2745 tree rhs;
2746 if (!gimple_assign_single_p (gs))
2747 return false;
2748 rhs = gimple_assign_rhs1 (gs);
2749 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2750 return true;
2751 rhs = get_base_address (rhs);
2752 return (DECL_P (rhs)
2753 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2757 /* Return true if S is a type-cast assignment. */
2759 static inline bool
2760 gimple_assign_cast_p (const gimple *s)
2762 if (is_gimple_assign (s))
2764 enum tree_code sc = gimple_assign_rhs_code (s);
2765 return CONVERT_EXPR_CODE_P (sc)
2766 || sc == VIEW_CONVERT_EXPR
2767 || sc == FIX_TRUNC_EXPR;
2770 return false;
2773 /* Return true if S is a clobber statement. */
2775 static inline bool
2776 gimple_clobber_p (const gimple *s)
2778 return gimple_assign_single_p (s)
2779 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2782 /* Return true if GS is a GIMPLE_CALL. */
2784 static inline bool
2785 is_gimple_call (const gimple *gs)
2787 return gimple_code (gs) == GIMPLE_CALL;
2790 /* Return the LHS of call statement GS. */
2792 static inline tree
2793 gimple_call_lhs (const gcall *gs)
2795 return gs->op[0];
2798 static inline tree
2799 gimple_call_lhs (const gimple *gs)
2801 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2802 return gimple_call_lhs (gc);
2806 /* Return a pointer to the LHS of call statement GS. */
2808 static inline tree *
2809 gimple_call_lhs_ptr (gcall *gs)
2811 return &gs->op[0];
2814 static inline tree *
2815 gimple_call_lhs_ptr (gimple *gs)
2817 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2818 return gimple_call_lhs_ptr (gc);
2822 /* Set LHS to be the LHS operand of call statement GS. */
2824 static inline void
2825 gimple_call_set_lhs (gcall *gs, tree lhs)
2827 gs->op[0] = lhs;
2828 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2829 SSA_NAME_DEF_STMT (lhs) = gs;
2832 static inline void
2833 gimple_call_set_lhs (gimple *gs, tree lhs)
2835 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2836 gimple_call_set_lhs (gc, lhs);
2840 /* Return true if call GS calls an internal-only function, as enumerated
2841 by internal_fn. */
2843 static inline bool
2844 gimple_call_internal_p (const gcall *gs)
2846 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2849 static inline bool
2850 gimple_call_internal_p (const gimple *gs)
2852 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2853 return gimple_call_internal_p (gc);
2857 /* Return true if call GS is marked as instrumented by
2858 Pointer Bounds Checker. */
2860 static inline bool
2861 gimple_call_with_bounds_p (const gcall *gs)
2863 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2866 static inline bool
2867 gimple_call_with_bounds_p (const gimple *gs)
2869 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2870 return gimple_call_with_bounds_p (gc);
2874 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2875 Pointer Bounds Checker. */
2877 static inline void
2878 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2880 if (with_bounds)
2881 gs->subcode |= GF_CALL_WITH_BOUNDS;
2882 else
2883 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2886 static inline void
2887 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2889 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2890 gimple_call_set_with_bounds (gc, with_bounds);
2894 /* Return the target of internal call GS. */
2896 static inline enum internal_fn
2897 gimple_call_internal_fn (const gcall *gs)
2899 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2900 return gs->u.internal_fn;
2903 static inline enum internal_fn
2904 gimple_call_internal_fn (const gimple *gs)
2906 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2907 return gimple_call_internal_fn (gc);
2910 /* Return true, if this internal gimple call is unique. */
2912 static inline bool
2913 gimple_call_internal_unique_p (const gcall *gs)
2915 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2918 static inline bool
2919 gimple_call_internal_unique_p (const gimple *gs)
2921 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2922 return gimple_call_internal_unique_p (gc);
2925 /* Return true if GS is an internal function FN. */
2927 static inline bool
2928 gimple_call_internal_p (const gimple *gs, internal_fn fn)
2930 return (is_gimple_call (gs)
2931 && gimple_call_internal_p (gs)
2932 && gimple_call_internal_fn (gs) == fn);
2935 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2936 that could alter control flow. */
2938 static inline void
2939 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2941 if (ctrl_altering_p)
2942 s->subcode |= GF_CALL_CTRL_ALTERING;
2943 else
2944 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2947 static inline void
2948 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2950 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2951 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2954 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2955 flag is set. Such call could not be a stmt in the middle of a bb. */
2957 static inline bool
2958 gimple_call_ctrl_altering_p (const gcall *gs)
2960 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2963 static inline bool
2964 gimple_call_ctrl_altering_p (const gimple *gs)
2966 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2967 return gimple_call_ctrl_altering_p (gc);
2971 /* Return the function type of the function called by GS. */
2973 static inline tree
2974 gimple_call_fntype (const gcall *gs)
2976 if (gimple_call_internal_p (gs))
2977 return NULL_TREE;
2978 return gs->u.fntype;
2981 static inline tree
2982 gimple_call_fntype (const gimple *gs)
2984 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2985 return gimple_call_fntype (call_stmt);
2988 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2990 static inline void
2991 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2993 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2994 call_stmt->u.fntype = fntype;
2998 /* Return the tree node representing the function called by call
2999 statement GS. */
3001 static inline tree
3002 gimple_call_fn (const gcall *gs)
3004 return gs->op[1];
3007 static inline tree
3008 gimple_call_fn (const gimple *gs)
3010 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3011 return gimple_call_fn (gc);
3014 /* Return a pointer to the tree node representing the function called by call
3015 statement GS. */
3017 static inline tree *
3018 gimple_call_fn_ptr (gcall *gs)
3020 return &gs->op[1];
3023 static inline tree *
3024 gimple_call_fn_ptr (gimple *gs)
3026 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3027 return gimple_call_fn_ptr (gc);
3031 /* Set FN to be the function called by call statement GS. */
3033 static inline void
3034 gimple_call_set_fn (gcall *gs, tree fn)
3036 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3037 gs->op[1] = fn;
3041 /* Set FNDECL to be the function called by call statement GS. */
3043 static inline void
3044 gimple_call_set_fndecl (gcall *gs, tree decl)
3046 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3047 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3048 build_pointer_type (TREE_TYPE (decl)), decl);
3051 static inline void
3052 gimple_call_set_fndecl (gimple *gs, tree decl)
3054 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3055 gimple_call_set_fndecl (gc, decl);
3059 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3061 static inline void
3062 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3064 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3065 call_stmt->u.internal_fn = fn;
3069 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3070 Otherwise return NULL. This function is analogous to
3071 get_callee_fndecl in tree land. */
3073 static inline tree
3074 gimple_call_fndecl (const gcall *gs)
3076 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3079 static inline tree
3080 gimple_call_fndecl (const gimple *gs)
3082 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3083 return gimple_call_fndecl (gc);
3087 /* Return the type returned by call statement GS. */
3089 static inline tree
3090 gimple_call_return_type (const gcall *gs)
3092 tree type = gimple_call_fntype (gs);
3094 if (type == NULL_TREE)
3095 return TREE_TYPE (gimple_call_lhs (gs));
3097 /* The type returned by a function is the type of its
3098 function type. */
3099 return TREE_TYPE (type);
3103 /* Return the static chain for call statement GS. */
3105 static inline tree
3106 gimple_call_chain (const gcall *gs)
3108 return gs->op[2];
3111 static inline tree
3112 gimple_call_chain (const gimple *gs)
3114 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3115 return gimple_call_chain (gc);
3119 /* Return a pointer to the static chain for call statement CALL_STMT. */
3121 static inline tree *
3122 gimple_call_chain_ptr (gcall *call_stmt)
3124 return &call_stmt->op[2];
3127 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3129 static inline void
3130 gimple_call_set_chain (gcall *call_stmt, tree chain)
3132 call_stmt->op[2] = chain;
3136 /* Return the number of arguments used by call statement GS. */
3138 static inline unsigned
3139 gimple_call_num_args (const gcall *gs)
3141 return gimple_num_ops (gs) - 3;
3144 static inline unsigned
3145 gimple_call_num_args (const gimple *gs)
3147 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3148 return gimple_call_num_args (gc);
3152 /* Return the argument at position INDEX for call statement GS. */
3154 static inline tree
3155 gimple_call_arg (const gcall *gs, unsigned index)
3157 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3158 return gs->op[index + 3];
3161 static inline tree
3162 gimple_call_arg (const gimple *gs, unsigned index)
3164 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3165 return gimple_call_arg (gc, index);
3169 /* Return a pointer to the argument at position INDEX for call
3170 statement GS. */
3172 static inline tree *
3173 gimple_call_arg_ptr (gcall *gs, unsigned index)
3175 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3176 return &gs->op[index + 3];
3179 static inline tree *
3180 gimple_call_arg_ptr (gimple *gs, unsigned index)
3182 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3183 return gimple_call_arg_ptr (gc, index);
3187 /* Set ARG to be the argument at position INDEX for call statement GS. */
3189 static inline void
3190 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3192 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3193 gs->op[index + 3] = arg;
3196 static inline void
3197 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3199 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3200 gimple_call_set_arg (gc, index, arg);
3204 /* If TAIL_P is true, mark call statement S as being a tail call
3205 (i.e., a call just before the exit of a function). These calls are
3206 candidate for tail call optimization. */
3208 static inline void
3209 gimple_call_set_tail (gcall *s, bool tail_p)
3211 if (tail_p)
3212 s->subcode |= GF_CALL_TAILCALL;
3213 else
3214 s->subcode &= ~GF_CALL_TAILCALL;
3218 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3220 static inline bool
3221 gimple_call_tail_p (gcall *s)
3223 return (s->subcode & GF_CALL_TAILCALL) != 0;
3226 /* Mark (or clear) call statement S as requiring tail call optimization. */
3228 static inline void
3229 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3231 if (must_tail_p)
3232 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3233 else
3234 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3237 /* Return true if call statement has been marked as requiring
3238 tail call optimization. */
3240 static inline bool
3241 gimple_call_must_tail_p (const gcall *s)
3243 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3246 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3247 slot optimization. This transformation uses the target of the call
3248 expansion as the return slot for calls that return in memory. */
3250 static inline void
3251 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3253 if (return_slot_opt_p)
3254 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3255 else
3256 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3260 /* Return true if S is marked for return slot optimization. */
3262 static inline bool
3263 gimple_call_return_slot_opt_p (gcall *s)
3265 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3269 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3270 thunk to the thunked-to function. */
3272 static inline void
3273 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3275 if (from_thunk_p)
3276 s->subcode |= GF_CALL_FROM_THUNK;
3277 else
3278 s->subcode &= ~GF_CALL_FROM_THUNK;
3282 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3284 static inline bool
3285 gimple_call_from_thunk_p (gcall *s)
3287 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3291 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3292 argument pack in its argument list. */
3294 static inline void
3295 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3297 if (pass_arg_pack_p)
3298 s->subcode |= GF_CALL_VA_ARG_PACK;
3299 else
3300 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3304 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3305 argument pack in its argument list. */
3307 static inline bool
3308 gimple_call_va_arg_pack_p (gcall *s)
3310 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3314 /* Return true if S is a noreturn call. */
3316 static inline bool
3317 gimple_call_noreturn_p (const gcall *s)
3319 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3322 static inline bool
3323 gimple_call_noreturn_p (const gimple *s)
3325 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3326 return gimple_call_noreturn_p (gc);
3330 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3331 even if the called function can throw in other cases. */
3333 static inline void
3334 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3336 if (nothrow_p)
3337 s->subcode |= GF_CALL_NOTHROW;
3338 else
3339 s->subcode &= ~GF_CALL_NOTHROW;
3342 /* Return true if S is a nothrow call. */
3344 static inline bool
3345 gimple_call_nothrow_p (gcall *s)
3347 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3350 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3351 is known to be emitted for VLA objects. Those are wrapped by
3352 stack_save/stack_restore calls and hence can't lead to unbounded
3353 stack growth even when they occur in loops. */
3355 static inline void
3356 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3358 if (for_var)
3359 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3360 else
3361 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3364 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3366 static inline bool
3367 gimple_call_alloca_for_var_p (gcall *s)
3369 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3372 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3373 pointers to nested function are descriptors instead of trampolines. */
3375 static inline void
3376 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3378 if (by_descriptor_p)
3379 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3380 else
3381 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3384 /* Return true if S is a by-descriptor call. */
3386 static inline bool
3387 gimple_call_by_descriptor_p (gcall *s)
3389 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3392 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3394 static inline void
3395 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3397 dest_call->subcode = orig_call->subcode;
3401 /* Return a pointer to the points-to solution for the set of call-used
3402 variables of the call CALL_STMT. */
3404 static inline struct pt_solution *
3405 gimple_call_use_set (gcall *call_stmt)
3407 return &call_stmt->call_used;
3411 /* Return a pointer to the points-to solution for the set of call-used
3412 variables of the call CALL_STMT. */
3414 static inline struct pt_solution *
3415 gimple_call_clobber_set (gcall *call_stmt)
3417 return &call_stmt->call_clobbered;
3421 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3422 non-NULL lhs. */
3424 static inline bool
3425 gimple_has_lhs (gimple *stmt)
3427 if (is_gimple_assign (stmt))
3428 return true;
3429 if (gcall *call = dyn_cast <gcall *> (stmt))
3430 return gimple_call_lhs (call) != NULL_TREE;
3431 return false;
3435 /* Return the code of the predicate computed by conditional statement GS. */
3437 static inline enum tree_code
3438 gimple_cond_code (const gcond *gs)
3440 return (enum tree_code) gs->subcode;
3443 static inline enum tree_code
3444 gimple_cond_code (const gimple *gs)
3446 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3447 return gimple_cond_code (gc);
3451 /* Set CODE to be the predicate code for the conditional statement GS. */
3453 static inline void
3454 gimple_cond_set_code (gcond *gs, enum tree_code code)
3456 gs->subcode = code;
3460 /* Return the LHS of the predicate computed by conditional statement GS. */
3462 static inline tree
3463 gimple_cond_lhs (const gcond *gs)
3465 return gs->op[0];
3468 static inline tree
3469 gimple_cond_lhs (const gimple *gs)
3471 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3472 return gimple_cond_lhs (gc);
3475 /* Return the pointer to the LHS of the predicate computed by conditional
3476 statement GS. */
3478 static inline tree *
3479 gimple_cond_lhs_ptr (gcond *gs)
3481 return &gs->op[0];
3484 /* Set LHS to be the LHS operand of the predicate computed by
3485 conditional statement GS. */
3487 static inline void
3488 gimple_cond_set_lhs (gcond *gs, tree lhs)
3490 gs->op[0] = lhs;
3494 /* Return the RHS operand of the predicate computed by conditional GS. */
3496 static inline tree
3497 gimple_cond_rhs (const gcond *gs)
3499 return gs->op[1];
3502 static inline tree
3503 gimple_cond_rhs (const gimple *gs)
3505 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3506 return gimple_cond_rhs (gc);
3509 /* Return the pointer to the RHS operand of the predicate computed by
3510 conditional GS. */
3512 static inline tree *
3513 gimple_cond_rhs_ptr (gcond *gs)
3515 return &gs->op[1];
3519 /* Set RHS to be the RHS operand of the predicate computed by
3520 conditional statement GS. */
3522 static inline void
3523 gimple_cond_set_rhs (gcond *gs, tree rhs)
3525 gs->op[1] = rhs;
3529 /* Return the label used by conditional statement GS when its
3530 predicate evaluates to true. */
3532 static inline tree
3533 gimple_cond_true_label (const gcond *gs)
3535 return gs->op[2];
3539 /* Set LABEL to be the label used by conditional statement GS when its
3540 predicate evaluates to true. */
3542 static inline void
3543 gimple_cond_set_true_label (gcond *gs, tree label)
3545 gs->op[2] = label;
3549 /* Set LABEL to be the label used by conditional statement GS when its
3550 predicate evaluates to false. */
3552 static inline void
3553 gimple_cond_set_false_label (gcond *gs, tree label)
3555 gs->op[3] = label;
3559 /* Return the label used by conditional statement GS when its
3560 predicate evaluates to false. */
3562 static inline tree
3563 gimple_cond_false_label (const gcond *gs)
3565 return gs->op[3];
3569 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3571 static inline void
3572 gimple_cond_make_false (gcond *gs)
3574 gimple_cond_set_lhs (gs, boolean_false_node);
3575 gimple_cond_set_rhs (gs, boolean_false_node);
3576 gs->subcode = NE_EXPR;
3580 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3582 static inline void
3583 gimple_cond_make_true (gcond *gs)
3585 gimple_cond_set_lhs (gs, boolean_true_node);
3586 gimple_cond_set_rhs (gs, boolean_false_node);
3587 gs->subcode = NE_EXPR;
3590 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3591 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3593 static inline bool
3594 gimple_cond_true_p (const gcond *gs)
3596 tree lhs = gimple_cond_lhs (gs);
3597 tree rhs = gimple_cond_rhs (gs);
3598 enum tree_code code = gimple_cond_code (gs);
3600 if (lhs != boolean_true_node && lhs != boolean_false_node)
3601 return false;
3603 if (rhs != boolean_true_node && rhs != boolean_false_node)
3604 return false;
3606 if (code == NE_EXPR && lhs != rhs)
3607 return true;
3609 if (code == EQ_EXPR && lhs == rhs)
3610 return true;
3612 return false;
3615 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3616 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3618 static inline bool
3619 gimple_cond_false_p (const gcond *gs)
3621 tree lhs = gimple_cond_lhs (gs);
3622 tree rhs = gimple_cond_rhs (gs);
3623 enum tree_code code = gimple_cond_code (gs);
3625 if (lhs != boolean_true_node && lhs != boolean_false_node)
3626 return false;
3628 if (rhs != boolean_true_node && rhs != boolean_false_node)
3629 return false;
3631 if (code == NE_EXPR && lhs == rhs)
3632 return true;
3634 if (code == EQ_EXPR && lhs != rhs)
3635 return true;
3637 return false;
3640 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3642 static inline void
3643 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3644 tree rhs)
3646 gimple_cond_set_code (stmt, code);
3647 gimple_cond_set_lhs (stmt, lhs);
3648 gimple_cond_set_rhs (stmt, rhs);
3651 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3653 static inline tree
3654 gimple_label_label (const glabel *gs)
3656 return gs->op[0];
3660 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3661 GS. */
3663 static inline void
3664 gimple_label_set_label (glabel *gs, tree label)
3666 gs->op[0] = label;
3670 /* Return the destination of the unconditional jump GS. */
3672 static inline tree
3673 gimple_goto_dest (const gimple *gs)
3675 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3676 return gimple_op (gs, 0);
3680 /* Set DEST to be the destination of the unconditonal jump GS. */
3682 static inline void
3683 gimple_goto_set_dest (ggoto *gs, tree dest)
3685 gs->op[0] = dest;
3689 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3691 static inline tree
3692 gimple_bind_vars (const gbind *bind_stmt)
3694 return bind_stmt->vars;
3698 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3699 statement GS. */
3701 static inline void
3702 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3704 bind_stmt->vars = vars;
3708 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3709 statement GS. */
3711 static inline void
3712 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3714 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3718 static inline gimple_seq *
3719 gimple_bind_body_ptr (gbind *bind_stmt)
3721 return &bind_stmt->body;
3724 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3726 static inline gimple_seq
3727 gimple_bind_body (gbind *gs)
3729 return *gimple_bind_body_ptr (gs);
3733 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3734 statement GS. */
3736 static inline void
3737 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3739 bind_stmt->body = seq;
3743 /* Append a statement to the end of a GIMPLE_BIND's body. */
3745 static inline void
3746 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3748 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3752 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3754 static inline void
3755 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3757 gimple_seq_add_seq (&bind_stmt->body, seq);
3761 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3762 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3764 static inline tree
3765 gimple_bind_block (const gbind *bind_stmt)
3767 return bind_stmt->block;
3771 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3772 statement GS. */
3774 static inline void
3775 gimple_bind_set_block (gbind *bind_stmt, tree block)
3777 gcc_gimple_checking_assert (block == NULL_TREE
3778 || TREE_CODE (block) == BLOCK);
3779 bind_stmt->block = block;
3783 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3785 static inline unsigned
3786 gimple_asm_ninputs (const gasm *asm_stmt)
3788 return asm_stmt->ni;
3792 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3794 static inline unsigned
3795 gimple_asm_noutputs (const gasm *asm_stmt)
3797 return asm_stmt->no;
3801 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3803 static inline unsigned
3804 gimple_asm_nclobbers (const gasm *asm_stmt)
3806 return asm_stmt->nc;
3809 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3811 static inline unsigned
3812 gimple_asm_nlabels (const gasm *asm_stmt)
3814 return asm_stmt->nl;
3817 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3819 static inline tree
3820 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3822 gcc_gimple_checking_assert (index < asm_stmt->ni);
3823 return asm_stmt->op[index + asm_stmt->no];
3826 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3828 static inline void
3829 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3831 gcc_gimple_checking_assert (index < asm_stmt->ni
3832 && TREE_CODE (in_op) == TREE_LIST);
3833 asm_stmt->op[index + asm_stmt->no] = in_op;
3837 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3839 static inline tree
3840 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3842 gcc_gimple_checking_assert (index < asm_stmt->no);
3843 return asm_stmt->op[index];
3846 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3848 static inline void
3849 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3851 gcc_gimple_checking_assert (index < asm_stmt->no
3852 && TREE_CODE (out_op) == TREE_LIST);
3853 asm_stmt->op[index] = out_op;
3857 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3859 static inline tree
3860 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3862 gcc_gimple_checking_assert (index < asm_stmt->nc);
3863 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3867 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3869 static inline void
3870 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3872 gcc_gimple_checking_assert (index < asm_stmt->nc
3873 && TREE_CODE (clobber_op) == TREE_LIST);
3874 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3877 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3879 static inline tree
3880 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3882 gcc_gimple_checking_assert (index < asm_stmt->nl);
3883 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3886 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3888 static inline void
3889 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3891 gcc_gimple_checking_assert (index < asm_stmt->nl
3892 && TREE_CODE (label_op) == TREE_LIST);
3893 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3896 /* Return the string representing the assembly instruction in
3897 GIMPLE_ASM ASM_STMT. */
3899 static inline const char *
3900 gimple_asm_string (const gasm *asm_stmt)
3902 return asm_stmt->string;
3906 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3908 static inline bool
3909 gimple_asm_volatile_p (const gasm *asm_stmt)
3911 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3915 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3917 static inline void
3918 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3920 if (volatile_p)
3921 asm_stmt->subcode |= GF_ASM_VOLATILE;
3922 else
3923 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3927 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3929 static inline void
3930 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3932 if (input_p)
3933 asm_stmt->subcode |= GF_ASM_INPUT;
3934 else
3935 asm_stmt->subcode &= ~GF_ASM_INPUT;
3939 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3941 static inline bool
3942 gimple_asm_input_p (const gasm *asm_stmt)
3944 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3948 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3950 static inline tree
3951 gimple_catch_types (const gcatch *catch_stmt)
3953 return catch_stmt->types;
3957 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3959 static inline tree *
3960 gimple_catch_types_ptr (gcatch *catch_stmt)
3962 return &catch_stmt->types;
3966 /* Return a pointer to the GIMPLE sequence representing the body of
3967 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3969 static inline gimple_seq *
3970 gimple_catch_handler_ptr (gcatch *catch_stmt)
3972 return &catch_stmt->handler;
3976 /* Return the GIMPLE sequence representing the body of the handler of
3977 GIMPLE_CATCH statement CATCH_STMT. */
3979 static inline gimple_seq
3980 gimple_catch_handler (gcatch *catch_stmt)
3982 return *gimple_catch_handler_ptr (catch_stmt);
3986 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3988 static inline void
3989 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3991 catch_stmt->types = t;
3995 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3997 static inline void
3998 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4000 catch_stmt->handler = handler;
4004 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4006 static inline tree
4007 gimple_eh_filter_types (const gimple *gs)
4009 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4010 return eh_filter_stmt->types;
4014 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4015 GS. */
4017 static inline tree *
4018 gimple_eh_filter_types_ptr (gimple *gs)
4020 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4021 return &eh_filter_stmt->types;
4025 /* Return a pointer to the sequence of statement to execute when
4026 GIMPLE_EH_FILTER statement fails. */
4028 static inline gimple_seq *
4029 gimple_eh_filter_failure_ptr (gimple *gs)
4031 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4032 return &eh_filter_stmt->failure;
4036 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4037 statement fails. */
4039 static inline gimple_seq
4040 gimple_eh_filter_failure (gimple *gs)
4042 return *gimple_eh_filter_failure_ptr (gs);
4046 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4047 EH_FILTER_STMT. */
4049 static inline void
4050 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4052 eh_filter_stmt->types = types;
4056 /* Set FAILURE to be the sequence of statements to execute on failure
4057 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4059 static inline void
4060 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4061 gimple_seq failure)
4063 eh_filter_stmt->failure = failure;
4066 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4068 static inline tree
4069 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4071 return eh_mnt_stmt->fndecl;
4074 /* Set the function decl to be called by GS to DECL. */
4076 static inline void
4077 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4078 tree decl)
4080 eh_mnt_stmt->fndecl = decl;
4083 /* GIMPLE_EH_ELSE accessors. */
4085 static inline gimple_seq *
4086 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4088 return &eh_else_stmt->n_body;
4091 static inline gimple_seq
4092 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4094 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4097 static inline gimple_seq *
4098 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4100 return &eh_else_stmt->e_body;
4103 static inline gimple_seq
4104 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4106 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4109 static inline void
4110 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4112 eh_else_stmt->n_body = seq;
4115 static inline void
4116 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4118 eh_else_stmt->e_body = seq;
4121 /* GIMPLE_TRY accessors. */
4123 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4124 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4126 static inline enum gimple_try_flags
4127 gimple_try_kind (const gimple *gs)
4129 GIMPLE_CHECK (gs, GIMPLE_TRY);
4130 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4134 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4136 static inline void
4137 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4139 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4140 || kind == GIMPLE_TRY_FINALLY);
4141 if (gimple_try_kind (gs) != kind)
4142 gs->subcode = (unsigned int) kind;
4146 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4148 static inline bool
4149 gimple_try_catch_is_cleanup (const gimple *gs)
4151 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4152 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4156 /* Return a pointer to the sequence of statements used as the
4157 body for GIMPLE_TRY GS. */
4159 static inline gimple_seq *
4160 gimple_try_eval_ptr (gimple *gs)
4162 gtry *try_stmt = as_a <gtry *> (gs);
4163 return &try_stmt->eval;
4167 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4169 static inline gimple_seq
4170 gimple_try_eval (gimple *gs)
4172 return *gimple_try_eval_ptr (gs);
4176 /* Return a pointer to the sequence of statements used as the cleanup body for
4177 GIMPLE_TRY GS. */
4179 static inline gimple_seq *
4180 gimple_try_cleanup_ptr (gimple *gs)
4182 gtry *try_stmt = as_a <gtry *> (gs);
4183 return &try_stmt->cleanup;
4187 /* Return the sequence of statements used as the cleanup body for
4188 GIMPLE_TRY GS. */
4190 static inline gimple_seq
4191 gimple_try_cleanup (gimple *gs)
4193 return *gimple_try_cleanup_ptr (gs);
4197 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4199 static inline void
4200 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4202 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4203 if (catch_is_cleanup)
4204 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4205 else
4206 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4210 /* Set EVAL to be the sequence of statements to use as the body for
4211 GIMPLE_TRY TRY_STMT. */
4213 static inline void
4214 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4216 try_stmt->eval = eval;
4220 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4221 body for GIMPLE_TRY TRY_STMT. */
4223 static inline void
4224 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4226 try_stmt->cleanup = cleanup;
4230 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4232 static inline gimple_seq *
4233 gimple_wce_cleanup_ptr (gimple *gs)
4235 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4236 return &wce_stmt->cleanup;
4240 /* Return the cleanup sequence for cleanup statement GS. */
4242 static inline gimple_seq
4243 gimple_wce_cleanup (gimple *gs)
4245 return *gimple_wce_cleanup_ptr (gs);
4249 /* Set CLEANUP to be the cleanup sequence for GS. */
4251 static inline void
4252 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4254 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4255 wce_stmt->cleanup = cleanup;
4259 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4261 static inline bool
4262 gimple_wce_cleanup_eh_only (const gimple *gs)
4264 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4265 return gs->subcode != 0;
4269 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4271 static inline void
4272 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4274 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4275 gs->subcode = (unsigned int) eh_only_p;
4279 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4281 static inline unsigned
4282 gimple_phi_capacity (const gimple *gs)
4284 const gphi *phi_stmt = as_a <const gphi *> (gs);
4285 return phi_stmt->capacity;
4289 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4290 be exactly the number of incoming edges for the basic block holding
4291 GS. */
4293 static inline unsigned
4294 gimple_phi_num_args (const gimple *gs)
4296 const gphi *phi_stmt = as_a <const gphi *> (gs);
4297 return phi_stmt->nargs;
4301 /* Return the SSA name created by GIMPLE_PHI GS. */
4303 static inline tree
4304 gimple_phi_result (const gimple *gs)
4306 const gphi *phi_stmt = as_a <const gphi *> (gs);
4307 return phi_stmt->result;
4310 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4312 static inline tree *
4313 gimple_phi_result_ptr (gimple *gs)
4315 gphi *phi_stmt = as_a <gphi *> (gs);
4316 return &phi_stmt->result;
4319 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4321 static inline void
4322 gimple_phi_set_result (gphi *phi, tree result)
4324 phi->result = result;
4325 if (result && TREE_CODE (result) == SSA_NAME)
4326 SSA_NAME_DEF_STMT (result) = phi;
4330 /* Return the PHI argument corresponding to incoming edge INDEX for
4331 GIMPLE_PHI GS. */
4333 static inline struct phi_arg_d *
4334 gimple_phi_arg (gimple *gs, unsigned index)
4336 gphi *phi_stmt = as_a <gphi *> (gs);
4337 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4338 return &(phi_stmt->args[index]);
4341 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4342 for GIMPLE_PHI PHI. */
4344 static inline void
4345 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4347 gcc_gimple_checking_assert (index <= phi->nargs);
4348 phi->args[index] = *phiarg;
4351 /* Return the PHI nodes for basic block BB, or NULL if there are no
4352 PHI nodes. */
4354 static inline gimple_seq
4355 phi_nodes (const_basic_block bb)
4357 gcc_checking_assert (!(bb->flags & BB_RTL));
4358 return bb->il.gimple.phi_nodes;
4361 /* Return a pointer to the PHI nodes for basic block BB. */
4363 static inline gimple_seq *
4364 phi_nodes_ptr (basic_block bb)
4366 gcc_checking_assert (!(bb->flags & BB_RTL));
4367 return &bb->il.gimple.phi_nodes;
4370 /* Return the tree operand for argument I of PHI node GS. */
4372 static inline tree
4373 gimple_phi_arg_def (gimple *gs, size_t index)
4375 return gimple_phi_arg (gs, index)->def;
4379 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4381 static inline tree *
4382 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4384 return &gimple_phi_arg (phi, index)->def;
4387 /* Return the edge associated with argument I of phi node PHI. */
4389 static inline edge
4390 gimple_phi_arg_edge (gphi *phi, size_t i)
4392 return EDGE_PRED (gimple_bb (phi), i);
4395 /* Return the source location of gimple argument I of phi node PHI. */
4397 static inline source_location
4398 gimple_phi_arg_location (gphi *phi, size_t i)
4400 return gimple_phi_arg (phi, i)->locus;
4403 /* Return the source location of the argument on edge E of phi node PHI. */
4405 static inline source_location
4406 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4408 return gimple_phi_arg (phi, e->dest_idx)->locus;
4411 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4413 static inline void
4414 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4416 gimple_phi_arg (phi, i)->locus = loc;
4419 /* Return TRUE if argument I of phi node PHI has a location record. */
4421 static inline bool
4422 gimple_phi_arg_has_location (gphi *phi, size_t i)
4424 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4428 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4430 static inline int
4431 gimple_resx_region (const gresx *resx_stmt)
4433 return resx_stmt->region;
4436 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4438 static inline void
4439 gimple_resx_set_region (gresx *resx_stmt, int region)
4441 resx_stmt->region = region;
4444 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4446 static inline int
4447 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4449 return eh_dispatch_stmt->region;
4452 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4453 EH_DISPATCH_STMT. */
4455 static inline void
4456 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4458 eh_dispatch_stmt->region = region;
4461 /* Return the number of labels associated with the switch statement GS. */
4463 static inline unsigned
4464 gimple_switch_num_labels (const gswitch *gs)
4466 unsigned num_ops;
4467 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4468 num_ops = gimple_num_ops (gs);
4469 gcc_gimple_checking_assert (num_ops > 1);
4470 return num_ops - 1;
4474 /* Set NLABELS to be the number of labels for the switch statement GS. */
4476 static inline void
4477 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4479 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4480 gimple_set_num_ops (g, nlabels + 1);
4484 /* Return the index variable used by the switch statement GS. */
4486 static inline tree
4487 gimple_switch_index (const gswitch *gs)
4489 return gs->op[0];
4493 /* Return a pointer to the index variable for the switch statement GS. */
4495 static inline tree *
4496 gimple_switch_index_ptr (gswitch *gs)
4498 return &gs->op[0];
4502 /* Set INDEX to be the index variable for switch statement GS. */
4504 static inline void
4505 gimple_switch_set_index (gswitch *gs, tree index)
4507 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4508 gs->op[0] = index;
4512 /* Return the label numbered INDEX. The default label is 0, followed by any
4513 labels in a switch statement. */
4515 static inline tree
4516 gimple_switch_label (const gswitch *gs, unsigned index)
4518 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4519 return gs->op[index + 1];
4522 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4524 static inline void
4525 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4527 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4528 && (label == NULL_TREE
4529 || TREE_CODE (label) == CASE_LABEL_EXPR));
4530 gs->op[index + 1] = label;
4533 /* Return the default label for a switch statement. */
4535 static inline tree
4536 gimple_switch_default_label (const gswitch *gs)
4538 tree label = gimple_switch_label (gs, 0);
4539 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4540 return label;
4543 /* Set the default label for a switch statement. */
4545 static inline void
4546 gimple_switch_set_default_label (gswitch *gs, tree label)
4548 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4549 gimple_switch_set_label (gs, 0, label);
4552 /* Return true if GS is a GIMPLE_DEBUG statement. */
4554 static inline bool
4555 is_gimple_debug (const gimple *gs)
4557 return gimple_code (gs) == GIMPLE_DEBUG;
4560 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4562 static inline bool
4563 gimple_debug_bind_p (const gimple *s)
4565 if (is_gimple_debug (s))
4566 return s->subcode == GIMPLE_DEBUG_BIND;
4568 return false;
4571 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4573 static inline tree
4574 gimple_debug_bind_get_var (gimple *dbg)
4576 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4577 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4578 return gimple_op (dbg, 0);
4581 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4582 statement. */
4584 static inline tree
4585 gimple_debug_bind_get_value (gimple *dbg)
4587 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4588 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4589 return gimple_op (dbg, 1);
4592 /* Return a pointer to the value bound to the variable in a
4593 GIMPLE_DEBUG bind statement. */
4595 static inline tree *
4596 gimple_debug_bind_get_value_ptr (gimple *dbg)
4598 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4599 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4600 return gimple_op_ptr (dbg, 1);
4603 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4605 static inline void
4606 gimple_debug_bind_set_var (gimple *dbg, tree var)
4608 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4609 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4610 gimple_set_op (dbg, 0, var);
4613 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4614 statement. */
4616 static inline void
4617 gimple_debug_bind_set_value (gimple *dbg, tree value)
4619 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4620 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4621 gimple_set_op (dbg, 1, value);
4624 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4625 optimized away. */
4626 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4628 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4629 statement. */
4631 static inline void
4632 gimple_debug_bind_reset_value (gimple *dbg)
4634 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4635 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4636 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4639 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4640 value. */
4642 static inline bool
4643 gimple_debug_bind_has_value_p (gimple *dbg)
4645 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4646 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4647 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4650 #undef GIMPLE_DEBUG_BIND_NOVALUE
4652 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4654 static inline bool
4655 gimple_debug_source_bind_p (const gimple *s)
4657 if (is_gimple_debug (s))
4658 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4660 return false;
4663 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4665 static inline tree
4666 gimple_debug_source_bind_get_var (gimple *dbg)
4668 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4669 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4670 return gimple_op (dbg, 0);
4673 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4674 statement. */
4676 static inline tree
4677 gimple_debug_source_bind_get_value (gimple *dbg)
4679 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4680 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4681 return gimple_op (dbg, 1);
4684 /* Return a pointer to the value bound to the variable in a
4685 GIMPLE_DEBUG source bind statement. */
4687 static inline tree *
4688 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4690 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4691 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4692 return gimple_op_ptr (dbg, 1);
4695 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4697 static inline void
4698 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4700 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4701 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4702 gimple_set_op (dbg, 0, var);
4705 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4706 statement. */
4708 static inline void
4709 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4711 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4712 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4713 gimple_set_op (dbg, 1, value);
4716 /* Return the line number for EXPR, or return -1 if we have no line
4717 number information for it. */
4718 static inline int
4719 get_lineno (const gimple *stmt)
4721 location_t loc;
4723 if (!stmt)
4724 return -1;
4726 loc = gimple_location (stmt);
4727 if (loc == UNKNOWN_LOCATION)
4728 return -1;
4730 return LOCATION_LINE (loc);
4733 /* Return a pointer to the body for the OMP statement GS. */
4735 static inline gimple_seq *
4736 gimple_omp_body_ptr (gimple *gs)
4738 return &static_cast <gimple_statement_omp *> (gs)->body;
4741 /* Return the body for the OMP statement GS. */
4743 static inline gimple_seq
4744 gimple_omp_body (gimple *gs)
4746 return *gimple_omp_body_ptr (gs);
4749 /* Set BODY to be the body for the OMP statement GS. */
4751 static inline void
4752 gimple_omp_set_body (gimple *gs, gimple_seq body)
4754 static_cast <gimple_statement_omp *> (gs)->body = body;
4758 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4760 static inline tree
4761 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4763 return crit_stmt->name;
4767 /* Return a pointer to the name associated with OMP critical statement
4768 CRIT_STMT. */
4770 static inline tree *
4771 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4773 return &crit_stmt->name;
4777 /* Set NAME to be the name associated with OMP critical statement
4778 CRIT_STMT. */
4780 static inline void
4781 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4783 crit_stmt->name = name;
4787 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4789 static inline tree
4790 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4792 return crit_stmt->clauses;
4796 /* Return a pointer to the clauses associated with OMP critical statement
4797 CRIT_STMT. */
4799 static inline tree *
4800 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4802 return &crit_stmt->clauses;
4806 /* Set CLAUSES to be the clauses associated with OMP critical statement
4807 CRIT_STMT. */
4809 static inline void
4810 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4812 crit_stmt->clauses = clauses;
4816 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4818 static inline tree
4819 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4821 return ord_stmt->clauses;
4825 /* Return a pointer to the clauses associated with OMP ordered statement
4826 ORD_STMT. */
4828 static inline tree *
4829 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4831 return &ord_stmt->clauses;
4835 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4836 ORD_STMT. */
4838 static inline void
4839 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4841 ord_stmt->clauses = clauses;
4845 /* Return the kind of the OMP_FOR statemement G. */
4847 static inline int
4848 gimple_omp_for_kind (const gimple *g)
4850 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4851 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4855 /* Set the kind of the OMP_FOR statement G. */
4857 static inline void
4858 gimple_omp_for_set_kind (gomp_for *g, int kind)
4860 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4861 | (kind & GF_OMP_FOR_KIND_MASK);
4865 /* Return true if OMP_FOR statement G has the
4866 GF_OMP_FOR_COMBINED flag set. */
4868 static inline bool
4869 gimple_omp_for_combined_p (const gimple *g)
4871 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4872 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4876 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4877 the boolean value of COMBINED_P. */
4879 static inline void
4880 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4882 if (combined_p)
4883 g->subcode |= GF_OMP_FOR_COMBINED;
4884 else
4885 g->subcode &= ~GF_OMP_FOR_COMBINED;
4889 /* Return true if the OMP_FOR statement G has the
4890 GF_OMP_FOR_COMBINED_INTO flag set. */
4892 static inline bool
4893 gimple_omp_for_combined_into_p (const gimple *g)
4895 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4896 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4900 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4901 on the boolean value of COMBINED_P. */
4903 static inline void
4904 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4906 if (combined_p)
4907 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4908 else
4909 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4913 /* Return the clauses associated with the OMP_FOR statement GS. */
4915 static inline tree
4916 gimple_omp_for_clauses (const gimple *gs)
4918 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4919 return omp_for_stmt->clauses;
4923 /* Return a pointer to the clauses associated with the OMP_FOR statement
4924 GS. */
4926 static inline tree *
4927 gimple_omp_for_clauses_ptr (gimple *gs)
4929 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4930 return &omp_for_stmt->clauses;
4934 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4935 GS. */
4937 static inline void
4938 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4940 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4941 omp_for_stmt->clauses = clauses;
4945 /* Get the collapse count of the OMP_FOR statement GS. */
4947 static inline size_t
4948 gimple_omp_for_collapse (gimple *gs)
4950 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4951 return omp_for_stmt->collapse;
4955 /* Return the condition code associated with the OMP_FOR statement GS. */
4957 static inline enum tree_code
4958 gimple_omp_for_cond (const gimple *gs, size_t i)
4960 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4961 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4962 return omp_for_stmt->iter[i].cond;
4966 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4968 static inline void
4969 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4971 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4972 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4973 && i < omp_for_stmt->collapse);
4974 omp_for_stmt->iter[i].cond = cond;
4978 /* Return the index variable for the OMP_FOR statement GS. */
4980 static inline tree
4981 gimple_omp_for_index (const gimple *gs, size_t i)
4983 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4984 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4985 return omp_for_stmt->iter[i].index;
4989 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4991 static inline tree *
4992 gimple_omp_for_index_ptr (gimple *gs, size_t i)
4994 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4995 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4996 return &omp_for_stmt->iter[i].index;
5000 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5002 static inline void
5003 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5005 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5006 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5007 omp_for_stmt->iter[i].index = index;
5011 /* Return the initial value for the OMP_FOR statement GS. */
5013 static inline tree
5014 gimple_omp_for_initial (const gimple *gs, size_t i)
5016 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5017 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5018 return omp_for_stmt->iter[i].initial;
5022 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5024 static inline tree *
5025 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5027 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5028 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5029 return &omp_for_stmt->iter[i].initial;
5033 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5035 static inline void
5036 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5038 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5039 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5040 omp_for_stmt->iter[i].initial = initial;
5044 /* Return the final value for the OMP_FOR statement GS. */
5046 static inline tree
5047 gimple_omp_for_final (const gimple *gs, size_t i)
5049 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5050 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5051 return omp_for_stmt->iter[i].final;
5055 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5057 static inline tree *
5058 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5060 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5061 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5062 return &omp_for_stmt->iter[i].final;
5066 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5068 static inline void
5069 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5071 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5072 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5073 omp_for_stmt->iter[i].final = final;
5077 /* Return the increment value for the OMP_FOR statement GS. */
5079 static inline tree
5080 gimple_omp_for_incr (const gimple *gs, size_t i)
5082 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5083 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5084 return omp_for_stmt->iter[i].incr;
5088 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5090 static inline tree *
5091 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5093 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5094 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5095 return &omp_for_stmt->iter[i].incr;
5099 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5101 static inline void
5102 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5104 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5105 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5106 omp_for_stmt->iter[i].incr = incr;
5110 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5111 statement GS starts. */
5113 static inline gimple_seq *
5114 gimple_omp_for_pre_body_ptr (gimple *gs)
5116 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5117 return &omp_for_stmt->pre_body;
5121 /* Return the sequence of statements to execute before the OMP_FOR
5122 statement GS starts. */
5124 static inline gimple_seq
5125 gimple_omp_for_pre_body (gimple *gs)
5127 return *gimple_omp_for_pre_body_ptr (gs);
5131 /* Set PRE_BODY to be the sequence of statements to execute before the
5132 OMP_FOR statement GS starts. */
5134 static inline void
5135 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5137 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5138 omp_for_stmt->pre_body = pre_body;
5141 /* Return the kernel_phony of OMP_FOR statement. */
5143 static inline bool
5144 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5146 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5149 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5151 static inline void
5152 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5154 if (value)
5155 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5156 else
5157 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5160 /* Return the clauses associated with OMP_PARALLEL GS. */
5162 static inline tree
5163 gimple_omp_parallel_clauses (const gimple *gs)
5165 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5166 return omp_parallel_stmt->clauses;
5170 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5172 static inline tree *
5173 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5175 return &omp_parallel_stmt->clauses;
5179 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5181 static inline void
5182 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5183 tree clauses)
5185 omp_parallel_stmt->clauses = clauses;
5189 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5191 static inline tree
5192 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5194 return omp_parallel_stmt->child_fn;
5197 /* Return a pointer to the child function used to hold the body of
5198 OMP_PARALLEL_STMT. */
5200 static inline tree *
5201 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5203 return &omp_parallel_stmt->child_fn;
5207 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5209 static inline void
5210 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5211 tree child_fn)
5213 omp_parallel_stmt->child_fn = child_fn;
5217 /* Return the artificial argument used to send variables and values
5218 from the parent to the children threads in OMP_PARALLEL_STMT. */
5220 static inline tree
5221 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5223 return omp_parallel_stmt->data_arg;
5227 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5229 static inline tree *
5230 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5232 return &omp_parallel_stmt->data_arg;
5236 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5238 static inline void
5239 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5240 tree data_arg)
5242 omp_parallel_stmt->data_arg = data_arg;
5245 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5247 static inline bool
5248 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5250 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5253 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5255 static inline void
5256 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5258 if (value)
5259 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5260 else
5261 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5264 /* Return the clauses associated with OMP_TASK GS. */
5266 static inline tree
5267 gimple_omp_task_clauses (const gimple *gs)
5269 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5270 return omp_task_stmt->clauses;
5274 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5276 static inline tree *
5277 gimple_omp_task_clauses_ptr (gimple *gs)
5279 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5280 return &omp_task_stmt->clauses;
5284 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5285 GS. */
5287 static inline void
5288 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5290 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5291 omp_task_stmt->clauses = clauses;
5295 /* Return true if OMP task statement G has the
5296 GF_OMP_TASK_TASKLOOP flag set. */
5298 static inline bool
5299 gimple_omp_task_taskloop_p (const gimple *g)
5301 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5302 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5306 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5307 value of TASKLOOP_P. */
5309 static inline void
5310 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5312 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5313 if (taskloop_p)
5314 g->subcode |= GF_OMP_TASK_TASKLOOP;
5315 else
5316 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5320 /* Return the child function used to hold the body of OMP_TASK GS. */
5322 static inline tree
5323 gimple_omp_task_child_fn (const gimple *gs)
5325 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5326 return omp_task_stmt->child_fn;
5329 /* Return a pointer to the child function used to hold the body of
5330 OMP_TASK GS. */
5332 static inline tree *
5333 gimple_omp_task_child_fn_ptr (gimple *gs)
5335 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5336 return &omp_task_stmt->child_fn;
5340 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5342 static inline void
5343 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5345 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5346 omp_task_stmt->child_fn = child_fn;
5350 /* Return the artificial argument used to send variables and values
5351 from the parent to the children threads in OMP_TASK GS. */
5353 static inline tree
5354 gimple_omp_task_data_arg (const gimple *gs)
5356 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5357 return omp_task_stmt->data_arg;
5361 /* Return a pointer to the data argument for OMP_TASK GS. */
5363 static inline tree *
5364 gimple_omp_task_data_arg_ptr (gimple *gs)
5366 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5367 return &omp_task_stmt->data_arg;
5371 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5373 static inline void
5374 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5376 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5377 omp_task_stmt->data_arg = data_arg;
5381 /* Return the clauses associated with OMP_TASK GS. */
5383 static inline tree
5384 gimple_omp_taskreg_clauses (const gimple *gs)
5386 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5387 = as_a <const gimple_statement_omp_taskreg *> (gs);
5388 return omp_taskreg_stmt->clauses;
5392 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5394 static inline tree *
5395 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5397 gimple_statement_omp_taskreg *omp_taskreg_stmt
5398 = as_a <gimple_statement_omp_taskreg *> (gs);
5399 return &omp_taskreg_stmt->clauses;
5403 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5404 GS. */
5406 static inline void
5407 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5409 gimple_statement_omp_taskreg *omp_taskreg_stmt
5410 = as_a <gimple_statement_omp_taskreg *> (gs);
5411 omp_taskreg_stmt->clauses = clauses;
5415 /* Return the child function used to hold the body of OMP_TASK GS. */
5417 static inline tree
5418 gimple_omp_taskreg_child_fn (const gimple *gs)
5420 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5421 = as_a <const gimple_statement_omp_taskreg *> (gs);
5422 return omp_taskreg_stmt->child_fn;
5425 /* Return a pointer to the child function used to hold the body of
5426 OMP_TASK GS. */
5428 static inline tree *
5429 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5431 gimple_statement_omp_taskreg *omp_taskreg_stmt
5432 = as_a <gimple_statement_omp_taskreg *> (gs);
5433 return &omp_taskreg_stmt->child_fn;
5437 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5439 static inline void
5440 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5442 gimple_statement_omp_taskreg *omp_taskreg_stmt
5443 = as_a <gimple_statement_omp_taskreg *> (gs);
5444 omp_taskreg_stmt->child_fn = child_fn;
5448 /* Return the artificial argument used to send variables and values
5449 from the parent to the children threads in OMP_TASK GS. */
5451 static inline tree
5452 gimple_omp_taskreg_data_arg (const gimple *gs)
5454 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5455 = as_a <const gimple_statement_omp_taskreg *> (gs);
5456 return omp_taskreg_stmt->data_arg;
5460 /* Return a pointer to the data argument for OMP_TASK GS. */
5462 static inline tree *
5463 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5465 gimple_statement_omp_taskreg *omp_taskreg_stmt
5466 = as_a <gimple_statement_omp_taskreg *> (gs);
5467 return &omp_taskreg_stmt->data_arg;
5471 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5473 static inline void
5474 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5476 gimple_statement_omp_taskreg *omp_taskreg_stmt
5477 = as_a <gimple_statement_omp_taskreg *> (gs);
5478 omp_taskreg_stmt->data_arg = data_arg;
5482 /* Return the copy function used to hold the body of OMP_TASK GS. */
5484 static inline tree
5485 gimple_omp_task_copy_fn (const gimple *gs)
5487 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5488 return omp_task_stmt->copy_fn;
5491 /* Return a pointer to the copy function used to hold the body of
5492 OMP_TASK GS. */
5494 static inline tree *
5495 gimple_omp_task_copy_fn_ptr (gimple *gs)
5497 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5498 return &omp_task_stmt->copy_fn;
5502 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5504 static inline void
5505 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5507 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5508 omp_task_stmt->copy_fn = copy_fn;
5512 /* Return size of the data block in bytes in OMP_TASK GS. */
5514 static inline tree
5515 gimple_omp_task_arg_size (const gimple *gs)
5517 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5518 return omp_task_stmt->arg_size;
5522 /* Return a pointer to the data block size for OMP_TASK GS. */
5524 static inline tree *
5525 gimple_omp_task_arg_size_ptr (gimple *gs)
5527 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5528 return &omp_task_stmt->arg_size;
5532 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5534 static inline void
5535 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5537 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5538 omp_task_stmt->arg_size = arg_size;
5542 /* Return align of the data block in bytes in OMP_TASK GS. */
5544 static inline tree
5545 gimple_omp_task_arg_align (const gimple *gs)
5547 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5548 return omp_task_stmt->arg_align;
5552 /* Return a pointer to the data block align for OMP_TASK GS. */
5554 static inline tree *
5555 gimple_omp_task_arg_align_ptr (gimple *gs)
5557 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5558 return &omp_task_stmt->arg_align;
5562 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5564 static inline void
5565 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5567 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5568 omp_task_stmt->arg_align = arg_align;
5572 /* Return the clauses associated with OMP_SINGLE GS. */
5574 static inline tree
5575 gimple_omp_single_clauses (const gimple *gs)
5577 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5578 return omp_single_stmt->clauses;
5582 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5584 static inline tree *
5585 gimple_omp_single_clauses_ptr (gimple *gs)
5587 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5588 return &omp_single_stmt->clauses;
5592 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5594 static inline void
5595 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5597 omp_single_stmt->clauses = clauses;
5601 /* Return the clauses associated with OMP_TARGET GS. */
5603 static inline tree
5604 gimple_omp_target_clauses (const gimple *gs)
5606 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5607 return omp_target_stmt->clauses;
5611 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5613 static inline tree *
5614 gimple_omp_target_clauses_ptr (gimple *gs)
5616 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5617 return &omp_target_stmt->clauses;
5621 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5623 static inline void
5624 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5625 tree clauses)
5627 omp_target_stmt->clauses = clauses;
5631 /* Return the kind of the OMP_TARGET G. */
5633 static inline int
5634 gimple_omp_target_kind (const gimple *g)
5636 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5637 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5641 /* Set the kind of the OMP_TARGET G. */
5643 static inline void
5644 gimple_omp_target_set_kind (gomp_target *g, int kind)
5646 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5647 | (kind & GF_OMP_TARGET_KIND_MASK);
5651 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5653 static inline tree
5654 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5656 return omp_target_stmt->child_fn;
5659 /* Return a pointer to the child function used to hold the body of
5660 OMP_TARGET_STMT. */
5662 static inline tree *
5663 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5665 return &omp_target_stmt->child_fn;
5669 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5671 static inline void
5672 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5673 tree child_fn)
5675 omp_target_stmt->child_fn = child_fn;
5679 /* Return the artificial argument used to send variables and values
5680 from the parent to the children threads in OMP_TARGET_STMT. */
5682 static inline tree
5683 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5685 return omp_target_stmt->data_arg;
5689 /* Return a pointer to the data argument for OMP_TARGET GS. */
5691 static inline tree *
5692 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5694 return &omp_target_stmt->data_arg;
5698 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5700 static inline void
5701 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5702 tree data_arg)
5704 omp_target_stmt->data_arg = data_arg;
5708 /* Return the clauses associated with OMP_TEAMS GS. */
5710 static inline tree
5711 gimple_omp_teams_clauses (const gimple *gs)
5713 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5714 return omp_teams_stmt->clauses;
5718 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5720 static inline tree *
5721 gimple_omp_teams_clauses_ptr (gimple *gs)
5723 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5724 return &omp_teams_stmt->clauses;
5728 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5730 static inline void
5731 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5733 omp_teams_stmt->clauses = clauses;
5736 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5738 static inline bool
5739 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5741 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5744 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5746 static inline void
5747 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5749 if (value)
5750 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5751 else
5752 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5755 /* Return the clauses associated with OMP_SECTIONS GS. */
5757 static inline tree
5758 gimple_omp_sections_clauses (const gimple *gs)
5760 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5761 return omp_sections_stmt->clauses;
5765 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5767 static inline tree *
5768 gimple_omp_sections_clauses_ptr (gimple *gs)
5770 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5771 return &omp_sections_stmt->clauses;
5775 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5776 GS. */
5778 static inline void
5779 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5781 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5782 omp_sections_stmt->clauses = clauses;
5786 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5787 in GS. */
5789 static inline tree
5790 gimple_omp_sections_control (const gimple *gs)
5792 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5793 return omp_sections_stmt->control;
5797 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5798 GS. */
5800 static inline tree *
5801 gimple_omp_sections_control_ptr (gimple *gs)
5803 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5804 return &omp_sections_stmt->control;
5808 /* Set CONTROL to be the set of clauses associated with the
5809 GIMPLE_OMP_SECTIONS in GS. */
5811 static inline void
5812 gimple_omp_sections_set_control (gimple *gs, tree control)
5814 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5815 omp_sections_stmt->control = control;
5819 /* Set the value being stored in an atomic store. */
5821 static inline void
5822 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5824 store_stmt->val = val;
5828 /* Return the value being stored in an atomic store. */
5830 static inline tree
5831 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5833 return store_stmt->val;
5837 /* Return a pointer to the value being stored in an atomic store. */
5839 static inline tree *
5840 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5842 return &store_stmt->val;
5846 /* Set the LHS of an atomic load. */
5848 static inline void
5849 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5851 load_stmt->lhs = lhs;
5855 /* Get the LHS of an atomic load. */
5857 static inline tree
5858 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5860 return load_stmt->lhs;
5864 /* Return a pointer to the LHS of an atomic load. */
5866 static inline tree *
5867 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5869 return &load_stmt->lhs;
5873 /* Set the RHS of an atomic load. */
5875 static inline void
5876 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5878 load_stmt->rhs = rhs;
5882 /* Get the RHS of an atomic load. */
5884 static inline tree
5885 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5887 return load_stmt->rhs;
5891 /* Return a pointer to the RHS of an atomic load. */
5893 static inline tree *
5894 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5896 return &load_stmt->rhs;
5900 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5902 static inline tree
5903 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5905 return cont_stmt->control_def;
5908 /* The same as above, but return the address. */
5910 static inline tree *
5911 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5913 return &cont_stmt->control_def;
5916 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5918 static inline void
5919 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5921 cont_stmt->control_def = def;
5925 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5927 static inline tree
5928 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5930 return cont_stmt->control_use;
5934 /* The same as above, but return the address. */
5936 static inline tree *
5937 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5939 return &cont_stmt->control_use;
5943 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5945 static inline void
5946 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5948 cont_stmt->control_use = use;
5951 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5952 TRANSACTION_STMT. */
5954 static inline gimple_seq *
5955 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5957 return &transaction_stmt->body;
5960 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5962 static inline gimple_seq
5963 gimple_transaction_body (gtransaction *transaction_stmt)
5965 return transaction_stmt->body;
5968 /* Return the label associated with a GIMPLE_TRANSACTION. */
5970 static inline tree
5971 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
5973 return transaction_stmt->label_norm;
5976 static inline tree *
5977 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
5979 return &transaction_stmt->label_norm;
5982 static inline tree
5983 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
5985 return transaction_stmt->label_uninst;
5988 static inline tree *
5989 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
5991 return &transaction_stmt->label_uninst;
5994 static inline tree
5995 gimple_transaction_label_over (const gtransaction *transaction_stmt)
5997 return transaction_stmt->label_over;
6000 static inline tree *
6001 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6003 return &transaction_stmt->label_over;
6006 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6008 static inline unsigned int
6009 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6011 return transaction_stmt->subcode;
6014 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6015 TRANSACTION_STMT. */
6017 static inline void
6018 gimple_transaction_set_body (gtransaction *transaction_stmt,
6019 gimple_seq body)
6021 transaction_stmt->body = body;
6024 /* Set the label associated with a GIMPLE_TRANSACTION. */
6026 static inline void
6027 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6029 transaction_stmt->label_norm = label;
6032 static inline void
6033 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6035 transaction_stmt->label_uninst = label;
6038 static inline void
6039 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6041 transaction_stmt->label_over = label;
6044 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6046 static inline void
6047 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6048 unsigned int subcode)
6050 transaction_stmt->subcode = subcode;
6053 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6055 static inline tree *
6056 gimple_return_retval_ptr (greturn *gs)
6058 return &gs->op[0];
6061 /* Return the return value for GIMPLE_RETURN GS. */
6063 static inline tree
6064 gimple_return_retval (const greturn *gs)
6066 return gs->op[0];
6070 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6072 static inline void
6073 gimple_return_set_retval (greturn *gs, tree retval)
6075 gs->op[0] = retval;
6079 /* Return the return bounds for GIMPLE_RETURN GS. */
6081 static inline tree
6082 gimple_return_retbnd (const gimple *gs)
6084 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6085 return gimple_op (gs, 1);
6089 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6091 static inline void
6092 gimple_return_set_retbnd (gimple *gs, tree retval)
6094 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6095 gimple_set_op (gs, 1, retval);
6099 /* Returns true when the gimple statement STMT is any of the OMP types. */
6101 #define CASE_GIMPLE_OMP \
6102 case GIMPLE_OMP_PARALLEL: \
6103 case GIMPLE_OMP_TASK: \
6104 case GIMPLE_OMP_FOR: \
6105 case GIMPLE_OMP_SECTIONS: \
6106 case GIMPLE_OMP_SECTIONS_SWITCH: \
6107 case GIMPLE_OMP_SINGLE: \
6108 case GIMPLE_OMP_TARGET: \
6109 case GIMPLE_OMP_TEAMS: \
6110 case GIMPLE_OMP_SECTION: \
6111 case GIMPLE_OMP_MASTER: \
6112 case GIMPLE_OMP_TASKGROUP: \
6113 case GIMPLE_OMP_ORDERED: \
6114 case GIMPLE_OMP_CRITICAL: \
6115 case GIMPLE_OMP_RETURN: \
6116 case GIMPLE_OMP_ATOMIC_LOAD: \
6117 case GIMPLE_OMP_ATOMIC_STORE: \
6118 case GIMPLE_OMP_CONTINUE: \
6119 case GIMPLE_OMP_GRID_BODY
6121 static inline bool
6122 is_gimple_omp (const gimple *stmt)
6124 switch (gimple_code (stmt))
6126 CASE_GIMPLE_OMP:
6127 return true;
6128 default:
6129 return false;
6133 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6134 specifically. */
6136 static inline bool
6137 is_gimple_omp_oacc (const gimple *stmt)
6139 gcc_assert (is_gimple_omp (stmt));
6140 switch (gimple_code (stmt))
6142 case GIMPLE_OMP_FOR:
6143 switch (gimple_omp_for_kind (stmt))
6145 case GF_OMP_FOR_KIND_OACC_LOOP:
6146 return true;
6147 default:
6148 return false;
6150 case GIMPLE_OMP_TARGET:
6151 switch (gimple_omp_target_kind (stmt))
6153 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6154 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6155 case GF_OMP_TARGET_KIND_OACC_DATA:
6156 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6157 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6158 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6159 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6160 return true;
6161 default:
6162 return false;
6164 default:
6165 return false;
6170 /* Return true if the OMP gimple statement STMT is offloaded. */
6172 static inline bool
6173 is_gimple_omp_offloaded (const gimple *stmt)
6175 gcc_assert (is_gimple_omp (stmt));
6176 switch (gimple_code (stmt))
6178 case GIMPLE_OMP_TARGET:
6179 switch (gimple_omp_target_kind (stmt))
6181 case GF_OMP_TARGET_KIND_REGION:
6182 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6183 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6184 return true;
6185 default:
6186 return false;
6188 default:
6189 return false;
6194 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6196 static inline bool
6197 gimple_nop_p (const gimple *g)
6199 return gimple_code (g) == GIMPLE_NOP;
6203 /* Return true if GS is a GIMPLE_RESX. */
6205 static inline bool
6206 is_gimple_resx (const gimple *gs)
6208 return gimple_code (gs) == GIMPLE_RESX;
6211 /* Return the type of the main expression computed by STMT. Return
6212 void_type_node if the statement computes nothing. */
6214 static inline tree
6215 gimple_expr_type (const gimple *stmt)
6217 enum gimple_code code = gimple_code (stmt);
6218 /* In general we want to pass out a type that can be substituted
6219 for both the RHS and the LHS types if there is a possibly
6220 useless conversion involved. That means returning the
6221 original RHS type as far as we can reconstruct it. */
6222 if (code == GIMPLE_CALL)
6224 const gcall *call_stmt = as_a <const gcall *> (stmt);
6225 if (gimple_call_internal_p (call_stmt)
6226 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6227 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6228 else
6229 return gimple_call_return_type (call_stmt);
6231 else if (code == GIMPLE_ASSIGN)
6233 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6234 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6235 else
6236 /* As fallback use the type of the LHS. */
6237 return TREE_TYPE (gimple_get_lhs (stmt));
6239 else if (code == GIMPLE_COND)
6240 return boolean_type_node;
6241 else
6242 return void_type_node;
6245 /* Enum and arrays used for allocation stats. Keep in sync with
6246 gimple.c:gimple_alloc_kind_names. */
6247 enum gimple_alloc_kind
6249 gimple_alloc_kind_assign, /* Assignments. */
6250 gimple_alloc_kind_phi, /* PHI nodes. */
6251 gimple_alloc_kind_cond, /* Conditionals. */
6252 gimple_alloc_kind_rest, /* Everything else. */
6253 gimple_alloc_kind_all
6256 extern int gimple_alloc_counts[];
6257 extern int gimple_alloc_sizes[];
6259 /* Return the allocation kind for a given stmt CODE. */
6260 static inline enum gimple_alloc_kind
6261 gimple_alloc_kind (enum gimple_code code)
6263 switch (code)
6265 case GIMPLE_ASSIGN:
6266 return gimple_alloc_kind_assign;
6267 case GIMPLE_PHI:
6268 return gimple_alloc_kind_phi;
6269 case GIMPLE_COND:
6270 return gimple_alloc_kind_cond;
6271 default:
6272 return gimple_alloc_kind_rest;
6276 /* Return true if a location should not be emitted for this statement
6277 by annotate_all_with_location. */
6279 static inline bool
6280 gimple_do_not_emit_location_p (gimple *g)
6282 return gimple_plf (g, GF_PLF_1);
6285 /* Mark statement G so a location will not be emitted by
6286 annotate_one_with_location. */
6288 static inline void
6289 gimple_set_do_not_emit_location (gimple *g)
6291 /* The PLF flags are initialized to 0 when a new tuple is created,
6292 so no need to initialize it anywhere. */
6293 gimple_set_plf (g, GF_PLF_1, true);
6297 /* Macros for showing usage statistics. */
6298 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6299 ? (x) \
6300 : ((x) < 1024*1024*10 \
6301 ? (x) / 1024 \
6302 : (x) / (1024*1024))))
6304 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6306 #endif /* GCC_GIMPLE_H */