gcc/
[official-gcc.git] / gcc / gimple.h
blob0e80d2eb700245a6ed268e18940bf747cc613747
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_OMP_PARALLEL_COMBINED = 1 << 0,
94 GF_OMP_FOR_KIND_MASK = 3 << 0,
95 GF_OMP_FOR_KIND_FOR = 0 << 0,
96 GF_OMP_FOR_KIND_DISTRIBUTE = 1 << 0,
97 GF_OMP_FOR_KIND_SIMD = 2 << 0,
98 GF_OMP_FOR_KIND_CILKSIMD = 3 << 0,
99 GF_OMP_FOR_COMBINED = 1 << 2,
100 GF_OMP_FOR_COMBINED_INTO = 1 << 3,
101 GF_OMP_TARGET_KIND_MASK = 3 << 0,
102 GF_OMP_TARGET_KIND_REGION = 0 << 0,
103 GF_OMP_TARGET_KIND_DATA = 1 << 0,
104 GF_OMP_TARGET_KIND_UPDATE = 2 << 0,
106 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
107 a thread synchronization via some sort of barrier. The exact barrier
108 that would otherwise be emitted is dependent on the OMP statement with
109 which this return is associated. */
110 GF_OMP_RETURN_NOWAIT = 1 << 0,
112 GF_OMP_SECTION_LAST = 1 << 0,
113 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
114 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
115 GF_PREDICT_TAKEN = 1 << 15
118 /* Currently, there are only two types of gimple debug stmt. Others are
119 envisioned, for example, to enable the generation of is_stmt notes
120 in line number information, to mark sequence points, etc. This
121 subcode is to be used to tell them apart. */
122 enum gimple_debug_subcode {
123 GIMPLE_DEBUG_BIND = 0,
124 GIMPLE_DEBUG_SOURCE_BIND = 1
127 /* Masks for selecting a pass local flag (PLF) to work on. These
128 masks are used by gimple_set_plf and gimple_plf. */
129 enum plf_mask {
130 GF_PLF_1 = 1 << 0,
131 GF_PLF_2 = 1 << 1
134 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
135 are for 64 bit hosts. */
137 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
138 chain_next ("%h.next"), variable_size))
139 gimple_statement_base
141 /* [ WORD 1 ]
142 Main identifying code for a tuple. */
143 ENUM_BITFIELD(gimple_code) code : 8;
145 /* Nonzero if a warning should not be emitted on this tuple. */
146 unsigned int no_warning : 1;
148 /* Nonzero if this tuple has been visited. Passes are responsible
149 for clearing this bit before using it. */
150 unsigned int visited : 1;
152 /* Nonzero if this tuple represents a non-temporal move. */
153 unsigned int nontemporal_move : 1;
155 /* Pass local flags. These flags are free for any pass to use as
156 they see fit. Passes should not assume that these flags contain
157 any useful value when the pass starts. Any initial state that
158 the pass requires should be set on entry to the pass. See
159 gimple_set_plf and gimple_plf for usage. */
160 unsigned int plf : 2;
162 /* Nonzero if this statement has been modified and needs to have its
163 operands rescanned. */
164 unsigned modified : 1;
166 /* Nonzero if this statement contains volatile operands. */
167 unsigned has_volatile_ops : 1;
169 /* The SUBCODE field can be used for tuple-specific flags for tuples
170 that do not require subcodes. Note that SUBCODE should be at
171 least as wide as tree codes, as several tuples store tree codes
172 in there. */
173 unsigned int subcode : 16;
175 /* UID of this statement. This is used by passes that want to
176 assign IDs to statements. It must be assigned and used by each
177 pass. By default it should be assumed to contain garbage. */
178 unsigned uid;
180 /* [ WORD 2 ]
181 Locus information for debug info. */
182 location_t location;
184 /* Number of operands in this tuple. */
185 unsigned num_ops;
187 /* [ WORD 3 ]
188 Basic block holding this statement. */
189 basic_block bb;
191 /* [ WORD 4-5 ]
192 Linked lists of gimple statements. The next pointers form
193 a NULL terminated list, the prev pointers are a cyclic list.
194 A gimple statement is hence also a double-ended list of
195 statements, with the pointer itself being the first element,
196 and the prev pointer being the last. */
197 gimple next;
198 gimple GTY((skip)) prev;
202 /* Base structure for tuples with operands. */
204 /* This gimple subclass has no tag value. */
205 struct GTY(())
206 gimple_statement_with_ops_base : public gimple_statement_base
208 /* [ WORD 1-6 ] : base class */
210 /* [ WORD 7 ]
211 SSA operand vectors. NOTE: It should be possible to
212 amalgamate these vectors with the operand vector OP. However,
213 the SSA operand vectors are organized differently and contain
214 more information (like immediate use chaining). */
215 struct use_optype_d GTY((skip (""))) *use_ops;
219 /* Statements that take register operands. */
221 struct GTY((tag("GSS_WITH_OPS")))
222 gimple_statement_with_ops : public gimple_statement_with_ops_base
224 /* [ WORD 1-7 ] : base class */
226 /* [ WORD 8 ]
227 Operand vector. NOTE! This must always be the last field
228 of this structure. In particular, this means that this
229 structure cannot be embedded inside another one. */
230 tree GTY((length ("%h.num_ops"))) op[1];
234 /* Base for statements that take both memory and register operands. */
236 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
237 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
239 /* [ WORD 1-7 ] : base class */
241 /* [ WORD 8-9 ]
242 Virtual operands for this statement. The GC will pick them
243 up via the ssa_names array. */
244 tree GTY((skip (""))) vdef;
245 tree GTY((skip (""))) vuse;
249 /* Statements that take both memory and register operands. */
251 struct GTY((tag("GSS_WITH_MEM_OPS")))
252 gimple_statement_with_memory_ops :
253 public gimple_statement_with_memory_ops_base
255 /* [ WORD 1-9 ] : base class */
257 /* [ WORD 10 ]
258 Operand vector. NOTE! This must always be the last field
259 of this structure. In particular, this means that this
260 structure cannot be embedded inside another one. */
261 tree GTY((length ("%h.num_ops"))) op[1];
265 /* Call statements that take both memory and register operands. */
267 struct GTY((tag("GSS_CALL")))
268 gimple_statement_call : public gimple_statement_with_memory_ops_base
270 /* [ WORD 1-9 ] : base class */
272 /* [ WORD 10-13 ] */
273 struct pt_solution call_used;
274 struct pt_solution call_clobbered;
276 /* [ WORD 14 ] */
277 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
278 tree GTY ((tag ("0"))) fntype;
279 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
280 } u;
282 /* [ WORD 15 ]
283 Operand vector. NOTE! This must always be the last field
284 of this structure. In particular, this means that this
285 structure cannot be embedded inside another one. */
286 tree GTY((length ("%h.num_ops"))) op[1];
290 /* OpenMP statements (#pragma omp). */
292 struct GTY((tag("GSS_OMP")))
293 gimple_statement_omp : public gimple_statement_base
295 /* [ WORD 1-6 ] : base class */
297 /* [ WORD 7 ] */
298 gimple_seq body;
302 /* GIMPLE_BIND */
304 struct GTY((tag("GSS_BIND")))
305 gimple_statement_bind : public gimple_statement_base
307 /* [ WORD 1-6 ] : base class */
309 /* [ WORD 7 ]
310 Variables declared in this scope. */
311 tree vars;
313 /* [ WORD 8 ]
314 This is different than the BLOCK field in gimple_statement_base,
315 which is analogous to TREE_BLOCK (i.e., the lexical block holding
316 this statement). This field is the equivalent of BIND_EXPR_BLOCK
317 in tree land (i.e., the lexical scope defined by this bind). See
318 gimple-low.c. */
319 tree block;
321 /* [ WORD 9 ] */
322 gimple_seq body;
326 /* GIMPLE_CATCH */
328 struct GTY((tag("GSS_CATCH")))
329 gimple_statement_catch : public gimple_statement_base
331 /* [ WORD 1-6 ] : base class */
333 /* [ WORD 7 ] */
334 tree types;
336 /* [ WORD 8 ] */
337 gimple_seq handler;
341 /* GIMPLE_EH_FILTER */
343 struct GTY((tag("GSS_EH_FILTER")))
344 gimple_statement_eh_filter : public gimple_statement_base
346 /* [ WORD 1-6 ] : base class */
348 /* [ WORD 7 ]
349 Filter types. */
350 tree types;
352 /* [ WORD 8 ]
353 Failure actions. */
354 gimple_seq failure;
357 /* GIMPLE_EH_ELSE */
359 struct GTY((tag("GSS_EH_ELSE")))
360 gimple_statement_eh_else : public gimple_statement_base
362 /* [ WORD 1-6 ] : base class */
364 /* [ WORD 7,8 ] */
365 gimple_seq n_body, e_body;
368 /* GIMPLE_EH_MUST_NOT_THROW */
370 struct GTY((tag("GSS_EH_MNT")))
371 gimple_statement_eh_mnt : public gimple_statement_base
373 /* [ WORD 1-6 ] : base class */
375 /* [ WORD 7 ] Abort function decl. */
376 tree fndecl;
379 /* GIMPLE_PHI */
381 struct GTY((tag("GSS_PHI")))
382 gimple_statement_phi : public gimple_statement_base
384 /* [ WORD 1-6 ] : base class */
386 /* [ WORD 7 ] */
387 unsigned capacity;
388 unsigned nargs;
390 /* [ WORD 8 ] */
391 tree result;
393 /* [ WORD 9 ] */
394 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
398 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
400 struct GTY((tag("GSS_EH_CTRL")))
401 gimple_statement_eh_ctrl : public gimple_statement_base
403 /* [ WORD 1-6 ] : base class */
405 /* [ WORD 7 ]
406 Exception region number. */
407 int region;
410 struct GTY((tag("GSS_EH_CTRL")))
411 gimple_statement_resx : public gimple_statement_eh_ctrl
413 /* No extra fields; adds invariant:
414 stmt->code == GIMPLE_RESX. */
417 struct GTY((tag("GSS_EH_CTRL")))
418 gimple_statement_eh_dispatch : public gimple_statement_eh_ctrl
420 /* No extra fields; adds invariant:
421 stmt->code == GIMPLE_EH_DISPATH. */
425 /* GIMPLE_TRY */
427 struct GTY((tag("GSS_TRY")))
428 gimple_statement_try : public gimple_statement_base
430 /* [ WORD 1-6 ] : base class */
432 /* [ WORD 7 ]
433 Expression to evaluate. */
434 gimple_seq eval;
436 /* [ WORD 8 ]
437 Cleanup expression. */
438 gimple_seq cleanup;
441 /* Kind of GIMPLE_TRY statements. */
442 enum gimple_try_flags
444 /* A try/catch. */
445 GIMPLE_TRY_CATCH = 1 << 0,
447 /* A try/finally. */
448 GIMPLE_TRY_FINALLY = 1 << 1,
449 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
451 /* Analogous to TRY_CATCH_IS_CLEANUP. */
452 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
455 /* GIMPLE_WITH_CLEANUP_EXPR */
457 struct GTY((tag("GSS_WCE")))
458 gimple_statement_wce : public gimple_statement_base
460 /* [ WORD 1-6 ] : base class */
462 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
463 executed if an exception is thrown, not on normal exit of its
464 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
465 in TARGET_EXPRs. */
467 /* [ WORD 7 ]
468 Cleanup expression. */
469 gimple_seq cleanup;
473 /* GIMPLE_ASM */
475 struct GTY((tag("GSS_ASM")))
476 gimple_statement_asm : public gimple_statement_with_memory_ops_base
478 /* [ WORD 1-9 ] : base class */
480 /* [ WORD 10 ]
481 __asm__ statement. */
482 const char *string;
484 /* [ WORD 11 ]
485 Number of inputs, outputs, clobbers, labels. */
486 unsigned char ni;
487 unsigned char no;
488 unsigned char nc;
489 unsigned char nl;
491 /* [ WORD 12 ]
492 Operand vector. NOTE! This must always be the last field
493 of this structure. In particular, this means that this
494 structure cannot be embedded inside another one. */
495 tree GTY((length ("%h.num_ops"))) op[1];
498 /* GIMPLE_OMP_CRITICAL */
500 struct GTY((tag("GSS_OMP_CRITICAL")))
501 gimple_statement_omp_critical : public gimple_statement_omp
503 /* [ WORD 1-7 ] : base class */
505 /* [ WORD 8 ]
506 Critical section name. */
507 tree name;
511 struct GTY(()) gimple_omp_for_iter {
512 /* Condition code. */
513 enum tree_code cond;
515 /* Index variable. */
516 tree index;
518 /* Initial value. */
519 tree initial;
521 /* Final value. */
522 tree final;
524 /* Increment. */
525 tree incr;
528 /* GIMPLE_OMP_FOR */
530 struct GTY((tag("GSS_OMP_FOR")))
531 gimple_statement_omp_for : public gimple_statement_omp
533 /* [ WORD 1-7 ] : base class */
535 /* [ WORD 8 ] */
536 tree clauses;
538 /* [ WORD 9 ]
539 Number of elements in iter array. */
540 size_t collapse;
542 /* [ WORD 10 ] */
543 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
545 /* [ WORD 11 ]
546 Pre-body evaluated before the loop body begins. */
547 gimple_seq pre_body;
551 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
552 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
553 gimple_statement_omp_parallel_layout : public gimple_statement_omp
555 /* [ WORD 1-7 ] : base class */
557 /* [ WORD 8 ]
558 Clauses. */
559 tree clauses;
561 /* [ WORD 9 ]
562 Child function holding the body of the parallel region. */
563 tree child_fn;
565 /* [ WORD 10 ]
566 Shared data argument. */
567 tree data_arg;
570 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
571 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
572 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
574 /* No extra fields; adds invariant:
575 stmt->code == GIMPLE_OMP_PARALLEL
576 || stmt->code == GIMPLE_OMP_TASK. */
580 /* GIMPLE_OMP_PARALLEL */
581 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
582 gimple_statement_omp_parallel : public gimple_statement_omp_taskreg
584 /* No extra fields; adds invariant:
585 stmt->code == GIMPLE_OMP_PARALLEL. */
588 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
589 gimple_statement_omp_target : public gimple_statement_omp_parallel_layout
591 /* No extra fields; adds invariant:
592 stmt->code == GIMPLE_OMP_TARGET. */
595 /* GIMPLE_OMP_TASK */
597 struct GTY((tag("GSS_OMP_TASK")))
598 gimple_statement_omp_task : public gimple_statement_omp_taskreg
600 /* [ WORD 1-10 ] : base class */
602 /* [ WORD 11 ]
603 Child function holding firstprivate initialization if needed. */
604 tree copy_fn;
606 /* [ WORD 12-13 ]
607 Size and alignment in bytes of the argument data block. */
608 tree arg_size;
609 tree arg_align;
613 /* GIMPLE_OMP_SECTION */
614 /* Uses struct gimple_statement_omp. */
617 /* GIMPLE_OMP_SECTIONS */
619 struct GTY((tag("GSS_OMP_SECTIONS")))
620 gimple_statement_omp_sections : public gimple_statement_omp
622 /* [ WORD 1-7 ] : base class */
624 /* [ WORD 8 ] */
625 tree clauses;
627 /* [ WORD 9 ]
628 The control variable used for deciding which of the sections to
629 execute. */
630 tree control;
633 /* GIMPLE_OMP_CONTINUE.
635 Note: This does not inherit from gimple_statement_omp, because we
636 do not need the body field. */
638 struct GTY((tag("GSS_OMP_CONTINUE")))
639 gimple_statement_omp_continue : public gimple_statement_base
641 /* [ WORD 1-6 ] : base class */
643 /* [ WORD 7 ] */
644 tree control_def;
646 /* [ WORD 8 ] */
647 tree control_use;
650 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
652 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
653 gimple_statement_omp_single_layout : public gimple_statement_omp
655 /* [ WORD 1-7 ] : base class */
657 /* [ WORD 7 ] */
658 tree clauses;
661 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
662 gimple_statement_omp_single : public gimple_statement_omp_single_layout
664 /* No extra fields; adds invariant:
665 stmt->code == GIMPLE_OMP_SINGLE. */
668 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
669 gimple_statement_omp_teams : public gimple_statement_omp_single_layout
671 /* No extra fields; adds invariant:
672 stmt->code == GIMPLE_OMP_TEAMS. */
676 /* GIMPLE_OMP_ATOMIC_LOAD.
677 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
678 contains a sequence, which we don't need here. */
680 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
681 gimple_statement_omp_atomic_load : public gimple_statement_base
683 /* [ WORD 1-6 ] : base class */
685 /* [ WORD 7-8 ] */
686 tree rhs, lhs;
689 /* GIMPLE_OMP_ATOMIC_STORE.
690 See note on GIMPLE_OMP_ATOMIC_LOAD. */
692 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
693 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
695 /* [ WORD 1-6 ] : base class */
697 /* [ WORD 7 ] */
698 tree val;
701 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
702 gimple_statement_omp_atomic_store :
703 public gimple_statement_omp_atomic_store_layout
705 /* No extra fields; adds invariant:
706 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
709 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
710 gimple_statement_omp_return :
711 public gimple_statement_omp_atomic_store_layout
713 /* No extra fields; adds invariant:
714 stmt->code == GIMPLE_OMP_RETURN. */
717 /* GIMPLE_TRANSACTION. */
719 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
721 /* The __transaction_atomic was declared [[outer]] or it is
722 __transaction_relaxed. */
723 #define GTMA_IS_OUTER (1u << 0)
724 #define GTMA_IS_RELAXED (1u << 1)
725 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
727 /* The transaction is seen to not have an abort. */
728 #define GTMA_HAVE_ABORT (1u << 2)
729 /* The transaction is seen to have loads or stores. */
730 #define GTMA_HAVE_LOAD (1u << 3)
731 #define GTMA_HAVE_STORE (1u << 4)
732 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
733 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
734 /* The transaction WILL enter serial irrevocable mode.
735 An irrevocable block post-dominates the entire transaction, such
736 that all invocations of the transaction will go serial-irrevocable.
737 In such case, we don't bother instrumenting the transaction, and
738 tell the runtime that it should begin the transaction in
739 serial-irrevocable mode. */
740 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
741 /* The transaction contains no instrumentation code whatsover, most
742 likely because it is guaranteed to go irrevocable upon entry. */
743 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
745 struct GTY((tag("GSS_TRANSACTION")))
746 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
748 /* [ WORD 1-9 ] : base class */
750 /* [ WORD 10 ] */
751 gimple_seq body;
753 /* [ WORD 11 ] */
754 tree label;
757 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
758 enum gimple_statement_structure_enum {
759 #include "gsstruct.def"
760 LAST_GSS_ENUM
762 #undef DEFGSSTRUCT
764 template <>
765 template <>
766 inline bool
767 is_a_helper <gimple_statement_asm>::test (gimple gs)
769 return gs->code == GIMPLE_ASM;
772 template <>
773 template <>
774 inline bool
775 is_a_helper <gimple_statement_bind>::test (gimple gs)
777 return gs->code == GIMPLE_BIND;
780 template <>
781 template <>
782 inline bool
783 is_a_helper <gimple_statement_call>::test (gimple gs)
785 return gs->code == GIMPLE_CALL;
788 template <>
789 template <>
790 inline bool
791 is_a_helper <gimple_statement_catch>::test (gimple gs)
793 return gs->code == GIMPLE_CATCH;
796 template <>
797 template <>
798 inline bool
799 is_a_helper <gimple_statement_resx>::test (gimple gs)
801 return gs->code == GIMPLE_RESX;
804 template <>
805 template <>
806 inline bool
807 is_a_helper <gimple_statement_eh_dispatch>::test (gimple gs)
809 return gs->code == GIMPLE_EH_DISPATCH;
812 template <>
813 template <>
814 inline bool
815 is_a_helper <gimple_statement_eh_else>::test (gimple gs)
817 return gs->code == GIMPLE_EH_ELSE;
820 template <>
821 template <>
822 inline bool
823 is_a_helper <gimple_statement_eh_filter>::test (gimple gs)
825 return gs->code == GIMPLE_EH_FILTER;
828 template <>
829 template <>
830 inline bool
831 is_a_helper <gimple_statement_eh_mnt>::test (gimple gs)
833 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
836 template <>
837 template <>
838 inline bool
839 is_a_helper <gimple_statement_omp_atomic_load>::test (gimple gs)
841 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
844 template <>
845 template <>
846 inline bool
847 is_a_helper <gimple_statement_omp_atomic_store>::test (gimple gs)
849 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
852 template <>
853 template <>
854 inline bool
855 is_a_helper <gimple_statement_omp_return>::test (gimple gs)
857 return gs->code == GIMPLE_OMP_RETURN;
860 template <>
861 template <>
862 inline bool
863 is_a_helper <gimple_statement_omp_continue>::test (gimple gs)
865 return gs->code == GIMPLE_OMP_CONTINUE;
868 template <>
869 template <>
870 inline bool
871 is_a_helper <gimple_statement_omp_critical>::test (gimple gs)
873 return gs->code == GIMPLE_OMP_CRITICAL;
876 template <>
877 template <>
878 inline bool
879 is_a_helper <gimple_statement_omp_for>::test (gimple gs)
881 return gs->code == GIMPLE_OMP_FOR;
884 template <>
885 template <>
886 inline bool
887 is_a_helper <gimple_statement_omp_taskreg>::test (gimple gs)
889 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
892 template <>
893 template <>
894 inline bool
895 is_a_helper <gimple_statement_omp_parallel>::test (gimple gs)
897 return gs->code == GIMPLE_OMP_PARALLEL;
900 template <>
901 template <>
902 inline bool
903 is_a_helper <gimple_statement_omp_target>::test (gimple gs)
905 return gs->code == GIMPLE_OMP_TARGET;
908 template <>
909 template <>
910 inline bool
911 is_a_helper <gimple_statement_omp_sections>::test (gimple gs)
913 return gs->code == GIMPLE_OMP_SECTIONS;
916 template <>
917 template <>
918 inline bool
919 is_a_helper <gimple_statement_omp_single>::test (gimple gs)
921 return gs->code == GIMPLE_OMP_SINGLE;
924 template <>
925 template <>
926 inline bool
927 is_a_helper <gimple_statement_omp_teams>::test (gimple gs)
929 return gs->code == GIMPLE_OMP_TEAMS;
932 template <>
933 template <>
934 inline bool
935 is_a_helper <gimple_statement_omp_task>::test (gimple gs)
937 return gs->code == GIMPLE_OMP_TASK;
940 template <>
941 template <>
942 inline bool
943 is_a_helper <gimple_statement_phi>::test (gimple gs)
945 return gs->code == GIMPLE_PHI;
948 template <>
949 template <>
950 inline bool
951 is_a_helper <gimple_statement_transaction>::test (gimple gs)
953 return gs->code == GIMPLE_TRANSACTION;
956 template <>
957 template <>
958 inline bool
959 is_a_helper <gimple_statement_try>::test (gimple gs)
961 return gs->code == GIMPLE_TRY;
964 template <>
965 template <>
966 inline bool
967 is_a_helper <gimple_statement_wce>::test (gimple gs)
969 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
972 template <>
973 template <>
974 inline bool
975 is_a_helper <const gimple_statement_asm>::test (const_gimple gs)
977 return gs->code == GIMPLE_ASM;
980 template <>
981 template <>
982 inline bool
983 is_a_helper <const gimple_statement_bind>::test (const_gimple gs)
985 return gs->code == GIMPLE_BIND;
988 template <>
989 template <>
990 inline bool
991 is_a_helper <const gimple_statement_call>::test (const_gimple gs)
993 return gs->code == GIMPLE_CALL;
996 template <>
997 template <>
998 inline bool
999 is_a_helper <const gimple_statement_catch>::test (const_gimple gs)
1001 return gs->code == GIMPLE_CATCH;
1004 template <>
1005 template <>
1006 inline bool
1007 is_a_helper <const gimple_statement_resx>::test (const_gimple gs)
1009 return gs->code == GIMPLE_RESX;
1012 template <>
1013 template <>
1014 inline bool
1015 is_a_helper <const gimple_statement_eh_dispatch>::test (const_gimple gs)
1017 return gs->code == GIMPLE_EH_DISPATCH;
1020 template <>
1021 template <>
1022 inline bool
1023 is_a_helper <const gimple_statement_eh_filter>::test (const_gimple gs)
1025 return gs->code == GIMPLE_EH_FILTER;
1028 template <>
1029 template <>
1030 inline bool
1031 is_a_helper <const gimple_statement_omp_atomic_load>::test (const_gimple gs)
1033 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1036 template <>
1037 template <>
1038 inline bool
1039 is_a_helper <const gimple_statement_omp_atomic_store>::test (const_gimple gs)
1041 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1044 template <>
1045 template <>
1046 inline bool
1047 is_a_helper <const gimple_statement_omp_return>::test (const_gimple gs)
1049 return gs->code == GIMPLE_OMP_RETURN;
1052 template <>
1053 template <>
1054 inline bool
1055 is_a_helper <const gimple_statement_omp_continue>::test (const_gimple gs)
1057 return gs->code == GIMPLE_OMP_CONTINUE;
1060 template <>
1061 template <>
1062 inline bool
1063 is_a_helper <const gimple_statement_omp_critical>::test (const_gimple gs)
1065 return gs->code == GIMPLE_OMP_CRITICAL;
1068 template <>
1069 template <>
1070 inline bool
1071 is_a_helper <const gimple_statement_omp_for>::test (const_gimple gs)
1073 return gs->code == GIMPLE_OMP_FOR;
1076 template <>
1077 template <>
1078 inline bool
1079 is_a_helper <const gimple_statement_omp_taskreg>::test (const_gimple gs)
1081 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1084 template <>
1085 template <>
1086 inline bool
1087 is_a_helper <const gimple_statement_omp_parallel>::test (const_gimple gs)
1089 return gs->code == GIMPLE_OMP_PARALLEL;
1092 template <>
1093 template <>
1094 inline bool
1095 is_a_helper <const gimple_statement_omp_target>::test (const_gimple gs)
1097 return gs->code == GIMPLE_OMP_TARGET;
1100 template <>
1101 template <>
1102 inline bool
1103 is_a_helper <const gimple_statement_omp_sections>::test (const_gimple gs)
1105 return gs->code == GIMPLE_OMP_SECTIONS;
1108 template <>
1109 template <>
1110 inline bool
1111 is_a_helper <const gimple_statement_omp_single>::test (const_gimple gs)
1113 return gs->code == GIMPLE_OMP_SINGLE;
1116 template <>
1117 template <>
1118 inline bool
1119 is_a_helper <const gimple_statement_omp_teams>::test (const_gimple gs)
1121 return gs->code == GIMPLE_OMP_TEAMS;
1124 template <>
1125 template <>
1126 inline bool
1127 is_a_helper <const gimple_statement_omp_task>::test (const_gimple gs)
1129 return gs->code == GIMPLE_OMP_TASK;
1132 template <>
1133 template <>
1134 inline bool
1135 is_a_helper <const gimple_statement_phi>::test (const_gimple gs)
1137 return gs->code == GIMPLE_PHI;
1140 template <>
1141 template <>
1142 inline bool
1143 is_a_helper <const gimple_statement_transaction>::test (const_gimple gs)
1145 return gs->code == GIMPLE_TRANSACTION;
1148 /* Offset in bytes to the location of the operand vector.
1149 Zero if there is no operand vector for this tuple structure. */
1150 extern size_t const gimple_ops_offset_[];
1152 /* Map GIMPLE codes to GSS codes. */
1153 extern enum gimple_statement_structure_enum const gss_for_code_[];
1155 /* This variable holds the currently expanded gimple statement for purposes
1156 of comminucating the profile info to the builtin expanders. */
1157 extern gimple currently_expanding_gimple_stmt;
1159 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1160 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1161 gimple gimple_build_return (tree);
1162 void gimple_call_reset_alias_info (gimple);
1163 gimple gimple_build_call_vec (tree, vec<tree> );
1164 gimple gimple_build_call (tree, unsigned, ...);
1165 gimple gimple_build_call_valist (tree, unsigned, va_list);
1166 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1167 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1168 gimple gimple_build_call_from_tree (tree);
1169 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1170 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1171 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1172 tree, tree, tree CXX_MEM_STAT_INFO);
1173 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1174 tree, tree CXX_MEM_STAT_INFO);
1175 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1176 gimple gimple_build_cond_from_tree (tree, tree, tree);
1177 void gimple_cond_set_condition_from_tree (gimple, tree);
1178 gimple gimple_build_label (tree label);
1179 gimple gimple_build_goto (tree dest);
1180 gimple gimple_build_nop (void);
1181 gimple gimple_build_bind (tree, gimple_seq, tree);
1182 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1183 vec<tree, va_gc> *, vec<tree, va_gc> *,
1184 vec<tree, va_gc> *);
1185 gimple gimple_build_catch (tree, gimple_seq);
1186 gimple gimple_build_eh_filter (tree, gimple_seq);
1187 gimple gimple_build_eh_must_not_throw (tree);
1188 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1189 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1190 enum gimple_try_flags);
1191 gimple gimple_build_wce (gimple_seq);
1192 gimple gimple_build_resx (int);
1193 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1194 gimple gimple_build_switch (tree, tree, vec<tree> );
1195 gimple gimple_build_eh_dispatch (int);
1196 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1197 #define gimple_build_debug_bind(var,val,stmt) \
1198 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1199 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1200 #define gimple_build_debug_source_bind(var,val,stmt) \
1201 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1202 gimple gimple_build_omp_critical (gimple_seq, tree);
1203 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1204 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1205 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1206 gimple gimple_build_omp_section (gimple_seq);
1207 gimple gimple_build_omp_master (gimple_seq);
1208 gimple gimple_build_omp_taskgroup (gimple_seq);
1209 gimple gimple_build_omp_continue (tree, tree);
1210 gimple gimple_build_omp_ordered (gimple_seq);
1211 gimple gimple_build_omp_return (bool);
1212 gimple gimple_build_omp_sections (gimple_seq, tree);
1213 gimple gimple_build_omp_sections_switch (void);
1214 gimple gimple_build_omp_single (gimple_seq, tree);
1215 gimple gimple_build_omp_target (gimple_seq, int, tree);
1216 gimple gimple_build_omp_teams (gimple_seq, tree);
1217 gimple gimple_build_omp_atomic_load (tree, tree);
1218 gimple gimple_build_omp_atomic_store (tree);
1219 gimple gimple_build_transaction (gimple_seq, tree);
1220 gimple gimple_build_predict (enum br_predictor, enum prediction);
1221 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1222 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1223 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1224 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1225 location_t);
1226 extern void annotate_all_with_location (gimple_seq, location_t);
1227 bool empty_body_p (gimple_seq);
1228 gimple_seq gimple_seq_copy (gimple_seq);
1229 bool gimple_call_same_target_p (const_gimple, const_gimple);
1230 int gimple_call_flags (const_gimple);
1231 int gimple_call_arg_flags (const_gimple, unsigned);
1232 int gimple_call_return_flags (const_gimple);
1233 bool gimple_assign_copy_p (gimple);
1234 bool gimple_assign_ssa_name_copy_p (gimple);
1235 bool gimple_assign_unary_nop_p (gimple);
1236 void gimple_set_bb (gimple, basic_block);
1237 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1238 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1239 tree, tree, tree);
1240 tree gimple_get_lhs (const_gimple);
1241 void gimple_set_lhs (gimple, tree);
1242 gimple gimple_copy (gimple);
1243 bool gimple_has_side_effects (const_gimple);
1244 bool gimple_could_trap_p_1 (gimple, bool, bool);
1245 bool gimple_could_trap_p (gimple);
1246 bool gimple_assign_rhs_could_trap_p (gimple);
1247 extern void dump_gimple_statistics (void);
1248 unsigned get_gimple_rhs_num_ops (enum tree_code);
1249 extern tree canonicalize_cond_expr_cond (tree);
1250 gimple gimple_call_copy_skip_args (gimple, bitmap);
1251 extern bool gimple_compare_field_offset (tree, tree);
1252 extern tree gimple_unsigned_type (tree);
1253 extern tree gimple_signed_type (tree);
1254 extern alias_set_type gimple_get_alias_set (tree);
1255 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1256 extern bool gimple_builtin_call_types_compatible_p (gimple, tree);
1257 extern bool gimple_call_builtin_p (gimple);
1258 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
1259 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1260 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1261 extern void dump_decl_set (FILE *, bitmap);
1262 extern bool nonfreeing_call_p (gimple);
1263 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1264 extern void sort_case_labels (vec<tree> );
1265 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1266 extern void gimple_seq_set_location (gimple_seq , location_t);
1268 /* Formal (expression) temporary table handling: multiple occurrences of
1269 the same scalar expression are evaluated into the same temporary. */
1271 typedef struct gimple_temp_hash_elt
1273 tree val; /* Key */
1274 tree temp; /* Value */
1275 } elt_t;
1277 /* Get the number of the next statement uid to be allocated. */
1278 static inline unsigned int
1279 gimple_stmt_max_uid (struct function *fn)
1281 return fn->last_stmt_uid;
1284 /* Set the number of the next statement uid to be allocated. */
1285 static inline void
1286 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1288 fn->last_stmt_uid = maxid;
1291 /* Set the number of the next statement uid to be allocated. */
1292 static inline unsigned int
1293 inc_gimple_stmt_max_uid (struct function *fn)
1295 return fn->last_stmt_uid++;
1298 /* Return the first node in GIMPLE sequence S. */
1300 static inline gimple_seq_node
1301 gimple_seq_first (gimple_seq s)
1303 return s;
1307 /* Return the first statement in GIMPLE sequence S. */
1309 static inline gimple
1310 gimple_seq_first_stmt (gimple_seq s)
1312 gimple_seq_node n = gimple_seq_first (s);
1313 return n;
1317 /* Return the last node in GIMPLE sequence S. */
1319 static inline gimple_seq_node
1320 gimple_seq_last (gimple_seq s)
1322 return s ? s->prev : NULL;
1326 /* Return the last statement in GIMPLE sequence S. */
1328 static inline gimple
1329 gimple_seq_last_stmt (gimple_seq s)
1331 gimple_seq_node n = gimple_seq_last (s);
1332 return n;
1336 /* Set the last node in GIMPLE sequence *PS to LAST. */
1338 static inline void
1339 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1341 (*ps)->prev = last;
1345 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1347 static inline void
1348 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1350 *ps = first;
1354 /* Return true if GIMPLE sequence S is empty. */
1356 static inline bool
1357 gimple_seq_empty_p (gimple_seq s)
1359 return s == NULL;
1362 /* Allocate a new sequence and initialize its first element with STMT. */
1364 static inline gimple_seq
1365 gimple_seq_alloc_with_stmt (gimple stmt)
1367 gimple_seq seq = NULL;
1368 gimple_seq_add_stmt (&seq, stmt);
1369 return seq;
1373 /* Returns the sequence of statements in BB. */
1375 static inline gimple_seq
1376 bb_seq (const_basic_block bb)
1378 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1381 static inline gimple_seq *
1382 bb_seq_addr (basic_block bb)
1384 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1387 /* Sets the sequence of statements in BB to SEQ. */
1389 static inline void
1390 set_bb_seq (basic_block bb, gimple_seq seq)
1392 gcc_checking_assert (!(bb->flags & BB_RTL));
1393 bb->il.gimple.seq = seq;
1397 /* Return the code for GIMPLE statement G. */
1399 static inline enum gimple_code
1400 gimple_code (const_gimple g)
1402 return g->code;
1406 /* Return the GSS code used by a GIMPLE code. */
1408 static inline enum gimple_statement_structure_enum
1409 gss_for_code (enum gimple_code code)
1411 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1412 return gss_for_code_[code];
1416 /* Return which GSS code is used by GS. */
1418 static inline enum gimple_statement_structure_enum
1419 gimple_statement_structure (gimple gs)
1421 return gss_for_code (gimple_code (gs));
1425 /* Return true if statement G has sub-statements. This is only true for
1426 High GIMPLE statements. */
1428 static inline bool
1429 gimple_has_substatements (gimple g)
1431 switch (gimple_code (g))
1433 case GIMPLE_BIND:
1434 case GIMPLE_CATCH:
1435 case GIMPLE_EH_FILTER:
1436 case GIMPLE_EH_ELSE:
1437 case GIMPLE_TRY:
1438 case GIMPLE_OMP_FOR:
1439 case GIMPLE_OMP_MASTER:
1440 case GIMPLE_OMP_TASKGROUP:
1441 case GIMPLE_OMP_ORDERED:
1442 case GIMPLE_OMP_SECTION:
1443 case GIMPLE_OMP_PARALLEL:
1444 case GIMPLE_OMP_TASK:
1445 case GIMPLE_OMP_SECTIONS:
1446 case GIMPLE_OMP_SINGLE:
1447 case GIMPLE_OMP_TARGET:
1448 case GIMPLE_OMP_TEAMS:
1449 case GIMPLE_OMP_CRITICAL:
1450 case GIMPLE_WITH_CLEANUP_EXPR:
1451 case GIMPLE_TRANSACTION:
1452 return true;
1454 default:
1455 return false;
1460 /* Return the basic block holding statement G. */
1462 static inline basic_block
1463 gimple_bb (const_gimple g)
1465 return g->bb;
1469 /* Return the lexical scope block holding statement G. */
1471 static inline tree
1472 gimple_block (const_gimple g)
1474 return LOCATION_BLOCK (g->location);
1478 /* Set BLOCK to be the lexical scope block holding statement G. */
1480 static inline void
1481 gimple_set_block (gimple g, tree block)
1483 if (block)
1484 g->location =
1485 COMBINE_LOCATION_DATA (line_table, g->location, block);
1486 else
1487 g->location = LOCATION_LOCUS (g->location);
1491 /* Return location information for statement G. */
1493 static inline location_t
1494 gimple_location (const_gimple g)
1496 return g->location;
1499 /* Return pointer to location information for statement G. */
1501 static inline const location_t *
1502 gimple_location_ptr (const_gimple g)
1504 return &g->location;
1508 /* Set location information for statement G. */
1510 static inline void
1511 gimple_set_location (gimple g, location_t location)
1513 g->location = location;
1517 /* Return true if G contains location information. */
1519 static inline bool
1520 gimple_has_location (const_gimple g)
1522 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1526 /* Return the file name of the location of STMT. */
1528 static inline const char *
1529 gimple_filename (const_gimple stmt)
1531 return LOCATION_FILE (gimple_location (stmt));
1535 /* Return the line number of the location of STMT. */
1537 static inline int
1538 gimple_lineno (const_gimple stmt)
1540 return LOCATION_LINE (gimple_location (stmt));
1544 /* Determine whether SEQ is a singleton. */
1546 static inline bool
1547 gimple_seq_singleton_p (gimple_seq seq)
1549 return ((gimple_seq_first (seq) != NULL)
1550 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1553 /* Return true if no warnings should be emitted for statement STMT. */
1555 static inline bool
1556 gimple_no_warning_p (const_gimple stmt)
1558 return stmt->no_warning;
1561 /* Set the no_warning flag of STMT to NO_WARNING. */
1563 static inline void
1564 gimple_set_no_warning (gimple stmt, bool no_warning)
1566 stmt->no_warning = (unsigned) no_warning;
1569 /* Set the visited status on statement STMT to VISITED_P. */
1571 static inline void
1572 gimple_set_visited (gimple stmt, bool visited_p)
1574 stmt->visited = (unsigned) visited_p;
1578 /* Return the visited status for statement STMT. */
1580 static inline bool
1581 gimple_visited_p (gimple stmt)
1583 return stmt->visited;
1587 /* Set pass local flag PLF on statement STMT to VAL_P. */
1589 static inline void
1590 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1592 if (val_p)
1593 stmt->plf |= (unsigned int) plf;
1594 else
1595 stmt->plf &= ~((unsigned int) plf);
1599 /* Return the value of pass local flag PLF on statement STMT. */
1601 static inline unsigned int
1602 gimple_plf (gimple stmt, enum plf_mask plf)
1604 return stmt->plf & ((unsigned int) plf);
1608 /* Set the UID of statement. */
1610 static inline void
1611 gimple_set_uid (gimple g, unsigned uid)
1613 g->uid = uid;
1617 /* Return the UID of statement. */
1619 static inline unsigned
1620 gimple_uid (const_gimple g)
1622 return g->uid;
1626 /* Make statement G a singleton sequence. */
1628 static inline void
1629 gimple_init_singleton (gimple g)
1631 g->next = NULL;
1632 g->prev = g;
1636 /* Return true if GIMPLE statement G has register or memory operands. */
1638 static inline bool
1639 gimple_has_ops (const_gimple g)
1641 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1644 template <>
1645 template <>
1646 inline bool
1647 is_a_helper <const gimple_statement_with_ops>::test (const_gimple gs)
1649 return gimple_has_ops (gs);
1652 template <>
1653 template <>
1654 inline bool
1655 is_a_helper <gimple_statement_with_ops>::test (gimple gs)
1657 return gimple_has_ops (gs);
1660 /* Return true if GIMPLE statement G has memory operands. */
1662 static inline bool
1663 gimple_has_mem_ops (const_gimple g)
1665 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1668 template <>
1669 template <>
1670 inline bool
1671 is_a_helper <const gimple_statement_with_memory_ops>::test (const_gimple gs)
1673 return gimple_has_mem_ops (gs);
1676 template <>
1677 template <>
1678 inline bool
1679 is_a_helper <gimple_statement_with_memory_ops>::test (gimple gs)
1681 return gimple_has_mem_ops (gs);
1684 /* Return the set of USE operands for statement G. */
1686 static inline struct use_optype_d *
1687 gimple_use_ops (const_gimple g)
1689 const gimple_statement_with_ops *ops_stmt =
1690 dyn_cast <const gimple_statement_with_ops> (g);
1691 if (!ops_stmt)
1692 return NULL;
1693 return ops_stmt->use_ops;
1697 /* Set USE to be the set of USE operands for statement G. */
1699 static inline void
1700 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1702 gimple_statement_with_ops *ops_stmt =
1703 as_a <gimple_statement_with_ops> (g);
1704 ops_stmt->use_ops = use;
1708 /* Return the single VUSE operand of the statement G. */
1710 static inline tree
1711 gimple_vuse (const_gimple g)
1713 const gimple_statement_with_memory_ops *mem_ops_stmt =
1714 dyn_cast <const gimple_statement_with_memory_ops> (g);
1715 if (!mem_ops_stmt)
1716 return NULL_TREE;
1717 return mem_ops_stmt->vuse;
1720 /* Return the single VDEF operand of the statement G. */
1722 static inline tree
1723 gimple_vdef (const_gimple g)
1725 const gimple_statement_with_memory_ops *mem_ops_stmt =
1726 dyn_cast <const gimple_statement_with_memory_ops> (g);
1727 if (!mem_ops_stmt)
1728 return NULL_TREE;
1729 return mem_ops_stmt->vdef;
1732 /* Return the single VUSE operand of the statement G. */
1734 static inline tree *
1735 gimple_vuse_ptr (gimple g)
1737 gimple_statement_with_memory_ops *mem_ops_stmt =
1738 dyn_cast <gimple_statement_with_memory_ops> (g);
1739 if (!mem_ops_stmt)
1740 return NULL;
1741 return &mem_ops_stmt->vuse;
1744 /* Return the single VDEF operand of the statement G. */
1746 static inline tree *
1747 gimple_vdef_ptr (gimple g)
1749 gimple_statement_with_memory_ops *mem_ops_stmt =
1750 dyn_cast <gimple_statement_with_memory_ops> (g);
1751 if (!mem_ops_stmt)
1752 return NULL;
1753 return &mem_ops_stmt->vdef;
1756 /* Set the single VUSE operand of the statement G. */
1758 static inline void
1759 gimple_set_vuse (gimple g, tree vuse)
1761 gimple_statement_with_memory_ops *mem_ops_stmt =
1762 as_a <gimple_statement_with_memory_ops> (g);
1763 mem_ops_stmt->vuse = vuse;
1766 /* Set the single VDEF operand of the statement G. */
1768 static inline void
1769 gimple_set_vdef (gimple g, tree vdef)
1771 gimple_statement_with_memory_ops *mem_ops_stmt =
1772 as_a <gimple_statement_with_memory_ops> (g);
1773 mem_ops_stmt->vdef = vdef;
1777 /* Return true if statement G has operands and the modified field has
1778 been set. */
1780 static inline bool
1781 gimple_modified_p (const_gimple g)
1783 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1787 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1788 a MODIFIED field. */
1790 static inline void
1791 gimple_set_modified (gimple s, bool modifiedp)
1793 if (gimple_has_ops (s))
1794 s->modified = (unsigned) modifiedp;
1798 /* Return the tree code for the expression computed by STMT. This is
1799 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1800 GIMPLE_CALL, return CALL_EXPR as the expression code for
1801 consistency. This is useful when the caller needs to deal with the
1802 three kinds of computation that GIMPLE supports. */
1804 static inline enum tree_code
1805 gimple_expr_code (const_gimple stmt)
1807 enum gimple_code code = gimple_code (stmt);
1808 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1809 return (enum tree_code) stmt->subcode;
1810 else
1812 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1813 return CALL_EXPR;
1818 /* Return true if statement STMT contains volatile operands. */
1820 static inline bool
1821 gimple_has_volatile_ops (const_gimple stmt)
1823 if (gimple_has_mem_ops (stmt))
1824 return stmt->has_volatile_ops;
1825 else
1826 return false;
1830 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1832 static inline void
1833 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1835 if (gimple_has_mem_ops (stmt))
1836 stmt->has_volatile_ops = (unsigned) volatilep;
1839 /* Return true if STMT is in a transaction. */
1841 static inline bool
1842 gimple_in_transaction (gimple stmt)
1844 return bb_in_transaction (gimple_bb (stmt));
1847 /* Return true if statement STMT may access memory. */
1849 static inline bool
1850 gimple_references_memory_p (gimple stmt)
1852 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1856 /* Return the subcode for OMP statement S. */
1858 static inline unsigned
1859 gimple_omp_subcode (const_gimple s)
1861 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1862 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1863 return s->subcode;
1866 /* Set the subcode for OMP statement S to SUBCODE. */
1868 static inline void
1869 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1871 /* We only have 16 bits for the subcode. Assert that we are not
1872 overflowing it. */
1873 gcc_gimple_checking_assert (subcode < (1 << 16));
1874 s->subcode = subcode;
1877 /* Set the nowait flag on OMP_RETURN statement S. */
1879 static inline void
1880 gimple_omp_return_set_nowait (gimple s)
1882 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1883 s->subcode |= GF_OMP_RETURN_NOWAIT;
1887 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1888 flag set. */
1890 static inline bool
1891 gimple_omp_return_nowait_p (const_gimple g)
1893 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1894 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1898 /* Set the LHS of OMP return. */
1900 static inline void
1901 gimple_omp_return_set_lhs (gimple g, tree lhs)
1903 gimple_statement_omp_return *omp_return_stmt =
1904 as_a <gimple_statement_omp_return> (g);
1905 omp_return_stmt->val = lhs;
1909 /* Get the LHS of OMP return. */
1911 static inline tree
1912 gimple_omp_return_lhs (const_gimple g)
1914 const gimple_statement_omp_return *omp_return_stmt =
1915 as_a <const gimple_statement_omp_return> (g);
1916 return omp_return_stmt->val;
1920 /* Return a pointer to the LHS of OMP return. */
1922 static inline tree *
1923 gimple_omp_return_lhs_ptr (gimple g)
1925 gimple_statement_omp_return *omp_return_stmt =
1926 as_a <gimple_statement_omp_return> (g);
1927 return &omp_return_stmt->val;
1931 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1932 flag set. */
1934 static inline bool
1935 gimple_omp_section_last_p (const_gimple g)
1937 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1938 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1942 /* Set the GF_OMP_SECTION_LAST flag on G. */
1944 static inline void
1945 gimple_omp_section_set_last (gimple g)
1947 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1948 g->subcode |= GF_OMP_SECTION_LAST;
1952 /* Return true if OMP parallel statement G has the
1953 GF_OMP_PARALLEL_COMBINED flag set. */
1955 static inline bool
1956 gimple_omp_parallel_combined_p (const_gimple g)
1958 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1959 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1963 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1964 value of COMBINED_P. */
1966 static inline void
1967 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1969 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1970 if (combined_p)
1971 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1972 else
1973 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1977 /* Return true if OMP atomic load/store statement G has the
1978 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1980 static inline bool
1981 gimple_omp_atomic_need_value_p (const_gimple g)
1983 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1984 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1985 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1989 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1991 static inline void
1992 gimple_omp_atomic_set_need_value (gimple g)
1994 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1995 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1996 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2000 /* Return true if OMP atomic load/store statement G has the
2001 GF_OMP_ATOMIC_SEQ_CST flag set. */
2003 static inline bool
2004 gimple_omp_atomic_seq_cst_p (const_gimple g)
2006 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2007 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2008 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2012 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2014 static inline void
2015 gimple_omp_atomic_set_seq_cst (gimple g)
2017 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2018 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2019 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2023 /* Return the number of operands for statement GS. */
2025 static inline unsigned
2026 gimple_num_ops (const_gimple gs)
2028 return gs->num_ops;
2032 /* Set the number of operands for statement GS. */
2034 static inline void
2035 gimple_set_num_ops (gimple gs, unsigned num_ops)
2037 gs->num_ops = num_ops;
2041 /* Return the array of operands for statement GS. */
2043 static inline tree *
2044 gimple_ops (gimple gs)
2046 size_t off;
2048 /* All the tuples have their operand vector at the very bottom
2049 of the structure. Note that those structures that do not
2050 have an operand vector have a zero offset. */
2051 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2052 gcc_gimple_checking_assert (off != 0);
2054 return (tree *) ((char *) gs + off);
2058 /* Return operand I for statement GS. */
2060 static inline tree
2061 gimple_op (const_gimple gs, unsigned i)
2063 if (gimple_has_ops (gs))
2065 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2066 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2068 else
2069 return NULL_TREE;
2072 /* Return a pointer to operand I for statement GS. */
2074 static inline tree *
2075 gimple_op_ptr (const_gimple gs, unsigned i)
2077 if (gimple_has_ops (gs))
2079 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2080 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2082 else
2083 return NULL;
2086 /* Set operand I of statement GS to OP. */
2088 static inline void
2089 gimple_set_op (gimple gs, unsigned i, tree op)
2091 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2093 /* Note. It may be tempting to assert that OP matches
2094 is_gimple_operand, but that would be wrong. Different tuples
2095 accept slightly different sets of tree operands. Each caller
2096 should perform its own validation. */
2097 gimple_ops (gs)[i] = op;
2100 /* Return true if GS is a GIMPLE_ASSIGN. */
2102 static inline bool
2103 is_gimple_assign (const_gimple gs)
2105 return gimple_code (gs) == GIMPLE_ASSIGN;
2108 /* Determine if expression CODE is one of the valid expressions that can
2109 be used on the RHS of GIMPLE assignments. */
2111 static inline enum gimple_rhs_class
2112 get_gimple_rhs_class (enum tree_code code)
2114 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2117 /* Return the LHS of assignment statement GS. */
2119 static inline tree
2120 gimple_assign_lhs (const_gimple gs)
2122 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2123 return gimple_op (gs, 0);
2127 /* Return a pointer to the LHS of assignment statement GS. */
2129 static inline tree *
2130 gimple_assign_lhs_ptr (const_gimple gs)
2132 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2133 return gimple_op_ptr (gs, 0);
2137 /* Set LHS to be the LHS operand of assignment statement GS. */
2139 static inline void
2140 gimple_assign_set_lhs (gimple gs, tree lhs)
2142 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2143 gimple_set_op (gs, 0, lhs);
2145 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2146 SSA_NAME_DEF_STMT (lhs) = gs;
2150 /* Return the first operand on the RHS of assignment statement GS. */
2152 static inline tree
2153 gimple_assign_rhs1 (const_gimple gs)
2155 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2156 return gimple_op (gs, 1);
2160 /* Return a pointer to the first operand on the RHS of assignment
2161 statement GS. */
2163 static inline tree *
2164 gimple_assign_rhs1_ptr (const_gimple gs)
2166 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2167 return gimple_op_ptr (gs, 1);
2170 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2172 static inline void
2173 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2175 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2177 gimple_set_op (gs, 1, rhs);
2181 /* Return the second operand on the RHS of assignment statement GS.
2182 If GS does not have two operands, NULL is returned instead. */
2184 static inline tree
2185 gimple_assign_rhs2 (const_gimple gs)
2187 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2189 if (gimple_num_ops (gs) >= 3)
2190 return gimple_op (gs, 2);
2191 else
2192 return NULL_TREE;
2196 /* Return a pointer to the second operand on the RHS of assignment
2197 statement GS. */
2199 static inline tree *
2200 gimple_assign_rhs2_ptr (const_gimple gs)
2202 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2203 return gimple_op_ptr (gs, 2);
2207 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2209 static inline void
2210 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2212 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2214 gimple_set_op (gs, 2, rhs);
2217 /* Return the third operand on the RHS of assignment statement GS.
2218 If GS does not have two operands, NULL is returned instead. */
2220 static inline tree
2221 gimple_assign_rhs3 (const_gimple gs)
2223 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2225 if (gimple_num_ops (gs) >= 4)
2226 return gimple_op (gs, 3);
2227 else
2228 return NULL_TREE;
2231 /* Return a pointer to the third operand on the RHS of assignment
2232 statement GS. */
2234 static inline tree *
2235 gimple_assign_rhs3_ptr (const_gimple gs)
2237 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2238 return gimple_op_ptr (gs, 3);
2242 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2244 static inline void
2245 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2247 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2249 gimple_set_op (gs, 3, rhs);
2252 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2253 to see only a maximum of two operands. */
2255 static inline void
2256 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2257 tree op1, tree op2)
2259 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2262 /* Returns true if GS is a nontemporal move. */
2264 static inline bool
2265 gimple_assign_nontemporal_move_p (const_gimple gs)
2267 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2268 return gs->nontemporal_move;
2271 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2273 static inline void
2274 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2276 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2277 gs->nontemporal_move = nontemporal;
2281 /* Return the code of the expression computed on the rhs of assignment
2282 statement GS. In case that the RHS is a single object, returns the
2283 tree code of the object. */
2285 static inline enum tree_code
2286 gimple_assign_rhs_code (const_gimple gs)
2288 enum tree_code code;
2289 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2291 code = (enum tree_code) gs->subcode;
2292 /* While we initially set subcode to the TREE_CODE of the rhs for
2293 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2294 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2295 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2296 code = TREE_CODE (gimple_assign_rhs1 (gs));
2298 return code;
2302 /* Set CODE to be the code for the expression computed on the RHS of
2303 assignment S. */
2305 static inline void
2306 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2308 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2309 s->subcode = code;
2313 /* Return the gimple rhs class of the code of the expression computed on
2314 the rhs of assignment statement GS.
2315 This will never return GIMPLE_INVALID_RHS. */
2317 static inline enum gimple_rhs_class
2318 gimple_assign_rhs_class (const_gimple gs)
2320 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2323 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2324 there is no operator associated with the assignment itself.
2325 Unlike gimple_assign_copy_p, this predicate returns true for
2326 any RHS operand, including those that perform an operation
2327 and do not have the semantics of a copy, such as COND_EXPR. */
2329 static inline bool
2330 gimple_assign_single_p (gimple gs)
2332 return (is_gimple_assign (gs)
2333 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2336 /* Return true if GS performs a store to its lhs. */
2338 static inline bool
2339 gimple_store_p (gimple gs)
2341 tree lhs = gimple_get_lhs (gs);
2342 return lhs && !is_gimple_reg (lhs);
2345 /* Return true if GS is an assignment that loads from its rhs1. */
2347 static inline bool
2348 gimple_assign_load_p (gimple gs)
2350 tree rhs;
2351 if (!gimple_assign_single_p (gs))
2352 return false;
2353 rhs = gimple_assign_rhs1 (gs);
2354 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2355 return true;
2356 rhs = get_base_address (rhs);
2357 return (DECL_P (rhs)
2358 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2362 /* Return true if S is a type-cast assignment. */
2364 static inline bool
2365 gimple_assign_cast_p (gimple s)
2367 if (is_gimple_assign (s))
2369 enum tree_code sc = gimple_assign_rhs_code (s);
2370 return CONVERT_EXPR_CODE_P (sc)
2371 || sc == VIEW_CONVERT_EXPR
2372 || sc == FIX_TRUNC_EXPR;
2375 return false;
2378 /* Return true if S is a clobber statement. */
2380 static inline bool
2381 gimple_clobber_p (gimple s)
2383 return gimple_assign_single_p (s)
2384 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2387 /* Return true if GS is a GIMPLE_CALL. */
2389 static inline bool
2390 is_gimple_call (const_gimple gs)
2392 return gimple_code (gs) == GIMPLE_CALL;
2395 /* Return the LHS of call statement GS. */
2397 static inline tree
2398 gimple_call_lhs (const_gimple gs)
2400 GIMPLE_CHECK (gs, GIMPLE_CALL);
2401 return gimple_op (gs, 0);
2405 /* Return a pointer to the LHS of call statement GS. */
2407 static inline tree *
2408 gimple_call_lhs_ptr (const_gimple gs)
2410 GIMPLE_CHECK (gs, GIMPLE_CALL);
2411 return gimple_op_ptr (gs, 0);
2415 /* Set LHS to be the LHS operand of call statement GS. */
2417 static inline void
2418 gimple_call_set_lhs (gimple gs, tree lhs)
2420 GIMPLE_CHECK (gs, GIMPLE_CALL);
2421 gimple_set_op (gs, 0, lhs);
2422 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2423 SSA_NAME_DEF_STMT (lhs) = gs;
2427 /* Return true if call GS calls an internal-only function, as enumerated
2428 by internal_fn. */
2430 static inline bool
2431 gimple_call_internal_p (const_gimple gs)
2433 GIMPLE_CHECK (gs, GIMPLE_CALL);
2434 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2438 /* Return the target of internal call GS. */
2440 static inline enum internal_fn
2441 gimple_call_internal_fn (const_gimple gs)
2443 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2444 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2448 /* Return the function type of the function called by GS. */
2450 static inline tree
2451 gimple_call_fntype (const_gimple gs)
2453 const gimple_statement_call *call_stmt =
2454 as_a <const gimple_statement_call> (gs);
2455 if (gimple_call_internal_p (gs))
2456 return NULL_TREE;
2457 return call_stmt->u.fntype;
2460 /* Set the type of the function called by GS to FNTYPE. */
2462 static inline void
2463 gimple_call_set_fntype (gimple gs, tree fntype)
2465 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2466 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2467 call_stmt->u.fntype = fntype;
2471 /* Return the tree node representing the function called by call
2472 statement GS. */
2474 static inline tree
2475 gimple_call_fn (const_gimple gs)
2477 GIMPLE_CHECK (gs, GIMPLE_CALL);
2478 return gimple_op (gs, 1);
2481 /* Return a pointer to the tree node representing the function called by call
2482 statement GS. */
2484 static inline tree *
2485 gimple_call_fn_ptr (const_gimple gs)
2487 GIMPLE_CHECK (gs, GIMPLE_CALL);
2488 return gimple_op_ptr (gs, 1);
2492 /* Set FN to be the function called by call statement GS. */
2494 static inline void
2495 gimple_call_set_fn (gimple gs, tree fn)
2497 GIMPLE_CHECK (gs, GIMPLE_CALL);
2498 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2499 gimple_set_op (gs, 1, fn);
2503 /* Set FNDECL to be the function called by call statement GS. */
2505 static inline void
2506 gimple_call_set_fndecl (gimple gs, tree decl)
2508 GIMPLE_CHECK (gs, GIMPLE_CALL);
2509 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2510 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2514 /* Set internal function FN to be the function called by call statement GS. */
2516 static inline void
2517 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2519 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2520 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2521 call_stmt->u.internal_fn = fn;
2525 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2526 Otherwise return NULL. This function is analogous to
2527 get_callee_fndecl in tree land. */
2529 static inline tree
2530 gimple_call_fndecl (const_gimple gs)
2532 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2536 /* Return the type returned by call statement GS. */
2538 static inline tree
2539 gimple_call_return_type (const_gimple gs)
2541 tree type = gimple_call_fntype (gs);
2543 if (type == NULL_TREE)
2544 return TREE_TYPE (gimple_call_lhs (gs));
2546 /* The type returned by a function is the type of its
2547 function type. */
2548 return TREE_TYPE (type);
2552 /* Return the static chain for call statement GS. */
2554 static inline tree
2555 gimple_call_chain (const_gimple gs)
2557 GIMPLE_CHECK (gs, GIMPLE_CALL);
2558 return gimple_op (gs, 2);
2562 /* Return a pointer to the static chain for call statement GS. */
2564 static inline tree *
2565 gimple_call_chain_ptr (const_gimple gs)
2567 GIMPLE_CHECK (gs, GIMPLE_CALL);
2568 return gimple_op_ptr (gs, 2);
2571 /* Set CHAIN to be the static chain for call statement GS. */
2573 static inline void
2574 gimple_call_set_chain (gimple gs, tree chain)
2576 GIMPLE_CHECK (gs, GIMPLE_CALL);
2578 gimple_set_op (gs, 2, chain);
2582 /* Return the number of arguments used by call statement GS. */
2584 static inline unsigned
2585 gimple_call_num_args (const_gimple gs)
2587 unsigned num_ops;
2588 GIMPLE_CHECK (gs, GIMPLE_CALL);
2589 num_ops = gimple_num_ops (gs);
2590 return num_ops - 3;
2594 /* Return the argument at position INDEX for call statement GS. */
2596 static inline tree
2597 gimple_call_arg (const_gimple gs, unsigned index)
2599 GIMPLE_CHECK (gs, GIMPLE_CALL);
2600 return gimple_op (gs, index + 3);
2604 /* Return a pointer to the argument at position INDEX for call
2605 statement GS. */
2607 static inline tree *
2608 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2610 GIMPLE_CHECK (gs, GIMPLE_CALL);
2611 return gimple_op_ptr (gs, index + 3);
2615 /* Set ARG to be the argument at position INDEX for call statement GS. */
2617 static inline void
2618 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2620 GIMPLE_CHECK (gs, GIMPLE_CALL);
2621 gimple_set_op (gs, index + 3, arg);
2625 /* If TAIL_P is true, mark call statement S as being a tail call
2626 (i.e., a call just before the exit of a function). These calls are
2627 candidate for tail call optimization. */
2629 static inline void
2630 gimple_call_set_tail (gimple s, bool tail_p)
2632 GIMPLE_CHECK (s, GIMPLE_CALL);
2633 if (tail_p)
2634 s->subcode |= GF_CALL_TAILCALL;
2635 else
2636 s->subcode &= ~GF_CALL_TAILCALL;
2640 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2642 static inline bool
2643 gimple_call_tail_p (gimple s)
2645 GIMPLE_CHECK (s, GIMPLE_CALL);
2646 return (s->subcode & GF_CALL_TAILCALL) != 0;
2650 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2651 slot optimization. This transformation uses the target of the call
2652 expansion as the return slot for calls that return in memory. */
2654 static inline void
2655 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2657 GIMPLE_CHECK (s, GIMPLE_CALL);
2658 if (return_slot_opt_p)
2659 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2660 else
2661 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2665 /* Return true if S is marked for return slot optimization. */
2667 static inline bool
2668 gimple_call_return_slot_opt_p (gimple s)
2670 GIMPLE_CHECK (s, GIMPLE_CALL);
2671 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2675 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2676 thunk to the thunked-to function. */
2678 static inline void
2679 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2681 GIMPLE_CHECK (s, GIMPLE_CALL);
2682 if (from_thunk_p)
2683 s->subcode |= GF_CALL_FROM_THUNK;
2684 else
2685 s->subcode &= ~GF_CALL_FROM_THUNK;
2689 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2691 static inline bool
2692 gimple_call_from_thunk_p (gimple s)
2694 GIMPLE_CHECK (s, GIMPLE_CALL);
2695 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2699 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2700 argument pack in its argument list. */
2702 static inline void
2703 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2705 GIMPLE_CHECK (s, GIMPLE_CALL);
2706 if (pass_arg_pack_p)
2707 s->subcode |= GF_CALL_VA_ARG_PACK;
2708 else
2709 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2713 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2714 argument pack in its argument list. */
2716 static inline bool
2717 gimple_call_va_arg_pack_p (gimple s)
2719 GIMPLE_CHECK (s, GIMPLE_CALL);
2720 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2724 /* Return true if S is a noreturn call. */
2726 static inline bool
2727 gimple_call_noreturn_p (gimple s)
2729 GIMPLE_CHECK (s, GIMPLE_CALL);
2730 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2734 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2735 even if the called function can throw in other cases. */
2737 static inline void
2738 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2740 GIMPLE_CHECK (s, GIMPLE_CALL);
2741 if (nothrow_p)
2742 s->subcode |= GF_CALL_NOTHROW;
2743 else
2744 s->subcode &= ~GF_CALL_NOTHROW;
2747 /* Return true if S is a nothrow call. */
2749 static inline bool
2750 gimple_call_nothrow_p (gimple s)
2752 GIMPLE_CHECK (s, GIMPLE_CALL);
2753 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2756 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2757 is known to be emitted for VLA objects. Those are wrapped by
2758 stack_save/stack_restore calls and hence can't lead to unbounded
2759 stack growth even when they occur in loops. */
2761 static inline void
2762 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2764 GIMPLE_CHECK (s, GIMPLE_CALL);
2765 if (for_var)
2766 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2767 else
2768 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2771 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2773 static inline bool
2774 gimple_call_alloca_for_var_p (gimple s)
2776 GIMPLE_CHECK (s, GIMPLE_CALL);
2777 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2780 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2782 static inline void
2783 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2785 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2786 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2787 dest_call->subcode = orig_call->subcode;
2791 /* Return a pointer to the points-to solution for the set of call-used
2792 variables of the call CALL. */
2794 static inline struct pt_solution *
2795 gimple_call_use_set (gimple call)
2797 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2798 return &call_stmt->call_used;
2802 /* Return a pointer to the points-to solution for the set of call-used
2803 variables of the call CALL. */
2805 static inline struct pt_solution *
2806 gimple_call_clobber_set (gimple call)
2808 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2809 return &call_stmt->call_clobbered;
2813 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2814 non-NULL lhs. */
2816 static inline bool
2817 gimple_has_lhs (gimple stmt)
2819 return (is_gimple_assign (stmt)
2820 || (is_gimple_call (stmt)
2821 && gimple_call_lhs (stmt) != NULL_TREE));
2825 /* Return the code of the predicate computed by conditional statement GS. */
2827 static inline enum tree_code
2828 gimple_cond_code (const_gimple gs)
2830 GIMPLE_CHECK (gs, GIMPLE_COND);
2831 return (enum tree_code) gs->subcode;
2835 /* Set CODE to be the predicate code for the conditional statement GS. */
2837 static inline void
2838 gimple_cond_set_code (gimple gs, enum tree_code code)
2840 GIMPLE_CHECK (gs, GIMPLE_COND);
2841 gs->subcode = code;
2845 /* Return the LHS of the predicate computed by conditional statement GS. */
2847 static inline tree
2848 gimple_cond_lhs (const_gimple gs)
2850 GIMPLE_CHECK (gs, GIMPLE_COND);
2851 return gimple_op (gs, 0);
2854 /* Return the pointer to the LHS of the predicate computed by conditional
2855 statement GS. */
2857 static inline tree *
2858 gimple_cond_lhs_ptr (const_gimple gs)
2860 GIMPLE_CHECK (gs, GIMPLE_COND);
2861 return gimple_op_ptr (gs, 0);
2864 /* Set LHS to be the LHS operand of the predicate computed by
2865 conditional statement GS. */
2867 static inline void
2868 gimple_cond_set_lhs (gimple gs, tree lhs)
2870 GIMPLE_CHECK (gs, GIMPLE_COND);
2871 gimple_set_op (gs, 0, lhs);
2875 /* Return the RHS operand of the predicate computed by conditional GS. */
2877 static inline tree
2878 gimple_cond_rhs (const_gimple gs)
2880 GIMPLE_CHECK (gs, GIMPLE_COND);
2881 return gimple_op (gs, 1);
2884 /* Return the pointer to the RHS operand of the predicate computed by
2885 conditional GS. */
2887 static inline tree *
2888 gimple_cond_rhs_ptr (const_gimple gs)
2890 GIMPLE_CHECK (gs, GIMPLE_COND);
2891 return gimple_op_ptr (gs, 1);
2895 /* Set RHS to be the RHS operand of the predicate computed by
2896 conditional statement GS. */
2898 static inline void
2899 gimple_cond_set_rhs (gimple gs, tree rhs)
2901 GIMPLE_CHECK (gs, GIMPLE_COND);
2902 gimple_set_op (gs, 1, rhs);
2906 /* Return the label used by conditional statement GS when its
2907 predicate evaluates to true. */
2909 static inline tree
2910 gimple_cond_true_label (const_gimple gs)
2912 GIMPLE_CHECK (gs, GIMPLE_COND);
2913 return gimple_op (gs, 2);
2917 /* Set LABEL to be the label used by conditional statement GS when its
2918 predicate evaluates to true. */
2920 static inline void
2921 gimple_cond_set_true_label (gimple gs, tree label)
2923 GIMPLE_CHECK (gs, GIMPLE_COND);
2924 gimple_set_op (gs, 2, label);
2928 /* Set LABEL to be the label used by conditional statement GS when its
2929 predicate evaluates to false. */
2931 static inline void
2932 gimple_cond_set_false_label (gimple gs, tree label)
2934 GIMPLE_CHECK (gs, GIMPLE_COND);
2935 gimple_set_op (gs, 3, label);
2939 /* Return the label used by conditional statement GS when its
2940 predicate evaluates to false. */
2942 static inline tree
2943 gimple_cond_false_label (const_gimple gs)
2945 GIMPLE_CHECK (gs, GIMPLE_COND);
2946 return gimple_op (gs, 3);
2950 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2952 static inline void
2953 gimple_cond_make_false (gimple gs)
2955 gimple_cond_set_lhs (gs, boolean_true_node);
2956 gimple_cond_set_rhs (gs, boolean_false_node);
2957 gs->subcode = EQ_EXPR;
2961 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2963 static inline void
2964 gimple_cond_make_true (gimple gs)
2966 gimple_cond_set_lhs (gs, boolean_true_node);
2967 gimple_cond_set_rhs (gs, boolean_true_node);
2968 gs->subcode = EQ_EXPR;
2971 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2972 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2974 static inline bool
2975 gimple_cond_true_p (const_gimple gs)
2977 tree lhs = gimple_cond_lhs (gs);
2978 tree rhs = gimple_cond_rhs (gs);
2979 enum tree_code code = gimple_cond_code (gs);
2981 if (lhs != boolean_true_node && lhs != boolean_false_node)
2982 return false;
2984 if (rhs != boolean_true_node && rhs != boolean_false_node)
2985 return false;
2987 if (code == NE_EXPR && lhs != rhs)
2988 return true;
2990 if (code == EQ_EXPR && lhs == rhs)
2991 return true;
2993 return false;
2996 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2997 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2999 static inline bool
3000 gimple_cond_false_p (const_gimple gs)
3002 tree lhs = gimple_cond_lhs (gs);
3003 tree rhs = gimple_cond_rhs (gs);
3004 enum tree_code code = gimple_cond_code (gs);
3006 if (lhs != boolean_true_node && lhs != boolean_false_node)
3007 return false;
3009 if (rhs != boolean_true_node && rhs != boolean_false_node)
3010 return false;
3012 if (code == NE_EXPR && lhs == rhs)
3013 return true;
3015 if (code == EQ_EXPR && lhs != rhs)
3016 return true;
3018 return false;
3021 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3023 static inline void
3024 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3026 gimple_cond_set_code (stmt, code);
3027 gimple_cond_set_lhs (stmt, lhs);
3028 gimple_cond_set_rhs (stmt, rhs);
3031 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3033 static inline tree
3034 gimple_label_label (const_gimple gs)
3036 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3037 return gimple_op (gs, 0);
3041 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3042 GS. */
3044 static inline void
3045 gimple_label_set_label (gimple gs, tree label)
3047 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3048 gimple_set_op (gs, 0, label);
3052 /* Return the destination of the unconditional jump GS. */
3054 static inline tree
3055 gimple_goto_dest (const_gimple gs)
3057 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3058 return gimple_op (gs, 0);
3062 /* Set DEST to be the destination of the unconditonal jump GS. */
3064 static inline void
3065 gimple_goto_set_dest (gimple gs, tree dest)
3067 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3068 gimple_set_op (gs, 0, dest);
3072 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3074 static inline tree
3075 gimple_bind_vars (const_gimple gs)
3077 const gimple_statement_bind *bind_stmt =
3078 as_a <const gimple_statement_bind> (gs);
3079 return bind_stmt->vars;
3083 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3084 statement GS. */
3086 static inline void
3087 gimple_bind_set_vars (gimple gs, tree vars)
3089 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3090 bind_stmt->vars = vars;
3094 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3095 statement GS. */
3097 static inline void
3098 gimple_bind_append_vars (gimple gs, tree vars)
3100 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3101 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3105 static inline gimple_seq *
3106 gimple_bind_body_ptr (gimple gs)
3108 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3109 return &bind_stmt->body;
3112 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3114 static inline gimple_seq
3115 gimple_bind_body (gimple gs)
3117 return *gimple_bind_body_ptr (gs);
3121 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3122 statement GS. */
3124 static inline void
3125 gimple_bind_set_body (gimple gs, gimple_seq seq)
3127 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3128 bind_stmt->body = seq;
3132 /* Append a statement to the end of a GIMPLE_BIND's body. */
3134 static inline void
3135 gimple_bind_add_stmt (gimple gs, gimple stmt)
3137 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3138 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3142 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3144 static inline void
3145 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3147 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3148 gimple_seq_add_seq (&bind_stmt->body, seq);
3152 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3153 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3155 static inline tree
3156 gimple_bind_block (const_gimple gs)
3158 const gimple_statement_bind *bind_stmt =
3159 as_a <const gimple_statement_bind> (gs);
3160 return bind_stmt->block;
3164 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3165 statement GS. */
3167 static inline void
3168 gimple_bind_set_block (gimple gs, tree block)
3170 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3171 gcc_gimple_checking_assert (block == NULL_TREE
3172 || TREE_CODE (block) == BLOCK);
3173 bind_stmt->block = block;
3177 /* Return the number of input operands for GIMPLE_ASM GS. */
3179 static inline unsigned
3180 gimple_asm_ninputs (const_gimple gs)
3182 const gimple_statement_asm *asm_stmt =
3183 as_a <const gimple_statement_asm> (gs);
3184 return asm_stmt->ni;
3188 /* Return the number of output operands for GIMPLE_ASM GS. */
3190 static inline unsigned
3191 gimple_asm_noutputs (const_gimple gs)
3193 const gimple_statement_asm *asm_stmt =
3194 as_a <const gimple_statement_asm> (gs);
3195 return asm_stmt->no;
3199 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3201 static inline unsigned
3202 gimple_asm_nclobbers (const_gimple gs)
3204 const gimple_statement_asm *asm_stmt =
3205 as_a <const gimple_statement_asm> (gs);
3206 return asm_stmt->nc;
3209 /* Return the number of label operands for GIMPLE_ASM GS. */
3211 static inline unsigned
3212 gimple_asm_nlabels (const_gimple gs)
3214 const gimple_statement_asm *asm_stmt =
3215 as_a <const gimple_statement_asm> (gs);
3216 return asm_stmt->nl;
3219 /* Return input operand INDEX of GIMPLE_ASM GS. */
3221 static inline tree
3222 gimple_asm_input_op (const_gimple gs, unsigned index)
3224 const gimple_statement_asm *asm_stmt =
3225 as_a <const gimple_statement_asm> (gs);
3226 gcc_gimple_checking_assert (index < asm_stmt->ni);
3227 return gimple_op (gs, index + asm_stmt->no);
3230 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3232 static inline tree *
3233 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3235 const gimple_statement_asm *asm_stmt =
3236 as_a <const gimple_statement_asm> (gs);
3237 gcc_gimple_checking_assert (index < asm_stmt->ni);
3238 return gimple_op_ptr (gs, index + asm_stmt->no);
3242 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3244 static inline void
3245 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3247 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3248 gcc_gimple_checking_assert (index < asm_stmt->ni
3249 && TREE_CODE (in_op) == TREE_LIST);
3250 gimple_set_op (gs, index + asm_stmt->no, in_op);
3254 /* Return output operand INDEX of GIMPLE_ASM GS. */
3256 static inline tree
3257 gimple_asm_output_op (const_gimple gs, unsigned index)
3259 const gimple_statement_asm *asm_stmt =
3260 as_a <const gimple_statement_asm> (gs);
3261 gcc_gimple_checking_assert (index < asm_stmt->no);
3262 return gimple_op (gs, index);
3265 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3267 static inline tree *
3268 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3270 const gimple_statement_asm *asm_stmt =
3271 as_a <const gimple_statement_asm> (gs);
3272 gcc_gimple_checking_assert (index < asm_stmt->no);
3273 return gimple_op_ptr (gs, index);
3277 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3279 static inline void
3280 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3282 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3283 gcc_gimple_checking_assert (index < asm_stmt->no
3284 && TREE_CODE (out_op) == TREE_LIST);
3285 gimple_set_op (gs, index, out_op);
3289 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3291 static inline tree
3292 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3294 const gimple_statement_asm *asm_stmt =
3295 as_a <const gimple_statement_asm> (gs);
3296 gcc_gimple_checking_assert (index < asm_stmt->nc);
3297 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3301 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3303 static inline void
3304 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3306 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3307 gcc_gimple_checking_assert (index < asm_stmt->nc
3308 && TREE_CODE (clobber_op) == TREE_LIST);
3309 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3312 /* Return label operand INDEX of GIMPLE_ASM GS. */
3314 static inline tree
3315 gimple_asm_label_op (const_gimple gs, unsigned index)
3317 const gimple_statement_asm *asm_stmt =
3318 as_a <const gimple_statement_asm> (gs);
3319 gcc_gimple_checking_assert (index < asm_stmt->nl);
3320 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3323 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3325 static inline void
3326 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3328 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3329 gcc_gimple_checking_assert (index < asm_stmt->nl
3330 && TREE_CODE (label_op) == TREE_LIST);
3331 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3334 /* Return the string representing the assembly instruction in
3335 GIMPLE_ASM GS. */
3337 static inline const char *
3338 gimple_asm_string (const_gimple gs)
3340 const gimple_statement_asm *asm_stmt =
3341 as_a <const gimple_statement_asm> (gs);
3342 return asm_stmt->string;
3346 /* Return true if GS is an asm statement marked volatile. */
3348 static inline bool
3349 gimple_asm_volatile_p (const_gimple gs)
3351 GIMPLE_CHECK (gs, GIMPLE_ASM);
3352 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3356 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3358 static inline void
3359 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3361 GIMPLE_CHECK (gs, GIMPLE_ASM);
3362 if (volatile_p)
3363 gs->subcode |= GF_ASM_VOLATILE;
3364 else
3365 gs->subcode &= ~GF_ASM_VOLATILE;
3369 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3371 static inline void
3372 gimple_asm_set_input (gimple gs, bool input_p)
3374 GIMPLE_CHECK (gs, GIMPLE_ASM);
3375 if (input_p)
3376 gs->subcode |= GF_ASM_INPUT;
3377 else
3378 gs->subcode &= ~GF_ASM_INPUT;
3382 /* Return true if asm GS is an ASM_INPUT. */
3384 static inline bool
3385 gimple_asm_input_p (const_gimple gs)
3387 GIMPLE_CHECK (gs, GIMPLE_ASM);
3388 return (gs->subcode & GF_ASM_INPUT) != 0;
3392 /* Return the types handled by GIMPLE_CATCH statement GS. */
3394 static inline tree
3395 gimple_catch_types (const_gimple gs)
3397 const gimple_statement_catch *catch_stmt =
3398 as_a <const gimple_statement_catch> (gs);
3399 return catch_stmt->types;
3403 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3405 static inline tree *
3406 gimple_catch_types_ptr (gimple gs)
3408 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3409 return &catch_stmt->types;
3413 /* Return a pointer to the GIMPLE sequence representing the body of
3414 the handler of GIMPLE_CATCH statement GS. */
3416 static inline gimple_seq *
3417 gimple_catch_handler_ptr (gimple gs)
3419 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3420 return &catch_stmt->handler;
3424 /* Return the GIMPLE sequence representing the body of the handler of
3425 GIMPLE_CATCH statement GS. */
3427 static inline gimple_seq
3428 gimple_catch_handler (gimple gs)
3430 return *gimple_catch_handler_ptr (gs);
3434 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3436 static inline void
3437 gimple_catch_set_types (gimple gs, tree t)
3439 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3440 catch_stmt->types = t;
3444 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3446 static inline void
3447 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3449 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3450 catch_stmt->handler = handler;
3454 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3456 static inline tree
3457 gimple_eh_filter_types (const_gimple gs)
3459 const gimple_statement_eh_filter *eh_filter_stmt =
3460 as_a <const gimple_statement_eh_filter> (gs);
3461 return eh_filter_stmt->types;
3465 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3466 GS. */
3468 static inline tree *
3469 gimple_eh_filter_types_ptr (gimple gs)
3471 gimple_statement_eh_filter *eh_filter_stmt =
3472 as_a <gimple_statement_eh_filter> (gs);
3473 return &eh_filter_stmt->types;
3477 /* Return a pointer to the sequence of statement to execute when
3478 GIMPLE_EH_FILTER statement fails. */
3480 static inline gimple_seq *
3481 gimple_eh_filter_failure_ptr (gimple gs)
3483 gimple_statement_eh_filter *eh_filter_stmt =
3484 as_a <gimple_statement_eh_filter> (gs);
3485 return &eh_filter_stmt->failure;
3489 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3490 statement fails. */
3492 static inline gimple_seq
3493 gimple_eh_filter_failure (gimple gs)
3495 return *gimple_eh_filter_failure_ptr (gs);
3499 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3501 static inline void
3502 gimple_eh_filter_set_types (gimple gs, tree types)
3504 gimple_statement_eh_filter *eh_filter_stmt =
3505 as_a <gimple_statement_eh_filter> (gs);
3506 eh_filter_stmt->types = types;
3510 /* Set FAILURE to be the sequence of statements to execute on failure
3511 for GIMPLE_EH_FILTER GS. */
3513 static inline void
3514 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3516 gimple_statement_eh_filter *eh_filter_stmt =
3517 as_a <gimple_statement_eh_filter> (gs);
3518 eh_filter_stmt->failure = failure;
3521 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3523 static inline tree
3524 gimple_eh_must_not_throw_fndecl (gimple gs)
3526 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3527 return eh_mnt_stmt->fndecl;
3530 /* Set the function decl to be called by GS to DECL. */
3532 static inline void
3533 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3535 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3536 eh_mnt_stmt->fndecl = decl;
3539 /* GIMPLE_EH_ELSE accessors. */
3541 static inline gimple_seq *
3542 gimple_eh_else_n_body_ptr (gimple gs)
3544 gimple_statement_eh_else *eh_else_stmt =
3545 as_a <gimple_statement_eh_else> (gs);
3546 return &eh_else_stmt->n_body;
3549 static inline gimple_seq
3550 gimple_eh_else_n_body (gimple gs)
3552 return *gimple_eh_else_n_body_ptr (gs);
3555 static inline gimple_seq *
3556 gimple_eh_else_e_body_ptr (gimple gs)
3558 gimple_statement_eh_else *eh_else_stmt =
3559 as_a <gimple_statement_eh_else> (gs);
3560 return &eh_else_stmt->e_body;
3563 static inline gimple_seq
3564 gimple_eh_else_e_body (gimple gs)
3566 return *gimple_eh_else_e_body_ptr (gs);
3569 static inline void
3570 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3572 gimple_statement_eh_else *eh_else_stmt =
3573 as_a <gimple_statement_eh_else> (gs);
3574 eh_else_stmt->n_body = seq;
3577 static inline void
3578 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3580 gimple_statement_eh_else *eh_else_stmt =
3581 as_a <gimple_statement_eh_else> (gs);
3582 eh_else_stmt->e_body = seq;
3585 /* GIMPLE_TRY accessors. */
3587 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3588 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3590 static inline enum gimple_try_flags
3591 gimple_try_kind (const_gimple gs)
3593 GIMPLE_CHECK (gs, GIMPLE_TRY);
3594 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3598 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3600 static inline void
3601 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3603 GIMPLE_CHECK (gs, GIMPLE_TRY);
3604 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3605 || kind == GIMPLE_TRY_FINALLY);
3606 if (gimple_try_kind (gs) != kind)
3607 gs->subcode = (unsigned int) kind;
3611 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3613 static inline bool
3614 gimple_try_catch_is_cleanup (const_gimple gs)
3616 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3617 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3621 /* Return a pointer to the sequence of statements used as the
3622 body for GIMPLE_TRY GS. */
3624 static inline gimple_seq *
3625 gimple_try_eval_ptr (gimple gs)
3627 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3628 return &try_stmt->eval;
3632 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3634 static inline gimple_seq
3635 gimple_try_eval (gimple gs)
3637 return *gimple_try_eval_ptr (gs);
3641 /* Return a pointer to the sequence of statements used as the cleanup body for
3642 GIMPLE_TRY GS. */
3644 static inline gimple_seq *
3645 gimple_try_cleanup_ptr (gimple gs)
3647 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3648 return &try_stmt->cleanup;
3652 /* Return the sequence of statements used as the cleanup body for
3653 GIMPLE_TRY GS. */
3655 static inline gimple_seq
3656 gimple_try_cleanup (gimple gs)
3658 return *gimple_try_cleanup_ptr (gs);
3662 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3664 static inline void
3665 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3667 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3668 if (catch_is_cleanup)
3669 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3670 else
3671 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3675 /* Set EVAL to be the sequence of statements to use as the body for
3676 GIMPLE_TRY GS. */
3678 static inline void
3679 gimple_try_set_eval (gimple gs, gimple_seq eval)
3681 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3682 try_stmt->eval = eval;
3686 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3687 body for GIMPLE_TRY GS. */
3689 static inline void
3690 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3692 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3693 try_stmt->cleanup = cleanup;
3697 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3699 static inline gimple_seq *
3700 gimple_wce_cleanup_ptr (gimple gs)
3702 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3703 return &wce_stmt->cleanup;
3707 /* Return the cleanup sequence for cleanup statement GS. */
3709 static inline gimple_seq
3710 gimple_wce_cleanup (gimple gs)
3712 return *gimple_wce_cleanup_ptr (gs);
3716 /* Set CLEANUP to be the cleanup sequence for GS. */
3718 static inline void
3719 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3721 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3722 wce_stmt->cleanup = cleanup;
3726 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3728 static inline bool
3729 gimple_wce_cleanup_eh_only (const_gimple gs)
3731 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3732 return gs->subcode != 0;
3736 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3738 static inline void
3739 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3741 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3742 gs->subcode = (unsigned int) eh_only_p;
3746 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3748 static inline unsigned
3749 gimple_phi_capacity (const_gimple gs)
3751 const gimple_statement_phi *phi_stmt =
3752 as_a <const gimple_statement_phi> (gs);
3753 return phi_stmt->capacity;
3757 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3758 be exactly the number of incoming edges for the basic block holding
3759 GS. */
3761 static inline unsigned
3762 gimple_phi_num_args (const_gimple gs)
3764 const gimple_statement_phi *phi_stmt =
3765 as_a <const gimple_statement_phi> (gs);
3766 return phi_stmt->nargs;
3770 /* Return the SSA name created by GIMPLE_PHI GS. */
3772 static inline tree
3773 gimple_phi_result (const_gimple gs)
3775 const gimple_statement_phi *phi_stmt =
3776 as_a <const gimple_statement_phi> (gs);
3777 return phi_stmt->result;
3780 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3782 static inline tree *
3783 gimple_phi_result_ptr (gimple gs)
3785 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3786 return &phi_stmt->result;
3789 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3791 static inline void
3792 gimple_phi_set_result (gimple gs, tree result)
3794 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3795 phi_stmt->result = result;
3796 if (result && TREE_CODE (result) == SSA_NAME)
3797 SSA_NAME_DEF_STMT (result) = gs;
3801 /* Return the PHI argument corresponding to incoming edge INDEX for
3802 GIMPLE_PHI GS. */
3804 static inline struct phi_arg_d *
3805 gimple_phi_arg (gimple gs, unsigned index)
3807 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3808 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3809 return &(phi_stmt->args[index]);
3812 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3813 for GIMPLE_PHI GS. */
3815 static inline void
3816 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3818 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3819 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3820 phi_stmt->args[index] = *phiarg;
3823 /* Return the PHI nodes for basic block BB, or NULL if there are no
3824 PHI nodes. */
3826 static inline gimple_seq
3827 phi_nodes (const_basic_block bb)
3829 gcc_checking_assert (!(bb->flags & BB_RTL));
3830 return bb->il.gimple.phi_nodes;
3833 /* Return a pointer to the PHI nodes for basic block BB. */
3835 static inline gimple_seq *
3836 phi_nodes_ptr (basic_block bb)
3838 gcc_checking_assert (!(bb->flags & BB_RTL));
3839 return &bb->il.gimple.phi_nodes;
3842 /* Return the tree operand for argument I of PHI node GS. */
3844 static inline tree
3845 gimple_phi_arg_def (gimple gs, size_t index)
3847 return gimple_phi_arg (gs, index)->def;
3851 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3853 static inline tree *
3854 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3856 return &gimple_phi_arg (gs, index)->def;
3859 /* Return the edge associated with argument I of phi node GS. */
3861 static inline edge
3862 gimple_phi_arg_edge (gimple gs, size_t i)
3864 return EDGE_PRED (gimple_bb (gs), i);
3867 /* Return the source location of gimple argument I of phi node GS. */
3869 static inline source_location
3870 gimple_phi_arg_location (gimple gs, size_t i)
3872 return gimple_phi_arg (gs, i)->locus;
3875 /* Return the source location of the argument on edge E of phi node GS. */
3877 static inline source_location
3878 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3880 return gimple_phi_arg (gs, e->dest_idx)->locus;
3883 /* Set the source location of gimple argument I of phi node GS to LOC. */
3885 static inline void
3886 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3888 gimple_phi_arg (gs, i)->locus = loc;
3891 /* Return TRUE if argument I of phi node GS has a location record. */
3893 static inline bool
3894 gimple_phi_arg_has_location (gimple gs, size_t i)
3896 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3900 /* Return the region number for GIMPLE_RESX GS. */
3902 static inline int
3903 gimple_resx_region (const_gimple gs)
3905 const gimple_statement_resx *resx_stmt =
3906 as_a <const gimple_statement_resx> (gs);
3907 return resx_stmt->region;
3910 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3912 static inline void
3913 gimple_resx_set_region (gimple gs, int region)
3915 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx> (gs);
3916 resx_stmt->region = region;
3919 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3921 static inline int
3922 gimple_eh_dispatch_region (const_gimple gs)
3924 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3925 as_a <const gimple_statement_eh_dispatch> (gs);
3926 return eh_dispatch_stmt->region;
3929 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3931 static inline void
3932 gimple_eh_dispatch_set_region (gimple gs, int region)
3934 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3935 as_a <gimple_statement_eh_dispatch> (gs);
3936 eh_dispatch_stmt->region = region;
3939 /* Return the number of labels associated with the switch statement GS. */
3941 static inline unsigned
3942 gimple_switch_num_labels (const_gimple gs)
3944 unsigned num_ops;
3945 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3946 num_ops = gimple_num_ops (gs);
3947 gcc_gimple_checking_assert (num_ops > 1);
3948 return num_ops - 1;
3952 /* Set NLABELS to be the number of labels for the switch statement GS. */
3954 static inline void
3955 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3957 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3958 gimple_set_num_ops (g, nlabels + 1);
3962 /* Return the index variable used by the switch statement GS. */
3964 static inline tree
3965 gimple_switch_index (const_gimple gs)
3967 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3968 return gimple_op (gs, 0);
3972 /* Return a pointer to the index variable for the switch statement GS. */
3974 static inline tree *
3975 gimple_switch_index_ptr (const_gimple gs)
3977 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3978 return gimple_op_ptr (gs, 0);
3982 /* Set INDEX to be the index variable for switch statement GS. */
3984 static inline void
3985 gimple_switch_set_index (gimple gs, tree index)
3987 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3988 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3989 gimple_set_op (gs, 0, index);
3993 /* Return the label numbered INDEX. The default label is 0, followed by any
3994 labels in a switch statement. */
3996 static inline tree
3997 gimple_switch_label (const_gimple gs, unsigned index)
3999 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4000 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4001 return gimple_op (gs, index + 1);
4004 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4006 static inline void
4007 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4009 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4010 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4011 && (label == NULL_TREE
4012 || TREE_CODE (label) == CASE_LABEL_EXPR));
4013 gimple_set_op (gs, index + 1, label);
4016 /* Return the default label for a switch statement. */
4018 static inline tree
4019 gimple_switch_default_label (const_gimple gs)
4021 tree label = gimple_switch_label (gs, 0);
4022 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4023 return label;
4026 /* Set the default label for a switch statement. */
4028 static inline void
4029 gimple_switch_set_default_label (gimple gs, tree label)
4031 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4032 gimple_switch_set_label (gs, 0, label);
4035 /* Return true if GS is a GIMPLE_DEBUG statement. */
4037 static inline bool
4038 is_gimple_debug (const_gimple gs)
4040 return gimple_code (gs) == GIMPLE_DEBUG;
4043 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4045 static inline bool
4046 gimple_debug_bind_p (const_gimple s)
4048 if (is_gimple_debug (s))
4049 return s->subcode == GIMPLE_DEBUG_BIND;
4051 return false;
4054 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4056 static inline tree
4057 gimple_debug_bind_get_var (gimple dbg)
4059 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4060 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4061 return gimple_op (dbg, 0);
4064 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4065 statement. */
4067 static inline tree
4068 gimple_debug_bind_get_value (gimple dbg)
4070 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4071 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4072 return gimple_op (dbg, 1);
4075 /* Return a pointer to the value bound to the variable in a
4076 GIMPLE_DEBUG bind statement. */
4078 static inline tree *
4079 gimple_debug_bind_get_value_ptr (gimple dbg)
4081 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4082 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4083 return gimple_op_ptr (dbg, 1);
4086 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4088 static inline void
4089 gimple_debug_bind_set_var (gimple dbg, tree var)
4091 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4092 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4093 gimple_set_op (dbg, 0, var);
4096 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4097 statement. */
4099 static inline void
4100 gimple_debug_bind_set_value (gimple dbg, tree value)
4102 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4103 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4104 gimple_set_op (dbg, 1, value);
4107 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4108 optimized away. */
4109 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4111 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4112 statement. */
4114 static inline void
4115 gimple_debug_bind_reset_value (gimple dbg)
4117 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4118 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4119 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4122 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4123 value. */
4125 static inline bool
4126 gimple_debug_bind_has_value_p (gimple dbg)
4128 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4129 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4130 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4133 #undef GIMPLE_DEBUG_BIND_NOVALUE
4135 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4137 static inline bool
4138 gimple_debug_source_bind_p (const_gimple s)
4140 if (is_gimple_debug (s))
4141 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4143 return false;
4146 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4148 static inline tree
4149 gimple_debug_source_bind_get_var (gimple dbg)
4151 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4152 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4153 return gimple_op (dbg, 0);
4156 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4157 statement. */
4159 static inline tree
4160 gimple_debug_source_bind_get_value (gimple dbg)
4162 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4163 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4164 return gimple_op (dbg, 1);
4167 /* Return a pointer to the value bound to the variable in a
4168 GIMPLE_DEBUG source bind statement. */
4170 static inline tree *
4171 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4173 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4174 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4175 return gimple_op_ptr (dbg, 1);
4178 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4180 static inline void
4181 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4183 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4184 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4185 gimple_set_op (dbg, 0, var);
4188 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4189 statement. */
4191 static inline void
4192 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4194 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4195 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4196 gimple_set_op (dbg, 1, value);
4199 /* Return the line number for EXPR, or return -1 if we have no line
4200 number information for it. */
4201 static inline int
4202 get_lineno (const_gimple stmt)
4204 location_t loc;
4206 if (!stmt)
4207 return -1;
4209 loc = gimple_location (stmt);
4210 if (loc == UNKNOWN_LOCATION)
4211 return -1;
4213 return LOCATION_LINE (loc);
4216 /* Return a pointer to the body for the OMP statement GS. */
4218 static inline gimple_seq *
4219 gimple_omp_body_ptr (gimple gs)
4221 return &static_cast <gimple_statement_omp *> (gs)->body;
4224 /* Return the body for the OMP statement GS. */
4226 static inline gimple_seq
4227 gimple_omp_body (gimple gs)
4229 return *gimple_omp_body_ptr (gs);
4232 /* Set BODY to be the body for the OMP statement GS. */
4234 static inline void
4235 gimple_omp_set_body (gimple gs, gimple_seq body)
4237 static_cast <gimple_statement_omp *> (gs)->body = body;
4241 /* Return the name associated with OMP_CRITICAL statement GS. */
4243 static inline tree
4244 gimple_omp_critical_name (const_gimple gs)
4246 const gimple_statement_omp_critical *omp_critical_stmt =
4247 as_a <const gimple_statement_omp_critical> (gs);
4248 return omp_critical_stmt->name;
4252 /* Return a pointer to the name associated with OMP critical statement GS. */
4254 static inline tree *
4255 gimple_omp_critical_name_ptr (gimple gs)
4257 gimple_statement_omp_critical *omp_critical_stmt =
4258 as_a <gimple_statement_omp_critical> (gs);
4259 return &omp_critical_stmt->name;
4263 /* Set NAME to be the name associated with OMP critical statement GS. */
4265 static inline void
4266 gimple_omp_critical_set_name (gimple gs, tree name)
4268 gimple_statement_omp_critical *omp_critical_stmt =
4269 as_a <gimple_statement_omp_critical> (gs);
4270 omp_critical_stmt->name = name;
4274 /* Return the kind of OMP for statemement. */
4276 static inline int
4277 gimple_omp_for_kind (const_gimple g)
4279 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4280 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4284 /* Set the OMP for kind. */
4286 static inline void
4287 gimple_omp_for_set_kind (gimple g, int kind)
4289 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4290 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4291 | (kind & GF_OMP_FOR_KIND_MASK);
4295 /* Return true if OMP for statement G has the
4296 GF_OMP_FOR_COMBINED flag set. */
4298 static inline bool
4299 gimple_omp_for_combined_p (const_gimple g)
4301 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4302 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4306 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4307 value of COMBINED_P. */
4309 static inline void
4310 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4312 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4313 if (combined_p)
4314 g->subcode |= GF_OMP_FOR_COMBINED;
4315 else
4316 g->subcode &= ~GF_OMP_FOR_COMBINED;
4320 /* Return true if OMP for statement G has the
4321 GF_OMP_FOR_COMBINED_INTO flag set. */
4323 static inline bool
4324 gimple_omp_for_combined_into_p (const_gimple g)
4326 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4327 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4331 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4332 value of COMBINED_P. */
4334 static inline void
4335 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4337 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4338 if (combined_p)
4339 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4340 else
4341 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4345 /* Return the clauses associated with OMP_FOR GS. */
4347 static inline tree
4348 gimple_omp_for_clauses (const_gimple gs)
4350 const gimple_statement_omp_for *omp_for_stmt =
4351 as_a <const gimple_statement_omp_for> (gs);
4352 return omp_for_stmt->clauses;
4356 /* Return a pointer to the OMP_FOR GS. */
4358 static inline tree *
4359 gimple_omp_for_clauses_ptr (gimple gs)
4361 gimple_statement_omp_for *omp_for_stmt =
4362 as_a <gimple_statement_omp_for> (gs);
4363 return &omp_for_stmt->clauses;
4367 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4369 static inline void
4370 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4372 gimple_statement_omp_for *omp_for_stmt =
4373 as_a <gimple_statement_omp_for> (gs);
4374 omp_for_stmt->clauses = clauses;
4378 /* Get the collapse count of OMP_FOR GS. */
4380 static inline size_t
4381 gimple_omp_for_collapse (gimple gs)
4383 gimple_statement_omp_for *omp_for_stmt =
4384 as_a <gimple_statement_omp_for> (gs);
4385 return omp_for_stmt->collapse;
4389 /* Return the index variable for OMP_FOR GS. */
4391 static inline tree
4392 gimple_omp_for_index (const_gimple gs, size_t i)
4394 const gimple_statement_omp_for *omp_for_stmt =
4395 as_a <const gimple_statement_omp_for> (gs);
4396 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4397 return omp_for_stmt->iter[i].index;
4401 /* Return a pointer to the index variable for OMP_FOR GS. */
4403 static inline tree *
4404 gimple_omp_for_index_ptr (gimple gs, size_t i)
4406 gimple_statement_omp_for *omp_for_stmt =
4407 as_a <gimple_statement_omp_for> (gs);
4408 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4409 return &omp_for_stmt->iter[i].index;
4413 /* Set INDEX to be the index variable for OMP_FOR GS. */
4415 static inline void
4416 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4418 gimple_statement_omp_for *omp_for_stmt =
4419 as_a <gimple_statement_omp_for> (gs);
4420 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4421 omp_for_stmt->iter[i].index = index;
4425 /* Return the initial value for OMP_FOR GS. */
4427 static inline tree
4428 gimple_omp_for_initial (const_gimple gs, size_t i)
4430 const gimple_statement_omp_for *omp_for_stmt =
4431 as_a <const gimple_statement_omp_for> (gs);
4432 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4433 return omp_for_stmt->iter[i].initial;
4437 /* Return a pointer to the initial value for OMP_FOR GS. */
4439 static inline tree *
4440 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4442 gimple_statement_omp_for *omp_for_stmt =
4443 as_a <gimple_statement_omp_for> (gs);
4444 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4445 return &omp_for_stmt->iter[i].initial;
4449 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4451 static inline void
4452 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4454 gimple_statement_omp_for *omp_for_stmt =
4455 as_a <gimple_statement_omp_for> (gs);
4456 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4457 omp_for_stmt->iter[i].initial = initial;
4461 /* Return the final value for OMP_FOR GS. */
4463 static inline tree
4464 gimple_omp_for_final (const_gimple gs, size_t i)
4466 const gimple_statement_omp_for *omp_for_stmt =
4467 as_a <const gimple_statement_omp_for> (gs);
4468 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4469 return omp_for_stmt->iter[i].final;
4473 /* Return a pointer to the final value for OMP_FOR GS. */
4475 static inline tree *
4476 gimple_omp_for_final_ptr (gimple gs, size_t i)
4478 gimple_statement_omp_for *omp_for_stmt =
4479 as_a <gimple_statement_omp_for> (gs);
4480 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4481 return &omp_for_stmt->iter[i].final;
4485 /* Set FINAL to be the final value for OMP_FOR GS. */
4487 static inline void
4488 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4490 gimple_statement_omp_for *omp_for_stmt =
4491 as_a <gimple_statement_omp_for> (gs);
4492 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4493 omp_for_stmt->iter[i].final = final;
4497 /* Return the increment value for OMP_FOR GS. */
4499 static inline tree
4500 gimple_omp_for_incr (const_gimple gs, size_t i)
4502 const gimple_statement_omp_for *omp_for_stmt =
4503 as_a <const gimple_statement_omp_for> (gs);
4504 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4505 return omp_for_stmt->iter[i].incr;
4509 /* Return a pointer to the increment value for OMP_FOR GS. */
4511 static inline tree *
4512 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4514 gimple_statement_omp_for *omp_for_stmt =
4515 as_a <gimple_statement_omp_for> (gs);
4516 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4517 return &omp_for_stmt->iter[i].incr;
4521 /* Set INCR to be the increment value for OMP_FOR GS. */
4523 static inline void
4524 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4526 gimple_statement_omp_for *omp_for_stmt =
4527 as_a <gimple_statement_omp_for> (gs);
4528 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4529 omp_for_stmt->iter[i].incr = incr;
4533 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4534 statement GS starts. */
4536 static inline gimple_seq *
4537 gimple_omp_for_pre_body_ptr (gimple gs)
4539 gimple_statement_omp_for *omp_for_stmt =
4540 as_a <gimple_statement_omp_for> (gs);
4541 return &omp_for_stmt->pre_body;
4545 /* Return the sequence of statements to execute before the OMP_FOR
4546 statement GS starts. */
4548 static inline gimple_seq
4549 gimple_omp_for_pre_body (gimple gs)
4551 return *gimple_omp_for_pre_body_ptr (gs);
4555 /* Set PRE_BODY to be the sequence of statements to execute before the
4556 OMP_FOR statement GS starts. */
4558 static inline void
4559 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4561 gimple_statement_omp_for *omp_for_stmt =
4562 as_a <gimple_statement_omp_for> (gs);
4563 omp_for_stmt->pre_body = pre_body;
4567 /* Return the clauses associated with OMP_PARALLEL GS. */
4569 static inline tree
4570 gimple_omp_parallel_clauses (const_gimple gs)
4572 const gimple_statement_omp_parallel *omp_parallel_stmt =
4573 as_a <const gimple_statement_omp_parallel> (gs);
4574 return omp_parallel_stmt->clauses;
4578 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4580 static inline tree *
4581 gimple_omp_parallel_clauses_ptr (gimple gs)
4583 gimple_statement_omp_parallel *omp_parallel_stmt =
4584 as_a <gimple_statement_omp_parallel> (gs);
4585 return &omp_parallel_stmt->clauses;
4589 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4590 GS. */
4592 static inline void
4593 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4595 gimple_statement_omp_parallel *omp_parallel_stmt =
4596 as_a <gimple_statement_omp_parallel> (gs);
4597 omp_parallel_stmt->clauses = clauses;
4601 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4603 static inline tree
4604 gimple_omp_parallel_child_fn (const_gimple gs)
4606 const gimple_statement_omp_parallel *omp_parallel_stmt =
4607 as_a <const gimple_statement_omp_parallel> (gs);
4608 return omp_parallel_stmt->child_fn;
4611 /* Return a pointer to the child function used to hold the body of
4612 OMP_PARALLEL GS. */
4614 static inline tree *
4615 gimple_omp_parallel_child_fn_ptr (gimple gs)
4617 gimple_statement_omp_parallel *omp_parallel_stmt =
4618 as_a <gimple_statement_omp_parallel> (gs);
4619 return &omp_parallel_stmt->child_fn;
4623 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4625 static inline void
4626 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4628 gimple_statement_omp_parallel *omp_parallel_stmt =
4629 as_a <gimple_statement_omp_parallel> (gs);
4630 omp_parallel_stmt->child_fn = child_fn;
4634 /* Return the artificial argument used to send variables and values
4635 from the parent to the children threads in OMP_PARALLEL GS. */
4637 static inline tree
4638 gimple_omp_parallel_data_arg (const_gimple gs)
4640 const gimple_statement_omp_parallel *omp_parallel_stmt =
4641 as_a <const gimple_statement_omp_parallel> (gs);
4642 return omp_parallel_stmt->data_arg;
4646 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4648 static inline tree *
4649 gimple_omp_parallel_data_arg_ptr (gimple gs)
4651 gimple_statement_omp_parallel *omp_parallel_stmt =
4652 as_a <gimple_statement_omp_parallel> (gs);
4653 return &omp_parallel_stmt->data_arg;
4657 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4659 static inline void
4660 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4662 gimple_statement_omp_parallel *omp_parallel_stmt =
4663 as_a <gimple_statement_omp_parallel> (gs);
4664 omp_parallel_stmt->data_arg = data_arg;
4668 /* Return the clauses associated with OMP_TASK GS. */
4670 static inline tree
4671 gimple_omp_task_clauses (const_gimple gs)
4673 const gimple_statement_omp_task *omp_task_stmt =
4674 as_a <const gimple_statement_omp_task> (gs);
4675 return omp_task_stmt->clauses;
4679 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4681 static inline tree *
4682 gimple_omp_task_clauses_ptr (gimple gs)
4684 gimple_statement_omp_task *omp_task_stmt =
4685 as_a <gimple_statement_omp_task> (gs);
4686 return &omp_task_stmt->clauses;
4690 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4691 GS. */
4693 static inline void
4694 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4696 gimple_statement_omp_task *omp_task_stmt =
4697 as_a <gimple_statement_omp_task> (gs);
4698 omp_task_stmt->clauses = clauses;
4702 /* Return the child function used to hold the body of OMP_TASK GS. */
4704 static inline tree
4705 gimple_omp_task_child_fn (const_gimple gs)
4707 const gimple_statement_omp_task *omp_task_stmt =
4708 as_a <const gimple_statement_omp_task> (gs);
4709 return omp_task_stmt->child_fn;
4712 /* Return a pointer to the child function used to hold the body of
4713 OMP_TASK GS. */
4715 static inline tree *
4716 gimple_omp_task_child_fn_ptr (gimple gs)
4718 gimple_statement_omp_task *omp_task_stmt =
4719 as_a <gimple_statement_omp_task> (gs);
4720 return &omp_task_stmt->child_fn;
4724 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4726 static inline void
4727 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4729 gimple_statement_omp_task *omp_task_stmt =
4730 as_a <gimple_statement_omp_task> (gs);
4731 omp_task_stmt->child_fn = child_fn;
4735 /* Return the artificial argument used to send variables and values
4736 from the parent to the children threads in OMP_TASK GS. */
4738 static inline tree
4739 gimple_omp_task_data_arg (const_gimple gs)
4741 const gimple_statement_omp_task *omp_task_stmt =
4742 as_a <const gimple_statement_omp_task> (gs);
4743 return omp_task_stmt->data_arg;
4747 /* Return a pointer to the data argument for OMP_TASK GS. */
4749 static inline tree *
4750 gimple_omp_task_data_arg_ptr (gimple gs)
4752 gimple_statement_omp_task *omp_task_stmt =
4753 as_a <gimple_statement_omp_task> (gs);
4754 return &omp_task_stmt->data_arg;
4758 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4760 static inline void
4761 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4763 gimple_statement_omp_task *omp_task_stmt =
4764 as_a <gimple_statement_omp_task> (gs);
4765 omp_task_stmt->data_arg = data_arg;
4769 /* Return the clauses associated with OMP_TASK GS. */
4771 static inline tree
4772 gimple_omp_taskreg_clauses (const_gimple gs)
4774 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4775 as_a <const gimple_statement_omp_taskreg> (gs);
4776 return omp_taskreg_stmt->clauses;
4780 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4782 static inline tree *
4783 gimple_omp_taskreg_clauses_ptr (gimple gs)
4785 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4786 as_a <gimple_statement_omp_taskreg> (gs);
4787 return &omp_taskreg_stmt->clauses;
4791 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4792 GS. */
4794 static inline void
4795 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4797 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4798 as_a <gimple_statement_omp_taskreg> (gs);
4799 omp_taskreg_stmt->clauses = clauses;
4803 /* Return the child function used to hold the body of OMP_TASK GS. */
4805 static inline tree
4806 gimple_omp_taskreg_child_fn (const_gimple gs)
4808 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4809 as_a <const gimple_statement_omp_taskreg> (gs);
4810 return omp_taskreg_stmt->child_fn;
4813 /* Return a pointer to the child function used to hold the body of
4814 OMP_TASK GS. */
4816 static inline tree *
4817 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4819 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4820 as_a <gimple_statement_omp_taskreg> (gs);
4821 return &omp_taskreg_stmt->child_fn;
4825 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4827 static inline void
4828 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4830 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4831 as_a <gimple_statement_omp_taskreg> (gs);
4832 omp_taskreg_stmt->child_fn = child_fn;
4836 /* Return the artificial argument used to send variables and values
4837 from the parent to the children threads in OMP_TASK GS. */
4839 static inline tree
4840 gimple_omp_taskreg_data_arg (const_gimple gs)
4842 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4843 as_a <const gimple_statement_omp_taskreg> (gs);
4844 return omp_taskreg_stmt->data_arg;
4848 /* Return a pointer to the data argument for OMP_TASK GS. */
4850 static inline tree *
4851 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4853 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4854 as_a <gimple_statement_omp_taskreg> (gs);
4855 return &omp_taskreg_stmt->data_arg;
4859 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4861 static inline void
4862 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4864 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4865 as_a <gimple_statement_omp_taskreg> (gs);
4866 omp_taskreg_stmt->data_arg = data_arg;
4870 /* Return the copy function used to hold the body of OMP_TASK GS. */
4872 static inline tree
4873 gimple_omp_task_copy_fn (const_gimple gs)
4875 const gimple_statement_omp_task *omp_task_stmt =
4876 as_a <const gimple_statement_omp_task> (gs);
4877 return omp_task_stmt->copy_fn;
4880 /* Return a pointer to the copy function used to hold the body of
4881 OMP_TASK GS. */
4883 static inline tree *
4884 gimple_omp_task_copy_fn_ptr (gimple gs)
4886 gimple_statement_omp_task *omp_task_stmt =
4887 as_a <gimple_statement_omp_task> (gs);
4888 return &omp_task_stmt->copy_fn;
4892 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4894 static inline void
4895 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4897 gimple_statement_omp_task *omp_task_stmt =
4898 as_a <gimple_statement_omp_task> (gs);
4899 omp_task_stmt->copy_fn = copy_fn;
4903 /* Return size of the data block in bytes in OMP_TASK GS. */
4905 static inline tree
4906 gimple_omp_task_arg_size (const_gimple gs)
4908 const gimple_statement_omp_task *omp_task_stmt =
4909 as_a <const gimple_statement_omp_task> (gs);
4910 return omp_task_stmt->arg_size;
4914 /* Return a pointer to the data block size for OMP_TASK GS. */
4916 static inline tree *
4917 gimple_omp_task_arg_size_ptr (gimple gs)
4919 gimple_statement_omp_task *omp_task_stmt =
4920 as_a <gimple_statement_omp_task> (gs);
4921 return &omp_task_stmt->arg_size;
4925 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4927 static inline void
4928 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4930 gimple_statement_omp_task *omp_task_stmt =
4931 as_a <gimple_statement_omp_task> (gs);
4932 omp_task_stmt->arg_size = arg_size;
4936 /* Return align of the data block in bytes in OMP_TASK GS. */
4938 static inline tree
4939 gimple_omp_task_arg_align (const_gimple gs)
4941 const gimple_statement_omp_task *omp_task_stmt =
4942 as_a <const gimple_statement_omp_task> (gs);
4943 return omp_task_stmt->arg_align;
4947 /* Return a pointer to the data block align for OMP_TASK GS. */
4949 static inline tree *
4950 gimple_omp_task_arg_align_ptr (gimple gs)
4952 gimple_statement_omp_task *omp_task_stmt =
4953 as_a <gimple_statement_omp_task> (gs);
4954 return &omp_task_stmt->arg_align;
4958 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4960 static inline void
4961 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4963 gimple_statement_omp_task *omp_task_stmt =
4964 as_a <gimple_statement_omp_task> (gs);
4965 omp_task_stmt->arg_align = arg_align;
4969 /* Return the clauses associated with OMP_SINGLE GS. */
4971 static inline tree
4972 gimple_omp_single_clauses (const_gimple gs)
4974 const gimple_statement_omp_single *omp_single_stmt =
4975 as_a <const gimple_statement_omp_single> (gs);
4976 return omp_single_stmt->clauses;
4980 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4982 static inline tree *
4983 gimple_omp_single_clauses_ptr (gimple gs)
4985 gimple_statement_omp_single *omp_single_stmt =
4986 as_a <gimple_statement_omp_single> (gs);
4987 return &omp_single_stmt->clauses;
4991 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4993 static inline void
4994 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4996 gimple_statement_omp_single *omp_single_stmt =
4997 as_a <gimple_statement_omp_single> (gs);
4998 omp_single_stmt->clauses = clauses;
5002 /* Return the clauses associated with OMP_TARGET GS. */
5004 static inline tree
5005 gimple_omp_target_clauses (const_gimple gs)
5007 const gimple_statement_omp_target *omp_target_stmt =
5008 as_a <const gimple_statement_omp_target> (gs);
5009 return omp_target_stmt->clauses;
5013 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5015 static inline tree *
5016 gimple_omp_target_clauses_ptr (gimple gs)
5018 gimple_statement_omp_target *omp_target_stmt =
5019 as_a <gimple_statement_omp_target> (gs);
5020 return &omp_target_stmt->clauses;
5024 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5026 static inline void
5027 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5029 gimple_statement_omp_target *omp_target_stmt =
5030 as_a <gimple_statement_omp_target> (gs);
5031 omp_target_stmt->clauses = clauses;
5035 /* Return the kind of OMP target statemement. */
5037 static inline int
5038 gimple_omp_target_kind (const_gimple g)
5040 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5041 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5045 /* Set the OMP target kind. */
5047 static inline void
5048 gimple_omp_target_set_kind (gimple g, int kind)
5050 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5051 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5052 | (kind & GF_OMP_TARGET_KIND_MASK);
5056 /* Return the child function used to hold the body of OMP_TARGET GS. */
5058 static inline tree
5059 gimple_omp_target_child_fn (const_gimple gs)
5061 const gimple_statement_omp_target *omp_target_stmt =
5062 as_a <const gimple_statement_omp_target> (gs);
5063 return omp_target_stmt->child_fn;
5066 /* Return a pointer to the child function used to hold the body of
5067 OMP_TARGET GS. */
5069 static inline tree *
5070 gimple_omp_target_child_fn_ptr (gimple gs)
5072 gimple_statement_omp_target *omp_target_stmt =
5073 as_a <gimple_statement_omp_target> (gs);
5074 return &omp_target_stmt->child_fn;
5078 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5080 static inline void
5081 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5083 gimple_statement_omp_target *omp_target_stmt =
5084 as_a <gimple_statement_omp_target> (gs);
5085 omp_target_stmt->child_fn = child_fn;
5089 /* Return the artificial argument used to send variables and values
5090 from the parent to the children threads in OMP_TARGET GS. */
5092 static inline tree
5093 gimple_omp_target_data_arg (const_gimple gs)
5095 const gimple_statement_omp_target *omp_target_stmt =
5096 as_a <const gimple_statement_omp_target> (gs);
5097 return omp_target_stmt->data_arg;
5101 /* Return a pointer to the data argument for OMP_TARGET GS. */
5103 static inline tree *
5104 gimple_omp_target_data_arg_ptr (gimple gs)
5106 gimple_statement_omp_target *omp_target_stmt =
5107 as_a <gimple_statement_omp_target> (gs);
5108 return &omp_target_stmt->data_arg;
5112 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5114 static inline void
5115 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5117 gimple_statement_omp_target *omp_target_stmt =
5118 as_a <gimple_statement_omp_target> (gs);
5119 omp_target_stmt->data_arg = data_arg;
5123 /* Return the clauses associated with OMP_TEAMS GS. */
5125 static inline tree
5126 gimple_omp_teams_clauses (const_gimple gs)
5128 const gimple_statement_omp_teams *omp_teams_stmt =
5129 as_a <const gimple_statement_omp_teams> (gs);
5130 return omp_teams_stmt->clauses;
5134 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5136 static inline tree *
5137 gimple_omp_teams_clauses_ptr (gimple gs)
5139 gimple_statement_omp_teams *omp_teams_stmt =
5140 as_a <gimple_statement_omp_teams> (gs);
5141 return &omp_teams_stmt->clauses;
5145 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5147 static inline void
5148 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5150 gimple_statement_omp_teams *omp_teams_stmt =
5151 as_a <gimple_statement_omp_teams> (gs);
5152 omp_teams_stmt->clauses = clauses;
5156 /* Return the clauses associated with OMP_SECTIONS GS. */
5158 static inline tree
5159 gimple_omp_sections_clauses (const_gimple gs)
5161 const gimple_statement_omp_sections *omp_sections_stmt =
5162 as_a <const gimple_statement_omp_sections> (gs);
5163 return omp_sections_stmt->clauses;
5167 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5169 static inline tree *
5170 gimple_omp_sections_clauses_ptr (gimple gs)
5172 gimple_statement_omp_sections *omp_sections_stmt =
5173 as_a <gimple_statement_omp_sections> (gs);
5174 return &omp_sections_stmt->clauses;
5178 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5179 GS. */
5181 static inline void
5182 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5184 gimple_statement_omp_sections *omp_sections_stmt =
5185 as_a <gimple_statement_omp_sections> (gs);
5186 omp_sections_stmt->clauses = clauses;
5190 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5191 in GS. */
5193 static inline tree
5194 gimple_omp_sections_control (const_gimple gs)
5196 const gimple_statement_omp_sections *omp_sections_stmt =
5197 as_a <const gimple_statement_omp_sections> (gs);
5198 return omp_sections_stmt->control;
5202 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5203 GS. */
5205 static inline tree *
5206 gimple_omp_sections_control_ptr (gimple gs)
5208 gimple_statement_omp_sections *omp_sections_stmt =
5209 as_a <gimple_statement_omp_sections> (gs);
5210 return &omp_sections_stmt->control;
5214 /* Set CONTROL to be the set of clauses associated with the
5215 GIMPLE_OMP_SECTIONS in GS. */
5217 static inline void
5218 gimple_omp_sections_set_control (gimple gs, tree control)
5220 gimple_statement_omp_sections *omp_sections_stmt =
5221 as_a <gimple_statement_omp_sections> (gs);
5222 omp_sections_stmt->control = control;
5226 /* Set COND to be the condition code for OMP_FOR GS. */
5228 static inline void
5229 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5231 gimple_statement_omp_for *omp_for_stmt =
5232 as_a <gimple_statement_omp_for> (gs);
5233 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5234 && i < omp_for_stmt->collapse);
5235 omp_for_stmt->iter[i].cond = cond;
5239 /* Return the condition code associated with OMP_FOR GS. */
5241 static inline enum tree_code
5242 gimple_omp_for_cond (const_gimple gs, size_t i)
5244 const gimple_statement_omp_for *omp_for_stmt =
5245 as_a <const gimple_statement_omp_for> (gs);
5246 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5247 return omp_for_stmt->iter[i].cond;
5251 /* Set the value being stored in an atomic store. */
5253 static inline void
5254 gimple_omp_atomic_store_set_val (gimple g, tree val)
5256 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5257 as_a <gimple_statement_omp_atomic_store> (g);
5258 omp_atomic_store_stmt->val = val;
5262 /* Return the value being stored in an atomic store. */
5264 static inline tree
5265 gimple_omp_atomic_store_val (const_gimple g)
5267 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5268 as_a <const gimple_statement_omp_atomic_store> (g);
5269 return omp_atomic_store_stmt->val;
5273 /* Return a pointer to the value being stored in an atomic store. */
5275 static inline tree *
5276 gimple_omp_atomic_store_val_ptr (gimple g)
5278 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5279 as_a <gimple_statement_omp_atomic_store> (g);
5280 return &omp_atomic_store_stmt->val;
5284 /* Set the LHS of an atomic load. */
5286 static inline void
5287 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5289 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5290 as_a <gimple_statement_omp_atomic_load> (g);
5291 omp_atomic_load_stmt->lhs = lhs;
5295 /* Get the LHS of an atomic load. */
5297 static inline tree
5298 gimple_omp_atomic_load_lhs (const_gimple g)
5300 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5301 as_a <const gimple_statement_omp_atomic_load> (g);
5302 return omp_atomic_load_stmt->lhs;
5306 /* Return a pointer to the LHS of an atomic load. */
5308 static inline tree *
5309 gimple_omp_atomic_load_lhs_ptr (gimple g)
5311 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5312 as_a <gimple_statement_omp_atomic_load> (g);
5313 return &omp_atomic_load_stmt->lhs;
5317 /* Set the RHS of an atomic load. */
5319 static inline void
5320 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5322 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5323 as_a <gimple_statement_omp_atomic_load> (g);
5324 omp_atomic_load_stmt->rhs = rhs;
5328 /* Get the RHS of an atomic load. */
5330 static inline tree
5331 gimple_omp_atomic_load_rhs (const_gimple g)
5333 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5334 as_a <const gimple_statement_omp_atomic_load> (g);
5335 return omp_atomic_load_stmt->rhs;
5339 /* Return a pointer to the RHS of an atomic load. */
5341 static inline tree *
5342 gimple_omp_atomic_load_rhs_ptr (gimple g)
5344 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5345 as_a <gimple_statement_omp_atomic_load> (g);
5346 return &omp_atomic_load_stmt->rhs;
5350 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5352 static inline tree
5353 gimple_omp_continue_control_def (const_gimple g)
5355 const gimple_statement_omp_continue *omp_continue_stmt =
5356 as_a <const gimple_statement_omp_continue> (g);
5357 return omp_continue_stmt->control_def;
5360 /* The same as above, but return the address. */
5362 static inline tree *
5363 gimple_omp_continue_control_def_ptr (gimple g)
5365 gimple_statement_omp_continue *omp_continue_stmt =
5366 as_a <gimple_statement_omp_continue> (g);
5367 return &omp_continue_stmt->control_def;
5370 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5372 static inline void
5373 gimple_omp_continue_set_control_def (gimple g, tree def)
5375 gimple_statement_omp_continue *omp_continue_stmt =
5376 as_a <gimple_statement_omp_continue> (g);
5377 omp_continue_stmt->control_def = def;
5381 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5383 static inline tree
5384 gimple_omp_continue_control_use (const_gimple g)
5386 const gimple_statement_omp_continue *omp_continue_stmt =
5387 as_a <const gimple_statement_omp_continue> (g);
5388 return omp_continue_stmt->control_use;
5392 /* The same as above, but return the address. */
5394 static inline tree *
5395 gimple_omp_continue_control_use_ptr (gimple g)
5397 gimple_statement_omp_continue *omp_continue_stmt =
5398 as_a <gimple_statement_omp_continue> (g);
5399 return &omp_continue_stmt->control_use;
5403 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5405 static inline void
5406 gimple_omp_continue_set_control_use (gimple g, tree use)
5408 gimple_statement_omp_continue *omp_continue_stmt =
5409 as_a <gimple_statement_omp_continue> (g);
5410 omp_continue_stmt->control_use = use;
5413 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5415 static inline gimple_seq *
5416 gimple_transaction_body_ptr (gimple gs)
5418 gimple_statement_transaction *transaction_stmt =
5419 as_a <gimple_statement_transaction> (gs);
5420 return &transaction_stmt->body;
5423 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5425 static inline gimple_seq
5426 gimple_transaction_body (gimple gs)
5428 return *gimple_transaction_body_ptr (gs);
5431 /* Return the label associated with a GIMPLE_TRANSACTION. */
5433 static inline tree
5434 gimple_transaction_label (const_gimple gs)
5436 const gimple_statement_transaction *transaction_stmt =
5437 as_a <const gimple_statement_transaction> (gs);
5438 return transaction_stmt->label;
5441 static inline tree *
5442 gimple_transaction_label_ptr (gimple gs)
5444 gimple_statement_transaction *transaction_stmt =
5445 as_a <gimple_statement_transaction> (gs);
5446 return &transaction_stmt->label;
5449 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5451 static inline unsigned int
5452 gimple_transaction_subcode (const_gimple gs)
5454 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5455 return gs->subcode;
5458 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5460 static inline void
5461 gimple_transaction_set_body (gimple gs, gimple_seq body)
5463 gimple_statement_transaction *transaction_stmt =
5464 as_a <gimple_statement_transaction> (gs);
5465 transaction_stmt->body = body;
5468 /* Set the label associated with a GIMPLE_TRANSACTION. */
5470 static inline void
5471 gimple_transaction_set_label (gimple gs, tree label)
5473 gimple_statement_transaction *transaction_stmt =
5474 as_a <gimple_statement_transaction> (gs);
5475 transaction_stmt->label = label;
5478 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5480 static inline void
5481 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5483 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5484 gs->subcode = subcode;
5488 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5490 static inline tree *
5491 gimple_return_retval_ptr (const_gimple gs)
5493 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5494 return gimple_op_ptr (gs, 0);
5497 /* Return the return value for GIMPLE_RETURN GS. */
5499 static inline tree
5500 gimple_return_retval (const_gimple gs)
5502 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5503 return gimple_op (gs, 0);
5507 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5509 static inline void
5510 gimple_return_set_retval (gimple gs, tree retval)
5512 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5513 gimple_set_op (gs, 0, retval);
5517 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5519 #define CASE_GIMPLE_OMP \
5520 case GIMPLE_OMP_PARALLEL: \
5521 case GIMPLE_OMP_TASK: \
5522 case GIMPLE_OMP_FOR: \
5523 case GIMPLE_OMP_SECTIONS: \
5524 case GIMPLE_OMP_SECTIONS_SWITCH: \
5525 case GIMPLE_OMP_SINGLE: \
5526 case GIMPLE_OMP_TARGET: \
5527 case GIMPLE_OMP_TEAMS: \
5528 case GIMPLE_OMP_SECTION: \
5529 case GIMPLE_OMP_MASTER: \
5530 case GIMPLE_OMP_TASKGROUP: \
5531 case GIMPLE_OMP_ORDERED: \
5532 case GIMPLE_OMP_CRITICAL: \
5533 case GIMPLE_OMP_RETURN: \
5534 case GIMPLE_OMP_ATOMIC_LOAD: \
5535 case GIMPLE_OMP_ATOMIC_STORE: \
5536 case GIMPLE_OMP_CONTINUE
5538 static inline bool
5539 is_gimple_omp (const_gimple stmt)
5541 switch (gimple_code (stmt))
5543 CASE_GIMPLE_OMP:
5544 return true;
5545 default:
5546 return false;
5551 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5553 static inline bool
5554 gimple_nop_p (const_gimple g)
5556 return gimple_code (g) == GIMPLE_NOP;
5560 /* Return true if GS is a GIMPLE_RESX. */
5562 static inline bool
5563 is_gimple_resx (const_gimple gs)
5565 return gimple_code (gs) == GIMPLE_RESX;
5568 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5570 static inline enum br_predictor
5571 gimple_predict_predictor (gimple gs)
5573 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5574 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5578 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5580 static inline void
5581 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5583 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5584 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5585 | (unsigned) predictor;
5589 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5591 static inline enum prediction
5592 gimple_predict_outcome (gimple gs)
5594 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5595 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5599 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5601 static inline void
5602 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5604 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5605 if (outcome == TAKEN)
5606 gs->subcode |= GF_PREDICT_TAKEN;
5607 else
5608 gs->subcode &= ~GF_PREDICT_TAKEN;
5612 /* Return the type of the main expression computed by STMT. Return
5613 void_type_node if the statement computes nothing. */
5615 static inline tree
5616 gimple_expr_type (const_gimple stmt)
5618 enum gimple_code code = gimple_code (stmt);
5620 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5622 tree type;
5623 /* In general we want to pass out a type that can be substituted
5624 for both the RHS and the LHS types if there is a possibly
5625 useless conversion involved. That means returning the
5626 original RHS type as far as we can reconstruct it. */
5627 if (code == GIMPLE_CALL)
5629 if (gimple_call_internal_p (stmt)
5630 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5631 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5632 else
5633 type = gimple_call_return_type (stmt);
5635 else
5636 switch (gimple_assign_rhs_code (stmt))
5638 case POINTER_PLUS_EXPR:
5639 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5640 break;
5642 default:
5643 /* As fallback use the type of the LHS. */
5644 type = TREE_TYPE (gimple_get_lhs (stmt));
5645 break;
5647 return type;
5649 else if (code == GIMPLE_COND)
5650 return boolean_type_node;
5651 else
5652 return void_type_node;
5655 /* Enum and arrays used for allocation stats. Keep in sync with
5656 gimple.c:gimple_alloc_kind_names. */
5657 enum gimple_alloc_kind
5659 gimple_alloc_kind_assign, /* Assignments. */
5660 gimple_alloc_kind_phi, /* PHI nodes. */
5661 gimple_alloc_kind_cond, /* Conditionals. */
5662 gimple_alloc_kind_rest, /* Everything else. */
5663 gimple_alloc_kind_all
5666 extern int gimple_alloc_counts[];
5667 extern int gimple_alloc_sizes[];
5669 /* Return the allocation kind for a given stmt CODE. */
5670 static inline enum gimple_alloc_kind
5671 gimple_alloc_kind (enum gimple_code code)
5673 switch (code)
5675 case GIMPLE_ASSIGN:
5676 return gimple_alloc_kind_assign;
5677 case GIMPLE_PHI:
5678 return gimple_alloc_kind_phi;
5679 case GIMPLE_COND:
5680 return gimple_alloc_kind_cond;
5681 default:
5682 return gimple_alloc_kind_rest;
5686 /* Return true if a location should not be emitted for this statement
5687 by annotate_all_with_location. */
5689 static inline bool
5690 gimple_do_not_emit_location_p (gimple g)
5692 return gimple_plf (g, GF_PLF_1);
5695 /* Mark statement G so a location will not be emitted by
5696 annotate_one_with_location. */
5698 static inline void
5699 gimple_set_do_not_emit_location (gimple g)
5701 /* The PLF flags are initialized to 0 when a new tuple is created,
5702 so no need to initialize it anywhere. */
5703 gimple_set_plf (g, GF_PLF_1, true);
5707 /* Macros for showing usage statistics. */
5708 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5709 ? (x) \
5710 : ((x) < 1024*1024*10 \
5711 ? (x) / 1024 \
5712 : (x) / (1024*1024))))
5714 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5716 #endif /* GCC_GIMPLE_H */