Fix bootstrap/PR63632
[official-gcc.git] / gcc / gimple.h
blob7f1240f753826660342b9b6b09cd3dfa5ff98459
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_OMP_PARALLEL_COMBINED = 1 << 0,
95 GF_OMP_FOR_KIND_MASK = 7 << 0,
96 GF_OMP_FOR_KIND_FOR = 0,
97 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
98 GF_OMP_FOR_KIND_CILKFOR = 2,
99 /* Flag for SIMD variants of OMP_FOR kinds. */
100 GF_OMP_FOR_SIMD = 1 << 2,
101 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
102 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
103 GF_OMP_FOR_COMBINED = 1 << 3,
104 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
105 GF_OMP_TARGET_KIND_MASK = (1 << 2) - 1,
106 GF_OMP_TARGET_KIND_REGION = 0,
107 GF_OMP_TARGET_KIND_DATA = 1,
108 GF_OMP_TARGET_KIND_UPDATE = 2,
110 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
111 a thread synchronization via some sort of barrier. The exact barrier
112 that would otherwise be emitted is dependent on the OMP statement with
113 which this return is associated. */
114 GF_OMP_RETURN_NOWAIT = 1 << 0,
116 GF_OMP_SECTION_LAST = 1 << 0,
117 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
118 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
119 GF_PREDICT_TAKEN = 1 << 15
122 /* Currently, there are only two types of gimple debug stmt. Others are
123 envisioned, for example, to enable the generation of is_stmt notes
124 in line number information, to mark sequence points, etc. This
125 subcode is to be used to tell them apart. */
126 enum gimple_debug_subcode {
127 GIMPLE_DEBUG_BIND = 0,
128 GIMPLE_DEBUG_SOURCE_BIND = 1
131 /* Masks for selecting a pass local flag (PLF) to work on. These
132 masks are used by gimple_set_plf and gimple_plf. */
133 enum plf_mask {
134 GF_PLF_1 = 1 << 0,
135 GF_PLF_2 = 1 << 1
138 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
139 are for 64 bit hosts. */
141 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
142 chain_next ("%h.next"), variable_size))
143 gimple_statement_base
145 /* [ WORD 1 ]
146 Main identifying code for a tuple. */
147 ENUM_BITFIELD(gimple_code) code : 8;
149 /* Nonzero if a warning should not be emitted on this tuple. */
150 unsigned int no_warning : 1;
152 /* Nonzero if this tuple has been visited. Passes are responsible
153 for clearing this bit before using it. */
154 unsigned int visited : 1;
156 /* Nonzero if this tuple represents a non-temporal move. */
157 unsigned int nontemporal_move : 1;
159 /* Pass local flags. These flags are free for any pass to use as
160 they see fit. Passes should not assume that these flags contain
161 any useful value when the pass starts. Any initial state that
162 the pass requires should be set on entry to the pass. See
163 gimple_set_plf and gimple_plf for usage. */
164 unsigned int plf : 2;
166 /* Nonzero if this statement has been modified and needs to have its
167 operands rescanned. */
168 unsigned modified : 1;
170 /* Nonzero if this statement contains volatile operands. */
171 unsigned has_volatile_ops : 1;
173 /* Padding to get subcode to 16 bit alignment. */
174 unsigned pad : 1;
176 /* The SUBCODE field can be used for tuple-specific flags for tuples
177 that do not require subcodes. Note that SUBCODE should be at
178 least as wide as tree codes, as several tuples store tree codes
179 in there. */
180 unsigned int subcode : 16;
182 /* UID of this statement. This is used by passes that want to
183 assign IDs to statements. It must be assigned and used by each
184 pass. By default it should be assumed to contain garbage. */
185 unsigned uid;
187 /* [ WORD 2 ]
188 Locus information for debug info. */
189 location_t location;
191 /* Number of operands in this tuple. */
192 unsigned num_ops;
194 /* [ WORD 3 ]
195 Basic block holding this statement. */
196 basic_block bb;
198 /* [ WORD 4-5 ]
199 Linked lists of gimple statements. The next pointers form
200 a NULL terminated list, the prev pointers are a cyclic list.
201 A gimple statement is hence also a double-ended list of
202 statements, with the pointer itself being the first element,
203 and the prev pointer being the last. */
204 gimple next;
205 gimple GTY((skip)) prev;
209 /* Base structure for tuples with operands. */
211 /* This gimple subclass has no tag value. */
212 struct GTY(())
213 gimple_statement_with_ops_base : public gimple_statement_base
215 /* [ WORD 1-6 ] : base class */
217 /* [ WORD 7 ]
218 SSA operand vectors. NOTE: It should be possible to
219 amalgamate these vectors with the operand vector OP. However,
220 the SSA operand vectors are organized differently and contain
221 more information (like immediate use chaining). */
222 struct use_optype_d GTY((skip (""))) *use_ops;
226 /* Statements that take register operands. */
228 struct GTY((tag("GSS_WITH_OPS")))
229 gimple_statement_with_ops : public gimple_statement_with_ops_base
231 /* [ WORD 1-7 ] : base class */
233 /* [ WORD 8 ]
234 Operand vector. NOTE! This must always be the last field
235 of this structure. In particular, this means that this
236 structure cannot be embedded inside another one. */
237 tree GTY((length ("%h.num_ops"))) op[1];
241 /* Base for statements that take both memory and register operands. */
243 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
244 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
246 /* [ WORD 1-7 ] : base class */
248 /* [ WORD 8-9 ]
249 Virtual operands for this statement. The GC will pick them
250 up via the ssa_names array. */
251 tree GTY((skip (""))) vdef;
252 tree GTY((skip (""))) vuse;
256 /* Statements that take both memory and register operands. */
258 struct GTY((tag("GSS_WITH_MEM_OPS")))
259 gimple_statement_with_memory_ops :
260 public gimple_statement_with_memory_ops_base
262 /* [ WORD 1-9 ] : base class */
264 /* [ WORD 10 ]
265 Operand vector. NOTE! This must always be the last field
266 of this structure. In particular, this means that this
267 structure cannot be embedded inside another one. */
268 tree GTY((length ("%h.num_ops"))) op[1];
272 /* Call statements that take both memory and register operands. */
274 struct GTY((tag("GSS_CALL")))
275 gimple_statement_call : public gimple_statement_with_memory_ops_base
277 /* [ WORD 1-9 ] : base class */
279 /* [ WORD 10-13 ] */
280 struct pt_solution call_used;
281 struct pt_solution call_clobbered;
283 /* [ WORD 14 ] */
284 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
285 tree GTY ((tag ("0"))) fntype;
286 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
287 } u;
289 /* [ WORD 15 ]
290 Operand vector. NOTE! This must always be the last field
291 of this structure. In particular, this means that this
292 structure cannot be embedded inside another one. */
293 tree GTY((length ("%h.num_ops"))) op[1];
297 /* OpenMP statements (#pragma omp). */
299 struct GTY((tag("GSS_OMP")))
300 gimple_statement_omp : public gimple_statement_base
302 /* [ WORD 1-6 ] : base class */
304 /* [ WORD 7 ] */
305 gimple_seq body;
309 /* GIMPLE_BIND */
311 struct GTY((tag("GSS_BIND")))
312 gimple_statement_bind : public gimple_statement_base
314 /* [ WORD 1-6 ] : base class */
316 /* [ WORD 7 ]
317 Variables declared in this scope. */
318 tree vars;
320 /* [ WORD 8 ]
321 This is different than the BLOCK field in gimple_statement_base,
322 which is analogous to TREE_BLOCK (i.e., the lexical block holding
323 this statement). This field is the equivalent of BIND_EXPR_BLOCK
324 in tree land (i.e., the lexical scope defined by this bind). See
325 gimple-low.c. */
326 tree block;
328 /* [ WORD 9 ] */
329 gimple_seq body;
333 /* GIMPLE_CATCH */
335 struct GTY((tag("GSS_CATCH")))
336 gimple_statement_catch : public gimple_statement_base
338 /* [ WORD 1-6 ] : base class */
340 /* [ WORD 7 ] */
341 tree types;
343 /* [ WORD 8 ] */
344 gimple_seq handler;
348 /* GIMPLE_EH_FILTER */
350 struct GTY((tag("GSS_EH_FILTER")))
351 gimple_statement_eh_filter : public gimple_statement_base
353 /* [ WORD 1-6 ] : base class */
355 /* [ WORD 7 ]
356 Filter types. */
357 tree types;
359 /* [ WORD 8 ]
360 Failure actions. */
361 gimple_seq failure;
364 /* GIMPLE_EH_ELSE */
366 struct GTY((tag("GSS_EH_ELSE")))
367 gimple_statement_eh_else : public gimple_statement_base
369 /* [ WORD 1-6 ] : base class */
371 /* [ WORD 7,8 ] */
372 gimple_seq n_body, e_body;
375 /* GIMPLE_EH_MUST_NOT_THROW */
377 struct GTY((tag("GSS_EH_MNT")))
378 gimple_statement_eh_mnt : public gimple_statement_base
380 /* [ WORD 1-6 ] : base class */
382 /* [ WORD 7 ] Abort function decl. */
383 tree fndecl;
386 /* GIMPLE_PHI */
388 struct GTY((tag("GSS_PHI")))
389 gimple_statement_phi : public gimple_statement_base
391 /* [ WORD 1-6 ] : base class */
393 /* [ WORD 7 ] */
394 unsigned capacity;
395 unsigned nargs;
397 /* [ WORD 8 ] */
398 tree result;
400 /* [ WORD 9 ] */
401 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
405 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
407 struct GTY((tag("GSS_EH_CTRL")))
408 gimple_statement_eh_ctrl : public gimple_statement_base
410 /* [ WORD 1-6 ] : base class */
412 /* [ WORD 7 ]
413 Exception region number. */
414 int region;
417 struct GTY((tag("GSS_EH_CTRL")))
418 gimple_statement_resx : public gimple_statement_eh_ctrl
420 /* No extra fields; adds invariant:
421 stmt->code == GIMPLE_RESX. */
424 struct GTY((tag("GSS_EH_CTRL")))
425 gimple_statement_eh_dispatch : public gimple_statement_eh_ctrl
427 /* No extra fields; adds invariant:
428 stmt->code == GIMPLE_EH_DISPATH. */
432 /* GIMPLE_TRY */
434 struct GTY((tag("GSS_TRY")))
435 gimple_statement_try : public gimple_statement_base
437 /* [ WORD 1-6 ] : base class */
439 /* [ WORD 7 ]
440 Expression to evaluate. */
441 gimple_seq eval;
443 /* [ WORD 8 ]
444 Cleanup expression. */
445 gimple_seq cleanup;
448 /* Kind of GIMPLE_TRY statements. */
449 enum gimple_try_flags
451 /* A try/catch. */
452 GIMPLE_TRY_CATCH = 1 << 0,
454 /* A try/finally. */
455 GIMPLE_TRY_FINALLY = 1 << 1,
456 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
458 /* Analogous to TRY_CATCH_IS_CLEANUP. */
459 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
462 /* GIMPLE_WITH_CLEANUP_EXPR */
464 struct GTY((tag("GSS_WCE")))
465 gimple_statement_wce : public gimple_statement_base
467 /* [ WORD 1-6 ] : base class */
469 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
470 executed if an exception is thrown, not on normal exit of its
471 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
472 in TARGET_EXPRs. */
474 /* [ WORD 7 ]
475 Cleanup expression. */
476 gimple_seq cleanup;
480 /* GIMPLE_ASM */
482 struct GTY((tag("GSS_ASM")))
483 gimple_statement_asm : public gimple_statement_with_memory_ops_base
485 /* [ WORD 1-9 ] : base class */
487 /* [ WORD 10 ]
488 __asm__ statement. */
489 const char *string;
491 /* [ WORD 11 ]
492 Number of inputs, outputs, clobbers, labels. */
493 unsigned char ni;
494 unsigned char no;
495 unsigned char nc;
496 unsigned char nl;
498 /* [ WORD 12 ]
499 Operand vector. NOTE! This must always be the last field
500 of this structure. In particular, this means that this
501 structure cannot be embedded inside another one. */
502 tree GTY((length ("%h.num_ops"))) op[1];
505 /* GIMPLE_OMP_CRITICAL */
507 struct GTY((tag("GSS_OMP_CRITICAL")))
508 gimple_statement_omp_critical : public gimple_statement_omp
510 /* [ WORD 1-7 ] : base class */
512 /* [ WORD 8 ]
513 Critical section name. */
514 tree name;
518 struct GTY(()) gimple_omp_for_iter {
519 /* Condition code. */
520 enum tree_code cond;
522 /* Index variable. */
523 tree index;
525 /* Initial value. */
526 tree initial;
528 /* Final value. */
529 tree final;
531 /* Increment. */
532 tree incr;
535 /* GIMPLE_OMP_FOR */
537 struct GTY((tag("GSS_OMP_FOR")))
538 gimple_statement_omp_for : public gimple_statement_omp
540 /* [ WORD 1-7 ] : base class */
542 /* [ WORD 8 ] */
543 tree clauses;
545 /* [ WORD 9 ]
546 Number of elements in iter array. */
547 size_t collapse;
549 /* [ WORD 10 ] */
550 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
552 /* [ WORD 11 ]
553 Pre-body evaluated before the loop body begins. */
554 gimple_seq pre_body;
558 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
559 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
560 gimple_statement_omp_parallel_layout : public gimple_statement_omp
562 /* [ WORD 1-7 ] : base class */
564 /* [ WORD 8 ]
565 Clauses. */
566 tree clauses;
568 /* [ WORD 9 ]
569 Child function holding the body of the parallel region. */
570 tree child_fn;
572 /* [ WORD 10 ]
573 Shared data argument. */
574 tree data_arg;
577 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
578 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
579 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
581 /* No extra fields; adds invariant:
582 stmt->code == GIMPLE_OMP_PARALLEL
583 || stmt->code == GIMPLE_OMP_TASK. */
587 /* GIMPLE_OMP_PARALLEL */
588 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
589 gimple_statement_omp_parallel : public gimple_statement_omp_taskreg
591 /* No extra fields; adds invariant:
592 stmt->code == GIMPLE_OMP_PARALLEL. */
595 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
596 gimple_statement_omp_target : public gimple_statement_omp_parallel_layout
598 /* No extra fields; adds invariant:
599 stmt->code == GIMPLE_OMP_TARGET. */
602 /* GIMPLE_OMP_TASK */
604 struct GTY((tag("GSS_OMP_TASK")))
605 gimple_statement_omp_task : public gimple_statement_omp_taskreg
607 /* [ WORD 1-10 ] : base class */
609 /* [ WORD 11 ]
610 Child function holding firstprivate initialization if needed. */
611 tree copy_fn;
613 /* [ WORD 12-13 ]
614 Size and alignment in bytes of the argument data block. */
615 tree arg_size;
616 tree arg_align;
620 /* GIMPLE_OMP_SECTION */
621 /* Uses struct gimple_statement_omp. */
624 /* GIMPLE_OMP_SECTIONS */
626 struct GTY((tag("GSS_OMP_SECTIONS")))
627 gimple_statement_omp_sections : public gimple_statement_omp
629 /* [ WORD 1-7 ] : base class */
631 /* [ WORD 8 ] */
632 tree clauses;
634 /* [ WORD 9 ]
635 The control variable used for deciding which of the sections to
636 execute. */
637 tree control;
640 /* GIMPLE_OMP_CONTINUE.
642 Note: This does not inherit from gimple_statement_omp, because we
643 do not need the body field. */
645 struct GTY((tag("GSS_OMP_CONTINUE")))
646 gimple_statement_omp_continue : public gimple_statement_base
648 /* [ WORD 1-6 ] : base class */
650 /* [ WORD 7 ] */
651 tree control_def;
653 /* [ WORD 8 ] */
654 tree control_use;
657 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
659 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
660 gimple_statement_omp_single_layout : public gimple_statement_omp
662 /* [ WORD 1-7 ] : base class */
664 /* [ WORD 7 ] */
665 tree clauses;
668 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
669 gimple_statement_omp_single : public gimple_statement_omp_single_layout
671 /* No extra fields; adds invariant:
672 stmt->code == GIMPLE_OMP_SINGLE. */
675 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
676 gimple_statement_omp_teams : public gimple_statement_omp_single_layout
678 /* No extra fields; adds invariant:
679 stmt->code == GIMPLE_OMP_TEAMS. */
683 /* GIMPLE_OMP_ATOMIC_LOAD.
684 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
685 contains a sequence, which we don't need here. */
687 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
688 gimple_statement_omp_atomic_load : public gimple_statement_base
690 /* [ WORD 1-6 ] : base class */
692 /* [ WORD 7-8 ] */
693 tree rhs, lhs;
696 /* GIMPLE_OMP_ATOMIC_STORE.
697 See note on GIMPLE_OMP_ATOMIC_LOAD. */
699 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
700 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
702 /* [ WORD 1-6 ] : base class */
704 /* [ WORD 7 ] */
705 tree val;
708 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
709 gimple_statement_omp_atomic_store :
710 public gimple_statement_omp_atomic_store_layout
712 /* No extra fields; adds invariant:
713 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
716 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
717 gimple_statement_omp_return :
718 public gimple_statement_omp_atomic_store_layout
720 /* No extra fields; adds invariant:
721 stmt->code == GIMPLE_OMP_RETURN. */
724 /* GIMPLE_TRANSACTION. */
726 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
728 /* The __transaction_atomic was declared [[outer]] or it is
729 __transaction_relaxed. */
730 #define GTMA_IS_OUTER (1u << 0)
731 #define GTMA_IS_RELAXED (1u << 1)
732 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
734 /* The transaction is seen to not have an abort. */
735 #define GTMA_HAVE_ABORT (1u << 2)
736 /* The transaction is seen to have loads or stores. */
737 #define GTMA_HAVE_LOAD (1u << 3)
738 #define GTMA_HAVE_STORE (1u << 4)
739 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
740 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
741 /* The transaction WILL enter serial irrevocable mode.
742 An irrevocable block post-dominates the entire transaction, such
743 that all invocations of the transaction will go serial-irrevocable.
744 In such case, we don't bother instrumenting the transaction, and
745 tell the runtime that it should begin the transaction in
746 serial-irrevocable mode. */
747 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
748 /* The transaction contains no instrumentation code whatsover, most
749 likely because it is guaranteed to go irrevocable upon entry. */
750 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
752 struct GTY((tag("GSS_TRANSACTION")))
753 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
755 /* [ WORD 1-9 ] : base class */
757 /* [ WORD 10 ] */
758 gimple_seq body;
760 /* [ WORD 11 ] */
761 tree label;
764 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
765 enum gimple_statement_structure_enum {
766 #include "gsstruct.def"
767 LAST_GSS_ENUM
769 #undef DEFGSSTRUCT
771 template <>
772 template <>
773 inline bool
774 is_a_helper <gimple_statement_asm *>::test (gimple gs)
776 return gs->code == GIMPLE_ASM;
779 template <>
780 template <>
781 inline bool
782 is_a_helper <gimple_statement_bind *>::test (gimple gs)
784 return gs->code == GIMPLE_BIND;
787 template <>
788 template <>
789 inline bool
790 is_a_helper <gimple_statement_call *>::test (gimple gs)
792 return gs->code == GIMPLE_CALL;
795 template <>
796 template <>
797 inline bool
798 is_a_helper <gimple_statement_catch *>::test (gimple gs)
800 return gs->code == GIMPLE_CATCH;
803 template <>
804 template <>
805 inline bool
806 is_a_helper <gimple_statement_resx *>::test (gimple gs)
808 return gs->code == GIMPLE_RESX;
811 template <>
812 template <>
813 inline bool
814 is_a_helper <gimple_statement_eh_dispatch *>::test (gimple gs)
816 return gs->code == GIMPLE_EH_DISPATCH;
819 template <>
820 template <>
821 inline bool
822 is_a_helper <gimple_statement_eh_else *>::test (gimple gs)
824 return gs->code == GIMPLE_EH_ELSE;
827 template <>
828 template <>
829 inline bool
830 is_a_helper <gimple_statement_eh_filter *>::test (gimple gs)
832 return gs->code == GIMPLE_EH_FILTER;
835 template <>
836 template <>
837 inline bool
838 is_a_helper <gimple_statement_eh_mnt *>::test (gimple gs)
840 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
843 template <>
844 template <>
845 inline bool
846 is_a_helper <gimple_statement_omp_atomic_load *>::test (gimple gs)
848 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
851 template <>
852 template <>
853 inline bool
854 is_a_helper <gimple_statement_omp_atomic_store *>::test (gimple gs)
856 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
859 template <>
860 template <>
861 inline bool
862 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
864 return gs->code == GIMPLE_OMP_RETURN;
867 template <>
868 template <>
869 inline bool
870 is_a_helper <gimple_statement_omp_continue *>::test (gimple gs)
872 return gs->code == GIMPLE_OMP_CONTINUE;
875 template <>
876 template <>
877 inline bool
878 is_a_helper <gimple_statement_omp_critical *>::test (gimple gs)
880 return gs->code == GIMPLE_OMP_CRITICAL;
883 template <>
884 template <>
885 inline bool
886 is_a_helper <gimple_statement_omp_for *>::test (gimple gs)
888 return gs->code == GIMPLE_OMP_FOR;
891 template <>
892 template <>
893 inline bool
894 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
896 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
899 template <>
900 template <>
901 inline bool
902 is_a_helper <gimple_statement_omp_parallel *>::test (gimple gs)
904 return gs->code == GIMPLE_OMP_PARALLEL;
907 template <>
908 template <>
909 inline bool
910 is_a_helper <gimple_statement_omp_target *>::test (gimple gs)
912 return gs->code == GIMPLE_OMP_TARGET;
915 template <>
916 template <>
917 inline bool
918 is_a_helper <gimple_statement_omp_sections *>::test (gimple gs)
920 return gs->code == GIMPLE_OMP_SECTIONS;
923 template <>
924 template <>
925 inline bool
926 is_a_helper <gimple_statement_omp_single *>::test (gimple gs)
928 return gs->code == GIMPLE_OMP_SINGLE;
931 template <>
932 template <>
933 inline bool
934 is_a_helper <gimple_statement_omp_teams *>::test (gimple gs)
936 return gs->code == GIMPLE_OMP_TEAMS;
939 template <>
940 template <>
941 inline bool
942 is_a_helper <gimple_statement_omp_task *>::test (gimple gs)
944 return gs->code == GIMPLE_OMP_TASK;
947 template <>
948 template <>
949 inline bool
950 is_a_helper <gimple_statement_phi *>::test (gimple gs)
952 return gs->code == GIMPLE_PHI;
955 template <>
956 template <>
957 inline bool
958 is_a_helper <gimple_statement_transaction *>::test (gimple gs)
960 return gs->code == GIMPLE_TRANSACTION;
963 template <>
964 template <>
965 inline bool
966 is_a_helper <gimple_statement_try *>::test (gimple gs)
968 return gs->code == GIMPLE_TRY;
971 template <>
972 template <>
973 inline bool
974 is_a_helper <gimple_statement_wce *>::test (gimple gs)
976 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
979 template <>
980 template <>
981 inline bool
982 is_a_helper <const gimple_statement_asm *>::test (const_gimple gs)
984 return gs->code == GIMPLE_ASM;
987 template <>
988 template <>
989 inline bool
990 is_a_helper <const gimple_statement_bind *>::test (const_gimple gs)
992 return gs->code == GIMPLE_BIND;
995 template <>
996 template <>
997 inline bool
998 is_a_helper <const gimple_statement_call *>::test (const_gimple gs)
1000 return gs->code == GIMPLE_CALL;
1003 template <>
1004 template <>
1005 inline bool
1006 is_a_helper <const gimple_statement_catch *>::test (const_gimple gs)
1008 return gs->code == GIMPLE_CATCH;
1011 template <>
1012 template <>
1013 inline bool
1014 is_a_helper <const gimple_statement_resx *>::test (const_gimple gs)
1016 return gs->code == GIMPLE_RESX;
1019 template <>
1020 template <>
1021 inline bool
1022 is_a_helper <const gimple_statement_eh_dispatch *>::test (const_gimple gs)
1024 return gs->code == GIMPLE_EH_DISPATCH;
1027 template <>
1028 template <>
1029 inline bool
1030 is_a_helper <const gimple_statement_eh_filter *>::test (const_gimple gs)
1032 return gs->code == GIMPLE_EH_FILTER;
1035 template <>
1036 template <>
1037 inline bool
1038 is_a_helper <const gimple_statement_omp_atomic_load *>::test (const_gimple gs)
1040 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1043 template <>
1044 template <>
1045 inline bool
1046 is_a_helper <const gimple_statement_omp_atomic_store *>::test (const_gimple gs)
1048 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1051 template <>
1052 template <>
1053 inline bool
1054 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1056 return gs->code == GIMPLE_OMP_RETURN;
1059 template <>
1060 template <>
1061 inline bool
1062 is_a_helper <const gimple_statement_omp_continue *>::test (const_gimple gs)
1064 return gs->code == GIMPLE_OMP_CONTINUE;
1067 template <>
1068 template <>
1069 inline bool
1070 is_a_helper <const gimple_statement_omp_critical *>::test (const_gimple gs)
1072 return gs->code == GIMPLE_OMP_CRITICAL;
1075 template <>
1076 template <>
1077 inline bool
1078 is_a_helper <const gimple_statement_omp_for *>::test (const_gimple gs)
1080 return gs->code == GIMPLE_OMP_FOR;
1083 template <>
1084 template <>
1085 inline bool
1086 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1088 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1091 template <>
1092 template <>
1093 inline bool
1094 is_a_helper <const gimple_statement_omp_parallel *>::test (const_gimple gs)
1096 return gs->code == GIMPLE_OMP_PARALLEL;
1099 template <>
1100 template <>
1101 inline bool
1102 is_a_helper <const gimple_statement_omp_target *>::test (const_gimple gs)
1104 return gs->code == GIMPLE_OMP_TARGET;
1107 template <>
1108 template <>
1109 inline bool
1110 is_a_helper <const gimple_statement_omp_sections *>::test (const_gimple gs)
1112 return gs->code == GIMPLE_OMP_SECTIONS;
1115 template <>
1116 template <>
1117 inline bool
1118 is_a_helper <const gimple_statement_omp_single *>::test (const_gimple gs)
1120 return gs->code == GIMPLE_OMP_SINGLE;
1123 template <>
1124 template <>
1125 inline bool
1126 is_a_helper <const gimple_statement_omp_teams *>::test (const_gimple gs)
1128 return gs->code == GIMPLE_OMP_TEAMS;
1131 template <>
1132 template <>
1133 inline bool
1134 is_a_helper <const gimple_statement_omp_task *>::test (const_gimple gs)
1136 return gs->code == GIMPLE_OMP_TASK;
1139 template <>
1140 template <>
1141 inline bool
1142 is_a_helper <const gimple_statement_phi *>::test (const_gimple gs)
1144 return gs->code == GIMPLE_PHI;
1147 template <>
1148 template <>
1149 inline bool
1150 is_a_helper <const gimple_statement_transaction *>::test (const_gimple gs)
1152 return gs->code == GIMPLE_TRANSACTION;
1155 /* Offset in bytes to the location of the operand vector.
1156 Zero if there is no operand vector for this tuple structure. */
1157 extern size_t const gimple_ops_offset_[];
1159 /* Map GIMPLE codes to GSS codes. */
1160 extern enum gimple_statement_structure_enum const gss_for_code_[];
1162 /* This variable holds the currently expanded gimple statement for purposes
1163 of comminucating the profile info to the builtin expanders. */
1164 extern gimple currently_expanding_gimple_stmt;
1166 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1167 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1168 gimple gimple_build_return (tree);
1169 void gimple_call_reset_alias_info (gimple);
1170 gimple gimple_build_call_vec (tree, vec<tree> );
1171 gimple gimple_build_call (tree, unsigned, ...);
1172 gimple gimple_build_call_valist (tree, unsigned, va_list);
1173 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1174 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1175 gimple gimple_build_call_from_tree (tree);
1176 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1177 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1178 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1179 tree, tree, tree CXX_MEM_STAT_INFO);
1180 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1181 tree, tree CXX_MEM_STAT_INFO);
1182 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1183 gimple gimple_build_cond_from_tree (tree, tree, tree);
1184 void gimple_cond_set_condition_from_tree (gimple, tree);
1185 gimple gimple_build_label (tree label);
1186 gimple gimple_build_goto (tree dest);
1187 gimple gimple_build_nop (void);
1188 gimple gimple_build_bind (tree, gimple_seq, tree);
1189 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1190 vec<tree, va_gc> *, vec<tree, va_gc> *,
1191 vec<tree, va_gc> *);
1192 gimple gimple_build_catch (tree, gimple_seq);
1193 gimple gimple_build_eh_filter (tree, gimple_seq);
1194 gimple gimple_build_eh_must_not_throw (tree);
1195 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1196 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1197 enum gimple_try_flags);
1198 gimple gimple_build_wce (gimple_seq);
1199 gimple gimple_build_resx (int);
1200 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1201 gimple gimple_build_switch (tree, tree, vec<tree> );
1202 gimple gimple_build_eh_dispatch (int);
1203 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1204 #define gimple_build_debug_bind(var,val,stmt) \
1205 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1206 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1207 #define gimple_build_debug_source_bind(var,val,stmt) \
1208 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1209 gimple gimple_build_omp_critical (gimple_seq, tree);
1210 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1211 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1212 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1213 gimple gimple_build_omp_section (gimple_seq);
1214 gimple gimple_build_omp_master (gimple_seq);
1215 gimple gimple_build_omp_taskgroup (gimple_seq);
1216 gimple gimple_build_omp_continue (tree, tree);
1217 gimple gimple_build_omp_ordered (gimple_seq);
1218 gimple gimple_build_omp_return (bool);
1219 gimple gimple_build_omp_sections (gimple_seq, tree);
1220 gimple gimple_build_omp_sections_switch (void);
1221 gimple gimple_build_omp_single (gimple_seq, tree);
1222 gimple gimple_build_omp_target (gimple_seq, int, tree);
1223 gimple gimple_build_omp_teams (gimple_seq, tree);
1224 gimple gimple_build_omp_atomic_load (tree, tree);
1225 gimple gimple_build_omp_atomic_store (tree);
1226 gimple gimple_build_transaction (gimple_seq, tree);
1227 gimple gimple_build_predict (enum br_predictor, enum prediction);
1228 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1229 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1230 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1231 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1232 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1233 location_t);
1234 extern void annotate_all_with_location (gimple_seq, location_t);
1235 bool empty_body_p (gimple_seq);
1236 gimple_seq gimple_seq_copy (gimple_seq);
1237 bool gimple_call_same_target_p (const_gimple, const_gimple);
1238 int gimple_call_flags (const_gimple);
1239 int gimple_call_arg_flags (const_gimple, unsigned);
1240 int gimple_call_return_flags (const_gimple);
1241 bool gimple_assign_copy_p (gimple);
1242 bool gimple_assign_ssa_name_copy_p (gimple);
1243 bool gimple_assign_unary_nop_p (gimple);
1244 void gimple_set_bb (gimple, basic_block);
1245 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1246 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1247 tree, tree, tree);
1248 tree gimple_get_lhs (const_gimple);
1249 void gimple_set_lhs (gimple, tree);
1250 gimple gimple_copy (gimple);
1251 bool gimple_has_side_effects (const_gimple);
1252 bool gimple_could_trap_p_1 (gimple, bool, bool);
1253 bool gimple_could_trap_p (gimple);
1254 bool gimple_assign_rhs_could_trap_p (gimple);
1255 extern void dump_gimple_statistics (void);
1256 unsigned get_gimple_rhs_num_ops (enum tree_code);
1257 extern tree canonicalize_cond_expr_cond (tree);
1258 gimple gimple_call_copy_skip_args (gimple, bitmap);
1259 extern bool gimple_compare_field_offset (tree, tree);
1260 extern tree gimple_unsigned_type (tree);
1261 extern tree gimple_signed_type (tree);
1262 extern alias_set_type gimple_get_alias_set (tree);
1263 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1264 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1265 extern bool gimple_call_builtin_p (const_gimple);
1266 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1267 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1268 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1269 extern void dump_decl_set (FILE *, bitmap);
1270 extern bool nonfreeing_call_p (gimple);
1271 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1272 extern void sort_case_labels (vec<tree>);
1273 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1274 extern void gimple_seq_set_location (gimple_seq, location_t);
1275 extern void gimple_seq_discard (gimple_seq);
1277 /* Formal (expression) temporary table handling: multiple occurrences of
1278 the same scalar expression are evaluated into the same temporary. */
1280 typedef struct gimple_temp_hash_elt
1282 tree val; /* Key */
1283 tree temp; /* Value */
1284 } elt_t;
1286 /* Get the number of the next statement uid to be allocated. */
1287 static inline unsigned int
1288 gimple_stmt_max_uid (struct function *fn)
1290 return fn->last_stmt_uid;
1293 /* Set the number of the next statement uid to be allocated. */
1294 static inline void
1295 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1297 fn->last_stmt_uid = maxid;
1300 /* Set the number of the next statement uid to be allocated. */
1301 static inline unsigned int
1302 inc_gimple_stmt_max_uid (struct function *fn)
1304 return fn->last_stmt_uid++;
1307 /* Return the first node in GIMPLE sequence S. */
1309 static inline gimple_seq_node
1310 gimple_seq_first (gimple_seq s)
1312 return s;
1316 /* Return the first statement in GIMPLE sequence S. */
1318 static inline gimple
1319 gimple_seq_first_stmt (gimple_seq s)
1321 gimple_seq_node n = gimple_seq_first (s);
1322 return n;
1326 /* Return the last node in GIMPLE sequence S. */
1328 static inline gimple_seq_node
1329 gimple_seq_last (gimple_seq s)
1331 return s ? s->prev : NULL;
1335 /* Return the last statement in GIMPLE sequence S. */
1337 static inline gimple
1338 gimple_seq_last_stmt (gimple_seq s)
1340 gimple_seq_node n = gimple_seq_last (s);
1341 return n;
1345 /* Set the last node in GIMPLE sequence *PS to LAST. */
1347 static inline void
1348 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1350 (*ps)->prev = last;
1354 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1356 static inline void
1357 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1359 *ps = first;
1363 /* Return true if GIMPLE sequence S is empty. */
1365 static inline bool
1366 gimple_seq_empty_p (gimple_seq s)
1368 return s == NULL;
1371 /* Allocate a new sequence and initialize its first element with STMT. */
1373 static inline gimple_seq
1374 gimple_seq_alloc_with_stmt (gimple stmt)
1376 gimple_seq seq = NULL;
1377 gimple_seq_add_stmt (&seq, stmt);
1378 return seq;
1382 /* Returns the sequence of statements in BB. */
1384 static inline gimple_seq
1385 bb_seq (const_basic_block bb)
1387 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1390 static inline gimple_seq *
1391 bb_seq_addr (basic_block bb)
1393 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1396 /* Sets the sequence of statements in BB to SEQ. */
1398 static inline void
1399 set_bb_seq (basic_block bb, gimple_seq seq)
1401 gcc_checking_assert (!(bb->flags & BB_RTL));
1402 bb->il.gimple.seq = seq;
1406 /* Return the code for GIMPLE statement G. */
1408 static inline enum gimple_code
1409 gimple_code (const_gimple g)
1411 return g->code;
1415 /* Return the GSS code used by a GIMPLE code. */
1417 static inline enum gimple_statement_structure_enum
1418 gss_for_code (enum gimple_code code)
1420 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1421 return gss_for_code_[code];
1425 /* Return which GSS code is used by GS. */
1427 static inline enum gimple_statement_structure_enum
1428 gimple_statement_structure (gimple gs)
1430 return gss_for_code (gimple_code (gs));
1434 /* Return true if statement G has sub-statements. This is only true for
1435 High GIMPLE statements. */
1437 static inline bool
1438 gimple_has_substatements (gimple g)
1440 switch (gimple_code (g))
1442 case GIMPLE_BIND:
1443 case GIMPLE_CATCH:
1444 case GIMPLE_EH_FILTER:
1445 case GIMPLE_EH_ELSE:
1446 case GIMPLE_TRY:
1447 case GIMPLE_OMP_FOR:
1448 case GIMPLE_OMP_MASTER:
1449 case GIMPLE_OMP_TASKGROUP:
1450 case GIMPLE_OMP_ORDERED:
1451 case GIMPLE_OMP_SECTION:
1452 case GIMPLE_OMP_PARALLEL:
1453 case GIMPLE_OMP_TASK:
1454 case GIMPLE_OMP_SECTIONS:
1455 case GIMPLE_OMP_SINGLE:
1456 case GIMPLE_OMP_TARGET:
1457 case GIMPLE_OMP_TEAMS:
1458 case GIMPLE_OMP_CRITICAL:
1459 case GIMPLE_WITH_CLEANUP_EXPR:
1460 case GIMPLE_TRANSACTION:
1461 return true;
1463 default:
1464 return false;
1469 /* Return the basic block holding statement G. */
1471 static inline basic_block
1472 gimple_bb (const_gimple g)
1474 return g->bb;
1478 /* Return the lexical scope block holding statement G. */
1480 static inline tree
1481 gimple_block (const_gimple g)
1483 return LOCATION_BLOCK (g->location);
1487 /* Set BLOCK to be the lexical scope block holding statement G. */
1489 static inline void
1490 gimple_set_block (gimple g, tree block)
1492 if (block)
1493 g->location =
1494 COMBINE_LOCATION_DATA (line_table, g->location, block);
1495 else
1496 g->location = LOCATION_LOCUS (g->location);
1500 /* Return location information for statement G. */
1502 static inline location_t
1503 gimple_location (const_gimple g)
1505 return g->location;
1508 /* Return location information for statement G if g is not NULL.
1509 Otherwise, UNKNOWN_LOCATION is returned. */
1511 static inline location_t
1512 gimple_location_safe (const_gimple g)
1514 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1517 /* Return pointer to location information for statement G. */
1519 static inline const location_t *
1520 gimple_location_ptr (const_gimple g)
1522 return &g->location;
1526 /* Set location information for statement G. */
1528 static inline void
1529 gimple_set_location (gimple g, location_t location)
1531 g->location = location;
1535 /* Return true if G contains location information. */
1537 static inline bool
1538 gimple_has_location (const_gimple g)
1540 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1544 /* Return the file name of the location of STMT. */
1546 static inline const char *
1547 gimple_filename (const_gimple stmt)
1549 return LOCATION_FILE (gimple_location (stmt));
1553 /* Return the line number of the location of STMT. */
1555 static inline int
1556 gimple_lineno (const_gimple stmt)
1558 return LOCATION_LINE (gimple_location (stmt));
1562 /* Determine whether SEQ is a singleton. */
1564 static inline bool
1565 gimple_seq_singleton_p (gimple_seq seq)
1567 return ((gimple_seq_first (seq) != NULL)
1568 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1571 /* Return true if no warnings should be emitted for statement STMT. */
1573 static inline bool
1574 gimple_no_warning_p (const_gimple stmt)
1576 return stmt->no_warning;
1579 /* Set the no_warning flag of STMT to NO_WARNING. */
1581 static inline void
1582 gimple_set_no_warning (gimple stmt, bool no_warning)
1584 stmt->no_warning = (unsigned) no_warning;
1587 /* Set the visited status on statement STMT to VISITED_P. */
1589 static inline void
1590 gimple_set_visited (gimple stmt, bool visited_p)
1592 stmt->visited = (unsigned) visited_p;
1596 /* Return the visited status for statement STMT. */
1598 static inline bool
1599 gimple_visited_p (gimple stmt)
1601 return stmt->visited;
1605 /* Set pass local flag PLF on statement STMT to VAL_P. */
1607 static inline void
1608 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1610 if (val_p)
1611 stmt->plf |= (unsigned int) plf;
1612 else
1613 stmt->plf &= ~((unsigned int) plf);
1617 /* Return the value of pass local flag PLF on statement STMT. */
1619 static inline unsigned int
1620 gimple_plf (gimple stmt, enum plf_mask plf)
1622 return stmt->plf & ((unsigned int) plf);
1626 /* Set the UID of statement. */
1628 static inline void
1629 gimple_set_uid (gimple g, unsigned uid)
1631 g->uid = uid;
1635 /* Return the UID of statement. */
1637 static inline unsigned
1638 gimple_uid (const_gimple g)
1640 return g->uid;
1644 /* Make statement G a singleton sequence. */
1646 static inline void
1647 gimple_init_singleton (gimple g)
1649 g->next = NULL;
1650 g->prev = g;
1654 /* Return true if GIMPLE statement G has register or memory operands. */
1656 static inline bool
1657 gimple_has_ops (const_gimple g)
1659 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1662 template <>
1663 template <>
1664 inline bool
1665 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1667 return gimple_has_ops (gs);
1670 template <>
1671 template <>
1672 inline bool
1673 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1675 return gimple_has_ops (gs);
1678 /* Return true if GIMPLE statement G has memory operands. */
1680 static inline bool
1681 gimple_has_mem_ops (const_gimple g)
1683 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1686 template <>
1687 template <>
1688 inline bool
1689 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1691 return gimple_has_mem_ops (gs);
1694 template <>
1695 template <>
1696 inline bool
1697 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1699 return gimple_has_mem_ops (gs);
1702 /* Return the set of USE operands for statement G. */
1704 static inline struct use_optype_d *
1705 gimple_use_ops (const_gimple g)
1707 const gimple_statement_with_ops *ops_stmt =
1708 dyn_cast <const gimple_statement_with_ops *> (g);
1709 if (!ops_stmt)
1710 return NULL;
1711 return ops_stmt->use_ops;
1715 /* Set USE to be the set of USE operands for statement G. */
1717 static inline void
1718 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1720 gimple_statement_with_ops *ops_stmt =
1721 as_a <gimple_statement_with_ops *> (g);
1722 ops_stmt->use_ops = use;
1726 /* Return the single VUSE operand of the statement G. */
1728 static inline tree
1729 gimple_vuse (const_gimple g)
1731 const gimple_statement_with_memory_ops *mem_ops_stmt =
1732 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1733 if (!mem_ops_stmt)
1734 return NULL_TREE;
1735 return mem_ops_stmt->vuse;
1738 /* Return the single VDEF operand of the statement G. */
1740 static inline tree
1741 gimple_vdef (const_gimple g)
1743 const gimple_statement_with_memory_ops *mem_ops_stmt =
1744 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1745 if (!mem_ops_stmt)
1746 return NULL_TREE;
1747 return mem_ops_stmt->vdef;
1750 /* Return the single VUSE operand of the statement G. */
1752 static inline tree *
1753 gimple_vuse_ptr (gimple g)
1755 gimple_statement_with_memory_ops *mem_ops_stmt =
1756 dyn_cast <gimple_statement_with_memory_ops *> (g);
1757 if (!mem_ops_stmt)
1758 return NULL;
1759 return &mem_ops_stmt->vuse;
1762 /* Return the single VDEF operand of the statement G. */
1764 static inline tree *
1765 gimple_vdef_ptr (gimple g)
1767 gimple_statement_with_memory_ops *mem_ops_stmt =
1768 dyn_cast <gimple_statement_with_memory_ops *> (g);
1769 if (!mem_ops_stmt)
1770 return NULL;
1771 return &mem_ops_stmt->vdef;
1774 /* Set the single VUSE operand of the statement G. */
1776 static inline void
1777 gimple_set_vuse (gimple g, tree vuse)
1779 gimple_statement_with_memory_ops *mem_ops_stmt =
1780 as_a <gimple_statement_with_memory_ops *> (g);
1781 mem_ops_stmt->vuse = vuse;
1784 /* Set the single VDEF operand of the statement G. */
1786 static inline void
1787 gimple_set_vdef (gimple g, tree vdef)
1789 gimple_statement_with_memory_ops *mem_ops_stmt =
1790 as_a <gimple_statement_with_memory_ops *> (g);
1791 mem_ops_stmt->vdef = vdef;
1795 /* Return true if statement G has operands and the modified field has
1796 been set. */
1798 static inline bool
1799 gimple_modified_p (const_gimple g)
1801 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1805 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1806 a MODIFIED field. */
1808 static inline void
1809 gimple_set_modified (gimple s, bool modifiedp)
1811 if (gimple_has_ops (s))
1812 s->modified = (unsigned) modifiedp;
1816 /* Return the tree code for the expression computed by STMT. This is
1817 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1818 GIMPLE_CALL, return CALL_EXPR as the expression code for
1819 consistency. This is useful when the caller needs to deal with the
1820 three kinds of computation that GIMPLE supports. */
1822 static inline enum tree_code
1823 gimple_expr_code (const_gimple stmt)
1825 enum gimple_code code = gimple_code (stmt);
1826 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1827 return (enum tree_code) stmt->subcode;
1828 else
1830 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1831 return CALL_EXPR;
1836 /* Return true if statement STMT contains volatile operands. */
1838 static inline bool
1839 gimple_has_volatile_ops (const_gimple stmt)
1841 if (gimple_has_mem_ops (stmt))
1842 return stmt->has_volatile_ops;
1843 else
1844 return false;
1848 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1850 static inline void
1851 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1853 if (gimple_has_mem_ops (stmt))
1854 stmt->has_volatile_ops = (unsigned) volatilep;
1857 /* Return true if STMT is in a transaction. */
1859 static inline bool
1860 gimple_in_transaction (gimple stmt)
1862 return bb_in_transaction (gimple_bb (stmt));
1865 /* Return true if statement STMT may access memory. */
1867 static inline bool
1868 gimple_references_memory_p (gimple stmt)
1870 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1874 /* Return the subcode for OMP statement S. */
1876 static inline unsigned
1877 gimple_omp_subcode (const_gimple s)
1879 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1880 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1881 return s->subcode;
1884 /* Set the subcode for OMP statement S to SUBCODE. */
1886 static inline void
1887 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1889 /* We only have 16 bits for the subcode. Assert that we are not
1890 overflowing it. */
1891 gcc_gimple_checking_assert (subcode < (1 << 16));
1892 s->subcode = subcode;
1895 /* Set the nowait flag on OMP_RETURN statement S. */
1897 static inline void
1898 gimple_omp_return_set_nowait (gimple s)
1900 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1901 s->subcode |= GF_OMP_RETURN_NOWAIT;
1905 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1906 flag set. */
1908 static inline bool
1909 gimple_omp_return_nowait_p (const_gimple g)
1911 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1912 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1916 /* Set the LHS of OMP return. */
1918 static inline void
1919 gimple_omp_return_set_lhs (gimple g, tree lhs)
1921 gimple_statement_omp_return *omp_return_stmt =
1922 as_a <gimple_statement_omp_return *> (g);
1923 omp_return_stmt->val = lhs;
1927 /* Get the LHS of OMP return. */
1929 static inline tree
1930 gimple_omp_return_lhs (const_gimple g)
1932 const gimple_statement_omp_return *omp_return_stmt =
1933 as_a <const gimple_statement_omp_return *> (g);
1934 return omp_return_stmt->val;
1938 /* Return a pointer to the LHS of OMP return. */
1940 static inline tree *
1941 gimple_omp_return_lhs_ptr (gimple g)
1943 gimple_statement_omp_return *omp_return_stmt =
1944 as_a <gimple_statement_omp_return *> (g);
1945 return &omp_return_stmt->val;
1949 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1950 flag set. */
1952 static inline bool
1953 gimple_omp_section_last_p (const_gimple g)
1955 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1956 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1960 /* Set the GF_OMP_SECTION_LAST flag on G. */
1962 static inline void
1963 gimple_omp_section_set_last (gimple g)
1965 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1966 g->subcode |= GF_OMP_SECTION_LAST;
1970 /* Return true if OMP parallel statement G has the
1971 GF_OMP_PARALLEL_COMBINED flag set. */
1973 static inline bool
1974 gimple_omp_parallel_combined_p (const_gimple g)
1976 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1977 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1981 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1982 value of COMBINED_P. */
1984 static inline void
1985 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1987 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1988 if (combined_p)
1989 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1990 else
1991 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1995 /* Return true if OMP atomic load/store statement G has the
1996 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1998 static inline bool
1999 gimple_omp_atomic_need_value_p (const_gimple g)
2001 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2002 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2003 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2007 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2009 static inline void
2010 gimple_omp_atomic_set_need_value (gimple g)
2012 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2013 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2014 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2018 /* Return true if OMP atomic load/store statement G has the
2019 GF_OMP_ATOMIC_SEQ_CST flag set. */
2021 static inline bool
2022 gimple_omp_atomic_seq_cst_p (const_gimple g)
2024 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2025 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2026 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2030 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2032 static inline void
2033 gimple_omp_atomic_set_seq_cst (gimple g)
2035 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2036 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2037 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2041 /* Return the number of operands for statement GS. */
2043 static inline unsigned
2044 gimple_num_ops (const_gimple gs)
2046 return gs->num_ops;
2050 /* Set the number of operands for statement GS. */
2052 static inline void
2053 gimple_set_num_ops (gimple gs, unsigned num_ops)
2055 gs->num_ops = num_ops;
2059 /* Return the array of operands for statement GS. */
2061 static inline tree *
2062 gimple_ops (gimple gs)
2064 size_t off;
2066 /* All the tuples have their operand vector at the very bottom
2067 of the structure. Note that those structures that do not
2068 have an operand vector have a zero offset. */
2069 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2070 gcc_gimple_checking_assert (off != 0);
2072 return (tree *) ((char *) gs + off);
2076 /* Return operand I for statement GS. */
2078 static inline tree
2079 gimple_op (const_gimple gs, unsigned i)
2081 if (gimple_has_ops (gs))
2083 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2084 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2086 else
2087 return NULL_TREE;
2090 /* Return a pointer to operand I for statement GS. */
2092 static inline tree *
2093 gimple_op_ptr (const_gimple gs, unsigned i)
2095 if (gimple_has_ops (gs))
2097 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2098 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2100 else
2101 return NULL;
2104 /* Set operand I of statement GS to OP. */
2106 static inline void
2107 gimple_set_op (gimple gs, unsigned i, tree op)
2109 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2111 /* Note. It may be tempting to assert that OP matches
2112 is_gimple_operand, but that would be wrong. Different tuples
2113 accept slightly different sets of tree operands. Each caller
2114 should perform its own validation. */
2115 gimple_ops (gs)[i] = op;
2118 /* Return true if GS is a GIMPLE_ASSIGN. */
2120 static inline bool
2121 is_gimple_assign (const_gimple gs)
2123 return gimple_code (gs) == GIMPLE_ASSIGN;
2126 /* Determine if expression CODE is one of the valid expressions that can
2127 be used on the RHS of GIMPLE assignments. */
2129 static inline enum gimple_rhs_class
2130 get_gimple_rhs_class (enum tree_code code)
2132 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2135 /* Return the LHS of assignment statement GS. */
2137 static inline tree
2138 gimple_assign_lhs (const_gimple gs)
2140 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2141 return gimple_op (gs, 0);
2145 /* Return a pointer to the LHS of assignment statement GS. */
2147 static inline tree *
2148 gimple_assign_lhs_ptr (const_gimple gs)
2150 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2151 return gimple_op_ptr (gs, 0);
2155 /* Set LHS to be the LHS operand of assignment statement GS. */
2157 static inline void
2158 gimple_assign_set_lhs (gimple gs, tree lhs)
2160 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2161 gimple_set_op (gs, 0, lhs);
2163 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2164 SSA_NAME_DEF_STMT (lhs) = gs;
2168 /* Return the first operand on the RHS of assignment statement GS. */
2170 static inline tree
2171 gimple_assign_rhs1 (const_gimple gs)
2173 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2174 return gimple_op (gs, 1);
2178 /* Return a pointer to the first operand on the RHS of assignment
2179 statement GS. */
2181 static inline tree *
2182 gimple_assign_rhs1_ptr (const_gimple gs)
2184 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2185 return gimple_op_ptr (gs, 1);
2188 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2190 static inline void
2191 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2193 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2195 gimple_set_op (gs, 1, rhs);
2199 /* Return the second operand on the RHS of assignment statement GS.
2200 If GS does not have two operands, NULL is returned instead. */
2202 static inline tree
2203 gimple_assign_rhs2 (const_gimple gs)
2205 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2207 if (gimple_num_ops (gs) >= 3)
2208 return gimple_op (gs, 2);
2209 else
2210 return NULL_TREE;
2214 /* Return a pointer to the second operand on the RHS of assignment
2215 statement GS. */
2217 static inline tree *
2218 gimple_assign_rhs2_ptr (const_gimple gs)
2220 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2221 return gimple_op_ptr (gs, 2);
2225 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2227 static inline void
2228 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2230 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2232 gimple_set_op (gs, 2, rhs);
2235 /* Return the third operand on the RHS of assignment statement GS.
2236 If GS does not have two operands, NULL is returned instead. */
2238 static inline tree
2239 gimple_assign_rhs3 (const_gimple gs)
2241 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2243 if (gimple_num_ops (gs) >= 4)
2244 return gimple_op (gs, 3);
2245 else
2246 return NULL_TREE;
2249 /* Return a pointer to the third operand on the RHS of assignment
2250 statement GS. */
2252 static inline tree *
2253 gimple_assign_rhs3_ptr (const_gimple gs)
2255 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2256 return gimple_op_ptr (gs, 3);
2260 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2262 static inline void
2263 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2265 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2267 gimple_set_op (gs, 3, rhs);
2270 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2271 to see only a maximum of two operands. */
2273 static inline void
2274 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2275 tree op1, tree op2)
2277 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2280 /* Returns true if GS is a nontemporal move. */
2282 static inline bool
2283 gimple_assign_nontemporal_move_p (const_gimple gs)
2285 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2286 return gs->nontemporal_move;
2289 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2291 static inline void
2292 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2294 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2295 gs->nontemporal_move = nontemporal;
2299 /* Return the code of the expression computed on the rhs of assignment
2300 statement GS. In case that the RHS is a single object, returns the
2301 tree code of the object. */
2303 static inline enum tree_code
2304 gimple_assign_rhs_code (const_gimple gs)
2306 enum tree_code code;
2307 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2309 code = (enum tree_code) gs->subcode;
2310 /* While we initially set subcode to the TREE_CODE of the rhs for
2311 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2312 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2313 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2314 code = TREE_CODE (gimple_assign_rhs1 (gs));
2316 return code;
2320 /* Set CODE to be the code for the expression computed on the RHS of
2321 assignment S. */
2323 static inline void
2324 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2326 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2327 s->subcode = code;
2331 /* Return the gimple rhs class of the code of the expression computed on
2332 the rhs of assignment statement GS.
2333 This will never return GIMPLE_INVALID_RHS. */
2335 static inline enum gimple_rhs_class
2336 gimple_assign_rhs_class (const_gimple gs)
2338 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2341 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2342 there is no operator associated with the assignment itself.
2343 Unlike gimple_assign_copy_p, this predicate returns true for
2344 any RHS operand, including those that perform an operation
2345 and do not have the semantics of a copy, such as COND_EXPR. */
2347 static inline bool
2348 gimple_assign_single_p (const_gimple gs)
2350 return (is_gimple_assign (gs)
2351 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2354 /* Return true if GS performs a store to its lhs. */
2356 static inline bool
2357 gimple_store_p (const_gimple gs)
2359 tree lhs = gimple_get_lhs (gs);
2360 return lhs && !is_gimple_reg (lhs);
2363 /* Return true if GS is an assignment that loads from its rhs1. */
2365 static inline bool
2366 gimple_assign_load_p (const_gimple gs)
2368 tree rhs;
2369 if (!gimple_assign_single_p (gs))
2370 return false;
2371 rhs = gimple_assign_rhs1 (gs);
2372 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2373 return true;
2374 rhs = get_base_address (rhs);
2375 return (DECL_P (rhs)
2376 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2380 /* Return true if S is a type-cast assignment. */
2382 static inline bool
2383 gimple_assign_cast_p (const_gimple s)
2385 if (is_gimple_assign (s))
2387 enum tree_code sc = gimple_assign_rhs_code (s);
2388 return CONVERT_EXPR_CODE_P (sc)
2389 || sc == VIEW_CONVERT_EXPR
2390 || sc == FIX_TRUNC_EXPR;
2393 return false;
2396 /* Return true if S is a clobber statement. */
2398 static inline bool
2399 gimple_clobber_p (const_gimple s)
2401 return gimple_assign_single_p (s)
2402 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2405 /* Return true if GS is a GIMPLE_CALL. */
2407 static inline bool
2408 is_gimple_call (const_gimple gs)
2410 return gimple_code (gs) == GIMPLE_CALL;
2413 /* Return the LHS of call statement GS. */
2415 static inline tree
2416 gimple_call_lhs (const_gimple gs)
2418 GIMPLE_CHECK (gs, GIMPLE_CALL);
2419 return gimple_op (gs, 0);
2423 /* Return a pointer to the LHS of call statement GS. */
2425 static inline tree *
2426 gimple_call_lhs_ptr (const_gimple gs)
2428 GIMPLE_CHECK (gs, GIMPLE_CALL);
2429 return gimple_op_ptr (gs, 0);
2433 /* Set LHS to be the LHS operand of call statement GS. */
2435 static inline void
2436 gimple_call_set_lhs (gimple gs, tree lhs)
2438 GIMPLE_CHECK (gs, GIMPLE_CALL);
2439 gimple_set_op (gs, 0, lhs);
2440 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2441 SSA_NAME_DEF_STMT (lhs) = gs;
2445 /* Return true if call GS calls an internal-only function, as enumerated
2446 by internal_fn. */
2448 static inline bool
2449 gimple_call_internal_p (const_gimple gs)
2451 GIMPLE_CHECK (gs, GIMPLE_CALL);
2452 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2456 /* Return the target of internal call GS. */
2458 static inline enum internal_fn
2459 gimple_call_internal_fn (const_gimple gs)
2461 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2462 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2465 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2466 that could alter control flow. */
2468 static inline void
2469 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2471 GIMPLE_CHECK (s, GIMPLE_CALL);
2472 if (ctrl_altering_p)
2473 s->subcode |= GF_CALL_CTRL_ALTERING;
2474 else
2475 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2478 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2479 flag is set. Such call could not be a stmt in the middle of a bb. */
2481 static inline bool
2482 gimple_call_ctrl_altering_p (const_gimple gs)
2484 GIMPLE_CHECK (gs, GIMPLE_CALL);
2485 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2489 /* Return the function type of the function called by GS. */
2491 static inline tree
2492 gimple_call_fntype (const_gimple gs)
2494 const gimple_statement_call *call_stmt =
2495 as_a <const gimple_statement_call *> (gs);
2496 if (gimple_call_internal_p (gs))
2497 return NULL_TREE;
2498 return call_stmt->u.fntype;
2501 /* Set the type of the function called by GS to FNTYPE. */
2503 static inline void
2504 gimple_call_set_fntype (gimple gs, tree fntype)
2506 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2507 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2508 call_stmt->u.fntype = fntype;
2512 /* Return the tree node representing the function called by call
2513 statement GS. */
2515 static inline tree
2516 gimple_call_fn (const_gimple gs)
2518 GIMPLE_CHECK (gs, GIMPLE_CALL);
2519 return gimple_op (gs, 1);
2522 /* Return a pointer to the tree node representing the function called by call
2523 statement GS. */
2525 static inline tree *
2526 gimple_call_fn_ptr (const_gimple gs)
2528 GIMPLE_CHECK (gs, GIMPLE_CALL);
2529 return gimple_op_ptr (gs, 1);
2533 /* Set FN to be the function called by call statement GS. */
2535 static inline void
2536 gimple_call_set_fn (gimple gs, tree fn)
2538 GIMPLE_CHECK (gs, GIMPLE_CALL);
2539 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2540 gimple_set_op (gs, 1, fn);
2544 /* Set FNDECL to be the function called by call statement GS. */
2546 static inline void
2547 gimple_call_set_fndecl (gimple gs, tree decl)
2549 GIMPLE_CHECK (gs, GIMPLE_CALL);
2550 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2551 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2555 /* Set internal function FN to be the function called by call statement GS. */
2557 static inline void
2558 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2560 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2561 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2562 call_stmt->u.internal_fn = fn;
2566 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2567 Otherwise return NULL. This function is analogous to
2568 get_callee_fndecl in tree land. */
2570 static inline tree
2571 gimple_call_fndecl (const_gimple gs)
2573 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2577 /* Return the type returned by call statement GS. */
2579 static inline tree
2580 gimple_call_return_type (const_gimple gs)
2582 tree type = gimple_call_fntype (gs);
2584 if (type == NULL_TREE)
2585 return TREE_TYPE (gimple_call_lhs (gs));
2587 /* The type returned by a function is the type of its
2588 function type. */
2589 return TREE_TYPE (type);
2593 /* Return the static chain for call statement GS. */
2595 static inline tree
2596 gimple_call_chain (const_gimple gs)
2598 GIMPLE_CHECK (gs, GIMPLE_CALL);
2599 return gimple_op (gs, 2);
2603 /* Return a pointer to the static chain for call statement GS. */
2605 static inline tree *
2606 gimple_call_chain_ptr (const_gimple gs)
2608 GIMPLE_CHECK (gs, GIMPLE_CALL);
2609 return gimple_op_ptr (gs, 2);
2612 /* Set CHAIN to be the static chain for call statement GS. */
2614 static inline void
2615 gimple_call_set_chain (gimple gs, tree chain)
2617 GIMPLE_CHECK (gs, GIMPLE_CALL);
2619 gimple_set_op (gs, 2, chain);
2623 /* Return the number of arguments used by call statement GS. */
2625 static inline unsigned
2626 gimple_call_num_args (const_gimple gs)
2628 unsigned num_ops;
2629 GIMPLE_CHECK (gs, GIMPLE_CALL);
2630 num_ops = gimple_num_ops (gs);
2631 return num_ops - 3;
2635 /* Return the argument at position INDEX for call statement GS. */
2637 static inline tree
2638 gimple_call_arg (const_gimple gs, unsigned index)
2640 GIMPLE_CHECK (gs, GIMPLE_CALL);
2641 return gimple_op (gs, index + 3);
2645 /* Return a pointer to the argument at position INDEX for call
2646 statement GS. */
2648 static inline tree *
2649 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2651 GIMPLE_CHECK (gs, GIMPLE_CALL);
2652 return gimple_op_ptr (gs, index + 3);
2656 /* Set ARG to be the argument at position INDEX for call statement GS. */
2658 static inline void
2659 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2661 GIMPLE_CHECK (gs, GIMPLE_CALL);
2662 gimple_set_op (gs, index + 3, arg);
2666 /* If TAIL_P is true, mark call statement S as being a tail call
2667 (i.e., a call just before the exit of a function). These calls are
2668 candidate for tail call optimization. */
2670 static inline void
2671 gimple_call_set_tail (gimple s, bool tail_p)
2673 GIMPLE_CHECK (s, GIMPLE_CALL);
2674 if (tail_p)
2675 s->subcode |= GF_CALL_TAILCALL;
2676 else
2677 s->subcode &= ~GF_CALL_TAILCALL;
2681 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2683 static inline bool
2684 gimple_call_tail_p (gimple s)
2686 GIMPLE_CHECK (s, GIMPLE_CALL);
2687 return (s->subcode & GF_CALL_TAILCALL) != 0;
2691 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2692 slot optimization. This transformation uses the target of the call
2693 expansion as the return slot for calls that return in memory. */
2695 static inline void
2696 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2698 GIMPLE_CHECK (s, GIMPLE_CALL);
2699 if (return_slot_opt_p)
2700 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2701 else
2702 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2706 /* Return true if S is marked for return slot optimization. */
2708 static inline bool
2709 gimple_call_return_slot_opt_p (gimple s)
2711 GIMPLE_CHECK (s, GIMPLE_CALL);
2712 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2716 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2717 thunk to the thunked-to function. */
2719 static inline void
2720 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2722 GIMPLE_CHECK (s, GIMPLE_CALL);
2723 if (from_thunk_p)
2724 s->subcode |= GF_CALL_FROM_THUNK;
2725 else
2726 s->subcode &= ~GF_CALL_FROM_THUNK;
2730 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2732 static inline bool
2733 gimple_call_from_thunk_p (gimple s)
2735 GIMPLE_CHECK (s, GIMPLE_CALL);
2736 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2740 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2741 argument pack in its argument list. */
2743 static inline void
2744 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2746 GIMPLE_CHECK (s, GIMPLE_CALL);
2747 if (pass_arg_pack_p)
2748 s->subcode |= GF_CALL_VA_ARG_PACK;
2749 else
2750 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2754 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2755 argument pack in its argument list. */
2757 static inline bool
2758 gimple_call_va_arg_pack_p (gimple s)
2760 GIMPLE_CHECK (s, GIMPLE_CALL);
2761 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2765 /* Return true if S is a noreturn call. */
2767 static inline bool
2768 gimple_call_noreturn_p (gimple s)
2770 GIMPLE_CHECK (s, GIMPLE_CALL);
2771 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2775 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2776 even if the called function can throw in other cases. */
2778 static inline void
2779 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2781 GIMPLE_CHECK (s, GIMPLE_CALL);
2782 if (nothrow_p)
2783 s->subcode |= GF_CALL_NOTHROW;
2784 else
2785 s->subcode &= ~GF_CALL_NOTHROW;
2788 /* Return true if S is a nothrow call. */
2790 static inline bool
2791 gimple_call_nothrow_p (gimple s)
2793 GIMPLE_CHECK (s, GIMPLE_CALL);
2794 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2797 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2798 is known to be emitted for VLA objects. Those are wrapped by
2799 stack_save/stack_restore calls and hence can't lead to unbounded
2800 stack growth even when they occur in loops. */
2802 static inline void
2803 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2805 GIMPLE_CHECK (s, GIMPLE_CALL);
2806 if (for_var)
2807 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2808 else
2809 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2812 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2814 static inline bool
2815 gimple_call_alloca_for_var_p (gimple s)
2817 GIMPLE_CHECK (s, GIMPLE_CALL);
2818 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2821 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2823 static inline void
2824 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2826 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2827 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2828 dest_call->subcode = orig_call->subcode;
2832 /* Return a pointer to the points-to solution for the set of call-used
2833 variables of the call CALL. */
2835 static inline struct pt_solution *
2836 gimple_call_use_set (gimple call)
2838 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2839 return &call_stmt->call_used;
2843 /* Return a pointer to the points-to solution for the set of call-used
2844 variables of the call CALL. */
2846 static inline struct pt_solution *
2847 gimple_call_clobber_set (gimple call)
2849 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2850 return &call_stmt->call_clobbered;
2854 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2855 non-NULL lhs. */
2857 static inline bool
2858 gimple_has_lhs (gimple stmt)
2860 return (is_gimple_assign (stmt)
2861 || (is_gimple_call (stmt)
2862 && gimple_call_lhs (stmt) != NULL_TREE));
2866 /* Return the code of the predicate computed by conditional statement GS. */
2868 static inline enum tree_code
2869 gimple_cond_code (const_gimple gs)
2871 GIMPLE_CHECK (gs, GIMPLE_COND);
2872 return (enum tree_code) gs->subcode;
2876 /* Set CODE to be the predicate code for the conditional statement GS. */
2878 static inline void
2879 gimple_cond_set_code (gimple gs, enum tree_code code)
2881 GIMPLE_CHECK (gs, GIMPLE_COND);
2882 gs->subcode = code;
2886 /* Return the LHS of the predicate computed by conditional statement GS. */
2888 static inline tree
2889 gimple_cond_lhs (const_gimple gs)
2891 GIMPLE_CHECK (gs, GIMPLE_COND);
2892 return gimple_op (gs, 0);
2895 /* Return the pointer to the LHS of the predicate computed by conditional
2896 statement GS. */
2898 static inline tree *
2899 gimple_cond_lhs_ptr (const_gimple gs)
2901 GIMPLE_CHECK (gs, GIMPLE_COND);
2902 return gimple_op_ptr (gs, 0);
2905 /* Set LHS to be the LHS operand of the predicate computed by
2906 conditional statement GS. */
2908 static inline void
2909 gimple_cond_set_lhs (gimple gs, tree lhs)
2911 GIMPLE_CHECK (gs, GIMPLE_COND);
2912 gimple_set_op (gs, 0, lhs);
2916 /* Return the RHS operand of the predicate computed by conditional GS. */
2918 static inline tree
2919 gimple_cond_rhs (const_gimple gs)
2921 GIMPLE_CHECK (gs, GIMPLE_COND);
2922 return gimple_op (gs, 1);
2925 /* Return the pointer to the RHS operand of the predicate computed by
2926 conditional GS. */
2928 static inline tree *
2929 gimple_cond_rhs_ptr (const_gimple gs)
2931 GIMPLE_CHECK (gs, GIMPLE_COND);
2932 return gimple_op_ptr (gs, 1);
2936 /* Set RHS to be the RHS operand of the predicate computed by
2937 conditional statement GS. */
2939 static inline void
2940 gimple_cond_set_rhs (gimple gs, tree rhs)
2942 GIMPLE_CHECK (gs, GIMPLE_COND);
2943 gimple_set_op (gs, 1, rhs);
2947 /* Return the label used by conditional statement GS when its
2948 predicate evaluates to true. */
2950 static inline tree
2951 gimple_cond_true_label (const_gimple gs)
2953 GIMPLE_CHECK (gs, GIMPLE_COND);
2954 return gimple_op (gs, 2);
2958 /* Set LABEL to be the label used by conditional statement GS when its
2959 predicate evaluates to true. */
2961 static inline void
2962 gimple_cond_set_true_label (gimple gs, tree label)
2964 GIMPLE_CHECK (gs, GIMPLE_COND);
2965 gimple_set_op (gs, 2, label);
2969 /* Set LABEL to be the label used by conditional statement GS when its
2970 predicate evaluates to false. */
2972 static inline void
2973 gimple_cond_set_false_label (gimple gs, tree label)
2975 GIMPLE_CHECK (gs, GIMPLE_COND);
2976 gimple_set_op (gs, 3, label);
2980 /* Return the label used by conditional statement GS when its
2981 predicate evaluates to false. */
2983 static inline tree
2984 gimple_cond_false_label (const_gimple gs)
2986 GIMPLE_CHECK (gs, GIMPLE_COND);
2987 return gimple_op (gs, 3);
2991 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2993 static inline void
2994 gimple_cond_make_false (gimple gs)
2996 gimple_cond_set_lhs (gs, boolean_true_node);
2997 gimple_cond_set_rhs (gs, boolean_false_node);
2998 gs->subcode = EQ_EXPR;
3002 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3004 static inline void
3005 gimple_cond_make_true (gimple gs)
3007 gimple_cond_set_lhs (gs, boolean_true_node);
3008 gimple_cond_set_rhs (gs, boolean_true_node);
3009 gs->subcode = EQ_EXPR;
3012 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3013 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3015 static inline bool
3016 gimple_cond_true_p (const_gimple gs)
3018 tree lhs = gimple_cond_lhs (gs);
3019 tree rhs = gimple_cond_rhs (gs);
3020 enum tree_code code = gimple_cond_code (gs);
3022 if (lhs != boolean_true_node && lhs != boolean_false_node)
3023 return false;
3025 if (rhs != boolean_true_node && rhs != boolean_false_node)
3026 return false;
3028 if (code == NE_EXPR && lhs != rhs)
3029 return true;
3031 if (code == EQ_EXPR && lhs == rhs)
3032 return true;
3034 return false;
3037 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3038 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3040 static inline bool
3041 gimple_cond_false_p (const_gimple gs)
3043 tree lhs = gimple_cond_lhs (gs);
3044 tree rhs = gimple_cond_rhs (gs);
3045 enum tree_code code = gimple_cond_code (gs);
3047 if (lhs != boolean_true_node && lhs != boolean_false_node)
3048 return false;
3050 if (rhs != boolean_true_node && rhs != boolean_false_node)
3051 return false;
3053 if (code == NE_EXPR && lhs == rhs)
3054 return true;
3056 if (code == EQ_EXPR && lhs != rhs)
3057 return true;
3059 return false;
3062 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3064 static inline void
3065 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3067 gimple_cond_set_code (stmt, code);
3068 gimple_cond_set_lhs (stmt, lhs);
3069 gimple_cond_set_rhs (stmt, rhs);
3072 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3074 static inline tree
3075 gimple_label_label (const_gimple gs)
3077 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3078 return gimple_op (gs, 0);
3082 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3083 GS. */
3085 static inline void
3086 gimple_label_set_label (gimple gs, tree label)
3088 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3089 gimple_set_op (gs, 0, label);
3093 /* Return the destination of the unconditional jump GS. */
3095 static inline tree
3096 gimple_goto_dest (const_gimple gs)
3098 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3099 return gimple_op (gs, 0);
3103 /* Set DEST to be the destination of the unconditonal jump GS. */
3105 static inline void
3106 gimple_goto_set_dest (gimple gs, tree dest)
3108 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3109 gimple_set_op (gs, 0, dest);
3113 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3115 static inline tree
3116 gimple_bind_vars (const_gimple gs)
3118 const gimple_statement_bind *bind_stmt =
3119 as_a <const gimple_statement_bind *> (gs);
3120 return bind_stmt->vars;
3124 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3125 statement GS. */
3127 static inline void
3128 gimple_bind_set_vars (gimple gs, tree vars)
3130 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3131 bind_stmt->vars = vars;
3135 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3136 statement GS. */
3138 static inline void
3139 gimple_bind_append_vars (gimple gs, tree vars)
3141 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3142 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3146 static inline gimple_seq *
3147 gimple_bind_body_ptr (gimple gs)
3149 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3150 return &bind_stmt->body;
3153 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3155 static inline gimple_seq
3156 gimple_bind_body (gimple gs)
3158 return *gimple_bind_body_ptr (gs);
3162 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3163 statement GS. */
3165 static inline void
3166 gimple_bind_set_body (gimple gs, gimple_seq seq)
3168 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3169 bind_stmt->body = seq;
3173 /* Append a statement to the end of a GIMPLE_BIND's body. */
3175 static inline void
3176 gimple_bind_add_stmt (gimple gs, gimple stmt)
3178 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3179 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3183 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3185 static inline void
3186 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3188 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3189 gimple_seq_add_seq (&bind_stmt->body, seq);
3193 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3194 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3196 static inline tree
3197 gimple_bind_block (const_gimple gs)
3199 const gimple_statement_bind *bind_stmt =
3200 as_a <const gimple_statement_bind *> (gs);
3201 return bind_stmt->block;
3205 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3206 statement GS. */
3208 static inline void
3209 gimple_bind_set_block (gimple gs, tree block)
3211 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3212 gcc_gimple_checking_assert (block == NULL_TREE
3213 || TREE_CODE (block) == BLOCK);
3214 bind_stmt->block = block;
3218 /* Return the number of input operands for GIMPLE_ASM GS. */
3220 static inline unsigned
3221 gimple_asm_ninputs (const_gimple gs)
3223 const gimple_statement_asm *asm_stmt =
3224 as_a <const gimple_statement_asm *> (gs);
3225 return asm_stmt->ni;
3229 /* Return the number of output operands for GIMPLE_ASM GS. */
3231 static inline unsigned
3232 gimple_asm_noutputs (const_gimple gs)
3234 const gimple_statement_asm *asm_stmt =
3235 as_a <const gimple_statement_asm *> (gs);
3236 return asm_stmt->no;
3240 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3242 static inline unsigned
3243 gimple_asm_nclobbers (const_gimple gs)
3245 const gimple_statement_asm *asm_stmt =
3246 as_a <const gimple_statement_asm *> (gs);
3247 return asm_stmt->nc;
3250 /* Return the number of label operands for GIMPLE_ASM GS. */
3252 static inline unsigned
3253 gimple_asm_nlabels (const_gimple gs)
3255 const gimple_statement_asm *asm_stmt =
3256 as_a <const gimple_statement_asm *> (gs);
3257 return asm_stmt->nl;
3260 /* Return input operand INDEX of GIMPLE_ASM GS. */
3262 static inline tree
3263 gimple_asm_input_op (const_gimple gs, unsigned index)
3265 const gimple_statement_asm *asm_stmt =
3266 as_a <const gimple_statement_asm *> (gs);
3267 gcc_gimple_checking_assert (index < asm_stmt->ni);
3268 return gimple_op (gs, index + asm_stmt->no);
3271 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3273 static inline tree *
3274 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3276 const gimple_statement_asm *asm_stmt =
3277 as_a <const gimple_statement_asm *> (gs);
3278 gcc_gimple_checking_assert (index < asm_stmt->ni);
3279 return gimple_op_ptr (gs, index + asm_stmt->no);
3283 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3285 static inline void
3286 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3288 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3289 gcc_gimple_checking_assert (index < asm_stmt->ni
3290 && TREE_CODE (in_op) == TREE_LIST);
3291 gimple_set_op (gs, index + asm_stmt->no, in_op);
3295 /* Return output operand INDEX of GIMPLE_ASM GS. */
3297 static inline tree
3298 gimple_asm_output_op (const_gimple gs, unsigned index)
3300 const gimple_statement_asm *asm_stmt =
3301 as_a <const gimple_statement_asm *> (gs);
3302 gcc_gimple_checking_assert (index < asm_stmt->no);
3303 return gimple_op (gs, index);
3306 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3308 static inline tree *
3309 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3311 const gimple_statement_asm *asm_stmt =
3312 as_a <const gimple_statement_asm *> (gs);
3313 gcc_gimple_checking_assert (index < asm_stmt->no);
3314 return gimple_op_ptr (gs, index);
3318 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3320 static inline void
3321 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3323 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3324 gcc_gimple_checking_assert (index < asm_stmt->no
3325 && TREE_CODE (out_op) == TREE_LIST);
3326 gimple_set_op (gs, index, out_op);
3330 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3332 static inline tree
3333 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3335 const gimple_statement_asm *asm_stmt =
3336 as_a <const gimple_statement_asm *> (gs);
3337 gcc_gimple_checking_assert (index < asm_stmt->nc);
3338 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3342 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3344 static inline void
3345 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3347 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3348 gcc_gimple_checking_assert (index < asm_stmt->nc
3349 && TREE_CODE (clobber_op) == TREE_LIST);
3350 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3353 /* Return label operand INDEX of GIMPLE_ASM GS. */
3355 static inline tree
3356 gimple_asm_label_op (const_gimple gs, unsigned index)
3358 const gimple_statement_asm *asm_stmt =
3359 as_a <const gimple_statement_asm *> (gs);
3360 gcc_gimple_checking_assert (index < asm_stmt->nl);
3361 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3364 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3366 static inline void
3367 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3369 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3370 gcc_gimple_checking_assert (index < asm_stmt->nl
3371 && TREE_CODE (label_op) == TREE_LIST);
3372 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3375 /* Return the string representing the assembly instruction in
3376 GIMPLE_ASM GS. */
3378 static inline const char *
3379 gimple_asm_string (const_gimple gs)
3381 const gimple_statement_asm *asm_stmt =
3382 as_a <const gimple_statement_asm *> (gs);
3383 return asm_stmt->string;
3387 /* Return true if GS is an asm statement marked volatile. */
3389 static inline bool
3390 gimple_asm_volatile_p (const_gimple gs)
3392 GIMPLE_CHECK (gs, GIMPLE_ASM);
3393 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3397 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3399 static inline void
3400 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3402 GIMPLE_CHECK (gs, GIMPLE_ASM);
3403 if (volatile_p)
3404 gs->subcode |= GF_ASM_VOLATILE;
3405 else
3406 gs->subcode &= ~GF_ASM_VOLATILE;
3410 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3412 static inline void
3413 gimple_asm_set_input (gimple gs, bool input_p)
3415 GIMPLE_CHECK (gs, GIMPLE_ASM);
3416 if (input_p)
3417 gs->subcode |= GF_ASM_INPUT;
3418 else
3419 gs->subcode &= ~GF_ASM_INPUT;
3423 /* Return true if asm GS is an ASM_INPUT. */
3425 static inline bool
3426 gimple_asm_input_p (const_gimple gs)
3428 GIMPLE_CHECK (gs, GIMPLE_ASM);
3429 return (gs->subcode & GF_ASM_INPUT) != 0;
3433 /* Return the types handled by GIMPLE_CATCH statement GS. */
3435 static inline tree
3436 gimple_catch_types (const_gimple gs)
3438 const gimple_statement_catch *catch_stmt =
3439 as_a <const gimple_statement_catch *> (gs);
3440 return catch_stmt->types;
3444 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3446 static inline tree *
3447 gimple_catch_types_ptr (gimple gs)
3449 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3450 return &catch_stmt->types;
3454 /* Return a pointer to the GIMPLE sequence representing the body of
3455 the handler of GIMPLE_CATCH statement GS. */
3457 static inline gimple_seq *
3458 gimple_catch_handler_ptr (gimple gs)
3460 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3461 return &catch_stmt->handler;
3465 /* Return the GIMPLE sequence representing the body of the handler of
3466 GIMPLE_CATCH statement GS. */
3468 static inline gimple_seq
3469 gimple_catch_handler (gimple gs)
3471 return *gimple_catch_handler_ptr (gs);
3475 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3477 static inline void
3478 gimple_catch_set_types (gimple gs, tree t)
3480 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3481 catch_stmt->types = t;
3485 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3487 static inline void
3488 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3490 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3491 catch_stmt->handler = handler;
3495 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3497 static inline tree
3498 gimple_eh_filter_types (const_gimple gs)
3500 const gimple_statement_eh_filter *eh_filter_stmt =
3501 as_a <const gimple_statement_eh_filter *> (gs);
3502 return eh_filter_stmt->types;
3506 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3507 GS. */
3509 static inline tree *
3510 gimple_eh_filter_types_ptr (gimple gs)
3512 gimple_statement_eh_filter *eh_filter_stmt =
3513 as_a <gimple_statement_eh_filter *> (gs);
3514 return &eh_filter_stmt->types;
3518 /* Return a pointer to the sequence of statement to execute when
3519 GIMPLE_EH_FILTER statement fails. */
3521 static inline gimple_seq *
3522 gimple_eh_filter_failure_ptr (gimple gs)
3524 gimple_statement_eh_filter *eh_filter_stmt =
3525 as_a <gimple_statement_eh_filter *> (gs);
3526 return &eh_filter_stmt->failure;
3530 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3531 statement fails. */
3533 static inline gimple_seq
3534 gimple_eh_filter_failure (gimple gs)
3536 return *gimple_eh_filter_failure_ptr (gs);
3540 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3542 static inline void
3543 gimple_eh_filter_set_types (gimple gs, tree types)
3545 gimple_statement_eh_filter *eh_filter_stmt =
3546 as_a <gimple_statement_eh_filter *> (gs);
3547 eh_filter_stmt->types = types;
3551 /* Set FAILURE to be the sequence of statements to execute on failure
3552 for GIMPLE_EH_FILTER GS. */
3554 static inline void
3555 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3557 gimple_statement_eh_filter *eh_filter_stmt =
3558 as_a <gimple_statement_eh_filter *> (gs);
3559 eh_filter_stmt->failure = failure;
3562 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3564 static inline tree
3565 gimple_eh_must_not_throw_fndecl (gimple gs)
3567 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3568 return eh_mnt_stmt->fndecl;
3571 /* Set the function decl to be called by GS to DECL. */
3573 static inline void
3574 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3576 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3577 eh_mnt_stmt->fndecl = decl;
3580 /* GIMPLE_EH_ELSE accessors. */
3582 static inline gimple_seq *
3583 gimple_eh_else_n_body_ptr (gimple gs)
3585 gimple_statement_eh_else *eh_else_stmt =
3586 as_a <gimple_statement_eh_else *> (gs);
3587 return &eh_else_stmt->n_body;
3590 static inline gimple_seq
3591 gimple_eh_else_n_body (gimple gs)
3593 return *gimple_eh_else_n_body_ptr (gs);
3596 static inline gimple_seq *
3597 gimple_eh_else_e_body_ptr (gimple gs)
3599 gimple_statement_eh_else *eh_else_stmt =
3600 as_a <gimple_statement_eh_else *> (gs);
3601 return &eh_else_stmt->e_body;
3604 static inline gimple_seq
3605 gimple_eh_else_e_body (gimple gs)
3607 return *gimple_eh_else_e_body_ptr (gs);
3610 static inline void
3611 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3613 gimple_statement_eh_else *eh_else_stmt =
3614 as_a <gimple_statement_eh_else *> (gs);
3615 eh_else_stmt->n_body = seq;
3618 static inline void
3619 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3621 gimple_statement_eh_else *eh_else_stmt =
3622 as_a <gimple_statement_eh_else *> (gs);
3623 eh_else_stmt->e_body = seq;
3626 /* GIMPLE_TRY accessors. */
3628 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3629 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3631 static inline enum gimple_try_flags
3632 gimple_try_kind (const_gimple gs)
3634 GIMPLE_CHECK (gs, GIMPLE_TRY);
3635 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3639 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3641 static inline void
3642 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3644 GIMPLE_CHECK (gs, GIMPLE_TRY);
3645 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3646 || kind == GIMPLE_TRY_FINALLY);
3647 if (gimple_try_kind (gs) != kind)
3648 gs->subcode = (unsigned int) kind;
3652 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3654 static inline bool
3655 gimple_try_catch_is_cleanup (const_gimple gs)
3657 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3658 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3662 /* Return a pointer to the sequence of statements used as the
3663 body for GIMPLE_TRY GS. */
3665 static inline gimple_seq *
3666 gimple_try_eval_ptr (gimple gs)
3668 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3669 return &try_stmt->eval;
3673 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3675 static inline gimple_seq
3676 gimple_try_eval (gimple gs)
3678 return *gimple_try_eval_ptr (gs);
3682 /* Return a pointer to the sequence of statements used as the cleanup body for
3683 GIMPLE_TRY GS. */
3685 static inline gimple_seq *
3686 gimple_try_cleanup_ptr (gimple gs)
3688 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3689 return &try_stmt->cleanup;
3693 /* Return the sequence of statements used as the cleanup body for
3694 GIMPLE_TRY GS. */
3696 static inline gimple_seq
3697 gimple_try_cleanup (gimple gs)
3699 return *gimple_try_cleanup_ptr (gs);
3703 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3705 static inline void
3706 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3708 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3709 if (catch_is_cleanup)
3710 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3711 else
3712 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3716 /* Set EVAL to be the sequence of statements to use as the body for
3717 GIMPLE_TRY GS. */
3719 static inline void
3720 gimple_try_set_eval (gimple gs, gimple_seq eval)
3722 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3723 try_stmt->eval = eval;
3727 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3728 body for GIMPLE_TRY GS. */
3730 static inline void
3731 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3733 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3734 try_stmt->cleanup = cleanup;
3738 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3740 static inline gimple_seq *
3741 gimple_wce_cleanup_ptr (gimple gs)
3743 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3744 return &wce_stmt->cleanup;
3748 /* Return the cleanup sequence for cleanup statement GS. */
3750 static inline gimple_seq
3751 gimple_wce_cleanup (gimple gs)
3753 return *gimple_wce_cleanup_ptr (gs);
3757 /* Set CLEANUP to be the cleanup sequence for GS. */
3759 static inline void
3760 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3762 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3763 wce_stmt->cleanup = cleanup;
3767 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3769 static inline bool
3770 gimple_wce_cleanup_eh_only (const_gimple gs)
3772 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3773 return gs->subcode != 0;
3777 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3779 static inline void
3780 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3782 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3783 gs->subcode = (unsigned int) eh_only_p;
3787 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3789 static inline unsigned
3790 gimple_phi_capacity (const_gimple gs)
3792 const gimple_statement_phi *phi_stmt =
3793 as_a <const gimple_statement_phi *> (gs);
3794 return phi_stmt->capacity;
3798 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3799 be exactly the number of incoming edges for the basic block holding
3800 GS. */
3802 static inline unsigned
3803 gimple_phi_num_args (const_gimple gs)
3805 const gimple_statement_phi *phi_stmt =
3806 as_a <const gimple_statement_phi *> (gs);
3807 return phi_stmt->nargs;
3811 /* Return the SSA name created by GIMPLE_PHI GS. */
3813 static inline tree
3814 gimple_phi_result (const_gimple gs)
3816 const gimple_statement_phi *phi_stmt =
3817 as_a <const gimple_statement_phi *> (gs);
3818 return phi_stmt->result;
3821 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3823 static inline tree *
3824 gimple_phi_result_ptr (gimple gs)
3826 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3827 return &phi_stmt->result;
3830 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3832 static inline void
3833 gimple_phi_set_result (gimple gs, tree result)
3835 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3836 phi_stmt->result = result;
3837 if (result && TREE_CODE (result) == SSA_NAME)
3838 SSA_NAME_DEF_STMT (result) = gs;
3842 /* Return the PHI argument corresponding to incoming edge INDEX for
3843 GIMPLE_PHI GS. */
3845 static inline struct phi_arg_d *
3846 gimple_phi_arg (gimple gs, unsigned index)
3848 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3849 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3850 return &(phi_stmt->args[index]);
3853 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3854 for GIMPLE_PHI GS. */
3856 static inline void
3857 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3859 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3860 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3861 phi_stmt->args[index] = *phiarg;
3864 /* Return the PHI nodes for basic block BB, or NULL if there are no
3865 PHI nodes. */
3867 static inline gimple_seq
3868 phi_nodes (const_basic_block bb)
3870 gcc_checking_assert (!(bb->flags & BB_RTL));
3871 return bb->il.gimple.phi_nodes;
3874 /* Return a pointer to the PHI nodes for basic block BB. */
3876 static inline gimple_seq *
3877 phi_nodes_ptr (basic_block bb)
3879 gcc_checking_assert (!(bb->flags & BB_RTL));
3880 return &bb->il.gimple.phi_nodes;
3883 /* Return the tree operand for argument I of PHI node GS. */
3885 static inline tree
3886 gimple_phi_arg_def (gimple gs, size_t index)
3888 return gimple_phi_arg (gs, index)->def;
3892 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3894 static inline tree *
3895 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3897 return &gimple_phi_arg (gs, index)->def;
3900 /* Return the edge associated with argument I of phi node GS. */
3902 static inline edge
3903 gimple_phi_arg_edge (gimple gs, size_t i)
3905 return EDGE_PRED (gimple_bb (gs), i);
3908 /* Return the source location of gimple argument I of phi node GS. */
3910 static inline source_location
3911 gimple_phi_arg_location (gimple gs, size_t i)
3913 return gimple_phi_arg (gs, i)->locus;
3916 /* Return the source location of the argument on edge E of phi node GS. */
3918 static inline source_location
3919 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3921 return gimple_phi_arg (gs, e->dest_idx)->locus;
3924 /* Set the source location of gimple argument I of phi node GS to LOC. */
3926 static inline void
3927 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3929 gimple_phi_arg (gs, i)->locus = loc;
3932 /* Return TRUE if argument I of phi node GS has a location record. */
3934 static inline bool
3935 gimple_phi_arg_has_location (gimple gs, size_t i)
3937 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3941 /* Return the region number for GIMPLE_RESX GS. */
3943 static inline int
3944 gimple_resx_region (const_gimple gs)
3946 const gimple_statement_resx *resx_stmt =
3947 as_a <const gimple_statement_resx *> (gs);
3948 return resx_stmt->region;
3951 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3953 static inline void
3954 gimple_resx_set_region (gimple gs, int region)
3956 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
3957 resx_stmt->region = region;
3960 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3962 static inline int
3963 gimple_eh_dispatch_region (const_gimple gs)
3965 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3966 as_a <const gimple_statement_eh_dispatch *> (gs);
3967 return eh_dispatch_stmt->region;
3970 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3972 static inline void
3973 gimple_eh_dispatch_set_region (gimple gs, int region)
3975 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3976 as_a <gimple_statement_eh_dispatch *> (gs);
3977 eh_dispatch_stmt->region = region;
3980 /* Return the number of labels associated with the switch statement GS. */
3982 static inline unsigned
3983 gimple_switch_num_labels (const_gimple gs)
3985 unsigned num_ops;
3986 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3987 num_ops = gimple_num_ops (gs);
3988 gcc_gimple_checking_assert (num_ops > 1);
3989 return num_ops - 1;
3993 /* Set NLABELS to be the number of labels for the switch statement GS. */
3995 static inline void
3996 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3998 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3999 gimple_set_num_ops (g, nlabels + 1);
4003 /* Return the index variable used by the switch statement GS. */
4005 static inline tree
4006 gimple_switch_index (const_gimple gs)
4008 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4009 return gimple_op (gs, 0);
4013 /* Return a pointer to the index variable for the switch statement GS. */
4015 static inline tree *
4016 gimple_switch_index_ptr (const_gimple gs)
4018 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4019 return gimple_op_ptr (gs, 0);
4023 /* Set INDEX to be the index variable for switch statement GS. */
4025 static inline void
4026 gimple_switch_set_index (gimple gs, tree index)
4028 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4029 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4030 gimple_set_op (gs, 0, index);
4034 /* Return the label numbered INDEX. The default label is 0, followed by any
4035 labels in a switch statement. */
4037 static inline tree
4038 gimple_switch_label (const_gimple gs, unsigned index)
4040 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4041 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4042 return gimple_op (gs, index + 1);
4045 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4047 static inline void
4048 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4050 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4051 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4052 && (label == NULL_TREE
4053 || TREE_CODE (label) == CASE_LABEL_EXPR));
4054 gimple_set_op (gs, index + 1, label);
4057 /* Return the default label for a switch statement. */
4059 static inline tree
4060 gimple_switch_default_label (const_gimple gs)
4062 tree label = gimple_switch_label (gs, 0);
4063 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4064 return label;
4067 /* Set the default label for a switch statement. */
4069 static inline void
4070 gimple_switch_set_default_label (gimple gs, tree label)
4072 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4073 gimple_switch_set_label (gs, 0, label);
4076 /* Return true if GS is a GIMPLE_DEBUG statement. */
4078 static inline bool
4079 is_gimple_debug (const_gimple gs)
4081 return gimple_code (gs) == GIMPLE_DEBUG;
4084 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4086 static inline bool
4087 gimple_debug_bind_p (const_gimple s)
4089 if (is_gimple_debug (s))
4090 return s->subcode == GIMPLE_DEBUG_BIND;
4092 return false;
4095 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4097 static inline tree
4098 gimple_debug_bind_get_var (gimple dbg)
4100 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4101 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4102 return gimple_op (dbg, 0);
4105 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4106 statement. */
4108 static inline tree
4109 gimple_debug_bind_get_value (gimple dbg)
4111 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4112 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4113 return gimple_op (dbg, 1);
4116 /* Return a pointer to the value bound to the variable in a
4117 GIMPLE_DEBUG bind statement. */
4119 static inline tree *
4120 gimple_debug_bind_get_value_ptr (gimple dbg)
4122 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4123 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4124 return gimple_op_ptr (dbg, 1);
4127 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4129 static inline void
4130 gimple_debug_bind_set_var (gimple dbg, tree var)
4132 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4133 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4134 gimple_set_op (dbg, 0, var);
4137 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4138 statement. */
4140 static inline void
4141 gimple_debug_bind_set_value (gimple dbg, tree value)
4143 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4144 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4145 gimple_set_op (dbg, 1, value);
4148 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4149 optimized away. */
4150 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4152 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4153 statement. */
4155 static inline void
4156 gimple_debug_bind_reset_value (gimple dbg)
4158 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4159 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4160 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4163 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4164 value. */
4166 static inline bool
4167 gimple_debug_bind_has_value_p (gimple dbg)
4169 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4170 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4171 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4174 #undef GIMPLE_DEBUG_BIND_NOVALUE
4176 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4178 static inline bool
4179 gimple_debug_source_bind_p (const_gimple s)
4181 if (is_gimple_debug (s))
4182 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4184 return false;
4187 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4189 static inline tree
4190 gimple_debug_source_bind_get_var (gimple dbg)
4192 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4193 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4194 return gimple_op (dbg, 0);
4197 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4198 statement. */
4200 static inline tree
4201 gimple_debug_source_bind_get_value (gimple dbg)
4203 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4204 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4205 return gimple_op (dbg, 1);
4208 /* Return a pointer to the value bound to the variable in a
4209 GIMPLE_DEBUG source bind statement. */
4211 static inline tree *
4212 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4214 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4215 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4216 return gimple_op_ptr (dbg, 1);
4219 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4221 static inline void
4222 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4224 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4225 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4226 gimple_set_op (dbg, 0, var);
4229 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4230 statement. */
4232 static inline void
4233 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4235 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4236 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4237 gimple_set_op (dbg, 1, value);
4240 /* Return the line number for EXPR, or return -1 if we have no line
4241 number information for it. */
4242 static inline int
4243 get_lineno (const_gimple stmt)
4245 location_t loc;
4247 if (!stmt)
4248 return -1;
4250 loc = gimple_location (stmt);
4251 if (loc == UNKNOWN_LOCATION)
4252 return -1;
4254 return LOCATION_LINE (loc);
4257 /* Return a pointer to the body for the OMP statement GS. */
4259 static inline gimple_seq *
4260 gimple_omp_body_ptr (gimple gs)
4262 return &static_cast <gimple_statement_omp *> (gs)->body;
4265 /* Return the body for the OMP statement GS. */
4267 static inline gimple_seq
4268 gimple_omp_body (gimple gs)
4270 return *gimple_omp_body_ptr (gs);
4273 /* Set BODY to be the body for the OMP statement GS. */
4275 static inline void
4276 gimple_omp_set_body (gimple gs, gimple_seq body)
4278 static_cast <gimple_statement_omp *> (gs)->body = body;
4282 /* Return the name associated with OMP_CRITICAL statement GS. */
4284 static inline tree
4285 gimple_omp_critical_name (const_gimple gs)
4287 const gimple_statement_omp_critical *omp_critical_stmt =
4288 as_a <const gimple_statement_omp_critical *> (gs);
4289 return omp_critical_stmt->name;
4293 /* Return a pointer to the name associated with OMP critical statement GS. */
4295 static inline tree *
4296 gimple_omp_critical_name_ptr (gimple gs)
4298 gimple_statement_omp_critical *omp_critical_stmt =
4299 as_a <gimple_statement_omp_critical *> (gs);
4300 return &omp_critical_stmt->name;
4304 /* Set NAME to be the name associated with OMP critical statement GS. */
4306 static inline void
4307 gimple_omp_critical_set_name (gimple gs, tree name)
4309 gimple_statement_omp_critical *omp_critical_stmt =
4310 as_a <gimple_statement_omp_critical *> (gs);
4311 omp_critical_stmt->name = name;
4315 /* Return the kind of OMP for statemement. */
4317 static inline int
4318 gimple_omp_for_kind (const_gimple g)
4320 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4321 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4325 /* Set the OMP for kind. */
4327 static inline void
4328 gimple_omp_for_set_kind (gimple g, int kind)
4330 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4331 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4332 | (kind & GF_OMP_FOR_KIND_MASK);
4336 /* Return true if OMP for statement G has the
4337 GF_OMP_FOR_COMBINED flag set. */
4339 static inline bool
4340 gimple_omp_for_combined_p (const_gimple g)
4342 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4343 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4347 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4348 value of COMBINED_P. */
4350 static inline void
4351 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4353 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4354 if (combined_p)
4355 g->subcode |= GF_OMP_FOR_COMBINED;
4356 else
4357 g->subcode &= ~GF_OMP_FOR_COMBINED;
4361 /* Return true if OMP for statement G has the
4362 GF_OMP_FOR_COMBINED_INTO flag set. */
4364 static inline bool
4365 gimple_omp_for_combined_into_p (const_gimple g)
4367 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4368 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4372 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4373 value of COMBINED_P. */
4375 static inline void
4376 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4378 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4379 if (combined_p)
4380 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4381 else
4382 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4386 /* Return the clauses associated with OMP_FOR GS. */
4388 static inline tree
4389 gimple_omp_for_clauses (const_gimple gs)
4391 const gimple_statement_omp_for *omp_for_stmt =
4392 as_a <const gimple_statement_omp_for *> (gs);
4393 return omp_for_stmt->clauses;
4397 /* Return a pointer to the OMP_FOR GS. */
4399 static inline tree *
4400 gimple_omp_for_clauses_ptr (gimple gs)
4402 gimple_statement_omp_for *omp_for_stmt =
4403 as_a <gimple_statement_omp_for *> (gs);
4404 return &omp_for_stmt->clauses;
4408 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4410 static inline void
4411 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4413 gimple_statement_omp_for *omp_for_stmt =
4414 as_a <gimple_statement_omp_for *> (gs);
4415 omp_for_stmt->clauses = clauses;
4419 /* Get the collapse count of OMP_FOR GS. */
4421 static inline size_t
4422 gimple_omp_for_collapse (gimple gs)
4424 gimple_statement_omp_for *omp_for_stmt =
4425 as_a <gimple_statement_omp_for *> (gs);
4426 return omp_for_stmt->collapse;
4430 /* Return the index variable for OMP_FOR GS. */
4432 static inline tree
4433 gimple_omp_for_index (const_gimple gs, size_t i)
4435 const gimple_statement_omp_for *omp_for_stmt =
4436 as_a <const gimple_statement_omp_for *> (gs);
4437 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4438 return omp_for_stmt->iter[i].index;
4442 /* Return a pointer to the index variable for OMP_FOR GS. */
4444 static inline tree *
4445 gimple_omp_for_index_ptr (gimple gs, size_t i)
4447 gimple_statement_omp_for *omp_for_stmt =
4448 as_a <gimple_statement_omp_for *> (gs);
4449 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4450 return &omp_for_stmt->iter[i].index;
4454 /* Set INDEX to be the index variable for OMP_FOR GS. */
4456 static inline void
4457 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4459 gimple_statement_omp_for *omp_for_stmt =
4460 as_a <gimple_statement_omp_for *> (gs);
4461 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4462 omp_for_stmt->iter[i].index = index;
4466 /* Return the initial value for OMP_FOR GS. */
4468 static inline tree
4469 gimple_omp_for_initial (const_gimple gs, size_t i)
4471 const gimple_statement_omp_for *omp_for_stmt =
4472 as_a <const gimple_statement_omp_for *> (gs);
4473 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4474 return omp_for_stmt->iter[i].initial;
4478 /* Return a pointer to the initial value for OMP_FOR GS. */
4480 static inline tree *
4481 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4483 gimple_statement_omp_for *omp_for_stmt =
4484 as_a <gimple_statement_omp_for *> (gs);
4485 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4486 return &omp_for_stmt->iter[i].initial;
4490 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4492 static inline void
4493 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4495 gimple_statement_omp_for *omp_for_stmt =
4496 as_a <gimple_statement_omp_for *> (gs);
4497 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4498 omp_for_stmt->iter[i].initial = initial;
4502 /* Return the final value for OMP_FOR GS. */
4504 static inline tree
4505 gimple_omp_for_final (const_gimple gs, size_t i)
4507 const gimple_statement_omp_for *omp_for_stmt =
4508 as_a <const gimple_statement_omp_for *> (gs);
4509 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4510 return omp_for_stmt->iter[i].final;
4514 /* Return a pointer to the final value for OMP_FOR GS. */
4516 static inline tree *
4517 gimple_omp_for_final_ptr (gimple gs, size_t i)
4519 gimple_statement_omp_for *omp_for_stmt =
4520 as_a <gimple_statement_omp_for *> (gs);
4521 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4522 return &omp_for_stmt->iter[i].final;
4526 /* Set FINAL to be the final value for OMP_FOR GS. */
4528 static inline void
4529 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4531 gimple_statement_omp_for *omp_for_stmt =
4532 as_a <gimple_statement_omp_for *> (gs);
4533 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4534 omp_for_stmt->iter[i].final = final;
4538 /* Return the increment value for OMP_FOR GS. */
4540 static inline tree
4541 gimple_omp_for_incr (const_gimple gs, size_t i)
4543 const gimple_statement_omp_for *omp_for_stmt =
4544 as_a <const gimple_statement_omp_for *> (gs);
4545 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4546 return omp_for_stmt->iter[i].incr;
4550 /* Return a pointer to the increment value for OMP_FOR GS. */
4552 static inline tree *
4553 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4555 gimple_statement_omp_for *omp_for_stmt =
4556 as_a <gimple_statement_omp_for *> (gs);
4557 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4558 return &omp_for_stmt->iter[i].incr;
4562 /* Set INCR to be the increment value for OMP_FOR GS. */
4564 static inline void
4565 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4567 gimple_statement_omp_for *omp_for_stmt =
4568 as_a <gimple_statement_omp_for *> (gs);
4569 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4570 omp_for_stmt->iter[i].incr = incr;
4574 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4575 statement GS starts. */
4577 static inline gimple_seq *
4578 gimple_omp_for_pre_body_ptr (gimple gs)
4580 gimple_statement_omp_for *omp_for_stmt =
4581 as_a <gimple_statement_omp_for *> (gs);
4582 return &omp_for_stmt->pre_body;
4586 /* Return the sequence of statements to execute before the OMP_FOR
4587 statement GS starts. */
4589 static inline gimple_seq
4590 gimple_omp_for_pre_body (gimple gs)
4592 return *gimple_omp_for_pre_body_ptr (gs);
4596 /* Set PRE_BODY to be the sequence of statements to execute before the
4597 OMP_FOR statement GS starts. */
4599 static inline void
4600 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4602 gimple_statement_omp_for *omp_for_stmt =
4603 as_a <gimple_statement_omp_for *> (gs);
4604 omp_for_stmt->pre_body = pre_body;
4608 /* Return the clauses associated with OMP_PARALLEL GS. */
4610 static inline tree
4611 gimple_omp_parallel_clauses (const_gimple gs)
4613 const gimple_statement_omp_parallel *omp_parallel_stmt =
4614 as_a <const gimple_statement_omp_parallel *> (gs);
4615 return omp_parallel_stmt->clauses;
4619 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4621 static inline tree *
4622 gimple_omp_parallel_clauses_ptr (gimple gs)
4624 gimple_statement_omp_parallel *omp_parallel_stmt =
4625 as_a <gimple_statement_omp_parallel *> (gs);
4626 return &omp_parallel_stmt->clauses;
4630 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4631 GS. */
4633 static inline void
4634 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4636 gimple_statement_omp_parallel *omp_parallel_stmt =
4637 as_a <gimple_statement_omp_parallel *> (gs);
4638 omp_parallel_stmt->clauses = clauses;
4642 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4644 static inline tree
4645 gimple_omp_parallel_child_fn (const_gimple gs)
4647 const gimple_statement_omp_parallel *omp_parallel_stmt =
4648 as_a <const gimple_statement_omp_parallel *> (gs);
4649 return omp_parallel_stmt->child_fn;
4652 /* Return a pointer to the child function used to hold the body of
4653 OMP_PARALLEL GS. */
4655 static inline tree *
4656 gimple_omp_parallel_child_fn_ptr (gimple gs)
4658 gimple_statement_omp_parallel *omp_parallel_stmt =
4659 as_a <gimple_statement_omp_parallel *> (gs);
4660 return &omp_parallel_stmt->child_fn;
4664 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4666 static inline void
4667 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4669 gimple_statement_omp_parallel *omp_parallel_stmt =
4670 as_a <gimple_statement_omp_parallel *> (gs);
4671 omp_parallel_stmt->child_fn = child_fn;
4675 /* Return the artificial argument used to send variables and values
4676 from the parent to the children threads in OMP_PARALLEL GS. */
4678 static inline tree
4679 gimple_omp_parallel_data_arg (const_gimple gs)
4681 const gimple_statement_omp_parallel *omp_parallel_stmt =
4682 as_a <const gimple_statement_omp_parallel *> (gs);
4683 return omp_parallel_stmt->data_arg;
4687 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4689 static inline tree *
4690 gimple_omp_parallel_data_arg_ptr (gimple gs)
4692 gimple_statement_omp_parallel *omp_parallel_stmt =
4693 as_a <gimple_statement_omp_parallel *> (gs);
4694 return &omp_parallel_stmt->data_arg;
4698 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4700 static inline void
4701 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4703 gimple_statement_omp_parallel *omp_parallel_stmt =
4704 as_a <gimple_statement_omp_parallel *> (gs);
4705 omp_parallel_stmt->data_arg = data_arg;
4709 /* Return the clauses associated with OMP_TASK GS. */
4711 static inline tree
4712 gimple_omp_task_clauses (const_gimple gs)
4714 const gimple_statement_omp_task *omp_task_stmt =
4715 as_a <const gimple_statement_omp_task *> (gs);
4716 return omp_task_stmt->clauses;
4720 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4722 static inline tree *
4723 gimple_omp_task_clauses_ptr (gimple gs)
4725 gimple_statement_omp_task *omp_task_stmt =
4726 as_a <gimple_statement_omp_task *> (gs);
4727 return &omp_task_stmt->clauses;
4731 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4732 GS. */
4734 static inline void
4735 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4737 gimple_statement_omp_task *omp_task_stmt =
4738 as_a <gimple_statement_omp_task *> (gs);
4739 omp_task_stmt->clauses = clauses;
4743 /* Return the child function used to hold the body of OMP_TASK GS. */
4745 static inline tree
4746 gimple_omp_task_child_fn (const_gimple gs)
4748 const gimple_statement_omp_task *omp_task_stmt =
4749 as_a <const gimple_statement_omp_task *> (gs);
4750 return omp_task_stmt->child_fn;
4753 /* Return a pointer to the child function used to hold the body of
4754 OMP_TASK GS. */
4756 static inline tree *
4757 gimple_omp_task_child_fn_ptr (gimple gs)
4759 gimple_statement_omp_task *omp_task_stmt =
4760 as_a <gimple_statement_omp_task *> (gs);
4761 return &omp_task_stmt->child_fn;
4765 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4767 static inline void
4768 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4770 gimple_statement_omp_task *omp_task_stmt =
4771 as_a <gimple_statement_omp_task *> (gs);
4772 omp_task_stmt->child_fn = child_fn;
4776 /* Return the artificial argument used to send variables and values
4777 from the parent to the children threads in OMP_TASK GS. */
4779 static inline tree
4780 gimple_omp_task_data_arg (const_gimple gs)
4782 const gimple_statement_omp_task *omp_task_stmt =
4783 as_a <const gimple_statement_omp_task *> (gs);
4784 return omp_task_stmt->data_arg;
4788 /* Return a pointer to the data argument for OMP_TASK GS. */
4790 static inline tree *
4791 gimple_omp_task_data_arg_ptr (gimple gs)
4793 gimple_statement_omp_task *omp_task_stmt =
4794 as_a <gimple_statement_omp_task *> (gs);
4795 return &omp_task_stmt->data_arg;
4799 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4801 static inline void
4802 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4804 gimple_statement_omp_task *omp_task_stmt =
4805 as_a <gimple_statement_omp_task *> (gs);
4806 omp_task_stmt->data_arg = data_arg;
4810 /* Return the clauses associated with OMP_TASK GS. */
4812 static inline tree
4813 gimple_omp_taskreg_clauses (const_gimple gs)
4815 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4816 as_a <const gimple_statement_omp_taskreg *> (gs);
4817 return omp_taskreg_stmt->clauses;
4821 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4823 static inline tree *
4824 gimple_omp_taskreg_clauses_ptr (gimple gs)
4826 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4827 as_a <gimple_statement_omp_taskreg *> (gs);
4828 return &omp_taskreg_stmt->clauses;
4832 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4833 GS. */
4835 static inline void
4836 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4838 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4839 as_a <gimple_statement_omp_taskreg *> (gs);
4840 omp_taskreg_stmt->clauses = clauses;
4844 /* Return the child function used to hold the body of OMP_TASK GS. */
4846 static inline tree
4847 gimple_omp_taskreg_child_fn (const_gimple gs)
4849 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4850 as_a <const gimple_statement_omp_taskreg *> (gs);
4851 return omp_taskreg_stmt->child_fn;
4854 /* Return a pointer to the child function used to hold the body of
4855 OMP_TASK GS. */
4857 static inline tree *
4858 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4860 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4861 as_a <gimple_statement_omp_taskreg *> (gs);
4862 return &omp_taskreg_stmt->child_fn;
4866 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4868 static inline void
4869 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4871 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4872 as_a <gimple_statement_omp_taskreg *> (gs);
4873 omp_taskreg_stmt->child_fn = child_fn;
4877 /* Return the artificial argument used to send variables and values
4878 from the parent to the children threads in OMP_TASK GS. */
4880 static inline tree
4881 gimple_omp_taskreg_data_arg (const_gimple gs)
4883 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4884 as_a <const gimple_statement_omp_taskreg *> (gs);
4885 return omp_taskreg_stmt->data_arg;
4889 /* Return a pointer to the data argument for OMP_TASK GS. */
4891 static inline tree *
4892 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4894 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4895 as_a <gimple_statement_omp_taskreg *> (gs);
4896 return &omp_taskreg_stmt->data_arg;
4900 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4902 static inline void
4903 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4905 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4906 as_a <gimple_statement_omp_taskreg *> (gs);
4907 omp_taskreg_stmt->data_arg = data_arg;
4911 /* Return the copy function used to hold the body of OMP_TASK GS. */
4913 static inline tree
4914 gimple_omp_task_copy_fn (const_gimple gs)
4916 const gimple_statement_omp_task *omp_task_stmt =
4917 as_a <const gimple_statement_omp_task *> (gs);
4918 return omp_task_stmt->copy_fn;
4921 /* Return a pointer to the copy function used to hold the body of
4922 OMP_TASK GS. */
4924 static inline tree *
4925 gimple_omp_task_copy_fn_ptr (gimple gs)
4927 gimple_statement_omp_task *omp_task_stmt =
4928 as_a <gimple_statement_omp_task *> (gs);
4929 return &omp_task_stmt->copy_fn;
4933 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4935 static inline void
4936 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4938 gimple_statement_omp_task *omp_task_stmt =
4939 as_a <gimple_statement_omp_task *> (gs);
4940 omp_task_stmt->copy_fn = copy_fn;
4944 /* Return size of the data block in bytes in OMP_TASK GS. */
4946 static inline tree
4947 gimple_omp_task_arg_size (const_gimple gs)
4949 const gimple_statement_omp_task *omp_task_stmt =
4950 as_a <const gimple_statement_omp_task *> (gs);
4951 return omp_task_stmt->arg_size;
4955 /* Return a pointer to the data block size for OMP_TASK GS. */
4957 static inline tree *
4958 gimple_omp_task_arg_size_ptr (gimple gs)
4960 gimple_statement_omp_task *omp_task_stmt =
4961 as_a <gimple_statement_omp_task *> (gs);
4962 return &omp_task_stmt->arg_size;
4966 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4968 static inline void
4969 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4971 gimple_statement_omp_task *omp_task_stmt =
4972 as_a <gimple_statement_omp_task *> (gs);
4973 omp_task_stmt->arg_size = arg_size;
4977 /* Return align of the data block in bytes in OMP_TASK GS. */
4979 static inline tree
4980 gimple_omp_task_arg_align (const_gimple gs)
4982 const gimple_statement_omp_task *omp_task_stmt =
4983 as_a <const gimple_statement_omp_task *> (gs);
4984 return omp_task_stmt->arg_align;
4988 /* Return a pointer to the data block align for OMP_TASK GS. */
4990 static inline tree *
4991 gimple_omp_task_arg_align_ptr (gimple gs)
4993 gimple_statement_omp_task *omp_task_stmt =
4994 as_a <gimple_statement_omp_task *> (gs);
4995 return &omp_task_stmt->arg_align;
4999 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5001 static inline void
5002 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5004 gimple_statement_omp_task *omp_task_stmt =
5005 as_a <gimple_statement_omp_task *> (gs);
5006 omp_task_stmt->arg_align = arg_align;
5010 /* Return the clauses associated with OMP_SINGLE GS. */
5012 static inline tree
5013 gimple_omp_single_clauses (const_gimple gs)
5015 const gimple_statement_omp_single *omp_single_stmt =
5016 as_a <const gimple_statement_omp_single *> (gs);
5017 return omp_single_stmt->clauses;
5021 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5023 static inline tree *
5024 gimple_omp_single_clauses_ptr (gimple gs)
5026 gimple_statement_omp_single *omp_single_stmt =
5027 as_a <gimple_statement_omp_single *> (gs);
5028 return &omp_single_stmt->clauses;
5032 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5034 static inline void
5035 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5037 gimple_statement_omp_single *omp_single_stmt =
5038 as_a <gimple_statement_omp_single *> (gs);
5039 omp_single_stmt->clauses = clauses;
5043 /* Return the clauses associated with OMP_TARGET GS. */
5045 static inline tree
5046 gimple_omp_target_clauses (const_gimple gs)
5048 const gimple_statement_omp_target *omp_target_stmt =
5049 as_a <const gimple_statement_omp_target *> (gs);
5050 return omp_target_stmt->clauses;
5054 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5056 static inline tree *
5057 gimple_omp_target_clauses_ptr (gimple gs)
5059 gimple_statement_omp_target *omp_target_stmt =
5060 as_a <gimple_statement_omp_target *> (gs);
5061 return &omp_target_stmt->clauses;
5065 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5067 static inline void
5068 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5070 gimple_statement_omp_target *omp_target_stmt =
5071 as_a <gimple_statement_omp_target *> (gs);
5072 omp_target_stmt->clauses = clauses;
5076 /* Return the kind of OMP target statemement. */
5078 static inline int
5079 gimple_omp_target_kind (const_gimple g)
5081 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5082 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5086 /* Set the OMP target kind. */
5088 static inline void
5089 gimple_omp_target_set_kind (gimple g, int kind)
5091 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5092 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5093 | (kind & GF_OMP_TARGET_KIND_MASK);
5097 /* Return the child function used to hold the body of OMP_TARGET GS. */
5099 static inline tree
5100 gimple_omp_target_child_fn (const_gimple gs)
5102 const gimple_statement_omp_target *omp_target_stmt =
5103 as_a <const gimple_statement_omp_target *> (gs);
5104 return omp_target_stmt->child_fn;
5107 /* Return a pointer to the child function used to hold the body of
5108 OMP_TARGET GS. */
5110 static inline tree *
5111 gimple_omp_target_child_fn_ptr (gimple gs)
5113 gimple_statement_omp_target *omp_target_stmt =
5114 as_a <gimple_statement_omp_target *> (gs);
5115 return &omp_target_stmt->child_fn;
5119 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5121 static inline void
5122 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5124 gimple_statement_omp_target *omp_target_stmt =
5125 as_a <gimple_statement_omp_target *> (gs);
5126 omp_target_stmt->child_fn = child_fn;
5130 /* Return the artificial argument used to send variables and values
5131 from the parent to the children threads in OMP_TARGET GS. */
5133 static inline tree
5134 gimple_omp_target_data_arg (const_gimple gs)
5136 const gimple_statement_omp_target *omp_target_stmt =
5137 as_a <const gimple_statement_omp_target *> (gs);
5138 return omp_target_stmt->data_arg;
5142 /* Return a pointer to the data argument for OMP_TARGET GS. */
5144 static inline tree *
5145 gimple_omp_target_data_arg_ptr (gimple gs)
5147 gimple_statement_omp_target *omp_target_stmt =
5148 as_a <gimple_statement_omp_target *> (gs);
5149 return &omp_target_stmt->data_arg;
5153 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5155 static inline void
5156 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5158 gimple_statement_omp_target *omp_target_stmt =
5159 as_a <gimple_statement_omp_target *> (gs);
5160 omp_target_stmt->data_arg = data_arg;
5164 /* Return the clauses associated with OMP_TEAMS GS. */
5166 static inline tree
5167 gimple_omp_teams_clauses (const_gimple gs)
5169 const gimple_statement_omp_teams *omp_teams_stmt =
5170 as_a <const gimple_statement_omp_teams *> (gs);
5171 return omp_teams_stmt->clauses;
5175 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5177 static inline tree *
5178 gimple_omp_teams_clauses_ptr (gimple gs)
5180 gimple_statement_omp_teams *omp_teams_stmt =
5181 as_a <gimple_statement_omp_teams *> (gs);
5182 return &omp_teams_stmt->clauses;
5186 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5188 static inline void
5189 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5191 gimple_statement_omp_teams *omp_teams_stmt =
5192 as_a <gimple_statement_omp_teams *> (gs);
5193 omp_teams_stmt->clauses = clauses;
5197 /* Return the clauses associated with OMP_SECTIONS GS. */
5199 static inline tree
5200 gimple_omp_sections_clauses (const_gimple gs)
5202 const gimple_statement_omp_sections *omp_sections_stmt =
5203 as_a <const gimple_statement_omp_sections *> (gs);
5204 return omp_sections_stmt->clauses;
5208 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5210 static inline tree *
5211 gimple_omp_sections_clauses_ptr (gimple gs)
5213 gimple_statement_omp_sections *omp_sections_stmt =
5214 as_a <gimple_statement_omp_sections *> (gs);
5215 return &omp_sections_stmt->clauses;
5219 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5220 GS. */
5222 static inline void
5223 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5225 gimple_statement_omp_sections *omp_sections_stmt =
5226 as_a <gimple_statement_omp_sections *> (gs);
5227 omp_sections_stmt->clauses = clauses;
5231 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5232 in GS. */
5234 static inline tree
5235 gimple_omp_sections_control (const_gimple gs)
5237 const gimple_statement_omp_sections *omp_sections_stmt =
5238 as_a <const gimple_statement_omp_sections *> (gs);
5239 return omp_sections_stmt->control;
5243 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5244 GS. */
5246 static inline tree *
5247 gimple_omp_sections_control_ptr (gimple gs)
5249 gimple_statement_omp_sections *omp_sections_stmt =
5250 as_a <gimple_statement_omp_sections *> (gs);
5251 return &omp_sections_stmt->control;
5255 /* Set CONTROL to be the set of clauses associated with the
5256 GIMPLE_OMP_SECTIONS in GS. */
5258 static inline void
5259 gimple_omp_sections_set_control (gimple gs, tree control)
5261 gimple_statement_omp_sections *omp_sections_stmt =
5262 as_a <gimple_statement_omp_sections *> (gs);
5263 omp_sections_stmt->control = control;
5267 /* Set COND to be the condition code for OMP_FOR GS. */
5269 static inline void
5270 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5272 gimple_statement_omp_for *omp_for_stmt =
5273 as_a <gimple_statement_omp_for *> (gs);
5274 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5275 && i < omp_for_stmt->collapse);
5276 omp_for_stmt->iter[i].cond = cond;
5280 /* Return the condition code associated with OMP_FOR GS. */
5282 static inline enum tree_code
5283 gimple_omp_for_cond (const_gimple gs, size_t i)
5285 const gimple_statement_omp_for *omp_for_stmt =
5286 as_a <const gimple_statement_omp_for *> (gs);
5287 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5288 return omp_for_stmt->iter[i].cond;
5292 /* Set the value being stored in an atomic store. */
5294 static inline void
5295 gimple_omp_atomic_store_set_val (gimple g, tree val)
5297 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5298 as_a <gimple_statement_omp_atomic_store *> (g);
5299 omp_atomic_store_stmt->val = val;
5303 /* Return the value being stored in an atomic store. */
5305 static inline tree
5306 gimple_omp_atomic_store_val (const_gimple g)
5308 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5309 as_a <const gimple_statement_omp_atomic_store *> (g);
5310 return omp_atomic_store_stmt->val;
5314 /* Return a pointer to the value being stored in an atomic store. */
5316 static inline tree *
5317 gimple_omp_atomic_store_val_ptr (gimple g)
5319 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5320 as_a <gimple_statement_omp_atomic_store *> (g);
5321 return &omp_atomic_store_stmt->val;
5325 /* Set the LHS of an atomic load. */
5327 static inline void
5328 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5330 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5331 as_a <gimple_statement_omp_atomic_load *> (g);
5332 omp_atomic_load_stmt->lhs = lhs;
5336 /* Get the LHS of an atomic load. */
5338 static inline tree
5339 gimple_omp_atomic_load_lhs (const_gimple g)
5341 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5342 as_a <const gimple_statement_omp_atomic_load *> (g);
5343 return omp_atomic_load_stmt->lhs;
5347 /* Return a pointer to the LHS of an atomic load. */
5349 static inline tree *
5350 gimple_omp_atomic_load_lhs_ptr (gimple g)
5352 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5353 as_a <gimple_statement_omp_atomic_load *> (g);
5354 return &omp_atomic_load_stmt->lhs;
5358 /* Set the RHS of an atomic load. */
5360 static inline void
5361 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5363 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5364 as_a <gimple_statement_omp_atomic_load *> (g);
5365 omp_atomic_load_stmt->rhs = rhs;
5369 /* Get the RHS of an atomic load. */
5371 static inline tree
5372 gimple_omp_atomic_load_rhs (const_gimple g)
5374 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5375 as_a <const gimple_statement_omp_atomic_load *> (g);
5376 return omp_atomic_load_stmt->rhs;
5380 /* Return a pointer to the RHS of an atomic load. */
5382 static inline tree *
5383 gimple_omp_atomic_load_rhs_ptr (gimple g)
5385 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5386 as_a <gimple_statement_omp_atomic_load *> (g);
5387 return &omp_atomic_load_stmt->rhs;
5391 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5393 static inline tree
5394 gimple_omp_continue_control_def (const_gimple g)
5396 const gimple_statement_omp_continue *omp_continue_stmt =
5397 as_a <const gimple_statement_omp_continue *> (g);
5398 return omp_continue_stmt->control_def;
5401 /* The same as above, but return the address. */
5403 static inline tree *
5404 gimple_omp_continue_control_def_ptr (gimple g)
5406 gimple_statement_omp_continue *omp_continue_stmt =
5407 as_a <gimple_statement_omp_continue *> (g);
5408 return &omp_continue_stmt->control_def;
5411 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5413 static inline void
5414 gimple_omp_continue_set_control_def (gimple g, tree def)
5416 gimple_statement_omp_continue *omp_continue_stmt =
5417 as_a <gimple_statement_omp_continue *> (g);
5418 omp_continue_stmt->control_def = def;
5422 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5424 static inline tree
5425 gimple_omp_continue_control_use (const_gimple g)
5427 const gimple_statement_omp_continue *omp_continue_stmt =
5428 as_a <const gimple_statement_omp_continue *> (g);
5429 return omp_continue_stmt->control_use;
5433 /* The same as above, but return the address. */
5435 static inline tree *
5436 gimple_omp_continue_control_use_ptr (gimple g)
5438 gimple_statement_omp_continue *omp_continue_stmt =
5439 as_a <gimple_statement_omp_continue *> (g);
5440 return &omp_continue_stmt->control_use;
5444 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5446 static inline void
5447 gimple_omp_continue_set_control_use (gimple g, tree use)
5449 gimple_statement_omp_continue *omp_continue_stmt =
5450 as_a <gimple_statement_omp_continue *> (g);
5451 omp_continue_stmt->control_use = use;
5454 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5456 static inline gimple_seq *
5457 gimple_transaction_body_ptr (gimple gs)
5459 gimple_statement_transaction *transaction_stmt =
5460 as_a <gimple_statement_transaction *> (gs);
5461 return &transaction_stmt->body;
5464 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5466 static inline gimple_seq
5467 gimple_transaction_body (gimple gs)
5469 return *gimple_transaction_body_ptr (gs);
5472 /* Return the label associated with a GIMPLE_TRANSACTION. */
5474 static inline tree
5475 gimple_transaction_label (const_gimple gs)
5477 const gimple_statement_transaction *transaction_stmt =
5478 as_a <const gimple_statement_transaction *> (gs);
5479 return transaction_stmt->label;
5482 static inline tree *
5483 gimple_transaction_label_ptr (gimple gs)
5485 gimple_statement_transaction *transaction_stmt =
5486 as_a <gimple_statement_transaction *> (gs);
5487 return &transaction_stmt->label;
5490 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5492 static inline unsigned int
5493 gimple_transaction_subcode (const_gimple gs)
5495 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5496 return gs->subcode;
5499 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5501 static inline void
5502 gimple_transaction_set_body (gimple gs, gimple_seq body)
5504 gimple_statement_transaction *transaction_stmt =
5505 as_a <gimple_statement_transaction *> (gs);
5506 transaction_stmt->body = body;
5509 /* Set the label associated with a GIMPLE_TRANSACTION. */
5511 static inline void
5512 gimple_transaction_set_label (gimple gs, tree label)
5514 gimple_statement_transaction *transaction_stmt =
5515 as_a <gimple_statement_transaction *> (gs);
5516 transaction_stmt->label = label;
5519 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5521 static inline void
5522 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5524 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5525 gs->subcode = subcode;
5529 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5531 static inline tree *
5532 gimple_return_retval_ptr (const_gimple gs)
5534 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5535 return gimple_op_ptr (gs, 0);
5538 /* Return the return value for GIMPLE_RETURN GS. */
5540 static inline tree
5541 gimple_return_retval (const_gimple gs)
5543 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5544 return gimple_op (gs, 0);
5548 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5550 static inline void
5551 gimple_return_set_retval (gimple gs, tree retval)
5553 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5554 gimple_set_op (gs, 0, retval);
5558 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5560 #define CASE_GIMPLE_OMP \
5561 case GIMPLE_OMP_PARALLEL: \
5562 case GIMPLE_OMP_TASK: \
5563 case GIMPLE_OMP_FOR: \
5564 case GIMPLE_OMP_SECTIONS: \
5565 case GIMPLE_OMP_SECTIONS_SWITCH: \
5566 case GIMPLE_OMP_SINGLE: \
5567 case GIMPLE_OMP_TARGET: \
5568 case GIMPLE_OMP_TEAMS: \
5569 case GIMPLE_OMP_SECTION: \
5570 case GIMPLE_OMP_MASTER: \
5571 case GIMPLE_OMP_TASKGROUP: \
5572 case GIMPLE_OMP_ORDERED: \
5573 case GIMPLE_OMP_CRITICAL: \
5574 case GIMPLE_OMP_RETURN: \
5575 case GIMPLE_OMP_ATOMIC_LOAD: \
5576 case GIMPLE_OMP_ATOMIC_STORE: \
5577 case GIMPLE_OMP_CONTINUE
5579 static inline bool
5580 is_gimple_omp (const_gimple stmt)
5582 switch (gimple_code (stmt))
5584 CASE_GIMPLE_OMP:
5585 return true;
5586 default:
5587 return false;
5592 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5594 static inline bool
5595 gimple_nop_p (const_gimple g)
5597 return gimple_code (g) == GIMPLE_NOP;
5601 /* Return true if GS is a GIMPLE_RESX. */
5603 static inline bool
5604 is_gimple_resx (const_gimple gs)
5606 return gimple_code (gs) == GIMPLE_RESX;
5609 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5611 static inline enum br_predictor
5612 gimple_predict_predictor (gimple gs)
5614 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5615 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5619 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5621 static inline void
5622 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5624 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5625 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5626 | (unsigned) predictor;
5630 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5632 static inline enum prediction
5633 gimple_predict_outcome (gimple gs)
5635 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5636 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5640 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5642 static inline void
5643 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5645 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5646 if (outcome == TAKEN)
5647 gs->subcode |= GF_PREDICT_TAKEN;
5648 else
5649 gs->subcode &= ~GF_PREDICT_TAKEN;
5653 /* Return the type of the main expression computed by STMT. Return
5654 void_type_node if the statement computes nothing. */
5656 static inline tree
5657 gimple_expr_type (const_gimple stmt)
5659 enum gimple_code code = gimple_code (stmt);
5661 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5663 tree type;
5664 /* In general we want to pass out a type that can be substituted
5665 for both the RHS and the LHS types if there is a possibly
5666 useless conversion involved. That means returning the
5667 original RHS type as far as we can reconstruct it. */
5668 if (code == GIMPLE_CALL)
5670 if (gimple_call_internal_p (stmt)
5671 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5672 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5673 else
5674 type = gimple_call_return_type (stmt);
5676 else
5677 switch (gimple_assign_rhs_code (stmt))
5679 case POINTER_PLUS_EXPR:
5680 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5681 break;
5683 default:
5684 /* As fallback use the type of the LHS. */
5685 type = TREE_TYPE (gimple_get_lhs (stmt));
5686 break;
5688 return type;
5690 else if (code == GIMPLE_COND)
5691 return boolean_type_node;
5692 else
5693 return void_type_node;
5696 /* Enum and arrays used for allocation stats. Keep in sync with
5697 gimple.c:gimple_alloc_kind_names. */
5698 enum gimple_alloc_kind
5700 gimple_alloc_kind_assign, /* Assignments. */
5701 gimple_alloc_kind_phi, /* PHI nodes. */
5702 gimple_alloc_kind_cond, /* Conditionals. */
5703 gimple_alloc_kind_rest, /* Everything else. */
5704 gimple_alloc_kind_all
5707 extern int gimple_alloc_counts[];
5708 extern int gimple_alloc_sizes[];
5710 /* Return the allocation kind for a given stmt CODE. */
5711 static inline enum gimple_alloc_kind
5712 gimple_alloc_kind (enum gimple_code code)
5714 switch (code)
5716 case GIMPLE_ASSIGN:
5717 return gimple_alloc_kind_assign;
5718 case GIMPLE_PHI:
5719 return gimple_alloc_kind_phi;
5720 case GIMPLE_COND:
5721 return gimple_alloc_kind_cond;
5722 default:
5723 return gimple_alloc_kind_rest;
5727 /* Return true if a location should not be emitted for this statement
5728 by annotate_all_with_location. */
5730 static inline bool
5731 gimple_do_not_emit_location_p (gimple g)
5733 return gimple_plf (g, GF_PLF_1);
5736 /* Mark statement G so a location will not be emitted by
5737 annotate_one_with_location. */
5739 static inline void
5740 gimple_set_do_not_emit_location (gimple g)
5742 /* The PLF flags are initialized to 0 when a new tuple is created,
5743 so no need to initialize it anywhere. */
5744 gimple_set_plf (g, GF_PLF_1, true);
5748 /* Macros for showing usage statistics. */
5749 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5750 ? (x) \
5751 : ((x) < 1024*1024*10 \
5752 ? (x) / 1024 \
5753 : (x) / (1024*1024))))
5755 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5757 #endif /* GCC_GIMPLE_H */