Mark ChangeLog
[official-gcc.git] / gcc / gimple.h
blob50a5a8620c3495e113d8f6a5be3a900963be93f3
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2014 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 typedef gimple gimple_seq_node;
27 /* For each block, the PHI nodes that need to be rewritten are stored into
28 these vectors. */
29 typedef vec<gimple> gimple_vec;
31 enum gimple_code {
32 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
33 #include "gimple.def"
34 #undef DEFGSCODE
35 LAST_AND_UNUSED_GIMPLE_CODE
38 extern const char *const gimple_code_name[];
39 extern const unsigned char gimple_rhs_class_table[];
41 /* Error out if a gimple tuple is addressed incorrectly. */
42 #if defined ENABLE_GIMPLE_CHECKING
43 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
44 extern void gimple_check_failed (const_gimple, const char *, int, \
45 const char *, enum gimple_code, \
46 enum tree_code) ATTRIBUTE_NORETURN;
48 #define GIMPLE_CHECK(GS, CODE) \
49 do { \
50 const_gimple __gs = (GS); \
51 if (gimple_code (__gs) != (CODE)) \
52 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
53 (CODE), ERROR_MARK); \
54 } while (0)
55 #else /* not ENABLE_GIMPLE_CHECKING */
56 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
57 #define GIMPLE_CHECK(GS, CODE) (void)0
58 #endif
60 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
61 get_gimple_rhs_class. */
62 enum gimple_rhs_class
64 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
65 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
66 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
67 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
68 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
69 name, a _DECL, a _REF, etc. */
72 /* Specific flags for individual GIMPLE statements. These flags are
73 always stored in gimple_statement_base.subcode and they may only be
74 defined for statement codes that do not use subcodes.
76 Values for the masks can overlap as long as the overlapping values
77 are never used in the same statement class.
79 The maximum mask value that can be defined is 1 << 15 (i.e., each
80 statement code can hold up to 16 bitflags).
82 Keep this list sorted. */
83 enum gf_mask {
84 GF_ASM_INPUT = 1 << 0,
85 GF_ASM_VOLATILE = 1 << 1,
86 GF_CALL_FROM_THUNK = 1 << 0,
87 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
88 GF_CALL_TAILCALL = 1 << 2,
89 GF_CALL_VA_ARG_PACK = 1 << 3,
90 GF_CALL_NOTHROW = 1 << 4,
91 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
92 GF_CALL_INTERNAL = 1 << 6,
93 GF_CALL_CTRL_ALTERING = 1 << 7,
94 GF_OMP_PARALLEL_COMBINED = 1 << 0,
95 GF_OMP_FOR_KIND_MASK = 3 << 0,
96 GF_OMP_FOR_KIND_FOR = 0 << 0,
97 GF_OMP_FOR_KIND_DISTRIBUTE = 1 << 0,
98 GF_OMP_FOR_KIND_SIMD = 2 << 0,
99 GF_OMP_FOR_KIND_CILKSIMD = 3 << 0,
100 GF_OMP_FOR_COMBINED = 1 << 2,
101 GF_OMP_FOR_COMBINED_INTO = 1 << 3,
102 GF_OMP_TARGET_KIND_MASK = 3 << 0,
103 GF_OMP_TARGET_KIND_REGION = 0 << 0,
104 GF_OMP_TARGET_KIND_DATA = 1 << 0,
105 GF_OMP_TARGET_KIND_UPDATE = 2 << 0,
107 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
108 a thread synchronization via some sort of barrier. The exact barrier
109 that would otherwise be emitted is dependent on the OMP statement with
110 which this return is associated. */
111 GF_OMP_RETURN_NOWAIT = 1 << 0,
113 GF_OMP_SECTION_LAST = 1 << 0,
114 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
115 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
116 GF_PREDICT_TAKEN = 1 << 15
119 /* Currently, there are only two types of gimple debug stmt. Others are
120 envisioned, for example, to enable the generation of is_stmt notes
121 in line number information, to mark sequence points, etc. This
122 subcode is to be used to tell them apart. */
123 enum gimple_debug_subcode {
124 GIMPLE_DEBUG_BIND = 0,
125 GIMPLE_DEBUG_SOURCE_BIND = 1
128 /* Masks for selecting a pass local flag (PLF) to work on. These
129 masks are used by gimple_set_plf and gimple_plf. */
130 enum plf_mask {
131 GF_PLF_1 = 1 << 0,
132 GF_PLF_2 = 1 << 1
135 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
136 are for 64 bit hosts. */
138 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
139 chain_next ("%h.next"), variable_size))
140 gimple_statement_base
142 /* [ WORD 1 ]
143 Main identifying code for a tuple. */
144 ENUM_BITFIELD(gimple_code) code : 8;
146 /* Nonzero if a warning should not be emitted on this tuple. */
147 unsigned int no_warning : 1;
149 /* Nonzero if this tuple has been visited. Passes are responsible
150 for clearing this bit before using it. */
151 unsigned int visited : 1;
153 /* Nonzero if this tuple represents a non-temporal move. */
154 unsigned int nontemporal_move : 1;
156 /* Pass local flags. These flags are free for any pass to use as
157 they see fit. Passes should not assume that these flags contain
158 any useful value when the pass starts. Any initial state that
159 the pass requires should be set on entry to the pass. See
160 gimple_set_plf and gimple_plf for usage. */
161 unsigned int plf : 2;
163 /* Nonzero if this statement has been modified and needs to have its
164 operands rescanned. */
165 unsigned modified : 1;
167 /* Nonzero if this statement contains volatile operands. */
168 unsigned has_volatile_ops : 1;
170 /* Padding to get subcode to 16 bit alignment. */
171 unsigned pad : 1;
173 /* The SUBCODE field can be used for tuple-specific flags for tuples
174 that do not require subcodes. Note that SUBCODE should be at
175 least as wide as tree codes, as several tuples store tree codes
176 in there. */
177 unsigned int subcode : 16;
179 /* UID of this statement. This is used by passes that want to
180 assign IDs to statements. It must be assigned and used by each
181 pass. By default it should be assumed to contain garbage. */
182 unsigned uid;
184 /* [ WORD 2 ]
185 Locus information for debug info. */
186 location_t location;
188 /* Number of operands in this tuple. */
189 unsigned num_ops;
191 /* [ WORD 3 ]
192 Basic block holding this statement. */
193 basic_block bb;
195 /* [ WORD 4-5 ]
196 Linked lists of gimple statements. The next pointers form
197 a NULL terminated list, the prev pointers are a cyclic list.
198 A gimple statement is hence also a double-ended list of
199 statements, with the pointer itself being the first element,
200 and the prev pointer being the last. */
201 gimple next;
202 gimple GTY((skip)) prev;
206 /* Base structure for tuples with operands. */
208 /* This gimple subclass has no tag value. */
209 struct GTY(())
210 gimple_statement_with_ops_base : public gimple_statement_base
212 /* [ WORD 1-6 ] : base class */
214 /* [ WORD 7 ]
215 SSA operand vectors. NOTE: It should be possible to
216 amalgamate these vectors with the operand vector OP. However,
217 the SSA operand vectors are organized differently and contain
218 more information (like immediate use chaining). */
219 struct use_optype_d GTY((skip (""))) *use_ops;
223 /* Statements that take register operands. */
225 struct GTY((tag("GSS_WITH_OPS")))
226 gimple_statement_with_ops : public gimple_statement_with_ops_base
228 /* [ WORD 1-7 ] : base class */
230 /* [ WORD 8 ]
231 Operand vector. NOTE! This must always be the last field
232 of this structure. In particular, this means that this
233 structure cannot be embedded inside another one. */
234 tree GTY((length ("%h.num_ops"))) op[1];
238 /* Base for statements that take both memory and register operands. */
240 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
241 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
243 /* [ WORD 1-7 ] : base class */
245 /* [ WORD 8-9 ]
246 Virtual operands for this statement. The GC will pick them
247 up via the ssa_names array. */
248 tree GTY((skip (""))) vdef;
249 tree GTY((skip (""))) vuse;
253 /* Statements that take both memory and register operands. */
255 struct GTY((tag("GSS_WITH_MEM_OPS")))
256 gimple_statement_with_memory_ops :
257 public gimple_statement_with_memory_ops_base
259 /* [ WORD 1-9 ] : base class */
261 /* [ WORD 10 ]
262 Operand vector. NOTE! This must always be the last field
263 of this structure. In particular, this means that this
264 structure cannot be embedded inside another one. */
265 tree GTY((length ("%h.num_ops"))) op[1];
269 /* Call statements that take both memory and register operands. */
271 struct GTY((tag("GSS_CALL")))
272 gimple_statement_call : public gimple_statement_with_memory_ops_base
274 /* [ WORD 1-9 ] : base class */
276 /* [ WORD 10-13 ] */
277 struct pt_solution call_used;
278 struct pt_solution call_clobbered;
280 /* [ WORD 14 ] */
281 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
282 tree GTY ((tag ("0"))) fntype;
283 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
284 } u;
286 /* [ WORD 15 ]
287 Operand vector. NOTE! This must always be the last field
288 of this structure. In particular, this means that this
289 structure cannot be embedded inside another one. */
290 tree GTY((length ("%h.num_ops"))) op[1];
294 /* OpenMP statements (#pragma omp). */
296 struct GTY((tag("GSS_OMP")))
297 gimple_statement_omp : public gimple_statement_base
299 /* [ WORD 1-6 ] : base class */
301 /* [ WORD 7 ] */
302 gimple_seq body;
306 /* GIMPLE_BIND */
308 struct GTY((tag("GSS_BIND")))
309 gimple_statement_bind : public gimple_statement_base
311 /* [ WORD 1-6 ] : base class */
313 /* [ WORD 7 ]
314 Variables declared in this scope. */
315 tree vars;
317 /* [ WORD 8 ]
318 This is different than the BLOCK field in gimple_statement_base,
319 which is analogous to TREE_BLOCK (i.e., the lexical block holding
320 this statement). This field is the equivalent of BIND_EXPR_BLOCK
321 in tree land (i.e., the lexical scope defined by this bind). See
322 gimple-low.c. */
323 tree block;
325 /* [ WORD 9 ] */
326 gimple_seq body;
330 /* GIMPLE_CATCH */
332 struct GTY((tag("GSS_CATCH")))
333 gimple_statement_catch : public gimple_statement_base
335 /* [ WORD 1-6 ] : base class */
337 /* [ WORD 7 ] */
338 tree types;
340 /* [ WORD 8 ] */
341 gimple_seq handler;
345 /* GIMPLE_EH_FILTER */
347 struct GTY((tag("GSS_EH_FILTER")))
348 gimple_statement_eh_filter : public gimple_statement_base
350 /* [ WORD 1-6 ] : base class */
352 /* [ WORD 7 ]
353 Filter types. */
354 tree types;
356 /* [ WORD 8 ]
357 Failure actions. */
358 gimple_seq failure;
361 /* GIMPLE_EH_ELSE */
363 struct GTY((tag("GSS_EH_ELSE")))
364 gimple_statement_eh_else : public gimple_statement_base
366 /* [ WORD 1-6 ] : base class */
368 /* [ WORD 7,8 ] */
369 gimple_seq n_body, e_body;
372 /* GIMPLE_EH_MUST_NOT_THROW */
374 struct GTY((tag("GSS_EH_MNT")))
375 gimple_statement_eh_mnt : public gimple_statement_base
377 /* [ WORD 1-6 ] : base class */
379 /* [ WORD 7 ] Abort function decl. */
380 tree fndecl;
383 /* GIMPLE_PHI */
385 struct GTY((tag("GSS_PHI")))
386 gimple_statement_phi : public gimple_statement_base
388 /* [ WORD 1-6 ] : base class */
390 /* [ WORD 7 ] */
391 unsigned capacity;
392 unsigned nargs;
394 /* [ WORD 8 ] */
395 tree result;
397 /* [ WORD 9 ] */
398 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
402 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
404 struct GTY((tag("GSS_EH_CTRL")))
405 gimple_statement_eh_ctrl : public gimple_statement_base
407 /* [ WORD 1-6 ] : base class */
409 /* [ WORD 7 ]
410 Exception region number. */
411 int region;
414 struct GTY((tag("GSS_EH_CTRL")))
415 gimple_statement_resx : public gimple_statement_eh_ctrl
417 /* No extra fields; adds invariant:
418 stmt->code == GIMPLE_RESX. */
421 struct GTY((tag("GSS_EH_CTRL")))
422 gimple_statement_eh_dispatch : public gimple_statement_eh_ctrl
424 /* No extra fields; adds invariant:
425 stmt->code == GIMPLE_EH_DISPATH. */
429 /* GIMPLE_TRY */
431 struct GTY((tag("GSS_TRY")))
432 gimple_statement_try : public gimple_statement_base
434 /* [ WORD 1-6 ] : base class */
436 /* [ WORD 7 ]
437 Expression to evaluate. */
438 gimple_seq eval;
440 /* [ WORD 8 ]
441 Cleanup expression. */
442 gimple_seq cleanup;
445 /* Kind of GIMPLE_TRY statements. */
446 enum gimple_try_flags
448 /* A try/catch. */
449 GIMPLE_TRY_CATCH = 1 << 0,
451 /* A try/finally. */
452 GIMPLE_TRY_FINALLY = 1 << 1,
453 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
455 /* Analogous to TRY_CATCH_IS_CLEANUP. */
456 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
459 /* GIMPLE_WITH_CLEANUP_EXPR */
461 struct GTY((tag("GSS_WCE")))
462 gimple_statement_wce : public gimple_statement_base
464 /* [ WORD 1-6 ] : base class */
466 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
467 executed if an exception is thrown, not on normal exit of its
468 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
469 in TARGET_EXPRs. */
471 /* [ WORD 7 ]
472 Cleanup expression. */
473 gimple_seq cleanup;
477 /* GIMPLE_ASM */
479 struct GTY((tag("GSS_ASM")))
480 gimple_statement_asm : public gimple_statement_with_memory_ops_base
482 /* [ WORD 1-9 ] : base class */
484 /* [ WORD 10 ]
485 __asm__ statement. */
486 const char *string;
488 /* [ WORD 11 ]
489 Number of inputs, outputs, clobbers, labels. */
490 unsigned char ni;
491 unsigned char no;
492 unsigned char nc;
493 unsigned char nl;
495 /* [ WORD 12 ]
496 Operand vector. NOTE! This must always be the last field
497 of this structure. In particular, this means that this
498 structure cannot be embedded inside another one. */
499 tree GTY((length ("%h.num_ops"))) op[1];
502 /* GIMPLE_OMP_CRITICAL */
504 struct GTY((tag("GSS_OMP_CRITICAL")))
505 gimple_statement_omp_critical : public gimple_statement_omp
507 /* [ WORD 1-7 ] : base class */
509 /* [ WORD 8 ]
510 Critical section name. */
511 tree name;
515 struct GTY(()) gimple_omp_for_iter {
516 /* Condition code. */
517 enum tree_code cond;
519 /* Index variable. */
520 tree index;
522 /* Initial value. */
523 tree initial;
525 /* Final value. */
526 tree final;
528 /* Increment. */
529 tree incr;
532 /* GIMPLE_OMP_FOR */
534 struct GTY((tag("GSS_OMP_FOR")))
535 gimple_statement_omp_for : public gimple_statement_omp
537 /* [ WORD 1-7 ] : base class */
539 /* [ WORD 8 ] */
540 tree clauses;
542 /* [ WORD 9 ]
543 Number of elements in iter array. */
544 size_t collapse;
546 /* [ WORD 10 ] */
547 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
549 /* [ WORD 11 ]
550 Pre-body evaluated before the loop body begins. */
551 gimple_seq pre_body;
555 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
556 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
557 gimple_statement_omp_parallel_layout : public gimple_statement_omp
559 /* [ WORD 1-7 ] : base class */
561 /* [ WORD 8 ]
562 Clauses. */
563 tree clauses;
565 /* [ WORD 9 ]
566 Child function holding the body of the parallel region. */
567 tree child_fn;
569 /* [ WORD 10 ]
570 Shared data argument. */
571 tree data_arg;
574 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
575 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
576 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
578 /* No extra fields; adds invariant:
579 stmt->code == GIMPLE_OMP_PARALLEL
580 || stmt->code == GIMPLE_OMP_TASK. */
584 /* GIMPLE_OMP_PARALLEL */
585 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
586 gimple_statement_omp_parallel : public gimple_statement_omp_taskreg
588 /* No extra fields; adds invariant:
589 stmt->code == GIMPLE_OMP_PARALLEL. */
592 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
593 gimple_statement_omp_target : public gimple_statement_omp_parallel_layout
595 /* No extra fields; adds invariant:
596 stmt->code == GIMPLE_OMP_TARGET. */
599 /* GIMPLE_OMP_TASK */
601 struct GTY((tag("GSS_OMP_TASK")))
602 gimple_statement_omp_task : public gimple_statement_omp_taskreg
604 /* [ WORD 1-10 ] : base class */
606 /* [ WORD 11 ]
607 Child function holding firstprivate initialization if needed. */
608 tree copy_fn;
610 /* [ WORD 12-13 ]
611 Size and alignment in bytes of the argument data block. */
612 tree arg_size;
613 tree arg_align;
617 /* GIMPLE_OMP_SECTION */
618 /* Uses struct gimple_statement_omp. */
621 /* GIMPLE_OMP_SECTIONS */
623 struct GTY((tag("GSS_OMP_SECTIONS")))
624 gimple_statement_omp_sections : public gimple_statement_omp
626 /* [ WORD 1-7 ] : base class */
628 /* [ WORD 8 ] */
629 tree clauses;
631 /* [ WORD 9 ]
632 The control variable used for deciding which of the sections to
633 execute. */
634 tree control;
637 /* GIMPLE_OMP_CONTINUE.
639 Note: This does not inherit from gimple_statement_omp, because we
640 do not need the body field. */
642 struct GTY((tag("GSS_OMP_CONTINUE")))
643 gimple_statement_omp_continue : public gimple_statement_base
645 /* [ WORD 1-6 ] : base class */
647 /* [ WORD 7 ] */
648 tree control_def;
650 /* [ WORD 8 ] */
651 tree control_use;
654 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
656 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
657 gimple_statement_omp_single_layout : public gimple_statement_omp
659 /* [ WORD 1-7 ] : base class */
661 /* [ WORD 7 ] */
662 tree clauses;
665 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
666 gimple_statement_omp_single : public gimple_statement_omp_single_layout
668 /* No extra fields; adds invariant:
669 stmt->code == GIMPLE_OMP_SINGLE. */
672 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
673 gimple_statement_omp_teams : public gimple_statement_omp_single_layout
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_TEAMS. */
680 /* GIMPLE_OMP_ATOMIC_LOAD.
681 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
682 contains a sequence, which we don't need here. */
684 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
685 gimple_statement_omp_atomic_load : public gimple_statement_base
687 /* [ WORD 1-6 ] : base class */
689 /* [ WORD 7-8 ] */
690 tree rhs, lhs;
693 /* GIMPLE_OMP_ATOMIC_STORE.
694 See note on GIMPLE_OMP_ATOMIC_LOAD. */
696 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
697 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
699 /* [ WORD 1-6 ] : base class */
701 /* [ WORD 7 ] */
702 tree val;
705 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
706 gimple_statement_omp_atomic_store :
707 public gimple_statement_omp_atomic_store_layout
709 /* No extra fields; adds invariant:
710 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
713 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
714 gimple_statement_omp_return :
715 public gimple_statement_omp_atomic_store_layout
717 /* No extra fields; adds invariant:
718 stmt->code == GIMPLE_OMP_RETURN. */
721 /* GIMPLE_TRANSACTION. */
723 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
725 /* The __transaction_atomic was declared [[outer]] or it is
726 __transaction_relaxed. */
727 #define GTMA_IS_OUTER (1u << 0)
728 #define GTMA_IS_RELAXED (1u << 1)
729 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
731 /* The transaction is seen to not have an abort. */
732 #define GTMA_HAVE_ABORT (1u << 2)
733 /* The transaction is seen to have loads or stores. */
734 #define GTMA_HAVE_LOAD (1u << 3)
735 #define GTMA_HAVE_STORE (1u << 4)
736 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
737 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
738 /* The transaction WILL enter serial irrevocable mode.
739 An irrevocable block post-dominates the entire transaction, such
740 that all invocations of the transaction will go serial-irrevocable.
741 In such case, we don't bother instrumenting the transaction, and
742 tell the runtime that it should begin the transaction in
743 serial-irrevocable mode. */
744 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
745 /* The transaction contains no instrumentation code whatsover, most
746 likely because it is guaranteed to go irrevocable upon entry. */
747 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
749 struct GTY((tag("GSS_TRANSACTION")))
750 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
752 /* [ WORD 1-9 ] : base class */
754 /* [ WORD 10 ] */
755 gimple_seq body;
757 /* [ WORD 11 ] */
758 tree label;
761 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
762 enum gimple_statement_structure_enum {
763 #include "gsstruct.def"
764 LAST_GSS_ENUM
766 #undef DEFGSSTRUCT
768 template <>
769 template <>
770 inline bool
771 is_a_helper <gimple_statement_asm>::test (gimple gs)
773 return gs->code == GIMPLE_ASM;
776 template <>
777 template <>
778 inline bool
779 is_a_helper <gimple_statement_bind>::test (gimple gs)
781 return gs->code == GIMPLE_BIND;
784 template <>
785 template <>
786 inline bool
787 is_a_helper <gimple_statement_call>::test (gimple gs)
789 return gs->code == GIMPLE_CALL;
792 template <>
793 template <>
794 inline bool
795 is_a_helper <gimple_statement_catch>::test (gimple gs)
797 return gs->code == GIMPLE_CATCH;
800 template <>
801 template <>
802 inline bool
803 is_a_helper <gimple_statement_resx>::test (gimple gs)
805 return gs->code == GIMPLE_RESX;
808 template <>
809 template <>
810 inline bool
811 is_a_helper <gimple_statement_eh_dispatch>::test (gimple gs)
813 return gs->code == GIMPLE_EH_DISPATCH;
816 template <>
817 template <>
818 inline bool
819 is_a_helper <gimple_statement_eh_else>::test (gimple gs)
821 return gs->code == GIMPLE_EH_ELSE;
824 template <>
825 template <>
826 inline bool
827 is_a_helper <gimple_statement_eh_filter>::test (gimple gs)
829 return gs->code == GIMPLE_EH_FILTER;
832 template <>
833 template <>
834 inline bool
835 is_a_helper <gimple_statement_eh_mnt>::test (gimple gs)
837 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
840 template <>
841 template <>
842 inline bool
843 is_a_helper <gimple_statement_omp_atomic_load>::test (gimple gs)
845 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
848 template <>
849 template <>
850 inline bool
851 is_a_helper <gimple_statement_omp_atomic_store>::test (gimple gs)
853 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
856 template <>
857 template <>
858 inline bool
859 is_a_helper <gimple_statement_omp_return>::test (gimple gs)
861 return gs->code == GIMPLE_OMP_RETURN;
864 template <>
865 template <>
866 inline bool
867 is_a_helper <gimple_statement_omp_continue>::test (gimple gs)
869 return gs->code == GIMPLE_OMP_CONTINUE;
872 template <>
873 template <>
874 inline bool
875 is_a_helper <gimple_statement_omp_critical>::test (gimple gs)
877 return gs->code == GIMPLE_OMP_CRITICAL;
880 template <>
881 template <>
882 inline bool
883 is_a_helper <gimple_statement_omp_for>::test (gimple gs)
885 return gs->code == GIMPLE_OMP_FOR;
888 template <>
889 template <>
890 inline bool
891 is_a_helper <gimple_statement_omp_taskreg>::test (gimple gs)
893 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
896 template <>
897 template <>
898 inline bool
899 is_a_helper <gimple_statement_omp_parallel>::test (gimple gs)
901 return gs->code == GIMPLE_OMP_PARALLEL;
904 template <>
905 template <>
906 inline bool
907 is_a_helper <gimple_statement_omp_target>::test (gimple gs)
909 return gs->code == GIMPLE_OMP_TARGET;
912 template <>
913 template <>
914 inline bool
915 is_a_helper <gimple_statement_omp_sections>::test (gimple gs)
917 return gs->code == GIMPLE_OMP_SECTIONS;
920 template <>
921 template <>
922 inline bool
923 is_a_helper <gimple_statement_omp_single>::test (gimple gs)
925 return gs->code == GIMPLE_OMP_SINGLE;
928 template <>
929 template <>
930 inline bool
931 is_a_helper <gimple_statement_omp_teams>::test (gimple gs)
933 return gs->code == GIMPLE_OMP_TEAMS;
936 template <>
937 template <>
938 inline bool
939 is_a_helper <gimple_statement_omp_task>::test (gimple gs)
941 return gs->code == GIMPLE_OMP_TASK;
944 template <>
945 template <>
946 inline bool
947 is_a_helper <gimple_statement_phi>::test (gimple gs)
949 return gs->code == GIMPLE_PHI;
952 template <>
953 template <>
954 inline bool
955 is_a_helper <gimple_statement_transaction>::test (gimple gs)
957 return gs->code == GIMPLE_TRANSACTION;
960 template <>
961 template <>
962 inline bool
963 is_a_helper <gimple_statement_try>::test (gimple gs)
965 return gs->code == GIMPLE_TRY;
968 template <>
969 template <>
970 inline bool
971 is_a_helper <gimple_statement_wce>::test (gimple gs)
973 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
976 template <>
977 template <>
978 inline bool
979 is_a_helper <const gimple_statement_asm>::test (const_gimple gs)
981 return gs->code == GIMPLE_ASM;
984 template <>
985 template <>
986 inline bool
987 is_a_helper <const gimple_statement_bind>::test (const_gimple gs)
989 return gs->code == GIMPLE_BIND;
992 template <>
993 template <>
994 inline bool
995 is_a_helper <const gimple_statement_call>::test (const_gimple gs)
997 return gs->code == GIMPLE_CALL;
1000 template <>
1001 template <>
1002 inline bool
1003 is_a_helper <const gimple_statement_catch>::test (const_gimple gs)
1005 return gs->code == GIMPLE_CATCH;
1008 template <>
1009 template <>
1010 inline bool
1011 is_a_helper <const gimple_statement_resx>::test (const_gimple gs)
1013 return gs->code == GIMPLE_RESX;
1016 template <>
1017 template <>
1018 inline bool
1019 is_a_helper <const gimple_statement_eh_dispatch>::test (const_gimple gs)
1021 return gs->code == GIMPLE_EH_DISPATCH;
1024 template <>
1025 template <>
1026 inline bool
1027 is_a_helper <const gimple_statement_eh_filter>::test (const_gimple gs)
1029 return gs->code == GIMPLE_EH_FILTER;
1032 template <>
1033 template <>
1034 inline bool
1035 is_a_helper <const gimple_statement_omp_atomic_load>::test (const_gimple gs)
1037 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1040 template <>
1041 template <>
1042 inline bool
1043 is_a_helper <const gimple_statement_omp_atomic_store>::test (const_gimple gs)
1045 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1048 template <>
1049 template <>
1050 inline bool
1051 is_a_helper <const gimple_statement_omp_return>::test (const_gimple gs)
1053 return gs->code == GIMPLE_OMP_RETURN;
1056 template <>
1057 template <>
1058 inline bool
1059 is_a_helper <const gimple_statement_omp_continue>::test (const_gimple gs)
1061 return gs->code == GIMPLE_OMP_CONTINUE;
1064 template <>
1065 template <>
1066 inline bool
1067 is_a_helper <const gimple_statement_omp_critical>::test (const_gimple gs)
1069 return gs->code == GIMPLE_OMP_CRITICAL;
1072 template <>
1073 template <>
1074 inline bool
1075 is_a_helper <const gimple_statement_omp_for>::test (const_gimple gs)
1077 return gs->code == GIMPLE_OMP_FOR;
1080 template <>
1081 template <>
1082 inline bool
1083 is_a_helper <const gimple_statement_omp_taskreg>::test (const_gimple gs)
1085 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1088 template <>
1089 template <>
1090 inline bool
1091 is_a_helper <const gimple_statement_omp_parallel>::test (const_gimple gs)
1093 return gs->code == GIMPLE_OMP_PARALLEL;
1096 template <>
1097 template <>
1098 inline bool
1099 is_a_helper <const gimple_statement_omp_target>::test (const_gimple gs)
1101 return gs->code == GIMPLE_OMP_TARGET;
1104 template <>
1105 template <>
1106 inline bool
1107 is_a_helper <const gimple_statement_omp_sections>::test (const_gimple gs)
1109 return gs->code == GIMPLE_OMP_SECTIONS;
1112 template <>
1113 template <>
1114 inline bool
1115 is_a_helper <const gimple_statement_omp_single>::test (const_gimple gs)
1117 return gs->code == GIMPLE_OMP_SINGLE;
1120 template <>
1121 template <>
1122 inline bool
1123 is_a_helper <const gimple_statement_omp_teams>::test (const_gimple gs)
1125 return gs->code == GIMPLE_OMP_TEAMS;
1128 template <>
1129 template <>
1130 inline bool
1131 is_a_helper <const gimple_statement_omp_task>::test (const_gimple gs)
1133 return gs->code == GIMPLE_OMP_TASK;
1136 template <>
1137 template <>
1138 inline bool
1139 is_a_helper <const gimple_statement_phi>::test (const_gimple gs)
1141 return gs->code == GIMPLE_PHI;
1144 template <>
1145 template <>
1146 inline bool
1147 is_a_helper <const gimple_statement_transaction>::test (const_gimple gs)
1149 return gs->code == GIMPLE_TRANSACTION;
1152 /* Offset in bytes to the location of the operand vector.
1153 Zero if there is no operand vector for this tuple structure. */
1154 extern size_t const gimple_ops_offset_[];
1156 /* Map GIMPLE codes to GSS codes. */
1157 extern enum gimple_statement_structure_enum const gss_for_code_[];
1159 /* This variable holds the currently expanded gimple statement for purposes
1160 of comminucating the profile info to the builtin expanders. */
1161 extern gimple currently_expanding_gimple_stmt;
1163 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1164 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1165 gimple gimple_build_return (tree);
1166 void gimple_call_reset_alias_info (gimple);
1167 gimple gimple_build_call_vec (tree, vec<tree> );
1168 gimple gimple_build_call (tree, unsigned, ...);
1169 gimple gimple_build_call_valist (tree, unsigned, va_list);
1170 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1171 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1172 gimple gimple_build_call_from_tree (tree);
1173 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1174 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1175 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1176 tree, tree, tree CXX_MEM_STAT_INFO);
1177 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1178 tree, tree CXX_MEM_STAT_INFO);
1179 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1180 gimple gimple_build_cond_from_tree (tree, tree, tree);
1181 void gimple_cond_set_condition_from_tree (gimple, tree);
1182 gimple gimple_build_label (tree label);
1183 gimple gimple_build_goto (tree dest);
1184 gimple gimple_build_nop (void);
1185 gimple gimple_build_bind (tree, gimple_seq, tree);
1186 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1187 vec<tree, va_gc> *, vec<tree, va_gc> *,
1188 vec<tree, va_gc> *);
1189 gimple gimple_build_catch (tree, gimple_seq);
1190 gimple gimple_build_eh_filter (tree, gimple_seq);
1191 gimple gimple_build_eh_must_not_throw (tree);
1192 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1193 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1194 enum gimple_try_flags);
1195 gimple gimple_build_wce (gimple_seq);
1196 gimple gimple_build_resx (int);
1197 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1198 gimple gimple_build_switch (tree, tree, vec<tree> );
1199 gimple gimple_build_eh_dispatch (int);
1200 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1201 #define gimple_build_debug_bind(var,val,stmt) \
1202 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1203 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1204 #define gimple_build_debug_source_bind(var,val,stmt) \
1205 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1206 gimple gimple_build_omp_critical (gimple_seq, tree);
1207 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1208 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1209 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1210 gimple gimple_build_omp_section (gimple_seq);
1211 gimple gimple_build_omp_master (gimple_seq);
1212 gimple gimple_build_omp_taskgroup (gimple_seq);
1213 gimple gimple_build_omp_continue (tree, tree);
1214 gimple gimple_build_omp_ordered (gimple_seq);
1215 gimple gimple_build_omp_return (bool);
1216 gimple gimple_build_omp_sections (gimple_seq, tree);
1217 gimple gimple_build_omp_sections_switch (void);
1218 gimple gimple_build_omp_single (gimple_seq, tree);
1219 gimple gimple_build_omp_target (gimple_seq, int, tree);
1220 gimple gimple_build_omp_teams (gimple_seq, tree);
1221 gimple gimple_build_omp_atomic_load (tree, tree);
1222 gimple gimple_build_omp_atomic_store (tree);
1223 gimple gimple_build_transaction (gimple_seq, tree);
1224 gimple gimple_build_predict (enum br_predictor, enum prediction);
1225 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1226 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1227 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1228 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1229 location_t);
1230 extern void annotate_all_with_location (gimple_seq, location_t);
1231 bool empty_body_p (gimple_seq);
1232 gimple_seq gimple_seq_copy (gimple_seq);
1233 bool gimple_call_same_target_p (const_gimple, const_gimple);
1234 int gimple_call_flags (const_gimple);
1235 int gimple_call_arg_flags (const_gimple, unsigned);
1236 int gimple_call_return_flags (const_gimple);
1237 bool gimple_assign_copy_p (gimple);
1238 bool gimple_assign_ssa_name_copy_p (gimple);
1239 bool gimple_assign_unary_nop_p (gimple);
1240 void gimple_set_bb (gimple, basic_block);
1241 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1242 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1243 tree, tree, tree);
1244 tree gimple_get_lhs (const_gimple);
1245 void gimple_set_lhs (gimple, tree);
1246 gimple gimple_copy (gimple);
1247 bool gimple_has_side_effects (const_gimple);
1248 bool gimple_could_trap_p_1 (gimple, bool, bool);
1249 bool gimple_could_trap_p (gimple);
1250 bool gimple_assign_rhs_could_trap_p (gimple);
1251 extern void dump_gimple_statistics (void);
1252 unsigned get_gimple_rhs_num_ops (enum tree_code);
1253 extern tree canonicalize_cond_expr_cond (tree);
1254 gimple gimple_call_copy_skip_args (gimple, bitmap);
1255 extern bool gimple_compare_field_offset (tree, tree);
1256 extern tree gimple_unsigned_type (tree);
1257 extern tree gimple_signed_type (tree);
1258 extern alias_set_type gimple_get_alias_set (tree);
1259 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1260 extern bool gimple_builtin_call_types_compatible_p (gimple, tree);
1261 extern bool gimple_call_builtin_p (gimple);
1262 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
1263 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1264 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1265 extern void dump_decl_set (FILE *, bitmap);
1266 extern bool nonfreeing_call_p (gimple);
1267 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1268 extern void sort_case_labels (vec<tree> );
1269 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1270 extern void gimple_seq_set_location (gimple_seq , location_t);
1272 /* Formal (expression) temporary table handling: multiple occurrences of
1273 the same scalar expression are evaluated into the same temporary. */
1275 typedef struct gimple_temp_hash_elt
1277 tree val; /* Key */
1278 tree temp; /* Value */
1279 } elt_t;
1281 /* Get the number of the next statement uid to be allocated. */
1282 static inline unsigned int
1283 gimple_stmt_max_uid (struct function *fn)
1285 return fn->last_stmt_uid;
1288 /* Set the number of the next statement uid to be allocated. */
1289 static inline void
1290 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1292 fn->last_stmt_uid = maxid;
1295 /* Set the number of the next statement uid to be allocated. */
1296 static inline unsigned int
1297 inc_gimple_stmt_max_uid (struct function *fn)
1299 return fn->last_stmt_uid++;
1302 /* Return the first node in GIMPLE sequence S. */
1304 static inline gimple_seq_node
1305 gimple_seq_first (gimple_seq s)
1307 return s;
1311 /* Return the first statement in GIMPLE sequence S. */
1313 static inline gimple
1314 gimple_seq_first_stmt (gimple_seq s)
1316 gimple_seq_node n = gimple_seq_first (s);
1317 return n;
1321 /* Return the last node in GIMPLE sequence S. */
1323 static inline gimple_seq_node
1324 gimple_seq_last (gimple_seq s)
1326 return s ? s->prev : NULL;
1330 /* Return the last statement in GIMPLE sequence S. */
1332 static inline gimple
1333 gimple_seq_last_stmt (gimple_seq s)
1335 gimple_seq_node n = gimple_seq_last (s);
1336 return n;
1340 /* Set the last node in GIMPLE sequence *PS to LAST. */
1342 static inline void
1343 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1345 (*ps)->prev = last;
1349 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1351 static inline void
1352 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1354 *ps = first;
1358 /* Return true if GIMPLE sequence S is empty. */
1360 static inline bool
1361 gimple_seq_empty_p (gimple_seq s)
1363 return s == NULL;
1366 /* Allocate a new sequence and initialize its first element with STMT. */
1368 static inline gimple_seq
1369 gimple_seq_alloc_with_stmt (gimple stmt)
1371 gimple_seq seq = NULL;
1372 gimple_seq_add_stmt (&seq, stmt);
1373 return seq;
1377 /* Returns the sequence of statements in BB. */
1379 static inline gimple_seq
1380 bb_seq (const_basic_block bb)
1382 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1385 static inline gimple_seq *
1386 bb_seq_addr (basic_block bb)
1388 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1391 /* Sets the sequence of statements in BB to SEQ. */
1393 static inline void
1394 set_bb_seq (basic_block bb, gimple_seq seq)
1396 gcc_checking_assert (!(bb->flags & BB_RTL));
1397 bb->il.gimple.seq = seq;
1401 /* Return the code for GIMPLE statement G. */
1403 static inline enum gimple_code
1404 gimple_code (const_gimple g)
1406 return g->code;
1410 /* Return the GSS code used by a GIMPLE code. */
1412 static inline enum gimple_statement_structure_enum
1413 gss_for_code (enum gimple_code code)
1415 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1416 return gss_for_code_[code];
1420 /* Return which GSS code is used by GS. */
1422 static inline enum gimple_statement_structure_enum
1423 gimple_statement_structure (gimple gs)
1425 return gss_for_code (gimple_code (gs));
1429 /* Return true if statement G has sub-statements. This is only true for
1430 High GIMPLE statements. */
1432 static inline bool
1433 gimple_has_substatements (gimple g)
1435 switch (gimple_code (g))
1437 case GIMPLE_BIND:
1438 case GIMPLE_CATCH:
1439 case GIMPLE_EH_FILTER:
1440 case GIMPLE_EH_ELSE:
1441 case GIMPLE_TRY:
1442 case GIMPLE_OMP_FOR:
1443 case GIMPLE_OMP_MASTER:
1444 case GIMPLE_OMP_TASKGROUP:
1445 case GIMPLE_OMP_ORDERED:
1446 case GIMPLE_OMP_SECTION:
1447 case GIMPLE_OMP_PARALLEL:
1448 case GIMPLE_OMP_TASK:
1449 case GIMPLE_OMP_SECTIONS:
1450 case GIMPLE_OMP_SINGLE:
1451 case GIMPLE_OMP_TARGET:
1452 case GIMPLE_OMP_TEAMS:
1453 case GIMPLE_OMP_CRITICAL:
1454 case GIMPLE_WITH_CLEANUP_EXPR:
1455 case GIMPLE_TRANSACTION:
1456 return true;
1458 default:
1459 return false;
1464 /* Return the basic block holding statement G. */
1466 static inline basic_block
1467 gimple_bb (const_gimple g)
1469 return g->bb;
1473 /* Return the lexical scope block holding statement G. */
1475 static inline tree
1476 gimple_block (const_gimple g)
1478 return LOCATION_BLOCK (g->location);
1482 /* Set BLOCK to be the lexical scope block holding statement G. */
1484 static inline void
1485 gimple_set_block (gimple g, tree block)
1487 if (block)
1488 g->location =
1489 COMBINE_LOCATION_DATA (line_table, g->location, block);
1490 else
1491 g->location = LOCATION_LOCUS (g->location);
1495 /* Return location information for statement G. */
1497 static inline location_t
1498 gimple_location (const_gimple g)
1500 return g->location;
1503 /* Return pointer to location information for statement G. */
1505 static inline const location_t *
1506 gimple_location_ptr (const_gimple g)
1508 return &g->location;
1512 /* Set location information for statement G. */
1514 static inline void
1515 gimple_set_location (gimple g, location_t location)
1517 g->location = location;
1521 /* Return true if G contains location information. */
1523 static inline bool
1524 gimple_has_location (const_gimple g)
1526 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1530 /* Return the file name of the location of STMT. */
1532 static inline const char *
1533 gimple_filename (const_gimple stmt)
1535 return LOCATION_FILE (gimple_location (stmt));
1539 /* Return the line number of the location of STMT. */
1541 static inline int
1542 gimple_lineno (const_gimple stmt)
1544 return LOCATION_LINE (gimple_location (stmt));
1548 /* Determine whether SEQ is a singleton. */
1550 static inline bool
1551 gimple_seq_singleton_p (gimple_seq seq)
1553 return ((gimple_seq_first (seq) != NULL)
1554 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1557 /* Return true if no warnings should be emitted for statement STMT. */
1559 static inline bool
1560 gimple_no_warning_p (const_gimple stmt)
1562 return stmt->no_warning;
1565 /* Set the no_warning flag of STMT to NO_WARNING. */
1567 static inline void
1568 gimple_set_no_warning (gimple stmt, bool no_warning)
1570 stmt->no_warning = (unsigned) no_warning;
1573 /* Set the visited status on statement STMT to VISITED_P. */
1575 static inline void
1576 gimple_set_visited (gimple stmt, bool visited_p)
1578 stmt->visited = (unsigned) visited_p;
1582 /* Return the visited status for statement STMT. */
1584 static inline bool
1585 gimple_visited_p (gimple stmt)
1587 return stmt->visited;
1591 /* Set pass local flag PLF on statement STMT to VAL_P. */
1593 static inline void
1594 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1596 if (val_p)
1597 stmt->plf |= (unsigned int) plf;
1598 else
1599 stmt->plf &= ~((unsigned int) plf);
1603 /* Return the value of pass local flag PLF on statement STMT. */
1605 static inline unsigned int
1606 gimple_plf (gimple stmt, enum plf_mask plf)
1608 return stmt->plf & ((unsigned int) plf);
1612 /* Set the UID of statement. */
1614 static inline void
1615 gimple_set_uid (gimple g, unsigned uid)
1617 g->uid = uid;
1621 /* Return the UID of statement. */
1623 static inline unsigned
1624 gimple_uid (const_gimple g)
1626 return g->uid;
1630 /* Make statement G a singleton sequence. */
1632 static inline void
1633 gimple_init_singleton (gimple g)
1635 g->next = NULL;
1636 g->prev = g;
1640 /* Return true if GIMPLE statement G has register or memory operands. */
1642 static inline bool
1643 gimple_has_ops (const_gimple g)
1645 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1648 template <>
1649 template <>
1650 inline bool
1651 is_a_helper <const gimple_statement_with_ops>::test (const_gimple gs)
1653 return gimple_has_ops (gs);
1656 template <>
1657 template <>
1658 inline bool
1659 is_a_helper <gimple_statement_with_ops>::test (gimple gs)
1661 return gimple_has_ops (gs);
1664 /* Return true if GIMPLE statement G has memory operands. */
1666 static inline bool
1667 gimple_has_mem_ops (const_gimple g)
1669 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1672 template <>
1673 template <>
1674 inline bool
1675 is_a_helper <const gimple_statement_with_memory_ops>::test (const_gimple gs)
1677 return gimple_has_mem_ops (gs);
1680 template <>
1681 template <>
1682 inline bool
1683 is_a_helper <gimple_statement_with_memory_ops>::test (gimple gs)
1685 return gimple_has_mem_ops (gs);
1688 /* Return the set of USE operands for statement G. */
1690 static inline struct use_optype_d *
1691 gimple_use_ops (const_gimple g)
1693 const gimple_statement_with_ops *ops_stmt =
1694 dyn_cast <const gimple_statement_with_ops> (g);
1695 if (!ops_stmt)
1696 return NULL;
1697 return ops_stmt->use_ops;
1701 /* Set USE to be the set of USE operands for statement G. */
1703 static inline void
1704 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1706 gimple_statement_with_ops *ops_stmt =
1707 as_a <gimple_statement_with_ops> (g);
1708 ops_stmt->use_ops = use;
1712 /* Return the single VUSE operand of the statement G. */
1714 static inline tree
1715 gimple_vuse (const_gimple g)
1717 const gimple_statement_with_memory_ops *mem_ops_stmt =
1718 dyn_cast <const gimple_statement_with_memory_ops> (g);
1719 if (!mem_ops_stmt)
1720 return NULL_TREE;
1721 return mem_ops_stmt->vuse;
1724 /* Return the single VDEF operand of the statement G. */
1726 static inline tree
1727 gimple_vdef (const_gimple g)
1729 const gimple_statement_with_memory_ops *mem_ops_stmt =
1730 dyn_cast <const gimple_statement_with_memory_ops> (g);
1731 if (!mem_ops_stmt)
1732 return NULL_TREE;
1733 return mem_ops_stmt->vdef;
1736 /* Return the single VUSE operand of the statement G. */
1738 static inline tree *
1739 gimple_vuse_ptr (gimple g)
1741 gimple_statement_with_memory_ops *mem_ops_stmt =
1742 dyn_cast <gimple_statement_with_memory_ops> (g);
1743 if (!mem_ops_stmt)
1744 return NULL;
1745 return &mem_ops_stmt->vuse;
1748 /* Return the single VDEF operand of the statement G. */
1750 static inline tree *
1751 gimple_vdef_ptr (gimple g)
1753 gimple_statement_with_memory_ops *mem_ops_stmt =
1754 dyn_cast <gimple_statement_with_memory_ops> (g);
1755 if (!mem_ops_stmt)
1756 return NULL;
1757 return &mem_ops_stmt->vdef;
1760 /* Set the single VUSE operand of the statement G. */
1762 static inline void
1763 gimple_set_vuse (gimple g, tree vuse)
1765 gimple_statement_with_memory_ops *mem_ops_stmt =
1766 as_a <gimple_statement_with_memory_ops> (g);
1767 mem_ops_stmt->vuse = vuse;
1770 /* Set the single VDEF operand of the statement G. */
1772 static inline void
1773 gimple_set_vdef (gimple g, tree vdef)
1775 gimple_statement_with_memory_ops *mem_ops_stmt =
1776 as_a <gimple_statement_with_memory_ops> (g);
1777 mem_ops_stmt->vdef = vdef;
1781 /* Return true if statement G has operands and the modified field has
1782 been set. */
1784 static inline bool
1785 gimple_modified_p (const_gimple g)
1787 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1791 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1792 a MODIFIED field. */
1794 static inline void
1795 gimple_set_modified (gimple s, bool modifiedp)
1797 if (gimple_has_ops (s))
1798 s->modified = (unsigned) modifiedp;
1802 /* Return the tree code for the expression computed by STMT. This is
1803 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1804 GIMPLE_CALL, return CALL_EXPR as the expression code for
1805 consistency. This is useful when the caller needs to deal with the
1806 three kinds of computation that GIMPLE supports. */
1808 static inline enum tree_code
1809 gimple_expr_code (const_gimple stmt)
1811 enum gimple_code code = gimple_code (stmt);
1812 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1813 return (enum tree_code) stmt->subcode;
1814 else
1816 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1817 return CALL_EXPR;
1822 /* Return true if statement STMT contains volatile operands. */
1824 static inline bool
1825 gimple_has_volatile_ops (const_gimple stmt)
1827 if (gimple_has_mem_ops (stmt))
1828 return stmt->has_volatile_ops;
1829 else
1830 return false;
1834 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1836 static inline void
1837 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1839 if (gimple_has_mem_ops (stmt))
1840 stmt->has_volatile_ops = (unsigned) volatilep;
1843 /* Return true if STMT is in a transaction. */
1845 static inline bool
1846 gimple_in_transaction (gimple stmt)
1848 return bb_in_transaction (gimple_bb (stmt));
1851 /* Return true if statement STMT may access memory. */
1853 static inline bool
1854 gimple_references_memory_p (gimple stmt)
1856 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1860 /* Return the subcode for OMP statement S. */
1862 static inline unsigned
1863 gimple_omp_subcode (const_gimple s)
1865 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1866 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1867 return s->subcode;
1870 /* Set the subcode for OMP statement S to SUBCODE. */
1872 static inline void
1873 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1875 /* We only have 16 bits for the subcode. Assert that we are not
1876 overflowing it. */
1877 gcc_gimple_checking_assert (subcode < (1 << 16));
1878 s->subcode = subcode;
1881 /* Set the nowait flag on OMP_RETURN statement S. */
1883 static inline void
1884 gimple_omp_return_set_nowait (gimple s)
1886 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1887 s->subcode |= GF_OMP_RETURN_NOWAIT;
1891 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1892 flag set. */
1894 static inline bool
1895 gimple_omp_return_nowait_p (const_gimple g)
1897 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1898 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1902 /* Set the LHS of OMP return. */
1904 static inline void
1905 gimple_omp_return_set_lhs (gimple g, tree lhs)
1907 gimple_statement_omp_return *omp_return_stmt =
1908 as_a <gimple_statement_omp_return> (g);
1909 omp_return_stmt->val = lhs;
1913 /* Get the LHS of OMP return. */
1915 static inline tree
1916 gimple_omp_return_lhs (const_gimple g)
1918 const gimple_statement_omp_return *omp_return_stmt =
1919 as_a <const gimple_statement_omp_return> (g);
1920 return omp_return_stmt->val;
1924 /* Return a pointer to the LHS of OMP return. */
1926 static inline tree *
1927 gimple_omp_return_lhs_ptr (gimple g)
1929 gimple_statement_omp_return *omp_return_stmt =
1930 as_a <gimple_statement_omp_return> (g);
1931 return &omp_return_stmt->val;
1935 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1936 flag set. */
1938 static inline bool
1939 gimple_omp_section_last_p (const_gimple g)
1941 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1942 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1946 /* Set the GF_OMP_SECTION_LAST flag on G. */
1948 static inline void
1949 gimple_omp_section_set_last (gimple g)
1951 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1952 g->subcode |= GF_OMP_SECTION_LAST;
1956 /* Return true if OMP parallel statement G has the
1957 GF_OMP_PARALLEL_COMBINED flag set. */
1959 static inline bool
1960 gimple_omp_parallel_combined_p (const_gimple g)
1962 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1963 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1967 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1968 value of COMBINED_P. */
1970 static inline void
1971 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1973 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1974 if (combined_p)
1975 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1976 else
1977 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1981 /* Return true if OMP atomic load/store statement G has the
1982 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1984 static inline bool
1985 gimple_omp_atomic_need_value_p (const_gimple g)
1987 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1988 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1989 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1993 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1995 static inline void
1996 gimple_omp_atomic_set_need_value (gimple g)
1998 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1999 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2000 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2004 /* Return true if OMP atomic load/store statement G has the
2005 GF_OMP_ATOMIC_SEQ_CST flag set. */
2007 static inline bool
2008 gimple_omp_atomic_seq_cst_p (const_gimple g)
2010 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2011 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2012 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2016 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2018 static inline void
2019 gimple_omp_atomic_set_seq_cst (gimple g)
2021 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2022 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2023 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2027 /* Return the number of operands for statement GS. */
2029 static inline unsigned
2030 gimple_num_ops (const_gimple gs)
2032 return gs->num_ops;
2036 /* Set the number of operands for statement GS. */
2038 static inline void
2039 gimple_set_num_ops (gimple gs, unsigned num_ops)
2041 gs->num_ops = num_ops;
2045 /* Return the array of operands for statement GS. */
2047 static inline tree *
2048 gimple_ops (gimple gs)
2050 size_t off;
2052 /* All the tuples have their operand vector at the very bottom
2053 of the structure. Note that those structures that do not
2054 have an operand vector have a zero offset. */
2055 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2056 gcc_gimple_checking_assert (off != 0);
2058 return (tree *) ((char *) gs + off);
2062 /* Return operand I for statement GS. */
2064 static inline tree
2065 gimple_op (const_gimple gs, unsigned i)
2067 if (gimple_has_ops (gs))
2069 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2070 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2072 else
2073 return NULL_TREE;
2076 /* Return a pointer to operand I for statement GS. */
2078 static inline tree *
2079 gimple_op_ptr (const_gimple gs, unsigned i)
2081 if (gimple_has_ops (gs))
2083 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2084 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2086 else
2087 return NULL;
2090 /* Set operand I of statement GS to OP. */
2092 static inline void
2093 gimple_set_op (gimple gs, unsigned i, tree op)
2095 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2097 /* Note. It may be tempting to assert that OP matches
2098 is_gimple_operand, but that would be wrong. Different tuples
2099 accept slightly different sets of tree operands. Each caller
2100 should perform its own validation. */
2101 gimple_ops (gs)[i] = op;
2104 /* Return true if GS is a GIMPLE_ASSIGN. */
2106 static inline bool
2107 is_gimple_assign (const_gimple gs)
2109 return gimple_code (gs) == GIMPLE_ASSIGN;
2112 /* Determine if expression CODE is one of the valid expressions that can
2113 be used on the RHS of GIMPLE assignments. */
2115 static inline enum gimple_rhs_class
2116 get_gimple_rhs_class (enum tree_code code)
2118 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2121 /* Return the LHS of assignment statement GS. */
2123 static inline tree
2124 gimple_assign_lhs (const_gimple gs)
2126 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2127 return gimple_op (gs, 0);
2131 /* Return a pointer to the LHS of assignment statement GS. */
2133 static inline tree *
2134 gimple_assign_lhs_ptr (const_gimple gs)
2136 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2137 return gimple_op_ptr (gs, 0);
2141 /* Set LHS to be the LHS operand of assignment statement GS. */
2143 static inline void
2144 gimple_assign_set_lhs (gimple gs, tree lhs)
2146 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2147 gimple_set_op (gs, 0, lhs);
2149 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2150 SSA_NAME_DEF_STMT (lhs) = gs;
2154 /* Return the first operand on the RHS of assignment statement GS. */
2156 static inline tree
2157 gimple_assign_rhs1 (const_gimple gs)
2159 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2160 return gimple_op (gs, 1);
2164 /* Return a pointer to the first operand on the RHS of assignment
2165 statement GS. */
2167 static inline tree *
2168 gimple_assign_rhs1_ptr (const_gimple gs)
2170 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2171 return gimple_op_ptr (gs, 1);
2174 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2176 static inline void
2177 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2179 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2181 gimple_set_op (gs, 1, rhs);
2185 /* Return the second operand on the RHS of assignment statement GS.
2186 If GS does not have two operands, NULL is returned instead. */
2188 static inline tree
2189 gimple_assign_rhs2 (const_gimple gs)
2191 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2193 if (gimple_num_ops (gs) >= 3)
2194 return gimple_op (gs, 2);
2195 else
2196 return NULL_TREE;
2200 /* Return a pointer to the second operand on the RHS of assignment
2201 statement GS. */
2203 static inline tree *
2204 gimple_assign_rhs2_ptr (const_gimple gs)
2206 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2207 return gimple_op_ptr (gs, 2);
2211 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2213 static inline void
2214 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2216 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2218 gimple_set_op (gs, 2, rhs);
2221 /* Return the third operand on the RHS of assignment statement GS.
2222 If GS does not have two operands, NULL is returned instead. */
2224 static inline tree
2225 gimple_assign_rhs3 (const_gimple gs)
2227 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2229 if (gimple_num_ops (gs) >= 4)
2230 return gimple_op (gs, 3);
2231 else
2232 return NULL_TREE;
2235 /* Return a pointer to the third operand on the RHS of assignment
2236 statement GS. */
2238 static inline tree *
2239 gimple_assign_rhs3_ptr (const_gimple gs)
2241 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2242 return gimple_op_ptr (gs, 3);
2246 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2248 static inline void
2249 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2251 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2253 gimple_set_op (gs, 3, rhs);
2256 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2257 to see only a maximum of two operands. */
2259 static inline void
2260 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2261 tree op1, tree op2)
2263 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2266 /* Returns true if GS is a nontemporal move. */
2268 static inline bool
2269 gimple_assign_nontemporal_move_p (const_gimple gs)
2271 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2272 return gs->nontemporal_move;
2275 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2277 static inline void
2278 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2280 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2281 gs->nontemporal_move = nontemporal;
2285 /* Return the code of the expression computed on the rhs of assignment
2286 statement GS. In case that the RHS is a single object, returns the
2287 tree code of the object. */
2289 static inline enum tree_code
2290 gimple_assign_rhs_code (const_gimple gs)
2292 enum tree_code code;
2293 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2295 code = (enum tree_code) gs->subcode;
2296 /* While we initially set subcode to the TREE_CODE of the rhs for
2297 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2298 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2299 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2300 code = TREE_CODE (gimple_assign_rhs1 (gs));
2302 return code;
2306 /* Set CODE to be the code for the expression computed on the RHS of
2307 assignment S. */
2309 static inline void
2310 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2312 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2313 s->subcode = code;
2317 /* Return the gimple rhs class of the code of the expression computed on
2318 the rhs of assignment statement GS.
2319 This will never return GIMPLE_INVALID_RHS. */
2321 static inline enum gimple_rhs_class
2322 gimple_assign_rhs_class (const_gimple gs)
2324 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2327 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2328 there is no operator associated with the assignment itself.
2329 Unlike gimple_assign_copy_p, this predicate returns true for
2330 any RHS operand, including those that perform an operation
2331 and do not have the semantics of a copy, such as COND_EXPR. */
2333 static inline bool
2334 gimple_assign_single_p (gimple gs)
2336 return (is_gimple_assign (gs)
2337 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2340 /* Return true if GS performs a store to its lhs. */
2342 static inline bool
2343 gimple_store_p (gimple gs)
2345 tree lhs = gimple_get_lhs (gs);
2346 return lhs && !is_gimple_reg (lhs);
2349 /* Return true if GS is an assignment that loads from its rhs1. */
2351 static inline bool
2352 gimple_assign_load_p (gimple gs)
2354 tree rhs;
2355 if (!gimple_assign_single_p (gs))
2356 return false;
2357 rhs = gimple_assign_rhs1 (gs);
2358 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2359 return true;
2360 rhs = get_base_address (rhs);
2361 return (DECL_P (rhs)
2362 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2366 /* Return true if S is a type-cast assignment. */
2368 static inline bool
2369 gimple_assign_cast_p (gimple s)
2371 if (is_gimple_assign (s))
2373 enum tree_code sc = gimple_assign_rhs_code (s);
2374 return CONVERT_EXPR_CODE_P (sc)
2375 || sc == VIEW_CONVERT_EXPR
2376 || sc == FIX_TRUNC_EXPR;
2379 return false;
2382 /* Return true if S is a clobber statement. */
2384 static inline bool
2385 gimple_clobber_p (gimple s)
2387 return gimple_assign_single_p (s)
2388 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2391 /* Return true if GS is a GIMPLE_CALL. */
2393 static inline bool
2394 is_gimple_call (const_gimple gs)
2396 return gimple_code (gs) == GIMPLE_CALL;
2399 /* Return the LHS of call statement GS. */
2401 static inline tree
2402 gimple_call_lhs (const_gimple gs)
2404 GIMPLE_CHECK (gs, GIMPLE_CALL);
2405 return gimple_op (gs, 0);
2409 /* Return a pointer to the LHS of call statement GS. */
2411 static inline tree *
2412 gimple_call_lhs_ptr (const_gimple gs)
2414 GIMPLE_CHECK (gs, GIMPLE_CALL);
2415 return gimple_op_ptr (gs, 0);
2419 /* Set LHS to be the LHS operand of call statement GS. */
2421 static inline void
2422 gimple_call_set_lhs (gimple gs, tree lhs)
2424 GIMPLE_CHECK (gs, GIMPLE_CALL);
2425 gimple_set_op (gs, 0, lhs);
2426 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2427 SSA_NAME_DEF_STMT (lhs) = gs;
2431 /* Return true if call GS calls an internal-only function, as enumerated
2432 by internal_fn. */
2434 static inline bool
2435 gimple_call_internal_p (const_gimple gs)
2437 GIMPLE_CHECK (gs, GIMPLE_CALL);
2438 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2442 /* Return the target of internal call GS. */
2444 static inline enum internal_fn
2445 gimple_call_internal_fn (const_gimple gs)
2447 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2448 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2451 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2452 that could alter control flow. */
2454 static inline void
2455 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2457 GIMPLE_CHECK (s, GIMPLE_CALL);
2458 if (ctrl_altering_p)
2459 s->subcode |= GF_CALL_CTRL_ALTERING;
2460 else
2461 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2464 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2465 flag is set. Such call could not be a stmt in the middle of a bb. */
2467 static inline bool
2468 gimple_call_ctrl_altering_p (const_gimple gs)
2470 GIMPLE_CHECK (gs, GIMPLE_CALL);
2471 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2475 /* Return the function type of the function called by GS. */
2477 static inline tree
2478 gimple_call_fntype (const_gimple gs)
2480 const gimple_statement_call *call_stmt =
2481 as_a <const gimple_statement_call> (gs);
2482 if (gimple_call_internal_p (gs))
2483 return NULL_TREE;
2484 return call_stmt->u.fntype;
2487 /* Set the type of the function called by GS to FNTYPE. */
2489 static inline void
2490 gimple_call_set_fntype (gimple gs, tree fntype)
2492 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2493 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2494 call_stmt->u.fntype = fntype;
2498 /* Return the tree node representing the function called by call
2499 statement GS. */
2501 static inline tree
2502 gimple_call_fn (const_gimple gs)
2504 GIMPLE_CHECK (gs, GIMPLE_CALL);
2505 return gimple_op (gs, 1);
2508 /* Return a pointer to the tree node representing the function called by call
2509 statement GS. */
2511 static inline tree *
2512 gimple_call_fn_ptr (const_gimple gs)
2514 GIMPLE_CHECK (gs, GIMPLE_CALL);
2515 return gimple_op_ptr (gs, 1);
2519 /* Set FN to be the function called by call statement GS. */
2521 static inline void
2522 gimple_call_set_fn (gimple gs, tree fn)
2524 GIMPLE_CHECK (gs, GIMPLE_CALL);
2525 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2526 gimple_set_op (gs, 1, fn);
2530 /* Set FNDECL to be the function called by call statement GS. */
2532 static inline void
2533 gimple_call_set_fndecl (gimple gs, tree decl)
2535 GIMPLE_CHECK (gs, GIMPLE_CALL);
2536 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2537 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2541 /* Set internal function FN to be the function called by call statement GS. */
2543 static inline void
2544 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2546 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2547 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2548 call_stmt->u.internal_fn = fn;
2552 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2553 Otherwise return NULL. This function is analogous to
2554 get_callee_fndecl in tree land. */
2556 static inline tree
2557 gimple_call_fndecl (const_gimple gs)
2559 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2563 /* Return the type returned by call statement GS. */
2565 static inline tree
2566 gimple_call_return_type (const_gimple gs)
2568 tree type = gimple_call_fntype (gs);
2570 if (type == NULL_TREE)
2571 return TREE_TYPE (gimple_call_lhs (gs));
2573 /* The type returned by a function is the type of its
2574 function type. */
2575 return TREE_TYPE (type);
2579 /* Return the static chain for call statement GS. */
2581 static inline tree
2582 gimple_call_chain (const_gimple gs)
2584 GIMPLE_CHECK (gs, GIMPLE_CALL);
2585 return gimple_op (gs, 2);
2589 /* Return a pointer to the static chain for call statement GS. */
2591 static inline tree *
2592 gimple_call_chain_ptr (const_gimple gs)
2594 GIMPLE_CHECK (gs, GIMPLE_CALL);
2595 return gimple_op_ptr (gs, 2);
2598 /* Set CHAIN to be the static chain for call statement GS. */
2600 static inline void
2601 gimple_call_set_chain (gimple gs, tree chain)
2603 GIMPLE_CHECK (gs, GIMPLE_CALL);
2605 gimple_set_op (gs, 2, chain);
2609 /* Return the number of arguments used by call statement GS. */
2611 static inline unsigned
2612 gimple_call_num_args (const_gimple gs)
2614 unsigned num_ops;
2615 GIMPLE_CHECK (gs, GIMPLE_CALL);
2616 num_ops = gimple_num_ops (gs);
2617 return num_ops - 3;
2621 /* Return the argument at position INDEX for call statement GS. */
2623 static inline tree
2624 gimple_call_arg (const_gimple gs, unsigned index)
2626 GIMPLE_CHECK (gs, GIMPLE_CALL);
2627 return gimple_op (gs, index + 3);
2631 /* Return a pointer to the argument at position INDEX for call
2632 statement GS. */
2634 static inline tree *
2635 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2637 GIMPLE_CHECK (gs, GIMPLE_CALL);
2638 return gimple_op_ptr (gs, index + 3);
2642 /* Set ARG to be the argument at position INDEX for call statement GS. */
2644 static inline void
2645 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2647 GIMPLE_CHECK (gs, GIMPLE_CALL);
2648 gimple_set_op (gs, index + 3, arg);
2652 /* If TAIL_P is true, mark call statement S as being a tail call
2653 (i.e., a call just before the exit of a function). These calls are
2654 candidate for tail call optimization. */
2656 static inline void
2657 gimple_call_set_tail (gimple s, bool tail_p)
2659 GIMPLE_CHECK (s, GIMPLE_CALL);
2660 if (tail_p)
2661 s->subcode |= GF_CALL_TAILCALL;
2662 else
2663 s->subcode &= ~GF_CALL_TAILCALL;
2667 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2669 static inline bool
2670 gimple_call_tail_p (gimple s)
2672 GIMPLE_CHECK (s, GIMPLE_CALL);
2673 return (s->subcode & GF_CALL_TAILCALL) != 0;
2677 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2678 slot optimization. This transformation uses the target of the call
2679 expansion as the return slot for calls that return in memory. */
2681 static inline void
2682 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2684 GIMPLE_CHECK (s, GIMPLE_CALL);
2685 if (return_slot_opt_p)
2686 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2687 else
2688 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2692 /* Return true if S is marked for return slot optimization. */
2694 static inline bool
2695 gimple_call_return_slot_opt_p (gimple s)
2697 GIMPLE_CHECK (s, GIMPLE_CALL);
2698 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2702 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2703 thunk to the thunked-to function. */
2705 static inline void
2706 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2708 GIMPLE_CHECK (s, GIMPLE_CALL);
2709 if (from_thunk_p)
2710 s->subcode |= GF_CALL_FROM_THUNK;
2711 else
2712 s->subcode &= ~GF_CALL_FROM_THUNK;
2716 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2718 static inline bool
2719 gimple_call_from_thunk_p (gimple s)
2721 GIMPLE_CHECK (s, GIMPLE_CALL);
2722 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2726 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2727 argument pack in its argument list. */
2729 static inline void
2730 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2732 GIMPLE_CHECK (s, GIMPLE_CALL);
2733 if (pass_arg_pack_p)
2734 s->subcode |= GF_CALL_VA_ARG_PACK;
2735 else
2736 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2740 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2741 argument pack in its argument list. */
2743 static inline bool
2744 gimple_call_va_arg_pack_p (gimple s)
2746 GIMPLE_CHECK (s, GIMPLE_CALL);
2747 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2751 /* Return true if S is a noreturn call. */
2753 static inline bool
2754 gimple_call_noreturn_p (gimple s)
2756 GIMPLE_CHECK (s, GIMPLE_CALL);
2757 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2761 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2762 even if the called function can throw in other cases. */
2764 static inline void
2765 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2767 GIMPLE_CHECK (s, GIMPLE_CALL);
2768 if (nothrow_p)
2769 s->subcode |= GF_CALL_NOTHROW;
2770 else
2771 s->subcode &= ~GF_CALL_NOTHROW;
2774 /* Return true if S is a nothrow call. */
2776 static inline bool
2777 gimple_call_nothrow_p (gimple s)
2779 GIMPLE_CHECK (s, GIMPLE_CALL);
2780 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2783 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2784 is known to be emitted for VLA objects. Those are wrapped by
2785 stack_save/stack_restore calls and hence can't lead to unbounded
2786 stack growth even when they occur in loops. */
2788 static inline void
2789 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2791 GIMPLE_CHECK (s, GIMPLE_CALL);
2792 if (for_var)
2793 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2794 else
2795 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2798 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2800 static inline bool
2801 gimple_call_alloca_for_var_p (gimple s)
2803 GIMPLE_CHECK (s, GIMPLE_CALL);
2804 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2807 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2809 static inline void
2810 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2812 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2813 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2814 dest_call->subcode = orig_call->subcode;
2818 /* Return a pointer to the points-to solution for the set of call-used
2819 variables of the call CALL. */
2821 static inline struct pt_solution *
2822 gimple_call_use_set (gimple call)
2824 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2825 return &call_stmt->call_used;
2829 /* Return a pointer to the points-to solution for the set of call-used
2830 variables of the call CALL. */
2832 static inline struct pt_solution *
2833 gimple_call_clobber_set (gimple call)
2835 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2836 return &call_stmt->call_clobbered;
2840 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2841 non-NULL lhs. */
2843 static inline bool
2844 gimple_has_lhs (gimple stmt)
2846 return (is_gimple_assign (stmt)
2847 || (is_gimple_call (stmt)
2848 && gimple_call_lhs (stmt) != NULL_TREE));
2852 /* Return the code of the predicate computed by conditional statement GS. */
2854 static inline enum tree_code
2855 gimple_cond_code (const_gimple gs)
2857 GIMPLE_CHECK (gs, GIMPLE_COND);
2858 return (enum tree_code) gs->subcode;
2862 /* Set CODE to be the predicate code for the conditional statement GS. */
2864 static inline void
2865 gimple_cond_set_code (gimple gs, enum tree_code code)
2867 GIMPLE_CHECK (gs, GIMPLE_COND);
2868 gs->subcode = code;
2872 /* Return the LHS of the predicate computed by conditional statement GS. */
2874 static inline tree
2875 gimple_cond_lhs (const_gimple gs)
2877 GIMPLE_CHECK (gs, GIMPLE_COND);
2878 return gimple_op (gs, 0);
2881 /* Return the pointer to the LHS of the predicate computed by conditional
2882 statement GS. */
2884 static inline tree *
2885 gimple_cond_lhs_ptr (const_gimple gs)
2887 GIMPLE_CHECK (gs, GIMPLE_COND);
2888 return gimple_op_ptr (gs, 0);
2891 /* Set LHS to be the LHS operand of the predicate computed by
2892 conditional statement GS. */
2894 static inline void
2895 gimple_cond_set_lhs (gimple gs, tree lhs)
2897 GIMPLE_CHECK (gs, GIMPLE_COND);
2898 gimple_set_op (gs, 0, lhs);
2902 /* Return the RHS operand of the predicate computed by conditional GS. */
2904 static inline tree
2905 gimple_cond_rhs (const_gimple gs)
2907 GIMPLE_CHECK (gs, GIMPLE_COND);
2908 return gimple_op (gs, 1);
2911 /* Return the pointer to the RHS operand of the predicate computed by
2912 conditional GS. */
2914 static inline tree *
2915 gimple_cond_rhs_ptr (const_gimple gs)
2917 GIMPLE_CHECK (gs, GIMPLE_COND);
2918 return gimple_op_ptr (gs, 1);
2922 /* Set RHS to be the RHS operand of the predicate computed by
2923 conditional statement GS. */
2925 static inline void
2926 gimple_cond_set_rhs (gimple gs, tree rhs)
2928 GIMPLE_CHECK (gs, GIMPLE_COND);
2929 gimple_set_op (gs, 1, rhs);
2933 /* Return the label used by conditional statement GS when its
2934 predicate evaluates to true. */
2936 static inline tree
2937 gimple_cond_true_label (const_gimple gs)
2939 GIMPLE_CHECK (gs, GIMPLE_COND);
2940 return gimple_op (gs, 2);
2944 /* Set LABEL to be the label used by conditional statement GS when its
2945 predicate evaluates to true. */
2947 static inline void
2948 gimple_cond_set_true_label (gimple gs, tree label)
2950 GIMPLE_CHECK (gs, GIMPLE_COND);
2951 gimple_set_op (gs, 2, label);
2955 /* Set LABEL to be the label used by conditional statement GS when its
2956 predicate evaluates to false. */
2958 static inline void
2959 gimple_cond_set_false_label (gimple gs, tree label)
2961 GIMPLE_CHECK (gs, GIMPLE_COND);
2962 gimple_set_op (gs, 3, label);
2966 /* Return the label used by conditional statement GS when its
2967 predicate evaluates to false. */
2969 static inline tree
2970 gimple_cond_false_label (const_gimple gs)
2972 GIMPLE_CHECK (gs, GIMPLE_COND);
2973 return gimple_op (gs, 3);
2977 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2979 static inline void
2980 gimple_cond_make_false (gimple gs)
2982 gimple_cond_set_lhs (gs, boolean_true_node);
2983 gimple_cond_set_rhs (gs, boolean_false_node);
2984 gs->subcode = EQ_EXPR;
2988 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2990 static inline void
2991 gimple_cond_make_true (gimple gs)
2993 gimple_cond_set_lhs (gs, boolean_true_node);
2994 gimple_cond_set_rhs (gs, boolean_true_node);
2995 gs->subcode = EQ_EXPR;
2998 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2999 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3001 static inline bool
3002 gimple_cond_true_p (const_gimple gs)
3004 tree lhs = gimple_cond_lhs (gs);
3005 tree rhs = gimple_cond_rhs (gs);
3006 enum tree_code code = gimple_cond_code (gs);
3008 if (lhs != boolean_true_node && lhs != boolean_false_node)
3009 return false;
3011 if (rhs != boolean_true_node && rhs != boolean_false_node)
3012 return false;
3014 if (code == NE_EXPR && lhs != rhs)
3015 return true;
3017 if (code == EQ_EXPR && lhs == rhs)
3018 return true;
3020 return false;
3023 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3024 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3026 static inline bool
3027 gimple_cond_false_p (const_gimple gs)
3029 tree lhs = gimple_cond_lhs (gs);
3030 tree rhs = gimple_cond_rhs (gs);
3031 enum tree_code code = gimple_cond_code (gs);
3033 if (lhs != boolean_true_node && lhs != boolean_false_node)
3034 return false;
3036 if (rhs != boolean_true_node && rhs != boolean_false_node)
3037 return false;
3039 if (code == NE_EXPR && lhs == rhs)
3040 return true;
3042 if (code == EQ_EXPR && lhs != rhs)
3043 return true;
3045 return false;
3048 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3050 static inline void
3051 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3053 gimple_cond_set_code (stmt, code);
3054 gimple_cond_set_lhs (stmt, lhs);
3055 gimple_cond_set_rhs (stmt, rhs);
3058 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3060 static inline tree
3061 gimple_label_label (const_gimple gs)
3063 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3064 return gimple_op (gs, 0);
3068 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3069 GS. */
3071 static inline void
3072 gimple_label_set_label (gimple gs, tree label)
3074 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3075 gimple_set_op (gs, 0, label);
3079 /* Return the destination of the unconditional jump GS. */
3081 static inline tree
3082 gimple_goto_dest (const_gimple gs)
3084 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3085 return gimple_op (gs, 0);
3089 /* Set DEST to be the destination of the unconditonal jump GS. */
3091 static inline void
3092 gimple_goto_set_dest (gimple gs, tree dest)
3094 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3095 gimple_set_op (gs, 0, dest);
3099 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3101 static inline tree
3102 gimple_bind_vars (const_gimple gs)
3104 const gimple_statement_bind *bind_stmt =
3105 as_a <const gimple_statement_bind> (gs);
3106 return bind_stmt->vars;
3110 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3111 statement GS. */
3113 static inline void
3114 gimple_bind_set_vars (gimple gs, tree vars)
3116 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3117 bind_stmt->vars = vars;
3121 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3122 statement GS. */
3124 static inline void
3125 gimple_bind_append_vars (gimple gs, tree vars)
3127 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3128 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3132 static inline gimple_seq *
3133 gimple_bind_body_ptr (gimple gs)
3135 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3136 return &bind_stmt->body;
3139 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3141 static inline gimple_seq
3142 gimple_bind_body (gimple gs)
3144 return *gimple_bind_body_ptr (gs);
3148 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3149 statement GS. */
3151 static inline void
3152 gimple_bind_set_body (gimple gs, gimple_seq seq)
3154 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3155 bind_stmt->body = seq;
3159 /* Append a statement to the end of a GIMPLE_BIND's body. */
3161 static inline void
3162 gimple_bind_add_stmt (gimple gs, gimple stmt)
3164 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3165 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3169 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3171 static inline void
3172 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3174 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3175 gimple_seq_add_seq (&bind_stmt->body, seq);
3179 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3180 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3182 static inline tree
3183 gimple_bind_block (const_gimple gs)
3185 const gimple_statement_bind *bind_stmt =
3186 as_a <const gimple_statement_bind> (gs);
3187 return bind_stmt->block;
3191 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3192 statement GS. */
3194 static inline void
3195 gimple_bind_set_block (gimple gs, tree block)
3197 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3198 gcc_gimple_checking_assert (block == NULL_TREE
3199 || TREE_CODE (block) == BLOCK);
3200 bind_stmt->block = block;
3204 /* Return the number of input operands for GIMPLE_ASM GS. */
3206 static inline unsigned
3207 gimple_asm_ninputs (const_gimple gs)
3209 const gimple_statement_asm *asm_stmt =
3210 as_a <const gimple_statement_asm> (gs);
3211 return asm_stmt->ni;
3215 /* Return the number of output operands for GIMPLE_ASM GS. */
3217 static inline unsigned
3218 gimple_asm_noutputs (const_gimple gs)
3220 const gimple_statement_asm *asm_stmt =
3221 as_a <const gimple_statement_asm> (gs);
3222 return asm_stmt->no;
3226 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3228 static inline unsigned
3229 gimple_asm_nclobbers (const_gimple gs)
3231 const gimple_statement_asm *asm_stmt =
3232 as_a <const gimple_statement_asm> (gs);
3233 return asm_stmt->nc;
3236 /* Return the number of label operands for GIMPLE_ASM GS. */
3238 static inline unsigned
3239 gimple_asm_nlabels (const_gimple gs)
3241 const gimple_statement_asm *asm_stmt =
3242 as_a <const gimple_statement_asm> (gs);
3243 return asm_stmt->nl;
3246 /* Return input operand INDEX of GIMPLE_ASM GS. */
3248 static inline tree
3249 gimple_asm_input_op (const_gimple gs, unsigned index)
3251 const gimple_statement_asm *asm_stmt =
3252 as_a <const gimple_statement_asm> (gs);
3253 gcc_gimple_checking_assert (index < asm_stmt->ni);
3254 return gimple_op (gs, index + asm_stmt->no);
3257 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3259 static inline tree *
3260 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3262 const gimple_statement_asm *asm_stmt =
3263 as_a <const gimple_statement_asm> (gs);
3264 gcc_gimple_checking_assert (index < asm_stmt->ni);
3265 return gimple_op_ptr (gs, index + asm_stmt->no);
3269 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3271 static inline void
3272 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3274 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3275 gcc_gimple_checking_assert (index < asm_stmt->ni
3276 && TREE_CODE (in_op) == TREE_LIST);
3277 gimple_set_op (gs, index + asm_stmt->no, in_op);
3281 /* Return output operand INDEX of GIMPLE_ASM GS. */
3283 static inline tree
3284 gimple_asm_output_op (const_gimple gs, unsigned index)
3286 const gimple_statement_asm *asm_stmt =
3287 as_a <const gimple_statement_asm> (gs);
3288 gcc_gimple_checking_assert (index < asm_stmt->no);
3289 return gimple_op (gs, index);
3292 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3294 static inline tree *
3295 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3297 const gimple_statement_asm *asm_stmt =
3298 as_a <const gimple_statement_asm> (gs);
3299 gcc_gimple_checking_assert (index < asm_stmt->no);
3300 return gimple_op_ptr (gs, index);
3304 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3306 static inline void
3307 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3309 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3310 gcc_gimple_checking_assert (index < asm_stmt->no
3311 && TREE_CODE (out_op) == TREE_LIST);
3312 gimple_set_op (gs, index, out_op);
3316 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3318 static inline tree
3319 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3321 const gimple_statement_asm *asm_stmt =
3322 as_a <const gimple_statement_asm> (gs);
3323 gcc_gimple_checking_assert (index < asm_stmt->nc);
3324 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3328 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3330 static inline void
3331 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3333 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3334 gcc_gimple_checking_assert (index < asm_stmt->nc
3335 && TREE_CODE (clobber_op) == TREE_LIST);
3336 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3339 /* Return label operand INDEX of GIMPLE_ASM GS. */
3341 static inline tree
3342 gimple_asm_label_op (const_gimple gs, unsigned index)
3344 const gimple_statement_asm *asm_stmt =
3345 as_a <const gimple_statement_asm> (gs);
3346 gcc_gimple_checking_assert (index < asm_stmt->nl);
3347 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3350 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3352 static inline void
3353 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3355 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3356 gcc_gimple_checking_assert (index < asm_stmt->nl
3357 && TREE_CODE (label_op) == TREE_LIST);
3358 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3361 /* Return the string representing the assembly instruction in
3362 GIMPLE_ASM GS. */
3364 static inline const char *
3365 gimple_asm_string (const_gimple gs)
3367 const gimple_statement_asm *asm_stmt =
3368 as_a <const gimple_statement_asm> (gs);
3369 return asm_stmt->string;
3373 /* Return true if GS is an asm statement marked volatile. */
3375 static inline bool
3376 gimple_asm_volatile_p (const_gimple gs)
3378 GIMPLE_CHECK (gs, GIMPLE_ASM);
3379 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3383 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3385 static inline void
3386 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3388 GIMPLE_CHECK (gs, GIMPLE_ASM);
3389 if (volatile_p)
3390 gs->subcode |= GF_ASM_VOLATILE;
3391 else
3392 gs->subcode &= ~GF_ASM_VOLATILE;
3396 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3398 static inline void
3399 gimple_asm_set_input (gimple gs, bool input_p)
3401 GIMPLE_CHECK (gs, GIMPLE_ASM);
3402 if (input_p)
3403 gs->subcode |= GF_ASM_INPUT;
3404 else
3405 gs->subcode &= ~GF_ASM_INPUT;
3409 /* Return true if asm GS is an ASM_INPUT. */
3411 static inline bool
3412 gimple_asm_input_p (const_gimple gs)
3414 GIMPLE_CHECK (gs, GIMPLE_ASM);
3415 return (gs->subcode & GF_ASM_INPUT) != 0;
3419 /* Return the types handled by GIMPLE_CATCH statement GS. */
3421 static inline tree
3422 gimple_catch_types (const_gimple gs)
3424 const gimple_statement_catch *catch_stmt =
3425 as_a <const gimple_statement_catch> (gs);
3426 return catch_stmt->types;
3430 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3432 static inline tree *
3433 gimple_catch_types_ptr (gimple gs)
3435 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3436 return &catch_stmt->types;
3440 /* Return a pointer to the GIMPLE sequence representing the body of
3441 the handler of GIMPLE_CATCH statement GS. */
3443 static inline gimple_seq *
3444 gimple_catch_handler_ptr (gimple gs)
3446 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3447 return &catch_stmt->handler;
3451 /* Return the GIMPLE sequence representing the body of the handler of
3452 GIMPLE_CATCH statement GS. */
3454 static inline gimple_seq
3455 gimple_catch_handler (gimple gs)
3457 return *gimple_catch_handler_ptr (gs);
3461 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3463 static inline void
3464 gimple_catch_set_types (gimple gs, tree t)
3466 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3467 catch_stmt->types = t;
3471 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3473 static inline void
3474 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3476 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3477 catch_stmt->handler = handler;
3481 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3483 static inline tree
3484 gimple_eh_filter_types (const_gimple gs)
3486 const gimple_statement_eh_filter *eh_filter_stmt =
3487 as_a <const gimple_statement_eh_filter> (gs);
3488 return eh_filter_stmt->types;
3492 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3493 GS. */
3495 static inline tree *
3496 gimple_eh_filter_types_ptr (gimple gs)
3498 gimple_statement_eh_filter *eh_filter_stmt =
3499 as_a <gimple_statement_eh_filter> (gs);
3500 return &eh_filter_stmt->types;
3504 /* Return a pointer to the sequence of statement to execute when
3505 GIMPLE_EH_FILTER statement fails. */
3507 static inline gimple_seq *
3508 gimple_eh_filter_failure_ptr (gimple gs)
3510 gimple_statement_eh_filter *eh_filter_stmt =
3511 as_a <gimple_statement_eh_filter> (gs);
3512 return &eh_filter_stmt->failure;
3516 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3517 statement fails. */
3519 static inline gimple_seq
3520 gimple_eh_filter_failure (gimple gs)
3522 return *gimple_eh_filter_failure_ptr (gs);
3526 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3528 static inline void
3529 gimple_eh_filter_set_types (gimple gs, tree types)
3531 gimple_statement_eh_filter *eh_filter_stmt =
3532 as_a <gimple_statement_eh_filter> (gs);
3533 eh_filter_stmt->types = types;
3537 /* Set FAILURE to be the sequence of statements to execute on failure
3538 for GIMPLE_EH_FILTER GS. */
3540 static inline void
3541 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3543 gimple_statement_eh_filter *eh_filter_stmt =
3544 as_a <gimple_statement_eh_filter> (gs);
3545 eh_filter_stmt->failure = failure;
3548 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3550 static inline tree
3551 gimple_eh_must_not_throw_fndecl (gimple gs)
3553 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3554 return eh_mnt_stmt->fndecl;
3557 /* Set the function decl to be called by GS to DECL. */
3559 static inline void
3560 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3562 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3563 eh_mnt_stmt->fndecl = decl;
3566 /* GIMPLE_EH_ELSE accessors. */
3568 static inline gimple_seq *
3569 gimple_eh_else_n_body_ptr (gimple gs)
3571 gimple_statement_eh_else *eh_else_stmt =
3572 as_a <gimple_statement_eh_else> (gs);
3573 return &eh_else_stmt->n_body;
3576 static inline gimple_seq
3577 gimple_eh_else_n_body (gimple gs)
3579 return *gimple_eh_else_n_body_ptr (gs);
3582 static inline gimple_seq *
3583 gimple_eh_else_e_body_ptr (gimple gs)
3585 gimple_statement_eh_else *eh_else_stmt =
3586 as_a <gimple_statement_eh_else> (gs);
3587 return &eh_else_stmt->e_body;
3590 static inline gimple_seq
3591 gimple_eh_else_e_body (gimple gs)
3593 return *gimple_eh_else_e_body_ptr (gs);
3596 static inline void
3597 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3599 gimple_statement_eh_else *eh_else_stmt =
3600 as_a <gimple_statement_eh_else> (gs);
3601 eh_else_stmt->n_body = seq;
3604 static inline void
3605 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3607 gimple_statement_eh_else *eh_else_stmt =
3608 as_a <gimple_statement_eh_else> (gs);
3609 eh_else_stmt->e_body = seq;
3612 /* GIMPLE_TRY accessors. */
3614 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3615 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3617 static inline enum gimple_try_flags
3618 gimple_try_kind (const_gimple gs)
3620 GIMPLE_CHECK (gs, GIMPLE_TRY);
3621 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3625 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3627 static inline void
3628 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3630 GIMPLE_CHECK (gs, GIMPLE_TRY);
3631 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3632 || kind == GIMPLE_TRY_FINALLY);
3633 if (gimple_try_kind (gs) != kind)
3634 gs->subcode = (unsigned int) kind;
3638 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3640 static inline bool
3641 gimple_try_catch_is_cleanup (const_gimple gs)
3643 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3644 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3648 /* Return a pointer to the sequence of statements used as the
3649 body for GIMPLE_TRY GS. */
3651 static inline gimple_seq *
3652 gimple_try_eval_ptr (gimple gs)
3654 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3655 return &try_stmt->eval;
3659 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3661 static inline gimple_seq
3662 gimple_try_eval (gimple gs)
3664 return *gimple_try_eval_ptr (gs);
3668 /* Return a pointer to the sequence of statements used as the cleanup body for
3669 GIMPLE_TRY GS. */
3671 static inline gimple_seq *
3672 gimple_try_cleanup_ptr (gimple gs)
3674 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3675 return &try_stmt->cleanup;
3679 /* Return the sequence of statements used as the cleanup body for
3680 GIMPLE_TRY GS. */
3682 static inline gimple_seq
3683 gimple_try_cleanup (gimple gs)
3685 return *gimple_try_cleanup_ptr (gs);
3689 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3691 static inline void
3692 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3694 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3695 if (catch_is_cleanup)
3696 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3697 else
3698 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3702 /* Set EVAL to be the sequence of statements to use as the body for
3703 GIMPLE_TRY GS. */
3705 static inline void
3706 gimple_try_set_eval (gimple gs, gimple_seq eval)
3708 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3709 try_stmt->eval = eval;
3713 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3714 body for GIMPLE_TRY GS. */
3716 static inline void
3717 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3719 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3720 try_stmt->cleanup = cleanup;
3724 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3726 static inline gimple_seq *
3727 gimple_wce_cleanup_ptr (gimple gs)
3729 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3730 return &wce_stmt->cleanup;
3734 /* Return the cleanup sequence for cleanup statement GS. */
3736 static inline gimple_seq
3737 gimple_wce_cleanup (gimple gs)
3739 return *gimple_wce_cleanup_ptr (gs);
3743 /* Set CLEANUP to be the cleanup sequence for GS. */
3745 static inline void
3746 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3748 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3749 wce_stmt->cleanup = cleanup;
3753 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3755 static inline bool
3756 gimple_wce_cleanup_eh_only (const_gimple gs)
3758 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3759 return gs->subcode != 0;
3763 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3765 static inline void
3766 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3768 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3769 gs->subcode = (unsigned int) eh_only_p;
3773 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3775 static inline unsigned
3776 gimple_phi_capacity (const_gimple gs)
3778 const gimple_statement_phi *phi_stmt =
3779 as_a <const gimple_statement_phi> (gs);
3780 return phi_stmt->capacity;
3784 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3785 be exactly the number of incoming edges for the basic block holding
3786 GS. */
3788 static inline unsigned
3789 gimple_phi_num_args (const_gimple gs)
3791 const gimple_statement_phi *phi_stmt =
3792 as_a <const gimple_statement_phi> (gs);
3793 return phi_stmt->nargs;
3797 /* Return the SSA name created by GIMPLE_PHI GS. */
3799 static inline tree
3800 gimple_phi_result (const_gimple gs)
3802 const gimple_statement_phi *phi_stmt =
3803 as_a <const gimple_statement_phi> (gs);
3804 return phi_stmt->result;
3807 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3809 static inline tree *
3810 gimple_phi_result_ptr (gimple gs)
3812 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3813 return &phi_stmt->result;
3816 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3818 static inline void
3819 gimple_phi_set_result (gimple gs, tree result)
3821 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3822 phi_stmt->result = result;
3823 if (result && TREE_CODE (result) == SSA_NAME)
3824 SSA_NAME_DEF_STMT (result) = gs;
3828 /* Return the PHI argument corresponding to incoming edge INDEX for
3829 GIMPLE_PHI GS. */
3831 static inline struct phi_arg_d *
3832 gimple_phi_arg (gimple gs, unsigned index)
3834 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3835 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3836 return &(phi_stmt->args[index]);
3839 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3840 for GIMPLE_PHI GS. */
3842 static inline void
3843 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3845 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3846 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3847 phi_stmt->args[index] = *phiarg;
3850 /* Return the PHI nodes for basic block BB, or NULL if there are no
3851 PHI nodes. */
3853 static inline gimple_seq
3854 phi_nodes (const_basic_block bb)
3856 gcc_checking_assert (!(bb->flags & BB_RTL));
3857 return bb->il.gimple.phi_nodes;
3860 /* Return a pointer to the PHI nodes for basic block BB. */
3862 static inline gimple_seq *
3863 phi_nodes_ptr (basic_block bb)
3865 gcc_checking_assert (!(bb->flags & BB_RTL));
3866 return &bb->il.gimple.phi_nodes;
3869 /* Return the tree operand for argument I of PHI node GS. */
3871 static inline tree
3872 gimple_phi_arg_def (gimple gs, size_t index)
3874 return gimple_phi_arg (gs, index)->def;
3878 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3880 static inline tree *
3881 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3883 return &gimple_phi_arg (gs, index)->def;
3886 /* Return the edge associated with argument I of phi node GS. */
3888 static inline edge
3889 gimple_phi_arg_edge (gimple gs, size_t i)
3891 return EDGE_PRED (gimple_bb (gs), i);
3894 /* Return the source location of gimple argument I of phi node GS. */
3896 static inline source_location
3897 gimple_phi_arg_location (gimple gs, size_t i)
3899 return gimple_phi_arg (gs, i)->locus;
3902 /* Return the source location of the argument on edge E of phi node GS. */
3904 static inline source_location
3905 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3907 return gimple_phi_arg (gs, e->dest_idx)->locus;
3910 /* Set the source location of gimple argument I of phi node GS to LOC. */
3912 static inline void
3913 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3915 gimple_phi_arg (gs, i)->locus = loc;
3918 /* Return TRUE if argument I of phi node GS has a location record. */
3920 static inline bool
3921 gimple_phi_arg_has_location (gimple gs, size_t i)
3923 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3927 /* Return the region number for GIMPLE_RESX GS. */
3929 static inline int
3930 gimple_resx_region (const_gimple gs)
3932 const gimple_statement_resx *resx_stmt =
3933 as_a <const gimple_statement_resx> (gs);
3934 return resx_stmt->region;
3937 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3939 static inline void
3940 gimple_resx_set_region (gimple gs, int region)
3942 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx> (gs);
3943 resx_stmt->region = region;
3946 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3948 static inline int
3949 gimple_eh_dispatch_region (const_gimple gs)
3951 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3952 as_a <const gimple_statement_eh_dispatch> (gs);
3953 return eh_dispatch_stmt->region;
3956 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3958 static inline void
3959 gimple_eh_dispatch_set_region (gimple gs, int region)
3961 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3962 as_a <gimple_statement_eh_dispatch> (gs);
3963 eh_dispatch_stmt->region = region;
3966 /* Return the number of labels associated with the switch statement GS. */
3968 static inline unsigned
3969 gimple_switch_num_labels (const_gimple gs)
3971 unsigned num_ops;
3972 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3973 num_ops = gimple_num_ops (gs);
3974 gcc_gimple_checking_assert (num_ops > 1);
3975 return num_ops - 1;
3979 /* Set NLABELS to be the number of labels for the switch statement GS. */
3981 static inline void
3982 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3984 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3985 gimple_set_num_ops (g, nlabels + 1);
3989 /* Return the index variable used by the switch statement GS. */
3991 static inline tree
3992 gimple_switch_index (const_gimple gs)
3994 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3995 return gimple_op (gs, 0);
3999 /* Return a pointer to the index variable for the switch statement GS. */
4001 static inline tree *
4002 gimple_switch_index_ptr (const_gimple gs)
4004 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4005 return gimple_op_ptr (gs, 0);
4009 /* Set INDEX to be the index variable for switch statement GS. */
4011 static inline void
4012 gimple_switch_set_index (gimple gs, tree index)
4014 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4015 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4016 gimple_set_op (gs, 0, index);
4020 /* Return the label numbered INDEX. The default label is 0, followed by any
4021 labels in a switch statement. */
4023 static inline tree
4024 gimple_switch_label (const_gimple gs, unsigned index)
4026 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4027 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4028 return gimple_op (gs, index + 1);
4031 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4033 static inline void
4034 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4036 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4037 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4038 && (label == NULL_TREE
4039 || TREE_CODE (label) == CASE_LABEL_EXPR));
4040 gimple_set_op (gs, index + 1, label);
4043 /* Return the default label for a switch statement. */
4045 static inline tree
4046 gimple_switch_default_label (const_gimple gs)
4048 tree label = gimple_switch_label (gs, 0);
4049 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4050 return label;
4053 /* Set the default label for a switch statement. */
4055 static inline void
4056 gimple_switch_set_default_label (gimple gs, tree label)
4058 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4059 gimple_switch_set_label (gs, 0, label);
4062 /* Return true if GS is a GIMPLE_DEBUG statement. */
4064 static inline bool
4065 is_gimple_debug (const_gimple gs)
4067 return gimple_code (gs) == GIMPLE_DEBUG;
4070 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4072 static inline bool
4073 gimple_debug_bind_p (const_gimple s)
4075 if (is_gimple_debug (s))
4076 return s->subcode == GIMPLE_DEBUG_BIND;
4078 return false;
4081 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4083 static inline tree
4084 gimple_debug_bind_get_var (gimple dbg)
4086 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4087 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4088 return gimple_op (dbg, 0);
4091 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4092 statement. */
4094 static inline tree
4095 gimple_debug_bind_get_value (gimple dbg)
4097 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4098 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4099 return gimple_op (dbg, 1);
4102 /* Return a pointer to the value bound to the variable in a
4103 GIMPLE_DEBUG bind statement. */
4105 static inline tree *
4106 gimple_debug_bind_get_value_ptr (gimple dbg)
4108 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4109 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4110 return gimple_op_ptr (dbg, 1);
4113 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4115 static inline void
4116 gimple_debug_bind_set_var (gimple dbg, tree var)
4118 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4119 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4120 gimple_set_op (dbg, 0, var);
4123 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4124 statement. */
4126 static inline void
4127 gimple_debug_bind_set_value (gimple dbg, tree value)
4129 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4130 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4131 gimple_set_op (dbg, 1, value);
4134 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4135 optimized away. */
4136 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4138 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4139 statement. */
4141 static inline void
4142 gimple_debug_bind_reset_value (gimple dbg)
4144 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4145 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4146 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4149 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4150 value. */
4152 static inline bool
4153 gimple_debug_bind_has_value_p (gimple dbg)
4155 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4156 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4157 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4160 #undef GIMPLE_DEBUG_BIND_NOVALUE
4162 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4164 static inline bool
4165 gimple_debug_source_bind_p (const_gimple s)
4167 if (is_gimple_debug (s))
4168 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4170 return false;
4173 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4175 static inline tree
4176 gimple_debug_source_bind_get_var (gimple dbg)
4178 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4179 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4180 return gimple_op (dbg, 0);
4183 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4184 statement. */
4186 static inline tree
4187 gimple_debug_source_bind_get_value (gimple dbg)
4189 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4190 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4191 return gimple_op (dbg, 1);
4194 /* Return a pointer to the value bound to the variable in a
4195 GIMPLE_DEBUG source bind statement. */
4197 static inline tree *
4198 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4200 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4201 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4202 return gimple_op_ptr (dbg, 1);
4205 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4207 static inline void
4208 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4210 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4211 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4212 gimple_set_op (dbg, 0, var);
4215 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4216 statement. */
4218 static inline void
4219 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4221 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4222 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4223 gimple_set_op (dbg, 1, value);
4226 /* Return the line number for EXPR, or return -1 if we have no line
4227 number information for it. */
4228 static inline int
4229 get_lineno (const_gimple stmt)
4231 location_t loc;
4233 if (!stmt)
4234 return -1;
4236 loc = gimple_location (stmt);
4237 if (loc == UNKNOWN_LOCATION)
4238 return -1;
4240 return LOCATION_LINE (loc);
4243 /* Return a pointer to the body for the OMP statement GS. */
4245 static inline gimple_seq *
4246 gimple_omp_body_ptr (gimple gs)
4248 return &static_cast <gimple_statement_omp *> (gs)->body;
4251 /* Return the body for the OMP statement GS. */
4253 static inline gimple_seq
4254 gimple_omp_body (gimple gs)
4256 return *gimple_omp_body_ptr (gs);
4259 /* Set BODY to be the body for the OMP statement GS. */
4261 static inline void
4262 gimple_omp_set_body (gimple gs, gimple_seq body)
4264 static_cast <gimple_statement_omp *> (gs)->body = body;
4268 /* Return the name associated with OMP_CRITICAL statement GS. */
4270 static inline tree
4271 gimple_omp_critical_name (const_gimple gs)
4273 const gimple_statement_omp_critical *omp_critical_stmt =
4274 as_a <const gimple_statement_omp_critical> (gs);
4275 return omp_critical_stmt->name;
4279 /* Return a pointer to the name associated with OMP critical statement GS. */
4281 static inline tree *
4282 gimple_omp_critical_name_ptr (gimple gs)
4284 gimple_statement_omp_critical *omp_critical_stmt =
4285 as_a <gimple_statement_omp_critical> (gs);
4286 return &omp_critical_stmt->name;
4290 /* Set NAME to be the name associated with OMP critical statement GS. */
4292 static inline void
4293 gimple_omp_critical_set_name (gimple gs, tree name)
4295 gimple_statement_omp_critical *omp_critical_stmt =
4296 as_a <gimple_statement_omp_critical> (gs);
4297 omp_critical_stmt->name = name;
4301 /* Return the kind of OMP for statemement. */
4303 static inline int
4304 gimple_omp_for_kind (const_gimple g)
4306 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4307 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4311 /* Set the OMP for kind. */
4313 static inline void
4314 gimple_omp_for_set_kind (gimple g, int kind)
4316 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4317 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4318 | (kind & GF_OMP_FOR_KIND_MASK);
4322 /* Return true if OMP for statement G has the
4323 GF_OMP_FOR_COMBINED flag set. */
4325 static inline bool
4326 gimple_omp_for_combined_p (const_gimple g)
4328 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4329 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4333 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4334 value of COMBINED_P. */
4336 static inline void
4337 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4339 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4340 if (combined_p)
4341 g->subcode |= GF_OMP_FOR_COMBINED;
4342 else
4343 g->subcode &= ~GF_OMP_FOR_COMBINED;
4347 /* Return true if OMP for statement G has the
4348 GF_OMP_FOR_COMBINED_INTO flag set. */
4350 static inline bool
4351 gimple_omp_for_combined_into_p (const_gimple g)
4353 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4354 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4358 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4359 value of COMBINED_P. */
4361 static inline void
4362 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4364 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4365 if (combined_p)
4366 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4367 else
4368 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4372 /* Return the clauses associated with OMP_FOR GS. */
4374 static inline tree
4375 gimple_omp_for_clauses (const_gimple gs)
4377 const gimple_statement_omp_for *omp_for_stmt =
4378 as_a <const gimple_statement_omp_for> (gs);
4379 return omp_for_stmt->clauses;
4383 /* Return a pointer to the OMP_FOR GS. */
4385 static inline tree *
4386 gimple_omp_for_clauses_ptr (gimple gs)
4388 gimple_statement_omp_for *omp_for_stmt =
4389 as_a <gimple_statement_omp_for> (gs);
4390 return &omp_for_stmt->clauses;
4394 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4396 static inline void
4397 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4399 gimple_statement_omp_for *omp_for_stmt =
4400 as_a <gimple_statement_omp_for> (gs);
4401 omp_for_stmt->clauses = clauses;
4405 /* Get the collapse count of OMP_FOR GS. */
4407 static inline size_t
4408 gimple_omp_for_collapse (gimple gs)
4410 gimple_statement_omp_for *omp_for_stmt =
4411 as_a <gimple_statement_omp_for> (gs);
4412 return omp_for_stmt->collapse;
4416 /* Return the index variable for OMP_FOR GS. */
4418 static inline tree
4419 gimple_omp_for_index (const_gimple gs, size_t i)
4421 const gimple_statement_omp_for *omp_for_stmt =
4422 as_a <const gimple_statement_omp_for> (gs);
4423 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4424 return omp_for_stmt->iter[i].index;
4428 /* Return a pointer to the index variable for OMP_FOR GS. */
4430 static inline tree *
4431 gimple_omp_for_index_ptr (gimple gs, size_t i)
4433 gimple_statement_omp_for *omp_for_stmt =
4434 as_a <gimple_statement_omp_for> (gs);
4435 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4436 return &omp_for_stmt->iter[i].index;
4440 /* Set INDEX to be the index variable for OMP_FOR GS. */
4442 static inline void
4443 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4445 gimple_statement_omp_for *omp_for_stmt =
4446 as_a <gimple_statement_omp_for> (gs);
4447 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4448 omp_for_stmt->iter[i].index = index;
4452 /* Return the initial value for OMP_FOR GS. */
4454 static inline tree
4455 gimple_omp_for_initial (const_gimple gs, size_t i)
4457 const gimple_statement_omp_for *omp_for_stmt =
4458 as_a <const gimple_statement_omp_for> (gs);
4459 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4460 return omp_for_stmt->iter[i].initial;
4464 /* Return a pointer to the initial value for OMP_FOR GS. */
4466 static inline tree *
4467 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4469 gimple_statement_omp_for *omp_for_stmt =
4470 as_a <gimple_statement_omp_for> (gs);
4471 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4472 return &omp_for_stmt->iter[i].initial;
4476 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4478 static inline void
4479 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4481 gimple_statement_omp_for *omp_for_stmt =
4482 as_a <gimple_statement_omp_for> (gs);
4483 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4484 omp_for_stmt->iter[i].initial = initial;
4488 /* Return the final value for OMP_FOR GS. */
4490 static inline tree
4491 gimple_omp_for_final (const_gimple gs, size_t i)
4493 const gimple_statement_omp_for *omp_for_stmt =
4494 as_a <const gimple_statement_omp_for> (gs);
4495 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4496 return omp_for_stmt->iter[i].final;
4500 /* Return a pointer to the final value for OMP_FOR GS. */
4502 static inline tree *
4503 gimple_omp_for_final_ptr (gimple gs, size_t i)
4505 gimple_statement_omp_for *omp_for_stmt =
4506 as_a <gimple_statement_omp_for> (gs);
4507 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4508 return &omp_for_stmt->iter[i].final;
4512 /* Set FINAL to be the final value for OMP_FOR GS. */
4514 static inline void
4515 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4517 gimple_statement_omp_for *omp_for_stmt =
4518 as_a <gimple_statement_omp_for> (gs);
4519 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4520 omp_for_stmt->iter[i].final = final;
4524 /* Return the increment value for OMP_FOR GS. */
4526 static inline tree
4527 gimple_omp_for_incr (const_gimple gs, size_t i)
4529 const gimple_statement_omp_for *omp_for_stmt =
4530 as_a <const gimple_statement_omp_for> (gs);
4531 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4532 return omp_for_stmt->iter[i].incr;
4536 /* Return a pointer to the increment value for OMP_FOR GS. */
4538 static inline tree *
4539 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4541 gimple_statement_omp_for *omp_for_stmt =
4542 as_a <gimple_statement_omp_for> (gs);
4543 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4544 return &omp_for_stmt->iter[i].incr;
4548 /* Set INCR to be the increment value for OMP_FOR GS. */
4550 static inline void
4551 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4553 gimple_statement_omp_for *omp_for_stmt =
4554 as_a <gimple_statement_omp_for> (gs);
4555 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4556 omp_for_stmt->iter[i].incr = incr;
4560 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4561 statement GS starts. */
4563 static inline gimple_seq *
4564 gimple_omp_for_pre_body_ptr (gimple gs)
4566 gimple_statement_omp_for *omp_for_stmt =
4567 as_a <gimple_statement_omp_for> (gs);
4568 return &omp_for_stmt->pre_body;
4572 /* Return the sequence of statements to execute before the OMP_FOR
4573 statement GS starts. */
4575 static inline gimple_seq
4576 gimple_omp_for_pre_body (gimple gs)
4578 return *gimple_omp_for_pre_body_ptr (gs);
4582 /* Set PRE_BODY to be the sequence of statements to execute before the
4583 OMP_FOR statement GS starts. */
4585 static inline void
4586 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4588 gimple_statement_omp_for *omp_for_stmt =
4589 as_a <gimple_statement_omp_for> (gs);
4590 omp_for_stmt->pre_body = pre_body;
4594 /* Return the clauses associated with OMP_PARALLEL GS. */
4596 static inline tree
4597 gimple_omp_parallel_clauses (const_gimple gs)
4599 const gimple_statement_omp_parallel *omp_parallel_stmt =
4600 as_a <const gimple_statement_omp_parallel> (gs);
4601 return omp_parallel_stmt->clauses;
4605 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4607 static inline tree *
4608 gimple_omp_parallel_clauses_ptr (gimple gs)
4610 gimple_statement_omp_parallel *omp_parallel_stmt =
4611 as_a <gimple_statement_omp_parallel> (gs);
4612 return &omp_parallel_stmt->clauses;
4616 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4617 GS. */
4619 static inline void
4620 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4622 gimple_statement_omp_parallel *omp_parallel_stmt =
4623 as_a <gimple_statement_omp_parallel> (gs);
4624 omp_parallel_stmt->clauses = clauses;
4628 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4630 static inline tree
4631 gimple_omp_parallel_child_fn (const_gimple gs)
4633 const gimple_statement_omp_parallel *omp_parallel_stmt =
4634 as_a <const gimple_statement_omp_parallel> (gs);
4635 return omp_parallel_stmt->child_fn;
4638 /* Return a pointer to the child function used to hold the body of
4639 OMP_PARALLEL GS. */
4641 static inline tree *
4642 gimple_omp_parallel_child_fn_ptr (gimple gs)
4644 gimple_statement_omp_parallel *omp_parallel_stmt =
4645 as_a <gimple_statement_omp_parallel> (gs);
4646 return &omp_parallel_stmt->child_fn;
4650 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4652 static inline void
4653 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4655 gimple_statement_omp_parallel *omp_parallel_stmt =
4656 as_a <gimple_statement_omp_parallel> (gs);
4657 omp_parallel_stmt->child_fn = child_fn;
4661 /* Return the artificial argument used to send variables and values
4662 from the parent to the children threads in OMP_PARALLEL GS. */
4664 static inline tree
4665 gimple_omp_parallel_data_arg (const_gimple gs)
4667 const gimple_statement_omp_parallel *omp_parallel_stmt =
4668 as_a <const gimple_statement_omp_parallel> (gs);
4669 return omp_parallel_stmt->data_arg;
4673 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4675 static inline tree *
4676 gimple_omp_parallel_data_arg_ptr (gimple gs)
4678 gimple_statement_omp_parallel *omp_parallel_stmt =
4679 as_a <gimple_statement_omp_parallel> (gs);
4680 return &omp_parallel_stmt->data_arg;
4684 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4686 static inline void
4687 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4689 gimple_statement_omp_parallel *omp_parallel_stmt =
4690 as_a <gimple_statement_omp_parallel> (gs);
4691 omp_parallel_stmt->data_arg = data_arg;
4695 /* Return the clauses associated with OMP_TASK GS. */
4697 static inline tree
4698 gimple_omp_task_clauses (const_gimple gs)
4700 const gimple_statement_omp_task *omp_task_stmt =
4701 as_a <const gimple_statement_omp_task> (gs);
4702 return omp_task_stmt->clauses;
4706 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4708 static inline tree *
4709 gimple_omp_task_clauses_ptr (gimple gs)
4711 gimple_statement_omp_task *omp_task_stmt =
4712 as_a <gimple_statement_omp_task> (gs);
4713 return &omp_task_stmt->clauses;
4717 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4718 GS. */
4720 static inline void
4721 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4723 gimple_statement_omp_task *omp_task_stmt =
4724 as_a <gimple_statement_omp_task> (gs);
4725 omp_task_stmt->clauses = clauses;
4729 /* Return the child function used to hold the body of OMP_TASK GS. */
4731 static inline tree
4732 gimple_omp_task_child_fn (const_gimple gs)
4734 const gimple_statement_omp_task *omp_task_stmt =
4735 as_a <const gimple_statement_omp_task> (gs);
4736 return omp_task_stmt->child_fn;
4739 /* Return a pointer to the child function used to hold the body of
4740 OMP_TASK GS. */
4742 static inline tree *
4743 gimple_omp_task_child_fn_ptr (gimple gs)
4745 gimple_statement_omp_task *omp_task_stmt =
4746 as_a <gimple_statement_omp_task> (gs);
4747 return &omp_task_stmt->child_fn;
4751 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4753 static inline void
4754 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4756 gimple_statement_omp_task *omp_task_stmt =
4757 as_a <gimple_statement_omp_task> (gs);
4758 omp_task_stmt->child_fn = child_fn;
4762 /* Return the artificial argument used to send variables and values
4763 from the parent to the children threads in OMP_TASK GS. */
4765 static inline tree
4766 gimple_omp_task_data_arg (const_gimple gs)
4768 const gimple_statement_omp_task *omp_task_stmt =
4769 as_a <const gimple_statement_omp_task> (gs);
4770 return omp_task_stmt->data_arg;
4774 /* Return a pointer to the data argument for OMP_TASK GS. */
4776 static inline tree *
4777 gimple_omp_task_data_arg_ptr (gimple gs)
4779 gimple_statement_omp_task *omp_task_stmt =
4780 as_a <gimple_statement_omp_task> (gs);
4781 return &omp_task_stmt->data_arg;
4785 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4787 static inline void
4788 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4790 gimple_statement_omp_task *omp_task_stmt =
4791 as_a <gimple_statement_omp_task> (gs);
4792 omp_task_stmt->data_arg = data_arg;
4796 /* Return the clauses associated with OMP_TASK GS. */
4798 static inline tree
4799 gimple_omp_taskreg_clauses (const_gimple gs)
4801 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4802 as_a <const gimple_statement_omp_taskreg> (gs);
4803 return omp_taskreg_stmt->clauses;
4807 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4809 static inline tree *
4810 gimple_omp_taskreg_clauses_ptr (gimple gs)
4812 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4813 as_a <gimple_statement_omp_taskreg> (gs);
4814 return &omp_taskreg_stmt->clauses;
4818 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4819 GS. */
4821 static inline void
4822 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4824 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4825 as_a <gimple_statement_omp_taskreg> (gs);
4826 omp_taskreg_stmt->clauses = clauses;
4830 /* Return the child function used to hold the body of OMP_TASK GS. */
4832 static inline tree
4833 gimple_omp_taskreg_child_fn (const_gimple gs)
4835 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4836 as_a <const gimple_statement_omp_taskreg> (gs);
4837 return omp_taskreg_stmt->child_fn;
4840 /* Return a pointer to the child function used to hold the body of
4841 OMP_TASK GS. */
4843 static inline tree *
4844 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4846 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4847 as_a <gimple_statement_omp_taskreg> (gs);
4848 return &omp_taskreg_stmt->child_fn;
4852 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4854 static inline void
4855 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4857 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4858 as_a <gimple_statement_omp_taskreg> (gs);
4859 omp_taskreg_stmt->child_fn = child_fn;
4863 /* Return the artificial argument used to send variables and values
4864 from the parent to the children threads in OMP_TASK GS. */
4866 static inline tree
4867 gimple_omp_taskreg_data_arg (const_gimple gs)
4869 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4870 as_a <const gimple_statement_omp_taskreg> (gs);
4871 return omp_taskreg_stmt->data_arg;
4875 /* Return a pointer to the data argument for OMP_TASK GS. */
4877 static inline tree *
4878 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4880 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4881 as_a <gimple_statement_omp_taskreg> (gs);
4882 return &omp_taskreg_stmt->data_arg;
4886 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4888 static inline void
4889 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4891 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4892 as_a <gimple_statement_omp_taskreg> (gs);
4893 omp_taskreg_stmt->data_arg = data_arg;
4897 /* Return the copy function used to hold the body of OMP_TASK GS. */
4899 static inline tree
4900 gimple_omp_task_copy_fn (const_gimple gs)
4902 const gimple_statement_omp_task *omp_task_stmt =
4903 as_a <const gimple_statement_omp_task> (gs);
4904 return omp_task_stmt->copy_fn;
4907 /* Return a pointer to the copy function used to hold the body of
4908 OMP_TASK GS. */
4910 static inline tree *
4911 gimple_omp_task_copy_fn_ptr (gimple gs)
4913 gimple_statement_omp_task *omp_task_stmt =
4914 as_a <gimple_statement_omp_task> (gs);
4915 return &omp_task_stmt->copy_fn;
4919 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4921 static inline void
4922 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4924 gimple_statement_omp_task *omp_task_stmt =
4925 as_a <gimple_statement_omp_task> (gs);
4926 omp_task_stmt->copy_fn = copy_fn;
4930 /* Return size of the data block in bytes in OMP_TASK GS. */
4932 static inline tree
4933 gimple_omp_task_arg_size (const_gimple gs)
4935 const gimple_statement_omp_task *omp_task_stmt =
4936 as_a <const gimple_statement_omp_task> (gs);
4937 return omp_task_stmt->arg_size;
4941 /* Return a pointer to the data block size for OMP_TASK GS. */
4943 static inline tree *
4944 gimple_omp_task_arg_size_ptr (gimple gs)
4946 gimple_statement_omp_task *omp_task_stmt =
4947 as_a <gimple_statement_omp_task> (gs);
4948 return &omp_task_stmt->arg_size;
4952 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4954 static inline void
4955 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4957 gimple_statement_omp_task *omp_task_stmt =
4958 as_a <gimple_statement_omp_task> (gs);
4959 omp_task_stmt->arg_size = arg_size;
4963 /* Return align of the data block in bytes in OMP_TASK GS. */
4965 static inline tree
4966 gimple_omp_task_arg_align (const_gimple gs)
4968 const gimple_statement_omp_task *omp_task_stmt =
4969 as_a <const gimple_statement_omp_task> (gs);
4970 return omp_task_stmt->arg_align;
4974 /* Return a pointer to the data block align for OMP_TASK GS. */
4976 static inline tree *
4977 gimple_omp_task_arg_align_ptr (gimple gs)
4979 gimple_statement_omp_task *omp_task_stmt =
4980 as_a <gimple_statement_omp_task> (gs);
4981 return &omp_task_stmt->arg_align;
4985 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4987 static inline void
4988 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4990 gimple_statement_omp_task *omp_task_stmt =
4991 as_a <gimple_statement_omp_task> (gs);
4992 omp_task_stmt->arg_align = arg_align;
4996 /* Return the clauses associated with OMP_SINGLE GS. */
4998 static inline tree
4999 gimple_omp_single_clauses (const_gimple gs)
5001 const gimple_statement_omp_single *omp_single_stmt =
5002 as_a <const gimple_statement_omp_single> (gs);
5003 return omp_single_stmt->clauses;
5007 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5009 static inline tree *
5010 gimple_omp_single_clauses_ptr (gimple gs)
5012 gimple_statement_omp_single *omp_single_stmt =
5013 as_a <gimple_statement_omp_single> (gs);
5014 return &omp_single_stmt->clauses;
5018 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5020 static inline void
5021 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5023 gimple_statement_omp_single *omp_single_stmt =
5024 as_a <gimple_statement_omp_single> (gs);
5025 omp_single_stmt->clauses = clauses;
5029 /* Return the clauses associated with OMP_TARGET GS. */
5031 static inline tree
5032 gimple_omp_target_clauses (const_gimple gs)
5034 const gimple_statement_omp_target *omp_target_stmt =
5035 as_a <const gimple_statement_omp_target> (gs);
5036 return omp_target_stmt->clauses;
5040 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5042 static inline tree *
5043 gimple_omp_target_clauses_ptr (gimple gs)
5045 gimple_statement_omp_target *omp_target_stmt =
5046 as_a <gimple_statement_omp_target> (gs);
5047 return &omp_target_stmt->clauses;
5051 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5053 static inline void
5054 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5056 gimple_statement_omp_target *omp_target_stmt =
5057 as_a <gimple_statement_omp_target> (gs);
5058 omp_target_stmt->clauses = clauses;
5062 /* Return the kind of OMP target statemement. */
5064 static inline int
5065 gimple_omp_target_kind (const_gimple g)
5067 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5068 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5072 /* Set the OMP target kind. */
5074 static inline void
5075 gimple_omp_target_set_kind (gimple g, int kind)
5077 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5078 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5079 | (kind & GF_OMP_TARGET_KIND_MASK);
5083 /* Return the child function used to hold the body of OMP_TARGET GS. */
5085 static inline tree
5086 gimple_omp_target_child_fn (const_gimple gs)
5088 const gimple_statement_omp_target *omp_target_stmt =
5089 as_a <const gimple_statement_omp_target> (gs);
5090 return omp_target_stmt->child_fn;
5093 /* Return a pointer to the child function used to hold the body of
5094 OMP_TARGET GS. */
5096 static inline tree *
5097 gimple_omp_target_child_fn_ptr (gimple gs)
5099 gimple_statement_omp_target *omp_target_stmt =
5100 as_a <gimple_statement_omp_target> (gs);
5101 return &omp_target_stmt->child_fn;
5105 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5107 static inline void
5108 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5110 gimple_statement_omp_target *omp_target_stmt =
5111 as_a <gimple_statement_omp_target> (gs);
5112 omp_target_stmt->child_fn = child_fn;
5116 /* Return the artificial argument used to send variables and values
5117 from the parent to the children threads in OMP_TARGET GS. */
5119 static inline tree
5120 gimple_omp_target_data_arg (const_gimple gs)
5122 const gimple_statement_omp_target *omp_target_stmt =
5123 as_a <const gimple_statement_omp_target> (gs);
5124 return omp_target_stmt->data_arg;
5128 /* Return a pointer to the data argument for OMP_TARGET GS. */
5130 static inline tree *
5131 gimple_omp_target_data_arg_ptr (gimple gs)
5133 gimple_statement_omp_target *omp_target_stmt =
5134 as_a <gimple_statement_omp_target> (gs);
5135 return &omp_target_stmt->data_arg;
5139 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5141 static inline void
5142 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5144 gimple_statement_omp_target *omp_target_stmt =
5145 as_a <gimple_statement_omp_target> (gs);
5146 omp_target_stmt->data_arg = data_arg;
5150 /* Return the clauses associated with OMP_TEAMS GS. */
5152 static inline tree
5153 gimple_omp_teams_clauses (const_gimple gs)
5155 const gimple_statement_omp_teams *omp_teams_stmt =
5156 as_a <const gimple_statement_omp_teams> (gs);
5157 return omp_teams_stmt->clauses;
5161 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5163 static inline tree *
5164 gimple_omp_teams_clauses_ptr (gimple gs)
5166 gimple_statement_omp_teams *omp_teams_stmt =
5167 as_a <gimple_statement_omp_teams> (gs);
5168 return &omp_teams_stmt->clauses;
5172 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5174 static inline void
5175 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5177 gimple_statement_omp_teams *omp_teams_stmt =
5178 as_a <gimple_statement_omp_teams> (gs);
5179 omp_teams_stmt->clauses = clauses;
5183 /* Return the clauses associated with OMP_SECTIONS GS. */
5185 static inline tree
5186 gimple_omp_sections_clauses (const_gimple gs)
5188 const gimple_statement_omp_sections *omp_sections_stmt =
5189 as_a <const gimple_statement_omp_sections> (gs);
5190 return omp_sections_stmt->clauses;
5194 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5196 static inline tree *
5197 gimple_omp_sections_clauses_ptr (gimple gs)
5199 gimple_statement_omp_sections *omp_sections_stmt =
5200 as_a <gimple_statement_omp_sections> (gs);
5201 return &omp_sections_stmt->clauses;
5205 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5206 GS. */
5208 static inline void
5209 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5211 gimple_statement_omp_sections *omp_sections_stmt =
5212 as_a <gimple_statement_omp_sections> (gs);
5213 omp_sections_stmt->clauses = clauses;
5217 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5218 in GS. */
5220 static inline tree
5221 gimple_omp_sections_control (const_gimple gs)
5223 const gimple_statement_omp_sections *omp_sections_stmt =
5224 as_a <const gimple_statement_omp_sections> (gs);
5225 return omp_sections_stmt->control;
5229 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5230 GS. */
5232 static inline tree *
5233 gimple_omp_sections_control_ptr (gimple gs)
5235 gimple_statement_omp_sections *omp_sections_stmt =
5236 as_a <gimple_statement_omp_sections> (gs);
5237 return &omp_sections_stmt->control;
5241 /* Set CONTROL to be the set of clauses associated with the
5242 GIMPLE_OMP_SECTIONS in GS. */
5244 static inline void
5245 gimple_omp_sections_set_control (gimple gs, tree control)
5247 gimple_statement_omp_sections *omp_sections_stmt =
5248 as_a <gimple_statement_omp_sections> (gs);
5249 omp_sections_stmt->control = control;
5253 /* Set COND to be the condition code for OMP_FOR GS. */
5255 static inline void
5256 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5258 gimple_statement_omp_for *omp_for_stmt =
5259 as_a <gimple_statement_omp_for> (gs);
5260 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5261 && i < omp_for_stmt->collapse);
5262 omp_for_stmt->iter[i].cond = cond;
5266 /* Return the condition code associated with OMP_FOR GS. */
5268 static inline enum tree_code
5269 gimple_omp_for_cond (const_gimple gs, size_t i)
5271 const gimple_statement_omp_for *omp_for_stmt =
5272 as_a <const gimple_statement_omp_for> (gs);
5273 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5274 return omp_for_stmt->iter[i].cond;
5278 /* Set the value being stored in an atomic store. */
5280 static inline void
5281 gimple_omp_atomic_store_set_val (gimple g, tree val)
5283 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5284 as_a <gimple_statement_omp_atomic_store> (g);
5285 omp_atomic_store_stmt->val = val;
5289 /* Return the value being stored in an atomic store. */
5291 static inline tree
5292 gimple_omp_atomic_store_val (const_gimple g)
5294 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5295 as_a <const gimple_statement_omp_atomic_store> (g);
5296 return omp_atomic_store_stmt->val;
5300 /* Return a pointer to the value being stored in an atomic store. */
5302 static inline tree *
5303 gimple_omp_atomic_store_val_ptr (gimple g)
5305 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5306 as_a <gimple_statement_omp_atomic_store> (g);
5307 return &omp_atomic_store_stmt->val;
5311 /* Set the LHS of an atomic load. */
5313 static inline void
5314 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5316 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5317 as_a <gimple_statement_omp_atomic_load> (g);
5318 omp_atomic_load_stmt->lhs = lhs;
5322 /* Get the LHS of an atomic load. */
5324 static inline tree
5325 gimple_omp_atomic_load_lhs (const_gimple g)
5327 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5328 as_a <const gimple_statement_omp_atomic_load> (g);
5329 return omp_atomic_load_stmt->lhs;
5333 /* Return a pointer to the LHS of an atomic load. */
5335 static inline tree *
5336 gimple_omp_atomic_load_lhs_ptr (gimple g)
5338 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5339 as_a <gimple_statement_omp_atomic_load> (g);
5340 return &omp_atomic_load_stmt->lhs;
5344 /* Set the RHS of an atomic load. */
5346 static inline void
5347 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5349 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5350 as_a <gimple_statement_omp_atomic_load> (g);
5351 omp_atomic_load_stmt->rhs = rhs;
5355 /* Get the RHS of an atomic load. */
5357 static inline tree
5358 gimple_omp_atomic_load_rhs (const_gimple g)
5360 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5361 as_a <const gimple_statement_omp_atomic_load> (g);
5362 return omp_atomic_load_stmt->rhs;
5366 /* Return a pointer to the RHS of an atomic load. */
5368 static inline tree *
5369 gimple_omp_atomic_load_rhs_ptr (gimple g)
5371 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5372 as_a <gimple_statement_omp_atomic_load> (g);
5373 return &omp_atomic_load_stmt->rhs;
5377 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5379 static inline tree
5380 gimple_omp_continue_control_def (const_gimple g)
5382 const gimple_statement_omp_continue *omp_continue_stmt =
5383 as_a <const gimple_statement_omp_continue> (g);
5384 return omp_continue_stmt->control_def;
5387 /* The same as above, but return the address. */
5389 static inline tree *
5390 gimple_omp_continue_control_def_ptr (gimple g)
5392 gimple_statement_omp_continue *omp_continue_stmt =
5393 as_a <gimple_statement_omp_continue> (g);
5394 return &omp_continue_stmt->control_def;
5397 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5399 static inline void
5400 gimple_omp_continue_set_control_def (gimple g, tree def)
5402 gimple_statement_omp_continue *omp_continue_stmt =
5403 as_a <gimple_statement_omp_continue> (g);
5404 omp_continue_stmt->control_def = def;
5408 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5410 static inline tree
5411 gimple_omp_continue_control_use (const_gimple g)
5413 const gimple_statement_omp_continue *omp_continue_stmt =
5414 as_a <const gimple_statement_omp_continue> (g);
5415 return omp_continue_stmt->control_use;
5419 /* The same as above, but return the address. */
5421 static inline tree *
5422 gimple_omp_continue_control_use_ptr (gimple g)
5424 gimple_statement_omp_continue *omp_continue_stmt =
5425 as_a <gimple_statement_omp_continue> (g);
5426 return &omp_continue_stmt->control_use;
5430 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5432 static inline void
5433 gimple_omp_continue_set_control_use (gimple g, tree use)
5435 gimple_statement_omp_continue *omp_continue_stmt =
5436 as_a <gimple_statement_omp_continue> (g);
5437 omp_continue_stmt->control_use = use;
5440 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5442 static inline gimple_seq *
5443 gimple_transaction_body_ptr (gimple gs)
5445 gimple_statement_transaction *transaction_stmt =
5446 as_a <gimple_statement_transaction> (gs);
5447 return &transaction_stmt->body;
5450 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5452 static inline gimple_seq
5453 gimple_transaction_body (gimple gs)
5455 return *gimple_transaction_body_ptr (gs);
5458 /* Return the label associated with a GIMPLE_TRANSACTION. */
5460 static inline tree
5461 gimple_transaction_label (const_gimple gs)
5463 const gimple_statement_transaction *transaction_stmt =
5464 as_a <const gimple_statement_transaction> (gs);
5465 return transaction_stmt->label;
5468 static inline tree *
5469 gimple_transaction_label_ptr (gimple gs)
5471 gimple_statement_transaction *transaction_stmt =
5472 as_a <gimple_statement_transaction> (gs);
5473 return &transaction_stmt->label;
5476 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5478 static inline unsigned int
5479 gimple_transaction_subcode (const_gimple gs)
5481 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5482 return gs->subcode;
5485 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5487 static inline void
5488 gimple_transaction_set_body (gimple gs, gimple_seq body)
5490 gimple_statement_transaction *transaction_stmt =
5491 as_a <gimple_statement_transaction> (gs);
5492 transaction_stmt->body = body;
5495 /* Set the label associated with a GIMPLE_TRANSACTION. */
5497 static inline void
5498 gimple_transaction_set_label (gimple gs, tree label)
5500 gimple_statement_transaction *transaction_stmt =
5501 as_a <gimple_statement_transaction> (gs);
5502 transaction_stmt->label = label;
5505 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5507 static inline void
5508 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5510 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5511 gs->subcode = subcode;
5515 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5517 static inline tree *
5518 gimple_return_retval_ptr (const_gimple gs)
5520 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5521 return gimple_op_ptr (gs, 0);
5524 /* Return the return value for GIMPLE_RETURN GS. */
5526 static inline tree
5527 gimple_return_retval (const_gimple gs)
5529 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5530 return gimple_op (gs, 0);
5534 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5536 static inline void
5537 gimple_return_set_retval (gimple gs, tree retval)
5539 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5540 gimple_set_op (gs, 0, retval);
5544 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5546 #define CASE_GIMPLE_OMP \
5547 case GIMPLE_OMP_PARALLEL: \
5548 case GIMPLE_OMP_TASK: \
5549 case GIMPLE_OMP_FOR: \
5550 case GIMPLE_OMP_SECTIONS: \
5551 case GIMPLE_OMP_SECTIONS_SWITCH: \
5552 case GIMPLE_OMP_SINGLE: \
5553 case GIMPLE_OMP_TARGET: \
5554 case GIMPLE_OMP_TEAMS: \
5555 case GIMPLE_OMP_SECTION: \
5556 case GIMPLE_OMP_MASTER: \
5557 case GIMPLE_OMP_TASKGROUP: \
5558 case GIMPLE_OMP_ORDERED: \
5559 case GIMPLE_OMP_CRITICAL: \
5560 case GIMPLE_OMP_RETURN: \
5561 case GIMPLE_OMP_ATOMIC_LOAD: \
5562 case GIMPLE_OMP_ATOMIC_STORE: \
5563 case GIMPLE_OMP_CONTINUE
5565 static inline bool
5566 is_gimple_omp (const_gimple stmt)
5568 switch (gimple_code (stmt))
5570 CASE_GIMPLE_OMP:
5571 return true;
5572 default:
5573 return false;
5578 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5580 static inline bool
5581 gimple_nop_p (const_gimple g)
5583 return gimple_code (g) == GIMPLE_NOP;
5587 /* Return true if GS is a GIMPLE_RESX. */
5589 static inline bool
5590 is_gimple_resx (const_gimple gs)
5592 return gimple_code (gs) == GIMPLE_RESX;
5595 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5597 static inline enum br_predictor
5598 gimple_predict_predictor (gimple gs)
5600 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5601 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5605 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5607 static inline void
5608 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5610 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5611 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5612 | (unsigned) predictor;
5616 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5618 static inline enum prediction
5619 gimple_predict_outcome (gimple gs)
5621 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5622 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5626 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5628 static inline void
5629 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5631 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5632 if (outcome == TAKEN)
5633 gs->subcode |= GF_PREDICT_TAKEN;
5634 else
5635 gs->subcode &= ~GF_PREDICT_TAKEN;
5639 /* Return the type of the main expression computed by STMT. Return
5640 void_type_node if the statement computes nothing. */
5642 static inline tree
5643 gimple_expr_type (const_gimple stmt)
5645 enum gimple_code code = gimple_code (stmt);
5647 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5649 tree type;
5650 /* In general we want to pass out a type that can be substituted
5651 for both the RHS and the LHS types if there is a possibly
5652 useless conversion involved. That means returning the
5653 original RHS type as far as we can reconstruct it. */
5654 if (code == GIMPLE_CALL)
5656 if (gimple_call_internal_p (stmt)
5657 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5658 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5659 else
5660 type = gimple_call_return_type (stmt);
5662 else
5663 switch (gimple_assign_rhs_code (stmt))
5665 case POINTER_PLUS_EXPR:
5666 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5667 break;
5669 default:
5670 /* As fallback use the type of the LHS. */
5671 type = TREE_TYPE (gimple_get_lhs (stmt));
5672 break;
5674 return type;
5676 else if (code == GIMPLE_COND)
5677 return boolean_type_node;
5678 else
5679 return void_type_node;
5682 /* Enum and arrays used for allocation stats. Keep in sync with
5683 gimple.c:gimple_alloc_kind_names. */
5684 enum gimple_alloc_kind
5686 gimple_alloc_kind_assign, /* Assignments. */
5687 gimple_alloc_kind_phi, /* PHI nodes. */
5688 gimple_alloc_kind_cond, /* Conditionals. */
5689 gimple_alloc_kind_rest, /* Everything else. */
5690 gimple_alloc_kind_all
5693 extern int gimple_alloc_counts[];
5694 extern int gimple_alloc_sizes[];
5696 /* Return the allocation kind for a given stmt CODE. */
5697 static inline enum gimple_alloc_kind
5698 gimple_alloc_kind (enum gimple_code code)
5700 switch (code)
5702 case GIMPLE_ASSIGN:
5703 return gimple_alloc_kind_assign;
5704 case GIMPLE_PHI:
5705 return gimple_alloc_kind_phi;
5706 case GIMPLE_COND:
5707 return gimple_alloc_kind_cond;
5708 default:
5709 return gimple_alloc_kind_rest;
5713 /* Return true if a location should not be emitted for this statement
5714 by annotate_all_with_location. */
5716 static inline bool
5717 gimple_do_not_emit_location_p (gimple g)
5719 return gimple_plf (g, GF_PLF_1);
5722 /* Mark statement G so a location will not be emitted by
5723 annotate_one_with_location. */
5725 static inline void
5726 gimple_set_do_not_emit_location (gimple g)
5728 /* The PLF flags are initialized to 0 when a new tuple is created,
5729 so no need to initialize it anywhere. */
5730 gimple_set_plf (g, GF_PLF_1, true);
5734 /* Macros for showing usage statistics. */
5735 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5736 ? (x) \
5737 : ((x) < 1024*1024*10 \
5738 ? (x) / 1024 \
5739 : (x) / (1024*1024))))
5741 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5743 #endif /* GCC_GIMPLE_H */