svn merge -r 216846:217483 svn+ssh://gcc.gnu.org/svn/gcc/trunk
[official-gcc.git] / gcc / gimple.h
bloba91bd4e9a4e432d8c91f70bb3d6268ab5376fc0e
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2014 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 typedef gimple gimple_seq_node;
27 /* For each block, the PHI nodes that need to be rewritten are stored into
28 these vectors. */
29 typedef vec<gimple> gimple_vec;
31 enum gimple_code {
32 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
33 #include "gimple.def"
34 #undef DEFGSCODE
35 LAST_AND_UNUSED_GIMPLE_CODE
38 extern const char *const gimple_code_name[];
39 extern const unsigned char gimple_rhs_class_table[];
41 /* Error out if a gimple tuple is addressed incorrectly. */
42 #if defined ENABLE_GIMPLE_CHECKING
43 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
44 extern void gimple_check_failed (const_gimple, const char *, int, \
45 const char *, enum gimple_code, \
46 enum tree_code) ATTRIBUTE_NORETURN;
48 #define GIMPLE_CHECK(GS, CODE) \
49 do { \
50 const_gimple __gs = (GS); \
51 if (gimple_code (__gs) != (CODE)) \
52 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
53 (CODE), ERROR_MARK); \
54 } while (0)
55 #else /* not ENABLE_GIMPLE_CHECKING */
56 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
57 #define GIMPLE_CHECK(GS, CODE) (void)0
58 #endif
60 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
61 get_gimple_rhs_class. */
62 enum gimple_rhs_class
64 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
65 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
66 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
67 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
68 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
69 name, a _DECL, a _REF, etc. */
72 /* Specific flags for individual GIMPLE statements. These flags are
73 always stored in gimple_statement_base.subcode and they may only be
74 defined for statement codes that do not use subcodes.
76 Values for the masks can overlap as long as the overlapping values
77 are never used in the same statement class.
79 The maximum mask value that can be defined is 1 << 15 (i.e., each
80 statement code can hold up to 16 bitflags).
82 Keep this list sorted. */
83 enum gf_mask {
84 GF_ASM_INPUT = 1 << 0,
85 GF_ASM_VOLATILE = 1 << 1,
86 GF_CALL_FROM_THUNK = 1 << 0,
87 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
88 GF_CALL_TAILCALL = 1 << 2,
89 GF_CALL_VA_ARG_PACK = 1 << 3,
90 GF_CALL_NOTHROW = 1 << 4,
91 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
92 GF_CALL_INTERNAL = 1 << 6,
93 GF_CALL_CTRL_ALTERING = 1 << 7,
94 GF_CALL_WITH_BOUNDS = 1 << 8,
95 GF_OMP_PARALLEL_COMBINED = 1 << 0,
96 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
97 GF_OMP_FOR_KIND_FOR = 0,
98 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
99 GF_OMP_FOR_KIND_CILKFOR = 2,
100 GF_OMP_FOR_KIND_OACC_LOOP = 3,
101 /* Flag for SIMD variants of OMP_FOR kinds. */
102 GF_OMP_FOR_SIMD = 1 << 2,
103 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
104 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
105 GF_OMP_FOR_COMBINED = 1 << 3,
106 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
107 GF_OMP_TARGET_KIND_MASK = (1 << 3) - 1,
108 GF_OMP_TARGET_KIND_REGION = 0,
109 GF_OMP_TARGET_KIND_DATA = 1,
110 GF_OMP_TARGET_KIND_UPDATE = 2,
111 GF_OMP_TARGET_KIND_OACC_DATA = 3,
112 GF_OMP_TARGET_KIND_OACC_UPDATE = 4,
113 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 5,
115 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
116 a thread synchronization via some sort of barrier. The exact barrier
117 that would otherwise be emitted is dependent on the OMP statement with
118 which this return is associated. */
119 GF_OMP_RETURN_NOWAIT = 1 << 0,
121 GF_OMP_SECTION_LAST = 1 << 0,
122 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
123 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
124 GF_PREDICT_TAKEN = 1 << 15
127 /* Currently, there are only two types of gimple debug stmt. Others are
128 envisioned, for example, to enable the generation of is_stmt notes
129 in line number information, to mark sequence points, etc. This
130 subcode is to be used to tell them apart. */
131 enum gimple_debug_subcode {
132 GIMPLE_DEBUG_BIND = 0,
133 GIMPLE_DEBUG_SOURCE_BIND = 1
136 /* Masks for selecting a pass local flag (PLF) to work on. These
137 masks are used by gimple_set_plf and gimple_plf. */
138 enum plf_mask {
139 GF_PLF_1 = 1 << 0,
140 GF_PLF_2 = 1 << 1
143 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
144 are for 64 bit hosts. */
146 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
147 chain_next ("%h.next"), variable_size))
148 gimple_statement_base
150 /* [ WORD 1 ]
151 Main identifying code for a tuple. */
152 ENUM_BITFIELD(gimple_code) code : 8;
154 /* Nonzero if a warning should not be emitted on this tuple. */
155 unsigned int no_warning : 1;
157 /* Nonzero if this tuple has been visited. Passes are responsible
158 for clearing this bit before using it. */
159 unsigned int visited : 1;
161 /* Nonzero if this tuple represents a non-temporal move. */
162 unsigned int nontemporal_move : 1;
164 /* Pass local flags. These flags are free for any pass to use as
165 they see fit. Passes should not assume that these flags contain
166 any useful value when the pass starts. Any initial state that
167 the pass requires should be set on entry to the pass. See
168 gimple_set_plf and gimple_plf for usage. */
169 unsigned int plf : 2;
171 /* Nonzero if this statement has been modified and needs to have its
172 operands rescanned. */
173 unsigned modified : 1;
175 /* Nonzero if this statement contains volatile operands. */
176 unsigned has_volatile_ops : 1;
178 /* Padding to get subcode to 16 bit alignment. */
179 unsigned pad : 1;
181 /* The SUBCODE field can be used for tuple-specific flags for tuples
182 that do not require subcodes. Note that SUBCODE should be at
183 least as wide as tree codes, as several tuples store tree codes
184 in there. */
185 unsigned int subcode : 16;
187 /* UID of this statement. This is used by passes that want to
188 assign IDs to statements. It must be assigned and used by each
189 pass. By default it should be assumed to contain garbage. */
190 unsigned uid;
192 /* [ WORD 2 ]
193 Locus information for debug info. */
194 location_t location;
196 /* Number of operands in this tuple. */
197 unsigned num_ops;
199 /* [ WORD 3 ]
200 Basic block holding this statement. */
201 basic_block bb;
203 /* [ WORD 4-5 ]
204 Linked lists of gimple statements. The next pointers form
205 a NULL terminated list, the prev pointers are a cyclic list.
206 A gimple statement is hence also a double-ended list of
207 statements, with the pointer itself being the first element,
208 and the prev pointer being the last. */
209 gimple next;
210 gimple GTY((skip)) prev;
214 /* Base structure for tuples with operands. */
216 /* This gimple subclass has no tag value. */
217 struct GTY(())
218 gimple_statement_with_ops_base : public gimple_statement_base
220 /* [ WORD 1-6 ] : base class */
222 /* [ WORD 7 ]
223 SSA operand vectors. NOTE: It should be possible to
224 amalgamate these vectors with the operand vector OP. However,
225 the SSA operand vectors are organized differently and contain
226 more information (like immediate use chaining). */
227 struct use_optype_d GTY((skip (""))) *use_ops;
231 /* Statements that take register operands. */
233 struct GTY((tag("GSS_WITH_OPS")))
234 gimple_statement_with_ops : public gimple_statement_with_ops_base
236 /* [ WORD 1-7 ] : base class */
238 /* [ WORD 8 ]
239 Operand vector. NOTE! This must always be the last field
240 of this structure. In particular, this means that this
241 structure cannot be embedded inside another one. */
242 tree GTY((length ("%h.num_ops"))) op[1];
246 /* Base for statements that take both memory and register operands. */
248 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
249 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
251 /* [ WORD 1-7 ] : base class */
253 /* [ WORD 8-9 ]
254 Virtual operands for this statement. The GC will pick them
255 up via the ssa_names array. */
256 tree GTY((skip (""))) vdef;
257 tree GTY((skip (""))) vuse;
261 /* Statements that take both memory and register operands. */
263 struct GTY((tag("GSS_WITH_MEM_OPS")))
264 gimple_statement_with_memory_ops :
265 public gimple_statement_with_memory_ops_base
267 /* [ WORD 1-9 ] : base class */
269 /* [ WORD 10 ]
270 Operand vector. NOTE! This must always be the last field
271 of this structure. In particular, this means that this
272 structure cannot be embedded inside another one. */
273 tree GTY((length ("%h.num_ops"))) op[1];
277 /* Call statements that take both memory and register operands. */
279 struct GTY((tag("GSS_CALL")))
280 gimple_statement_call : public gimple_statement_with_memory_ops_base
282 /* [ WORD 1-9 ] : base class */
284 /* [ WORD 10-13 ] */
285 struct pt_solution call_used;
286 struct pt_solution call_clobbered;
288 /* [ WORD 14 ] */
289 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
290 tree GTY ((tag ("0"))) fntype;
291 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
292 } u;
294 /* [ WORD 15 ]
295 Operand vector. NOTE! This must always be the last field
296 of this structure. In particular, this means that this
297 structure cannot be embedded inside another one. */
298 tree GTY((length ("%h.num_ops"))) op[1];
302 /* OpenMP statements (#pragma omp). */
304 struct GTY((tag("GSS_OMP")))
305 gimple_statement_omp : public gimple_statement_base
307 /* [ WORD 1-6 ] : base class */
309 /* [ WORD 7 ] */
310 gimple_seq body;
314 /* GIMPLE_BIND */
316 struct GTY((tag("GSS_BIND")))
317 gimple_statement_bind : public gimple_statement_base
319 /* [ WORD 1-6 ] : base class */
321 /* [ WORD 7 ]
322 Variables declared in this scope. */
323 tree vars;
325 /* [ WORD 8 ]
326 This is different than the BLOCK field in gimple_statement_base,
327 which is analogous to TREE_BLOCK (i.e., the lexical block holding
328 this statement). This field is the equivalent of BIND_EXPR_BLOCK
329 in tree land (i.e., the lexical scope defined by this bind). See
330 gimple-low.c. */
331 tree block;
333 /* [ WORD 9 ] */
334 gimple_seq body;
338 /* GIMPLE_CATCH */
340 struct GTY((tag("GSS_CATCH")))
341 gimple_statement_catch : public gimple_statement_base
343 /* [ WORD 1-6 ] : base class */
345 /* [ WORD 7 ] */
346 tree types;
348 /* [ WORD 8 ] */
349 gimple_seq handler;
353 /* GIMPLE_EH_FILTER */
355 struct GTY((tag("GSS_EH_FILTER")))
356 gimple_statement_eh_filter : public gimple_statement_base
358 /* [ WORD 1-6 ] : base class */
360 /* [ WORD 7 ]
361 Filter types. */
362 tree types;
364 /* [ WORD 8 ]
365 Failure actions. */
366 gimple_seq failure;
369 /* GIMPLE_EH_ELSE */
371 struct GTY((tag("GSS_EH_ELSE")))
372 gimple_statement_eh_else : public gimple_statement_base
374 /* [ WORD 1-6 ] : base class */
376 /* [ WORD 7,8 ] */
377 gimple_seq n_body, e_body;
380 /* GIMPLE_EH_MUST_NOT_THROW */
382 struct GTY((tag("GSS_EH_MNT")))
383 gimple_statement_eh_mnt : public gimple_statement_base
385 /* [ WORD 1-6 ] : base class */
387 /* [ WORD 7 ] Abort function decl. */
388 tree fndecl;
391 /* GIMPLE_PHI */
393 struct GTY((tag("GSS_PHI")))
394 gimple_statement_phi : public gimple_statement_base
396 /* [ WORD 1-6 ] : base class */
398 /* [ WORD 7 ] */
399 unsigned capacity;
400 unsigned nargs;
402 /* [ WORD 8 ] */
403 tree result;
405 /* [ WORD 9 ] */
406 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
410 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
412 struct GTY((tag("GSS_EH_CTRL")))
413 gimple_statement_eh_ctrl : public gimple_statement_base
415 /* [ WORD 1-6 ] : base class */
417 /* [ WORD 7 ]
418 Exception region number. */
419 int region;
422 struct GTY((tag("GSS_EH_CTRL")))
423 gimple_statement_resx : public gimple_statement_eh_ctrl
425 /* No extra fields; adds invariant:
426 stmt->code == GIMPLE_RESX. */
429 struct GTY((tag("GSS_EH_CTRL")))
430 gimple_statement_eh_dispatch : public gimple_statement_eh_ctrl
432 /* No extra fields; adds invariant:
433 stmt->code == GIMPLE_EH_DISPATH. */
437 /* GIMPLE_TRY */
439 struct GTY((tag("GSS_TRY")))
440 gimple_statement_try : public gimple_statement_base
442 /* [ WORD 1-6 ] : base class */
444 /* [ WORD 7 ]
445 Expression to evaluate. */
446 gimple_seq eval;
448 /* [ WORD 8 ]
449 Cleanup expression. */
450 gimple_seq cleanup;
453 /* Kind of GIMPLE_TRY statements. */
454 enum gimple_try_flags
456 /* A try/catch. */
457 GIMPLE_TRY_CATCH = 1 << 0,
459 /* A try/finally. */
460 GIMPLE_TRY_FINALLY = 1 << 1,
461 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
463 /* Analogous to TRY_CATCH_IS_CLEANUP. */
464 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
467 /* GIMPLE_WITH_CLEANUP_EXPR */
469 struct GTY((tag("GSS_WCE")))
470 gimple_statement_wce : public gimple_statement_base
472 /* [ WORD 1-6 ] : base class */
474 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
475 executed if an exception is thrown, not on normal exit of its
476 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
477 in TARGET_EXPRs. */
479 /* [ WORD 7 ]
480 Cleanup expression. */
481 gimple_seq cleanup;
485 /* GIMPLE_ASM */
487 struct GTY((tag("GSS_ASM")))
488 gimple_statement_asm : public gimple_statement_with_memory_ops_base
490 /* [ WORD 1-9 ] : base class */
492 /* [ WORD 10 ]
493 __asm__ statement. */
494 const char *string;
496 /* [ WORD 11 ]
497 Number of inputs, outputs, clobbers, labels. */
498 unsigned char ni;
499 unsigned char no;
500 unsigned char nc;
501 unsigned char nl;
503 /* [ WORD 12 ]
504 Operand vector. NOTE! This must always be the last field
505 of this structure. In particular, this means that this
506 structure cannot be embedded inside another one. */
507 tree GTY((length ("%h.num_ops"))) op[1];
510 /* GIMPLE_OMP_CRITICAL */
512 struct GTY((tag("GSS_OMP_CRITICAL")))
513 gimple_statement_omp_critical : public gimple_statement_omp
515 /* [ WORD 1-7 ] : base class */
517 /* [ WORD 8 ]
518 Critical section name. */
519 tree name;
523 struct GTY(()) gimple_omp_for_iter {
524 /* Condition code. */
525 enum tree_code cond;
527 /* Index variable. */
528 tree index;
530 /* Initial value. */
531 tree initial;
533 /* Final value. */
534 tree final;
536 /* Increment. */
537 tree incr;
540 /* GIMPLE_OMP_FOR */
542 struct GTY((tag("GSS_OMP_FOR")))
543 gimple_statement_omp_for : public gimple_statement_omp
545 /* [ WORD 1-7 ] : base class */
547 /* [ WORD 8 ] */
548 tree clauses;
550 /* [ WORD 9 ]
551 Number of elements in iter array. */
552 size_t collapse;
554 /* [ WORD 10 ] */
555 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
557 /* [ WORD 11 ]
558 Pre-body evaluated before the loop body begins. */
559 gimple_seq pre_body;
563 /* GIMPLE_OACC_KERNELS, GIMPLE_OACC_PARALLEL, GIMPLE_OMP_PARALLEL,
564 GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
565 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
566 gimple_statement_omp_parallel_layout : public gimple_statement_omp
568 /* [ WORD 1-7 ] : base class */
570 /* [ WORD 8 ]
571 Clauses. */
572 tree clauses;
574 /* [ WORD 9 ]
575 Child function holding the body of the parallel region. */
576 tree child_fn;
578 /* [ WORD 10 ]
579 Shared data argument. */
580 tree data_arg;
583 /* GIMPLE_OACC_KERNELS */
584 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
585 gimple_statement_oacc_kernels : public gimple_statement_omp_parallel_layout
587 /* No extra fields; adds invariant:
588 stmt->code == GIMPLE_OACC_KERNELS. */
591 /* GIMPLE_OACC_PARALLEL */
592 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
593 gimple_statement_oacc_parallel : public gimple_statement_omp_parallel_layout
595 /* No extra fields; adds invariant:
596 stmt->code == GIMPLE_OACC_PARALLEL. */
599 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
600 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
601 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
603 /* No extra fields; adds invariant:
604 stmt->code == GIMPLE_OMP_PARALLEL
605 || stmt->code == GIMPLE_OMP_TASK. */
608 /* GIMPLE_OMP_PARALLEL */
609 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
610 gimple_statement_omp_parallel : public gimple_statement_omp_taskreg
612 /* No extra fields; adds invariant:
613 stmt->code == GIMPLE_OMP_PARALLEL. */
616 /* GIMPLE_OMP_TARGET */
617 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
618 gimple_statement_omp_target : public gimple_statement_omp_parallel_layout
620 /* No extra fields; adds invariant:
621 stmt->code == GIMPLE_OMP_TARGET. */
624 /* GIMPLE_OMP_TASK */
626 struct GTY((tag("GSS_OMP_TASK")))
627 gimple_statement_omp_task : public gimple_statement_omp_taskreg
629 /* [ WORD 1-10 ] : base class */
631 /* [ WORD 11 ]
632 Child function holding firstprivate initialization if needed. */
633 tree copy_fn;
635 /* [ WORD 12-13 ]
636 Size and alignment in bytes of the argument data block. */
637 tree arg_size;
638 tree arg_align;
642 /* GIMPLE_OMP_SECTION */
643 /* Uses struct gimple_statement_omp. */
646 /* GIMPLE_OMP_SECTIONS */
648 struct GTY((tag("GSS_OMP_SECTIONS")))
649 gimple_statement_omp_sections : public gimple_statement_omp
651 /* [ WORD 1-7 ] : base class */
653 /* [ WORD 8 ] */
654 tree clauses;
656 /* [ WORD 9 ]
657 The control variable used for deciding which of the sections to
658 execute. */
659 tree control;
662 /* GIMPLE_OMP_CONTINUE.
664 Note: This does not inherit from gimple_statement_omp, because we
665 do not need the body field. */
667 struct GTY((tag("GSS_OMP_CONTINUE")))
668 gimple_statement_omp_continue : public gimple_statement_base
670 /* [ WORD 1-6 ] : base class */
672 /* [ WORD 7 ] */
673 tree control_def;
675 /* [ WORD 8 ] */
676 tree control_use;
679 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
681 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
682 gimple_statement_omp_single_layout : public gimple_statement_omp
684 /* [ WORD 1-7 ] : base class */
686 /* [ WORD 7 ] */
687 tree clauses;
690 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
691 gimple_statement_omp_single : public gimple_statement_omp_single_layout
693 /* No extra fields; adds invariant:
694 stmt->code == GIMPLE_OMP_SINGLE. */
697 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
698 gimple_statement_omp_teams : public gimple_statement_omp_single_layout
700 /* No extra fields; adds invariant:
701 stmt->code == GIMPLE_OMP_TEAMS. */
705 /* GIMPLE_OMP_ATOMIC_LOAD.
706 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
707 contains a sequence, which we don't need here. */
709 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
710 gimple_statement_omp_atomic_load : public gimple_statement_base
712 /* [ WORD 1-6 ] : base class */
714 /* [ WORD 7-8 ] */
715 tree rhs, lhs;
718 /* GIMPLE_OMP_ATOMIC_STORE.
719 See note on GIMPLE_OMP_ATOMIC_LOAD. */
721 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
722 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
724 /* [ WORD 1-6 ] : base class */
726 /* [ WORD 7 ] */
727 tree val;
730 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
731 gimple_statement_omp_atomic_store :
732 public gimple_statement_omp_atomic_store_layout
734 /* No extra fields; adds invariant:
735 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
738 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
739 gimple_statement_omp_return :
740 public gimple_statement_omp_atomic_store_layout
742 /* No extra fields; adds invariant:
743 stmt->code == GIMPLE_OMP_RETURN. */
746 /* GIMPLE_TRANSACTION. */
748 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
750 /* The __transaction_atomic was declared [[outer]] or it is
751 __transaction_relaxed. */
752 #define GTMA_IS_OUTER (1u << 0)
753 #define GTMA_IS_RELAXED (1u << 1)
754 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
756 /* The transaction is seen to not have an abort. */
757 #define GTMA_HAVE_ABORT (1u << 2)
758 /* The transaction is seen to have loads or stores. */
759 #define GTMA_HAVE_LOAD (1u << 3)
760 #define GTMA_HAVE_STORE (1u << 4)
761 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
762 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
763 /* The transaction WILL enter serial irrevocable mode.
764 An irrevocable block post-dominates the entire transaction, such
765 that all invocations of the transaction will go serial-irrevocable.
766 In such case, we don't bother instrumenting the transaction, and
767 tell the runtime that it should begin the transaction in
768 serial-irrevocable mode. */
769 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
770 /* The transaction contains no instrumentation code whatsover, most
771 likely because it is guaranteed to go irrevocable upon entry. */
772 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
774 struct GTY((tag("GSS_TRANSACTION")))
775 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
777 /* [ WORD 1-9 ] : base class */
779 /* [ WORD 10 ] */
780 gimple_seq body;
782 /* [ WORD 11 ] */
783 tree label;
786 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
787 enum gimple_statement_structure_enum {
788 #include "gsstruct.def"
789 LAST_GSS_ENUM
791 #undef DEFGSSTRUCT
793 template <>
794 template <>
795 inline bool
796 is_a_helper <gimple_statement_asm *>::test (gimple gs)
798 return gs->code == GIMPLE_ASM;
801 template <>
802 template <>
803 inline bool
804 is_a_helper <gimple_statement_bind *>::test (gimple gs)
806 return gs->code == GIMPLE_BIND;
809 template <>
810 template <>
811 inline bool
812 is_a_helper <gimple_statement_call *>::test (gimple gs)
814 return gs->code == GIMPLE_CALL;
817 template <>
818 template <>
819 inline bool
820 is_a_helper <gimple_statement_catch *>::test (gimple gs)
822 return gs->code == GIMPLE_CATCH;
825 template <>
826 template <>
827 inline bool
828 is_a_helper <gimple_statement_resx *>::test (gimple gs)
830 return gs->code == GIMPLE_RESX;
833 template <>
834 template <>
835 inline bool
836 is_a_helper <gimple_statement_eh_dispatch *>::test (gimple gs)
838 return gs->code == GIMPLE_EH_DISPATCH;
841 template <>
842 template <>
843 inline bool
844 is_a_helper <gimple_statement_eh_else *>::test (gimple gs)
846 return gs->code == GIMPLE_EH_ELSE;
849 template <>
850 template <>
851 inline bool
852 is_a_helper <gimple_statement_eh_filter *>::test (gimple gs)
854 return gs->code == GIMPLE_EH_FILTER;
857 template <>
858 template <>
859 inline bool
860 is_a_helper <gimple_statement_eh_mnt *>::test (gimple gs)
862 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
865 template <>
866 template <>
867 inline bool
868 is_a_helper <gimple_statement_omp_atomic_load *>::test (gimple gs)
870 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
873 template <>
874 template <>
875 inline bool
876 is_a_helper <gimple_statement_omp_atomic_store *>::test (gimple gs)
878 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
881 template <>
882 template <>
883 inline bool
884 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
886 return gs->code == GIMPLE_OMP_RETURN;
889 template <>
890 template <>
891 inline bool
892 is_a_helper <gimple_statement_omp_continue *>::test (gimple gs)
894 return gs->code == GIMPLE_OMP_CONTINUE;
897 template <>
898 template <>
899 inline bool
900 is_a_helper <gimple_statement_omp_critical *>::test (gimple gs)
902 return gs->code == GIMPLE_OMP_CRITICAL;
905 template <>
906 template <>
907 inline bool
908 is_a_helper <gimple_statement_omp_for *>::test (gimple gs)
910 return gs->code == GIMPLE_OMP_FOR;
913 template <>
914 template <>
915 inline bool
916 is_a_helper <gimple_statement_oacc_kernels *>::test (gimple gs)
918 return gs->code == GIMPLE_OACC_KERNELS;
921 template <>
922 template <>
923 inline bool
924 is_a_helper <gimple_statement_oacc_parallel *>::test (gimple gs)
926 return gs->code == GIMPLE_OACC_PARALLEL;
929 template <>
930 template <>
931 inline bool
932 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
934 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
937 template <>
938 template <>
939 inline bool
940 is_a_helper <gimple_statement_omp_parallel *>::test (gimple gs)
942 return gs->code == GIMPLE_OMP_PARALLEL;
945 template <>
946 template <>
947 inline bool
948 is_a_helper <gimple_statement_omp_target *>::test (gimple gs)
950 return gs->code == GIMPLE_OMP_TARGET;
953 template <>
954 template <>
955 inline bool
956 is_a_helper <gimple_statement_omp_sections *>::test (gimple gs)
958 return gs->code == GIMPLE_OMP_SECTIONS;
961 template <>
962 template <>
963 inline bool
964 is_a_helper <gimple_statement_omp_single *>::test (gimple gs)
966 return gs->code == GIMPLE_OMP_SINGLE;
969 template <>
970 template <>
971 inline bool
972 is_a_helper <gimple_statement_omp_teams *>::test (gimple gs)
974 return gs->code == GIMPLE_OMP_TEAMS;
977 template <>
978 template <>
979 inline bool
980 is_a_helper <gimple_statement_omp_task *>::test (gimple gs)
982 return gs->code == GIMPLE_OMP_TASK;
985 template <>
986 template <>
987 inline bool
988 is_a_helper <gimple_statement_phi *>::test (gimple gs)
990 return gs->code == GIMPLE_PHI;
993 template <>
994 template <>
995 inline bool
996 is_a_helper <gimple_statement_transaction *>::test (gimple gs)
998 return gs->code == GIMPLE_TRANSACTION;
1001 template <>
1002 template <>
1003 inline bool
1004 is_a_helper <gimple_statement_try *>::test (gimple gs)
1006 return gs->code == GIMPLE_TRY;
1009 template <>
1010 template <>
1011 inline bool
1012 is_a_helper <gimple_statement_wce *>::test (gimple gs)
1014 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1017 template <>
1018 template <>
1019 inline bool
1020 is_a_helper <const gimple_statement_asm *>::test (const_gimple gs)
1022 return gs->code == GIMPLE_ASM;
1025 template <>
1026 template <>
1027 inline bool
1028 is_a_helper <const gimple_statement_bind *>::test (const_gimple gs)
1030 return gs->code == GIMPLE_BIND;
1033 template <>
1034 template <>
1035 inline bool
1036 is_a_helper <const gimple_statement_call *>::test (const_gimple gs)
1038 return gs->code == GIMPLE_CALL;
1041 template <>
1042 template <>
1043 inline bool
1044 is_a_helper <const gimple_statement_catch *>::test (const_gimple gs)
1046 return gs->code == GIMPLE_CATCH;
1049 template <>
1050 template <>
1051 inline bool
1052 is_a_helper <const gimple_statement_resx *>::test (const_gimple gs)
1054 return gs->code == GIMPLE_RESX;
1057 template <>
1058 template <>
1059 inline bool
1060 is_a_helper <const gimple_statement_eh_dispatch *>::test (const_gimple gs)
1062 return gs->code == GIMPLE_EH_DISPATCH;
1065 template <>
1066 template <>
1067 inline bool
1068 is_a_helper <const gimple_statement_eh_filter *>::test (const_gimple gs)
1070 return gs->code == GIMPLE_EH_FILTER;
1073 template <>
1074 template <>
1075 inline bool
1076 is_a_helper <const gimple_statement_omp_atomic_load *>::test (const_gimple gs)
1078 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1081 template <>
1082 template <>
1083 inline bool
1084 is_a_helper <const gimple_statement_omp_atomic_store *>::test (const_gimple gs)
1086 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1089 template <>
1090 template <>
1091 inline bool
1092 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1094 return gs->code == GIMPLE_OMP_RETURN;
1097 template <>
1098 template <>
1099 inline bool
1100 is_a_helper <const gimple_statement_omp_continue *>::test (const_gimple gs)
1102 return gs->code == GIMPLE_OMP_CONTINUE;
1105 template <>
1106 template <>
1107 inline bool
1108 is_a_helper <const gimple_statement_omp_critical *>::test (const_gimple gs)
1110 return gs->code == GIMPLE_OMP_CRITICAL;
1113 template <>
1114 template <>
1115 inline bool
1116 is_a_helper <const gimple_statement_omp_for *>::test (const_gimple gs)
1118 return gs->code == GIMPLE_OMP_FOR;
1121 template <>
1122 template <>
1123 inline bool
1124 is_a_helper <const gimple_statement_oacc_kernels *>::test (const_gimple gs)
1126 return gs->code == GIMPLE_OACC_KERNELS;
1129 template <>
1130 template <>
1131 inline bool
1132 is_a_helper <const gimple_statement_oacc_parallel *>::test (const_gimple gs)
1134 return gs->code == GIMPLE_OACC_PARALLEL;
1137 template <>
1138 template <>
1139 inline bool
1140 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1142 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1145 template <>
1146 template <>
1147 inline bool
1148 is_a_helper <const gimple_statement_omp_parallel *>::test (const_gimple gs)
1150 return gs->code == GIMPLE_OMP_PARALLEL;
1153 template <>
1154 template <>
1155 inline bool
1156 is_a_helper <const gimple_statement_omp_target *>::test (const_gimple gs)
1158 return gs->code == GIMPLE_OMP_TARGET;
1161 template <>
1162 template <>
1163 inline bool
1164 is_a_helper <const gimple_statement_omp_sections *>::test (const_gimple gs)
1166 return gs->code == GIMPLE_OMP_SECTIONS;
1169 template <>
1170 template <>
1171 inline bool
1172 is_a_helper <const gimple_statement_omp_single *>::test (const_gimple gs)
1174 return gs->code == GIMPLE_OMP_SINGLE;
1177 template <>
1178 template <>
1179 inline bool
1180 is_a_helper <const gimple_statement_omp_teams *>::test (const_gimple gs)
1182 return gs->code == GIMPLE_OMP_TEAMS;
1185 template <>
1186 template <>
1187 inline bool
1188 is_a_helper <const gimple_statement_omp_task *>::test (const_gimple gs)
1190 return gs->code == GIMPLE_OMP_TASK;
1193 template <>
1194 template <>
1195 inline bool
1196 is_a_helper <const gimple_statement_phi *>::test (const_gimple gs)
1198 return gs->code == GIMPLE_PHI;
1201 template <>
1202 template <>
1203 inline bool
1204 is_a_helper <const gimple_statement_transaction *>::test (const_gimple gs)
1206 return gs->code == GIMPLE_TRANSACTION;
1209 /* Offset in bytes to the location of the operand vector.
1210 Zero if there is no operand vector for this tuple structure. */
1211 extern size_t const gimple_ops_offset_[];
1213 /* Map GIMPLE codes to GSS codes. */
1214 extern enum gimple_statement_structure_enum const gss_for_code_[];
1216 /* This variable holds the currently expanded gimple statement for purposes
1217 of comminucating the profile info to the builtin expanders. */
1218 extern gimple currently_expanding_gimple_stmt;
1220 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1221 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1222 gimple gimple_build_return (tree);
1223 void gimple_call_reset_alias_info (gimple);
1224 gimple gimple_build_call_vec (tree, vec<tree> );
1225 gimple gimple_build_call (tree, unsigned, ...);
1226 gimple gimple_build_call_valist (tree, unsigned, va_list);
1227 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1228 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1229 gimple gimple_build_call_from_tree (tree);
1230 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1231 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1232 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1233 tree, tree, tree CXX_MEM_STAT_INFO);
1234 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1235 tree, tree CXX_MEM_STAT_INFO);
1236 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1237 gimple gimple_build_cond_from_tree (tree, tree, tree);
1238 void gimple_cond_set_condition_from_tree (gimple, tree);
1239 gimple gimple_build_label (tree label);
1240 gimple gimple_build_goto (tree dest);
1241 gimple gimple_build_nop (void);
1242 gimple gimple_build_bind (tree, gimple_seq, tree);
1243 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1244 vec<tree, va_gc> *, vec<tree, va_gc> *,
1245 vec<tree, va_gc> *);
1246 gimple gimple_build_catch (tree, gimple_seq);
1247 gimple gimple_build_eh_filter (tree, gimple_seq);
1248 gimple gimple_build_eh_must_not_throw (tree);
1249 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1250 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1251 enum gimple_try_flags);
1252 gimple gimple_build_wce (gimple_seq);
1253 gimple gimple_build_resx (int);
1254 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1255 gimple gimple_build_switch (tree, tree, vec<tree> );
1256 gimple gimple_build_eh_dispatch (int);
1257 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1258 #define gimple_build_debug_bind(var,val,stmt) \
1259 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1260 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1261 #define gimple_build_debug_source_bind(var,val,stmt) \
1262 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1263 gimple gimple_build_oacc_kernels (gimple_seq, tree);
1264 gimple gimple_build_oacc_parallel (gimple_seq, tree);
1265 gimple gimple_build_omp_critical (gimple_seq, tree);
1266 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1267 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1268 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1269 gimple gimple_build_omp_section (gimple_seq);
1270 gimple gimple_build_omp_master (gimple_seq);
1271 gimple gimple_build_omp_taskgroup (gimple_seq);
1272 gimple gimple_build_omp_continue (tree, tree);
1273 gimple gimple_build_omp_ordered (gimple_seq);
1274 gimple gimple_build_omp_return (bool);
1275 gimple gimple_build_omp_sections (gimple_seq, tree);
1276 gimple gimple_build_omp_sections_switch (void);
1277 gimple gimple_build_omp_single (gimple_seq, tree);
1278 gimple gimple_build_omp_target (gimple_seq, int, tree);
1279 gimple gimple_build_omp_teams (gimple_seq, tree);
1280 gimple gimple_build_omp_atomic_load (tree, tree);
1281 gimple gimple_build_omp_atomic_store (tree);
1282 gimple gimple_build_transaction (gimple_seq, tree);
1283 gimple gimple_build_predict (enum br_predictor, enum prediction);
1284 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1285 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1286 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1287 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1288 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1289 location_t);
1290 extern void annotate_all_with_location (gimple_seq, location_t);
1291 bool empty_body_p (gimple_seq);
1292 gimple_seq gimple_seq_copy (gimple_seq);
1293 bool gimple_call_same_target_p (const_gimple, const_gimple);
1294 int gimple_call_flags (const_gimple);
1295 int gimple_call_arg_flags (const_gimple, unsigned);
1296 int gimple_call_return_flags (const_gimple);
1297 bool gimple_assign_copy_p (gimple);
1298 bool gimple_assign_ssa_name_copy_p (gimple);
1299 bool gimple_assign_unary_nop_p (gimple);
1300 void gimple_set_bb (gimple, basic_block);
1301 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1302 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1303 tree, tree, tree);
1304 tree gimple_get_lhs (const_gimple);
1305 void gimple_set_lhs (gimple, tree);
1306 gimple gimple_copy (gimple);
1307 bool gimple_has_side_effects (const_gimple);
1308 bool gimple_could_trap_p_1 (gimple, bool, bool);
1309 bool gimple_could_trap_p (gimple);
1310 bool gimple_assign_rhs_could_trap_p (gimple);
1311 extern void dump_gimple_statistics (void);
1312 unsigned get_gimple_rhs_num_ops (enum tree_code);
1313 extern tree canonicalize_cond_expr_cond (tree);
1314 gimple gimple_call_copy_skip_args (gimple, bitmap);
1315 extern bool gimple_compare_field_offset (tree, tree);
1316 extern tree gimple_unsigned_type (tree);
1317 extern tree gimple_signed_type (tree);
1318 extern alias_set_type gimple_get_alias_set (tree);
1319 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1320 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1321 extern bool gimple_call_builtin_p (const_gimple);
1322 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1323 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1324 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1325 extern void dump_decl_set (FILE *, bitmap);
1326 extern bool nonfreeing_call_p (gimple);
1327 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1328 extern void sort_case_labels (vec<tree>);
1329 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1330 extern void gimple_seq_set_location (gimple_seq, location_t);
1331 extern void gimple_seq_discard (gimple_seq);
1333 /* Formal (expression) temporary table handling: multiple occurrences of
1334 the same scalar expression are evaluated into the same temporary. */
1336 typedef struct gimple_temp_hash_elt
1338 tree val; /* Key */
1339 tree temp; /* Value */
1340 } elt_t;
1342 /* Get the number of the next statement uid to be allocated. */
1343 static inline unsigned int
1344 gimple_stmt_max_uid (struct function *fn)
1346 return fn->last_stmt_uid;
1349 /* Set the number of the next statement uid to be allocated. */
1350 static inline void
1351 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1353 fn->last_stmt_uid = maxid;
1356 /* Set the number of the next statement uid to be allocated. */
1357 static inline unsigned int
1358 inc_gimple_stmt_max_uid (struct function *fn)
1360 return fn->last_stmt_uid++;
1363 /* Return the first node in GIMPLE sequence S. */
1365 static inline gimple_seq_node
1366 gimple_seq_first (gimple_seq s)
1368 return s;
1372 /* Return the first statement in GIMPLE sequence S. */
1374 static inline gimple
1375 gimple_seq_first_stmt (gimple_seq s)
1377 gimple_seq_node n = gimple_seq_first (s);
1378 return n;
1382 /* Return the last node in GIMPLE sequence S. */
1384 static inline gimple_seq_node
1385 gimple_seq_last (gimple_seq s)
1387 return s ? s->prev : NULL;
1391 /* Return the last statement in GIMPLE sequence S. */
1393 static inline gimple
1394 gimple_seq_last_stmt (gimple_seq s)
1396 gimple_seq_node n = gimple_seq_last (s);
1397 return n;
1401 /* Set the last node in GIMPLE sequence *PS to LAST. */
1403 static inline void
1404 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1406 (*ps)->prev = last;
1410 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1412 static inline void
1413 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1415 *ps = first;
1419 /* Return true if GIMPLE sequence S is empty. */
1421 static inline bool
1422 gimple_seq_empty_p (gimple_seq s)
1424 return s == NULL;
1427 /* Allocate a new sequence and initialize its first element with STMT. */
1429 static inline gimple_seq
1430 gimple_seq_alloc_with_stmt (gimple stmt)
1432 gimple_seq seq = NULL;
1433 gimple_seq_add_stmt (&seq, stmt);
1434 return seq;
1438 /* Returns the sequence of statements in BB. */
1440 static inline gimple_seq
1441 bb_seq (const_basic_block bb)
1443 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1446 static inline gimple_seq *
1447 bb_seq_addr (basic_block bb)
1449 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1452 /* Sets the sequence of statements in BB to SEQ. */
1454 static inline void
1455 set_bb_seq (basic_block bb, gimple_seq seq)
1457 gcc_checking_assert (!(bb->flags & BB_RTL));
1458 bb->il.gimple.seq = seq;
1462 /* Return the code for GIMPLE statement G. */
1464 static inline enum gimple_code
1465 gimple_code (const_gimple g)
1467 return g->code;
1471 /* Return the GSS code used by a GIMPLE code. */
1473 static inline enum gimple_statement_structure_enum
1474 gss_for_code (enum gimple_code code)
1476 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1477 return gss_for_code_[code];
1481 /* Return which GSS code is used by GS. */
1483 static inline enum gimple_statement_structure_enum
1484 gimple_statement_structure (gimple gs)
1486 return gss_for_code (gimple_code (gs));
1490 /* Return true if statement G has sub-statements. This is only true for
1491 High GIMPLE statements. */
1493 static inline bool
1494 gimple_has_substatements (gimple g)
1496 switch (gimple_code (g))
1498 case GIMPLE_BIND:
1499 case GIMPLE_CATCH:
1500 case GIMPLE_EH_FILTER:
1501 case GIMPLE_EH_ELSE:
1502 case GIMPLE_TRY:
1503 case GIMPLE_OACC_KERNELS:
1504 case GIMPLE_OACC_PARALLEL:
1505 case GIMPLE_OMP_FOR:
1506 case GIMPLE_OMP_MASTER:
1507 case GIMPLE_OMP_TASKGROUP:
1508 case GIMPLE_OMP_ORDERED:
1509 case GIMPLE_OMP_SECTION:
1510 case GIMPLE_OMP_PARALLEL:
1511 case GIMPLE_OMP_TASK:
1512 case GIMPLE_OMP_SECTIONS:
1513 case GIMPLE_OMP_SINGLE:
1514 case GIMPLE_OMP_TARGET:
1515 case GIMPLE_OMP_TEAMS:
1516 case GIMPLE_OMP_CRITICAL:
1517 case GIMPLE_WITH_CLEANUP_EXPR:
1518 case GIMPLE_TRANSACTION:
1519 return true;
1521 default:
1522 return false;
1527 /* Return the basic block holding statement G. */
1529 static inline basic_block
1530 gimple_bb (const_gimple g)
1532 return g->bb;
1536 /* Return the lexical scope block holding statement G. */
1538 static inline tree
1539 gimple_block (const_gimple g)
1541 return LOCATION_BLOCK (g->location);
1545 /* Set BLOCK to be the lexical scope block holding statement G. */
1547 static inline void
1548 gimple_set_block (gimple g, tree block)
1550 if (block)
1551 g->location =
1552 COMBINE_LOCATION_DATA (line_table, g->location, block);
1553 else
1554 g->location = LOCATION_LOCUS (g->location);
1558 /* Return location information for statement G. */
1560 static inline location_t
1561 gimple_location (const_gimple g)
1563 return g->location;
1566 /* Return location information for statement G if g is not NULL.
1567 Otherwise, UNKNOWN_LOCATION is returned. */
1569 static inline location_t
1570 gimple_location_safe (const_gimple g)
1572 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1575 /* Return pointer to location information for statement G. */
1577 static inline const location_t *
1578 gimple_location_ptr (const_gimple g)
1580 return &g->location;
1584 /* Set location information for statement G. */
1586 static inline void
1587 gimple_set_location (gimple g, location_t location)
1589 g->location = location;
1593 /* Return true if G contains location information. */
1595 static inline bool
1596 gimple_has_location (const_gimple g)
1598 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1602 /* Return the file name of the location of STMT. */
1604 static inline const char *
1605 gimple_filename (const_gimple stmt)
1607 return LOCATION_FILE (gimple_location (stmt));
1611 /* Return the line number of the location of STMT. */
1613 static inline int
1614 gimple_lineno (const_gimple stmt)
1616 return LOCATION_LINE (gimple_location (stmt));
1620 /* Determine whether SEQ is a singleton. */
1622 static inline bool
1623 gimple_seq_singleton_p (gimple_seq seq)
1625 return ((gimple_seq_first (seq) != NULL)
1626 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1629 /* Return true if no warnings should be emitted for statement STMT. */
1631 static inline bool
1632 gimple_no_warning_p (const_gimple stmt)
1634 return stmt->no_warning;
1637 /* Set the no_warning flag of STMT to NO_WARNING. */
1639 static inline void
1640 gimple_set_no_warning (gimple stmt, bool no_warning)
1642 stmt->no_warning = (unsigned) no_warning;
1645 /* Set the visited status on statement STMT to VISITED_P. */
1647 static inline void
1648 gimple_set_visited (gimple stmt, bool visited_p)
1650 stmt->visited = (unsigned) visited_p;
1654 /* Return the visited status for statement STMT. */
1656 static inline bool
1657 gimple_visited_p (gimple stmt)
1659 return stmt->visited;
1663 /* Set pass local flag PLF on statement STMT to VAL_P. */
1665 static inline void
1666 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1668 if (val_p)
1669 stmt->plf |= (unsigned int) plf;
1670 else
1671 stmt->plf &= ~((unsigned int) plf);
1675 /* Return the value of pass local flag PLF on statement STMT. */
1677 static inline unsigned int
1678 gimple_plf (gimple stmt, enum plf_mask plf)
1680 return stmt->plf & ((unsigned int) plf);
1684 /* Set the UID of statement. */
1686 static inline void
1687 gimple_set_uid (gimple g, unsigned uid)
1689 g->uid = uid;
1693 /* Return the UID of statement. */
1695 static inline unsigned
1696 gimple_uid (const_gimple g)
1698 return g->uid;
1702 /* Make statement G a singleton sequence. */
1704 static inline void
1705 gimple_init_singleton (gimple g)
1707 g->next = NULL;
1708 g->prev = g;
1712 /* Return true if GIMPLE statement G has register or memory operands. */
1714 static inline bool
1715 gimple_has_ops (const_gimple g)
1717 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1720 template <>
1721 template <>
1722 inline bool
1723 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1725 return gimple_has_ops (gs);
1728 template <>
1729 template <>
1730 inline bool
1731 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1733 return gimple_has_ops (gs);
1736 /* Return true if GIMPLE statement G has memory operands. */
1738 static inline bool
1739 gimple_has_mem_ops (const_gimple g)
1741 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1744 template <>
1745 template <>
1746 inline bool
1747 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1749 return gimple_has_mem_ops (gs);
1752 template <>
1753 template <>
1754 inline bool
1755 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1757 return gimple_has_mem_ops (gs);
1760 /* Return the set of USE operands for statement G. */
1762 static inline struct use_optype_d *
1763 gimple_use_ops (const_gimple g)
1765 const gimple_statement_with_ops *ops_stmt =
1766 dyn_cast <const gimple_statement_with_ops *> (g);
1767 if (!ops_stmt)
1768 return NULL;
1769 return ops_stmt->use_ops;
1773 /* Set USE to be the set of USE operands for statement G. */
1775 static inline void
1776 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1778 gimple_statement_with_ops *ops_stmt =
1779 as_a <gimple_statement_with_ops *> (g);
1780 ops_stmt->use_ops = use;
1784 /* Return the single VUSE operand of the statement G. */
1786 static inline tree
1787 gimple_vuse (const_gimple g)
1789 const gimple_statement_with_memory_ops *mem_ops_stmt =
1790 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1791 if (!mem_ops_stmt)
1792 return NULL_TREE;
1793 return mem_ops_stmt->vuse;
1796 /* Return the single VDEF operand of the statement G. */
1798 static inline tree
1799 gimple_vdef (const_gimple g)
1801 const gimple_statement_with_memory_ops *mem_ops_stmt =
1802 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1803 if (!mem_ops_stmt)
1804 return NULL_TREE;
1805 return mem_ops_stmt->vdef;
1808 /* Return the single VUSE operand of the statement G. */
1810 static inline tree *
1811 gimple_vuse_ptr (gimple g)
1813 gimple_statement_with_memory_ops *mem_ops_stmt =
1814 dyn_cast <gimple_statement_with_memory_ops *> (g);
1815 if (!mem_ops_stmt)
1816 return NULL;
1817 return &mem_ops_stmt->vuse;
1820 /* Return the single VDEF operand of the statement G. */
1822 static inline tree *
1823 gimple_vdef_ptr (gimple g)
1825 gimple_statement_with_memory_ops *mem_ops_stmt =
1826 dyn_cast <gimple_statement_with_memory_ops *> (g);
1827 if (!mem_ops_stmt)
1828 return NULL;
1829 return &mem_ops_stmt->vdef;
1832 /* Set the single VUSE operand of the statement G. */
1834 static inline void
1835 gimple_set_vuse (gimple g, tree vuse)
1837 gimple_statement_with_memory_ops *mem_ops_stmt =
1838 as_a <gimple_statement_with_memory_ops *> (g);
1839 mem_ops_stmt->vuse = vuse;
1842 /* Set the single VDEF operand of the statement G. */
1844 static inline void
1845 gimple_set_vdef (gimple g, tree vdef)
1847 gimple_statement_with_memory_ops *mem_ops_stmt =
1848 as_a <gimple_statement_with_memory_ops *> (g);
1849 mem_ops_stmt->vdef = vdef;
1853 /* Return true if statement G has operands and the modified field has
1854 been set. */
1856 static inline bool
1857 gimple_modified_p (const_gimple g)
1859 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1863 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1864 a MODIFIED field. */
1866 static inline void
1867 gimple_set_modified (gimple s, bool modifiedp)
1869 if (gimple_has_ops (s))
1870 s->modified = (unsigned) modifiedp;
1874 /* Return the tree code for the expression computed by STMT. This is
1875 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1876 GIMPLE_CALL, return CALL_EXPR as the expression code for
1877 consistency. This is useful when the caller needs to deal with the
1878 three kinds of computation that GIMPLE supports. */
1880 static inline enum tree_code
1881 gimple_expr_code (const_gimple stmt)
1883 enum gimple_code code = gimple_code (stmt);
1884 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1885 return (enum tree_code) stmt->subcode;
1886 else
1888 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1889 return CALL_EXPR;
1894 /* Return true if statement STMT contains volatile operands. */
1896 static inline bool
1897 gimple_has_volatile_ops (const_gimple stmt)
1899 if (gimple_has_mem_ops (stmt))
1900 return stmt->has_volatile_ops;
1901 else
1902 return false;
1906 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1908 static inline void
1909 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1911 if (gimple_has_mem_ops (stmt))
1912 stmt->has_volatile_ops = (unsigned) volatilep;
1915 /* Return true if STMT is in a transaction. */
1917 static inline bool
1918 gimple_in_transaction (gimple stmt)
1920 return bb_in_transaction (gimple_bb (stmt));
1923 /* Return true if statement STMT may access memory. */
1925 static inline bool
1926 gimple_references_memory_p (gimple stmt)
1928 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1932 /* Return the subcode for OMP statement S. */
1934 static inline unsigned
1935 gimple_omp_subcode (const_gimple s)
1937 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1938 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1939 return s->subcode;
1942 /* Set the subcode for OMP statement S to SUBCODE. */
1944 static inline void
1945 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1947 /* We only have 16 bits for the subcode. Assert that we are not
1948 overflowing it. */
1949 gcc_gimple_checking_assert (subcode < (1 << 16));
1950 s->subcode = subcode;
1953 /* Set the nowait flag on OMP_RETURN statement S. */
1955 static inline void
1956 gimple_omp_return_set_nowait (gimple s)
1958 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1959 s->subcode |= GF_OMP_RETURN_NOWAIT;
1963 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1964 flag set. */
1966 static inline bool
1967 gimple_omp_return_nowait_p (const_gimple g)
1969 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1970 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1974 /* Set the LHS of OMP return. */
1976 static inline void
1977 gimple_omp_return_set_lhs (gimple g, tree lhs)
1979 gimple_statement_omp_return *omp_return_stmt =
1980 as_a <gimple_statement_omp_return *> (g);
1981 omp_return_stmt->val = lhs;
1985 /* Get the LHS of OMP return. */
1987 static inline tree
1988 gimple_omp_return_lhs (const_gimple g)
1990 const gimple_statement_omp_return *omp_return_stmt =
1991 as_a <const gimple_statement_omp_return *> (g);
1992 return omp_return_stmt->val;
1996 /* Return a pointer to the LHS of OMP return. */
1998 static inline tree *
1999 gimple_omp_return_lhs_ptr (gimple g)
2001 gimple_statement_omp_return *omp_return_stmt =
2002 as_a <gimple_statement_omp_return *> (g);
2003 return &omp_return_stmt->val;
2007 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2008 flag set. */
2010 static inline bool
2011 gimple_omp_section_last_p (const_gimple g)
2013 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2014 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2018 /* Set the GF_OMP_SECTION_LAST flag on G. */
2020 static inline void
2021 gimple_omp_section_set_last (gimple g)
2023 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2024 g->subcode |= GF_OMP_SECTION_LAST;
2028 /* Return true if OMP parallel statement G has the
2029 GF_OMP_PARALLEL_COMBINED flag set. */
2031 static inline bool
2032 gimple_omp_parallel_combined_p (const_gimple g)
2034 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2035 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2039 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2040 value of COMBINED_P. */
2042 static inline void
2043 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2045 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2046 if (combined_p)
2047 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2048 else
2049 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2053 /* Return true if OMP atomic load/store statement G has the
2054 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2056 static inline bool
2057 gimple_omp_atomic_need_value_p (const_gimple g)
2059 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2060 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2061 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2065 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2067 static inline void
2068 gimple_omp_atomic_set_need_value (gimple g)
2070 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2071 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2072 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2076 /* Return true if OMP atomic load/store statement G has the
2077 GF_OMP_ATOMIC_SEQ_CST flag set. */
2079 static inline bool
2080 gimple_omp_atomic_seq_cst_p (const_gimple g)
2082 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2083 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2084 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2088 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2090 static inline void
2091 gimple_omp_atomic_set_seq_cst (gimple g)
2093 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2094 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2095 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2099 /* Return the number of operands for statement GS. */
2101 static inline unsigned
2102 gimple_num_ops (const_gimple gs)
2104 return gs->num_ops;
2108 /* Set the number of operands for statement GS. */
2110 static inline void
2111 gimple_set_num_ops (gimple gs, unsigned num_ops)
2113 gs->num_ops = num_ops;
2117 /* Return the array of operands for statement GS. */
2119 static inline tree *
2120 gimple_ops (gimple gs)
2122 size_t off;
2124 /* All the tuples have their operand vector at the very bottom
2125 of the structure. Note that those structures that do not
2126 have an operand vector have a zero offset. */
2127 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2128 gcc_gimple_checking_assert (off != 0);
2130 return (tree *) ((char *) gs + off);
2134 /* Return operand I for statement GS. */
2136 static inline tree
2137 gimple_op (const_gimple gs, unsigned i)
2139 if (gimple_has_ops (gs))
2141 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2142 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2144 else
2145 return NULL_TREE;
2148 /* Return a pointer to operand I for statement GS. */
2150 static inline tree *
2151 gimple_op_ptr (const_gimple gs, unsigned i)
2153 if (gimple_has_ops (gs))
2155 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2156 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2158 else
2159 return NULL;
2162 /* Set operand I of statement GS to OP. */
2164 static inline void
2165 gimple_set_op (gimple gs, unsigned i, tree op)
2167 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2169 /* Note. It may be tempting to assert that OP matches
2170 is_gimple_operand, but that would be wrong. Different tuples
2171 accept slightly different sets of tree operands. Each caller
2172 should perform its own validation. */
2173 gimple_ops (gs)[i] = op;
2176 /* Return true if GS is a GIMPLE_ASSIGN. */
2178 static inline bool
2179 is_gimple_assign (const_gimple gs)
2181 return gimple_code (gs) == GIMPLE_ASSIGN;
2184 /* Determine if expression CODE is one of the valid expressions that can
2185 be used on the RHS of GIMPLE assignments. */
2187 static inline enum gimple_rhs_class
2188 get_gimple_rhs_class (enum tree_code code)
2190 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2193 /* Return the LHS of assignment statement GS. */
2195 static inline tree
2196 gimple_assign_lhs (const_gimple gs)
2198 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2199 return gimple_op (gs, 0);
2203 /* Return a pointer to the LHS of assignment statement GS. */
2205 static inline tree *
2206 gimple_assign_lhs_ptr (const_gimple gs)
2208 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2209 return gimple_op_ptr (gs, 0);
2213 /* Set LHS to be the LHS operand of assignment statement GS. */
2215 static inline void
2216 gimple_assign_set_lhs (gimple gs, tree lhs)
2218 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2219 gimple_set_op (gs, 0, lhs);
2221 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2222 SSA_NAME_DEF_STMT (lhs) = gs;
2226 /* Return the first operand on the RHS of assignment statement GS. */
2228 static inline tree
2229 gimple_assign_rhs1 (const_gimple gs)
2231 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2232 return gimple_op (gs, 1);
2236 /* Return a pointer to the first operand on the RHS of assignment
2237 statement GS. */
2239 static inline tree *
2240 gimple_assign_rhs1_ptr (const_gimple gs)
2242 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2243 return gimple_op_ptr (gs, 1);
2246 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2248 static inline void
2249 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2251 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2253 gimple_set_op (gs, 1, rhs);
2257 /* Return the second operand on the RHS of assignment statement GS.
2258 If GS does not have two operands, NULL is returned instead. */
2260 static inline tree
2261 gimple_assign_rhs2 (const_gimple gs)
2263 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2265 if (gimple_num_ops (gs) >= 3)
2266 return gimple_op (gs, 2);
2267 else
2268 return NULL_TREE;
2272 /* Return a pointer to the second operand on the RHS of assignment
2273 statement GS. */
2275 static inline tree *
2276 gimple_assign_rhs2_ptr (const_gimple gs)
2278 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2279 return gimple_op_ptr (gs, 2);
2283 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2285 static inline void
2286 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2288 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2290 gimple_set_op (gs, 2, rhs);
2293 /* Return the third operand on the RHS of assignment statement GS.
2294 If GS does not have two operands, NULL is returned instead. */
2296 static inline tree
2297 gimple_assign_rhs3 (const_gimple gs)
2299 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2301 if (gimple_num_ops (gs) >= 4)
2302 return gimple_op (gs, 3);
2303 else
2304 return NULL_TREE;
2307 /* Return a pointer to the third operand on the RHS of assignment
2308 statement GS. */
2310 static inline tree *
2311 gimple_assign_rhs3_ptr (const_gimple gs)
2313 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2314 return gimple_op_ptr (gs, 3);
2318 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2320 static inline void
2321 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2323 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2325 gimple_set_op (gs, 3, rhs);
2328 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2329 to see only a maximum of two operands. */
2331 static inline void
2332 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2333 tree op1, tree op2)
2335 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2338 /* Returns true if GS is a nontemporal move. */
2340 static inline bool
2341 gimple_assign_nontemporal_move_p (const_gimple gs)
2343 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2344 return gs->nontemporal_move;
2347 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2349 static inline void
2350 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2352 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2353 gs->nontemporal_move = nontemporal;
2357 /* Return the code of the expression computed on the rhs of assignment
2358 statement GS. In case that the RHS is a single object, returns the
2359 tree code of the object. */
2361 static inline enum tree_code
2362 gimple_assign_rhs_code (const_gimple gs)
2364 enum tree_code code;
2365 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2367 code = (enum tree_code) gs->subcode;
2368 /* While we initially set subcode to the TREE_CODE of the rhs for
2369 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2370 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2371 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2372 code = TREE_CODE (gimple_assign_rhs1 (gs));
2374 return code;
2378 /* Set CODE to be the code for the expression computed on the RHS of
2379 assignment S. */
2381 static inline void
2382 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2384 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2385 s->subcode = code;
2389 /* Return the gimple rhs class of the code of the expression computed on
2390 the rhs of assignment statement GS.
2391 This will never return GIMPLE_INVALID_RHS. */
2393 static inline enum gimple_rhs_class
2394 gimple_assign_rhs_class (const_gimple gs)
2396 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2399 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2400 there is no operator associated with the assignment itself.
2401 Unlike gimple_assign_copy_p, this predicate returns true for
2402 any RHS operand, including those that perform an operation
2403 and do not have the semantics of a copy, such as COND_EXPR. */
2405 static inline bool
2406 gimple_assign_single_p (const_gimple gs)
2408 return (is_gimple_assign (gs)
2409 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2412 /* Return true if GS performs a store to its lhs. */
2414 static inline bool
2415 gimple_store_p (const_gimple gs)
2417 tree lhs = gimple_get_lhs (gs);
2418 return lhs && !is_gimple_reg (lhs);
2421 /* Return true if GS is an assignment that loads from its rhs1. */
2423 static inline bool
2424 gimple_assign_load_p (const_gimple gs)
2426 tree rhs;
2427 if (!gimple_assign_single_p (gs))
2428 return false;
2429 rhs = gimple_assign_rhs1 (gs);
2430 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2431 return true;
2432 rhs = get_base_address (rhs);
2433 return (DECL_P (rhs)
2434 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2438 /* Return true if S is a type-cast assignment. */
2440 static inline bool
2441 gimple_assign_cast_p (const_gimple s)
2443 if (is_gimple_assign (s))
2445 enum tree_code sc = gimple_assign_rhs_code (s);
2446 return CONVERT_EXPR_CODE_P (sc)
2447 || sc == VIEW_CONVERT_EXPR
2448 || sc == FIX_TRUNC_EXPR;
2451 return false;
2454 /* Return true if S is a clobber statement. */
2456 static inline bool
2457 gimple_clobber_p (const_gimple s)
2459 return gimple_assign_single_p (s)
2460 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2463 /* Return true if GS is a GIMPLE_CALL. */
2465 static inline bool
2466 is_gimple_call (const_gimple gs)
2468 return gimple_code (gs) == GIMPLE_CALL;
2471 /* Return the LHS of call statement GS. */
2473 static inline tree
2474 gimple_call_lhs (const_gimple gs)
2476 GIMPLE_CHECK (gs, GIMPLE_CALL);
2477 return gimple_op (gs, 0);
2481 /* Return a pointer to the LHS of call statement GS. */
2483 static inline tree *
2484 gimple_call_lhs_ptr (const_gimple gs)
2486 GIMPLE_CHECK (gs, GIMPLE_CALL);
2487 return gimple_op_ptr (gs, 0);
2491 /* Set LHS to be the LHS operand of call statement GS. */
2493 static inline void
2494 gimple_call_set_lhs (gimple gs, tree lhs)
2496 GIMPLE_CHECK (gs, GIMPLE_CALL);
2497 gimple_set_op (gs, 0, lhs);
2498 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2499 SSA_NAME_DEF_STMT (lhs) = gs;
2503 /* Return true if call GS calls an internal-only function, as enumerated
2504 by internal_fn. */
2506 static inline bool
2507 gimple_call_internal_p (const_gimple gs)
2509 GIMPLE_CHECK (gs, GIMPLE_CALL);
2510 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2514 /* Return true if call GS is marked as instrumented by
2515 Pointer Bounds Checker. */
2517 static inline bool
2518 gimple_call_with_bounds_p (const_gimple gs)
2520 GIMPLE_CHECK (gs, GIMPLE_CALL);
2521 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2525 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2526 Pointer Bounds Checker. */
2528 static inline void
2529 gimple_call_set_with_bounds (gimple gs, bool with_bounds)
2531 GIMPLE_CHECK (gs, GIMPLE_CALL);
2532 if (with_bounds)
2533 gs->subcode |= GF_CALL_WITH_BOUNDS;
2534 else
2535 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2539 /* Return the target of internal call GS. */
2541 static inline enum internal_fn
2542 gimple_call_internal_fn (const_gimple gs)
2544 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2545 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2548 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2549 that could alter control flow. */
2551 static inline void
2552 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2554 GIMPLE_CHECK (s, GIMPLE_CALL);
2555 if (ctrl_altering_p)
2556 s->subcode |= GF_CALL_CTRL_ALTERING;
2557 else
2558 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2561 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2562 flag is set. Such call could not be a stmt in the middle of a bb. */
2564 static inline bool
2565 gimple_call_ctrl_altering_p (const_gimple gs)
2567 GIMPLE_CHECK (gs, GIMPLE_CALL);
2568 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2572 /* Return the function type of the function called by GS. */
2574 static inline tree
2575 gimple_call_fntype (const_gimple gs)
2577 const gimple_statement_call *call_stmt =
2578 as_a <const gimple_statement_call *> (gs);
2579 if (gimple_call_internal_p (gs))
2580 return NULL_TREE;
2581 return call_stmt->u.fntype;
2584 /* Set the type of the function called by GS to FNTYPE. */
2586 static inline void
2587 gimple_call_set_fntype (gimple gs, tree fntype)
2589 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2590 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2591 call_stmt->u.fntype = fntype;
2595 /* Return the tree node representing the function called by call
2596 statement GS. */
2598 static inline tree
2599 gimple_call_fn (const_gimple gs)
2601 GIMPLE_CHECK (gs, GIMPLE_CALL);
2602 return gimple_op (gs, 1);
2605 /* Return a pointer to the tree node representing the function called by call
2606 statement GS. */
2608 static inline tree *
2609 gimple_call_fn_ptr (const_gimple gs)
2611 GIMPLE_CHECK (gs, GIMPLE_CALL);
2612 return gimple_op_ptr (gs, 1);
2616 /* Set FN to be the function called by call statement GS. */
2618 static inline void
2619 gimple_call_set_fn (gimple gs, tree fn)
2621 GIMPLE_CHECK (gs, GIMPLE_CALL);
2622 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2623 gimple_set_op (gs, 1, fn);
2627 /* Set FNDECL to be the function called by call statement GS. */
2629 static inline void
2630 gimple_call_set_fndecl (gimple gs, tree decl)
2632 GIMPLE_CHECK (gs, GIMPLE_CALL);
2633 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2634 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2638 /* Set internal function FN to be the function called by call statement GS. */
2640 static inline void
2641 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2643 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2644 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2645 call_stmt->u.internal_fn = fn;
2649 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2650 Otherwise return NULL. This function is analogous to
2651 get_callee_fndecl in tree land. */
2653 static inline tree
2654 gimple_call_fndecl (const_gimple gs)
2656 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2660 /* Return the type returned by call statement GS. */
2662 static inline tree
2663 gimple_call_return_type (const_gimple gs)
2665 tree type = gimple_call_fntype (gs);
2667 if (type == NULL_TREE)
2668 return TREE_TYPE (gimple_call_lhs (gs));
2670 /* The type returned by a function is the type of its
2671 function type. */
2672 return TREE_TYPE (type);
2676 /* Return the static chain for call statement GS. */
2678 static inline tree
2679 gimple_call_chain (const_gimple gs)
2681 GIMPLE_CHECK (gs, GIMPLE_CALL);
2682 return gimple_op (gs, 2);
2686 /* Return a pointer to the static chain for call statement GS. */
2688 static inline tree *
2689 gimple_call_chain_ptr (const_gimple gs)
2691 GIMPLE_CHECK (gs, GIMPLE_CALL);
2692 return gimple_op_ptr (gs, 2);
2695 /* Set CHAIN to be the static chain for call statement GS. */
2697 static inline void
2698 gimple_call_set_chain (gimple gs, tree chain)
2700 GIMPLE_CHECK (gs, GIMPLE_CALL);
2702 gimple_set_op (gs, 2, chain);
2706 /* Return the number of arguments used by call statement GS. */
2708 static inline unsigned
2709 gimple_call_num_args (const_gimple gs)
2711 unsigned num_ops;
2712 GIMPLE_CHECK (gs, GIMPLE_CALL);
2713 num_ops = gimple_num_ops (gs);
2714 return num_ops - 3;
2718 /* Return the argument at position INDEX for call statement GS. */
2720 static inline tree
2721 gimple_call_arg (const_gimple gs, unsigned index)
2723 GIMPLE_CHECK (gs, GIMPLE_CALL);
2724 return gimple_op (gs, index + 3);
2728 /* Return a pointer to the argument at position INDEX for call
2729 statement GS. */
2731 static inline tree *
2732 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2734 GIMPLE_CHECK (gs, GIMPLE_CALL);
2735 return gimple_op_ptr (gs, index + 3);
2739 /* Set ARG to be the argument at position INDEX for call statement GS. */
2741 static inline void
2742 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2744 GIMPLE_CHECK (gs, GIMPLE_CALL);
2745 gimple_set_op (gs, index + 3, arg);
2749 /* If TAIL_P is true, mark call statement S as being a tail call
2750 (i.e., a call just before the exit of a function). These calls are
2751 candidate for tail call optimization. */
2753 static inline void
2754 gimple_call_set_tail (gimple s, bool tail_p)
2756 GIMPLE_CHECK (s, GIMPLE_CALL);
2757 if (tail_p)
2758 s->subcode |= GF_CALL_TAILCALL;
2759 else
2760 s->subcode &= ~GF_CALL_TAILCALL;
2764 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2766 static inline bool
2767 gimple_call_tail_p (gimple s)
2769 GIMPLE_CHECK (s, GIMPLE_CALL);
2770 return (s->subcode & GF_CALL_TAILCALL) != 0;
2774 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2775 slot optimization. This transformation uses the target of the call
2776 expansion as the return slot for calls that return in memory. */
2778 static inline void
2779 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2781 GIMPLE_CHECK (s, GIMPLE_CALL);
2782 if (return_slot_opt_p)
2783 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2784 else
2785 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2789 /* Return true if S is marked for return slot optimization. */
2791 static inline bool
2792 gimple_call_return_slot_opt_p (gimple s)
2794 GIMPLE_CHECK (s, GIMPLE_CALL);
2795 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2799 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2800 thunk to the thunked-to function. */
2802 static inline void
2803 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2805 GIMPLE_CHECK (s, GIMPLE_CALL);
2806 if (from_thunk_p)
2807 s->subcode |= GF_CALL_FROM_THUNK;
2808 else
2809 s->subcode &= ~GF_CALL_FROM_THUNK;
2813 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2815 static inline bool
2816 gimple_call_from_thunk_p (gimple s)
2818 GIMPLE_CHECK (s, GIMPLE_CALL);
2819 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2823 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2824 argument pack in its argument list. */
2826 static inline void
2827 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2829 GIMPLE_CHECK (s, GIMPLE_CALL);
2830 if (pass_arg_pack_p)
2831 s->subcode |= GF_CALL_VA_ARG_PACK;
2832 else
2833 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2837 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2838 argument pack in its argument list. */
2840 static inline bool
2841 gimple_call_va_arg_pack_p (gimple s)
2843 GIMPLE_CHECK (s, GIMPLE_CALL);
2844 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2848 /* Return true if S is a noreturn call. */
2850 static inline bool
2851 gimple_call_noreturn_p (gimple s)
2853 GIMPLE_CHECK (s, GIMPLE_CALL);
2854 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2858 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2859 even if the called function can throw in other cases. */
2861 static inline void
2862 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2864 GIMPLE_CHECK (s, GIMPLE_CALL);
2865 if (nothrow_p)
2866 s->subcode |= GF_CALL_NOTHROW;
2867 else
2868 s->subcode &= ~GF_CALL_NOTHROW;
2871 /* Return true if S is a nothrow call. */
2873 static inline bool
2874 gimple_call_nothrow_p (gimple s)
2876 GIMPLE_CHECK (s, GIMPLE_CALL);
2877 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2880 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2881 is known to be emitted for VLA objects. Those are wrapped by
2882 stack_save/stack_restore calls and hence can't lead to unbounded
2883 stack growth even when they occur in loops. */
2885 static inline void
2886 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2888 GIMPLE_CHECK (s, GIMPLE_CALL);
2889 if (for_var)
2890 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2891 else
2892 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2895 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2897 static inline bool
2898 gimple_call_alloca_for_var_p (gimple s)
2900 GIMPLE_CHECK (s, GIMPLE_CALL);
2901 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2904 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2906 static inline void
2907 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2909 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2910 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2911 dest_call->subcode = orig_call->subcode;
2915 /* Return a pointer to the points-to solution for the set of call-used
2916 variables of the call CALL. */
2918 static inline struct pt_solution *
2919 gimple_call_use_set (gimple call)
2921 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2922 return &call_stmt->call_used;
2926 /* Return a pointer to the points-to solution for the set of call-used
2927 variables of the call CALL. */
2929 static inline struct pt_solution *
2930 gimple_call_clobber_set (gimple call)
2932 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2933 return &call_stmt->call_clobbered;
2937 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2938 non-NULL lhs. */
2940 static inline bool
2941 gimple_has_lhs (gimple stmt)
2943 return (is_gimple_assign (stmt)
2944 || (is_gimple_call (stmt)
2945 && gimple_call_lhs (stmt) != NULL_TREE));
2949 /* Return the code of the predicate computed by conditional statement GS. */
2951 static inline enum tree_code
2952 gimple_cond_code (const_gimple gs)
2954 GIMPLE_CHECK (gs, GIMPLE_COND);
2955 return (enum tree_code) gs->subcode;
2959 /* Set CODE to be the predicate code for the conditional statement GS. */
2961 static inline void
2962 gimple_cond_set_code (gimple gs, enum tree_code code)
2964 GIMPLE_CHECK (gs, GIMPLE_COND);
2965 gs->subcode = code;
2969 /* Return the LHS of the predicate computed by conditional statement GS. */
2971 static inline tree
2972 gimple_cond_lhs (const_gimple gs)
2974 GIMPLE_CHECK (gs, GIMPLE_COND);
2975 return gimple_op (gs, 0);
2978 /* Return the pointer to the LHS of the predicate computed by conditional
2979 statement GS. */
2981 static inline tree *
2982 gimple_cond_lhs_ptr (const_gimple gs)
2984 GIMPLE_CHECK (gs, GIMPLE_COND);
2985 return gimple_op_ptr (gs, 0);
2988 /* Set LHS to be the LHS operand of the predicate computed by
2989 conditional statement GS. */
2991 static inline void
2992 gimple_cond_set_lhs (gimple gs, tree lhs)
2994 GIMPLE_CHECK (gs, GIMPLE_COND);
2995 gimple_set_op (gs, 0, lhs);
2999 /* Return the RHS operand of the predicate computed by conditional GS. */
3001 static inline tree
3002 gimple_cond_rhs (const_gimple gs)
3004 GIMPLE_CHECK (gs, GIMPLE_COND);
3005 return gimple_op (gs, 1);
3008 /* Return the pointer to the RHS operand of the predicate computed by
3009 conditional GS. */
3011 static inline tree *
3012 gimple_cond_rhs_ptr (const_gimple gs)
3014 GIMPLE_CHECK (gs, GIMPLE_COND);
3015 return gimple_op_ptr (gs, 1);
3019 /* Set RHS to be the RHS operand of the predicate computed by
3020 conditional statement GS. */
3022 static inline void
3023 gimple_cond_set_rhs (gimple gs, tree rhs)
3025 GIMPLE_CHECK (gs, GIMPLE_COND);
3026 gimple_set_op (gs, 1, rhs);
3030 /* Return the label used by conditional statement GS when its
3031 predicate evaluates to true. */
3033 static inline tree
3034 gimple_cond_true_label (const_gimple gs)
3036 GIMPLE_CHECK (gs, GIMPLE_COND);
3037 return gimple_op (gs, 2);
3041 /* Set LABEL to be the label used by conditional statement GS when its
3042 predicate evaluates to true. */
3044 static inline void
3045 gimple_cond_set_true_label (gimple gs, tree label)
3047 GIMPLE_CHECK (gs, GIMPLE_COND);
3048 gimple_set_op (gs, 2, label);
3052 /* Set LABEL to be the label used by conditional statement GS when its
3053 predicate evaluates to false. */
3055 static inline void
3056 gimple_cond_set_false_label (gimple gs, tree label)
3058 GIMPLE_CHECK (gs, GIMPLE_COND);
3059 gimple_set_op (gs, 3, label);
3063 /* Return the label used by conditional statement GS when its
3064 predicate evaluates to false. */
3066 static inline tree
3067 gimple_cond_false_label (const_gimple gs)
3069 GIMPLE_CHECK (gs, GIMPLE_COND);
3070 return gimple_op (gs, 3);
3074 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3076 static inline void
3077 gimple_cond_make_false (gimple gs)
3079 gimple_cond_set_lhs (gs, boolean_true_node);
3080 gimple_cond_set_rhs (gs, boolean_false_node);
3081 gs->subcode = EQ_EXPR;
3085 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3087 static inline void
3088 gimple_cond_make_true (gimple gs)
3090 gimple_cond_set_lhs (gs, boolean_true_node);
3091 gimple_cond_set_rhs (gs, boolean_true_node);
3092 gs->subcode = EQ_EXPR;
3095 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3096 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3098 static inline bool
3099 gimple_cond_true_p (const_gimple gs)
3101 tree lhs = gimple_cond_lhs (gs);
3102 tree rhs = gimple_cond_rhs (gs);
3103 enum tree_code code = gimple_cond_code (gs);
3105 if (lhs != boolean_true_node && lhs != boolean_false_node)
3106 return false;
3108 if (rhs != boolean_true_node && rhs != boolean_false_node)
3109 return false;
3111 if (code == NE_EXPR && lhs != rhs)
3112 return true;
3114 if (code == EQ_EXPR && lhs == rhs)
3115 return true;
3117 return false;
3120 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3121 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3123 static inline bool
3124 gimple_cond_false_p (const_gimple gs)
3126 tree lhs = gimple_cond_lhs (gs);
3127 tree rhs = gimple_cond_rhs (gs);
3128 enum tree_code code = gimple_cond_code (gs);
3130 if (lhs != boolean_true_node && lhs != boolean_false_node)
3131 return false;
3133 if (rhs != boolean_true_node && rhs != boolean_false_node)
3134 return false;
3136 if (code == NE_EXPR && lhs == rhs)
3137 return true;
3139 if (code == EQ_EXPR && lhs != rhs)
3140 return true;
3142 return false;
3145 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3147 static inline void
3148 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3150 gimple_cond_set_code (stmt, code);
3151 gimple_cond_set_lhs (stmt, lhs);
3152 gimple_cond_set_rhs (stmt, rhs);
3155 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3157 static inline tree
3158 gimple_label_label (const_gimple gs)
3160 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3161 return gimple_op (gs, 0);
3165 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3166 GS. */
3168 static inline void
3169 gimple_label_set_label (gimple gs, tree label)
3171 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3172 gimple_set_op (gs, 0, label);
3176 /* Return the destination of the unconditional jump GS. */
3178 static inline tree
3179 gimple_goto_dest (const_gimple gs)
3181 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3182 return gimple_op (gs, 0);
3186 /* Set DEST to be the destination of the unconditonal jump GS. */
3188 static inline void
3189 gimple_goto_set_dest (gimple gs, tree dest)
3191 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3192 gimple_set_op (gs, 0, dest);
3196 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3198 static inline tree
3199 gimple_bind_vars (const_gimple gs)
3201 const gimple_statement_bind *bind_stmt =
3202 as_a <const gimple_statement_bind *> (gs);
3203 return bind_stmt->vars;
3207 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3208 statement GS. */
3210 static inline void
3211 gimple_bind_set_vars (gimple gs, tree vars)
3213 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3214 bind_stmt->vars = vars;
3218 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3219 statement GS. */
3221 static inline void
3222 gimple_bind_append_vars (gimple gs, tree vars)
3224 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3225 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3229 static inline gimple_seq *
3230 gimple_bind_body_ptr (gimple gs)
3232 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3233 return &bind_stmt->body;
3236 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3238 static inline gimple_seq
3239 gimple_bind_body (gimple gs)
3241 return *gimple_bind_body_ptr (gs);
3245 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3246 statement GS. */
3248 static inline void
3249 gimple_bind_set_body (gimple gs, gimple_seq seq)
3251 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3252 bind_stmt->body = seq;
3256 /* Append a statement to the end of a GIMPLE_BIND's body. */
3258 static inline void
3259 gimple_bind_add_stmt (gimple gs, gimple stmt)
3261 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3262 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3266 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3268 static inline void
3269 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3271 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3272 gimple_seq_add_seq (&bind_stmt->body, seq);
3276 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3277 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3279 static inline tree
3280 gimple_bind_block (const_gimple gs)
3282 const gimple_statement_bind *bind_stmt =
3283 as_a <const gimple_statement_bind *> (gs);
3284 return bind_stmt->block;
3288 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3289 statement GS. */
3291 static inline void
3292 gimple_bind_set_block (gimple gs, tree block)
3294 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3295 gcc_gimple_checking_assert (block == NULL_TREE
3296 || TREE_CODE (block) == BLOCK);
3297 bind_stmt->block = block;
3301 /* Return the number of input operands for GIMPLE_ASM GS. */
3303 static inline unsigned
3304 gimple_asm_ninputs (const_gimple gs)
3306 const gimple_statement_asm *asm_stmt =
3307 as_a <const gimple_statement_asm *> (gs);
3308 return asm_stmt->ni;
3312 /* Return the number of output operands for GIMPLE_ASM GS. */
3314 static inline unsigned
3315 gimple_asm_noutputs (const_gimple gs)
3317 const gimple_statement_asm *asm_stmt =
3318 as_a <const gimple_statement_asm *> (gs);
3319 return asm_stmt->no;
3323 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3325 static inline unsigned
3326 gimple_asm_nclobbers (const_gimple gs)
3328 const gimple_statement_asm *asm_stmt =
3329 as_a <const gimple_statement_asm *> (gs);
3330 return asm_stmt->nc;
3333 /* Return the number of label operands for GIMPLE_ASM GS. */
3335 static inline unsigned
3336 gimple_asm_nlabels (const_gimple gs)
3338 const gimple_statement_asm *asm_stmt =
3339 as_a <const gimple_statement_asm *> (gs);
3340 return asm_stmt->nl;
3343 /* Return input operand INDEX of GIMPLE_ASM GS. */
3345 static inline tree
3346 gimple_asm_input_op (const_gimple gs, unsigned index)
3348 const gimple_statement_asm *asm_stmt =
3349 as_a <const gimple_statement_asm *> (gs);
3350 gcc_gimple_checking_assert (index < asm_stmt->ni);
3351 return gimple_op (gs, index + asm_stmt->no);
3354 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3356 static inline tree *
3357 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3359 const gimple_statement_asm *asm_stmt =
3360 as_a <const gimple_statement_asm *> (gs);
3361 gcc_gimple_checking_assert (index < asm_stmt->ni);
3362 return gimple_op_ptr (gs, index + asm_stmt->no);
3366 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3368 static inline void
3369 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3371 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3372 gcc_gimple_checking_assert (index < asm_stmt->ni
3373 && TREE_CODE (in_op) == TREE_LIST);
3374 gimple_set_op (gs, index + asm_stmt->no, in_op);
3378 /* Return output operand INDEX of GIMPLE_ASM GS. */
3380 static inline tree
3381 gimple_asm_output_op (const_gimple gs, unsigned index)
3383 const gimple_statement_asm *asm_stmt =
3384 as_a <const gimple_statement_asm *> (gs);
3385 gcc_gimple_checking_assert (index < asm_stmt->no);
3386 return gimple_op (gs, index);
3389 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3391 static inline tree *
3392 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3394 const gimple_statement_asm *asm_stmt =
3395 as_a <const gimple_statement_asm *> (gs);
3396 gcc_gimple_checking_assert (index < asm_stmt->no);
3397 return gimple_op_ptr (gs, index);
3401 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3403 static inline void
3404 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3406 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3407 gcc_gimple_checking_assert (index < asm_stmt->no
3408 && TREE_CODE (out_op) == TREE_LIST);
3409 gimple_set_op (gs, index, out_op);
3413 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3415 static inline tree
3416 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3418 const gimple_statement_asm *asm_stmt =
3419 as_a <const gimple_statement_asm *> (gs);
3420 gcc_gimple_checking_assert (index < asm_stmt->nc);
3421 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3425 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3427 static inline void
3428 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3430 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3431 gcc_gimple_checking_assert (index < asm_stmt->nc
3432 && TREE_CODE (clobber_op) == TREE_LIST);
3433 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3436 /* Return label operand INDEX of GIMPLE_ASM GS. */
3438 static inline tree
3439 gimple_asm_label_op (const_gimple gs, unsigned index)
3441 const gimple_statement_asm *asm_stmt =
3442 as_a <const gimple_statement_asm *> (gs);
3443 gcc_gimple_checking_assert (index < asm_stmt->nl);
3444 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3447 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3449 static inline void
3450 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3452 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3453 gcc_gimple_checking_assert (index < asm_stmt->nl
3454 && TREE_CODE (label_op) == TREE_LIST);
3455 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3458 /* Return the string representing the assembly instruction in
3459 GIMPLE_ASM GS. */
3461 static inline const char *
3462 gimple_asm_string (const_gimple gs)
3464 const gimple_statement_asm *asm_stmt =
3465 as_a <const gimple_statement_asm *> (gs);
3466 return asm_stmt->string;
3470 /* Return true if GS is an asm statement marked volatile. */
3472 static inline bool
3473 gimple_asm_volatile_p (const_gimple gs)
3475 GIMPLE_CHECK (gs, GIMPLE_ASM);
3476 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3480 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3482 static inline void
3483 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3485 GIMPLE_CHECK (gs, GIMPLE_ASM);
3486 if (volatile_p)
3487 gs->subcode |= GF_ASM_VOLATILE;
3488 else
3489 gs->subcode &= ~GF_ASM_VOLATILE;
3493 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3495 static inline void
3496 gimple_asm_set_input (gimple gs, bool input_p)
3498 GIMPLE_CHECK (gs, GIMPLE_ASM);
3499 if (input_p)
3500 gs->subcode |= GF_ASM_INPUT;
3501 else
3502 gs->subcode &= ~GF_ASM_INPUT;
3506 /* Return true if asm GS is an ASM_INPUT. */
3508 static inline bool
3509 gimple_asm_input_p (const_gimple gs)
3511 GIMPLE_CHECK (gs, GIMPLE_ASM);
3512 return (gs->subcode & GF_ASM_INPUT) != 0;
3516 /* Return the types handled by GIMPLE_CATCH statement GS. */
3518 static inline tree
3519 gimple_catch_types (const_gimple gs)
3521 const gimple_statement_catch *catch_stmt =
3522 as_a <const gimple_statement_catch *> (gs);
3523 return catch_stmt->types;
3527 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3529 static inline tree *
3530 gimple_catch_types_ptr (gimple gs)
3532 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3533 return &catch_stmt->types;
3537 /* Return a pointer to the GIMPLE sequence representing the body of
3538 the handler of GIMPLE_CATCH statement GS. */
3540 static inline gimple_seq *
3541 gimple_catch_handler_ptr (gimple gs)
3543 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3544 return &catch_stmt->handler;
3548 /* Return the GIMPLE sequence representing the body of the handler of
3549 GIMPLE_CATCH statement GS. */
3551 static inline gimple_seq
3552 gimple_catch_handler (gimple gs)
3554 return *gimple_catch_handler_ptr (gs);
3558 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3560 static inline void
3561 gimple_catch_set_types (gimple gs, tree t)
3563 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3564 catch_stmt->types = t;
3568 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3570 static inline void
3571 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3573 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3574 catch_stmt->handler = handler;
3578 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3580 static inline tree
3581 gimple_eh_filter_types (const_gimple gs)
3583 const gimple_statement_eh_filter *eh_filter_stmt =
3584 as_a <const gimple_statement_eh_filter *> (gs);
3585 return eh_filter_stmt->types;
3589 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3590 GS. */
3592 static inline tree *
3593 gimple_eh_filter_types_ptr (gimple gs)
3595 gimple_statement_eh_filter *eh_filter_stmt =
3596 as_a <gimple_statement_eh_filter *> (gs);
3597 return &eh_filter_stmt->types;
3601 /* Return a pointer to the sequence of statement to execute when
3602 GIMPLE_EH_FILTER statement fails. */
3604 static inline gimple_seq *
3605 gimple_eh_filter_failure_ptr (gimple gs)
3607 gimple_statement_eh_filter *eh_filter_stmt =
3608 as_a <gimple_statement_eh_filter *> (gs);
3609 return &eh_filter_stmt->failure;
3613 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3614 statement fails. */
3616 static inline gimple_seq
3617 gimple_eh_filter_failure (gimple gs)
3619 return *gimple_eh_filter_failure_ptr (gs);
3623 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3625 static inline void
3626 gimple_eh_filter_set_types (gimple gs, tree types)
3628 gimple_statement_eh_filter *eh_filter_stmt =
3629 as_a <gimple_statement_eh_filter *> (gs);
3630 eh_filter_stmt->types = types;
3634 /* Set FAILURE to be the sequence of statements to execute on failure
3635 for GIMPLE_EH_FILTER GS. */
3637 static inline void
3638 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3640 gimple_statement_eh_filter *eh_filter_stmt =
3641 as_a <gimple_statement_eh_filter *> (gs);
3642 eh_filter_stmt->failure = failure;
3645 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3647 static inline tree
3648 gimple_eh_must_not_throw_fndecl (gimple gs)
3650 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3651 return eh_mnt_stmt->fndecl;
3654 /* Set the function decl to be called by GS to DECL. */
3656 static inline void
3657 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3659 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3660 eh_mnt_stmt->fndecl = decl;
3663 /* GIMPLE_EH_ELSE accessors. */
3665 static inline gimple_seq *
3666 gimple_eh_else_n_body_ptr (gimple gs)
3668 gimple_statement_eh_else *eh_else_stmt =
3669 as_a <gimple_statement_eh_else *> (gs);
3670 return &eh_else_stmt->n_body;
3673 static inline gimple_seq
3674 gimple_eh_else_n_body (gimple gs)
3676 return *gimple_eh_else_n_body_ptr (gs);
3679 static inline gimple_seq *
3680 gimple_eh_else_e_body_ptr (gimple gs)
3682 gimple_statement_eh_else *eh_else_stmt =
3683 as_a <gimple_statement_eh_else *> (gs);
3684 return &eh_else_stmt->e_body;
3687 static inline gimple_seq
3688 gimple_eh_else_e_body (gimple gs)
3690 return *gimple_eh_else_e_body_ptr (gs);
3693 static inline void
3694 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3696 gimple_statement_eh_else *eh_else_stmt =
3697 as_a <gimple_statement_eh_else *> (gs);
3698 eh_else_stmt->n_body = seq;
3701 static inline void
3702 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3704 gimple_statement_eh_else *eh_else_stmt =
3705 as_a <gimple_statement_eh_else *> (gs);
3706 eh_else_stmt->e_body = seq;
3709 /* GIMPLE_TRY accessors. */
3711 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3712 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3714 static inline enum gimple_try_flags
3715 gimple_try_kind (const_gimple gs)
3717 GIMPLE_CHECK (gs, GIMPLE_TRY);
3718 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3722 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3724 static inline void
3725 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3727 GIMPLE_CHECK (gs, GIMPLE_TRY);
3728 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3729 || kind == GIMPLE_TRY_FINALLY);
3730 if (gimple_try_kind (gs) != kind)
3731 gs->subcode = (unsigned int) kind;
3735 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3737 static inline bool
3738 gimple_try_catch_is_cleanup (const_gimple gs)
3740 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3741 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3745 /* Return a pointer to the sequence of statements used as the
3746 body for GIMPLE_TRY GS. */
3748 static inline gimple_seq *
3749 gimple_try_eval_ptr (gimple gs)
3751 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3752 return &try_stmt->eval;
3756 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3758 static inline gimple_seq
3759 gimple_try_eval (gimple gs)
3761 return *gimple_try_eval_ptr (gs);
3765 /* Return a pointer to the sequence of statements used as the cleanup body for
3766 GIMPLE_TRY GS. */
3768 static inline gimple_seq *
3769 gimple_try_cleanup_ptr (gimple gs)
3771 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3772 return &try_stmt->cleanup;
3776 /* Return the sequence of statements used as the cleanup body for
3777 GIMPLE_TRY GS. */
3779 static inline gimple_seq
3780 gimple_try_cleanup (gimple gs)
3782 return *gimple_try_cleanup_ptr (gs);
3786 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3788 static inline void
3789 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3791 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3792 if (catch_is_cleanup)
3793 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3794 else
3795 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3799 /* Set EVAL to be the sequence of statements to use as the body for
3800 GIMPLE_TRY GS. */
3802 static inline void
3803 gimple_try_set_eval (gimple gs, gimple_seq eval)
3805 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3806 try_stmt->eval = eval;
3810 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3811 body for GIMPLE_TRY GS. */
3813 static inline void
3814 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3816 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3817 try_stmt->cleanup = cleanup;
3821 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3823 static inline gimple_seq *
3824 gimple_wce_cleanup_ptr (gimple gs)
3826 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3827 return &wce_stmt->cleanup;
3831 /* Return the cleanup sequence for cleanup statement GS. */
3833 static inline gimple_seq
3834 gimple_wce_cleanup (gimple gs)
3836 return *gimple_wce_cleanup_ptr (gs);
3840 /* Set CLEANUP to be the cleanup sequence for GS. */
3842 static inline void
3843 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3845 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3846 wce_stmt->cleanup = cleanup;
3850 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3852 static inline bool
3853 gimple_wce_cleanup_eh_only (const_gimple gs)
3855 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3856 return gs->subcode != 0;
3860 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3862 static inline void
3863 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3865 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3866 gs->subcode = (unsigned int) eh_only_p;
3870 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3872 static inline unsigned
3873 gimple_phi_capacity (const_gimple gs)
3875 const gimple_statement_phi *phi_stmt =
3876 as_a <const gimple_statement_phi *> (gs);
3877 return phi_stmt->capacity;
3881 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3882 be exactly the number of incoming edges for the basic block holding
3883 GS. */
3885 static inline unsigned
3886 gimple_phi_num_args (const_gimple gs)
3888 const gimple_statement_phi *phi_stmt =
3889 as_a <const gimple_statement_phi *> (gs);
3890 return phi_stmt->nargs;
3894 /* Return the SSA name created by GIMPLE_PHI GS. */
3896 static inline tree
3897 gimple_phi_result (const_gimple gs)
3899 const gimple_statement_phi *phi_stmt =
3900 as_a <const gimple_statement_phi *> (gs);
3901 return phi_stmt->result;
3904 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3906 static inline tree *
3907 gimple_phi_result_ptr (gimple gs)
3909 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3910 return &phi_stmt->result;
3913 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3915 static inline void
3916 gimple_phi_set_result (gimple gs, tree result)
3918 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3919 phi_stmt->result = result;
3920 if (result && TREE_CODE (result) == SSA_NAME)
3921 SSA_NAME_DEF_STMT (result) = gs;
3925 /* Return the PHI argument corresponding to incoming edge INDEX for
3926 GIMPLE_PHI GS. */
3928 static inline struct phi_arg_d *
3929 gimple_phi_arg (gimple gs, unsigned index)
3931 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3932 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3933 return &(phi_stmt->args[index]);
3936 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3937 for GIMPLE_PHI GS. */
3939 static inline void
3940 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3942 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3943 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3944 phi_stmt->args[index] = *phiarg;
3947 /* Return the PHI nodes for basic block BB, or NULL if there are no
3948 PHI nodes. */
3950 static inline gimple_seq
3951 phi_nodes (const_basic_block bb)
3953 gcc_checking_assert (!(bb->flags & BB_RTL));
3954 return bb->il.gimple.phi_nodes;
3957 /* Return a pointer to the PHI nodes for basic block BB. */
3959 static inline gimple_seq *
3960 phi_nodes_ptr (basic_block bb)
3962 gcc_checking_assert (!(bb->flags & BB_RTL));
3963 return &bb->il.gimple.phi_nodes;
3966 /* Return the tree operand for argument I of PHI node GS. */
3968 static inline tree
3969 gimple_phi_arg_def (gimple gs, size_t index)
3971 return gimple_phi_arg (gs, index)->def;
3975 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3977 static inline tree *
3978 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3980 return &gimple_phi_arg (gs, index)->def;
3983 /* Return the edge associated with argument I of phi node GS. */
3985 static inline edge
3986 gimple_phi_arg_edge (gimple gs, size_t i)
3988 return EDGE_PRED (gimple_bb (gs), i);
3991 /* Return the source location of gimple argument I of phi node GS. */
3993 static inline source_location
3994 gimple_phi_arg_location (gimple gs, size_t i)
3996 return gimple_phi_arg (gs, i)->locus;
3999 /* Return the source location of the argument on edge E of phi node GS. */
4001 static inline source_location
4002 gimple_phi_arg_location_from_edge (gimple gs, edge e)
4004 return gimple_phi_arg (gs, e->dest_idx)->locus;
4007 /* Set the source location of gimple argument I of phi node GS to LOC. */
4009 static inline void
4010 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
4012 gimple_phi_arg (gs, i)->locus = loc;
4015 /* Return TRUE if argument I of phi node GS has a location record. */
4017 static inline bool
4018 gimple_phi_arg_has_location (gimple gs, size_t i)
4020 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
4024 /* Return the region number for GIMPLE_RESX GS. */
4026 static inline int
4027 gimple_resx_region (const_gimple gs)
4029 const gimple_statement_resx *resx_stmt =
4030 as_a <const gimple_statement_resx *> (gs);
4031 return resx_stmt->region;
4034 /* Set REGION to be the region number for GIMPLE_RESX GS. */
4036 static inline void
4037 gimple_resx_set_region (gimple gs, int region)
4039 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
4040 resx_stmt->region = region;
4043 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
4045 static inline int
4046 gimple_eh_dispatch_region (const_gimple gs)
4048 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
4049 as_a <const gimple_statement_eh_dispatch *> (gs);
4050 return eh_dispatch_stmt->region;
4053 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
4055 static inline void
4056 gimple_eh_dispatch_set_region (gimple gs, int region)
4058 gimple_statement_eh_dispatch *eh_dispatch_stmt =
4059 as_a <gimple_statement_eh_dispatch *> (gs);
4060 eh_dispatch_stmt->region = region;
4063 /* Return the number of labels associated with the switch statement GS. */
4065 static inline unsigned
4066 gimple_switch_num_labels (const_gimple gs)
4068 unsigned num_ops;
4069 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4070 num_ops = gimple_num_ops (gs);
4071 gcc_gimple_checking_assert (num_ops > 1);
4072 return num_ops - 1;
4076 /* Set NLABELS to be the number of labels for the switch statement GS. */
4078 static inline void
4079 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
4081 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4082 gimple_set_num_ops (g, nlabels + 1);
4086 /* Return the index variable used by the switch statement GS. */
4088 static inline tree
4089 gimple_switch_index (const_gimple gs)
4091 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4092 return gimple_op (gs, 0);
4096 /* Return a pointer to the index variable for the switch statement GS. */
4098 static inline tree *
4099 gimple_switch_index_ptr (const_gimple gs)
4101 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4102 return gimple_op_ptr (gs, 0);
4106 /* Set INDEX to be the index variable for switch statement GS. */
4108 static inline void
4109 gimple_switch_set_index (gimple gs, tree index)
4111 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4112 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4113 gimple_set_op (gs, 0, index);
4117 /* Return the label numbered INDEX. The default label is 0, followed by any
4118 labels in a switch statement. */
4120 static inline tree
4121 gimple_switch_label (const_gimple gs, unsigned index)
4123 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4124 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4125 return gimple_op (gs, index + 1);
4128 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4130 static inline void
4131 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4133 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4134 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4135 && (label == NULL_TREE
4136 || TREE_CODE (label) == CASE_LABEL_EXPR));
4137 gimple_set_op (gs, index + 1, label);
4140 /* Return the default label for a switch statement. */
4142 static inline tree
4143 gimple_switch_default_label (const_gimple gs)
4145 tree label = gimple_switch_label (gs, 0);
4146 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4147 return label;
4150 /* Set the default label for a switch statement. */
4152 static inline void
4153 gimple_switch_set_default_label (gimple gs, tree label)
4155 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4156 gimple_switch_set_label (gs, 0, label);
4159 /* Return true if GS is a GIMPLE_DEBUG statement. */
4161 static inline bool
4162 is_gimple_debug (const_gimple gs)
4164 return gimple_code (gs) == GIMPLE_DEBUG;
4167 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4169 static inline bool
4170 gimple_debug_bind_p (const_gimple s)
4172 if (is_gimple_debug (s))
4173 return s->subcode == GIMPLE_DEBUG_BIND;
4175 return false;
4178 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4180 static inline tree
4181 gimple_debug_bind_get_var (gimple dbg)
4183 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4184 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4185 return gimple_op (dbg, 0);
4188 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4189 statement. */
4191 static inline tree
4192 gimple_debug_bind_get_value (gimple dbg)
4194 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4195 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4196 return gimple_op (dbg, 1);
4199 /* Return a pointer to the value bound to the variable in a
4200 GIMPLE_DEBUG bind statement. */
4202 static inline tree *
4203 gimple_debug_bind_get_value_ptr (gimple dbg)
4205 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4206 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4207 return gimple_op_ptr (dbg, 1);
4210 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4212 static inline void
4213 gimple_debug_bind_set_var (gimple dbg, tree var)
4215 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4216 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4217 gimple_set_op (dbg, 0, var);
4220 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4221 statement. */
4223 static inline void
4224 gimple_debug_bind_set_value (gimple dbg, tree value)
4226 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4227 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4228 gimple_set_op (dbg, 1, value);
4231 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4232 optimized away. */
4233 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4235 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4236 statement. */
4238 static inline void
4239 gimple_debug_bind_reset_value (gimple dbg)
4241 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4242 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4243 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4246 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4247 value. */
4249 static inline bool
4250 gimple_debug_bind_has_value_p (gimple dbg)
4252 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4253 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4254 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4257 #undef GIMPLE_DEBUG_BIND_NOVALUE
4259 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4261 static inline bool
4262 gimple_debug_source_bind_p (const_gimple s)
4264 if (is_gimple_debug (s))
4265 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4267 return false;
4270 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4272 static inline tree
4273 gimple_debug_source_bind_get_var (gimple dbg)
4275 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4276 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4277 return gimple_op (dbg, 0);
4280 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4281 statement. */
4283 static inline tree
4284 gimple_debug_source_bind_get_value (gimple dbg)
4286 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4287 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4288 return gimple_op (dbg, 1);
4291 /* Return a pointer to the value bound to the variable in a
4292 GIMPLE_DEBUG source bind statement. */
4294 static inline tree *
4295 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4297 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4298 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4299 return gimple_op_ptr (dbg, 1);
4302 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4304 static inline void
4305 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4307 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4308 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4309 gimple_set_op (dbg, 0, var);
4312 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4313 statement. */
4315 static inline void
4316 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4318 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4319 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4320 gimple_set_op (dbg, 1, value);
4323 /* Return the line number for EXPR, or return -1 if we have no line
4324 number information for it. */
4325 static inline int
4326 get_lineno (const_gimple stmt)
4328 location_t loc;
4330 if (!stmt)
4331 return -1;
4333 loc = gimple_location (stmt);
4334 if (loc == UNKNOWN_LOCATION)
4335 return -1;
4337 return LOCATION_LINE (loc);
4340 /* Return a pointer to the body for the OMP statement GS. */
4342 static inline gimple_seq *
4343 gimple_omp_body_ptr (gimple gs)
4345 return &static_cast <gimple_statement_omp *> (gs)->body;
4348 /* Return the body for the OMP statement GS. */
4350 static inline gimple_seq
4351 gimple_omp_body (gimple gs)
4353 return *gimple_omp_body_ptr (gs);
4356 /* Set BODY to be the body for the OMP statement GS. */
4358 static inline void
4359 gimple_omp_set_body (gimple gs, gimple_seq body)
4361 static_cast <gimple_statement_omp *> (gs)->body = body;
4365 /* Return the clauses associated with OACC_KERNELS statement GS. */
4367 static inline tree
4368 gimple_oacc_kernels_clauses (const_gimple gs)
4370 const gimple_statement_oacc_kernels *oacc_kernels_stmt =
4371 as_a <const gimple_statement_oacc_kernels *> (gs);
4372 return oacc_kernels_stmt->clauses;
4375 /* Return a pointer to the clauses associated with OACC_KERNELS statement GS. */
4377 static inline tree *
4378 gimple_oacc_kernels_clauses_ptr (gimple gs)
4380 gimple_statement_oacc_kernels *oacc_kernels_stmt =
4381 as_a <gimple_statement_oacc_kernels *> (gs);
4382 return &oacc_kernels_stmt->clauses;
4385 /* Set CLAUSES to be the list of clauses associated with OACC_KERNELS statement
4386 GS. */
4388 static inline void
4389 gimple_oacc_kernels_set_clauses (gimple gs, tree clauses)
4391 gimple_statement_oacc_kernels *oacc_kernels_stmt =
4392 as_a <gimple_statement_oacc_kernels *> (gs);
4393 oacc_kernels_stmt->clauses = clauses;
4396 /* Return the child function used to hold the body of OACC_KERNELS statement
4397 GS. */
4399 static inline tree
4400 gimple_oacc_kernels_child_fn (const_gimple gs)
4402 const gimple_statement_oacc_kernels *oacc_kernels_stmt =
4403 as_a <const gimple_statement_oacc_kernels *> (gs);
4404 return oacc_kernels_stmt->child_fn;
4407 /* Return a pointer to the child function used to hold the body of OACC_KERNELS
4408 statement GS. */
4410 static inline tree *
4411 gimple_oacc_kernels_child_fn_ptr (gimple gs)
4413 gimple_statement_oacc_kernels *oacc_kernels_stmt =
4414 as_a <gimple_statement_oacc_kernels *> (gs);
4415 return &oacc_kernels_stmt->child_fn;
4418 /* Set CHILD_FN to be the child function for OACC_KERNELS statement GS. */
4420 static inline void
4421 gimple_oacc_kernels_set_child_fn (gimple gs, tree child_fn)
4423 gimple_statement_oacc_kernels *oacc_kernels_stmt =
4424 as_a <gimple_statement_oacc_kernels *> (gs);
4425 oacc_kernels_stmt->child_fn = child_fn;
4428 /* Return the artificial argument used to send variables and values
4429 from the parent to the children threads in OACC_KERNELS statement GS. */
4431 static inline tree
4432 gimple_oacc_kernels_data_arg (const_gimple gs)
4434 const gimple_statement_oacc_kernels *oacc_kernels_stmt =
4435 as_a <const gimple_statement_oacc_kernels *> (gs);
4436 return oacc_kernels_stmt->data_arg;
4439 /* Return a pointer to the data argument for OACC_KERNELS statement GS. */
4441 static inline tree *
4442 gimple_oacc_kernels_data_arg_ptr (gimple gs)
4444 gimple_statement_oacc_kernels *oacc_kernels_stmt =
4445 as_a <gimple_statement_oacc_kernels *> (gs);
4446 return &oacc_kernels_stmt->data_arg;
4449 /* Set DATA_ARG to be the data argument for OACC_KERNELS statement GS. */
4451 static inline void
4452 gimple_oacc_kernels_set_data_arg (gimple gs, tree data_arg)
4454 gimple_statement_oacc_kernels *oacc_kernels_stmt =
4455 as_a <gimple_statement_oacc_kernels *> (gs);
4456 oacc_kernels_stmt->data_arg = data_arg;
4460 /* Return the clauses associated with OACC_PARALLEL statement GS. */
4462 static inline tree
4463 gimple_oacc_parallel_clauses (const_gimple gs)
4465 const gimple_statement_oacc_parallel *oacc_parallel_stmt =
4466 as_a <const gimple_statement_oacc_parallel *> (gs);
4467 return oacc_parallel_stmt->clauses;
4470 /* Return a pointer to the clauses associated with OACC_PARALLEL statement
4471 GS. */
4473 static inline tree *
4474 gimple_oacc_parallel_clauses_ptr (gimple gs)
4476 gimple_statement_oacc_parallel *oacc_parallel_stmt =
4477 as_a <gimple_statement_oacc_parallel *> (gs);
4478 return &oacc_parallel_stmt->clauses;
4481 /* Set CLAUSES to be the list of clauses associated with OACC_PARALLEL
4482 statement GS. */
4484 static inline void
4485 gimple_oacc_parallel_set_clauses (gimple gs, tree clauses)
4487 gimple_statement_oacc_parallel *oacc_parallel_stmt =
4488 as_a <gimple_statement_oacc_parallel *> (gs);
4489 oacc_parallel_stmt->clauses = clauses;
4492 /* Return the child function used to hold the body of OACC_PARALLEL statement
4493 GS. */
4495 static inline tree
4496 gimple_oacc_parallel_child_fn (const_gimple gs)
4498 const gimple_statement_oacc_parallel *oacc_parallel_stmt =
4499 as_a <const gimple_statement_oacc_parallel *> (gs);
4500 return oacc_parallel_stmt->child_fn;
4503 /* Return a pointer to the child function used to hold the body of
4504 OACC_PARALLEL statement GS. */
4506 static inline tree *
4507 gimple_oacc_parallel_child_fn_ptr (gimple gs)
4509 gimple_statement_oacc_parallel *oacc_parallel_stmt =
4510 as_a <gimple_statement_oacc_parallel *> (gs);
4511 return &oacc_parallel_stmt->child_fn;
4514 /* Set CHILD_FN to be the child function for OACC_PARALLEL statement GS. */
4516 static inline void
4517 gimple_oacc_parallel_set_child_fn (gimple gs, tree child_fn)
4519 gimple_statement_oacc_parallel *oacc_parallel_stmt =
4520 as_a <gimple_statement_oacc_parallel *> (gs);
4521 oacc_parallel_stmt->child_fn = child_fn;
4524 /* Return the artificial argument used to send variables and values
4525 from the parent to the children threads in OACC_PARALLEL statement GS. */
4527 static inline tree
4528 gimple_oacc_parallel_data_arg (const_gimple gs)
4530 const gimple_statement_oacc_parallel *oacc_parallel_stmt =
4531 as_a <const gimple_statement_oacc_parallel *> (gs);
4532 return oacc_parallel_stmt->data_arg;
4535 /* Return a pointer to the data argument for OACC_PARALLEL statement GS. */
4537 static inline tree *
4538 gimple_oacc_parallel_data_arg_ptr (gimple gs)
4540 gimple_statement_oacc_parallel *oacc_parallel_stmt =
4541 as_a <gimple_statement_oacc_parallel *> (gs);
4542 return &oacc_parallel_stmt->data_arg;
4545 /* Set DATA_ARG to be the data argument for OACC_PARALLEL statement GS. */
4547 static inline void
4548 gimple_oacc_parallel_set_data_arg (gimple gs, tree data_arg)
4550 gimple_statement_oacc_parallel *oacc_parallel_stmt =
4551 as_a <gimple_statement_oacc_parallel *> (gs);
4552 oacc_parallel_stmt->data_arg = data_arg;
4556 /* Return the name associated with OMP_CRITICAL statement GS. */
4558 static inline tree
4559 gimple_omp_critical_name (const_gimple gs)
4561 const gimple_statement_omp_critical *omp_critical_stmt =
4562 as_a <const gimple_statement_omp_critical *> (gs);
4563 return omp_critical_stmt->name;
4567 /* Return a pointer to the name associated with OMP critical statement GS. */
4569 static inline tree *
4570 gimple_omp_critical_name_ptr (gimple gs)
4572 gimple_statement_omp_critical *omp_critical_stmt =
4573 as_a <gimple_statement_omp_critical *> (gs);
4574 return &omp_critical_stmt->name;
4578 /* Set NAME to be the name associated with OMP critical statement GS. */
4580 static inline void
4581 gimple_omp_critical_set_name (gimple gs, tree name)
4583 gimple_statement_omp_critical *omp_critical_stmt =
4584 as_a <gimple_statement_omp_critical *> (gs);
4585 omp_critical_stmt->name = name;
4589 /* Return the kind of the OMP_FOR statemement G. */
4591 static inline int
4592 gimple_omp_for_kind (const_gimple g)
4594 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4595 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4599 /* Set the kind of the OMP_FOR statement G. */
4601 static inline void
4602 gimple_omp_for_set_kind (gimple g, int kind)
4604 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4605 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4606 | (kind & GF_OMP_FOR_KIND_MASK);
4610 /* Return true if OMP_FOR statement G has the
4611 GF_OMP_FOR_COMBINED flag set. */
4613 static inline bool
4614 gimple_omp_for_combined_p (const_gimple g)
4616 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4617 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4621 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4622 the boolean value of COMBINED_P. */
4624 static inline void
4625 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4627 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4628 if (combined_p)
4629 g->subcode |= GF_OMP_FOR_COMBINED;
4630 else
4631 g->subcode &= ~GF_OMP_FOR_COMBINED;
4635 /* Return true if the OMP_FOR statement G has the
4636 GF_OMP_FOR_COMBINED_INTO flag set. */
4638 static inline bool
4639 gimple_omp_for_combined_into_p (const_gimple g)
4641 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4642 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4646 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4647 on the boolean value of COMBINED_P. */
4649 static inline void
4650 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4652 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4653 if (combined_p)
4654 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4655 else
4656 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4660 /* Return the clauses associated with the OMP_FOR statement GS. */
4662 static inline tree
4663 gimple_omp_for_clauses (const_gimple gs)
4665 const gimple_statement_omp_for *omp_for_stmt =
4666 as_a <const gimple_statement_omp_for *> (gs);
4667 return omp_for_stmt->clauses;
4671 /* Return a pointer to the clauses associated with the OMP_FOR statement
4672 GS. */
4674 static inline tree *
4675 gimple_omp_for_clauses_ptr (gimple gs)
4677 gimple_statement_omp_for *omp_for_stmt =
4678 as_a <gimple_statement_omp_for *> (gs);
4679 return &omp_for_stmt->clauses;
4683 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4684 GS. */
4686 static inline void
4687 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4689 gimple_statement_omp_for *omp_for_stmt =
4690 as_a <gimple_statement_omp_for *> (gs);
4691 omp_for_stmt->clauses = clauses;
4695 /* Get the collapse count of the OMP_FOR statement GS. */
4697 static inline size_t
4698 gimple_omp_for_collapse (gimple gs)
4700 gimple_statement_omp_for *omp_for_stmt =
4701 as_a <gimple_statement_omp_for *> (gs);
4702 return omp_for_stmt->collapse;
4706 /* Return the index variable for the OMP_FOR statement GS. */
4708 static inline tree
4709 gimple_omp_for_index (const_gimple gs, size_t i)
4711 const gimple_statement_omp_for *omp_for_stmt =
4712 as_a <const gimple_statement_omp_for *> (gs);
4713 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4714 return omp_for_stmt->iter[i].index;
4718 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4720 static inline tree *
4721 gimple_omp_for_index_ptr (gimple gs, size_t i)
4723 gimple_statement_omp_for *omp_for_stmt =
4724 as_a <gimple_statement_omp_for *> (gs);
4725 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4726 return &omp_for_stmt->iter[i].index;
4730 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4732 static inline void
4733 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4735 gimple_statement_omp_for *omp_for_stmt =
4736 as_a <gimple_statement_omp_for *> (gs);
4737 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4738 omp_for_stmt->iter[i].index = index;
4742 /* Return the initial value for the OMP_FOR statement GS. */
4744 static inline tree
4745 gimple_omp_for_initial (const_gimple gs, size_t i)
4747 const gimple_statement_omp_for *omp_for_stmt =
4748 as_a <const gimple_statement_omp_for *> (gs);
4749 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4750 return omp_for_stmt->iter[i].initial;
4754 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4756 static inline tree *
4757 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4759 gimple_statement_omp_for *omp_for_stmt =
4760 as_a <gimple_statement_omp_for *> (gs);
4761 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4762 return &omp_for_stmt->iter[i].initial;
4766 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4768 static inline void
4769 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4771 gimple_statement_omp_for *omp_for_stmt =
4772 as_a <gimple_statement_omp_for *> (gs);
4773 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4774 omp_for_stmt->iter[i].initial = initial;
4778 /* Return the final value for the OMP_FOR statement GS. */
4780 static inline tree
4781 gimple_omp_for_final (const_gimple gs, size_t i)
4783 const gimple_statement_omp_for *omp_for_stmt =
4784 as_a <const gimple_statement_omp_for *> (gs);
4785 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4786 return omp_for_stmt->iter[i].final;
4790 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4792 static inline tree *
4793 gimple_omp_for_final_ptr (gimple gs, size_t i)
4795 gimple_statement_omp_for *omp_for_stmt =
4796 as_a <gimple_statement_omp_for *> (gs);
4797 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4798 return &omp_for_stmt->iter[i].final;
4802 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
4804 static inline void
4805 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4807 gimple_statement_omp_for *omp_for_stmt =
4808 as_a <gimple_statement_omp_for *> (gs);
4809 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4810 omp_for_stmt->iter[i].final = final;
4814 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4816 static inline void
4817 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4819 gimple_statement_omp_for *omp_for_stmt =
4820 as_a <gimple_statement_omp_for *> (gs);
4821 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4822 && i < omp_for_stmt->collapse);
4823 omp_for_stmt->iter[i].cond = cond;
4827 /* Return the condition code associated with the OMP_FOR statement GS. */
4829 static inline enum tree_code
4830 gimple_omp_for_cond (const_gimple gs, size_t i)
4832 const gimple_statement_omp_for *omp_for_stmt =
4833 as_a <const gimple_statement_omp_for *> (gs);
4834 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4835 return omp_for_stmt->iter[i].cond;
4839 /* Return the increment value for the OMP_FOR statement GS. */
4841 static inline tree
4842 gimple_omp_for_incr (const_gimple gs, size_t i)
4844 const gimple_statement_omp_for *omp_for_stmt =
4845 as_a <const gimple_statement_omp_for *> (gs);
4846 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4847 return omp_for_stmt->iter[i].incr;
4851 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
4853 static inline tree *
4854 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4856 gimple_statement_omp_for *omp_for_stmt =
4857 as_a <gimple_statement_omp_for *> (gs);
4858 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4859 return &omp_for_stmt->iter[i].incr;
4863 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
4865 static inline void
4866 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4868 gimple_statement_omp_for *omp_for_stmt =
4869 as_a <gimple_statement_omp_for *> (gs);
4870 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4871 omp_for_stmt->iter[i].incr = incr;
4875 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4876 statement GS starts. */
4878 static inline gimple_seq *
4879 gimple_omp_for_pre_body_ptr (gimple gs)
4881 gimple_statement_omp_for *omp_for_stmt =
4882 as_a <gimple_statement_omp_for *> (gs);
4883 return &omp_for_stmt->pre_body;
4887 /* Return the sequence of statements to execute before the OMP_FOR
4888 statement GS starts. */
4890 static inline gimple_seq
4891 gimple_omp_for_pre_body (gimple gs)
4893 return *gimple_omp_for_pre_body_ptr (gs);
4897 /* Set PRE_BODY to be the sequence of statements to execute before the
4898 OMP_FOR statement GS starts. */
4900 static inline void
4901 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4903 gimple_statement_omp_for *omp_for_stmt =
4904 as_a <gimple_statement_omp_for *> (gs);
4905 omp_for_stmt->pre_body = pre_body;
4909 /* Return the clauses associated with OMP_PARALLEL GS. */
4911 static inline tree
4912 gimple_omp_parallel_clauses (const_gimple gs)
4914 const gimple_statement_omp_parallel *omp_parallel_stmt =
4915 as_a <const gimple_statement_omp_parallel *> (gs);
4916 return omp_parallel_stmt->clauses;
4920 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4922 static inline tree *
4923 gimple_omp_parallel_clauses_ptr (gimple gs)
4925 gimple_statement_omp_parallel *omp_parallel_stmt =
4926 as_a <gimple_statement_omp_parallel *> (gs);
4927 return &omp_parallel_stmt->clauses;
4931 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4932 GS. */
4934 static inline void
4935 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4937 gimple_statement_omp_parallel *omp_parallel_stmt =
4938 as_a <gimple_statement_omp_parallel *> (gs);
4939 omp_parallel_stmt->clauses = clauses;
4943 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4945 static inline tree
4946 gimple_omp_parallel_child_fn (const_gimple gs)
4948 const gimple_statement_omp_parallel *omp_parallel_stmt =
4949 as_a <const gimple_statement_omp_parallel *> (gs);
4950 return omp_parallel_stmt->child_fn;
4953 /* Return a pointer to the child function used to hold the body of
4954 OMP_PARALLEL GS. */
4956 static inline tree *
4957 gimple_omp_parallel_child_fn_ptr (gimple gs)
4959 gimple_statement_omp_parallel *omp_parallel_stmt =
4960 as_a <gimple_statement_omp_parallel *> (gs);
4961 return &omp_parallel_stmt->child_fn;
4965 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4967 static inline void
4968 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4970 gimple_statement_omp_parallel *omp_parallel_stmt =
4971 as_a <gimple_statement_omp_parallel *> (gs);
4972 omp_parallel_stmt->child_fn = child_fn;
4976 /* Return the artificial argument used to send variables and values
4977 from the parent to the children threads in OMP_PARALLEL GS. */
4979 static inline tree
4980 gimple_omp_parallel_data_arg (const_gimple gs)
4982 const gimple_statement_omp_parallel *omp_parallel_stmt =
4983 as_a <const gimple_statement_omp_parallel *> (gs);
4984 return omp_parallel_stmt->data_arg;
4988 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4990 static inline tree *
4991 gimple_omp_parallel_data_arg_ptr (gimple gs)
4993 gimple_statement_omp_parallel *omp_parallel_stmt =
4994 as_a <gimple_statement_omp_parallel *> (gs);
4995 return &omp_parallel_stmt->data_arg;
4999 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
5001 static inline void
5002 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
5004 gimple_statement_omp_parallel *omp_parallel_stmt =
5005 as_a <gimple_statement_omp_parallel *> (gs);
5006 omp_parallel_stmt->data_arg = data_arg;
5010 /* Return the clauses associated with OMP_TASK GS. */
5012 static inline tree
5013 gimple_omp_task_clauses (const_gimple gs)
5015 const gimple_statement_omp_task *omp_task_stmt =
5016 as_a <const gimple_statement_omp_task *> (gs);
5017 return omp_task_stmt->clauses;
5021 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5023 static inline tree *
5024 gimple_omp_task_clauses_ptr (gimple gs)
5026 gimple_statement_omp_task *omp_task_stmt =
5027 as_a <gimple_statement_omp_task *> (gs);
5028 return &omp_task_stmt->clauses;
5032 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5033 GS. */
5035 static inline void
5036 gimple_omp_task_set_clauses (gimple gs, tree clauses)
5038 gimple_statement_omp_task *omp_task_stmt =
5039 as_a <gimple_statement_omp_task *> (gs);
5040 omp_task_stmt->clauses = clauses;
5044 /* Return the child function used to hold the body of OMP_TASK GS. */
5046 static inline tree
5047 gimple_omp_task_child_fn (const_gimple gs)
5049 const gimple_statement_omp_task *omp_task_stmt =
5050 as_a <const gimple_statement_omp_task *> (gs);
5051 return omp_task_stmt->child_fn;
5054 /* Return a pointer to the child function used to hold the body of
5055 OMP_TASK GS. */
5057 static inline tree *
5058 gimple_omp_task_child_fn_ptr (gimple gs)
5060 gimple_statement_omp_task *omp_task_stmt =
5061 as_a <gimple_statement_omp_task *> (gs);
5062 return &omp_task_stmt->child_fn;
5066 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5068 static inline void
5069 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
5071 gimple_statement_omp_task *omp_task_stmt =
5072 as_a <gimple_statement_omp_task *> (gs);
5073 omp_task_stmt->child_fn = child_fn;
5077 /* Return the artificial argument used to send variables and values
5078 from the parent to the children threads in OMP_TASK GS. */
5080 static inline tree
5081 gimple_omp_task_data_arg (const_gimple gs)
5083 const gimple_statement_omp_task *omp_task_stmt =
5084 as_a <const gimple_statement_omp_task *> (gs);
5085 return omp_task_stmt->data_arg;
5089 /* Return a pointer to the data argument for OMP_TASK GS. */
5091 static inline tree *
5092 gimple_omp_task_data_arg_ptr (gimple gs)
5094 gimple_statement_omp_task *omp_task_stmt =
5095 as_a <gimple_statement_omp_task *> (gs);
5096 return &omp_task_stmt->data_arg;
5100 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5102 static inline void
5103 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
5105 gimple_statement_omp_task *omp_task_stmt =
5106 as_a <gimple_statement_omp_task *> (gs);
5107 omp_task_stmt->data_arg = data_arg;
5111 /* Return the clauses associated with OMP_TASK GS. */
5113 static inline tree
5114 gimple_omp_taskreg_clauses (const_gimple gs)
5116 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
5117 as_a <const gimple_statement_omp_taskreg *> (gs);
5118 return omp_taskreg_stmt->clauses;
5122 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5124 static inline tree *
5125 gimple_omp_taskreg_clauses_ptr (gimple gs)
5127 gimple_statement_omp_taskreg *omp_taskreg_stmt =
5128 as_a <gimple_statement_omp_taskreg *> (gs);
5129 return &omp_taskreg_stmt->clauses;
5133 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5134 GS. */
5136 static inline void
5137 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
5139 gimple_statement_omp_taskreg *omp_taskreg_stmt =
5140 as_a <gimple_statement_omp_taskreg *> (gs);
5141 omp_taskreg_stmt->clauses = clauses;
5145 /* Return the child function used to hold the body of OMP_TASK GS. */
5147 static inline tree
5148 gimple_omp_taskreg_child_fn (const_gimple gs)
5150 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
5151 as_a <const gimple_statement_omp_taskreg *> (gs);
5152 return omp_taskreg_stmt->child_fn;
5155 /* Return a pointer to the child function used to hold the body of
5156 OMP_TASK GS. */
5158 static inline tree *
5159 gimple_omp_taskreg_child_fn_ptr (gimple gs)
5161 gimple_statement_omp_taskreg *omp_taskreg_stmt =
5162 as_a <gimple_statement_omp_taskreg *> (gs);
5163 return &omp_taskreg_stmt->child_fn;
5167 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5169 static inline void
5170 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
5172 gimple_statement_omp_taskreg *omp_taskreg_stmt =
5173 as_a <gimple_statement_omp_taskreg *> (gs);
5174 omp_taskreg_stmt->child_fn = child_fn;
5178 /* Return the artificial argument used to send variables and values
5179 from the parent to the children threads in OMP_TASK GS. */
5181 static inline tree
5182 gimple_omp_taskreg_data_arg (const_gimple gs)
5184 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
5185 as_a <const gimple_statement_omp_taskreg *> (gs);
5186 return omp_taskreg_stmt->data_arg;
5190 /* Return a pointer to the data argument for OMP_TASK GS. */
5192 static inline tree *
5193 gimple_omp_taskreg_data_arg_ptr (gimple gs)
5195 gimple_statement_omp_taskreg *omp_taskreg_stmt =
5196 as_a <gimple_statement_omp_taskreg *> (gs);
5197 return &omp_taskreg_stmt->data_arg;
5201 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5203 static inline void
5204 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
5206 gimple_statement_omp_taskreg *omp_taskreg_stmt =
5207 as_a <gimple_statement_omp_taskreg *> (gs);
5208 omp_taskreg_stmt->data_arg = data_arg;
5212 /* Return the copy function used to hold the body of OMP_TASK GS. */
5214 static inline tree
5215 gimple_omp_task_copy_fn (const_gimple gs)
5217 const gimple_statement_omp_task *omp_task_stmt =
5218 as_a <const gimple_statement_omp_task *> (gs);
5219 return omp_task_stmt->copy_fn;
5222 /* Return a pointer to the copy function used to hold the body of
5223 OMP_TASK GS. */
5225 static inline tree *
5226 gimple_omp_task_copy_fn_ptr (gimple gs)
5228 gimple_statement_omp_task *omp_task_stmt =
5229 as_a <gimple_statement_omp_task *> (gs);
5230 return &omp_task_stmt->copy_fn;
5234 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5236 static inline void
5237 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
5239 gimple_statement_omp_task *omp_task_stmt =
5240 as_a <gimple_statement_omp_task *> (gs);
5241 omp_task_stmt->copy_fn = copy_fn;
5245 /* Return size of the data block in bytes in OMP_TASK GS. */
5247 static inline tree
5248 gimple_omp_task_arg_size (const_gimple gs)
5250 const gimple_statement_omp_task *omp_task_stmt =
5251 as_a <const gimple_statement_omp_task *> (gs);
5252 return omp_task_stmt->arg_size;
5256 /* Return a pointer to the data block size for OMP_TASK GS. */
5258 static inline tree *
5259 gimple_omp_task_arg_size_ptr (gimple gs)
5261 gimple_statement_omp_task *omp_task_stmt =
5262 as_a <gimple_statement_omp_task *> (gs);
5263 return &omp_task_stmt->arg_size;
5267 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5269 static inline void
5270 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
5272 gimple_statement_omp_task *omp_task_stmt =
5273 as_a <gimple_statement_omp_task *> (gs);
5274 omp_task_stmt->arg_size = arg_size;
5278 /* Return align of the data block in bytes in OMP_TASK GS. */
5280 static inline tree
5281 gimple_omp_task_arg_align (const_gimple gs)
5283 const gimple_statement_omp_task *omp_task_stmt =
5284 as_a <const gimple_statement_omp_task *> (gs);
5285 return omp_task_stmt->arg_align;
5289 /* Return a pointer to the data block align for OMP_TASK GS. */
5291 static inline tree *
5292 gimple_omp_task_arg_align_ptr (gimple gs)
5294 gimple_statement_omp_task *omp_task_stmt =
5295 as_a <gimple_statement_omp_task *> (gs);
5296 return &omp_task_stmt->arg_align;
5300 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5302 static inline void
5303 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5305 gimple_statement_omp_task *omp_task_stmt =
5306 as_a <gimple_statement_omp_task *> (gs);
5307 omp_task_stmt->arg_align = arg_align;
5311 /* Return the clauses associated with OMP_SINGLE GS. */
5313 static inline tree
5314 gimple_omp_single_clauses (const_gimple gs)
5316 const gimple_statement_omp_single *omp_single_stmt =
5317 as_a <const gimple_statement_omp_single *> (gs);
5318 return omp_single_stmt->clauses;
5322 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5324 static inline tree *
5325 gimple_omp_single_clauses_ptr (gimple gs)
5327 gimple_statement_omp_single *omp_single_stmt =
5328 as_a <gimple_statement_omp_single *> (gs);
5329 return &omp_single_stmt->clauses;
5333 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5335 static inline void
5336 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5338 gimple_statement_omp_single *omp_single_stmt =
5339 as_a <gimple_statement_omp_single *> (gs);
5340 omp_single_stmt->clauses = clauses;
5344 /* Return the clauses associated with OMP_TARGET GS. */
5346 static inline tree
5347 gimple_omp_target_clauses (const_gimple gs)
5349 const gimple_statement_omp_target *omp_target_stmt =
5350 as_a <const gimple_statement_omp_target *> (gs);
5351 return omp_target_stmt->clauses;
5355 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5357 static inline tree *
5358 gimple_omp_target_clauses_ptr (gimple gs)
5360 gimple_statement_omp_target *omp_target_stmt =
5361 as_a <gimple_statement_omp_target *> (gs);
5362 return &omp_target_stmt->clauses;
5366 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5368 static inline void
5369 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5371 gimple_statement_omp_target *omp_target_stmt =
5372 as_a <gimple_statement_omp_target *> (gs);
5373 omp_target_stmt->clauses = clauses;
5377 /* Return the kind of OMP target statemement. */
5379 static inline int
5380 gimple_omp_target_kind (const_gimple g)
5382 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5383 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5387 /* Set the OMP target kind. */
5389 static inline void
5390 gimple_omp_target_set_kind (gimple g, int kind)
5392 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5393 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5394 | (kind & GF_OMP_TARGET_KIND_MASK);
5398 /* Return the child function used to hold the body of OMP_TARGET GS. */
5400 static inline tree
5401 gimple_omp_target_child_fn (const_gimple gs)
5403 const gimple_statement_omp_target *omp_target_stmt =
5404 as_a <const gimple_statement_omp_target *> (gs);
5405 return omp_target_stmt->child_fn;
5408 /* Return a pointer to the child function used to hold the body of
5409 OMP_TARGET GS. */
5411 static inline tree *
5412 gimple_omp_target_child_fn_ptr (gimple gs)
5414 gimple_statement_omp_target *omp_target_stmt =
5415 as_a <gimple_statement_omp_target *> (gs);
5416 return &omp_target_stmt->child_fn;
5420 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5422 static inline void
5423 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5425 gimple_statement_omp_target *omp_target_stmt =
5426 as_a <gimple_statement_omp_target *> (gs);
5427 omp_target_stmt->child_fn = child_fn;
5431 /* Return the artificial argument used to send variables and values
5432 from the parent to the children threads in OMP_TARGET GS. */
5434 static inline tree
5435 gimple_omp_target_data_arg (const_gimple gs)
5437 const gimple_statement_omp_target *omp_target_stmt =
5438 as_a <const gimple_statement_omp_target *> (gs);
5439 return omp_target_stmt->data_arg;
5443 /* Return a pointer to the data argument for OMP_TARGET GS. */
5445 static inline tree *
5446 gimple_omp_target_data_arg_ptr (gimple gs)
5448 gimple_statement_omp_target *omp_target_stmt =
5449 as_a <gimple_statement_omp_target *> (gs);
5450 return &omp_target_stmt->data_arg;
5454 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5456 static inline void
5457 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5459 gimple_statement_omp_target *omp_target_stmt =
5460 as_a <gimple_statement_omp_target *> (gs);
5461 omp_target_stmt->data_arg = data_arg;
5465 /* Return the clauses associated with OMP_TEAMS GS. */
5467 static inline tree
5468 gimple_omp_teams_clauses (const_gimple gs)
5470 const gimple_statement_omp_teams *omp_teams_stmt =
5471 as_a <const gimple_statement_omp_teams *> (gs);
5472 return omp_teams_stmt->clauses;
5476 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5478 static inline tree *
5479 gimple_omp_teams_clauses_ptr (gimple gs)
5481 gimple_statement_omp_teams *omp_teams_stmt =
5482 as_a <gimple_statement_omp_teams *> (gs);
5483 return &omp_teams_stmt->clauses;
5487 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5489 static inline void
5490 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5492 gimple_statement_omp_teams *omp_teams_stmt =
5493 as_a <gimple_statement_omp_teams *> (gs);
5494 omp_teams_stmt->clauses = clauses;
5498 /* Return the clauses associated with OMP_SECTIONS GS. */
5500 static inline tree
5501 gimple_omp_sections_clauses (const_gimple gs)
5503 const gimple_statement_omp_sections *omp_sections_stmt =
5504 as_a <const gimple_statement_omp_sections *> (gs);
5505 return omp_sections_stmt->clauses;
5509 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5511 static inline tree *
5512 gimple_omp_sections_clauses_ptr (gimple gs)
5514 gimple_statement_omp_sections *omp_sections_stmt =
5515 as_a <gimple_statement_omp_sections *> (gs);
5516 return &omp_sections_stmt->clauses;
5520 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5521 GS. */
5523 static inline void
5524 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5526 gimple_statement_omp_sections *omp_sections_stmt =
5527 as_a <gimple_statement_omp_sections *> (gs);
5528 omp_sections_stmt->clauses = clauses;
5532 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5533 in GS. */
5535 static inline tree
5536 gimple_omp_sections_control (const_gimple gs)
5538 const gimple_statement_omp_sections *omp_sections_stmt =
5539 as_a <const gimple_statement_omp_sections *> (gs);
5540 return omp_sections_stmt->control;
5544 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5545 GS. */
5547 static inline tree *
5548 gimple_omp_sections_control_ptr (gimple gs)
5550 gimple_statement_omp_sections *omp_sections_stmt =
5551 as_a <gimple_statement_omp_sections *> (gs);
5552 return &omp_sections_stmt->control;
5556 /* Set CONTROL to be the set of clauses associated with the
5557 GIMPLE_OMP_SECTIONS in GS. */
5559 static inline void
5560 gimple_omp_sections_set_control (gimple gs, tree control)
5562 gimple_statement_omp_sections *omp_sections_stmt =
5563 as_a <gimple_statement_omp_sections *> (gs);
5564 omp_sections_stmt->control = control;
5568 /* Set the value being stored in an atomic store. */
5570 static inline void
5571 gimple_omp_atomic_store_set_val (gimple g, tree val)
5573 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5574 as_a <gimple_statement_omp_atomic_store *> (g);
5575 omp_atomic_store_stmt->val = val;
5579 /* Return the value being stored in an atomic store. */
5581 static inline tree
5582 gimple_omp_atomic_store_val (const_gimple g)
5584 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5585 as_a <const gimple_statement_omp_atomic_store *> (g);
5586 return omp_atomic_store_stmt->val;
5590 /* Return a pointer to the value being stored in an atomic store. */
5592 static inline tree *
5593 gimple_omp_atomic_store_val_ptr (gimple g)
5595 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5596 as_a <gimple_statement_omp_atomic_store *> (g);
5597 return &omp_atomic_store_stmt->val;
5601 /* Set the LHS of an atomic load. */
5603 static inline void
5604 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5606 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5607 as_a <gimple_statement_omp_atomic_load *> (g);
5608 omp_atomic_load_stmt->lhs = lhs;
5612 /* Get the LHS of an atomic load. */
5614 static inline tree
5615 gimple_omp_atomic_load_lhs (const_gimple g)
5617 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5618 as_a <const gimple_statement_omp_atomic_load *> (g);
5619 return omp_atomic_load_stmt->lhs;
5623 /* Return a pointer to the LHS of an atomic load. */
5625 static inline tree *
5626 gimple_omp_atomic_load_lhs_ptr (gimple g)
5628 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5629 as_a <gimple_statement_omp_atomic_load *> (g);
5630 return &omp_atomic_load_stmt->lhs;
5634 /* Set the RHS of an atomic load. */
5636 static inline void
5637 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5639 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5640 as_a <gimple_statement_omp_atomic_load *> (g);
5641 omp_atomic_load_stmt->rhs = rhs;
5645 /* Get the RHS of an atomic load. */
5647 static inline tree
5648 gimple_omp_atomic_load_rhs (const_gimple g)
5650 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5651 as_a <const gimple_statement_omp_atomic_load *> (g);
5652 return omp_atomic_load_stmt->rhs;
5656 /* Return a pointer to the RHS of an atomic load. */
5658 static inline tree *
5659 gimple_omp_atomic_load_rhs_ptr (gimple g)
5661 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5662 as_a <gimple_statement_omp_atomic_load *> (g);
5663 return &omp_atomic_load_stmt->rhs;
5667 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5669 static inline tree
5670 gimple_omp_continue_control_def (const_gimple g)
5672 const gimple_statement_omp_continue *omp_continue_stmt =
5673 as_a <const gimple_statement_omp_continue *> (g);
5674 return omp_continue_stmt->control_def;
5677 /* The same as above, but return the address. */
5679 static inline tree *
5680 gimple_omp_continue_control_def_ptr (gimple g)
5682 gimple_statement_omp_continue *omp_continue_stmt =
5683 as_a <gimple_statement_omp_continue *> (g);
5684 return &omp_continue_stmt->control_def;
5687 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5689 static inline void
5690 gimple_omp_continue_set_control_def (gimple g, tree def)
5692 gimple_statement_omp_continue *omp_continue_stmt =
5693 as_a <gimple_statement_omp_continue *> (g);
5694 omp_continue_stmt->control_def = def;
5698 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5700 static inline tree
5701 gimple_omp_continue_control_use (const_gimple g)
5703 const gimple_statement_omp_continue *omp_continue_stmt =
5704 as_a <const gimple_statement_omp_continue *> (g);
5705 return omp_continue_stmt->control_use;
5709 /* The same as above, but return the address. */
5711 static inline tree *
5712 gimple_omp_continue_control_use_ptr (gimple g)
5714 gimple_statement_omp_continue *omp_continue_stmt =
5715 as_a <gimple_statement_omp_continue *> (g);
5716 return &omp_continue_stmt->control_use;
5720 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5722 static inline void
5723 gimple_omp_continue_set_control_use (gimple g, tree use)
5725 gimple_statement_omp_continue *omp_continue_stmt =
5726 as_a <gimple_statement_omp_continue *> (g);
5727 omp_continue_stmt->control_use = use;
5730 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5732 static inline gimple_seq *
5733 gimple_transaction_body_ptr (gimple gs)
5735 gimple_statement_transaction *transaction_stmt =
5736 as_a <gimple_statement_transaction *> (gs);
5737 return &transaction_stmt->body;
5740 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5742 static inline gimple_seq
5743 gimple_transaction_body (gimple gs)
5745 return *gimple_transaction_body_ptr (gs);
5748 /* Return the label associated with a GIMPLE_TRANSACTION. */
5750 static inline tree
5751 gimple_transaction_label (const_gimple gs)
5753 const gimple_statement_transaction *transaction_stmt =
5754 as_a <const gimple_statement_transaction *> (gs);
5755 return transaction_stmt->label;
5758 static inline tree *
5759 gimple_transaction_label_ptr (gimple gs)
5761 gimple_statement_transaction *transaction_stmt =
5762 as_a <gimple_statement_transaction *> (gs);
5763 return &transaction_stmt->label;
5766 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5768 static inline unsigned int
5769 gimple_transaction_subcode (const_gimple gs)
5771 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5772 return gs->subcode;
5775 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5777 static inline void
5778 gimple_transaction_set_body (gimple gs, gimple_seq body)
5780 gimple_statement_transaction *transaction_stmt =
5781 as_a <gimple_statement_transaction *> (gs);
5782 transaction_stmt->body = body;
5785 /* Set the label associated with a GIMPLE_TRANSACTION. */
5787 static inline void
5788 gimple_transaction_set_label (gimple gs, tree label)
5790 gimple_statement_transaction *transaction_stmt =
5791 as_a <gimple_statement_transaction *> (gs);
5792 transaction_stmt->label = label;
5795 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5797 static inline void
5798 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5800 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5801 gs->subcode = subcode;
5805 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5807 static inline tree *
5808 gimple_return_retval_ptr (const_gimple gs)
5810 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5811 return gimple_op_ptr (gs, 0);
5814 /* Return the return value for GIMPLE_RETURN GS. */
5816 static inline tree
5817 gimple_return_retval (const_gimple gs)
5819 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5820 return gimple_op (gs, 0);
5824 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5826 static inline void
5827 gimple_return_set_retval (gimple gs, tree retval)
5829 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5830 gimple_set_op (gs, 0, retval);
5834 /* Return the return bounds for GIMPLE_RETURN GS. */
5836 static inline tree
5837 gimple_return_retbnd (const_gimple gs)
5839 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5840 return gimple_op (gs, 1);
5844 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5846 static inline void
5847 gimple_return_set_retbnd (gimple gs, tree retval)
5849 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5850 gimple_set_op (gs, 1, retval);
5854 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5856 #define CASE_GIMPLE_OMP \
5857 case GIMPLE_OACC_KERNELS: \
5858 case GIMPLE_OACC_PARALLEL: \
5859 case GIMPLE_OMP_PARALLEL: \
5860 case GIMPLE_OMP_TASK: \
5861 case GIMPLE_OMP_FOR: \
5862 case GIMPLE_OMP_SECTIONS: \
5863 case GIMPLE_OMP_SECTIONS_SWITCH: \
5864 case GIMPLE_OMP_SINGLE: \
5865 case GIMPLE_OMP_TARGET: \
5866 case GIMPLE_OMP_TEAMS: \
5867 case GIMPLE_OMP_SECTION: \
5868 case GIMPLE_OMP_MASTER: \
5869 case GIMPLE_OMP_TASKGROUP: \
5870 case GIMPLE_OMP_ORDERED: \
5871 case GIMPLE_OMP_CRITICAL: \
5872 case GIMPLE_OMP_RETURN: \
5873 case GIMPLE_OMP_ATOMIC_LOAD: \
5874 case GIMPLE_OMP_ATOMIC_STORE: \
5875 case GIMPLE_OMP_CONTINUE
5877 static inline bool
5878 is_gimple_omp (const_gimple stmt)
5880 switch (gimple_code (stmt))
5882 CASE_GIMPLE_OMP:
5883 return true;
5884 default:
5885 return false;
5889 /* Return true if STMT is any of the OpenACC types specifically.
5891 TODO: This function should go away eventually, once all its callers have
5892 either been fixed, changed into more specific checks, or verified to not
5893 need any special handling for OpenACC. */
5895 static inline bool
5896 is_gimple_omp_oacc_specifically (const_gimple stmt)
5898 gcc_assert (is_gimple_omp (stmt));
5899 switch (gimple_code (stmt))
5901 case GIMPLE_OACC_KERNELS:
5902 case GIMPLE_OACC_PARALLEL:
5903 return true;
5904 case GIMPLE_OMP_FOR:
5905 switch (gimple_omp_for_kind (stmt))
5907 case GF_OMP_FOR_KIND_OACC_LOOP:
5908 return true;
5909 default:
5910 return false;
5912 case GIMPLE_OMP_TARGET:
5913 switch (gimple_omp_target_kind (stmt))
5915 case GF_OMP_TARGET_KIND_OACC_DATA:
5916 case GF_OMP_TARGET_KIND_OACC_UPDATE:
5917 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
5918 return true;
5919 default:
5920 return false;
5922 default:
5923 return false;
5928 /* Return true if OMP_* STMT is offloaded. */
5930 static inline bool
5931 is_gimple_omp_offloaded (const_gimple stmt)
5933 gcc_assert (is_gimple_omp (stmt));
5934 switch (gimple_code (stmt))
5936 case GIMPLE_OACC_KERNELS:
5937 case GIMPLE_OACC_PARALLEL:
5938 return true;
5939 case GIMPLE_OMP_TARGET:
5940 switch (gimple_omp_target_kind (stmt))
5942 case GF_OMP_TARGET_KIND_REGION:
5943 return true;
5944 default:
5945 return false;
5947 default:
5948 return false;
5953 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5955 static inline bool
5956 gimple_nop_p (const_gimple g)
5958 return gimple_code (g) == GIMPLE_NOP;
5962 /* Return true if GS is a GIMPLE_RESX. */
5964 static inline bool
5965 is_gimple_resx (const_gimple gs)
5967 return gimple_code (gs) == GIMPLE_RESX;
5970 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5972 static inline enum br_predictor
5973 gimple_predict_predictor (gimple gs)
5975 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5976 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5980 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5982 static inline void
5983 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5985 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5986 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5987 | (unsigned) predictor;
5991 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5993 static inline enum prediction
5994 gimple_predict_outcome (gimple gs)
5996 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5997 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
6001 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
6003 static inline void
6004 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
6006 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
6007 if (outcome == TAKEN)
6008 gs->subcode |= GF_PREDICT_TAKEN;
6009 else
6010 gs->subcode &= ~GF_PREDICT_TAKEN;
6014 /* Return the type of the main expression computed by STMT. Return
6015 void_type_node if the statement computes nothing. */
6017 static inline tree
6018 gimple_expr_type (const_gimple stmt)
6020 enum gimple_code code = gimple_code (stmt);
6022 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
6024 tree type;
6025 /* In general we want to pass out a type that can be substituted
6026 for both the RHS and the LHS types if there is a possibly
6027 useless conversion involved. That means returning the
6028 original RHS type as far as we can reconstruct it. */
6029 if (code == GIMPLE_CALL)
6031 if (gimple_call_internal_p (stmt)
6032 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
6033 type = TREE_TYPE (gimple_call_arg (stmt, 3));
6034 else
6035 type = gimple_call_return_type (stmt);
6037 else
6038 switch (gimple_assign_rhs_code (stmt))
6040 case POINTER_PLUS_EXPR:
6041 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
6042 break;
6044 default:
6045 /* As fallback use the type of the LHS. */
6046 type = TREE_TYPE (gimple_get_lhs (stmt));
6047 break;
6049 return type;
6051 else if (code == GIMPLE_COND)
6052 return boolean_type_node;
6053 else
6054 return void_type_node;
6057 /* Enum and arrays used for allocation stats. Keep in sync with
6058 gimple.c:gimple_alloc_kind_names. */
6059 enum gimple_alloc_kind
6061 gimple_alloc_kind_assign, /* Assignments. */
6062 gimple_alloc_kind_phi, /* PHI nodes. */
6063 gimple_alloc_kind_cond, /* Conditionals. */
6064 gimple_alloc_kind_rest, /* Everything else. */
6065 gimple_alloc_kind_all
6068 extern int gimple_alloc_counts[];
6069 extern int gimple_alloc_sizes[];
6071 /* Return the allocation kind for a given stmt CODE. */
6072 static inline enum gimple_alloc_kind
6073 gimple_alloc_kind (enum gimple_code code)
6075 switch (code)
6077 case GIMPLE_ASSIGN:
6078 return gimple_alloc_kind_assign;
6079 case GIMPLE_PHI:
6080 return gimple_alloc_kind_phi;
6081 case GIMPLE_COND:
6082 return gimple_alloc_kind_cond;
6083 default:
6084 return gimple_alloc_kind_rest;
6088 /* Return true if a location should not be emitted for this statement
6089 by annotate_all_with_location. */
6091 static inline bool
6092 gimple_do_not_emit_location_p (gimple g)
6094 return gimple_plf (g, GF_PLF_1);
6097 /* Mark statement G so a location will not be emitted by
6098 annotate_one_with_location. */
6100 static inline void
6101 gimple_set_do_not_emit_location (gimple g)
6103 /* The PLF flags are initialized to 0 when a new tuple is created,
6104 so no need to initialize it anywhere. */
6105 gimple_set_plf (g, GF_PLF_1, true);
6109 /* Macros for showing usage statistics. */
6110 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6111 ? (x) \
6112 : ((x) < 1024*1024*10 \
6113 ? (x) / 1024 \
6114 : (x) / (1024*1024))))
6116 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6118 #endif /* GCC_GIMPLE_H */