2015-08-12 Paolo Carlini <paolo.carlini@oracle.com>
[official-gcc.git] / gcc / gimple.h
blob9e9be4ac62d17ab5f58cd1d6eafcbeeedf042236
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2015 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_statement_base.subcode and they may only be
127 defined for statement codes that do not use subcodes.
129 Values for the masks can overlap as long as the overlapping values
130 are never used in the same statement class.
132 The maximum mask value that can be defined is 1 << 15 (i.e., each
133 statement code can hold up to 16 bitflags).
135 Keep this list sorted. */
136 enum gf_mask {
137 GF_ASM_INPUT = 1 << 0,
138 GF_ASM_VOLATILE = 1 << 1,
139 GF_CALL_FROM_THUNK = 1 << 0,
140 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
141 GF_CALL_TAILCALL = 1 << 2,
142 GF_CALL_VA_ARG_PACK = 1 << 3,
143 GF_CALL_NOTHROW = 1 << 4,
144 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
145 GF_CALL_INTERNAL = 1 << 6,
146 GF_CALL_CTRL_ALTERING = 1 << 7,
147 GF_CALL_WITH_BOUNDS = 1 << 8,
148 GF_OMP_PARALLEL_COMBINED = 1 << 0,
149 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
150 GF_OMP_FOR_KIND_FOR = 0,
151 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
152 GF_OMP_FOR_KIND_CILKFOR = 2,
153 GF_OMP_FOR_KIND_OACC_LOOP = 3,
154 /* Flag for SIMD variants of OMP_FOR kinds. */
155 GF_OMP_FOR_SIMD = 1 << 2,
156 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
157 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
158 GF_OMP_FOR_COMBINED = 1 << 3,
159 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
160 GF_OMP_TARGET_KIND_MASK = (1 << 3) - 1,
161 GF_OMP_TARGET_KIND_REGION = 0,
162 GF_OMP_TARGET_KIND_DATA = 1,
163 GF_OMP_TARGET_KIND_UPDATE = 2,
164 GF_OMP_TARGET_KIND_OACC_PARALLEL = 3,
165 GF_OMP_TARGET_KIND_OACC_KERNELS = 4,
166 GF_OMP_TARGET_KIND_OACC_DATA = 5,
167 GF_OMP_TARGET_KIND_OACC_UPDATE = 6,
168 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 7,
170 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
171 a thread synchronization via some sort of barrier. The exact barrier
172 that would otherwise be emitted is dependent on the OMP statement with
173 which this return is associated. */
174 GF_OMP_RETURN_NOWAIT = 1 << 0,
176 GF_OMP_SECTION_LAST = 1 << 0,
177 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
178 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
179 GF_PREDICT_TAKEN = 1 << 15
182 /* Currently, there are only two types of gimple debug stmt. Others are
183 envisioned, for example, to enable the generation of is_stmt notes
184 in line number information, to mark sequence points, etc. This
185 subcode is to be used to tell them apart. */
186 enum gimple_debug_subcode {
187 GIMPLE_DEBUG_BIND = 0,
188 GIMPLE_DEBUG_SOURCE_BIND = 1
191 /* Masks for selecting a pass local flag (PLF) to work on. These
192 masks are used by gimple_set_plf and gimple_plf. */
193 enum plf_mask {
194 GF_PLF_1 = 1 << 0,
195 GF_PLF_2 = 1 << 1
198 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
199 are for 64 bit hosts. */
201 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
202 chain_next ("%h.next"), variable_size))
203 gimple_statement_base
205 /* [ WORD 1 ]
206 Main identifying code for a tuple. */
207 ENUM_BITFIELD(gimple_code) code : 8;
209 /* Nonzero if a warning should not be emitted on this tuple. */
210 unsigned int no_warning : 1;
212 /* Nonzero if this tuple has been visited. Passes are responsible
213 for clearing this bit before using it. */
214 unsigned int visited : 1;
216 /* Nonzero if this tuple represents a non-temporal move. */
217 unsigned int nontemporal_move : 1;
219 /* Pass local flags. These flags are free for any pass to use as
220 they see fit. Passes should not assume that these flags contain
221 any useful value when the pass starts. Any initial state that
222 the pass requires should be set on entry to the pass. See
223 gimple_set_plf and gimple_plf for usage. */
224 unsigned int plf : 2;
226 /* Nonzero if this statement has been modified and needs to have its
227 operands rescanned. */
228 unsigned modified : 1;
230 /* Nonzero if this statement contains volatile operands. */
231 unsigned has_volatile_ops : 1;
233 /* Padding to get subcode to 16 bit alignment. */
234 unsigned pad : 1;
236 /* The SUBCODE field can be used for tuple-specific flags for tuples
237 that do not require subcodes. Note that SUBCODE should be at
238 least as wide as tree codes, as several tuples store tree codes
239 in there. */
240 unsigned int subcode : 16;
242 /* UID of this statement. This is used by passes that want to
243 assign IDs to statements. It must be assigned and used by each
244 pass. By default it should be assumed to contain garbage. */
245 unsigned uid;
247 /* [ WORD 2 ]
248 Locus information for debug info. */
249 location_t location;
251 /* Number of operands in this tuple. */
252 unsigned num_ops;
254 /* [ WORD 3 ]
255 Basic block holding this statement. */
256 basic_block bb;
258 /* [ WORD 4-5 ]
259 Linked lists of gimple statements. The next pointers form
260 a NULL terminated list, the prev pointers are a cyclic list.
261 A gimple statement is hence also a double-ended list of
262 statements, with the pointer itself being the first element,
263 and the prev pointer being the last. */
264 gimple next;
265 gimple GTY((skip)) prev;
269 /* Base structure for tuples with operands. */
271 /* This gimple subclass has no tag value. */
272 struct GTY(())
273 gimple_statement_with_ops_base : public gimple_statement_base
275 /* [ WORD 1-6 ] : base class */
277 /* [ WORD 7 ]
278 SSA operand vectors. NOTE: It should be possible to
279 amalgamate these vectors with the operand vector OP. However,
280 the SSA operand vectors are organized differently and contain
281 more information (like immediate use chaining). */
282 struct use_optype_d GTY((skip (""))) *use_ops;
286 /* Statements that take register operands. */
288 struct GTY((tag("GSS_WITH_OPS")))
289 gimple_statement_with_ops : public gimple_statement_with_ops_base
291 /* [ WORD 1-7 ] : base class */
293 /* [ WORD 8 ]
294 Operand vector. NOTE! This must always be the last field
295 of this structure. In particular, this means that this
296 structure cannot be embedded inside another one. */
297 tree GTY((length ("%h.num_ops"))) op[1];
301 /* Base for statements that take both memory and register operands. */
303 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
304 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
306 /* [ WORD 1-7 ] : base class */
308 /* [ WORD 8-9 ]
309 Virtual operands for this statement. The GC will pick them
310 up via the ssa_names array. */
311 tree GTY((skip (""))) vdef;
312 tree GTY((skip (""))) vuse;
316 /* Statements that take both memory and register operands. */
318 struct GTY((tag("GSS_WITH_MEM_OPS")))
319 gimple_statement_with_memory_ops :
320 public gimple_statement_with_memory_ops_base
322 /* [ WORD 1-9 ] : base class */
324 /* [ WORD 10 ]
325 Operand vector. NOTE! This must always be the last field
326 of this structure. In particular, this means that this
327 structure cannot be embedded inside another one. */
328 tree GTY((length ("%h.num_ops"))) op[1];
332 /* Call statements that take both memory and register operands. */
334 struct GTY((tag("GSS_CALL")))
335 gcall : public gimple_statement_with_memory_ops_base
337 /* [ WORD 1-9 ] : base class */
339 /* [ WORD 10-13 ] */
340 struct pt_solution call_used;
341 struct pt_solution call_clobbered;
343 /* [ WORD 14 ] */
344 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
345 tree GTY ((tag ("0"))) fntype;
346 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
347 } u;
349 /* [ WORD 15 ]
350 Operand vector. NOTE! This must always be the last field
351 of this structure. In particular, this means that this
352 structure cannot be embedded inside another one. */
353 tree GTY((length ("%h.num_ops"))) op[1];
357 /* OMP statements. */
359 struct GTY((tag("GSS_OMP")))
360 gimple_statement_omp : public gimple_statement_base
362 /* [ WORD 1-6 ] : base class */
364 /* [ WORD 7 ] */
365 gimple_seq body;
369 /* GIMPLE_BIND */
371 struct GTY((tag("GSS_BIND")))
372 gbind : public gimple_statement_base
374 /* [ WORD 1-6 ] : base class */
376 /* [ WORD 7 ]
377 Variables declared in this scope. */
378 tree vars;
380 /* [ WORD 8 ]
381 This is different than the BLOCK field in gimple_statement_base,
382 which is analogous to TREE_BLOCK (i.e., the lexical block holding
383 this statement). This field is the equivalent of BIND_EXPR_BLOCK
384 in tree land (i.e., the lexical scope defined by this bind). See
385 gimple-low.c. */
386 tree block;
388 /* [ WORD 9 ] */
389 gimple_seq body;
393 /* GIMPLE_CATCH */
395 struct GTY((tag("GSS_CATCH")))
396 gcatch : public gimple_statement_base
398 /* [ WORD 1-6 ] : base class */
400 /* [ WORD 7 ] */
401 tree types;
403 /* [ WORD 8 ] */
404 gimple_seq handler;
408 /* GIMPLE_EH_FILTER */
410 struct GTY((tag("GSS_EH_FILTER")))
411 geh_filter : public gimple_statement_base
413 /* [ WORD 1-6 ] : base class */
415 /* [ WORD 7 ]
416 Filter types. */
417 tree types;
419 /* [ WORD 8 ]
420 Failure actions. */
421 gimple_seq failure;
424 /* GIMPLE_EH_ELSE */
426 struct GTY((tag("GSS_EH_ELSE")))
427 geh_else : public gimple_statement_base
429 /* [ WORD 1-6 ] : base class */
431 /* [ WORD 7,8 ] */
432 gimple_seq n_body, e_body;
435 /* GIMPLE_EH_MUST_NOT_THROW */
437 struct GTY((tag("GSS_EH_MNT")))
438 geh_mnt : public gimple_statement_base
440 /* [ WORD 1-6 ] : base class */
442 /* [ WORD 7 ] Abort function decl. */
443 tree fndecl;
446 /* GIMPLE_PHI */
448 struct GTY((tag("GSS_PHI")))
449 gphi : public gimple_statement_base
451 /* [ WORD 1-6 ] : base class */
453 /* [ WORD 7 ] */
454 unsigned capacity;
455 unsigned nargs;
457 /* [ WORD 8 ] */
458 tree result;
460 /* [ WORD 9 ] */
461 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
465 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
467 struct GTY((tag("GSS_EH_CTRL")))
468 gimple_statement_eh_ctrl : public gimple_statement_base
470 /* [ WORD 1-6 ] : base class */
472 /* [ WORD 7 ]
473 Exception region number. */
474 int region;
477 struct GTY((tag("GSS_EH_CTRL")))
478 gresx : public gimple_statement_eh_ctrl
480 /* No extra fields; adds invariant:
481 stmt->code == GIMPLE_RESX. */
484 struct GTY((tag("GSS_EH_CTRL")))
485 geh_dispatch : public gimple_statement_eh_ctrl
487 /* No extra fields; adds invariant:
488 stmt->code == GIMPLE_EH_DISPATH. */
492 /* GIMPLE_TRY */
494 struct GTY((tag("GSS_TRY")))
495 gtry : public gimple_statement_base
497 /* [ WORD 1-6 ] : base class */
499 /* [ WORD 7 ]
500 Expression to evaluate. */
501 gimple_seq eval;
503 /* [ WORD 8 ]
504 Cleanup expression. */
505 gimple_seq cleanup;
508 /* Kind of GIMPLE_TRY statements. */
509 enum gimple_try_flags
511 /* A try/catch. */
512 GIMPLE_TRY_CATCH = 1 << 0,
514 /* A try/finally. */
515 GIMPLE_TRY_FINALLY = 1 << 1,
516 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
518 /* Analogous to TRY_CATCH_IS_CLEANUP. */
519 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
522 /* GIMPLE_WITH_CLEANUP_EXPR */
524 struct GTY((tag("GSS_WCE")))
525 gimple_statement_wce : public gimple_statement_base
527 /* [ WORD 1-6 ] : base class */
529 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
530 executed if an exception is thrown, not on normal exit of its
531 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
532 in TARGET_EXPRs. */
534 /* [ WORD 7 ]
535 Cleanup expression. */
536 gimple_seq cleanup;
540 /* GIMPLE_ASM */
542 struct GTY((tag("GSS_ASM")))
543 gasm : public gimple_statement_with_memory_ops_base
545 /* [ WORD 1-9 ] : base class */
547 /* [ WORD 10 ]
548 __asm__ statement. */
549 const char *string;
551 /* [ WORD 11 ]
552 Number of inputs, outputs, clobbers, labels. */
553 unsigned char ni;
554 unsigned char no;
555 unsigned char nc;
556 unsigned char nl;
558 /* [ WORD 12 ]
559 Operand vector. NOTE! This must always be the last field
560 of this structure. In particular, this means that this
561 structure cannot be embedded inside another one. */
562 tree GTY((length ("%h.num_ops"))) op[1];
565 /* GIMPLE_OMP_CRITICAL */
567 struct GTY((tag("GSS_OMP_CRITICAL")))
568 gomp_critical : public gimple_statement_omp
570 /* [ WORD 1-7 ] : base class */
572 /* [ WORD 8 ]
573 Critical section name. */
574 tree name;
578 struct GTY(()) gimple_omp_for_iter {
579 /* Condition code. */
580 enum tree_code cond;
582 /* Index variable. */
583 tree index;
585 /* Initial value. */
586 tree initial;
588 /* Final value. */
589 tree final;
591 /* Increment. */
592 tree incr;
595 /* GIMPLE_OMP_FOR */
597 struct GTY((tag("GSS_OMP_FOR")))
598 gomp_for : public gimple_statement_omp
600 /* [ WORD 1-7 ] : base class */
602 /* [ WORD 8 ] */
603 tree clauses;
605 /* [ WORD 9 ]
606 Number of elements in iter array. */
607 size_t collapse;
609 /* [ WORD 10 ] */
610 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
612 /* [ WORD 11 ]
613 Pre-body evaluated before the loop body begins. */
614 gimple_seq pre_body;
618 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
620 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
621 gimple_statement_omp_parallel_layout : public gimple_statement_omp
623 /* [ WORD 1-7 ] : base class */
625 /* [ WORD 8 ]
626 Clauses. */
627 tree clauses;
629 /* [ WORD 9 ]
630 Child function holding the body of the parallel region. */
631 tree child_fn;
633 /* [ WORD 10 ]
634 Shared data argument. */
635 tree data_arg;
638 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
639 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
640 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
642 /* No extra fields; adds invariant:
643 stmt->code == GIMPLE_OMP_PARALLEL
644 || stmt->code == GIMPLE_OMP_TASK. */
647 /* GIMPLE_OMP_PARALLEL */
648 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
649 gomp_parallel : public gimple_statement_omp_taskreg
651 /* No extra fields; adds invariant:
652 stmt->code == GIMPLE_OMP_PARALLEL. */
655 /* GIMPLE_OMP_TARGET */
656 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
657 gomp_target : public gimple_statement_omp_parallel_layout
659 /* No extra fields; adds invariant:
660 stmt->code == GIMPLE_OMP_TARGET. */
663 /* GIMPLE_OMP_TASK */
665 struct GTY((tag("GSS_OMP_TASK")))
666 gomp_task : public gimple_statement_omp_taskreg
668 /* [ WORD 1-10 ] : base class */
670 /* [ WORD 11 ]
671 Child function holding firstprivate initialization if needed. */
672 tree copy_fn;
674 /* [ WORD 12-13 ]
675 Size and alignment in bytes of the argument data block. */
676 tree arg_size;
677 tree arg_align;
681 /* GIMPLE_OMP_SECTION */
682 /* Uses struct gimple_statement_omp. */
685 /* GIMPLE_OMP_SECTIONS */
687 struct GTY((tag("GSS_OMP_SECTIONS")))
688 gomp_sections : public gimple_statement_omp
690 /* [ WORD 1-7 ] : base class */
692 /* [ WORD 8 ] */
693 tree clauses;
695 /* [ WORD 9 ]
696 The control variable used for deciding which of the sections to
697 execute. */
698 tree control;
701 /* GIMPLE_OMP_CONTINUE.
703 Note: This does not inherit from gimple_statement_omp, because we
704 do not need the body field. */
706 struct GTY((tag("GSS_OMP_CONTINUE")))
707 gomp_continue : public gimple_statement_base
709 /* [ WORD 1-6 ] : base class */
711 /* [ WORD 7 ] */
712 tree control_def;
714 /* [ WORD 8 ] */
715 tree control_use;
718 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
720 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
721 gimple_statement_omp_single_layout : public gimple_statement_omp
723 /* [ WORD 1-7 ] : base class */
725 /* [ WORD 7 ] */
726 tree clauses;
729 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
730 gomp_single : public gimple_statement_omp_single_layout
732 /* No extra fields; adds invariant:
733 stmt->code == GIMPLE_OMP_SINGLE. */
736 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
737 gomp_teams : public gimple_statement_omp_single_layout
739 /* No extra fields; adds invariant:
740 stmt->code == GIMPLE_OMP_TEAMS. */
744 /* GIMPLE_OMP_ATOMIC_LOAD.
745 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
746 contains a sequence, which we don't need here. */
748 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
749 gomp_atomic_load : public gimple_statement_base
751 /* [ WORD 1-6 ] : base class */
753 /* [ WORD 7-8 ] */
754 tree rhs, lhs;
757 /* GIMPLE_OMP_ATOMIC_STORE.
758 See note on GIMPLE_OMP_ATOMIC_LOAD. */
760 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
761 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
763 /* [ WORD 1-6 ] : base class */
765 /* [ WORD 7 ] */
766 tree val;
769 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
770 gomp_atomic_store :
771 public gimple_statement_omp_atomic_store_layout
773 /* No extra fields; adds invariant:
774 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
777 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
778 gimple_statement_omp_return :
779 public gimple_statement_omp_atomic_store_layout
781 /* No extra fields; adds invariant:
782 stmt->code == GIMPLE_OMP_RETURN. */
785 /* GIMPLE_TRANSACTION. */
787 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
789 /* The __transaction_atomic was declared [[outer]] or it is
790 __transaction_relaxed. */
791 #define GTMA_IS_OUTER (1u << 0)
792 #define GTMA_IS_RELAXED (1u << 1)
793 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
795 /* The transaction is seen to not have an abort. */
796 #define GTMA_HAVE_ABORT (1u << 2)
797 /* The transaction is seen to have loads or stores. */
798 #define GTMA_HAVE_LOAD (1u << 3)
799 #define GTMA_HAVE_STORE (1u << 4)
800 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
801 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
802 /* The transaction WILL enter serial irrevocable mode.
803 An irrevocable block post-dominates the entire transaction, such
804 that all invocations of the transaction will go serial-irrevocable.
805 In such case, we don't bother instrumenting the transaction, and
806 tell the runtime that it should begin the transaction in
807 serial-irrevocable mode. */
808 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
809 /* The transaction contains no instrumentation code whatsover, most
810 likely because it is guaranteed to go irrevocable upon entry. */
811 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
813 struct GTY((tag("GSS_TRANSACTION")))
814 gtransaction : public gimple_statement_with_memory_ops_base
816 /* [ WORD 1-9 ] : base class */
818 /* [ WORD 10 ] */
819 gimple_seq body;
821 /* [ WORD 11 ] */
822 tree label;
825 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
826 enum gimple_statement_structure_enum {
827 #include "gsstruct.def"
828 LAST_GSS_ENUM
830 #undef DEFGSSTRUCT
832 /* A statement with the invariant that
833 stmt->code == GIMPLE_COND
834 i.e. a conditional jump statement. */
836 struct GTY((tag("GSS_WITH_OPS")))
837 gcond : public gimple_statement_with_ops
839 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
842 /* A statement with the invariant that
843 stmt->code == GIMPLE_DEBUG
844 i.e. a debug statement. */
846 struct GTY((tag("GSS_WITH_OPS")))
847 gdebug : public gimple_statement_with_ops
849 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
852 /* A statement with the invariant that
853 stmt->code == GIMPLE_GOTO
854 i.e. a goto statement. */
856 struct GTY((tag("GSS_WITH_OPS")))
857 ggoto : public gimple_statement_with_ops
859 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
862 /* A statement with the invariant that
863 stmt->code == GIMPLE_LABEL
864 i.e. a label statement. */
866 struct GTY((tag("GSS_WITH_OPS")))
867 glabel : public gimple_statement_with_ops
869 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
872 /* A statement with the invariant that
873 stmt->code == GIMPLE_SWITCH
874 i.e. a switch statement. */
876 struct GTY((tag("GSS_WITH_OPS")))
877 gswitch : public gimple_statement_with_ops
879 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
882 /* A statement with the invariant that
883 stmt->code == GIMPLE_ASSIGN
884 i.e. an assignment statement. */
886 struct GTY((tag("GSS_WITH_MEM_OPS")))
887 gassign : public gimple_statement_with_memory_ops
889 static const enum gimple_code code_ = GIMPLE_ASSIGN;
890 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
893 /* A statement with the invariant that
894 stmt->code == GIMPLE_RETURN
895 i.e. a return statement. */
897 struct GTY((tag("GSS_WITH_MEM_OPS")))
898 greturn : public gimple_statement_with_memory_ops
900 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
903 template <>
904 template <>
905 inline bool
906 is_a_helper <gasm *>::test (gimple gs)
908 return gs->code == GIMPLE_ASM;
911 template <>
912 template <>
913 inline bool
914 is_a_helper <gassign *>::test (gimple gs)
916 return gs->code == GIMPLE_ASSIGN;
919 template <>
920 template <>
921 inline bool
922 is_a_helper <const gassign *>::test (const_gimple gs)
924 return gs->code == GIMPLE_ASSIGN;
927 template <>
928 template <>
929 inline bool
930 is_a_helper <gbind *>::test (gimple gs)
932 return gs->code == GIMPLE_BIND;
935 template <>
936 template <>
937 inline bool
938 is_a_helper <gcall *>::test (gimple gs)
940 return gs->code == GIMPLE_CALL;
943 template <>
944 template <>
945 inline bool
946 is_a_helper <gcatch *>::test (gimple gs)
948 return gs->code == GIMPLE_CATCH;
951 template <>
952 template <>
953 inline bool
954 is_a_helper <gcond *>::test (gimple gs)
956 return gs->code == GIMPLE_COND;
959 template <>
960 template <>
961 inline bool
962 is_a_helper <gdebug *>::test (gimple gs)
964 return gs->code == GIMPLE_DEBUG;
967 template <>
968 template <>
969 inline bool
970 is_a_helper <ggoto *>::test (gimple gs)
972 return gs->code == GIMPLE_GOTO;
975 template <>
976 template <>
977 inline bool
978 is_a_helper <glabel *>::test (gimple gs)
980 return gs->code == GIMPLE_LABEL;
983 template <>
984 template <>
985 inline bool
986 is_a_helper <gresx *>::test (gimple gs)
988 return gs->code == GIMPLE_RESX;
991 template <>
992 template <>
993 inline bool
994 is_a_helper <geh_dispatch *>::test (gimple gs)
996 return gs->code == GIMPLE_EH_DISPATCH;
999 template <>
1000 template <>
1001 inline bool
1002 is_a_helper <geh_else *>::test (gimple gs)
1004 return gs->code == GIMPLE_EH_ELSE;
1007 template <>
1008 template <>
1009 inline bool
1010 is_a_helper <geh_filter *>::test (gimple gs)
1012 return gs->code == GIMPLE_EH_FILTER;
1015 template <>
1016 template <>
1017 inline bool
1018 is_a_helper <geh_mnt *>::test (gimple gs)
1020 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1023 template <>
1024 template <>
1025 inline bool
1026 is_a_helper <gomp_atomic_load *>::test (gimple gs)
1028 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1031 template <>
1032 template <>
1033 inline bool
1034 is_a_helper <gomp_atomic_store *>::test (gimple gs)
1036 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1039 template <>
1040 template <>
1041 inline bool
1042 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
1044 return gs->code == GIMPLE_OMP_RETURN;
1047 template <>
1048 template <>
1049 inline bool
1050 is_a_helper <gomp_continue *>::test (gimple gs)
1052 return gs->code == GIMPLE_OMP_CONTINUE;
1055 template <>
1056 template <>
1057 inline bool
1058 is_a_helper <gomp_critical *>::test (gimple gs)
1060 return gs->code == GIMPLE_OMP_CRITICAL;
1063 template <>
1064 template <>
1065 inline bool
1066 is_a_helper <gomp_for *>::test (gimple gs)
1068 return gs->code == GIMPLE_OMP_FOR;
1071 template <>
1072 template <>
1073 inline bool
1074 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
1076 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1079 template <>
1080 template <>
1081 inline bool
1082 is_a_helper <gomp_parallel *>::test (gimple gs)
1084 return gs->code == GIMPLE_OMP_PARALLEL;
1087 template <>
1088 template <>
1089 inline bool
1090 is_a_helper <gomp_target *>::test (gimple gs)
1092 return gs->code == GIMPLE_OMP_TARGET;
1095 template <>
1096 template <>
1097 inline bool
1098 is_a_helper <gomp_sections *>::test (gimple gs)
1100 return gs->code == GIMPLE_OMP_SECTIONS;
1103 template <>
1104 template <>
1105 inline bool
1106 is_a_helper <gomp_single *>::test (gimple gs)
1108 return gs->code == GIMPLE_OMP_SINGLE;
1111 template <>
1112 template <>
1113 inline bool
1114 is_a_helper <gomp_teams *>::test (gimple gs)
1116 return gs->code == GIMPLE_OMP_TEAMS;
1119 template <>
1120 template <>
1121 inline bool
1122 is_a_helper <gomp_task *>::test (gimple gs)
1124 return gs->code == GIMPLE_OMP_TASK;
1127 template <>
1128 template <>
1129 inline bool
1130 is_a_helper <gphi *>::test (gimple gs)
1132 return gs->code == GIMPLE_PHI;
1135 template <>
1136 template <>
1137 inline bool
1138 is_a_helper <greturn *>::test (gimple gs)
1140 return gs->code == GIMPLE_RETURN;
1143 template <>
1144 template <>
1145 inline bool
1146 is_a_helper <gswitch *>::test (gimple gs)
1148 return gs->code == GIMPLE_SWITCH;
1151 template <>
1152 template <>
1153 inline bool
1154 is_a_helper <gtransaction *>::test (gimple gs)
1156 return gs->code == GIMPLE_TRANSACTION;
1159 template <>
1160 template <>
1161 inline bool
1162 is_a_helper <gtry *>::test (gimple gs)
1164 return gs->code == GIMPLE_TRY;
1167 template <>
1168 template <>
1169 inline bool
1170 is_a_helper <gimple_statement_wce *>::test (gimple gs)
1172 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1175 template <>
1176 template <>
1177 inline bool
1178 is_a_helper <const gasm *>::test (const_gimple gs)
1180 return gs->code == GIMPLE_ASM;
1183 template <>
1184 template <>
1185 inline bool
1186 is_a_helper <const gbind *>::test (const_gimple gs)
1188 return gs->code == GIMPLE_BIND;
1191 template <>
1192 template <>
1193 inline bool
1194 is_a_helper <const gcall *>::test (const_gimple gs)
1196 return gs->code == GIMPLE_CALL;
1199 template <>
1200 template <>
1201 inline bool
1202 is_a_helper <const gcatch *>::test (const_gimple gs)
1204 return gs->code == GIMPLE_CATCH;
1207 template <>
1208 template <>
1209 inline bool
1210 is_a_helper <const gresx *>::test (const_gimple gs)
1212 return gs->code == GIMPLE_RESX;
1215 template <>
1216 template <>
1217 inline bool
1218 is_a_helper <const geh_dispatch *>::test (const_gimple gs)
1220 return gs->code == GIMPLE_EH_DISPATCH;
1223 template <>
1224 template <>
1225 inline bool
1226 is_a_helper <const geh_filter *>::test (const_gimple gs)
1228 return gs->code == GIMPLE_EH_FILTER;
1231 template <>
1232 template <>
1233 inline bool
1234 is_a_helper <const gomp_atomic_load *>::test (const_gimple gs)
1236 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1239 template <>
1240 template <>
1241 inline bool
1242 is_a_helper <const gomp_atomic_store *>::test (const_gimple gs)
1244 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1247 template <>
1248 template <>
1249 inline bool
1250 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1252 return gs->code == GIMPLE_OMP_RETURN;
1255 template <>
1256 template <>
1257 inline bool
1258 is_a_helper <const gomp_continue *>::test (const_gimple gs)
1260 return gs->code == GIMPLE_OMP_CONTINUE;
1263 template <>
1264 template <>
1265 inline bool
1266 is_a_helper <const gomp_critical *>::test (const_gimple gs)
1268 return gs->code == GIMPLE_OMP_CRITICAL;
1271 template <>
1272 template <>
1273 inline bool
1274 is_a_helper <const gomp_for *>::test (const_gimple gs)
1276 return gs->code == GIMPLE_OMP_FOR;
1279 template <>
1280 template <>
1281 inline bool
1282 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1284 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1287 template <>
1288 template <>
1289 inline bool
1290 is_a_helper <const gomp_parallel *>::test (const_gimple gs)
1292 return gs->code == GIMPLE_OMP_PARALLEL;
1295 template <>
1296 template <>
1297 inline bool
1298 is_a_helper <const gomp_target *>::test (const_gimple gs)
1300 return gs->code == GIMPLE_OMP_TARGET;
1303 template <>
1304 template <>
1305 inline bool
1306 is_a_helper <const gomp_sections *>::test (const_gimple gs)
1308 return gs->code == GIMPLE_OMP_SECTIONS;
1311 template <>
1312 template <>
1313 inline bool
1314 is_a_helper <const gomp_single *>::test (const_gimple gs)
1316 return gs->code == GIMPLE_OMP_SINGLE;
1319 template <>
1320 template <>
1321 inline bool
1322 is_a_helper <const gomp_teams *>::test (const_gimple gs)
1324 return gs->code == GIMPLE_OMP_TEAMS;
1327 template <>
1328 template <>
1329 inline bool
1330 is_a_helper <const gomp_task *>::test (const_gimple gs)
1332 return gs->code == GIMPLE_OMP_TASK;
1335 template <>
1336 template <>
1337 inline bool
1338 is_a_helper <const gphi *>::test (const_gimple gs)
1340 return gs->code == GIMPLE_PHI;
1343 template <>
1344 template <>
1345 inline bool
1346 is_a_helper <const gtransaction *>::test (const_gimple gs)
1348 return gs->code == GIMPLE_TRANSACTION;
1351 /* Offset in bytes to the location of the operand vector.
1352 Zero if there is no operand vector for this tuple structure. */
1353 extern size_t const gimple_ops_offset_[];
1355 /* Map GIMPLE codes to GSS codes. */
1356 extern enum gimple_statement_structure_enum const gss_for_code_[];
1358 /* This variable holds the currently expanded gimple statement for purposes
1359 of comminucating the profile info to the builtin expanders. */
1360 extern gimple currently_expanding_gimple_stmt;
1362 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1363 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1364 greturn *gimple_build_return (tree);
1365 void gimple_call_reset_alias_info (gcall *);
1366 gcall *gimple_build_call_vec (tree, vec<tree> );
1367 gcall *gimple_build_call (tree, unsigned, ...);
1368 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1369 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1370 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1371 gcall *gimple_build_call_from_tree (tree);
1372 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1373 gassign *gimple_build_assign (tree, enum tree_code,
1374 tree, tree, tree CXX_MEM_STAT_INFO);
1375 gassign *gimple_build_assign (tree, enum tree_code,
1376 tree, tree CXX_MEM_STAT_INFO);
1377 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1378 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1379 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1380 void gimple_cond_set_condition_from_tree (gcond *, tree);
1381 glabel *gimple_build_label (tree label);
1382 ggoto *gimple_build_goto (tree dest);
1383 gimple gimple_build_nop (void);
1384 gbind *gimple_build_bind (tree, gimple_seq, tree);
1385 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1386 vec<tree, va_gc> *, vec<tree, va_gc> *,
1387 vec<tree, va_gc> *);
1388 gcatch *gimple_build_catch (tree, gimple_seq);
1389 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1390 geh_mnt *gimple_build_eh_must_not_throw (tree);
1391 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1392 gtry *gimple_build_try (gimple_seq, gimple_seq,
1393 enum gimple_try_flags);
1394 gimple gimple_build_wce (gimple_seq);
1395 gresx *gimple_build_resx (int);
1396 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1397 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1398 geh_dispatch *gimple_build_eh_dispatch (int);
1399 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1400 #define gimple_build_debug_bind(var,val,stmt) \
1401 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1402 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1403 #define gimple_build_debug_source_bind(var,val,stmt) \
1404 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1405 gomp_critical *gimple_build_omp_critical (gimple_seq, tree);
1406 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1407 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1408 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1409 tree, tree);
1410 gimple gimple_build_omp_section (gimple_seq);
1411 gimple gimple_build_omp_master (gimple_seq);
1412 gimple gimple_build_omp_taskgroup (gimple_seq);
1413 gomp_continue *gimple_build_omp_continue (tree, tree);
1414 gimple gimple_build_omp_ordered (gimple_seq);
1415 gimple gimple_build_omp_return (bool);
1416 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1417 gimple gimple_build_omp_sections_switch (void);
1418 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1419 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1420 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1421 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1422 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1423 gtransaction *gimple_build_transaction (gimple_seq, tree);
1424 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1425 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1426 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1427 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1428 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1429 location_t);
1430 extern void annotate_all_with_location (gimple_seq, location_t);
1431 bool empty_body_p (gimple_seq);
1432 gimple_seq gimple_seq_copy (gimple_seq);
1433 bool gimple_call_same_target_p (const_gimple, const_gimple);
1434 int gimple_call_flags (const_gimple);
1435 int gimple_call_arg_flags (const gcall *, unsigned);
1436 int gimple_call_return_flags (const gcall *);
1437 bool gimple_assign_copy_p (gimple);
1438 bool gimple_assign_ssa_name_copy_p (gimple);
1439 bool gimple_assign_unary_nop_p (gimple);
1440 void gimple_set_bb (gimple, basic_block);
1441 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1442 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1443 tree, tree, tree);
1444 tree gimple_get_lhs (const_gimple);
1445 void gimple_set_lhs (gimple, tree);
1446 gimple gimple_copy (gimple);
1447 bool gimple_has_side_effects (const_gimple);
1448 bool gimple_could_trap_p_1 (gimple, bool, bool);
1449 bool gimple_could_trap_p (gimple);
1450 bool gimple_assign_rhs_could_trap_p (gimple);
1451 extern void dump_gimple_statistics (void);
1452 unsigned get_gimple_rhs_num_ops (enum tree_code);
1453 extern tree canonicalize_cond_expr_cond (tree);
1454 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1455 extern bool gimple_compare_field_offset (tree, tree);
1456 extern tree gimple_unsigned_type (tree);
1457 extern tree gimple_signed_type (tree);
1458 extern alias_set_type gimple_get_alias_set (tree);
1459 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1460 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1461 extern bool gimple_call_builtin_p (const_gimple);
1462 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1463 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1464 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1465 extern void dump_decl_set (FILE *, bitmap);
1466 extern bool nonfreeing_call_p (gimple);
1467 extern bool infer_nonnull_range (gimple, tree);
1468 extern bool infer_nonnull_range_by_dereference (gimple, tree);
1469 extern bool infer_nonnull_range_by_attribute (gimple, tree);
1470 extern void sort_case_labels (vec<tree>);
1471 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1472 extern void gimple_seq_set_location (gimple_seq, location_t);
1473 extern void gimple_seq_discard (gimple_seq);
1474 extern void maybe_remove_unused_call_args (struct function *, gimple);
1476 /* Formal (expression) temporary table handling: multiple occurrences of
1477 the same scalar expression are evaluated into the same temporary. */
1479 typedef struct gimple_temp_hash_elt
1481 tree val; /* Key */
1482 tree temp; /* Value */
1483 } elt_t;
1485 /* Get the number of the next statement uid to be allocated. */
1486 static inline unsigned int
1487 gimple_stmt_max_uid (struct function *fn)
1489 return fn->last_stmt_uid;
1492 /* Set the number of the next statement uid to be allocated. */
1493 static inline void
1494 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1496 fn->last_stmt_uid = maxid;
1499 /* Set the number of the next statement uid to be allocated. */
1500 static inline unsigned int
1501 inc_gimple_stmt_max_uid (struct function *fn)
1503 return fn->last_stmt_uid++;
1506 /* Return the first node in GIMPLE sequence S. */
1508 static inline gimple_seq_node
1509 gimple_seq_first (gimple_seq s)
1511 return s;
1515 /* Return the first statement in GIMPLE sequence S. */
1517 static inline gimple
1518 gimple_seq_first_stmt (gimple_seq s)
1520 gimple_seq_node n = gimple_seq_first (s);
1521 return n;
1524 /* Return the first statement in GIMPLE sequence S as a gbind *,
1525 verifying that it has code GIMPLE_BIND in a checked build. */
1527 static inline gbind *
1528 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1530 gimple_seq_node n = gimple_seq_first (s);
1531 return as_a <gbind *> (n);
1535 /* Return the last node in GIMPLE sequence S. */
1537 static inline gimple_seq_node
1538 gimple_seq_last (gimple_seq s)
1540 return s ? s->prev : NULL;
1544 /* Return the last statement in GIMPLE sequence S. */
1546 static inline gimple
1547 gimple_seq_last_stmt (gimple_seq s)
1549 gimple_seq_node n = gimple_seq_last (s);
1550 return n;
1554 /* Set the last node in GIMPLE sequence *PS to LAST. */
1556 static inline void
1557 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1559 (*ps)->prev = last;
1563 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1565 static inline void
1566 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1568 *ps = first;
1572 /* Return true if GIMPLE sequence S is empty. */
1574 static inline bool
1575 gimple_seq_empty_p (gimple_seq s)
1577 return s == NULL;
1580 /* Allocate a new sequence and initialize its first element with STMT. */
1582 static inline gimple_seq
1583 gimple_seq_alloc_with_stmt (gimple stmt)
1585 gimple_seq seq = NULL;
1586 gimple_seq_add_stmt (&seq, stmt);
1587 return seq;
1591 /* Returns the sequence of statements in BB. */
1593 static inline gimple_seq
1594 bb_seq (const_basic_block bb)
1596 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1599 static inline gimple_seq *
1600 bb_seq_addr (basic_block bb)
1602 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1605 /* Sets the sequence of statements in BB to SEQ. */
1607 static inline void
1608 set_bb_seq (basic_block bb, gimple_seq seq)
1610 gcc_checking_assert (!(bb->flags & BB_RTL));
1611 bb->il.gimple.seq = seq;
1615 /* Return the code for GIMPLE statement G. */
1617 static inline enum gimple_code
1618 gimple_code (const_gimple g)
1620 return g->code;
1624 /* Return the GSS code used by a GIMPLE code. */
1626 static inline enum gimple_statement_structure_enum
1627 gss_for_code (enum gimple_code code)
1629 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1630 return gss_for_code_[code];
1634 /* Return which GSS code is used by GS. */
1636 static inline enum gimple_statement_structure_enum
1637 gimple_statement_structure (gimple gs)
1639 return gss_for_code (gimple_code (gs));
1643 /* Return true if statement G has sub-statements. This is only true for
1644 High GIMPLE statements. */
1646 static inline bool
1647 gimple_has_substatements (gimple g)
1649 switch (gimple_code (g))
1651 case GIMPLE_BIND:
1652 case GIMPLE_CATCH:
1653 case GIMPLE_EH_FILTER:
1654 case GIMPLE_EH_ELSE:
1655 case GIMPLE_TRY:
1656 case GIMPLE_OMP_FOR:
1657 case GIMPLE_OMP_MASTER:
1658 case GIMPLE_OMP_TASKGROUP:
1659 case GIMPLE_OMP_ORDERED:
1660 case GIMPLE_OMP_SECTION:
1661 case GIMPLE_OMP_PARALLEL:
1662 case GIMPLE_OMP_TASK:
1663 case GIMPLE_OMP_SECTIONS:
1664 case GIMPLE_OMP_SINGLE:
1665 case GIMPLE_OMP_TARGET:
1666 case GIMPLE_OMP_TEAMS:
1667 case GIMPLE_OMP_CRITICAL:
1668 case GIMPLE_WITH_CLEANUP_EXPR:
1669 case GIMPLE_TRANSACTION:
1670 return true;
1672 default:
1673 return false;
1678 /* Return the basic block holding statement G. */
1680 static inline basic_block
1681 gimple_bb (const_gimple g)
1683 return g->bb;
1687 /* Return the lexical scope block holding statement G. */
1689 static inline tree
1690 gimple_block (const_gimple g)
1692 return LOCATION_BLOCK (g->location);
1696 /* Set BLOCK to be the lexical scope block holding statement G. */
1698 static inline void
1699 gimple_set_block (gimple g, tree block)
1701 if (block)
1702 g->location =
1703 COMBINE_LOCATION_DATA (line_table, g->location, block);
1704 else
1705 g->location = LOCATION_LOCUS (g->location);
1709 /* Return location information for statement G. */
1711 static inline location_t
1712 gimple_location (const_gimple g)
1714 return g->location;
1717 /* Return location information for statement G if g is not NULL.
1718 Otherwise, UNKNOWN_LOCATION is returned. */
1720 static inline location_t
1721 gimple_location_safe (const_gimple g)
1723 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1726 /* Return pointer to location information for statement G. */
1728 static inline const location_t *
1729 gimple_location_ptr (const_gimple g)
1731 return &g->location;
1735 /* Set location information for statement G. */
1737 static inline void
1738 gimple_set_location (gimple g, location_t location)
1740 g->location = location;
1744 /* Return true if G contains location information. */
1746 static inline bool
1747 gimple_has_location (const_gimple g)
1749 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1753 /* Return the file name of the location of STMT. */
1755 static inline const char *
1756 gimple_filename (const_gimple stmt)
1758 return LOCATION_FILE (gimple_location (stmt));
1762 /* Return the line number of the location of STMT. */
1764 static inline int
1765 gimple_lineno (const_gimple stmt)
1767 return LOCATION_LINE (gimple_location (stmt));
1771 /* Determine whether SEQ is a singleton. */
1773 static inline bool
1774 gimple_seq_singleton_p (gimple_seq seq)
1776 return ((gimple_seq_first (seq) != NULL)
1777 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1780 /* Return true if no warnings should be emitted for statement STMT. */
1782 static inline bool
1783 gimple_no_warning_p (const_gimple stmt)
1785 return stmt->no_warning;
1788 /* Set the no_warning flag of STMT to NO_WARNING. */
1790 static inline void
1791 gimple_set_no_warning (gimple stmt, bool no_warning)
1793 stmt->no_warning = (unsigned) no_warning;
1796 /* Set the visited status on statement STMT to VISITED_P.
1798 Please note that this 'visited' property of the gimple statement is
1799 supposed to be undefined at pass boundaries. This means that a
1800 given pass should not assume it contains any useful value when the
1801 pass starts and thus can set it to any value it sees fit.
1803 You can learn more about the visited property of the gimple
1804 statement by reading the comments of the 'visited' data member of
1805 struct gimple statement_base.
1808 static inline void
1809 gimple_set_visited (gimple stmt, bool visited_p)
1811 stmt->visited = (unsigned) visited_p;
1815 /* Return the visited status for statement STMT.
1817 Please note that this 'visited' property of the gimple statement is
1818 supposed to be undefined at pass boundaries. This means that a
1819 given pass should not assume it contains any useful value when the
1820 pass starts and thus can set it to any value it sees fit.
1822 You can learn more about the visited property of the gimple
1823 statement by reading the comments of the 'visited' data member of
1824 struct gimple statement_base. */
1826 static inline bool
1827 gimple_visited_p (gimple stmt)
1829 return stmt->visited;
1833 /* Set pass local flag PLF on statement STMT to VAL_P.
1835 Please note that this PLF property of the gimple statement is
1836 supposed to be undefined at pass boundaries. This means that a
1837 given pass should not assume it contains any useful value when the
1838 pass starts and thus can set it to any value it sees fit.
1840 You can learn more about the PLF property by reading the comment of
1841 the 'plf' data member of struct gimple_statement_structure. */
1843 static inline void
1844 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1846 if (val_p)
1847 stmt->plf |= (unsigned int) plf;
1848 else
1849 stmt->plf &= ~((unsigned int) plf);
1853 /* Return the value of pass local flag PLF on statement STMT.
1855 Please note that this 'plf' property of the gimple statement is
1856 supposed to be undefined at pass boundaries. This means that a
1857 given pass should not assume it contains any useful value when the
1858 pass starts and thus can set it to any value it sees fit.
1860 You can learn more about the plf property by reading the comment of
1861 the 'plf' data member of struct gimple_statement_structure. */
1863 static inline unsigned int
1864 gimple_plf (gimple stmt, enum plf_mask plf)
1866 return stmt->plf & ((unsigned int) plf);
1870 /* Set the UID of statement.
1872 Please note that this UID property is supposed to be undefined at
1873 pass boundaries. This means that a given pass should not assume it
1874 contains any useful value when the pass starts and thus can set it
1875 to any value it sees fit. */
1877 static inline void
1878 gimple_set_uid (gimple g, unsigned uid)
1880 g->uid = uid;
1884 /* Return the UID of statement.
1886 Please note that this UID property is supposed to be undefined at
1887 pass boundaries. This means that a given pass should not assume it
1888 contains any useful value when the pass starts and thus can set it
1889 to any value it sees fit. */
1891 static inline unsigned
1892 gimple_uid (const_gimple g)
1894 return g->uid;
1898 /* Make statement G a singleton sequence. */
1900 static inline void
1901 gimple_init_singleton (gimple g)
1903 g->next = NULL;
1904 g->prev = g;
1908 /* Return true if GIMPLE statement G has register or memory operands. */
1910 static inline bool
1911 gimple_has_ops (const_gimple g)
1913 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1916 template <>
1917 template <>
1918 inline bool
1919 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1921 return gimple_has_ops (gs);
1924 template <>
1925 template <>
1926 inline bool
1927 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1929 return gimple_has_ops (gs);
1932 /* Return true if GIMPLE statement G has memory operands. */
1934 static inline bool
1935 gimple_has_mem_ops (const_gimple g)
1937 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1940 template <>
1941 template <>
1942 inline bool
1943 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1945 return gimple_has_mem_ops (gs);
1948 template <>
1949 template <>
1950 inline bool
1951 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1953 return gimple_has_mem_ops (gs);
1956 /* Return the set of USE operands for statement G. */
1958 static inline struct use_optype_d *
1959 gimple_use_ops (const_gimple g)
1961 const gimple_statement_with_ops *ops_stmt =
1962 dyn_cast <const gimple_statement_with_ops *> (g);
1963 if (!ops_stmt)
1964 return NULL;
1965 return ops_stmt->use_ops;
1969 /* Set USE to be the set of USE operands for statement G. */
1971 static inline void
1972 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1974 gimple_statement_with_ops *ops_stmt =
1975 as_a <gimple_statement_with_ops *> (g);
1976 ops_stmt->use_ops = use;
1980 /* Return the single VUSE operand of the statement G. */
1982 static inline tree
1983 gimple_vuse (const_gimple g)
1985 const gimple_statement_with_memory_ops *mem_ops_stmt =
1986 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1987 if (!mem_ops_stmt)
1988 return NULL_TREE;
1989 return mem_ops_stmt->vuse;
1992 /* Return the single VDEF operand of the statement G. */
1994 static inline tree
1995 gimple_vdef (const_gimple g)
1997 const gimple_statement_with_memory_ops *mem_ops_stmt =
1998 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1999 if (!mem_ops_stmt)
2000 return NULL_TREE;
2001 return mem_ops_stmt->vdef;
2004 /* Return the single VUSE operand of the statement G. */
2006 static inline tree *
2007 gimple_vuse_ptr (gimple g)
2009 gimple_statement_with_memory_ops *mem_ops_stmt =
2010 dyn_cast <gimple_statement_with_memory_ops *> (g);
2011 if (!mem_ops_stmt)
2012 return NULL;
2013 return &mem_ops_stmt->vuse;
2016 /* Return the single VDEF operand of the statement G. */
2018 static inline tree *
2019 gimple_vdef_ptr (gimple g)
2021 gimple_statement_with_memory_ops *mem_ops_stmt =
2022 dyn_cast <gimple_statement_with_memory_ops *> (g);
2023 if (!mem_ops_stmt)
2024 return NULL;
2025 return &mem_ops_stmt->vdef;
2028 /* Set the single VUSE operand of the statement G. */
2030 static inline void
2031 gimple_set_vuse (gimple g, tree vuse)
2033 gimple_statement_with_memory_ops *mem_ops_stmt =
2034 as_a <gimple_statement_with_memory_ops *> (g);
2035 mem_ops_stmt->vuse = vuse;
2038 /* Set the single VDEF operand of the statement G. */
2040 static inline void
2041 gimple_set_vdef (gimple g, tree vdef)
2043 gimple_statement_with_memory_ops *mem_ops_stmt =
2044 as_a <gimple_statement_with_memory_ops *> (g);
2045 mem_ops_stmt->vdef = vdef;
2049 /* Return true if statement G has operands and the modified field has
2050 been set. */
2052 static inline bool
2053 gimple_modified_p (const_gimple g)
2055 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2059 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2060 a MODIFIED field. */
2062 static inline void
2063 gimple_set_modified (gimple s, bool modifiedp)
2065 if (gimple_has_ops (s))
2066 s->modified = (unsigned) modifiedp;
2070 /* Return the tree code for the expression computed by STMT. This is
2071 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2072 GIMPLE_CALL, return CALL_EXPR as the expression code for
2073 consistency. This is useful when the caller needs to deal with the
2074 three kinds of computation that GIMPLE supports. */
2076 static inline enum tree_code
2077 gimple_expr_code (const_gimple stmt)
2079 enum gimple_code code = gimple_code (stmt);
2080 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2081 return (enum tree_code) stmt->subcode;
2082 else
2084 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2085 return CALL_EXPR;
2090 /* Return true if statement STMT contains volatile operands. */
2092 static inline bool
2093 gimple_has_volatile_ops (const_gimple stmt)
2095 if (gimple_has_mem_ops (stmt))
2096 return stmt->has_volatile_ops;
2097 else
2098 return false;
2102 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2104 static inline void
2105 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
2107 if (gimple_has_mem_ops (stmt))
2108 stmt->has_volatile_ops = (unsigned) volatilep;
2111 /* Return true if STMT is in a transaction. */
2113 static inline bool
2114 gimple_in_transaction (gimple stmt)
2116 return bb_in_transaction (gimple_bb (stmt));
2119 /* Return true if statement STMT may access memory. */
2121 static inline bool
2122 gimple_references_memory_p (gimple stmt)
2124 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2128 /* Return the subcode for OMP statement S. */
2130 static inline unsigned
2131 gimple_omp_subcode (const_gimple s)
2133 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2134 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2135 return s->subcode;
2138 /* Set the subcode for OMP statement S to SUBCODE. */
2140 static inline void
2141 gimple_omp_set_subcode (gimple s, unsigned int subcode)
2143 /* We only have 16 bits for the subcode. Assert that we are not
2144 overflowing it. */
2145 gcc_gimple_checking_assert (subcode < (1 << 16));
2146 s->subcode = subcode;
2149 /* Set the nowait flag on OMP_RETURN statement S. */
2151 static inline void
2152 gimple_omp_return_set_nowait (gimple s)
2154 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2155 s->subcode |= GF_OMP_RETURN_NOWAIT;
2159 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2160 flag set. */
2162 static inline bool
2163 gimple_omp_return_nowait_p (const_gimple g)
2165 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2166 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2170 /* Set the LHS of OMP return. */
2172 static inline void
2173 gimple_omp_return_set_lhs (gimple g, tree lhs)
2175 gimple_statement_omp_return *omp_return_stmt =
2176 as_a <gimple_statement_omp_return *> (g);
2177 omp_return_stmt->val = lhs;
2181 /* Get the LHS of OMP return. */
2183 static inline tree
2184 gimple_omp_return_lhs (const_gimple g)
2186 const gimple_statement_omp_return *omp_return_stmt =
2187 as_a <const gimple_statement_omp_return *> (g);
2188 return omp_return_stmt->val;
2192 /* Return a pointer to the LHS of OMP return. */
2194 static inline tree *
2195 gimple_omp_return_lhs_ptr (gimple g)
2197 gimple_statement_omp_return *omp_return_stmt =
2198 as_a <gimple_statement_omp_return *> (g);
2199 return &omp_return_stmt->val;
2203 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2204 flag set. */
2206 static inline bool
2207 gimple_omp_section_last_p (const_gimple g)
2209 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2210 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2214 /* Set the GF_OMP_SECTION_LAST flag on G. */
2216 static inline void
2217 gimple_omp_section_set_last (gimple g)
2219 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2220 g->subcode |= GF_OMP_SECTION_LAST;
2224 /* Return true if OMP parallel statement G has the
2225 GF_OMP_PARALLEL_COMBINED flag set. */
2227 static inline bool
2228 gimple_omp_parallel_combined_p (const_gimple g)
2230 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2231 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2235 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2236 value of COMBINED_P. */
2238 static inline void
2239 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2241 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2242 if (combined_p)
2243 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2244 else
2245 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2249 /* Return true if OMP atomic load/store statement G has the
2250 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2252 static inline bool
2253 gimple_omp_atomic_need_value_p (const_gimple g)
2255 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2256 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2257 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2261 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2263 static inline void
2264 gimple_omp_atomic_set_need_value (gimple g)
2266 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2267 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2268 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2272 /* Return true if OMP atomic load/store statement G has the
2273 GF_OMP_ATOMIC_SEQ_CST flag set. */
2275 static inline bool
2276 gimple_omp_atomic_seq_cst_p (const_gimple g)
2278 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2279 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2280 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2284 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2286 static inline void
2287 gimple_omp_atomic_set_seq_cst (gimple g)
2289 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2290 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2291 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2295 /* Return the number of operands for statement GS. */
2297 static inline unsigned
2298 gimple_num_ops (const_gimple gs)
2300 return gs->num_ops;
2304 /* Set the number of operands for statement GS. */
2306 static inline void
2307 gimple_set_num_ops (gimple gs, unsigned num_ops)
2309 gs->num_ops = num_ops;
2313 /* Return the array of operands for statement GS. */
2315 static inline tree *
2316 gimple_ops (gimple gs)
2318 size_t off;
2320 /* All the tuples have their operand vector at the very bottom
2321 of the structure. Note that those structures that do not
2322 have an operand vector have a zero offset. */
2323 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2324 gcc_gimple_checking_assert (off != 0);
2326 return (tree *) ((char *) gs + off);
2330 /* Return operand I for statement GS. */
2332 static inline tree
2333 gimple_op (const_gimple gs, unsigned i)
2335 if (gimple_has_ops (gs))
2337 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2338 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2340 else
2341 return NULL_TREE;
2344 /* Return a pointer to operand I for statement GS. */
2346 static inline tree *
2347 gimple_op_ptr (const_gimple gs, unsigned i)
2349 if (gimple_has_ops (gs))
2351 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2352 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2354 else
2355 return NULL;
2358 /* Set operand I of statement GS to OP. */
2360 static inline void
2361 gimple_set_op (gimple gs, unsigned i, tree op)
2363 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2365 /* Note. It may be tempting to assert that OP matches
2366 is_gimple_operand, but that would be wrong. Different tuples
2367 accept slightly different sets of tree operands. Each caller
2368 should perform its own validation. */
2369 gimple_ops (gs)[i] = op;
2372 /* Return true if GS is a GIMPLE_ASSIGN. */
2374 static inline bool
2375 is_gimple_assign (const_gimple gs)
2377 return gimple_code (gs) == GIMPLE_ASSIGN;
2380 /* Determine if expression CODE is one of the valid expressions that can
2381 be used on the RHS of GIMPLE assignments. */
2383 static inline enum gimple_rhs_class
2384 get_gimple_rhs_class (enum tree_code code)
2386 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2389 /* Return the LHS of assignment statement GS. */
2391 static inline tree
2392 gimple_assign_lhs (const gassign *gs)
2394 return gs->op[0];
2397 static inline tree
2398 gimple_assign_lhs (const_gimple gs)
2400 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2401 return gimple_assign_lhs (ass);
2405 /* Return a pointer to the LHS of assignment statement GS. */
2407 static inline tree *
2408 gimple_assign_lhs_ptr (const gassign *gs)
2410 return const_cast<tree *> (&gs->op[0]);
2413 static inline tree *
2414 gimple_assign_lhs_ptr (const_gimple gs)
2416 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2417 return gimple_assign_lhs_ptr (ass);
2421 /* Set LHS to be the LHS operand of assignment statement GS. */
2423 static inline void
2424 gimple_assign_set_lhs (gassign *gs, tree lhs)
2426 gs->op[0] = lhs;
2428 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2429 SSA_NAME_DEF_STMT (lhs) = gs;
2432 static inline void
2433 gimple_assign_set_lhs (gimple gs, tree lhs)
2435 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2436 gimple_assign_set_lhs (ass, lhs);
2440 /* Return the first operand on the RHS of assignment statement GS. */
2442 static inline tree
2443 gimple_assign_rhs1 (const gassign *gs)
2445 return gs->op[1];
2448 static inline tree
2449 gimple_assign_rhs1 (const_gimple gs)
2451 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2452 return gimple_assign_rhs1 (ass);
2456 /* Return a pointer to the first operand on the RHS of assignment
2457 statement GS. */
2459 static inline tree *
2460 gimple_assign_rhs1_ptr (const gassign *gs)
2462 return const_cast<tree *> (&gs->op[1]);
2465 static inline tree *
2466 gimple_assign_rhs1_ptr (const_gimple gs)
2468 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2469 return gimple_assign_rhs1_ptr (ass);
2472 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2474 static inline void
2475 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2477 gs->op[1] = rhs;
2480 static inline void
2481 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2483 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2484 gimple_assign_set_rhs1 (ass, rhs);
2488 /* Return the second operand on the RHS of assignment statement GS.
2489 If GS does not have two operands, NULL is returned instead. */
2491 static inline tree
2492 gimple_assign_rhs2 (const gassign *gs)
2494 if (gimple_num_ops (gs) >= 3)
2495 return gs->op[2];
2496 else
2497 return NULL_TREE;
2500 static inline tree
2501 gimple_assign_rhs2 (const_gimple gs)
2503 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2504 return gimple_assign_rhs2 (ass);
2508 /* Return a pointer to the second operand on the RHS of assignment
2509 statement GS. */
2511 static inline tree *
2512 gimple_assign_rhs2_ptr (const gassign *gs)
2514 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2515 return const_cast<tree *> (&gs->op[2]);
2518 static inline tree *
2519 gimple_assign_rhs2_ptr (const_gimple gs)
2521 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2522 return gimple_assign_rhs2_ptr (ass);
2526 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2528 static inline void
2529 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2531 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2532 gs->op[2] = rhs;
2535 static inline void
2536 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2538 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2539 return gimple_assign_set_rhs2 (ass, rhs);
2542 /* Return the third operand on the RHS of assignment statement GS.
2543 If GS does not have two operands, NULL is returned instead. */
2545 static inline tree
2546 gimple_assign_rhs3 (const gassign *gs)
2548 if (gimple_num_ops (gs) >= 4)
2549 return gs->op[3];
2550 else
2551 return NULL_TREE;
2554 static inline tree
2555 gimple_assign_rhs3 (const_gimple gs)
2557 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2558 return gimple_assign_rhs3 (ass);
2561 /* Return a pointer to the third operand on the RHS of assignment
2562 statement GS. */
2564 static inline tree *
2565 gimple_assign_rhs3_ptr (const_gimple gs)
2567 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2568 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2569 return const_cast<tree *> (&ass->op[3]);
2573 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2575 static inline void
2576 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2578 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2579 gs->op[3] = rhs;
2582 static inline void
2583 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2585 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2586 gimple_assign_set_rhs3 (ass, rhs);
2590 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2591 which expect to see only two operands. */
2593 static inline void
2594 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2595 tree op1, tree op2)
2597 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2600 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2601 which expect to see only one operands. */
2603 static inline void
2604 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2605 tree op1)
2607 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2610 /* Returns true if GS is a nontemporal move. */
2612 static inline bool
2613 gimple_assign_nontemporal_move_p (const gassign *gs)
2615 return gs->nontemporal_move;
2618 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2620 static inline void
2621 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2623 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2624 gs->nontemporal_move = nontemporal;
2628 /* Return the code of the expression computed on the rhs of assignment
2629 statement GS. In case that the RHS is a single object, returns the
2630 tree code of the object. */
2632 static inline enum tree_code
2633 gimple_assign_rhs_code (const gassign *gs)
2635 enum tree_code code = (enum tree_code) gs->subcode;
2636 /* While we initially set subcode to the TREE_CODE of the rhs for
2637 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2638 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2639 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2640 code = TREE_CODE (gs->op[1]);
2642 return code;
2645 static inline enum tree_code
2646 gimple_assign_rhs_code (const_gimple gs)
2648 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2649 return gimple_assign_rhs_code (ass);
2653 /* Set CODE to be the code for the expression computed on the RHS of
2654 assignment S. */
2656 static inline void
2657 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2659 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2660 s->subcode = code;
2664 /* Return the gimple rhs class of the code of the expression computed on
2665 the rhs of assignment statement GS.
2666 This will never return GIMPLE_INVALID_RHS. */
2668 static inline enum gimple_rhs_class
2669 gimple_assign_rhs_class (const_gimple gs)
2671 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2674 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2675 there is no operator associated with the assignment itself.
2676 Unlike gimple_assign_copy_p, this predicate returns true for
2677 any RHS operand, including those that perform an operation
2678 and do not have the semantics of a copy, such as COND_EXPR. */
2680 static inline bool
2681 gimple_assign_single_p (const_gimple gs)
2683 return (is_gimple_assign (gs)
2684 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2687 /* Return true if GS performs a store to its lhs. */
2689 static inline bool
2690 gimple_store_p (const_gimple gs)
2692 tree lhs = gimple_get_lhs (gs);
2693 return lhs && !is_gimple_reg (lhs);
2696 /* Return true if GS is an assignment that loads from its rhs1. */
2698 static inline bool
2699 gimple_assign_load_p (const_gimple gs)
2701 tree rhs;
2702 if (!gimple_assign_single_p (gs))
2703 return false;
2704 rhs = gimple_assign_rhs1 (gs);
2705 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2706 return true;
2707 rhs = get_base_address (rhs);
2708 return (DECL_P (rhs)
2709 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2713 /* Return true if S is a type-cast assignment. */
2715 static inline bool
2716 gimple_assign_cast_p (const_gimple s)
2718 if (is_gimple_assign (s))
2720 enum tree_code sc = gimple_assign_rhs_code (s);
2721 return CONVERT_EXPR_CODE_P (sc)
2722 || sc == VIEW_CONVERT_EXPR
2723 || sc == FIX_TRUNC_EXPR;
2726 return false;
2729 /* Return true if S is a clobber statement. */
2731 static inline bool
2732 gimple_clobber_p (const_gimple s)
2734 return gimple_assign_single_p (s)
2735 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2738 /* Return true if GS is a GIMPLE_CALL. */
2740 static inline bool
2741 is_gimple_call (const_gimple gs)
2743 return gimple_code (gs) == GIMPLE_CALL;
2746 /* Return the LHS of call statement GS. */
2748 static inline tree
2749 gimple_call_lhs (const_gimple gs)
2751 GIMPLE_CHECK (gs, GIMPLE_CALL);
2752 return gimple_op (gs, 0);
2756 /* Return a pointer to the LHS of call statement GS. */
2758 static inline tree *
2759 gimple_call_lhs_ptr (const_gimple gs)
2761 GIMPLE_CHECK (gs, GIMPLE_CALL);
2762 return gimple_op_ptr (gs, 0);
2766 /* Set LHS to be the LHS operand of call statement GS. */
2768 static inline void
2769 gimple_call_set_lhs (gimple gs, tree lhs)
2771 GIMPLE_CHECK (gs, GIMPLE_CALL);
2772 gimple_set_op (gs, 0, lhs);
2773 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2774 SSA_NAME_DEF_STMT (lhs) = gs;
2778 /* Return true if call GS calls an internal-only function, as enumerated
2779 by internal_fn. */
2781 static inline bool
2782 gimple_call_internal_p (const_gimple gs)
2784 GIMPLE_CHECK (gs, GIMPLE_CALL);
2785 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2789 /* Return true if call GS is marked as instrumented by
2790 Pointer Bounds Checker. */
2792 static inline bool
2793 gimple_call_with_bounds_p (const_gimple gs)
2795 GIMPLE_CHECK (gs, GIMPLE_CALL);
2796 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2800 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2801 Pointer Bounds Checker. */
2803 static inline void
2804 gimple_call_set_with_bounds (gimple gs, bool with_bounds)
2806 GIMPLE_CHECK (gs, GIMPLE_CALL);
2807 if (with_bounds)
2808 gs->subcode |= GF_CALL_WITH_BOUNDS;
2809 else
2810 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2814 /* Return the target of internal call GS. */
2816 static inline enum internal_fn
2817 gimple_call_internal_fn (const_gimple gs)
2819 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2820 return static_cast <const gcall *> (gs)->u.internal_fn;
2823 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2824 that could alter control flow. */
2826 static inline void
2827 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2829 GIMPLE_CHECK (s, GIMPLE_CALL);
2830 if (ctrl_altering_p)
2831 s->subcode |= GF_CALL_CTRL_ALTERING;
2832 else
2833 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2836 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2837 flag is set. Such call could not be a stmt in the middle of a bb. */
2839 static inline bool
2840 gimple_call_ctrl_altering_p (const_gimple gs)
2842 GIMPLE_CHECK (gs, GIMPLE_CALL);
2843 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2847 /* Return the function type of the function called by GS. */
2849 static inline tree
2850 gimple_call_fntype (const_gimple gs)
2852 const gcall *call_stmt = as_a <const gcall *> (gs);
2853 if (gimple_call_internal_p (gs))
2854 return NULL_TREE;
2855 return call_stmt->u.fntype;
2858 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2860 static inline void
2861 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2863 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2864 call_stmt->u.fntype = fntype;
2868 /* Return the tree node representing the function called by call
2869 statement GS. */
2871 static inline tree
2872 gimple_call_fn (const_gimple gs)
2874 GIMPLE_CHECK (gs, GIMPLE_CALL);
2875 return gimple_op (gs, 1);
2878 /* Return a pointer to the tree node representing the function called by call
2879 statement GS. */
2881 static inline tree *
2882 gimple_call_fn_ptr (const_gimple gs)
2884 GIMPLE_CHECK (gs, GIMPLE_CALL);
2885 return gimple_op_ptr (gs, 1);
2889 /* Set FN to be the function called by call statement GS. */
2891 static inline void
2892 gimple_call_set_fn (gcall *gs, tree fn)
2894 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2895 gs->op[1] = fn;
2899 /* Set FNDECL to be the function called by call statement GS. */
2901 static inline void
2902 gimple_call_set_fndecl (gimple gs, tree decl)
2904 GIMPLE_CHECK (gs, GIMPLE_CALL);
2905 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2906 gimple_set_op (gs, 1, build1_loc (gimple_location (gs), ADDR_EXPR,
2907 build_pointer_type (TREE_TYPE (decl)),
2908 decl));
2912 /* Set internal function FN to be the function called by call statement CALL_STMT. */
2914 static inline void
2915 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
2917 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
2918 call_stmt->u.internal_fn = fn;
2922 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2923 Otherwise return NULL. This function is analogous to
2924 get_callee_fndecl in tree land. */
2926 static inline tree
2927 gimple_call_fndecl (const_gimple gs)
2929 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2933 /* Return the type returned by call statement GS. */
2935 static inline tree
2936 gimple_call_return_type (const gcall *gs)
2938 tree type = gimple_call_fntype (gs);
2940 if (type == NULL_TREE)
2941 return TREE_TYPE (gimple_call_lhs (gs));
2943 /* The type returned by a function is the type of its
2944 function type. */
2945 return TREE_TYPE (type);
2949 /* Return the static chain for call statement GS. */
2951 static inline tree
2952 gimple_call_chain (const_gimple gs)
2954 GIMPLE_CHECK (gs, GIMPLE_CALL);
2955 return gimple_op (gs, 2);
2959 /* Return a pointer to the static chain for call statement CALL_STMT. */
2961 static inline tree *
2962 gimple_call_chain_ptr (const gcall *call_stmt)
2964 return const_cast<tree *> (&call_stmt->op[2]);
2967 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
2969 static inline void
2970 gimple_call_set_chain (gcall *call_stmt, tree chain)
2972 call_stmt->op[2] = chain;
2976 /* Return the number of arguments used by call statement GS. */
2978 static inline unsigned
2979 gimple_call_num_args (const_gimple gs)
2981 unsigned num_ops;
2982 GIMPLE_CHECK (gs, GIMPLE_CALL);
2983 num_ops = gimple_num_ops (gs);
2984 return num_ops - 3;
2988 /* Return the argument at position INDEX for call statement GS. */
2990 static inline tree
2991 gimple_call_arg (const_gimple gs, unsigned index)
2993 GIMPLE_CHECK (gs, GIMPLE_CALL);
2994 return gimple_op (gs, index + 3);
2998 /* Return a pointer to the argument at position INDEX for call
2999 statement GS. */
3001 static inline tree *
3002 gimple_call_arg_ptr (const_gimple gs, unsigned index)
3004 GIMPLE_CHECK (gs, GIMPLE_CALL);
3005 return gimple_op_ptr (gs, index + 3);
3009 /* Set ARG to be the argument at position INDEX for call statement GS. */
3011 static inline void
3012 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
3014 GIMPLE_CHECK (gs, GIMPLE_CALL);
3015 gimple_set_op (gs, index + 3, arg);
3019 /* If TAIL_P is true, mark call statement S as being a tail call
3020 (i.e., a call just before the exit of a function). These calls are
3021 candidate for tail call optimization. */
3023 static inline void
3024 gimple_call_set_tail (gcall *s, bool tail_p)
3026 if (tail_p)
3027 s->subcode |= GF_CALL_TAILCALL;
3028 else
3029 s->subcode &= ~GF_CALL_TAILCALL;
3033 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3035 static inline bool
3036 gimple_call_tail_p (gcall *s)
3038 return (s->subcode & GF_CALL_TAILCALL) != 0;
3042 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3043 slot optimization. This transformation uses the target of the call
3044 expansion as the return slot for calls that return in memory. */
3046 static inline void
3047 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3049 if (return_slot_opt_p)
3050 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3051 else
3052 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3056 /* Return true if S is marked for return slot optimization. */
3058 static inline bool
3059 gimple_call_return_slot_opt_p (gcall *s)
3061 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3065 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3066 thunk to the thunked-to function. */
3068 static inline void
3069 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3071 if (from_thunk_p)
3072 s->subcode |= GF_CALL_FROM_THUNK;
3073 else
3074 s->subcode &= ~GF_CALL_FROM_THUNK;
3078 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3080 static inline bool
3081 gimple_call_from_thunk_p (gcall *s)
3083 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3087 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3088 argument pack in its argument list. */
3090 static inline void
3091 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3093 if (pass_arg_pack_p)
3094 s->subcode |= GF_CALL_VA_ARG_PACK;
3095 else
3096 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3100 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3101 argument pack in its argument list. */
3103 static inline bool
3104 gimple_call_va_arg_pack_p (gcall *s)
3106 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3110 /* Return true if S is a noreturn call. */
3112 static inline bool
3113 gimple_call_noreturn_p (gimple s)
3115 GIMPLE_CHECK (s, GIMPLE_CALL);
3116 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3120 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3121 even if the called function can throw in other cases. */
3123 static inline void
3124 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3126 if (nothrow_p)
3127 s->subcode |= GF_CALL_NOTHROW;
3128 else
3129 s->subcode &= ~GF_CALL_NOTHROW;
3132 /* Return true if S is a nothrow call. */
3134 static inline bool
3135 gimple_call_nothrow_p (gcall *s)
3137 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3140 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3141 is known to be emitted for VLA objects. Those are wrapped by
3142 stack_save/stack_restore calls and hence can't lead to unbounded
3143 stack growth even when they occur in loops. */
3145 static inline void
3146 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3148 if (for_var)
3149 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3150 else
3151 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3154 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3156 static inline bool
3157 gimple_call_alloca_for_var_p (gcall *s)
3159 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3162 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3164 static inline void
3165 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3167 dest_call->subcode = orig_call->subcode;
3171 /* Return a pointer to the points-to solution for the set of call-used
3172 variables of the call CALL_STMT. */
3174 static inline struct pt_solution *
3175 gimple_call_use_set (gcall *call_stmt)
3177 return &call_stmt->call_used;
3181 /* Return a pointer to the points-to solution for the set of call-used
3182 variables of the call CALL_STMT. */
3184 static inline struct pt_solution *
3185 gimple_call_clobber_set (gcall *call_stmt)
3187 return &call_stmt->call_clobbered;
3191 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3192 non-NULL lhs. */
3194 static inline bool
3195 gimple_has_lhs (gimple stmt)
3197 return (is_gimple_assign (stmt)
3198 || (is_gimple_call (stmt)
3199 && gimple_call_lhs (stmt) != NULL_TREE));
3203 /* Return the code of the predicate computed by conditional statement GS. */
3205 static inline enum tree_code
3206 gimple_cond_code (const_gimple gs)
3208 GIMPLE_CHECK (gs, GIMPLE_COND);
3209 return (enum tree_code) gs->subcode;
3213 /* Set CODE to be the predicate code for the conditional statement GS. */
3215 static inline void
3216 gimple_cond_set_code (gcond *gs, enum tree_code code)
3218 gs->subcode = code;
3222 /* Return the LHS of the predicate computed by conditional statement GS. */
3224 static inline tree
3225 gimple_cond_lhs (const_gimple gs)
3227 GIMPLE_CHECK (gs, GIMPLE_COND);
3228 return gimple_op (gs, 0);
3231 /* Return the pointer to the LHS of the predicate computed by conditional
3232 statement GS. */
3234 static inline tree *
3235 gimple_cond_lhs_ptr (const gcond *gs)
3237 return const_cast<tree *> (&gs->op[0]);
3240 /* Set LHS to be the LHS operand of the predicate computed by
3241 conditional statement GS. */
3243 static inline void
3244 gimple_cond_set_lhs (gcond *gs, tree lhs)
3246 gs->op[0] = lhs;
3250 /* Return the RHS operand of the predicate computed by conditional GS. */
3252 static inline tree
3253 gimple_cond_rhs (const_gimple gs)
3255 GIMPLE_CHECK (gs, GIMPLE_COND);
3256 return gimple_op (gs, 1);
3259 /* Return the pointer to the RHS operand of the predicate computed by
3260 conditional GS. */
3262 static inline tree *
3263 gimple_cond_rhs_ptr (const gcond *gs)
3265 return const_cast<tree *> (&gs->op[1]);
3269 /* Set RHS to be the RHS operand of the predicate computed by
3270 conditional statement GS. */
3272 static inline void
3273 gimple_cond_set_rhs (gcond *gs, tree rhs)
3275 gs->op[1] = rhs;
3279 /* Return the label used by conditional statement GS when its
3280 predicate evaluates to true. */
3282 static inline tree
3283 gimple_cond_true_label (const gcond *gs)
3285 return gs->op[2];
3289 /* Set LABEL to be the label used by conditional statement GS when its
3290 predicate evaluates to true. */
3292 static inline void
3293 gimple_cond_set_true_label (gcond *gs, tree label)
3295 gs->op[2] = label;
3299 /* Set LABEL to be the label used by conditional statement GS when its
3300 predicate evaluates to false. */
3302 static inline void
3303 gimple_cond_set_false_label (gcond *gs, tree label)
3305 gs->op[3] = label;
3309 /* Return the label used by conditional statement GS when its
3310 predicate evaluates to false. */
3312 static inline tree
3313 gimple_cond_false_label (const gcond *gs)
3315 return gs->op[3];
3319 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3321 static inline void
3322 gimple_cond_make_false (gcond *gs)
3324 gimple_cond_set_lhs (gs, boolean_false_node);
3325 gimple_cond_set_rhs (gs, boolean_false_node);
3326 gs->subcode = NE_EXPR;
3330 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3332 static inline void
3333 gimple_cond_make_true (gcond *gs)
3335 gimple_cond_set_lhs (gs, boolean_true_node);
3336 gimple_cond_set_rhs (gs, boolean_false_node);
3337 gs->subcode = NE_EXPR;
3340 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3341 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3343 static inline bool
3344 gimple_cond_true_p (const gcond *gs)
3346 tree lhs = gimple_cond_lhs (gs);
3347 tree rhs = gimple_cond_rhs (gs);
3348 enum tree_code code = gimple_cond_code (gs);
3350 if (lhs != boolean_true_node && lhs != boolean_false_node)
3351 return false;
3353 if (rhs != boolean_true_node && rhs != boolean_false_node)
3354 return false;
3356 if (code == NE_EXPR && lhs != rhs)
3357 return true;
3359 if (code == EQ_EXPR && lhs == rhs)
3360 return true;
3362 return false;
3365 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3366 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3368 static inline bool
3369 gimple_cond_false_p (const gcond *gs)
3371 tree lhs = gimple_cond_lhs (gs);
3372 tree rhs = gimple_cond_rhs (gs);
3373 enum tree_code code = gimple_cond_code (gs);
3375 if (lhs != boolean_true_node && lhs != boolean_false_node)
3376 return false;
3378 if (rhs != boolean_true_node && rhs != boolean_false_node)
3379 return false;
3381 if (code == NE_EXPR && lhs == rhs)
3382 return true;
3384 if (code == EQ_EXPR && lhs != rhs)
3385 return true;
3387 return false;
3390 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3392 static inline void
3393 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3394 tree rhs)
3396 gimple_cond_set_code (stmt, code);
3397 gimple_cond_set_lhs (stmt, lhs);
3398 gimple_cond_set_rhs (stmt, rhs);
3401 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3403 static inline tree
3404 gimple_label_label (const glabel *gs)
3406 return gs->op[0];
3410 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3411 GS. */
3413 static inline void
3414 gimple_label_set_label (glabel *gs, tree label)
3416 gs->op[0] = label;
3420 /* Return the destination of the unconditional jump GS. */
3422 static inline tree
3423 gimple_goto_dest (const_gimple gs)
3425 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3426 return gimple_op (gs, 0);
3430 /* Set DEST to be the destination of the unconditonal jump GS. */
3432 static inline void
3433 gimple_goto_set_dest (ggoto *gs, tree dest)
3435 gs->op[0] = dest;
3439 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3441 static inline tree
3442 gimple_bind_vars (const gbind *bind_stmt)
3444 return bind_stmt->vars;
3448 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3449 statement GS. */
3451 static inline void
3452 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3454 bind_stmt->vars = vars;
3458 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3459 statement GS. */
3461 static inline void
3462 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3464 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3468 static inline gimple_seq *
3469 gimple_bind_body_ptr (gbind *bind_stmt)
3471 return &bind_stmt->body;
3474 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3476 static inline gimple_seq
3477 gimple_bind_body (gbind *gs)
3479 return *gimple_bind_body_ptr (gs);
3483 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3484 statement GS. */
3486 static inline void
3487 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3489 bind_stmt->body = seq;
3493 /* Append a statement to the end of a GIMPLE_BIND's body. */
3495 static inline void
3496 gimple_bind_add_stmt (gbind *bind_stmt, gimple stmt)
3498 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3502 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3504 static inline void
3505 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3507 gimple_seq_add_seq (&bind_stmt->body, seq);
3511 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3512 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3514 static inline tree
3515 gimple_bind_block (const gbind *bind_stmt)
3517 return bind_stmt->block;
3521 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3522 statement GS. */
3524 static inline void
3525 gimple_bind_set_block (gbind *bind_stmt, tree block)
3527 gcc_gimple_checking_assert (block == NULL_TREE
3528 || TREE_CODE (block) == BLOCK);
3529 bind_stmt->block = block;
3533 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3535 static inline unsigned
3536 gimple_asm_ninputs (const gasm *asm_stmt)
3538 return asm_stmt->ni;
3542 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3544 static inline unsigned
3545 gimple_asm_noutputs (const gasm *asm_stmt)
3547 return asm_stmt->no;
3551 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3553 static inline unsigned
3554 gimple_asm_nclobbers (const gasm *asm_stmt)
3556 return asm_stmt->nc;
3559 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3561 static inline unsigned
3562 gimple_asm_nlabels (const gasm *asm_stmt)
3564 return asm_stmt->nl;
3567 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3569 static inline tree
3570 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3572 gcc_gimple_checking_assert (index < asm_stmt->ni);
3573 return asm_stmt->op[index + asm_stmt->no];
3576 /* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */
3578 static inline tree *
3579 gimple_asm_input_op_ptr (const gasm *asm_stmt, unsigned index)
3581 gcc_gimple_checking_assert (index < asm_stmt->ni);
3582 return const_cast<tree *> (&asm_stmt->op[index + asm_stmt->no]);
3586 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3588 static inline void
3589 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3591 gcc_gimple_checking_assert (index < asm_stmt->ni
3592 && TREE_CODE (in_op) == TREE_LIST);
3593 asm_stmt->op[index + asm_stmt->no] = in_op;
3597 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3599 static inline tree
3600 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3602 gcc_gimple_checking_assert (index < asm_stmt->no);
3603 return asm_stmt->op[index];
3606 /* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */
3608 static inline tree *
3609 gimple_asm_output_op_ptr (const gasm *asm_stmt, unsigned index)
3611 gcc_gimple_checking_assert (index < asm_stmt->no);
3612 return const_cast<tree *> (&asm_stmt->op[index]);
3616 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3618 static inline void
3619 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3621 gcc_gimple_checking_assert (index < asm_stmt->no
3622 && TREE_CODE (out_op) == TREE_LIST);
3623 asm_stmt->op[index] = out_op;
3627 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3629 static inline tree
3630 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3632 gcc_gimple_checking_assert (index < asm_stmt->nc);
3633 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3637 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3639 static inline void
3640 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3642 gcc_gimple_checking_assert (index < asm_stmt->nc
3643 && TREE_CODE (clobber_op) == TREE_LIST);
3644 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3647 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3649 static inline tree
3650 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3652 gcc_gimple_checking_assert (index < asm_stmt->nl);
3653 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3656 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3658 static inline void
3659 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3661 gcc_gimple_checking_assert (index < asm_stmt->nl
3662 && TREE_CODE (label_op) == TREE_LIST);
3663 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3666 /* Return the string representing the assembly instruction in
3667 GIMPLE_ASM ASM_STMT. */
3669 static inline const char *
3670 gimple_asm_string (const gasm *asm_stmt)
3672 return asm_stmt->string;
3676 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3678 static inline bool
3679 gimple_asm_volatile_p (const gasm *asm_stmt)
3681 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3685 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3687 static inline void
3688 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3690 if (volatile_p)
3691 asm_stmt->subcode |= GF_ASM_VOLATILE;
3692 else
3693 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3697 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3699 static inline void
3700 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3702 if (input_p)
3703 asm_stmt->subcode |= GF_ASM_INPUT;
3704 else
3705 asm_stmt->subcode &= ~GF_ASM_INPUT;
3709 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3711 static inline bool
3712 gimple_asm_input_p (const gasm *asm_stmt)
3714 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3718 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3720 static inline tree
3721 gimple_catch_types (const gcatch *catch_stmt)
3723 return catch_stmt->types;
3727 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3729 static inline tree *
3730 gimple_catch_types_ptr (gcatch *catch_stmt)
3732 return &catch_stmt->types;
3736 /* Return a pointer to the GIMPLE sequence representing the body of
3737 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3739 static inline gimple_seq *
3740 gimple_catch_handler_ptr (gcatch *catch_stmt)
3742 return &catch_stmt->handler;
3746 /* Return the GIMPLE sequence representing the body of the handler of
3747 GIMPLE_CATCH statement CATCH_STMT. */
3749 static inline gimple_seq
3750 gimple_catch_handler (gcatch *catch_stmt)
3752 return *gimple_catch_handler_ptr (catch_stmt);
3756 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3758 static inline void
3759 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3761 catch_stmt->types = t;
3765 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3767 static inline void
3768 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3770 catch_stmt->handler = handler;
3774 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3776 static inline tree
3777 gimple_eh_filter_types (const_gimple gs)
3779 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3780 return eh_filter_stmt->types;
3784 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3785 GS. */
3787 static inline tree *
3788 gimple_eh_filter_types_ptr (gimple gs)
3790 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3791 return &eh_filter_stmt->types;
3795 /* Return a pointer to the sequence of statement to execute when
3796 GIMPLE_EH_FILTER statement fails. */
3798 static inline gimple_seq *
3799 gimple_eh_filter_failure_ptr (gimple gs)
3801 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3802 return &eh_filter_stmt->failure;
3806 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3807 statement fails. */
3809 static inline gimple_seq
3810 gimple_eh_filter_failure (gimple gs)
3812 return *gimple_eh_filter_failure_ptr (gs);
3816 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3817 EH_FILTER_STMT. */
3819 static inline void
3820 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3822 eh_filter_stmt->types = types;
3826 /* Set FAILURE to be the sequence of statements to execute on failure
3827 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3829 static inline void
3830 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
3831 gimple_seq failure)
3833 eh_filter_stmt->failure = failure;
3836 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3838 static inline tree
3839 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
3841 return eh_mnt_stmt->fndecl;
3844 /* Set the function decl to be called by GS to DECL. */
3846 static inline void
3847 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
3848 tree decl)
3850 eh_mnt_stmt->fndecl = decl;
3853 /* GIMPLE_EH_ELSE accessors. */
3855 static inline gimple_seq *
3856 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
3858 return &eh_else_stmt->n_body;
3861 static inline gimple_seq
3862 gimple_eh_else_n_body (geh_else *eh_else_stmt)
3864 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
3867 static inline gimple_seq *
3868 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
3870 return &eh_else_stmt->e_body;
3873 static inline gimple_seq
3874 gimple_eh_else_e_body (geh_else *eh_else_stmt)
3876 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
3879 static inline void
3880 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
3882 eh_else_stmt->n_body = seq;
3885 static inline void
3886 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
3888 eh_else_stmt->e_body = seq;
3891 /* GIMPLE_TRY accessors. */
3893 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3894 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3896 static inline enum gimple_try_flags
3897 gimple_try_kind (const_gimple gs)
3899 GIMPLE_CHECK (gs, GIMPLE_TRY);
3900 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3904 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3906 static inline void
3907 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
3909 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3910 || kind == GIMPLE_TRY_FINALLY);
3911 if (gimple_try_kind (gs) != kind)
3912 gs->subcode = (unsigned int) kind;
3916 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3918 static inline bool
3919 gimple_try_catch_is_cleanup (const_gimple gs)
3921 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3922 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3926 /* Return a pointer to the sequence of statements used as the
3927 body for GIMPLE_TRY GS. */
3929 static inline gimple_seq *
3930 gimple_try_eval_ptr (gimple gs)
3932 gtry *try_stmt = as_a <gtry *> (gs);
3933 return &try_stmt->eval;
3937 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3939 static inline gimple_seq
3940 gimple_try_eval (gimple gs)
3942 return *gimple_try_eval_ptr (gs);
3946 /* Return a pointer to the sequence of statements used as the cleanup body for
3947 GIMPLE_TRY GS. */
3949 static inline gimple_seq *
3950 gimple_try_cleanup_ptr (gimple gs)
3952 gtry *try_stmt = as_a <gtry *> (gs);
3953 return &try_stmt->cleanup;
3957 /* Return the sequence of statements used as the cleanup body for
3958 GIMPLE_TRY GS. */
3960 static inline gimple_seq
3961 gimple_try_cleanup (gimple gs)
3963 return *gimple_try_cleanup_ptr (gs);
3967 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3969 static inline void
3970 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
3972 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3973 if (catch_is_cleanup)
3974 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3975 else
3976 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3980 /* Set EVAL to be the sequence of statements to use as the body for
3981 GIMPLE_TRY TRY_STMT. */
3983 static inline void
3984 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
3986 try_stmt->eval = eval;
3990 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3991 body for GIMPLE_TRY TRY_STMT. */
3993 static inline void
3994 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
3996 try_stmt->cleanup = cleanup;
4000 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4002 static inline gimple_seq *
4003 gimple_wce_cleanup_ptr (gimple gs)
4005 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4006 return &wce_stmt->cleanup;
4010 /* Return the cleanup sequence for cleanup statement GS. */
4012 static inline gimple_seq
4013 gimple_wce_cleanup (gimple gs)
4015 return *gimple_wce_cleanup_ptr (gs);
4019 /* Set CLEANUP to be the cleanup sequence for GS. */
4021 static inline void
4022 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
4024 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4025 wce_stmt->cleanup = cleanup;
4029 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4031 static inline bool
4032 gimple_wce_cleanup_eh_only (const_gimple gs)
4034 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4035 return gs->subcode != 0;
4039 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4041 static inline void
4042 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
4044 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4045 gs->subcode = (unsigned int) eh_only_p;
4049 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4051 static inline unsigned
4052 gimple_phi_capacity (const_gimple gs)
4054 const gphi *phi_stmt = as_a <const gphi *> (gs);
4055 return phi_stmt->capacity;
4059 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4060 be exactly the number of incoming edges for the basic block holding
4061 GS. */
4063 static inline unsigned
4064 gimple_phi_num_args (const_gimple gs)
4066 const gphi *phi_stmt = as_a <const gphi *> (gs);
4067 return phi_stmt->nargs;
4071 /* Return the SSA name created by GIMPLE_PHI GS. */
4073 static inline tree
4074 gimple_phi_result (const_gimple gs)
4076 const gphi *phi_stmt = as_a <const gphi *> (gs);
4077 return phi_stmt->result;
4080 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4082 static inline tree *
4083 gimple_phi_result_ptr (gimple gs)
4085 gphi *phi_stmt = as_a <gphi *> (gs);
4086 return &phi_stmt->result;
4089 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4091 static inline void
4092 gimple_phi_set_result (gphi *phi, tree result)
4094 phi->result = result;
4095 if (result && TREE_CODE (result) == SSA_NAME)
4096 SSA_NAME_DEF_STMT (result) = phi;
4100 /* Return the PHI argument corresponding to incoming edge INDEX for
4101 GIMPLE_PHI GS. */
4103 static inline struct phi_arg_d *
4104 gimple_phi_arg (gimple gs, unsigned index)
4106 gphi *phi_stmt = as_a <gphi *> (gs);
4107 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4108 return &(phi_stmt->args[index]);
4111 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4112 for GIMPLE_PHI PHI. */
4114 static inline void
4115 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4117 gcc_gimple_checking_assert (index <= phi->nargs);
4118 phi->args[index] = *phiarg;
4121 /* Return the PHI nodes for basic block BB, or NULL if there are no
4122 PHI nodes. */
4124 static inline gimple_seq
4125 phi_nodes (const_basic_block bb)
4127 gcc_checking_assert (!(bb->flags & BB_RTL));
4128 return bb->il.gimple.phi_nodes;
4131 /* Return a pointer to the PHI nodes for basic block BB. */
4133 static inline gimple_seq *
4134 phi_nodes_ptr (basic_block bb)
4136 gcc_checking_assert (!(bb->flags & BB_RTL));
4137 return &bb->il.gimple.phi_nodes;
4140 /* Return the tree operand for argument I of PHI node GS. */
4142 static inline tree
4143 gimple_phi_arg_def (gimple gs, size_t index)
4145 return gimple_phi_arg (gs, index)->def;
4149 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4151 static inline tree *
4152 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4154 return &gimple_phi_arg (phi, index)->def;
4157 /* Return the edge associated with argument I of phi node PHI. */
4159 static inline edge
4160 gimple_phi_arg_edge (gphi *phi, size_t i)
4162 return EDGE_PRED (gimple_bb (phi), i);
4165 /* Return the source location of gimple argument I of phi node PHI. */
4167 static inline source_location
4168 gimple_phi_arg_location (gphi *phi, size_t i)
4170 return gimple_phi_arg (phi, i)->locus;
4173 /* Return the source location of the argument on edge E of phi node PHI. */
4175 static inline source_location
4176 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4178 return gimple_phi_arg (phi, e->dest_idx)->locus;
4181 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4183 static inline void
4184 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4186 gimple_phi_arg (phi, i)->locus = loc;
4189 /* Return TRUE if argument I of phi node PHI has a location record. */
4191 static inline bool
4192 gimple_phi_arg_has_location (gphi *phi, size_t i)
4194 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4198 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4200 static inline int
4201 gimple_resx_region (const gresx *resx_stmt)
4203 return resx_stmt->region;
4206 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4208 static inline void
4209 gimple_resx_set_region (gresx *resx_stmt, int region)
4211 resx_stmt->region = region;
4214 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4216 static inline int
4217 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4219 return eh_dispatch_stmt->region;
4222 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4223 EH_DISPATCH_STMT. */
4225 static inline void
4226 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4228 eh_dispatch_stmt->region = region;
4231 /* Return the number of labels associated with the switch statement GS. */
4233 static inline unsigned
4234 gimple_switch_num_labels (const gswitch *gs)
4236 unsigned num_ops;
4237 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4238 num_ops = gimple_num_ops (gs);
4239 gcc_gimple_checking_assert (num_ops > 1);
4240 return num_ops - 1;
4244 /* Set NLABELS to be the number of labels for the switch statement GS. */
4246 static inline void
4247 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4249 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4250 gimple_set_num_ops (g, nlabels + 1);
4254 /* Return the index variable used by the switch statement GS. */
4256 static inline tree
4257 gimple_switch_index (const gswitch *gs)
4259 return gs->op[0];
4263 /* Return a pointer to the index variable for the switch statement GS. */
4265 static inline tree *
4266 gimple_switch_index_ptr (const gswitch *gs)
4268 return const_cast<tree *> (&gs->op[0]);
4272 /* Set INDEX to be the index variable for switch statement GS. */
4274 static inline void
4275 gimple_switch_set_index (gswitch *gs, tree index)
4277 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4278 gs->op[0] = index;
4282 /* Return the label numbered INDEX. The default label is 0, followed by any
4283 labels in a switch statement. */
4285 static inline tree
4286 gimple_switch_label (const gswitch *gs, unsigned index)
4288 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4289 return gs->op[index + 1];
4292 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4294 static inline void
4295 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4297 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4298 && (label == NULL_TREE
4299 || TREE_CODE (label) == CASE_LABEL_EXPR));
4300 gs->op[index + 1] = label;
4303 /* Return the default label for a switch statement. */
4305 static inline tree
4306 gimple_switch_default_label (const gswitch *gs)
4308 tree label = gimple_switch_label (gs, 0);
4309 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4310 return label;
4313 /* Set the default label for a switch statement. */
4315 static inline void
4316 gimple_switch_set_default_label (gswitch *gs, tree label)
4318 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4319 gimple_switch_set_label (gs, 0, label);
4322 /* Return true if GS is a GIMPLE_DEBUG statement. */
4324 static inline bool
4325 is_gimple_debug (const_gimple gs)
4327 return gimple_code (gs) == GIMPLE_DEBUG;
4330 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4332 static inline bool
4333 gimple_debug_bind_p (const_gimple s)
4335 if (is_gimple_debug (s))
4336 return s->subcode == GIMPLE_DEBUG_BIND;
4338 return false;
4341 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4343 static inline tree
4344 gimple_debug_bind_get_var (gimple dbg)
4346 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4347 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4348 return gimple_op (dbg, 0);
4351 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4352 statement. */
4354 static inline tree
4355 gimple_debug_bind_get_value (gimple dbg)
4357 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4358 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4359 return gimple_op (dbg, 1);
4362 /* Return a pointer to the value bound to the variable in a
4363 GIMPLE_DEBUG bind statement. */
4365 static inline tree *
4366 gimple_debug_bind_get_value_ptr (gimple dbg)
4368 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4369 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4370 return gimple_op_ptr (dbg, 1);
4373 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4375 static inline void
4376 gimple_debug_bind_set_var (gimple dbg, tree var)
4378 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4379 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4380 gimple_set_op (dbg, 0, var);
4383 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4384 statement. */
4386 static inline void
4387 gimple_debug_bind_set_value (gimple dbg, tree value)
4389 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4390 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4391 gimple_set_op (dbg, 1, value);
4394 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4395 optimized away. */
4396 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4398 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4399 statement. */
4401 static inline void
4402 gimple_debug_bind_reset_value (gimple dbg)
4404 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4405 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4406 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4409 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4410 value. */
4412 static inline bool
4413 gimple_debug_bind_has_value_p (gimple dbg)
4415 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4416 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4417 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4420 #undef GIMPLE_DEBUG_BIND_NOVALUE
4422 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4424 static inline bool
4425 gimple_debug_source_bind_p (const_gimple s)
4427 if (is_gimple_debug (s))
4428 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4430 return false;
4433 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4435 static inline tree
4436 gimple_debug_source_bind_get_var (gimple dbg)
4438 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4439 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4440 return gimple_op (dbg, 0);
4443 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4444 statement. */
4446 static inline tree
4447 gimple_debug_source_bind_get_value (gimple dbg)
4449 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4450 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4451 return gimple_op (dbg, 1);
4454 /* Return a pointer to the value bound to the variable in a
4455 GIMPLE_DEBUG source bind statement. */
4457 static inline tree *
4458 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4460 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4461 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4462 return gimple_op_ptr (dbg, 1);
4465 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4467 static inline void
4468 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4470 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4471 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4472 gimple_set_op (dbg, 0, var);
4475 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4476 statement. */
4478 static inline void
4479 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4481 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4482 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4483 gimple_set_op (dbg, 1, value);
4486 /* Return the line number for EXPR, or return -1 if we have no line
4487 number information for it. */
4488 static inline int
4489 get_lineno (const_gimple stmt)
4491 location_t loc;
4493 if (!stmt)
4494 return -1;
4496 loc = gimple_location (stmt);
4497 if (loc == UNKNOWN_LOCATION)
4498 return -1;
4500 return LOCATION_LINE (loc);
4503 /* Return a pointer to the body for the OMP statement GS. */
4505 static inline gimple_seq *
4506 gimple_omp_body_ptr (gimple gs)
4508 return &static_cast <gimple_statement_omp *> (gs)->body;
4511 /* Return the body for the OMP statement GS. */
4513 static inline gimple_seq
4514 gimple_omp_body (gimple gs)
4516 return *gimple_omp_body_ptr (gs);
4519 /* Set BODY to be the body for the OMP statement GS. */
4521 static inline void
4522 gimple_omp_set_body (gimple gs, gimple_seq body)
4524 static_cast <gimple_statement_omp *> (gs)->body = body;
4528 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4530 static inline tree
4531 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4533 return crit_stmt->name;
4537 /* Return a pointer to the name associated with OMP critical statement GS. */
4539 static inline tree *
4540 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4542 return &crit_stmt->name;
4546 /* Set NAME to be the name associated with OMP critical statement GS. */
4548 static inline void
4549 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4551 crit_stmt->name = name;
4555 /* Return the kind of the OMP_FOR statemement G. */
4557 static inline int
4558 gimple_omp_for_kind (const_gimple g)
4560 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4561 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4565 /* Set the kind of the OMP_FOR statement G. */
4567 static inline void
4568 gimple_omp_for_set_kind (gomp_for *g, int kind)
4570 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4571 | (kind & GF_OMP_FOR_KIND_MASK);
4575 /* Return true if OMP_FOR statement G has the
4576 GF_OMP_FOR_COMBINED flag set. */
4578 static inline bool
4579 gimple_omp_for_combined_p (const_gimple g)
4581 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4582 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4586 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4587 the boolean value of COMBINED_P. */
4589 static inline void
4590 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4592 if (combined_p)
4593 g->subcode |= GF_OMP_FOR_COMBINED;
4594 else
4595 g->subcode &= ~GF_OMP_FOR_COMBINED;
4599 /* Return true if the OMP_FOR statement G has the
4600 GF_OMP_FOR_COMBINED_INTO flag set. */
4602 static inline bool
4603 gimple_omp_for_combined_into_p (const_gimple g)
4605 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4606 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4610 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4611 on the boolean value of COMBINED_P. */
4613 static inline void
4614 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4616 if (combined_p)
4617 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4618 else
4619 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4623 /* Return the clauses associated with the OMP_FOR statement GS. */
4625 static inline tree
4626 gimple_omp_for_clauses (const_gimple gs)
4628 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4629 return omp_for_stmt->clauses;
4633 /* Return a pointer to the clauses associated with the OMP_FOR statement
4634 GS. */
4636 static inline tree *
4637 gimple_omp_for_clauses_ptr (gimple gs)
4639 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4640 return &omp_for_stmt->clauses;
4644 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4645 GS. */
4647 static inline void
4648 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4650 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4651 omp_for_stmt->clauses = clauses;
4655 /* Get the collapse count of the OMP_FOR statement GS. */
4657 static inline size_t
4658 gimple_omp_for_collapse (gimple gs)
4660 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4661 return omp_for_stmt->collapse;
4665 /* Return the condition code associated with the OMP_FOR statement GS. */
4667 static inline enum tree_code
4668 gimple_omp_for_cond (const_gimple gs, size_t i)
4670 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4671 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4672 return omp_for_stmt->iter[i].cond;
4676 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4678 static inline void
4679 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4681 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4682 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4683 && i < omp_for_stmt->collapse);
4684 omp_for_stmt->iter[i].cond = cond;
4688 /* Return the index variable for the OMP_FOR statement GS. */
4690 static inline tree
4691 gimple_omp_for_index (const_gimple gs, size_t i)
4693 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4694 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4695 return omp_for_stmt->iter[i].index;
4699 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4701 static inline tree *
4702 gimple_omp_for_index_ptr (gimple gs, size_t i)
4704 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4705 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4706 return &omp_for_stmt->iter[i].index;
4710 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4712 static inline void
4713 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4715 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4716 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4717 omp_for_stmt->iter[i].index = index;
4721 /* Return the initial value for the OMP_FOR statement GS. */
4723 static inline tree
4724 gimple_omp_for_initial (const_gimple gs, size_t i)
4726 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4727 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4728 return omp_for_stmt->iter[i].initial;
4732 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4734 static inline tree *
4735 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4737 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4738 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4739 return &omp_for_stmt->iter[i].initial;
4743 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4745 static inline void
4746 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4748 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4749 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4750 omp_for_stmt->iter[i].initial = initial;
4754 /* Return the final value for the OMP_FOR statement GS. */
4756 static inline tree
4757 gimple_omp_for_final (const_gimple gs, size_t i)
4759 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4760 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4761 return omp_for_stmt->iter[i].final;
4765 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4767 static inline tree *
4768 gimple_omp_for_final_ptr (gimple gs, size_t i)
4770 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4771 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4772 return &omp_for_stmt->iter[i].final;
4776 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
4778 static inline void
4779 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4781 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4782 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4783 omp_for_stmt->iter[i].final = final;
4787 /* Return the increment value for the OMP_FOR statement GS. */
4789 static inline tree
4790 gimple_omp_for_incr (const_gimple gs, size_t i)
4792 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4793 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4794 return omp_for_stmt->iter[i].incr;
4798 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
4800 static inline tree *
4801 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4803 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4804 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4805 return &omp_for_stmt->iter[i].incr;
4809 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
4811 static inline void
4812 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4814 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4815 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4816 omp_for_stmt->iter[i].incr = incr;
4820 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4821 statement GS starts. */
4823 static inline gimple_seq *
4824 gimple_omp_for_pre_body_ptr (gimple gs)
4826 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4827 return &omp_for_stmt->pre_body;
4831 /* Return the sequence of statements to execute before the OMP_FOR
4832 statement GS starts. */
4834 static inline gimple_seq
4835 gimple_omp_for_pre_body (gimple gs)
4837 return *gimple_omp_for_pre_body_ptr (gs);
4841 /* Set PRE_BODY to be the sequence of statements to execute before the
4842 OMP_FOR statement GS starts. */
4844 static inline void
4845 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4847 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4848 omp_for_stmt->pre_body = pre_body;
4852 /* Return the clauses associated with OMP_PARALLEL GS. */
4854 static inline tree
4855 gimple_omp_parallel_clauses (const_gimple gs)
4857 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
4858 return omp_parallel_stmt->clauses;
4862 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
4864 static inline tree *
4865 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
4867 return &omp_parallel_stmt->clauses;
4871 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
4873 static inline void
4874 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
4875 tree clauses)
4877 omp_parallel_stmt->clauses = clauses;
4881 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
4883 static inline tree
4884 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
4886 return omp_parallel_stmt->child_fn;
4889 /* Return a pointer to the child function used to hold the body of
4890 OMP_PARALLEL_STMT. */
4892 static inline tree *
4893 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
4895 return &omp_parallel_stmt->child_fn;
4899 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
4901 static inline void
4902 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
4903 tree child_fn)
4905 omp_parallel_stmt->child_fn = child_fn;
4909 /* Return the artificial argument used to send variables and values
4910 from the parent to the children threads in OMP_PARALLEL_STMT. */
4912 static inline tree
4913 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
4915 return omp_parallel_stmt->data_arg;
4919 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
4921 static inline tree *
4922 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
4924 return &omp_parallel_stmt->data_arg;
4928 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
4930 static inline void
4931 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
4932 tree data_arg)
4934 omp_parallel_stmt->data_arg = data_arg;
4938 /* Return the clauses associated with OMP_TASK GS. */
4940 static inline tree
4941 gimple_omp_task_clauses (const_gimple gs)
4943 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
4944 return omp_task_stmt->clauses;
4948 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4950 static inline tree *
4951 gimple_omp_task_clauses_ptr (gimple gs)
4953 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4954 return &omp_task_stmt->clauses;
4958 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4959 GS. */
4961 static inline void
4962 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4964 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4965 omp_task_stmt->clauses = clauses;
4969 /* Return the child function used to hold the body of OMP_TASK GS. */
4971 static inline tree
4972 gimple_omp_task_child_fn (const_gimple gs)
4974 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
4975 return omp_task_stmt->child_fn;
4978 /* Return a pointer to the child function used to hold the body of
4979 OMP_TASK GS. */
4981 static inline tree *
4982 gimple_omp_task_child_fn_ptr (gimple gs)
4984 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4985 return &omp_task_stmt->child_fn;
4989 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4991 static inline void
4992 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4994 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4995 omp_task_stmt->child_fn = child_fn;
4999 /* Return the artificial argument used to send variables and values
5000 from the parent to the children threads in OMP_TASK GS. */
5002 static inline tree
5003 gimple_omp_task_data_arg (const_gimple gs)
5005 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5006 return omp_task_stmt->data_arg;
5010 /* Return a pointer to the data argument for OMP_TASK GS. */
5012 static inline tree *
5013 gimple_omp_task_data_arg_ptr (gimple gs)
5015 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5016 return &omp_task_stmt->data_arg;
5020 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5022 static inline void
5023 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
5025 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5026 omp_task_stmt->data_arg = data_arg;
5030 /* Return the clauses associated with OMP_TASK GS. */
5032 static inline tree
5033 gimple_omp_taskreg_clauses (const_gimple gs)
5035 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5036 = as_a <const gimple_statement_omp_taskreg *> (gs);
5037 return omp_taskreg_stmt->clauses;
5041 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5043 static inline tree *
5044 gimple_omp_taskreg_clauses_ptr (gimple gs)
5046 gimple_statement_omp_taskreg *omp_taskreg_stmt
5047 = as_a <gimple_statement_omp_taskreg *> (gs);
5048 return &omp_taskreg_stmt->clauses;
5052 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5053 GS. */
5055 static inline void
5056 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
5058 gimple_statement_omp_taskreg *omp_taskreg_stmt
5059 = as_a <gimple_statement_omp_taskreg *> (gs);
5060 omp_taskreg_stmt->clauses = clauses;
5064 /* Return the child function used to hold the body of OMP_TASK GS. */
5066 static inline tree
5067 gimple_omp_taskreg_child_fn (const_gimple gs)
5069 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5070 = as_a <const gimple_statement_omp_taskreg *> (gs);
5071 return omp_taskreg_stmt->child_fn;
5074 /* Return a pointer to the child function used to hold the body of
5075 OMP_TASK GS. */
5077 static inline tree *
5078 gimple_omp_taskreg_child_fn_ptr (gimple gs)
5080 gimple_statement_omp_taskreg *omp_taskreg_stmt
5081 = as_a <gimple_statement_omp_taskreg *> (gs);
5082 return &omp_taskreg_stmt->child_fn;
5086 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5088 static inline void
5089 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
5091 gimple_statement_omp_taskreg *omp_taskreg_stmt
5092 = as_a <gimple_statement_omp_taskreg *> (gs);
5093 omp_taskreg_stmt->child_fn = child_fn;
5097 /* Return the artificial argument used to send variables and values
5098 from the parent to the children threads in OMP_TASK GS. */
5100 static inline tree
5101 gimple_omp_taskreg_data_arg (const_gimple gs)
5103 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5104 = as_a <const gimple_statement_omp_taskreg *> (gs);
5105 return omp_taskreg_stmt->data_arg;
5109 /* Return a pointer to the data argument for OMP_TASK GS. */
5111 static inline tree *
5112 gimple_omp_taskreg_data_arg_ptr (gimple gs)
5114 gimple_statement_omp_taskreg *omp_taskreg_stmt
5115 = as_a <gimple_statement_omp_taskreg *> (gs);
5116 return &omp_taskreg_stmt->data_arg;
5120 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5122 static inline void
5123 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
5125 gimple_statement_omp_taskreg *omp_taskreg_stmt
5126 = as_a <gimple_statement_omp_taskreg *> (gs);
5127 omp_taskreg_stmt->data_arg = data_arg;
5131 /* Return the copy function used to hold the body of OMP_TASK GS. */
5133 static inline tree
5134 gimple_omp_task_copy_fn (const_gimple gs)
5136 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5137 return omp_task_stmt->copy_fn;
5140 /* Return a pointer to the copy function used to hold the body of
5141 OMP_TASK GS. */
5143 static inline tree *
5144 gimple_omp_task_copy_fn_ptr (gimple gs)
5146 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5147 return &omp_task_stmt->copy_fn;
5151 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5153 static inline void
5154 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
5156 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5157 omp_task_stmt->copy_fn = copy_fn;
5161 /* Return size of the data block in bytes in OMP_TASK GS. */
5163 static inline tree
5164 gimple_omp_task_arg_size (const_gimple gs)
5166 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5167 return omp_task_stmt->arg_size;
5171 /* Return a pointer to the data block size for OMP_TASK GS. */
5173 static inline tree *
5174 gimple_omp_task_arg_size_ptr (gimple gs)
5176 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5177 return &omp_task_stmt->arg_size;
5181 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5183 static inline void
5184 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
5186 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5187 omp_task_stmt->arg_size = arg_size;
5191 /* Return align of the data block in bytes in OMP_TASK GS. */
5193 static inline tree
5194 gimple_omp_task_arg_align (const_gimple gs)
5196 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5197 return omp_task_stmt->arg_align;
5201 /* Return a pointer to the data block align for OMP_TASK GS. */
5203 static inline tree *
5204 gimple_omp_task_arg_align_ptr (gimple gs)
5206 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5207 return &omp_task_stmt->arg_align;
5211 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5213 static inline void
5214 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5216 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5217 omp_task_stmt->arg_align = arg_align;
5221 /* Return the clauses associated with OMP_SINGLE GS. */
5223 static inline tree
5224 gimple_omp_single_clauses (const_gimple gs)
5226 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5227 return omp_single_stmt->clauses;
5231 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5233 static inline tree *
5234 gimple_omp_single_clauses_ptr (gimple gs)
5236 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5237 return &omp_single_stmt->clauses;
5241 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5243 static inline void
5244 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5246 omp_single_stmt->clauses = clauses;
5250 /* Return the clauses associated with OMP_TARGET GS. */
5252 static inline tree
5253 gimple_omp_target_clauses (const_gimple gs)
5255 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5256 return omp_target_stmt->clauses;
5260 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5262 static inline tree *
5263 gimple_omp_target_clauses_ptr (gimple gs)
5265 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5266 return &omp_target_stmt->clauses;
5270 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5272 static inline void
5273 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5274 tree clauses)
5276 omp_target_stmt->clauses = clauses;
5280 /* Return the kind of the OMP_TARGET G. */
5282 static inline int
5283 gimple_omp_target_kind (const_gimple g)
5285 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5286 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5290 /* Set the kind of the OMP_TARGET G. */
5292 static inline void
5293 gimple_omp_target_set_kind (gomp_target *g, int kind)
5295 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5296 | (kind & GF_OMP_TARGET_KIND_MASK);
5300 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5302 static inline tree
5303 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5305 return omp_target_stmt->child_fn;
5308 /* Return a pointer to the child function used to hold the body of
5309 OMP_TARGET_STMT. */
5311 static inline tree *
5312 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5314 return &omp_target_stmt->child_fn;
5318 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5320 static inline void
5321 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5322 tree child_fn)
5324 omp_target_stmt->child_fn = child_fn;
5328 /* Return the artificial argument used to send variables and values
5329 from the parent to the children threads in OMP_TARGET_STMT. */
5331 static inline tree
5332 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5334 return omp_target_stmt->data_arg;
5338 /* Return a pointer to the data argument for OMP_TARGET GS. */
5340 static inline tree *
5341 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5343 return &omp_target_stmt->data_arg;
5347 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5349 static inline void
5350 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5351 tree data_arg)
5353 omp_target_stmt->data_arg = data_arg;
5357 /* Return the clauses associated with OMP_TEAMS GS. */
5359 static inline tree
5360 gimple_omp_teams_clauses (const_gimple gs)
5362 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5363 return omp_teams_stmt->clauses;
5367 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5369 static inline tree *
5370 gimple_omp_teams_clauses_ptr (gimple gs)
5372 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5373 return &omp_teams_stmt->clauses;
5377 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5379 static inline void
5380 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5382 omp_teams_stmt->clauses = clauses;
5386 /* Return the clauses associated with OMP_SECTIONS GS. */
5388 static inline tree
5389 gimple_omp_sections_clauses (const_gimple gs)
5391 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5392 return omp_sections_stmt->clauses;
5396 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5398 static inline tree *
5399 gimple_omp_sections_clauses_ptr (gimple gs)
5401 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5402 return &omp_sections_stmt->clauses;
5406 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5407 GS. */
5409 static inline void
5410 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5412 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5413 omp_sections_stmt->clauses = clauses;
5417 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5418 in GS. */
5420 static inline tree
5421 gimple_omp_sections_control (const_gimple gs)
5423 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5424 return omp_sections_stmt->control;
5428 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5429 GS. */
5431 static inline tree *
5432 gimple_omp_sections_control_ptr (gimple gs)
5434 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5435 return &omp_sections_stmt->control;
5439 /* Set CONTROL to be the set of clauses associated with the
5440 GIMPLE_OMP_SECTIONS in GS. */
5442 static inline void
5443 gimple_omp_sections_set_control (gimple gs, tree control)
5445 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5446 omp_sections_stmt->control = control;
5450 /* Set the value being stored in an atomic store. */
5452 static inline void
5453 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5455 store_stmt->val = val;
5459 /* Return the value being stored in an atomic store. */
5461 static inline tree
5462 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5464 return store_stmt->val;
5468 /* Return a pointer to the value being stored in an atomic store. */
5470 static inline tree *
5471 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5473 return &store_stmt->val;
5477 /* Set the LHS of an atomic load. */
5479 static inline void
5480 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5482 load_stmt->lhs = lhs;
5486 /* Get the LHS of an atomic load. */
5488 static inline tree
5489 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5491 return load_stmt->lhs;
5495 /* Return a pointer to the LHS of an atomic load. */
5497 static inline tree *
5498 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5500 return &load_stmt->lhs;
5504 /* Set the RHS of an atomic load. */
5506 static inline void
5507 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5509 load_stmt->rhs = rhs;
5513 /* Get the RHS of an atomic load. */
5515 static inline tree
5516 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5518 return load_stmt->rhs;
5522 /* Return a pointer to the RHS of an atomic load. */
5524 static inline tree *
5525 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5527 return &load_stmt->rhs;
5531 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5533 static inline tree
5534 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5536 return cont_stmt->control_def;
5539 /* The same as above, but return the address. */
5541 static inline tree *
5542 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5544 return &cont_stmt->control_def;
5547 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5549 static inline void
5550 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5552 cont_stmt->control_def = def;
5556 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5558 static inline tree
5559 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5561 return cont_stmt->control_use;
5565 /* The same as above, but return the address. */
5567 static inline tree *
5568 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5570 return &cont_stmt->control_use;
5574 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5576 static inline void
5577 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5579 cont_stmt->control_use = use;
5582 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5583 TRANSACTION_STMT. */
5585 static inline gimple_seq *
5586 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5588 return &transaction_stmt->body;
5591 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5593 static inline gimple_seq
5594 gimple_transaction_body (gtransaction *transaction_stmt)
5596 return *gimple_transaction_body_ptr (transaction_stmt);
5599 /* Return the label associated with a GIMPLE_TRANSACTION. */
5601 static inline tree
5602 gimple_transaction_label (const gtransaction *transaction_stmt)
5604 return transaction_stmt->label;
5607 static inline tree *
5608 gimple_transaction_label_ptr (gtransaction *transaction_stmt)
5610 return &transaction_stmt->label;
5613 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5615 static inline unsigned int
5616 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5618 return transaction_stmt->subcode;
5621 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5622 TRANSACTION_STMT. */
5624 static inline void
5625 gimple_transaction_set_body (gtransaction *transaction_stmt,
5626 gimple_seq body)
5628 transaction_stmt->body = body;
5631 /* Set the label associated with a GIMPLE_TRANSACTION. */
5633 static inline void
5634 gimple_transaction_set_label (gtransaction *transaction_stmt, tree label)
5636 transaction_stmt->label = label;
5639 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5641 static inline void
5642 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5643 unsigned int subcode)
5645 transaction_stmt->subcode = subcode;
5649 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5651 static inline tree *
5652 gimple_return_retval_ptr (const greturn *gs)
5654 return const_cast<tree *> (&gs->op[0]);
5657 /* Return the return value for GIMPLE_RETURN GS. */
5659 static inline tree
5660 gimple_return_retval (const greturn *gs)
5662 return gs->op[0];
5666 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5668 static inline void
5669 gimple_return_set_retval (greturn *gs, tree retval)
5671 gs->op[0] = retval;
5675 /* Return the return bounds for GIMPLE_RETURN GS. */
5677 static inline tree
5678 gimple_return_retbnd (const_gimple gs)
5680 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5681 return gimple_op (gs, 1);
5685 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5687 static inline void
5688 gimple_return_set_retbnd (gimple gs, tree retval)
5690 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5691 gimple_set_op (gs, 1, retval);
5695 /* Returns true when the gimple statement STMT is any of the OMP types. */
5697 #define CASE_GIMPLE_OMP \
5698 case GIMPLE_OMP_PARALLEL: \
5699 case GIMPLE_OMP_TASK: \
5700 case GIMPLE_OMP_FOR: \
5701 case GIMPLE_OMP_SECTIONS: \
5702 case GIMPLE_OMP_SECTIONS_SWITCH: \
5703 case GIMPLE_OMP_SINGLE: \
5704 case GIMPLE_OMP_TARGET: \
5705 case GIMPLE_OMP_TEAMS: \
5706 case GIMPLE_OMP_SECTION: \
5707 case GIMPLE_OMP_MASTER: \
5708 case GIMPLE_OMP_TASKGROUP: \
5709 case GIMPLE_OMP_ORDERED: \
5710 case GIMPLE_OMP_CRITICAL: \
5711 case GIMPLE_OMP_RETURN: \
5712 case GIMPLE_OMP_ATOMIC_LOAD: \
5713 case GIMPLE_OMP_ATOMIC_STORE: \
5714 case GIMPLE_OMP_CONTINUE
5716 static inline bool
5717 is_gimple_omp (const_gimple stmt)
5719 switch (gimple_code (stmt))
5721 CASE_GIMPLE_OMP:
5722 return true;
5723 default:
5724 return false;
5728 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
5729 specifically. */
5731 static inline bool
5732 is_gimple_omp_oacc (const_gimple stmt)
5734 gcc_assert (is_gimple_omp (stmt));
5735 switch (gimple_code (stmt))
5737 case GIMPLE_OMP_FOR:
5738 switch (gimple_omp_for_kind (stmt))
5740 case GF_OMP_FOR_KIND_OACC_LOOP:
5741 return true;
5742 default:
5743 return false;
5745 case GIMPLE_OMP_TARGET:
5746 switch (gimple_omp_target_kind (stmt))
5748 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
5749 case GF_OMP_TARGET_KIND_OACC_KERNELS:
5750 case GF_OMP_TARGET_KIND_OACC_DATA:
5751 case GF_OMP_TARGET_KIND_OACC_UPDATE:
5752 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
5753 return true;
5754 default:
5755 return false;
5757 default:
5758 return false;
5763 /* Return true if the OMP gimple statement STMT is offloaded. */
5765 static inline bool
5766 is_gimple_omp_offloaded (const_gimple stmt)
5768 gcc_assert (is_gimple_omp (stmt));
5769 switch (gimple_code (stmt))
5771 case GIMPLE_OMP_TARGET:
5772 switch (gimple_omp_target_kind (stmt))
5774 case GF_OMP_TARGET_KIND_REGION:
5775 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
5776 case GF_OMP_TARGET_KIND_OACC_KERNELS:
5777 return true;
5778 default:
5779 return false;
5781 default:
5782 return false;
5787 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5789 static inline bool
5790 gimple_nop_p (const_gimple g)
5792 return gimple_code (g) == GIMPLE_NOP;
5796 /* Return true if GS is a GIMPLE_RESX. */
5798 static inline bool
5799 is_gimple_resx (const_gimple gs)
5801 return gimple_code (gs) == GIMPLE_RESX;
5804 /* Return the type of the main expression computed by STMT. Return
5805 void_type_node if the statement computes nothing. */
5807 static inline tree
5808 gimple_expr_type (const_gimple stmt)
5810 enum gimple_code code = gimple_code (stmt);
5811 /* In general we want to pass out a type that can be substituted
5812 for both the RHS and the LHS types if there is a possibly
5813 useless conversion involved. That means returning the
5814 original RHS type as far as we can reconstruct it. */
5815 if (code == GIMPLE_CALL)
5817 const gcall *call_stmt = as_a <const gcall *> (stmt);
5818 if (gimple_call_internal_p (call_stmt)
5819 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
5820 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
5821 else
5822 return gimple_call_return_type (call_stmt);
5824 else if (code == GIMPLE_ASSIGN)
5826 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
5827 return TREE_TYPE (gimple_assign_rhs1 (stmt));
5828 else
5829 /* As fallback use the type of the LHS. */
5830 return TREE_TYPE (gimple_get_lhs (stmt));
5832 else if (code == GIMPLE_COND)
5833 return boolean_type_node;
5834 else
5835 return void_type_node;
5838 /* Enum and arrays used for allocation stats. Keep in sync with
5839 gimple.c:gimple_alloc_kind_names. */
5840 enum gimple_alloc_kind
5842 gimple_alloc_kind_assign, /* Assignments. */
5843 gimple_alloc_kind_phi, /* PHI nodes. */
5844 gimple_alloc_kind_cond, /* Conditionals. */
5845 gimple_alloc_kind_rest, /* Everything else. */
5846 gimple_alloc_kind_all
5849 extern int gimple_alloc_counts[];
5850 extern int gimple_alloc_sizes[];
5852 /* Return the allocation kind for a given stmt CODE. */
5853 static inline enum gimple_alloc_kind
5854 gimple_alloc_kind (enum gimple_code code)
5856 switch (code)
5858 case GIMPLE_ASSIGN:
5859 return gimple_alloc_kind_assign;
5860 case GIMPLE_PHI:
5861 return gimple_alloc_kind_phi;
5862 case GIMPLE_COND:
5863 return gimple_alloc_kind_cond;
5864 default:
5865 return gimple_alloc_kind_rest;
5869 /* Return true if a location should not be emitted for this statement
5870 by annotate_all_with_location. */
5872 static inline bool
5873 gimple_do_not_emit_location_p (gimple g)
5875 return gimple_plf (g, GF_PLF_1);
5878 /* Mark statement G so a location will not be emitted by
5879 annotate_one_with_location. */
5881 static inline void
5882 gimple_set_do_not_emit_location (gimple g)
5884 /* The PLF flags are initialized to 0 when a new tuple is created,
5885 so no need to initialize it anywhere. */
5886 gimple_set_plf (g, GF_PLF_1, true);
5890 /* Macros for showing usage statistics. */
5891 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5892 ? (x) \
5893 : ((x) < 1024*1024*10 \
5894 ? (x) / 1024 \
5895 : (x) / (1024*1024))))
5897 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5899 #endif /* GCC_GIMPLE_H */