Enabled Usage of _Cilk_spawn and _Cilk_sync in Cilk Runtime (libcilkrts).
[official-gcc.git] / gcc / gimple.h
bloba49016fcc6c71f9d54e41642922714b434996abb
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2013 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 is_gimple_builtin_call (gimple stmt);
1257 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
1258 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1259 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1260 extern void dump_decl_set (FILE *, bitmap);
1261 extern bool nonfreeing_call_p (gimple);
1262 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1263 extern void sort_case_labels (vec<tree> );
1264 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1265 extern void gimple_seq_set_location (gimple_seq , location_t);
1267 /* Formal (expression) temporary table handling: multiple occurrences of
1268 the same scalar expression are evaluated into the same temporary. */
1270 typedef struct gimple_temp_hash_elt
1272 tree val; /* Key */
1273 tree temp; /* Value */
1274 } elt_t;
1276 /* Get the number of the next statement uid to be allocated. */
1277 static inline unsigned int
1278 gimple_stmt_max_uid (struct function *fn)
1280 return fn->last_stmt_uid;
1283 /* Set the number of the next statement uid to be allocated. */
1284 static inline void
1285 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1287 fn->last_stmt_uid = maxid;
1290 /* Set the number of the next statement uid to be allocated. */
1291 static inline unsigned int
1292 inc_gimple_stmt_max_uid (struct function *fn)
1294 return fn->last_stmt_uid++;
1297 /* Return the first node in GIMPLE sequence S. */
1299 static inline gimple_seq_node
1300 gimple_seq_first (gimple_seq s)
1302 return s;
1306 /* Return the first statement in GIMPLE sequence S. */
1308 static inline gimple
1309 gimple_seq_first_stmt (gimple_seq s)
1311 gimple_seq_node n = gimple_seq_first (s);
1312 return n;
1316 /* Return the last node in GIMPLE sequence S. */
1318 static inline gimple_seq_node
1319 gimple_seq_last (gimple_seq s)
1321 return s ? s->prev : NULL;
1325 /* Return the last statement in GIMPLE sequence S. */
1327 static inline gimple
1328 gimple_seq_last_stmt (gimple_seq s)
1330 gimple_seq_node n = gimple_seq_last (s);
1331 return n;
1335 /* Set the last node in GIMPLE sequence *PS to LAST. */
1337 static inline void
1338 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1340 (*ps)->prev = last;
1344 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1346 static inline void
1347 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1349 *ps = first;
1353 /* Return true if GIMPLE sequence S is empty. */
1355 static inline bool
1356 gimple_seq_empty_p (gimple_seq s)
1358 return s == NULL;
1361 /* Allocate a new sequence and initialize its first element with STMT. */
1363 static inline gimple_seq
1364 gimple_seq_alloc_with_stmt (gimple stmt)
1366 gimple_seq seq = NULL;
1367 gimple_seq_add_stmt (&seq, stmt);
1368 return seq;
1372 /* Returns the sequence of statements in BB. */
1374 static inline gimple_seq
1375 bb_seq (const_basic_block bb)
1377 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1380 static inline gimple_seq *
1381 bb_seq_addr (basic_block bb)
1383 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1386 /* Sets the sequence of statements in BB to SEQ. */
1388 static inline void
1389 set_bb_seq (basic_block bb, gimple_seq seq)
1391 gcc_checking_assert (!(bb->flags & BB_RTL));
1392 bb->il.gimple.seq = seq;
1396 /* Return the code for GIMPLE statement G. */
1398 static inline enum gimple_code
1399 gimple_code (const_gimple g)
1401 return g->code;
1405 /* Return the GSS code used by a GIMPLE code. */
1407 static inline enum gimple_statement_structure_enum
1408 gss_for_code (enum gimple_code code)
1410 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1411 return gss_for_code_[code];
1415 /* Return which GSS code is used by GS. */
1417 static inline enum gimple_statement_structure_enum
1418 gimple_statement_structure (gimple gs)
1420 return gss_for_code (gimple_code (gs));
1424 /* Return true if statement G has sub-statements. This is only true for
1425 High GIMPLE statements. */
1427 static inline bool
1428 gimple_has_substatements (gimple g)
1430 switch (gimple_code (g))
1432 case GIMPLE_BIND:
1433 case GIMPLE_CATCH:
1434 case GIMPLE_EH_FILTER:
1435 case GIMPLE_EH_ELSE:
1436 case GIMPLE_TRY:
1437 case GIMPLE_OMP_FOR:
1438 case GIMPLE_OMP_MASTER:
1439 case GIMPLE_OMP_TASKGROUP:
1440 case GIMPLE_OMP_ORDERED:
1441 case GIMPLE_OMP_SECTION:
1442 case GIMPLE_OMP_PARALLEL:
1443 case GIMPLE_OMP_TASK:
1444 case GIMPLE_OMP_SECTIONS:
1445 case GIMPLE_OMP_SINGLE:
1446 case GIMPLE_OMP_TARGET:
1447 case GIMPLE_OMP_TEAMS:
1448 case GIMPLE_OMP_CRITICAL:
1449 case GIMPLE_WITH_CLEANUP_EXPR:
1450 case GIMPLE_TRANSACTION:
1451 return true;
1453 default:
1454 return false;
1459 /* Return the basic block holding statement G. */
1461 static inline basic_block
1462 gimple_bb (const_gimple g)
1464 return g->bb;
1468 /* Return the lexical scope block holding statement G. */
1470 static inline tree
1471 gimple_block (const_gimple g)
1473 return LOCATION_BLOCK (g->location);
1477 /* Set BLOCK to be the lexical scope block holding statement G. */
1479 static inline void
1480 gimple_set_block (gimple g, tree block)
1482 if (block)
1483 g->location =
1484 COMBINE_LOCATION_DATA (line_table, g->location, block);
1485 else
1486 g->location = LOCATION_LOCUS (g->location);
1490 /* Return location information for statement G. */
1492 static inline location_t
1493 gimple_location (const_gimple g)
1495 return g->location;
1498 /* Return pointer to location information for statement G. */
1500 static inline const location_t *
1501 gimple_location_ptr (const_gimple g)
1503 return &g->location;
1507 /* Set location information for statement G. */
1509 static inline void
1510 gimple_set_location (gimple g, location_t location)
1512 g->location = location;
1516 /* Return true if G contains location information. */
1518 static inline bool
1519 gimple_has_location (const_gimple g)
1521 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1525 /* Return the file name of the location of STMT. */
1527 static inline const char *
1528 gimple_filename (const_gimple stmt)
1530 return LOCATION_FILE (gimple_location (stmt));
1534 /* Return the line number of the location of STMT. */
1536 static inline int
1537 gimple_lineno (const_gimple stmt)
1539 return LOCATION_LINE (gimple_location (stmt));
1543 /* Determine whether SEQ is a singleton. */
1545 static inline bool
1546 gimple_seq_singleton_p (gimple_seq seq)
1548 return ((gimple_seq_first (seq) != NULL)
1549 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1552 /* Return true if no warnings should be emitted for statement STMT. */
1554 static inline bool
1555 gimple_no_warning_p (const_gimple stmt)
1557 return stmt->no_warning;
1560 /* Set the no_warning flag of STMT to NO_WARNING. */
1562 static inline void
1563 gimple_set_no_warning (gimple stmt, bool no_warning)
1565 stmt->no_warning = (unsigned) no_warning;
1568 /* Set the visited status on statement STMT to VISITED_P. */
1570 static inline void
1571 gimple_set_visited (gimple stmt, bool visited_p)
1573 stmt->visited = (unsigned) visited_p;
1577 /* Return the visited status for statement STMT. */
1579 static inline bool
1580 gimple_visited_p (gimple stmt)
1582 return stmt->visited;
1586 /* Set pass local flag PLF on statement STMT to VAL_P. */
1588 static inline void
1589 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1591 if (val_p)
1592 stmt->plf |= (unsigned int) plf;
1593 else
1594 stmt->plf &= ~((unsigned int) plf);
1598 /* Return the value of pass local flag PLF on statement STMT. */
1600 static inline unsigned int
1601 gimple_plf (gimple stmt, enum plf_mask plf)
1603 return stmt->plf & ((unsigned int) plf);
1607 /* Set the UID of statement. */
1609 static inline void
1610 gimple_set_uid (gimple g, unsigned uid)
1612 g->uid = uid;
1616 /* Return the UID of statement. */
1618 static inline unsigned
1619 gimple_uid (const_gimple g)
1621 return g->uid;
1625 /* Make statement G a singleton sequence. */
1627 static inline void
1628 gimple_init_singleton (gimple g)
1630 g->next = NULL;
1631 g->prev = g;
1635 /* Return true if GIMPLE statement G has register or memory operands. */
1637 static inline bool
1638 gimple_has_ops (const_gimple g)
1640 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1643 template <>
1644 template <>
1645 inline bool
1646 is_a_helper <const gimple_statement_with_ops>::test (const_gimple gs)
1648 return gimple_has_ops (gs);
1651 template <>
1652 template <>
1653 inline bool
1654 is_a_helper <gimple_statement_with_ops>::test (gimple gs)
1656 return gimple_has_ops (gs);
1659 /* Return true if GIMPLE statement G has memory operands. */
1661 static inline bool
1662 gimple_has_mem_ops (const_gimple g)
1664 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1667 template <>
1668 template <>
1669 inline bool
1670 is_a_helper <const gimple_statement_with_memory_ops>::test (const_gimple gs)
1672 return gimple_has_mem_ops (gs);
1675 template <>
1676 template <>
1677 inline bool
1678 is_a_helper <gimple_statement_with_memory_ops>::test (gimple gs)
1680 return gimple_has_mem_ops (gs);
1683 /* Return the set of USE operands for statement G. */
1685 static inline struct use_optype_d *
1686 gimple_use_ops (const_gimple g)
1688 const gimple_statement_with_ops *ops_stmt =
1689 dyn_cast <const gimple_statement_with_ops> (g);
1690 if (!ops_stmt)
1691 return NULL;
1692 return ops_stmt->use_ops;
1696 /* Set USE to be the set of USE operands for statement G. */
1698 static inline void
1699 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1701 gimple_statement_with_ops *ops_stmt =
1702 as_a <gimple_statement_with_ops> (g);
1703 ops_stmt->use_ops = use;
1707 /* Return the single VUSE operand of the statement G. */
1709 static inline tree
1710 gimple_vuse (const_gimple g)
1712 const gimple_statement_with_memory_ops *mem_ops_stmt =
1713 dyn_cast <const gimple_statement_with_memory_ops> (g);
1714 if (!mem_ops_stmt)
1715 return NULL_TREE;
1716 return mem_ops_stmt->vuse;
1719 /* Return the single VDEF operand of the statement G. */
1721 static inline tree
1722 gimple_vdef (const_gimple g)
1724 const gimple_statement_with_memory_ops *mem_ops_stmt =
1725 dyn_cast <const gimple_statement_with_memory_ops> (g);
1726 if (!mem_ops_stmt)
1727 return NULL_TREE;
1728 return mem_ops_stmt->vdef;
1731 /* Return the single VUSE operand of the statement G. */
1733 static inline tree *
1734 gimple_vuse_ptr (gimple g)
1736 gimple_statement_with_memory_ops *mem_ops_stmt =
1737 dyn_cast <gimple_statement_with_memory_ops> (g);
1738 if (!mem_ops_stmt)
1739 return NULL;
1740 return &mem_ops_stmt->vuse;
1743 /* Return the single VDEF operand of the statement G. */
1745 static inline tree *
1746 gimple_vdef_ptr (gimple g)
1748 gimple_statement_with_memory_ops *mem_ops_stmt =
1749 dyn_cast <gimple_statement_with_memory_ops> (g);
1750 if (!mem_ops_stmt)
1751 return NULL;
1752 return &mem_ops_stmt->vdef;
1755 /* Set the single VUSE operand of the statement G. */
1757 static inline void
1758 gimple_set_vuse (gimple g, tree vuse)
1760 gimple_statement_with_memory_ops *mem_ops_stmt =
1761 as_a <gimple_statement_with_memory_ops> (g);
1762 mem_ops_stmt->vuse = vuse;
1765 /* Set the single VDEF operand of the statement G. */
1767 static inline void
1768 gimple_set_vdef (gimple g, tree vdef)
1770 gimple_statement_with_memory_ops *mem_ops_stmt =
1771 as_a <gimple_statement_with_memory_ops> (g);
1772 mem_ops_stmt->vdef = vdef;
1776 /* Return true if statement G has operands and the modified field has
1777 been set. */
1779 static inline bool
1780 gimple_modified_p (const_gimple g)
1782 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1786 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1787 a MODIFIED field. */
1789 static inline void
1790 gimple_set_modified (gimple s, bool modifiedp)
1792 if (gimple_has_ops (s))
1793 s->modified = (unsigned) modifiedp;
1797 /* Return the tree code for the expression computed by STMT. This is
1798 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1799 GIMPLE_CALL, return CALL_EXPR as the expression code for
1800 consistency. This is useful when the caller needs to deal with the
1801 three kinds of computation that GIMPLE supports. */
1803 static inline enum tree_code
1804 gimple_expr_code (const_gimple stmt)
1806 enum gimple_code code = gimple_code (stmt);
1807 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1808 return (enum tree_code) stmt->subcode;
1809 else
1811 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1812 return CALL_EXPR;
1817 /* Return true if statement STMT contains volatile operands. */
1819 static inline bool
1820 gimple_has_volatile_ops (const_gimple stmt)
1822 if (gimple_has_mem_ops (stmt))
1823 return stmt->has_volatile_ops;
1824 else
1825 return false;
1829 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1831 static inline void
1832 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1834 if (gimple_has_mem_ops (stmt))
1835 stmt->has_volatile_ops = (unsigned) volatilep;
1838 /* Return true if STMT is in a transaction. */
1840 static inline bool
1841 gimple_in_transaction (gimple stmt)
1843 return bb_in_transaction (gimple_bb (stmt));
1846 /* Return true if statement STMT may access memory. */
1848 static inline bool
1849 gimple_references_memory_p (gimple stmt)
1851 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1855 /* Return the subcode for OMP statement S. */
1857 static inline unsigned
1858 gimple_omp_subcode (const_gimple s)
1860 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1861 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1862 return s->subcode;
1865 /* Set the subcode for OMP statement S to SUBCODE. */
1867 static inline void
1868 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1870 /* We only have 16 bits for the subcode. Assert that we are not
1871 overflowing it. */
1872 gcc_gimple_checking_assert (subcode < (1 << 16));
1873 s->subcode = subcode;
1876 /* Set the nowait flag on OMP_RETURN statement S. */
1878 static inline void
1879 gimple_omp_return_set_nowait (gimple s)
1881 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1882 s->subcode |= GF_OMP_RETURN_NOWAIT;
1886 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1887 flag set. */
1889 static inline bool
1890 gimple_omp_return_nowait_p (const_gimple g)
1892 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1893 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1897 /* Set the LHS of OMP return. */
1899 static inline void
1900 gimple_omp_return_set_lhs (gimple g, tree lhs)
1902 gimple_statement_omp_return *omp_return_stmt =
1903 as_a <gimple_statement_omp_return> (g);
1904 omp_return_stmt->val = lhs;
1908 /* Get the LHS of OMP return. */
1910 static inline tree
1911 gimple_omp_return_lhs (const_gimple g)
1913 const gimple_statement_omp_return *omp_return_stmt =
1914 as_a <const gimple_statement_omp_return> (g);
1915 return omp_return_stmt->val;
1919 /* Return a pointer to the LHS of OMP return. */
1921 static inline tree *
1922 gimple_omp_return_lhs_ptr (gimple g)
1924 gimple_statement_omp_return *omp_return_stmt =
1925 as_a <gimple_statement_omp_return> (g);
1926 return &omp_return_stmt->val;
1930 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1931 flag set. */
1933 static inline bool
1934 gimple_omp_section_last_p (const_gimple g)
1936 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1937 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1941 /* Set the GF_OMP_SECTION_LAST flag on G. */
1943 static inline void
1944 gimple_omp_section_set_last (gimple g)
1946 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1947 g->subcode |= GF_OMP_SECTION_LAST;
1951 /* Return true if OMP parallel statement G has the
1952 GF_OMP_PARALLEL_COMBINED flag set. */
1954 static inline bool
1955 gimple_omp_parallel_combined_p (const_gimple g)
1957 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1958 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1962 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1963 value of COMBINED_P. */
1965 static inline void
1966 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1968 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1969 if (combined_p)
1970 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1971 else
1972 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1976 /* Return true if OMP atomic load/store statement G has the
1977 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1979 static inline bool
1980 gimple_omp_atomic_need_value_p (const_gimple g)
1982 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1983 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1984 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1988 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1990 static inline void
1991 gimple_omp_atomic_set_need_value (gimple g)
1993 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1994 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1995 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1999 /* Return true if OMP atomic load/store statement G has the
2000 GF_OMP_ATOMIC_SEQ_CST flag set. */
2002 static inline bool
2003 gimple_omp_atomic_seq_cst_p (const_gimple g)
2005 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2006 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2007 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2011 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2013 static inline void
2014 gimple_omp_atomic_set_seq_cst (gimple g)
2016 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2017 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2018 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2022 /* Return the number of operands for statement GS. */
2024 static inline unsigned
2025 gimple_num_ops (const_gimple gs)
2027 return gs->num_ops;
2031 /* Set the number of operands for statement GS. */
2033 static inline void
2034 gimple_set_num_ops (gimple gs, unsigned num_ops)
2036 gs->num_ops = num_ops;
2040 /* Return the array of operands for statement GS. */
2042 static inline tree *
2043 gimple_ops (gimple gs)
2045 size_t off;
2047 /* All the tuples have their operand vector at the very bottom
2048 of the structure. Note that those structures that do not
2049 have an operand vector have a zero offset. */
2050 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2051 gcc_gimple_checking_assert (off != 0);
2053 return (tree *) ((char *) gs + off);
2057 /* Return operand I for statement GS. */
2059 static inline tree
2060 gimple_op (const_gimple gs, unsigned i)
2062 if (gimple_has_ops (gs))
2064 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2065 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2067 else
2068 return NULL_TREE;
2071 /* Return a pointer to operand I for statement GS. */
2073 static inline tree *
2074 gimple_op_ptr (const_gimple gs, unsigned i)
2076 if (gimple_has_ops (gs))
2078 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2079 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2081 else
2082 return NULL;
2085 /* Set operand I of statement GS to OP. */
2087 static inline void
2088 gimple_set_op (gimple gs, unsigned i, tree op)
2090 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2092 /* Note. It may be tempting to assert that OP matches
2093 is_gimple_operand, but that would be wrong. Different tuples
2094 accept slightly different sets of tree operands. Each caller
2095 should perform its own validation. */
2096 gimple_ops (gs)[i] = op;
2099 /* Return true if GS is a GIMPLE_ASSIGN. */
2101 static inline bool
2102 is_gimple_assign (const_gimple gs)
2104 return gimple_code (gs) == GIMPLE_ASSIGN;
2107 /* Determine if expression CODE is one of the valid expressions that can
2108 be used on the RHS of GIMPLE assignments. */
2110 static inline enum gimple_rhs_class
2111 get_gimple_rhs_class (enum tree_code code)
2113 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2116 /* Return the LHS of assignment statement GS. */
2118 static inline tree
2119 gimple_assign_lhs (const_gimple gs)
2121 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2122 return gimple_op (gs, 0);
2126 /* Return a pointer to the LHS of assignment statement GS. */
2128 static inline tree *
2129 gimple_assign_lhs_ptr (const_gimple gs)
2131 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2132 return gimple_op_ptr (gs, 0);
2136 /* Set LHS to be the LHS operand of assignment statement GS. */
2138 static inline void
2139 gimple_assign_set_lhs (gimple gs, tree lhs)
2141 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2142 gimple_set_op (gs, 0, lhs);
2144 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2145 SSA_NAME_DEF_STMT (lhs) = gs;
2149 /* Return the first operand on the RHS of assignment statement GS. */
2151 static inline tree
2152 gimple_assign_rhs1 (const_gimple gs)
2154 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2155 return gimple_op (gs, 1);
2159 /* Return a pointer to the first operand on the RHS of assignment
2160 statement GS. */
2162 static inline tree *
2163 gimple_assign_rhs1_ptr (const_gimple gs)
2165 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2166 return gimple_op_ptr (gs, 1);
2169 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2171 static inline void
2172 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2174 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2176 gimple_set_op (gs, 1, rhs);
2180 /* Return the second operand on the RHS of assignment statement GS.
2181 If GS does not have two operands, NULL is returned instead. */
2183 static inline tree
2184 gimple_assign_rhs2 (const_gimple gs)
2186 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2188 if (gimple_num_ops (gs) >= 3)
2189 return gimple_op (gs, 2);
2190 else
2191 return NULL_TREE;
2195 /* Return a pointer to the second operand on the RHS of assignment
2196 statement GS. */
2198 static inline tree *
2199 gimple_assign_rhs2_ptr (const_gimple gs)
2201 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2202 return gimple_op_ptr (gs, 2);
2206 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2208 static inline void
2209 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2211 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2213 gimple_set_op (gs, 2, rhs);
2216 /* Return the third operand on the RHS of assignment statement GS.
2217 If GS does not have two operands, NULL is returned instead. */
2219 static inline tree
2220 gimple_assign_rhs3 (const_gimple gs)
2222 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2224 if (gimple_num_ops (gs) >= 4)
2225 return gimple_op (gs, 3);
2226 else
2227 return NULL_TREE;
2230 /* Return a pointer to the third operand on the RHS of assignment
2231 statement GS. */
2233 static inline tree *
2234 gimple_assign_rhs3_ptr (const_gimple gs)
2236 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2237 return gimple_op_ptr (gs, 3);
2241 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2243 static inline void
2244 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2246 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2248 gimple_set_op (gs, 3, rhs);
2251 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2252 to see only a maximum of two operands. */
2254 static inline void
2255 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2256 tree op1, tree op2)
2258 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2261 /* Returns true if GS is a nontemporal move. */
2263 static inline bool
2264 gimple_assign_nontemporal_move_p (const_gimple gs)
2266 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2267 return gs->nontemporal_move;
2270 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2272 static inline void
2273 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2275 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2276 gs->nontemporal_move = nontemporal;
2280 /* Return the code of the expression computed on the rhs of assignment
2281 statement GS. In case that the RHS is a single object, returns the
2282 tree code of the object. */
2284 static inline enum tree_code
2285 gimple_assign_rhs_code (const_gimple gs)
2287 enum tree_code code;
2288 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2290 code = (enum tree_code) gs->subcode;
2291 /* While we initially set subcode to the TREE_CODE of the rhs for
2292 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2293 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2294 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2295 code = TREE_CODE (gimple_assign_rhs1 (gs));
2297 return code;
2301 /* Set CODE to be the code for the expression computed on the RHS of
2302 assignment S. */
2304 static inline void
2305 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2307 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2308 s->subcode = code;
2312 /* Return the gimple rhs class of the code of the expression computed on
2313 the rhs of assignment statement GS.
2314 This will never return GIMPLE_INVALID_RHS. */
2316 static inline enum gimple_rhs_class
2317 gimple_assign_rhs_class (const_gimple gs)
2319 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2322 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2323 there is no operator associated with the assignment itself.
2324 Unlike gimple_assign_copy_p, this predicate returns true for
2325 any RHS operand, including those that perform an operation
2326 and do not have the semantics of a copy, such as COND_EXPR. */
2328 static inline bool
2329 gimple_assign_single_p (gimple gs)
2331 return (is_gimple_assign (gs)
2332 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2335 /* Return true if GS performs a store to its lhs. */
2337 static inline bool
2338 gimple_store_p (gimple gs)
2340 tree lhs = gimple_get_lhs (gs);
2341 return lhs && !is_gimple_reg (lhs);
2344 /* Return true if GS is an assignment that loads from its rhs1. */
2346 static inline bool
2347 gimple_assign_load_p (gimple gs)
2349 tree rhs;
2350 if (!gimple_assign_single_p (gs))
2351 return false;
2352 rhs = gimple_assign_rhs1 (gs);
2353 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2354 return true;
2355 rhs = get_base_address (rhs);
2356 return (DECL_P (rhs)
2357 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2361 /* Return true if S is a type-cast assignment. */
2363 static inline bool
2364 gimple_assign_cast_p (gimple s)
2366 if (is_gimple_assign (s))
2368 enum tree_code sc = gimple_assign_rhs_code (s);
2369 return CONVERT_EXPR_CODE_P (sc)
2370 || sc == VIEW_CONVERT_EXPR
2371 || sc == FIX_TRUNC_EXPR;
2374 return false;
2377 /* Return true if S is a clobber statement. */
2379 static inline bool
2380 gimple_clobber_p (gimple s)
2382 return gimple_assign_single_p (s)
2383 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2386 /* Return true if GS is a GIMPLE_CALL. */
2388 static inline bool
2389 is_gimple_call (const_gimple gs)
2391 return gimple_code (gs) == GIMPLE_CALL;
2394 /* Return the LHS of call statement GS. */
2396 static inline tree
2397 gimple_call_lhs (const_gimple gs)
2399 GIMPLE_CHECK (gs, GIMPLE_CALL);
2400 return gimple_op (gs, 0);
2404 /* Return a pointer to the LHS of call statement GS. */
2406 static inline tree *
2407 gimple_call_lhs_ptr (const_gimple gs)
2409 GIMPLE_CHECK (gs, GIMPLE_CALL);
2410 return gimple_op_ptr (gs, 0);
2414 /* Set LHS to be the LHS operand of call statement GS. */
2416 static inline void
2417 gimple_call_set_lhs (gimple gs, tree lhs)
2419 GIMPLE_CHECK (gs, GIMPLE_CALL);
2420 gimple_set_op (gs, 0, lhs);
2421 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2422 SSA_NAME_DEF_STMT (lhs) = gs;
2426 /* Return true if call GS calls an internal-only function, as enumerated
2427 by internal_fn. */
2429 static inline bool
2430 gimple_call_internal_p (const_gimple gs)
2432 GIMPLE_CHECK (gs, GIMPLE_CALL);
2433 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2437 /* Return the target of internal call GS. */
2439 static inline enum internal_fn
2440 gimple_call_internal_fn (const_gimple gs)
2442 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2443 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2447 /* Return the function type of the function called by GS. */
2449 static inline tree
2450 gimple_call_fntype (const_gimple gs)
2452 const gimple_statement_call *call_stmt =
2453 as_a <const gimple_statement_call> (gs);
2454 if (gimple_call_internal_p (gs))
2455 return NULL_TREE;
2456 return call_stmt->u.fntype;
2459 /* Set the type of the function called by GS to FNTYPE. */
2461 static inline void
2462 gimple_call_set_fntype (gimple gs, tree fntype)
2464 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2465 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2466 call_stmt->u.fntype = fntype;
2470 /* Return the tree node representing the function called by call
2471 statement GS. */
2473 static inline tree
2474 gimple_call_fn (const_gimple gs)
2476 GIMPLE_CHECK (gs, GIMPLE_CALL);
2477 return gimple_op (gs, 1);
2480 /* Return a pointer to the tree node representing the function called by call
2481 statement GS. */
2483 static inline tree *
2484 gimple_call_fn_ptr (const_gimple gs)
2486 GIMPLE_CHECK (gs, GIMPLE_CALL);
2487 return gimple_op_ptr (gs, 1);
2491 /* Set FN to be the function called by call statement GS. */
2493 static inline void
2494 gimple_call_set_fn (gimple gs, tree fn)
2496 GIMPLE_CHECK (gs, GIMPLE_CALL);
2497 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2498 gimple_set_op (gs, 1, fn);
2502 /* Set FNDECL to be the function called by call statement GS. */
2504 static inline void
2505 gimple_call_set_fndecl (gimple gs, tree decl)
2507 GIMPLE_CHECK (gs, GIMPLE_CALL);
2508 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2509 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2513 /* Set internal function FN to be the function called by call statement GS. */
2515 static inline void
2516 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2518 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2519 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2520 call_stmt->u.internal_fn = fn;
2524 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2525 Otherwise return NULL. This function is analogous to
2526 get_callee_fndecl in tree land. */
2528 static inline tree
2529 gimple_call_fndecl (const_gimple gs)
2531 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2535 /* Return the type returned by call statement GS. */
2537 static inline tree
2538 gimple_call_return_type (const_gimple gs)
2540 tree type = gimple_call_fntype (gs);
2542 if (type == NULL_TREE)
2543 return TREE_TYPE (gimple_call_lhs (gs));
2545 /* The type returned by a function is the type of its
2546 function type. */
2547 return TREE_TYPE (type);
2551 /* Return the static chain for call statement GS. */
2553 static inline tree
2554 gimple_call_chain (const_gimple gs)
2556 GIMPLE_CHECK (gs, GIMPLE_CALL);
2557 return gimple_op (gs, 2);
2561 /* Return a pointer to the static chain for call statement GS. */
2563 static inline tree *
2564 gimple_call_chain_ptr (const_gimple gs)
2566 GIMPLE_CHECK (gs, GIMPLE_CALL);
2567 return gimple_op_ptr (gs, 2);
2570 /* Set CHAIN to be the static chain for call statement GS. */
2572 static inline void
2573 gimple_call_set_chain (gimple gs, tree chain)
2575 GIMPLE_CHECK (gs, GIMPLE_CALL);
2577 gimple_set_op (gs, 2, chain);
2581 /* Return the number of arguments used by call statement GS. */
2583 static inline unsigned
2584 gimple_call_num_args (const_gimple gs)
2586 unsigned num_ops;
2587 GIMPLE_CHECK (gs, GIMPLE_CALL);
2588 num_ops = gimple_num_ops (gs);
2589 return num_ops - 3;
2593 /* Return the argument at position INDEX for call statement GS. */
2595 static inline tree
2596 gimple_call_arg (const_gimple gs, unsigned index)
2598 GIMPLE_CHECK (gs, GIMPLE_CALL);
2599 return gimple_op (gs, index + 3);
2603 /* Return a pointer to the argument at position INDEX for call
2604 statement GS. */
2606 static inline tree *
2607 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2609 GIMPLE_CHECK (gs, GIMPLE_CALL);
2610 return gimple_op_ptr (gs, index + 3);
2614 /* Set ARG to be the argument at position INDEX for call statement GS. */
2616 static inline void
2617 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2619 GIMPLE_CHECK (gs, GIMPLE_CALL);
2620 gimple_set_op (gs, index + 3, arg);
2624 /* If TAIL_P is true, mark call statement S as being a tail call
2625 (i.e., a call just before the exit of a function). These calls are
2626 candidate for tail call optimization. */
2628 static inline void
2629 gimple_call_set_tail (gimple s, bool tail_p)
2631 GIMPLE_CHECK (s, GIMPLE_CALL);
2632 if (tail_p)
2633 s->subcode |= GF_CALL_TAILCALL;
2634 else
2635 s->subcode &= ~GF_CALL_TAILCALL;
2639 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2641 static inline bool
2642 gimple_call_tail_p (gimple s)
2644 GIMPLE_CHECK (s, GIMPLE_CALL);
2645 return (s->subcode & GF_CALL_TAILCALL) != 0;
2649 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2650 slot optimization. This transformation uses the target of the call
2651 expansion as the return slot for calls that return in memory. */
2653 static inline void
2654 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2656 GIMPLE_CHECK (s, GIMPLE_CALL);
2657 if (return_slot_opt_p)
2658 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2659 else
2660 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2664 /* Return true if S is marked for return slot optimization. */
2666 static inline bool
2667 gimple_call_return_slot_opt_p (gimple s)
2669 GIMPLE_CHECK (s, GIMPLE_CALL);
2670 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2674 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2675 thunk to the thunked-to function. */
2677 static inline void
2678 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2680 GIMPLE_CHECK (s, GIMPLE_CALL);
2681 if (from_thunk_p)
2682 s->subcode |= GF_CALL_FROM_THUNK;
2683 else
2684 s->subcode &= ~GF_CALL_FROM_THUNK;
2688 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2690 static inline bool
2691 gimple_call_from_thunk_p (gimple s)
2693 GIMPLE_CHECK (s, GIMPLE_CALL);
2694 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2698 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2699 argument pack in its argument list. */
2701 static inline void
2702 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2704 GIMPLE_CHECK (s, GIMPLE_CALL);
2705 if (pass_arg_pack_p)
2706 s->subcode |= GF_CALL_VA_ARG_PACK;
2707 else
2708 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2712 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2713 argument pack in its argument list. */
2715 static inline bool
2716 gimple_call_va_arg_pack_p (gimple s)
2718 GIMPLE_CHECK (s, GIMPLE_CALL);
2719 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2723 /* Return true if S is a noreturn call. */
2725 static inline bool
2726 gimple_call_noreturn_p (gimple s)
2728 GIMPLE_CHECK (s, GIMPLE_CALL);
2729 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2733 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2734 even if the called function can throw in other cases. */
2736 static inline void
2737 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2739 GIMPLE_CHECK (s, GIMPLE_CALL);
2740 if (nothrow_p)
2741 s->subcode |= GF_CALL_NOTHROW;
2742 else
2743 s->subcode &= ~GF_CALL_NOTHROW;
2746 /* Return true if S is a nothrow call. */
2748 static inline bool
2749 gimple_call_nothrow_p (gimple s)
2751 GIMPLE_CHECK (s, GIMPLE_CALL);
2752 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2755 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2756 is known to be emitted for VLA objects. Those are wrapped by
2757 stack_save/stack_restore calls and hence can't lead to unbounded
2758 stack growth even when they occur in loops. */
2760 static inline void
2761 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2763 GIMPLE_CHECK (s, GIMPLE_CALL);
2764 if (for_var)
2765 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2766 else
2767 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2770 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2772 static inline bool
2773 gimple_call_alloca_for_var_p (gimple s)
2775 GIMPLE_CHECK (s, GIMPLE_CALL);
2776 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2779 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2781 static inline void
2782 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2784 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2785 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2786 dest_call->subcode = orig_call->subcode;
2790 /* Return a pointer to the points-to solution for the set of call-used
2791 variables of the call CALL. */
2793 static inline struct pt_solution *
2794 gimple_call_use_set (gimple call)
2796 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2797 return &call_stmt->call_used;
2801 /* Return a pointer to the points-to solution for the set of call-used
2802 variables of the call CALL. */
2804 static inline struct pt_solution *
2805 gimple_call_clobber_set (gimple call)
2807 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2808 return &call_stmt->call_clobbered;
2812 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2813 non-NULL lhs. */
2815 static inline bool
2816 gimple_has_lhs (gimple stmt)
2818 return (is_gimple_assign (stmt)
2819 || (is_gimple_call (stmt)
2820 && gimple_call_lhs (stmt) != NULL_TREE));
2824 /* Return the code of the predicate computed by conditional statement GS. */
2826 static inline enum tree_code
2827 gimple_cond_code (const_gimple gs)
2829 GIMPLE_CHECK (gs, GIMPLE_COND);
2830 return (enum tree_code) gs->subcode;
2834 /* Set CODE to be the predicate code for the conditional statement GS. */
2836 static inline void
2837 gimple_cond_set_code (gimple gs, enum tree_code code)
2839 GIMPLE_CHECK (gs, GIMPLE_COND);
2840 gs->subcode = code;
2844 /* Return the LHS of the predicate computed by conditional statement GS. */
2846 static inline tree
2847 gimple_cond_lhs (const_gimple gs)
2849 GIMPLE_CHECK (gs, GIMPLE_COND);
2850 return gimple_op (gs, 0);
2853 /* Return the pointer to the LHS of the predicate computed by conditional
2854 statement GS. */
2856 static inline tree *
2857 gimple_cond_lhs_ptr (const_gimple gs)
2859 GIMPLE_CHECK (gs, GIMPLE_COND);
2860 return gimple_op_ptr (gs, 0);
2863 /* Set LHS to be the LHS operand of the predicate computed by
2864 conditional statement GS. */
2866 static inline void
2867 gimple_cond_set_lhs (gimple gs, tree lhs)
2869 GIMPLE_CHECK (gs, GIMPLE_COND);
2870 gimple_set_op (gs, 0, lhs);
2874 /* Return the RHS operand of the predicate computed by conditional GS. */
2876 static inline tree
2877 gimple_cond_rhs (const_gimple gs)
2879 GIMPLE_CHECK (gs, GIMPLE_COND);
2880 return gimple_op (gs, 1);
2883 /* Return the pointer to the RHS operand of the predicate computed by
2884 conditional GS. */
2886 static inline tree *
2887 gimple_cond_rhs_ptr (const_gimple gs)
2889 GIMPLE_CHECK (gs, GIMPLE_COND);
2890 return gimple_op_ptr (gs, 1);
2894 /* Set RHS to be the RHS operand of the predicate computed by
2895 conditional statement GS. */
2897 static inline void
2898 gimple_cond_set_rhs (gimple gs, tree rhs)
2900 GIMPLE_CHECK (gs, GIMPLE_COND);
2901 gimple_set_op (gs, 1, rhs);
2905 /* Return the label used by conditional statement GS when its
2906 predicate evaluates to true. */
2908 static inline tree
2909 gimple_cond_true_label (const_gimple gs)
2911 GIMPLE_CHECK (gs, GIMPLE_COND);
2912 return gimple_op (gs, 2);
2916 /* Set LABEL to be the label used by conditional statement GS when its
2917 predicate evaluates to true. */
2919 static inline void
2920 gimple_cond_set_true_label (gimple gs, tree label)
2922 GIMPLE_CHECK (gs, GIMPLE_COND);
2923 gimple_set_op (gs, 2, label);
2927 /* Set LABEL to be the label used by conditional statement GS when its
2928 predicate evaluates to false. */
2930 static inline void
2931 gimple_cond_set_false_label (gimple gs, tree label)
2933 GIMPLE_CHECK (gs, GIMPLE_COND);
2934 gimple_set_op (gs, 3, label);
2938 /* Return the label used by conditional statement GS when its
2939 predicate evaluates to false. */
2941 static inline tree
2942 gimple_cond_false_label (const_gimple gs)
2944 GIMPLE_CHECK (gs, GIMPLE_COND);
2945 return gimple_op (gs, 3);
2949 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2951 static inline void
2952 gimple_cond_make_false (gimple gs)
2954 gimple_cond_set_lhs (gs, boolean_true_node);
2955 gimple_cond_set_rhs (gs, boolean_false_node);
2956 gs->subcode = EQ_EXPR;
2960 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2962 static inline void
2963 gimple_cond_make_true (gimple gs)
2965 gimple_cond_set_lhs (gs, boolean_true_node);
2966 gimple_cond_set_rhs (gs, boolean_true_node);
2967 gs->subcode = EQ_EXPR;
2970 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2971 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2973 static inline bool
2974 gimple_cond_true_p (const_gimple gs)
2976 tree lhs = gimple_cond_lhs (gs);
2977 tree rhs = gimple_cond_rhs (gs);
2978 enum tree_code code = gimple_cond_code (gs);
2980 if (lhs != boolean_true_node && lhs != boolean_false_node)
2981 return false;
2983 if (rhs != boolean_true_node && rhs != boolean_false_node)
2984 return false;
2986 if (code == NE_EXPR && lhs != rhs)
2987 return true;
2989 if (code == EQ_EXPR && lhs == rhs)
2990 return true;
2992 return false;
2995 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2996 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2998 static inline bool
2999 gimple_cond_false_p (const_gimple gs)
3001 tree lhs = gimple_cond_lhs (gs);
3002 tree rhs = gimple_cond_rhs (gs);
3003 enum tree_code code = gimple_cond_code (gs);
3005 if (lhs != boolean_true_node && lhs != boolean_false_node)
3006 return false;
3008 if (rhs != boolean_true_node && rhs != boolean_false_node)
3009 return false;
3011 if (code == NE_EXPR && lhs == rhs)
3012 return true;
3014 if (code == EQ_EXPR && lhs != rhs)
3015 return true;
3017 return false;
3020 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3022 static inline void
3023 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3025 gimple_cond_set_code (stmt, code);
3026 gimple_cond_set_lhs (stmt, lhs);
3027 gimple_cond_set_rhs (stmt, rhs);
3030 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3032 static inline tree
3033 gimple_label_label (const_gimple gs)
3035 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3036 return gimple_op (gs, 0);
3040 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3041 GS. */
3043 static inline void
3044 gimple_label_set_label (gimple gs, tree label)
3046 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3047 gimple_set_op (gs, 0, label);
3051 /* Return the destination of the unconditional jump GS. */
3053 static inline tree
3054 gimple_goto_dest (const_gimple gs)
3056 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3057 return gimple_op (gs, 0);
3061 /* Set DEST to be the destination of the unconditonal jump GS. */
3063 static inline void
3064 gimple_goto_set_dest (gimple gs, tree dest)
3066 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3067 gimple_set_op (gs, 0, dest);
3071 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3073 static inline tree
3074 gimple_bind_vars (const_gimple gs)
3076 const gimple_statement_bind *bind_stmt =
3077 as_a <const gimple_statement_bind> (gs);
3078 return bind_stmt->vars;
3082 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3083 statement GS. */
3085 static inline void
3086 gimple_bind_set_vars (gimple gs, tree vars)
3088 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3089 bind_stmt->vars = vars;
3093 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3094 statement GS. */
3096 static inline void
3097 gimple_bind_append_vars (gimple gs, tree vars)
3099 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3100 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3104 static inline gimple_seq *
3105 gimple_bind_body_ptr (gimple gs)
3107 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3108 return &bind_stmt->body;
3111 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3113 static inline gimple_seq
3114 gimple_bind_body (gimple gs)
3116 return *gimple_bind_body_ptr (gs);
3120 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3121 statement GS. */
3123 static inline void
3124 gimple_bind_set_body (gimple gs, gimple_seq seq)
3126 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3127 bind_stmt->body = seq;
3131 /* Append a statement to the end of a GIMPLE_BIND's body. */
3133 static inline void
3134 gimple_bind_add_stmt (gimple gs, gimple stmt)
3136 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3137 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3141 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3143 static inline void
3144 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3146 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3147 gimple_seq_add_seq (&bind_stmt->body, seq);
3151 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3152 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3154 static inline tree
3155 gimple_bind_block (const_gimple gs)
3157 const gimple_statement_bind *bind_stmt =
3158 as_a <const gimple_statement_bind> (gs);
3159 return bind_stmt->block;
3163 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3164 statement GS. */
3166 static inline void
3167 gimple_bind_set_block (gimple gs, tree block)
3169 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3170 gcc_gimple_checking_assert (block == NULL_TREE
3171 || TREE_CODE (block) == BLOCK);
3172 bind_stmt->block = block;
3176 /* Return the number of input operands for GIMPLE_ASM GS. */
3178 static inline unsigned
3179 gimple_asm_ninputs (const_gimple gs)
3181 const gimple_statement_asm *asm_stmt =
3182 as_a <const gimple_statement_asm> (gs);
3183 return asm_stmt->ni;
3187 /* Return the number of output operands for GIMPLE_ASM GS. */
3189 static inline unsigned
3190 gimple_asm_noutputs (const_gimple gs)
3192 const gimple_statement_asm *asm_stmt =
3193 as_a <const gimple_statement_asm> (gs);
3194 return asm_stmt->no;
3198 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3200 static inline unsigned
3201 gimple_asm_nclobbers (const_gimple gs)
3203 const gimple_statement_asm *asm_stmt =
3204 as_a <const gimple_statement_asm> (gs);
3205 return asm_stmt->nc;
3208 /* Return the number of label operands for GIMPLE_ASM GS. */
3210 static inline unsigned
3211 gimple_asm_nlabels (const_gimple gs)
3213 const gimple_statement_asm *asm_stmt =
3214 as_a <const gimple_statement_asm> (gs);
3215 return asm_stmt->nl;
3218 /* Return input operand INDEX of GIMPLE_ASM GS. */
3220 static inline tree
3221 gimple_asm_input_op (const_gimple gs, unsigned index)
3223 const gimple_statement_asm *asm_stmt =
3224 as_a <const gimple_statement_asm> (gs);
3225 gcc_gimple_checking_assert (index < asm_stmt->ni);
3226 return gimple_op (gs, index + asm_stmt->no);
3229 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3231 static inline tree *
3232 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3234 const gimple_statement_asm *asm_stmt =
3235 as_a <const gimple_statement_asm> (gs);
3236 gcc_gimple_checking_assert (index < asm_stmt->ni);
3237 return gimple_op_ptr (gs, index + asm_stmt->no);
3241 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3243 static inline void
3244 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3246 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3247 gcc_gimple_checking_assert (index < asm_stmt->ni
3248 && TREE_CODE (in_op) == TREE_LIST);
3249 gimple_set_op (gs, index + asm_stmt->no, in_op);
3253 /* Return output operand INDEX of GIMPLE_ASM GS. */
3255 static inline tree
3256 gimple_asm_output_op (const_gimple gs, unsigned index)
3258 const gimple_statement_asm *asm_stmt =
3259 as_a <const gimple_statement_asm> (gs);
3260 gcc_gimple_checking_assert (index < asm_stmt->no);
3261 return gimple_op (gs, index);
3264 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3266 static inline tree *
3267 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3269 const gimple_statement_asm *asm_stmt =
3270 as_a <const gimple_statement_asm> (gs);
3271 gcc_gimple_checking_assert (index < asm_stmt->no);
3272 return gimple_op_ptr (gs, index);
3276 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3278 static inline void
3279 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3281 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3282 gcc_gimple_checking_assert (index < asm_stmt->no
3283 && TREE_CODE (out_op) == TREE_LIST);
3284 gimple_set_op (gs, index, out_op);
3288 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3290 static inline tree
3291 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3293 const gimple_statement_asm *asm_stmt =
3294 as_a <const gimple_statement_asm> (gs);
3295 gcc_gimple_checking_assert (index < asm_stmt->nc);
3296 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3300 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3302 static inline void
3303 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3305 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3306 gcc_gimple_checking_assert (index < asm_stmt->nc
3307 && TREE_CODE (clobber_op) == TREE_LIST);
3308 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3311 /* Return label operand INDEX of GIMPLE_ASM GS. */
3313 static inline tree
3314 gimple_asm_label_op (const_gimple gs, unsigned index)
3316 const gimple_statement_asm *asm_stmt =
3317 as_a <const gimple_statement_asm> (gs);
3318 gcc_gimple_checking_assert (index < asm_stmt->nl);
3319 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3322 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3324 static inline void
3325 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3327 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3328 gcc_gimple_checking_assert (index < asm_stmt->nl
3329 && TREE_CODE (label_op) == TREE_LIST);
3330 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3333 /* Return the string representing the assembly instruction in
3334 GIMPLE_ASM GS. */
3336 static inline const char *
3337 gimple_asm_string (const_gimple gs)
3339 const gimple_statement_asm *asm_stmt =
3340 as_a <const gimple_statement_asm> (gs);
3341 return asm_stmt->string;
3345 /* Return true if GS is an asm statement marked volatile. */
3347 static inline bool
3348 gimple_asm_volatile_p (const_gimple gs)
3350 GIMPLE_CHECK (gs, GIMPLE_ASM);
3351 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3355 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3357 static inline void
3358 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3360 GIMPLE_CHECK (gs, GIMPLE_ASM);
3361 if (volatile_p)
3362 gs->subcode |= GF_ASM_VOLATILE;
3363 else
3364 gs->subcode &= ~GF_ASM_VOLATILE;
3368 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3370 static inline void
3371 gimple_asm_set_input (gimple gs, bool input_p)
3373 GIMPLE_CHECK (gs, GIMPLE_ASM);
3374 if (input_p)
3375 gs->subcode |= GF_ASM_INPUT;
3376 else
3377 gs->subcode &= ~GF_ASM_INPUT;
3381 /* Return true if asm GS is an ASM_INPUT. */
3383 static inline bool
3384 gimple_asm_input_p (const_gimple gs)
3386 GIMPLE_CHECK (gs, GIMPLE_ASM);
3387 return (gs->subcode & GF_ASM_INPUT) != 0;
3391 /* Return the types handled by GIMPLE_CATCH statement GS. */
3393 static inline tree
3394 gimple_catch_types (const_gimple gs)
3396 const gimple_statement_catch *catch_stmt =
3397 as_a <const gimple_statement_catch> (gs);
3398 return catch_stmt->types;
3402 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3404 static inline tree *
3405 gimple_catch_types_ptr (gimple gs)
3407 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3408 return &catch_stmt->types;
3412 /* Return a pointer to the GIMPLE sequence representing the body of
3413 the handler of GIMPLE_CATCH statement GS. */
3415 static inline gimple_seq *
3416 gimple_catch_handler_ptr (gimple gs)
3418 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3419 return &catch_stmt->handler;
3423 /* Return the GIMPLE sequence representing the body of the handler of
3424 GIMPLE_CATCH statement GS. */
3426 static inline gimple_seq
3427 gimple_catch_handler (gimple gs)
3429 return *gimple_catch_handler_ptr (gs);
3433 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3435 static inline void
3436 gimple_catch_set_types (gimple gs, tree t)
3438 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3439 catch_stmt->types = t;
3443 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3445 static inline void
3446 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3448 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3449 catch_stmt->handler = handler;
3453 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3455 static inline tree
3456 gimple_eh_filter_types (const_gimple gs)
3458 const gimple_statement_eh_filter *eh_filter_stmt =
3459 as_a <const gimple_statement_eh_filter> (gs);
3460 return eh_filter_stmt->types;
3464 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3465 GS. */
3467 static inline tree *
3468 gimple_eh_filter_types_ptr (gimple gs)
3470 gimple_statement_eh_filter *eh_filter_stmt =
3471 as_a <gimple_statement_eh_filter> (gs);
3472 return &eh_filter_stmt->types;
3476 /* Return a pointer to the sequence of statement to execute when
3477 GIMPLE_EH_FILTER statement fails. */
3479 static inline gimple_seq *
3480 gimple_eh_filter_failure_ptr (gimple gs)
3482 gimple_statement_eh_filter *eh_filter_stmt =
3483 as_a <gimple_statement_eh_filter> (gs);
3484 return &eh_filter_stmt->failure;
3488 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3489 statement fails. */
3491 static inline gimple_seq
3492 gimple_eh_filter_failure (gimple gs)
3494 return *gimple_eh_filter_failure_ptr (gs);
3498 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3500 static inline void
3501 gimple_eh_filter_set_types (gimple gs, tree types)
3503 gimple_statement_eh_filter *eh_filter_stmt =
3504 as_a <gimple_statement_eh_filter> (gs);
3505 eh_filter_stmt->types = types;
3509 /* Set FAILURE to be the sequence of statements to execute on failure
3510 for GIMPLE_EH_FILTER GS. */
3512 static inline void
3513 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3515 gimple_statement_eh_filter *eh_filter_stmt =
3516 as_a <gimple_statement_eh_filter> (gs);
3517 eh_filter_stmt->failure = failure;
3520 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3522 static inline tree
3523 gimple_eh_must_not_throw_fndecl (gimple gs)
3525 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3526 return eh_mnt_stmt->fndecl;
3529 /* Set the function decl to be called by GS to DECL. */
3531 static inline void
3532 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3534 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3535 eh_mnt_stmt->fndecl = decl;
3538 /* GIMPLE_EH_ELSE accessors. */
3540 static inline gimple_seq *
3541 gimple_eh_else_n_body_ptr (gimple gs)
3543 gimple_statement_eh_else *eh_else_stmt =
3544 as_a <gimple_statement_eh_else> (gs);
3545 return &eh_else_stmt->n_body;
3548 static inline gimple_seq
3549 gimple_eh_else_n_body (gimple gs)
3551 return *gimple_eh_else_n_body_ptr (gs);
3554 static inline gimple_seq *
3555 gimple_eh_else_e_body_ptr (gimple gs)
3557 gimple_statement_eh_else *eh_else_stmt =
3558 as_a <gimple_statement_eh_else> (gs);
3559 return &eh_else_stmt->e_body;
3562 static inline gimple_seq
3563 gimple_eh_else_e_body (gimple gs)
3565 return *gimple_eh_else_e_body_ptr (gs);
3568 static inline void
3569 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3571 gimple_statement_eh_else *eh_else_stmt =
3572 as_a <gimple_statement_eh_else> (gs);
3573 eh_else_stmt->n_body = seq;
3576 static inline void
3577 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3579 gimple_statement_eh_else *eh_else_stmt =
3580 as_a <gimple_statement_eh_else> (gs);
3581 eh_else_stmt->e_body = seq;
3584 /* GIMPLE_TRY accessors. */
3586 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3587 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3589 static inline enum gimple_try_flags
3590 gimple_try_kind (const_gimple gs)
3592 GIMPLE_CHECK (gs, GIMPLE_TRY);
3593 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3597 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3599 static inline void
3600 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3602 GIMPLE_CHECK (gs, GIMPLE_TRY);
3603 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3604 || kind == GIMPLE_TRY_FINALLY);
3605 if (gimple_try_kind (gs) != kind)
3606 gs->subcode = (unsigned int) kind;
3610 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3612 static inline bool
3613 gimple_try_catch_is_cleanup (const_gimple gs)
3615 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3616 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3620 /* Return a pointer to the sequence of statements used as the
3621 body for GIMPLE_TRY GS. */
3623 static inline gimple_seq *
3624 gimple_try_eval_ptr (gimple gs)
3626 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3627 return &try_stmt->eval;
3631 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3633 static inline gimple_seq
3634 gimple_try_eval (gimple gs)
3636 return *gimple_try_eval_ptr (gs);
3640 /* Return a pointer to the sequence of statements used as the cleanup body for
3641 GIMPLE_TRY GS. */
3643 static inline gimple_seq *
3644 gimple_try_cleanup_ptr (gimple gs)
3646 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3647 return &try_stmt->cleanup;
3651 /* Return the sequence of statements used as the cleanup body for
3652 GIMPLE_TRY GS. */
3654 static inline gimple_seq
3655 gimple_try_cleanup (gimple gs)
3657 return *gimple_try_cleanup_ptr (gs);
3661 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3663 static inline void
3664 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3666 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3667 if (catch_is_cleanup)
3668 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3669 else
3670 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3674 /* Set EVAL to be the sequence of statements to use as the body for
3675 GIMPLE_TRY GS. */
3677 static inline void
3678 gimple_try_set_eval (gimple gs, gimple_seq eval)
3680 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3681 try_stmt->eval = eval;
3685 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3686 body for GIMPLE_TRY GS. */
3688 static inline void
3689 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3691 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3692 try_stmt->cleanup = cleanup;
3696 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3698 static inline gimple_seq *
3699 gimple_wce_cleanup_ptr (gimple gs)
3701 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3702 return &wce_stmt->cleanup;
3706 /* Return the cleanup sequence for cleanup statement GS. */
3708 static inline gimple_seq
3709 gimple_wce_cleanup (gimple gs)
3711 return *gimple_wce_cleanup_ptr (gs);
3715 /* Set CLEANUP to be the cleanup sequence for GS. */
3717 static inline void
3718 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3720 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3721 wce_stmt->cleanup = cleanup;
3725 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3727 static inline bool
3728 gimple_wce_cleanup_eh_only (const_gimple gs)
3730 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3731 return gs->subcode != 0;
3735 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3737 static inline void
3738 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3740 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3741 gs->subcode = (unsigned int) eh_only_p;
3745 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3747 static inline unsigned
3748 gimple_phi_capacity (const_gimple gs)
3750 const gimple_statement_phi *phi_stmt =
3751 as_a <const gimple_statement_phi> (gs);
3752 return phi_stmt->capacity;
3756 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3757 be exactly the number of incoming edges for the basic block holding
3758 GS. */
3760 static inline unsigned
3761 gimple_phi_num_args (const_gimple gs)
3763 const gimple_statement_phi *phi_stmt =
3764 as_a <const gimple_statement_phi> (gs);
3765 return phi_stmt->nargs;
3769 /* Return the SSA name created by GIMPLE_PHI GS. */
3771 static inline tree
3772 gimple_phi_result (const_gimple gs)
3774 const gimple_statement_phi *phi_stmt =
3775 as_a <const gimple_statement_phi> (gs);
3776 return phi_stmt->result;
3779 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3781 static inline tree *
3782 gimple_phi_result_ptr (gimple gs)
3784 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3785 return &phi_stmt->result;
3788 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3790 static inline void
3791 gimple_phi_set_result (gimple gs, tree result)
3793 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3794 phi_stmt->result = result;
3795 if (result && TREE_CODE (result) == SSA_NAME)
3796 SSA_NAME_DEF_STMT (result) = gs;
3800 /* Return the PHI argument corresponding to incoming edge INDEX for
3801 GIMPLE_PHI GS. */
3803 static inline struct phi_arg_d *
3804 gimple_phi_arg (gimple gs, unsigned index)
3806 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3807 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3808 return &(phi_stmt->args[index]);
3811 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3812 for GIMPLE_PHI GS. */
3814 static inline void
3815 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3817 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3818 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3819 phi_stmt->args[index] = *phiarg;
3822 /* Return the PHI nodes for basic block BB, or NULL if there are no
3823 PHI nodes. */
3825 static inline gimple_seq
3826 phi_nodes (const_basic_block bb)
3828 gcc_checking_assert (!(bb->flags & BB_RTL));
3829 return bb->il.gimple.phi_nodes;
3832 /* Return a pointer to the PHI nodes for basic block BB. */
3834 static inline gimple_seq *
3835 phi_nodes_ptr (basic_block bb)
3837 gcc_checking_assert (!(bb->flags & BB_RTL));
3838 return &bb->il.gimple.phi_nodes;
3841 /* Return the tree operand for argument I of PHI node GS. */
3843 static inline tree
3844 gimple_phi_arg_def (gimple gs, size_t index)
3846 return gimple_phi_arg (gs, index)->def;
3850 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3852 static inline tree *
3853 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3855 return &gimple_phi_arg (gs, index)->def;
3858 /* Return the edge associated with argument I of phi node GS. */
3860 static inline edge
3861 gimple_phi_arg_edge (gimple gs, size_t i)
3863 return EDGE_PRED (gimple_bb (gs), i);
3866 /* Return the source location of gimple argument I of phi node GS. */
3868 static inline source_location
3869 gimple_phi_arg_location (gimple gs, size_t i)
3871 return gimple_phi_arg (gs, i)->locus;
3874 /* Return the source location of the argument on edge E of phi node GS. */
3876 static inline source_location
3877 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3879 return gimple_phi_arg (gs, e->dest_idx)->locus;
3882 /* Set the source location of gimple argument I of phi node GS to LOC. */
3884 static inline void
3885 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3887 gimple_phi_arg (gs, i)->locus = loc;
3890 /* Return TRUE if argument I of phi node GS has a location record. */
3892 static inline bool
3893 gimple_phi_arg_has_location (gimple gs, size_t i)
3895 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3899 /* Return the region number for GIMPLE_RESX GS. */
3901 static inline int
3902 gimple_resx_region (const_gimple gs)
3904 const gimple_statement_resx *resx_stmt =
3905 as_a <const gimple_statement_resx> (gs);
3906 return resx_stmt->region;
3909 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3911 static inline void
3912 gimple_resx_set_region (gimple gs, int region)
3914 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx> (gs);
3915 resx_stmt->region = region;
3918 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3920 static inline int
3921 gimple_eh_dispatch_region (const_gimple gs)
3923 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3924 as_a <const gimple_statement_eh_dispatch> (gs);
3925 return eh_dispatch_stmt->region;
3928 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3930 static inline void
3931 gimple_eh_dispatch_set_region (gimple gs, int region)
3933 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3934 as_a <gimple_statement_eh_dispatch> (gs);
3935 eh_dispatch_stmt->region = region;
3938 /* Return the number of labels associated with the switch statement GS. */
3940 static inline unsigned
3941 gimple_switch_num_labels (const_gimple gs)
3943 unsigned num_ops;
3944 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3945 num_ops = gimple_num_ops (gs);
3946 gcc_gimple_checking_assert (num_ops > 1);
3947 return num_ops - 1;
3951 /* Set NLABELS to be the number of labels for the switch statement GS. */
3953 static inline void
3954 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3956 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3957 gimple_set_num_ops (g, nlabels + 1);
3961 /* Return the index variable used by the switch statement GS. */
3963 static inline tree
3964 gimple_switch_index (const_gimple gs)
3966 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3967 return gimple_op (gs, 0);
3971 /* Return a pointer to the index variable for the switch statement GS. */
3973 static inline tree *
3974 gimple_switch_index_ptr (const_gimple gs)
3976 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3977 return gimple_op_ptr (gs, 0);
3981 /* Set INDEX to be the index variable for switch statement GS. */
3983 static inline void
3984 gimple_switch_set_index (gimple gs, tree index)
3986 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3987 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3988 gimple_set_op (gs, 0, index);
3992 /* Return the label numbered INDEX. The default label is 0, followed by any
3993 labels in a switch statement. */
3995 static inline tree
3996 gimple_switch_label (const_gimple gs, unsigned index)
3998 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3999 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4000 return gimple_op (gs, index + 1);
4003 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4005 static inline void
4006 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4008 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4009 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4010 && (label == NULL_TREE
4011 || TREE_CODE (label) == CASE_LABEL_EXPR));
4012 gimple_set_op (gs, index + 1, label);
4015 /* Return the default label for a switch statement. */
4017 static inline tree
4018 gimple_switch_default_label (const_gimple gs)
4020 tree label = gimple_switch_label (gs, 0);
4021 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4022 return label;
4025 /* Set the default label for a switch statement. */
4027 static inline void
4028 gimple_switch_set_default_label (gimple gs, tree label)
4030 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4031 gimple_switch_set_label (gs, 0, label);
4034 /* Return true if GS is a GIMPLE_DEBUG statement. */
4036 static inline bool
4037 is_gimple_debug (const_gimple gs)
4039 return gimple_code (gs) == GIMPLE_DEBUG;
4042 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4044 static inline bool
4045 gimple_debug_bind_p (const_gimple s)
4047 if (is_gimple_debug (s))
4048 return s->subcode == GIMPLE_DEBUG_BIND;
4050 return false;
4053 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4055 static inline tree
4056 gimple_debug_bind_get_var (gimple dbg)
4058 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4059 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4060 return gimple_op (dbg, 0);
4063 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4064 statement. */
4066 static inline tree
4067 gimple_debug_bind_get_value (gimple dbg)
4069 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4070 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4071 return gimple_op (dbg, 1);
4074 /* Return a pointer to the value bound to the variable in a
4075 GIMPLE_DEBUG bind statement. */
4077 static inline tree *
4078 gimple_debug_bind_get_value_ptr (gimple dbg)
4080 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4081 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4082 return gimple_op_ptr (dbg, 1);
4085 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4087 static inline void
4088 gimple_debug_bind_set_var (gimple dbg, tree var)
4090 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4091 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4092 gimple_set_op (dbg, 0, var);
4095 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4096 statement. */
4098 static inline void
4099 gimple_debug_bind_set_value (gimple dbg, tree value)
4101 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4102 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4103 gimple_set_op (dbg, 1, value);
4106 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4107 optimized away. */
4108 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4110 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4111 statement. */
4113 static inline void
4114 gimple_debug_bind_reset_value (gimple dbg)
4116 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4117 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4118 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4121 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4122 value. */
4124 static inline bool
4125 gimple_debug_bind_has_value_p (gimple dbg)
4127 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4128 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4129 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4132 #undef GIMPLE_DEBUG_BIND_NOVALUE
4134 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4136 static inline bool
4137 gimple_debug_source_bind_p (const_gimple s)
4139 if (is_gimple_debug (s))
4140 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4142 return false;
4145 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4147 static inline tree
4148 gimple_debug_source_bind_get_var (gimple dbg)
4150 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4151 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4152 return gimple_op (dbg, 0);
4155 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4156 statement. */
4158 static inline tree
4159 gimple_debug_source_bind_get_value (gimple dbg)
4161 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4162 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4163 return gimple_op (dbg, 1);
4166 /* Return a pointer to the value bound to the variable in a
4167 GIMPLE_DEBUG source bind statement. */
4169 static inline tree *
4170 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4172 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4173 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4174 return gimple_op_ptr (dbg, 1);
4177 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4179 static inline void
4180 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4182 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4183 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4184 gimple_set_op (dbg, 0, var);
4187 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4188 statement. */
4190 static inline void
4191 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4193 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4194 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4195 gimple_set_op (dbg, 1, value);
4198 /* Return the line number for EXPR, or return -1 if we have no line
4199 number information for it. */
4200 static inline int
4201 get_lineno (const_gimple stmt)
4203 location_t loc;
4205 if (!stmt)
4206 return -1;
4208 loc = gimple_location (stmt);
4209 if (loc == UNKNOWN_LOCATION)
4210 return -1;
4212 return LOCATION_LINE (loc);
4215 /* Return a pointer to the body for the OMP statement GS. */
4217 static inline gimple_seq *
4218 gimple_omp_body_ptr (gimple gs)
4220 return &static_cast <gimple_statement_omp *> (gs)->body;
4223 /* Return the body for the OMP statement GS. */
4225 static inline gimple_seq
4226 gimple_omp_body (gimple gs)
4228 return *gimple_omp_body_ptr (gs);
4231 /* Set BODY to be the body for the OMP statement GS. */
4233 static inline void
4234 gimple_omp_set_body (gimple gs, gimple_seq body)
4236 static_cast <gimple_statement_omp *> (gs)->body = body;
4240 /* Return the name associated with OMP_CRITICAL statement GS. */
4242 static inline tree
4243 gimple_omp_critical_name (const_gimple gs)
4245 const gimple_statement_omp_critical *omp_critical_stmt =
4246 as_a <const gimple_statement_omp_critical> (gs);
4247 return omp_critical_stmt->name;
4251 /* Return a pointer to the name associated with OMP critical statement GS. */
4253 static inline tree *
4254 gimple_omp_critical_name_ptr (gimple gs)
4256 gimple_statement_omp_critical *omp_critical_stmt =
4257 as_a <gimple_statement_omp_critical> (gs);
4258 return &omp_critical_stmt->name;
4262 /* Set NAME to be the name associated with OMP critical statement GS. */
4264 static inline void
4265 gimple_omp_critical_set_name (gimple gs, tree name)
4267 gimple_statement_omp_critical *omp_critical_stmt =
4268 as_a <gimple_statement_omp_critical> (gs);
4269 omp_critical_stmt->name = name;
4273 /* Return the kind of OMP for statemement. */
4275 static inline int
4276 gimple_omp_for_kind (const_gimple g)
4278 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4279 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4283 /* Set the OMP for kind. */
4285 static inline void
4286 gimple_omp_for_set_kind (gimple g, int kind)
4288 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4289 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4290 | (kind & GF_OMP_FOR_KIND_MASK);
4294 /* Return true if OMP for statement G has the
4295 GF_OMP_FOR_COMBINED flag set. */
4297 static inline bool
4298 gimple_omp_for_combined_p (const_gimple g)
4300 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4301 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4305 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4306 value of COMBINED_P. */
4308 static inline void
4309 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4311 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4312 if (combined_p)
4313 g->subcode |= GF_OMP_FOR_COMBINED;
4314 else
4315 g->subcode &= ~GF_OMP_FOR_COMBINED;
4319 /* Return true if OMP for statement G has the
4320 GF_OMP_FOR_COMBINED_INTO flag set. */
4322 static inline bool
4323 gimple_omp_for_combined_into_p (const_gimple g)
4325 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4326 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4330 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4331 value of COMBINED_P. */
4333 static inline void
4334 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4336 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4337 if (combined_p)
4338 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4339 else
4340 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4344 /* Return the clauses associated with OMP_FOR GS. */
4346 static inline tree
4347 gimple_omp_for_clauses (const_gimple gs)
4349 const gimple_statement_omp_for *omp_for_stmt =
4350 as_a <const gimple_statement_omp_for> (gs);
4351 return omp_for_stmt->clauses;
4355 /* Return a pointer to the OMP_FOR GS. */
4357 static inline tree *
4358 gimple_omp_for_clauses_ptr (gimple gs)
4360 gimple_statement_omp_for *omp_for_stmt =
4361 as_a <gimple_statement_omp_for> (gs);
4362 return &omp_for_stmt->clauses;
4366 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4368 static inline void
4369 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4371 gimple_statement_omp_for *omp_for_stmt =
4372 as_a <gimple_statement_omp_for> (gs);
4373 omp_for_stmt->clauses = clauses;
4377 /* Get the collapse count of OMP_FOR GS. */
4379 static inline size_t
4380 gimple_omp_for_collapse (gimple gs)
4382 gimple_statement_omp_for *omp_for_stmt =
4383 as_a <gimple_statement_omp_for> (gs);
4384 return omp_for_stmt->collapse;
4388 /* Return the index variable for OMP_FOR GS. */
4390 static inline tree
4391 gimple_omp_for_index (const_gimple gs, size_t i)
4393 const gimple_statement_omp_for *omp_for_stmt =
4394 as_a <const gimple_statement_omp_for> (gs);
4395 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4396 return omp_for_stmt->iter[i].index;
4400 /* Return a pointer to the index variable for OMP_FOR GS. */
4402 static inline tree *
4403 gimple_omp_for_index_ptr (gimple gs, size_t i)
4405 gimple_statement_omp_for *omp_for_stmt =
4406 as_a <gimple_statement_omp_for> (gs);
4407 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4408 return &omp_for_stmt->iter[i].index;
4412 /* Set INDEX to be the index variable for OMP_FOR GS. */
4414 static inline void
4415 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4417 gimple_statement_omp_for *omp_for_stmt =
4418 as_a <gimple_statement_omp_for> (gs);
4419 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4420 omp_for_stmt->iter[i].index = index;
4424 /* Return the initial value for OMP_FOR GS. */
4426 static inline tree
4427 gimple_omp_for_initial (const_gimple gs, size_t i)
4429 const gimple_statement_omp_for *omp_for_stmt =
4430 as_a <const gimple_statement_omp_for> (gs);
4431 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4432 return omp_for_stmt->iter[i].initial;
4436 /* Return a pointer to the initial value for OMP_FOR GS. */
4438 static inline tree *
4439 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4441 gimple_statement_omp_for *omp_for_stmt =
4442 as_a <gimple_statement_omp_for> (gs);
4443 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4444 return &omp_for_stmt->iter[i].initial;
4448 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4450 static inline void
4451 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4453 gimple_statement_omp_for *omp_for_stmt =
4454 as_a <gimple_statement_omp_for> (gs);
4455 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4456 omp_for_stmt->iter[i].initial = initial;
4460 /* Return the final value for OMP_FOR GS. */
4462 static inline tree
4463 gimple_omp_for_final (const_gimple gs, size_t i)
4465 const gimple_statement_omp_for *omp_for_stmt =
4466 as_a <const gimple_statement_omp_for> (gs);
4467 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4468 return omp_for_stmt->iter[i].final;
4472 /* Return a pointer to the final value for OMP_FOR GS. */
4474 static inline tree *
4475 gimple_omp_for_final_ptr (gimple gs, size_t i)
4477 gimple_statement_omp_for *omp_for_stmt =
4478 as_a <gimple_statement_omp_for> (gs);
4479 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4480 return &omp_for_stmt->iter[i].final;
4484 /* Set FINAL to be the final value for OMP_FOR GS. */
4486 static inline void
4487 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4489 gimple_statement_omp_for *omp_for_stmt =
4490 as_a <gimple_statement_omp_for> (gs);
4491 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4492 omp_for_stmt->iter[i].final = final;
4496 /* Return the increment value for OMP_FOR GS. */
4498 static inline tree
4499 gimple_omp_for_incr (const_gimple gs, size_t i)
4501 const gimple_statement_omp_for *omp_for_stmt =
4502 as_a <const gimple_statement_omp_for> (gs);
4503 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4504 return omp_for_stmt->iter[i].incr;
4508 /* Return a pointer to the increment value for OMP_FOR GS. */
4510 static inline tree *
4511 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4513 gimple_statement_omp_for *omp_for_stmt =
4514 as_a <gimple_statement_omp_for> (gs);
4515 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4516 return &omp_for_stmt->iter[i].incr;
4520 /* Set INCR to be the increment value for OMP_FOR GS. */
4522 static inline void
4523 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4525 gimple_statement_omp_for *omp_for_stmt =
4526 as_a <gimple_statement_omp_for> (gs);
4527 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4528 omp_for_stmt->iter[i].incr = incr;
4532 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4533 statement GS starts. */
4535 static inline gimple_seq *
4536 gimple_omp_for_pre_body_ptr (gimple gs)
4538 gimple_statement_omp_for *omp_for_stmt =
4539 as_a <gimple_statement_omp_for> (gs);
4540 return &omp_for_stmt->pre_body;
4544 /* Return the sequence of statements to execute before the OMP_FOR
4545 statement GS starts. */
4547 static inline gimple_seq
4548 gimple_omp_for_pre_body (gimple gs)
4550 return *gimple_omp_for_pre_body_ptr (gs);
4554 /* Set PRE_BODY to be the sequence of statements to execute before the
4555 OMP_FOR statement GS starts. */
4557 static inline void
4558 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4560 gimple_statement_omp_for *omp_for_stmt =
4561 as_a <gimple_statement_omp_for> (gs);
4562 omp_for_stmt->pre_body = pre_body;
4566 /* Return the clauses associated with OMP_PARALLEL GS. */
4568 static inline tree
4569 gimple_omp_parallel_clauses (const_gimple gs)
4571 const gimple_statement_omp_parallel *omp_parallel_stmt =
4572 as_a <const gimple_statement_omp_parallel> (gs);
4573 return omp_parallel_stmt->clauses;
4577 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4579 static inline tree *
4580 gimple_omp_parallel_clauses_ptr (gimple gs)
4582 gimple_statement_omp_parallel *omp_parallel_stmt =
4583 as_a <gimple_statement_omp_parallel> (gs);
4584 return &omp_parallel_stmt->clauses;
4588 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4589 GS. */
4591 static inline void
4592 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4594 gimple_statement_omp_parallel *omp_parallel_stmt =
4595 as_a <gimple_statement_omp_parallel> (gs);
4596 omp_parallel_stmt->clauses = clauses;
4600 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4602 static inline tree
4603 gimple_omp_parallel_child_fn (const_gimple gs)
4605 const gimple_statement_omp_parallel *omp_parallel_stmt =
4606 as_a <const gimple_statement_omp_parallel> (gs);
4607 return omp_parallel_stmt->child_fn;
4610 /* Return a pointer to the child function used to hold the body of
4611 OMP_PARALLEL GS. */
4613 static inline tree *
4614 gimple_omp_parallel_child_fn_ptr (gimple gs)
4616 gimple_statement_omp_parallel *omp_parallel_stmt =
4617 as_a <gimple_statement_omp_parallel> (gs);
4618 return &omp_parallel_stmt->child_fn;
4622 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4624 static inline void
4625 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4627 gimple_statement_omp_parallel *omp_parallel_stmt =
4628 as_a <gimple_statement_omp_parallel> (gs);
4629 omp_parallel_stmt->child_fn = child_fn;
4633 /* Return the artificial argument used to send variables and values
4634 from the parent to the children threads in OMP_PARALLEL GS. */
4636 static inline tree
4637 gimple_omp_parallel_data_arg (const_gimple gs)
4639 const gimple_statement_omp_parallel *omp_parallel_stmt =
4640 as_a <const gimple_statement_omp_parallel> (gs);
4641 return omp_parallel_stmt->data_arg;
4645 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4647 static inline tree *
4648 gimple_omp_parallel_data_arg_ptr (gimple gs)
4650 gimple_statement_omp_parallel *omp_parallel_stmt =
4651 as_a <gimple_statement_omp_parallel> (gs);
4652 return &omp_parallel_stmt->data_arg;
4656 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4658 static inline void
4659 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4661 gimple_statement_omp_parallel *omp_parallel_stmt =
4662 as_a <gimple_statement_omp_parallel> (gs);
4663 omp_parallel_stmt->data_arg = data_arg;
4667 /* Return the clauses associated with OMP_TASK GS. */
4669 static inline tree
4670 gimple_omp_task_clauses (const_gimple gs)
4672 const gimple_statement_omp_task *omp_task_stmt =
4673 as_a <const gimple_statement_omp_task> (gs);
4674 return omp_task_stmt->clauses;
4678 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4680 static inline tree *
4681 gimple_omp_task_clauses_ptr (gimple gs)
4683 gimple_statement_omp_task *omp_task_stmt =
4684 as_a <gimple_statement_omp_task> (gs);
4685 return &omp_task_stmt->clauses;
4689 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4690 GS. */
4692 static inline void
4693 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4695 gimple_statement_omp_task *omp_task_stmt =
4696 as_a <gimple_statement_omp_task> (gs);
4697 omp_task_stmt->clauses = clauses;
4701 /* Return the child function used to hold the body of OMP_TASK GS. */
4703 static inline tree
4704 gimple_omp_task_child_fn (const_gimple gs)
4706 const gimple_statement_omp_task *omp_task_stmt =
4707 as_a <const gimple_statement_omp_task> (gs);
4708 return omp_task_stmt->child_fn;
4711 /* Return a pointer to the child function used to hold the body of
4712 OMP_TASK GS. */
4714 static inline tree *
4715 gimple_omp_task_child_fn_ptr (gimple gs)
4717 gimple_statement_omp_task *omp_task_stmt =
4718 as_a <gimple_statement_omp_task> (gs);
4719 return &omp_task_stmt->child_fn;
4723 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4725 static inline void
4726 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4728 gimple_statement_omp_task *omp_task_stmt =
4729 as_a <gimple_statement_omp_task> (gs);
4730 omp_task_stmt->child_fn = child_fn;
4734 /* Return the artificial argument used to send variables and values
4735 from the parent to the children threads in OMP_TASK GS. */
4737 static inline tree
4738 gimple_omp_task_data_arg (const_gimple gs)
4740 const gimple_statement_omp_task *omp_task_stmt =
4741 as_a <const gimple_statement_omp_task> (gs);
4742 return omp_task_stmt->data_arg;
4746 /* Return a pointer to the data argument for OMP_TASK GS. */
4748 static inline tree *
4749 gimple_omp_task_data_arg_ptr (gimple gs)
4751 gimple_statement_omp_task *omp_task_stmt =
4752 as_a <gimple_statement_omp_task> (gs);
4753 return &omp_task_stmt->data_arg;
4757 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4759 static inline void
4760 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4762 gimple_statement_omp_task *omp_task_stmt =
4763 as_a <gimple_statement_omp_task> (gs);
4764 omp_task_stmt->data_arg = data_arg;
4768 /* Return the clauses associated with OMP_TASK GS. */
4770 static inline tree
4771 gimple_omp_taskreg_clauses (const_gimple gs)
4773 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4774 as_a <const gimple_statement_omp_taskreg> (gs);
4775 return omp_taskreg_stmt->clauses;
4779 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4781 static inline tree *
4782 gimple_omp_taskreg_clauses_ptr (gimple gs)
4784 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4785 as_a <gimple_statement_omp_taskreg> (gs);
4786 return &omp_taskreg_stmt->clauses;
4790 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4791 GS. */
4793 static inline void
4794 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4796 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4797 as_a <gimple_statement_omp_taskreg> (gs);
4798 omp_taskreg_stmt->clauses = clauses;
4802 /* Return the child function used to hold the body of OMP_TASK GS. */
4804 static inline tree
4805 gimple_omp_taskreg_child_fn (const_gimple gs)
4807 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4808 as_a <const gimple_statement_omp_taskreg> (gs);
4809 return omp_taskreg_stmt->child_fn;
4812 /* Return a pointer to the child function used to hold the body of
4813 OMP_TASK GS. */
4815 static inline tree *
4816 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4818 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4819 as_a <gimple_statement_omp_taskreg> (gs);
4820 return &omp_taskreg_stmt->child_fn;
4824 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4826 static inline void
4827 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4829 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4830 as_a <gimple_statement_omp_taskreg> (gs);
4831 omp_taskreg_stmt->child_fn = child_fn;
4835 /* Return the artificial argument used to send variables and values
4836 from the parent to the children threads in OMP_TASK GS. */
4838 static inline tree
4839 gimple_omp_taskreg_data_arg (const_gimple gs)
4841 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4842 as_a <const gimple_statement_omp_taskreg> (gs);
4843 return omp_taskreg_stmt->data_arg;
4847 /* Return a pointer to the data argument for OMP_TASK GS. */
4849 static inline tree *
4850 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4852 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4853 as_a <gimple_statement_omp_taskreg> (gs);
4854 return &omp_taskreg_stmt->data_arg;
4858 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4860 static inline void
4861 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4863 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4864 as_a <gimple_statement_omp_taskreg> (gs);
4865 omp_taskreg_stmt->data_arg = data_arg;
4869 /* Return the copy function used to hold the body of OMP_TASK GS. */
4871 static inline tree
4872 gimple_omp_task_copy_fn (const_gimple gs)
4874 const gimple_statement_omp_task *omp_task_stmt =
4875 as_a <const gimple_statement_omp_task> (gs);
4876 return omp_task_stmt->copy_fn;
4879 /* Return a pointer to the copy function used to hold the body of
4880 OMP_TASK GS. */
4882 static inline tree *
4883 gimple_omp_task_copy_fn_ptr (gimple gs)
4885 gimple_statement_omp_task *omp_task_stmt =
4886 as_a <gimple_statement_omp_task> (gs);
4887 return &omp_task_stmt->copy_fn;
4891 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4893 static inline void
4894 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4896 gimple_statement_omp_task *omp_task_stmt =
4897 as_a <gimple_statement_omp_task> (gs);
4898 omp_task_stmt->copy_fn = copy_fn;
4902 /* Return size of the data block in bytes in OMP_TASK GS. */
4904 static inline tree
4905 gimple_omp_task_arg_size (const_gimple gs)
4907 const gimple_statement_omp_task *omp_task_stmt =
4908 as_a <const gimple_statement_omp_task> (gs);
4909 return omp_task_stmt->arg_size;
4913 /* Return a pointer to the data block size for OMP_TASK GS. */
4915 static inline tree *
4916 gimple_omp_task_arg_size_ptr (gimple gs)
4918 gimple_statement_omp_task *omp_task_stmt =
4919 as_a <gimple_statement_omp_task> (gs);
4920 return &omp_task_stmt->arg_size;
4924 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4926 static inline void
4927 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4929 gimple_statement_omp_task *omp_task_stmt =
4930 as_a <gimple_statement_omp_task> (gs);
4931 omp_task_stmt->arg_size = arg_size;
4935 /* Return align of the data block in bytes in OMP_TASK GS. */
4937 static inline tree
4938 gimple_omp_task_arg_align (const_gimple gs)
4940 const gimple_statement_omp_task *omp_task_stmt =
4941 as_a <const gimple_statement_omp_task> (gs);
4942 return omp_task_stmt->arg_align;
4946 /* Return a pointer to the data block align for OMP_TASK GS. */
4948 static inline tree *
4949 gimple_omp_task_arg_align_ptr (gimple gs)
4951 gimple_statement_omp_task *omp_task_stmt =
4952 as_a <gimple_statement_omp_task> (gs);
4953 return &omp_task_stmt->arg_align;
4957 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4959 static inline void
4960 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4962 gimple_statement_omp_task *omp_task_stmt =
4963 as_a <gimple_statement_omp_task> (gs);
4964 omp_task_stmt->arg_align = arg_align;
4968 /* Return the clauses associated with OMP_SINGLE GS. */
4970 static inline tree
4971 gimple_omp_single_clauses (const_gimple gs)
4973 const gimple_statement_omp_single *omp_single_stmt =
4974 as_a <const gimple_statement_omp_single> (gs);
4975 return omp_single_stmt->clauses;
4979 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4981 static inline tree *
4982 gimple_omp_single_clauses_ptr (gimple gs)
4984 gimple_statement_omp_single *omp_single_stmt =
4985 as_a <gimple_statement_omp_single> (gs);
4986 return &omp_single_stmt->clauses;
4990 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4992 static inline void
4993 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4995 gimple_statement_omp_single *omp_single_stmt =
4996 as_a <gimple_statement_omp_single> (gs);
4997 omp_single_stmt->clauses = clauses;
5001 /* Return the clauses associated with OMP_TARGET GS. */
5003 static inline tree
5004 gimple_omp_target_clauses (const_gimple gs)
5006 const gimple_statement_omp_target *omp_target_stmt =
5007 as_a <const gimple_statement_omp_target> (gs);
5008 return omp_target_stmt->clauses;
5012 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5014 static inline tree *
5015 gimple_omp_target_clauses_ptr (gimple gs)
5017 gimple_statement_omp_target *omp_target_stmt =
5018 as_a <gimple_statement_omp_target> (gs);
5019 return &omp_target_stmt->clauses;
5023 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5025 static inline void
5026 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5028 gimple_statement_omp_target *omp_target_stmt =
5029 as_a <gimple_statement_omp_target> (gs);
5030 omp_target_stmt->clauses = clauses;
5034 /* Return the kind of OMP target statemement. */
5036 static inline int
5037 gimple_omp_target_kind (const_gimple g)
5039 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5040 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5044 /* Set the OMP target kind. */
5046 static inline void
5047 gimple_omp_target_set_kind (gimple g, int kind)
5049 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5050 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5051 | (kind & GF_OMP_TARGET_KIND_MASK);
5055 /* Return the child function used to hold the body of OMP_TARGET GS. */
5057 static inline tree
5058 gimple_omp_target_child_fn (const_gimple gs)
5060 const gimple_statement_omp_target *omp_target_stmt =
5061 as_a <const gimple_statement_omp_target> (gs);
5062 return omp_target_stmt->child_fn;
5065 /* Return a pointer to the child function used to hold the body of
5066 OMP_TARGET GS. */
5068 static inline tree *
5069 gimple_omp_target_child_fn_ptr (gimple gs)
5071 gimple_statement_omp_target *omp_target_stmt =
5072 as_a <gimple_statement_omp_target> (gs);
5073 return &omp_target_stmt->child_fn;
5077 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5079 static inline void
5080 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5082 gimple_statement_omp_target *omp_target_stmt =
5083 as_a <gimple_statement_omp_target> (gs);
5084 omp_target_stmt->child_fn = child_fn;
5088 /* Return the artificial argument used to send variables and values
5089 from the parent to the children threads in OMP_TARGET GS. */
5091 static inline tree
5092 gimple_omp_target_data_arg (const_gimple gs)
5094 const gimple_statement_omp_target *omp_target_stmt =
5095 as_a <const gimple_statement_omp_target> (gs);
5096 return omp_target_stmt->data_arg;
5100 /* Return a pointer to the data argument for OMP_TARGET GS. */
5102 static inline tree *
5103 gimple_omp_target_data_arg_ptr (gimple gs)
5105 gimple_statement_omp_target *omp_target_stmt =
5106 as_a <gimple_statement_omp_target> (gs);
5107 return &omp_target_stmt->data_arg;
5111 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5113 static inline void
5114 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5116 gimple_statement_omp_target *omp_target_stmt =
5117 as_a <gimple_statement_omp_target> (gs);
5118 omp_target_stmt->data_arg = data_arg;
5122 /* Return the clauses associated with OMP_TEAMS GS. */
5124 static inline tree
5125 gimple_omp_teams_clauses (const_gimple gs)
5127 const gimple_statement_omp_teams *omp_teams_stmt =
5128 as_a <const gimple_statement_omp_teams> (gs);
5129 return omp_teams_stmt->clauses;
5133 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5135 static inline tree *
5136 gimple_omp_teams_clauses_ptr (gimple gs)
5138 gimple_statement_omp_teams *omp_teams_stmt =
5139 as_a <gimple_statement_omp_teams> (gs);
5140 return &omp_teams_stmt->clauses;
5144 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5146 static inline void
5147 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5149 gimple_statement_omp_teams *omp_teams_stmt =
5150 as_a <gimple_statement_omp_teams> (gs);
5151 omp_teams_stmt->clauses = clauses;
5155 /* Return the clauses associated with OMP_SECTIONS GS. */
5157 static inline tree
5158 gimple_omp_sections_clauses (const_gimple gs)
5160 const gimple_statement_omp_sections *omp_sections_stmt =
5161 as_a <const gimple_statement_omp_sections> (gs);
5162 return omp_sections_stmt->clauses;
5166 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5168 static inline tree *
5169 gimple_omp_sections_clauses_ptr (gimple gs)
5171 gimple_statement_omp_sections *omp_sections_stmt =
5172 as_a <gimple_statement_omp_sections> (gs);
5173 return &omp_sections_stmt->clauses;
5177 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5178 GS. */
5180 static inline void
5181 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5183 gimple_statement_omp_sections *omp_sections_stmt =
5184 as_a <gimple_statement_omp_sections> (gs);
5185 omp_sections_stmt->clauses = clauses;
5189 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5190 in GS. */
5192 static inline tree
5193 gimple_omp_sections_control (const_gimple gs)
5195 const gimple_statement_omp_sections *omp_sections_stmt =
5196 as_a <const gimple_statement_omp_sections> (gs);
5197 return omp_sections_stmt->control;
5201 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5202 GS. */
5204 static inline tree *
5205 gimple_omp_sections_control_ptr (gimple gs)
5207 gimple_statement_omp_sections *omp_sections_stmt =
5208 as_a <gimple_statement_omp_sections> (gs);
5209 return &omp_sections_stmt->control;
5213 /* Set CONTROL to be the set of clauses associated with the
5214 GIMPLE_OMP_SECTIONS in GS. */
5216 static inline void
5217 gimple_omp_sections_set_control (gimple gs, tree control)
5219 gimple_statement_omp_sections *omp_sections_stmt =
5220 as_a <gimple_statement_omp_sections> (gs);
5221 omp_sections_stmt->control = control;
5225 /* Set COND to be the condition code for OMP_FOR GS. */
5227 static inline void
5228 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5230 gimple_statement_omp_for *omp_for_stmt =
5231 as_a <gimple_statement_omp_for> (gs);
5232 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5233 && i < omp_for_stmt->collapse);
5234 omp_for_stmt->iter[i].cond = cond;
5238 /* Return the condition code associated with OMP_FOR GS. */
5240 static inline enum tree_code
5241 gimple_omp_for_cond (const_gimple gs, size_t i)
5243 const gimple_statement_omp_for *omp_for_stmt =
5244 as_a <const gimple_statement_omp_for> (gs);
5245 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5246 return omp_for_stmt->iter[i].cond;
5250 /* Set the value being stored in an atomic store. */
5252 static inline void
5253 gimple_omp_atomic_store_set_val (gimple g, tree val)
5255 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5256 as_a <gimple_statement_omp_atomic_store> (g);
5257 omp_atomic_store_stmt->val = val;
5261 /* Return the value being stored in an atomic store. */
5263 static inline tree
5264 gimple_omp_atomic_store_val (const_gimple g)
5266 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5267 as_a <const gimple_statement_omp_atomic_store> (g);
5268 return omp_atomic_store_stmt->val;
5272 /* Return a pointer to the value being stored in an atomic store. */
5274 static inline tree *
5275 gimple_omp_atomic_store_val_ptr (gimple g)
5277 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5278 as_a <gimple_statement_omp_atomic_store> (g);
5279 return &omp_atomic_store_stmt->val;
5283 /* Set the LHS of an atomic load. */
5285 static inline void
5286 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5288 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5289 as_a <gimple_statement_omp_atomic_load> (g);
5290 omp_atomic_load_stmt->lhs = lhs;
5294 /* Get the LHS of an atomic load. */
5296 static inline tree
5297 gimple_omp_atomic_load_lhs (const_gimple g)
5299 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5300 as_a <const gimple_statement_omp_atomic_load> (g);
5301 return omp_atomic_load_stmt->lhs;
5305 /* Return a pointer to the LHS of an atomic load. */
5307 static inline tree *
5308 gimple_omp_atomic_load_lhs_ptr (gimple g)
5310 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5311 as_a <gimple_statement_omp_atomic_load> (g);
5312 return &omp_atomic_load_stmt->lhs;
5316 /* Set the RHS of an atomic load. */
5318 static inline void
5319 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5321 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5322 as_a <gimple_statement_omp_atomic_load> (g);
5323 omp_atomic_load_stmt->rhs = rhs;
5327 /* Get the RHS of an atomic load. */
5329 static inline tree
5330 gimple_omp_atomic_load_rhs (const_gimple g)
5332 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5333 as_a <const gimple_statement_omp_atomic_load> (g);
5334 return omp_atomic_load_stmt->rhs;
5338 /* Return a pointer to the RHS of an atomic load. */
5340 static inline tree *
5341 gimple_omp_atomic_load_rhs_ptr (gimple g)
5343 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5344 as_a <gimple_statement_omp_atomic_load> (g);
5345 return &omp_atomic_load_stmt->rhs;
5349 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5351 static inline tree
5352 gimple_omp_continue_control_def (const_gimple g)
5354 const gimple_statement_omp_continue *omp_continue_stmt =
5355 as_a <const gimple_statement_omp_continue> (g);
5356 return omp_continue_stmt->control_def;
5359 /* The same as above, but return the address. */
5361 static inline tree *
5362 gimple_omp_continue_control_def_ptr (gimple g)
5364 gimple_statement_omp_continue *omp_continue_stmt =
5365 as_a <gimple_statement_omp_continue> (g);
5366 return &omp_continue_stmt->control_def;
5369 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5371 static inline void
5372 gimple_omp_continue_set_control_def (gimple g, tree def)
5374 gimple_statement_omp_continue *omp_continue_stmt =
5375 as_a <gimple_statement_omp_continue> (g);
5376 omp_continue_stmt->control_def = def;
5380 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5382 static inline tree
5383 gimple_omp_continue_control_use (const_gimple g)
5385 const gimple_statement_omp_continue *omp_continue_stmt =
5386 as_a <const gimple_statement_omp_continue> (g);
5387 return omp_continue_stmt->control_use;
5391 /* The same as above, but return the address. */
5393 static inline tree *
5394 gimple_omp_continue_control_use_ptr (gimple g)
5396 gimple_statement_omp_continue *omp_continue_stmt =
5397 as_a <gimple_statement_omp_continue> (g);
5398 return &omp_continue_stmt->control_use;
5402 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5404 static inline void
5405 gimple_omp_continue_set_control_use (gimple g, tree use)
5407 gimple_statement_omp_continue *omp_continue_stmt =
5408 as_a <gimple_statement_omp_continue> (g);
5409 omp_continue_stmt->control_use = use;
5412 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5414 static inline gimple_seq *
5415 gimple_transaction_body_ptr (gimple gs)
5417 gimple_statement_transaction *transaction_stmt =
5418 as_a <gimple_statement_transaction> (gs);
5419 return &transaction_stmt->body;
5422 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5424 static inline gimple_seq
5425 gimple_transaction_body (gimple gs)
5427 return *gimple_transaction_body_ptr (gs);
5430 /* Return the label associated with a GIMPLE_TRANSACTION. */
5432 static inline tree
5433 gimple_transaction_label (const_gimple gs)
5435 const gimple_statement_transaction *transaction_stmt =
5436 as_a <const gimple_statement_transaction> (gs);
5437 return transaction_stmt->label;
5440 static inline tree *
5441 gimple_transaction_label_ptr (gimple gs)
5443 gimple_statement_transaction *transaction_stmt =
5444 as_a <gimple_statement_transaction> (gs);
5445 return &transaction_stmt->label;
5448 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5450 static inline unsigned int
5451 gimple_transaction_subcode (const_gimple gs)
5453 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5454 return gs->subcode;
5457 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5459 static inline void
5460 gimple_transaction_set_body (gimple gs, gimple_seq body)
5462 gimple_statement_transaction *transaction_stmt =
5463 as_a <gimple_statement_transaction> (gs);
5464 transaction_stmt->body = body;
5467 /* Set the label associated with a GIMPLE_TRANSACTION. */
5469 static inline void
5470 gimple_transaction_set_label (gimple gs, tree label)
5472 gimple_statement_transaction *transaction_stmt =
5473 as_a <gimple_statement_transaction> (gs);
5474 transaction_stmt->label = label;
5477 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5479 static inline void
5480 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5482 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5483 gs->subcode = subcode;
5487 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5489 static inline tree *
5490 gimple_return_retval_ptr (const_gimple gs)
5492 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5493 return gimple_op_ptr (gs, 0);
5496 /* Return the return value for GIMPLE_RETURN GS. */
5498 static inline tree
5499 gimple_return_retval (const_gimple gs)
5501 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5502 return gimple_op (gs, 0);
5506 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5508 static inline void
5509 gimple_return_set_retval (gimple gs, tree retval)
5511 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5512 gimple_set_op (gs, 0, retval);
5516 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5518 #define CASE_GIMPLE_OMP \
5519 case GIMPLE_OMP_PARALLEL: \
5520 case GIMPLE_OMP_TASK: \
5521 case GIMPLE_OMP_FOR: \
5522 case GIMPLE_OMP_SECTIONS: \
5523 case GIMPLE_OMP_SECTIONS_SWITCH: \
5524 case GIMPLE_OMP_SINGLE: \
5525 case GIMPLE_OMP_TARGET: \
5526 case GIMPLE_OMP_TEAMS: \
5527 case GIMPLE_OMP_SECTION: \
5528 case GIMPLE_OMP_MASTER: \
5529 case GIMPLE_OMP_TASKGROUP: \
5530 case GIMPLE_OMP_ORDERED: \
5531 case GIMPLE_OMP_CRITICAL: \
5532 case GIMPLE_OMP_RETURN: \
5533 case GIMPLE_OMP_ATOMIC_LOAD: \
5534 case GIMPLE_OMP_ATOMIC_STORE: \
5535 case GIMPLE_OMP_CONTINUE
5537 static inline bool
5538 is_gimple_omp (const_gimple stmt)
5540 switch (gimple_code (stmt))
5542 CASE_GIMPLE_OMP:
5543 return true;
5544 default:
5545 return false;
5550 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5552 static inline bool
5553 gimple_nop_p (const_gimple g)
5555 return gimple_code (g) == GIMPLE_NOP;
5559 /* Return true if GS is a GIMPLE_RESX. */
5561 static inline bool
5562 is_gimple_resx (const_gimple gs)
5564 return gimple_code (gs) == GIMPLE_RESX;
5567 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5569 static inline enum br_predictor
5570 gimple_predict_predictor (gimple gs)
5572 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5573 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5577 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5579 static inline void
5580 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5582 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5583 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5584 | (unsigned) predictor;
5588 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5590 static inline enum prediction
5591 gimple_predict_outcome (gimple gs)
5593 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5594 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5598 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5600 static inline void
5601 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5603 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5604 if (outcome == TAKEN)
5605 gs->subcode |= GF_PREDICT_TAKEN;
5606 else
5607 gs->subcode &= ~GF_PREDICT_TAKEN;
5611 /* Return the type of the main expression computed by STMT. Return
5612 void_type_node if the statement computes nothing. */
5614 static inline tree
5615 gimple_expr_type (const_gimple stmt)
5617 enum gimple_code code = gimple_code (stmt);
5619 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5621 tree type;
5622 /* In general we want to pass out a type that can be substituted
5623 for both the RHS and the LHS types if there is a possibly
5624 useless conversion involved. That means returning the
5625 original RHS type as far as we can reconstruct it. */
5626 if (code == GIMPLE_CALL)
5628 if (gimple_call_internal_p (stmt)
5629 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5630 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5631 else
5632 type = gimple_call_return_type (stmt);
5634 else
5635 switch (gimple_assign_rhs_code (stmt))
5637 case POINTER_PLUS_EXPR:
5638 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5639 break;
5641 default:
5642 /* As fallback use the type of the LHS. */
5643 type = TREE_TYPE (gimple_get_lhs (stmt));
5644 break;
5646 return type;
5648 else if (code == GIMPLE_COND)
5649 return boolean_type_node;
5650 else
5651 return void_type_node;
5654 /* Enum and arrays used for allocation stats. Keep in sync with
5655 gimple.c:gimple_alloc_kind_names. */
5656 enum gimple_alloc_kind
5658 gimple_alloc_kind_assign, /* Assignments. */
5659 gimple_alloc_kind_phi, /* PHI nodes. */
5660 gimple_alloc_kind_cond, /* Conditionals. */
5661 gimple_alloc_kind_rest, /* Everything else. */
5662 gimple_alloc_kind_all
5665 extern int gimple_alloc_counts[];
5666 extern int gimple_alloc_sizes[];
5668 /* Return the allocation kind for a given stmt CODE. */
5669 static inline enum gimple_alloc_kind
5670 gimple_alloc_kind (enum gimple_code code)
5672 switch (code)
5674 case GIMPLE_ASSIGN:
5675 return gimple_alloc_kind_assign;
5676 case GIMPLE_PHI:
5677 return gimple_alloc_kind_phi;
5678 case GIMPLE_COND:
5679 return gimple_alloc_kind_cond;
5680 default:
5681 return gimple_alloc_kind_rest;
5685 /* Return true if a location should not be emitted for this statement
5686 by annotate_all_with_location. */
5688 static inline bool
5689 gimple_do_not_emit_location_p (gimple g)
5691 return gimple_plf (g, GF_PLF_1);
5694 /* Mark statement G so a location will not be emitted by
5695 annotate_one_with_location. */
5697 static inline void
5698 gimple_set_do_not_emit_location (gimple g)
5700 /* The PLF flags are initialized to 0 when a new tuple is created,
5701 so no need to initialize it anywhere. */
5702 gimple_set_plf (g, GF_PLF_1, true);
5706 /* Macros for showing usage statistics. */
5707 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5708 ? (x) \
5709 : ((x) < 1024*1024*10 \
5710 ? (x) / 1024 \
5711 : (x) / (1024*1024))))
5713 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5715 #endif /* GCC_GIMPLE_H */