Introduce gimple_eh_must_not_throw
[official-gcc.git] / gcc / gimple.h
blob445a1c0084026c56523f7b2d5590c6ebfbf3e779
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 enum gimple_code {
28 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
29 #include "gimple.def"
30 #undef DEFGSCODE
31 LAST_AND_UNUSED_GIMPLE_CODE
34 extern const char *const gimple_code_name[];
35 extern const unsigned char gimple_rhs_class_table[];
37 /* Error out if a gimple tuple is addressed incorrectly. */
38 #if defined ENABLE_GIMPLE_CHECKING
39 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
40 extern void gimple_check_failed (const_gimple, const char *, int, \
41 const char *, enum gimple_code, \
42 enum tree_code) ATTRIBUTE_NORETURN;
44 #define GIMPLE_CHECK(GS, CODE) \
45 do { \
46 const_gimple __gs = (GS); \
47 if (gimple_code (__gs) != (CODE)) \
48 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
49 (CODE), ERROR_MARK); \
50 } while (0)
51 #else /* not ENABLE_GIMPLE_CHECKING */
52 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
53 #define GIMPLE_CHECK(GS, CODE) (void)0
54 #endif
56 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
57 get_gimple_rhs_class. */
58 enum gimple_rhs_class
60 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
61 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
62 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
63 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
64 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
65 name, a _DECL, a _REF, etc. */
68 /* Specific flags for individual GIMPLE statements. These flags are
69 always stored in gimple_statement_base.subcode and they may only be
70 defined for statement codes that do not use subcodes.
72 Values for the masks can overlap as long as the overlapping values
73 are never used in the same statement class.
75 The maximum mask value that can be defined is 1 << 15 (i.e., each
76 statement code can hold up to 16 bitflags).
78 Keep this list sorted. */
79 enum gf_mask {
80 GF_ASM_INPUT = 1 << 0,
81 GF_ASM_VOLATILE = 1 << 1,
82 GF_CALL_FROM_THUNK = 1 << 0,
83 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
84 GF_CALL_TAILCALL = 1 << 2,
85 GF_CALL_VA_ARG_PACK = 1 << 3,
86 GF_CALL_NOTHROW = 1 << 4,
87 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
88 GF_CALL_INTERNAL = 1 << 6,
89 GF_CALL_CTRL_ALTERING = 1 << 7,
90 GF_OMP_PARALLEL_COMBINED = 1 << 0,
91 GF_OMP_FOR_KIND_MASK = 7 << 0,
92 GF_OMP_FOR_KIND_FOR = 0,
93 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
94 GF_OMP_FOR_KIND_CILKFOR = 2,
95 /* Flag for SIMD variants of OMP_FOR kinds. */
96 GF_OMP_FOR_SIMD = 1 << 2,
97 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
98 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
99 GF_OMP_FOR_COMBINED = 1 << 3,
100 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
101 GF_OMP_TARGET_KIND_MASK = (1 << 2) - 1,
102 GF_OMP_TARGET_KIND_REGION = 0,
103 GF_OMP_TARGET_KIND_DATA = 1,
104 GF_OMP_TARGET_KIND_UPDATE = 2,
106 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
107 a thread synchronization via some sort of barrier. The exact barrier
108 that would otherwise be emitted is dependent on the OMP statement with
109 which this return is associated. */
110 GF_OMP_RETURN_NOWAIT = 1 << 0,
112 GF_OMP_SECTION_LAST = 1 << 0,
113 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
114 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
115 GF_PREDICT_TAKEN = 1 << 15
118 /* Currently, there are only two types of gimple debug stmt. Others are
119 envisioned, for example, to enable the generation of is_stmt notes
120 in line number information, to mark sequence points, etc. This
121 subcode is to be used to tell them apart. */
122 enum gimple_debug_subcode {
123 GIMPLE_DEBUG_BIND = 0,
124 GIMPLE_DEBUG_SOURCE_BIND = 1
127 /* Masks for selecting a pass local flag (PLF) to work on. These
128 masks are used by gimple_set_plf and gimple_plf. */
129 enum plf_mask {
130 GF_PLF_1 = 1 << 0,
131 GF_PLF_2 = 1 << 1
134 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
135 are for 64 bit hosts. */
137 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
138 chain_next ("%h.next"), variable_size))
139 gimple_statement_base
141 /* [ WORD 1 ]
142 Main identifying code for a tuple. */
143 ENUM_BITFIELD(gimple_code) code : 8;
145 /* Nonzero if a warning should not be emitted on this tuple. */
146 unsigned int no_warning : 1;
148 /* Nonzero if this tuple has been visited. Passes are responsible
149 for clearing this bit before using it. */
150 unsigned int visited : 1;
152 /* Nonzero if this tuple represents a non-temporal move. */
153 unsigned int nontemporal_move : 1;
155 /* Pass local flags. These flags are free for any pass to use as
156 they see fit. Passes should not assume that these flags contain
157 any useful value when the pass starts. Any initial state that
158 the pass requires should be set on entry to the pass. See
159 gimple_set_plf and gimple_plf for usage. */
160 unsigned int plf : 2;
162 /* Nonzero if this statement has been modified and needs to have its
163 operands rescanned. */
164 unsigned modified : 1;
166 /* Nonzero if this statement contains volatile operands. */
167 unsigned has_volatile_ops : 1;
169 /* Padding to get subcode to 16 bit alignment. */
170 unsigned pad : 1;
172 /* The SUBCODE field can be used for tuple-specific flags for tuples
173 that do not require subcodes. Note that SUBCODE should be at
174 least as wide as tree codes, as several tuples store tree codes
175 in there. */
176 unsigned int subcode : 16;
178 /* UID of this statement. This is used by passes that want to
179 assign IDs to statements. It must be assigned and used by each
180 pass. By default it should be assumed to contain garbage. */
181 unsigned uid;
183 /* [ WORD 2 ]
184 Locus information for debug info. */
185 location_t location;
187 /* Number of operands in this tuple. */
188 unsigned num_ops;
190 /* [ WORD 3 ]
191 Basic block holding this statement. */
192 basic_block bb;
194 /* [ WORD 4-5 ]
195 Linked lists of gimple statements. The next pointers form
196 a NULL terminated list, the prev pointers are a cyclic list.
197 A gimple statement is hence also a double-ended list of
198 statements, with the pointer itself being the first element,
199 and the prev pointer being the last. */
200 gimple next;
201 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 /* A statement with the invariant that
769 stmt->code == GIMPLE_COND
770 i.e. a conditional jump statement. */
772 struct GTY((tag("GSS_WITH_OPS")))
773 gimple_statement_cond : public gimple_statement_with_ops
775 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
778 /* A statement with the invariant that
779 stmt->code == GIMPLE_DEBUG
780 i.e. a debug statement.
782 This type will normally be accessed via the gimple_debug and
783 const_gimple_debug typedefs (in coretypes.h), which are pointers to
784 this type. */
786 struct GTY((tag("GSS_WITH_OPS")))
787 gimple_statement_debug : public gimple_statement_with_ops
789 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
792 /* A statement with the invariant that
793 stmt->code == GIMPLE_GOTO
794 i.e. a goto statement.
796 This type will normally be accessed via the gimple_goto and
797 const_gimple_goto typedefs (in coretypes.h), which are pointers to
798 this type. */
800 struct GTY((tag("GSS_WITH_OPS")))
801 gimple_statement_goto : public gimple_statement_with_ops
803 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
806 /* A statement with the invariant that
807 stmt->code == GIMPLE_LABEL
808 i.e. a label statement.
810 This type will normally be accessed via the gimple_label and
811 const_gimple_label typedefs (in coretypes.h), which are pointers to
812 this type. */
814 struct GTY((tag("GSS_WITH_OPS")))
815 gimple_statement_label : public gimple_statement_with_ops
817 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
820 /* A statement with the invariant that
821 stmt->code == GIMPLE_SWITCH
822 i.e. a switch statement. */
824 struct GTY((tag("GSS_WITH_OPS")))
825 gimple_statement_switch : public gimple_statement_with_ops
827 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
830 /* A statement with the invariant that
831 stmt->code == GIMPLE_ASSIGN
832 i.e. an assignment statement. */
834 struct GTY((tag("GSS_WITH_MEM_OPS")))
835 gimple_statement_assign : public gimple_statement_with_memory_ops
837 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
840 /* A statement with the invariant that
841 stmt->code == GIMPLE_RETURN
842 i.e. a return statement. */
844 struct GTY((tag("GSS_WITH_MEM_OPS")))
845 gimple_statement_return : public gimple_statement_with_memory_ops
847 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
850 template <>
851 template <>
852 inline bool
853 is_a_helper <gimple_statement_asm *>::test (gimple gs)
855 return gs->code == GIMPLE_ASM;
858 template <>
859 template <>
860 inline bool
861 is_a_helper <gimple_statement_assign *>::test (gimple gs)
863 return gs->code == GIMPLE_ASSIGN;
866 template <>
867 template <>
868 inline bool
869 is_a_helper <gimple_statement_bind *>::test (gimple gs)
871 return gs->code == GIMPLE_BIND;
874 template <>
875 template <>
876 inline bool
877 is_a_helper <gimple_statement_call *>::test (gimple gs)
879 return gs->code == GIMPLE_CALL;
882 template <>
883 template <>
884 inline bool
885 is_a_helper <gimple_statement_catch *>::test (gimple gs)
887 return gs->code == GIMPLE_CATCH;
890 template <>
891 template <>
892 inline bool
893 is_a_helper <gimple_statement_cond *>::test (gimple gs)
895 return gs->code == GIMPLE_COND;
898 template <>
899 template <>
900 inline bool
901 is_a_helper <gimple_statement_debug *>::test (gimple gs)
903 return gs->code == GIMPLE_DEBUG;
906 template <>
907 template <>
908 inline bool
909 is_a_helper <gimple_statement_goto *>::test (gimple gs)
911 return gs->code == GIMPLE_GOTO;
914 template <>
915 template <>
916 inline bool
917 is_a_helper <gimple_statement_label *>::test (gimple gs)
919 return gs->code == GIMPLE_LABEL;
922 template <>
923 template <>
924 inline bool
925 is_a_helper <gimple_statement_resx *>::test (gimple gs)
927 return gs->code == GIMPLE_RESX;
930 template <>
931 template <>
932 inline bool
933 is_a_helper <gimple_statement_eh_dispatch *>::test (gimple gs)
935 return gs->code == GIMPLE_EH_DISPATCH;
938 template <>
939 template <>
940 inline bool
941 is_a_helper <gimple_statement_eh_else *>::test (gimple gs)
943 return gs->code == GIMPLE_EH_ELSE;
946 template <>
947 template <>
948 inline bool
949 is_a_helper <gimple_statement_eh_filter *>::test (gimple gs)
951 return gs->code == GIMPLE_EH_FILTER;
954 template <>
955 template <>
956 inline bool
957 is_a_helper <gimple_statement_eh_mnt *>::test (gimple gs)
959 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
962 template <>
963 template <>
964 inline bool
965 is_a_helper <gimple_statement_omp_atomic_load *>::test (gimple gs)
967 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
970 template <>
971 template <>
972 inline bool
973 is_a_helper <gimple_statement_omp_atomic_store *>::test (gimple gs)
975 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
978 template <>
979 template <>
980 inline bool
981 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
983 return gs->code == GIMPLE_OMP_RETURN;
986 template <>
987 template <>
988 inline bool
989 is_a_helper <gimple_statement_omp_continue *>::test (gimple gs)
991 return gs->code == GIMPLE_OMP_CONTINUE;
994 template <>
995 template <>
996 inline bool
997 is_a_helper <gimple_statement_omp_critical *>::test (gimple gs)
999 return gs->code == GIMPLE_OMP_CRITICAL;
1002 template <>
1003 template <>
1004 inline bool
1005 is_a_helper <gimple_statement_omp_for *>::test (gimple gs)
1007 return gs->code == GIMPLE_OMP_FOR;
1010 template <>
1011 template <>
1012 inline bool
1013 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
1015 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1018 template <>
1019 template <>
1020 inline bool
1021 is_a_helper <gimple_statement_omp_parallel *>::test (gimple gs)
1023 return gs->code == GIMPLE_OMP_PARALLEL;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <gimple_statement_omp_target *>::test (gimple gs)
1031 return gs->code == GIMPLE_OMP_TARGET;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <gimple_statement_omp_sections *>::test (gimple gs)
1039 return gs->code == GIMPLE_OMP_SECTIONS;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <gimple_statement_omp_single *>::test (gimple gs)
1047 return gs->code == GIMPLE_OMP_SINGLE;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <gimple_statement_omp_teams *>::test (gimple gs)
1055 return gs->code == GIMPLE_OMP_TEAMS;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <gimple_statement_omp_task *>::test (gimple gs)
1063 return gs->code == GIMPLE_OMP_TASK;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <gimple_statement_phi *>::test (gimple gs)
1071 return gs->code == GIMPLE_PHI;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <gimple_statement_return *>::test (gimple gs)
1079 return gs->code == GIMPLE_RETURN;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <gimple_statement_switch *>::test (gimple gs)
1087 return gs->code == GIMPLE_SWITCH;
1090 template <>
1091 template <>
1092 inline bool
1093 is_a_helper <gimple_statement_transaction *>::test (gimple gs)
1095 return gs->code == GIMPLE_TRANSACTION;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <gimple_statement_try *>::test (gimple gs)
1103 return gs->code == GIMPLE_TRY;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <gimple_statement_wce *>::test (gimple gs)
1111 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <const gimple_statement_asm *>::test (const_gimple gs)
1119 return gs->code == GIMPLE_ASM;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <const gimple_statement_bind *>::test (const_gimple gs)
1127 return gs->code == GIMPLE_BIND;
1130 template <>
1131 template <>
1132 inline bool
1133 is_a_helper <const gimple_statement_call *>::test (const_gimple gs)
1135 return gs->code == GIMPLE_CALL;
1138 template <>
1139 template <>
1140 inline bool
1141 is_a_helper <const gimple_statement_catch *>::test (const_gimple gs)
1143 return gs->code == GIMPLE_CATCH;
1146 template <>
1147 template <>
1148 inline bool
1149 is_a_helper <const gimple_statement_resx *>::test (const_gimple gs)
1151 return gs->code == GIMPLE_RESX;
1154 template <>
1155 template <>
1156 inline bool
1157 is_a_helper <const gimple_statement_eh_dispatch *>::test (const_gimple gs)
1159 return gs->code == GIMPLE_EH_DISPATCH;
1162 template <>
1163 template <>
1164 inline bool
1165 is_a_helper <const gimple_statement_eh_filter *>::test (const_gimple gs)
1167 return gs->code == GIMPLE_EH_FILTER;
1170 template <>
1171 template <>
1172 inline bool
1173 is_a_helper <const gimple_statement_omp_atomic_load *>::test (const_gimple gs)
1175 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1178 template <>
1179 template <>
1180 inline bool
1181 is_a_helper <const gimple_statement_omp_atomic_store *>::test (const_gimple gs)
1183 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1186 template <>
1187 template <>
1188 inline bool
1189 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1191 return gs->code == GIMPLE_OMP_RETURN;
1194 template <>
1195 template <>
1196 inline bool
1197 is_a_helper <const gimple_statement_omp_continue *>::test (const_gimple gs)
1199 return gs->code == GIMPLE_OMP_CONTINUE;
1202 template <>
1203 template <>
1204 inline bool
1205 is_a_helper <const gimple_statement_omp_critical *>::test (const_gimple gs)
1207 return gs->code == GIMPLE_OMP_CRITICAL;
1210 template <>
1211 template <>
1212 inline bool
1213 is_a_helper <const gimple_statement_omp_for *>::test (const_gimple gs)
1215 return gs->code == GIMPLE_OMP_FOR;
1218 template <>
1219 template <>
1220 inline bool
1221 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1223 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1226 template <>
1227 template <>
1228 inline bool
1229 is_a_helper <const gimple_statement_omp_parallel *>::test (const_gimple gs)
1231 return gs->code == GIMPLE_OMP_PARALLEL;
1234 template <>
1235 template <>
1236 inline bool
1237 is_a_helper <const gimple_statement_omp_target *>::test (const_gimple gs)
1239 return gs->code == GIMPLE_OMP_TARGET;
1242 template <>
1243 template <>
1244 inline bool
1245 is_a_helper <const gimple_statement_omp_sections *>::test (const_gimple gs)
1247 return gs->code == GIMPLE_OMP_SECTIONS;
1250 template <>
1251 template <>
1252 inline bool
1253 is_a_helper <const gimple_statement_omp_single *>::test (const_gimple gs)
1255 return gs->code == GIMPLE_OMP_SINGLE;
1258 template <>
1259 template <>
1260 inline bool
1261 is_a_helper <const gimple_statement_omp_teams *>::test (const_gimple gs)
1263 return gs->code == GIMPLE_OMP_TEAMS;
1266 template <>
1267 template <>
1268 inline bool
1269 is_a_helper <const gimple_statement_omp_task *>::test (const_gimple gs)
1271 return gs->code == GIMPLE_OMP_TASK;
1274 template <>
1275 template <>
1276 inline bool
1277 is_a_helper <const gimple_statement_phi *>::test (const_gimple gs)
1279 return gs->code == GIMPLE_PHI;
1282 template <>
1283 template <>
1284 inline bool
1285 is_a_helper <const gimple_statement_transaction *>::test (const_gimple gs)
1287 return gs->code == GIMPLE_TRANSACTION;
1290 /* Offset in bytes to the location of the operand vector.
1291 Zero if there is no operand vector for this tuple structure. */
1292 extern size_t const gimple_ops_offset_[];
1294 /* Map GIMPLE codes to GSS codes. */
1295 extern enum gimple_statement_structure_enum const gss_for_code_[];
1297 /* This variable holds the currently expanded gimple statement for purposes
1298 of comminucating the profile info to the builtin expanders. */
1299 extern gimple currently_expanding_gimple_stmt;
1301 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1302 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1303 gimple_return gimple_build_return (tree);
1304 void gimple_call_reset_alias_info (gimple_call);
1305 gimple_call gimple_build_call_vec (tree, vec<tree> );
1306 gimple_call gimple_build_call (tree, unsigned, ...);
1307 gimple_call gimple_build_call_valist (tree, unsigned, va_list);
1308 gimple_call gimple_build_call_internal (enum internal_fn, unsigned, ...);
1309 gimple_call gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1310 gimple_call gimple_build_call_from_tree (tree);
1311 gimple_assign gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1312 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1313 gimple_assign gimple_build_assign_with_ops (enum tree_code, tree,
1314 tree, tree,
1315 tree CXX_MEM_STAT_INFO);
1316 gimple_assign gimple_build_assign_with_ops (enum tree_code, tree,
1317 tree, tree CXX_MEM_STAT_INFO);
1318 gimple_cond gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1319 gimple_cond gimple_build_cond_from_tree (tree, tree, tree);
1320 void gimple_cond_set_condition_from_tree (gimple_cond, tree);
1321 gimple_label gimple_build_label (tree label);
1322 gimple_goto gimple_build_goto (tree dest);
1323 gimple gimple_build_nop (void);
1324 gimple_bind gimple_build_bind (tree, gimple_seq, tree);
1325 gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1326 vec<tree, va_gc> *, vec<tree, va_gc> *,
1327 vec<tree, va_gc> *);
1328 gimple_catch gimple_build_catch (tree, gimple_seq);
1329 gimple_eh_filter gimple_build_eh_filter (tree, gimple_seq);
1330 gimple_eh_must_not_throw gimple_build_eh_must_not_throw (tree);
1331 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1332 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1333 enum gimple_try_flags);
1334 gimple gimple_build_wce (gimple_seq);
1335 gimple gimple_build_resx (int);
1336 gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
1337 gimple_switch gimple_build_switch (tree, tree, vec<tree> );
1338 gimple gimple_build_eh_dispatch (int);
1339 gimple_debug gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1340 #define gimple_build_debug_bind(var,val,stmt) \
1341 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1342 gimple_debug gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1343 #define gimple_build_debug_source_bind(var,val,stmt) \
1344 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1345 gimple gimple_build_omp_critical (gimple_seq, tree);
1346 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1347 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1348 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1349 gimple gimple_build_omp_section (gimple_seq);
1350 gimple gimple_build_omp_master (gimple_seq);
1351 gimple gimple_build_omp_taskgroup (gimple_seq);
1352 gimple gimple_build_omp_continue (tree, tree);
1353 gimple gimple_build_omp_ordered (gimple_seq);
1354 gimple gimple_build_omp_return (bool);
1355 gimple gimple_build_omp_sections (gimple_seq, tree);
1356 gimple gimple_build_omp_sections_switch (void);
1357 gimple gimple_build_omp_single (gimple_seq, tree);
1358 gimple gimple_build_omp_target (gimple_seq, int, tree);
1359 gimple gimple_build_omp_teams (gimple_seq, tree);
1360 gimple gimple_build_omp_atomic_load (tree, tree);
1361 gimple gimple_build_omp_atomic_store (tree);
1362 gimple_transaction gimple_build_transaction (gimple_seq, tree);
1363 gimple gimple_build_predict (enum br_predictor, enum prediction);
1364 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1365 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1366 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1367 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1368 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1369 location_t);
1370 extern void annotate_all_with_location (gimple_seq, location_t);
1371 bool empty_body_p (gimple_seq);
1372 gimple_seq gimple_seq_copy (gimple_seq);
1373 bool gimple_call_same_target_p (const_gimple, const_gimple);
1374 int gimple_call_flags (const_gimple);
1375 int gimple_call_arg_flags (const_gimple, unsigned);
1376 int gimple_call_return_flags (const_gimple_call);
1377 bool gimple_assign_copy_p (gimple);
1378 bool gimple_assign_ssa_name_copy_p (gimple);
1379 bool gimple_assign_unary_nop_p (gimple);
1380 void gimple_set_bb (gimple, basic_block);
1381 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1382 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1383 tree, tree, tree);
1384 tree gimple_get_lhs (const_gimple);
1385 void gimple_set_lhs (gimple, tree);
1386 gimple gimple_copy (gimple);
1387 bool gimple_has_side_effects (const_gimple);
1388 bool gimple_could_trap_p_1 (gimple, bool, bool);
1389 bool gimple_could_trap_p (gimple);
1390 bool gimple_assign_rhs_could_trap_p (gimple);
1391 extern void dump_gimple_statistics (void);
1392 unsigned get_gimple_rhs_num_ops (enum tree_code);
1393 extern tree canonicalize_cond_expr_cond (tree);
1394 gimple_call gimple_call_copy_skip_args (gimple, bitmap);
1395 extern bool gimple_compare_field_offset (tree, tree);
1396 extern tree gimple_unsigned_type (tree);
1397 extern tree gimple_signed_type (tree);
1398 extern alias_set_type gimple_get_alias_set (tree);
1399 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1400 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1401 extern bool gimple_call_builtin_p (const_gimple);
1402 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1403 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1404 extern bool gimple_asm_clobbers_memory_p (const_gimple_asm);
1405 extern void dump_decl_set (FILE *, bitmap);
1406 extern bool nonfreeing_call_p (gimple);
1407 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1408 extern void sort_case_labels (vec<tree> );
1409 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1410 extern void gimple_seq_set_location (gimple_seq , location_t);
1412 /* Formal (expression) temporary table handling: multiple occurrences of
1413 the same scalar expression are evaluated into the same temporary. */
1415 typedef struct gimple_temp_hash_elt
1417 tree val; /* Key */
1418 tree temp; /* Value */
1419 } elt_t;
1421 /* Get the number of the next statement uid to be allocated. */
1422 static inline unsigned int
1423 gimple_stmt_max_uid (struct function *fn)
1425 return fn->last_stmt_uid;
1428 /* Set the number of the next statement uid to be allocated. */
1429 static inline void
1430 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1432 fn->last_stmt_uid = maxid;
1435 /* Set the number of the next statement uid to be allocated. */
1436 static inline unsigned int
1437 inc_gimple_stmt_max_uid (struct function *fn)
1439 return fn->last_stmt_uid++;
1442 /* Return the first node in GIMPLE sequence S. */
1444 static inline gimple_seq_node
1445 gimple_seq_first (gimple_seq s)
1447 return s;
1451 /* Return the first statement in GIMPLE sequence S. */
1453 static inline gimple
1454 gimple_seq_first_stmt (gimple_seq s)
1456 gimple_seq_node n = gimple_seq_first (s);
1457 return n;
1460 /* Return the first statement in GIMPLE sequence S as a gimple_bind,
1461 verifying that it has code GIMPLE_BIND in a checked build. */
1463 static inline gimple_bind
1464 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1466 gimple_seq_node n = gimple_seq_first (s);
1467 return as_a <gimple_bind> (n);
1471 /* Return the last node in GIMPLE sequence S. */
1473 static inline gimple_seq_node
1474 gimple_seq_last (gimple_seq s)
1476 return s ? s->prev : NULL;
1480 /* Return the last statement in GIMPLE sequence S. */
1482 static inline gimple
1483 gimple_seq_last_stmt (gimple_seq s)
1485 gimple_seq_node n = gimple_seq_last (s);
1486 return n;
1490 /* Set the last node in GIMPLE sequence *PS to LAST. */
1492 static inline void
1493 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1495 (*ps)->prev = last;
1499 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1501 static inline void
1502 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1504 *ps = first;
1508 /* Return true if GIMPLE sequence S is empty. */
1510 static inline bool
1511 gimple_seq_empty_p (gimple_seq s)
1513 return s == NULL;
1516 /* Allocate a new sequence and initialize its first element with STMT. */
1518 static inline gimple_seq
1519 gimple_seq_alloc_with_stmt (gimple stmt)
1521 gimple_seq seq = NULL;
1522 gimple_seq_add_stmt (&seq, stmt);
1523 return seq;
1527 /* Returns the sequence of statements in BB. */
1529 static inline gimple_seq
1530 bb_seq (const_basic_block bb)
1532 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1535 static inline gimple_seq *
1536 bb_seq_addr (basic_block bb)
1538 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1541 /* Sets the sequence of statements in BB to SEQ. */
1543 static inline void
1544 set_bb_seq (basic_block bb, gimple_seq seq)
1546 gcc_checking_assert (!(bb->flags & BB_RTL));
1547 bb->il.gimple.seq = seq;
1551 /* Return the code for GIMPLE statement G. */
1553 static inline enum gimple_code
1554 gimple_code (const_gimple g)
1556 return g->code;
1560 /* Return the GSS code used by a GIMPLE code. */
1562 static inline enum gimple_statement_structure_enum
1563 gss_for_code (enum gimple_code code)
1565 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1566 return gss_for_code_[code];
1570 /* Return which GSS code is used by GS. */
1572 static inline enum gimple_statement_structure_enum
1573 gimple_statement_structure (gimple gs)
1575 return gss_for_code (gimple_code (gs));
1579 /* Return true if statement G has sub-statements. This is only true for
1580 High GIMPLE statements. */
1582 static inline bool
1583 gimple_has_substatements (gimple g)
1585 switch (gimple_code (g))
1587 case GIMPLE_BIND:
1588 case GIMPLE_CATCH:
1589 case GIMPLE_EH_FILTER:
1590 case GIMPLE_EH_ELSE:
1591 case GIMPLE_TRY:
1592 case GIMPLE_OMP_FOR:
1593 case GIMPLE_OMP_MASTER:
1594 case GIMPLE_OMP_TASKGROUP:
1595 case GIMPLE_OMP_ORDERED:
1596 case GIMPLE_OMP_SECTION:
1597 case GIMPLE_OMP_PARALLEL:
1598 case GIMPLE_OMP_TASK:
1599 case GIMPLE_OMP_SECTIONS:
1600 case GIMPLE_OMP_SINGLE:
1601 case GIMPLE_OMP_TARGET:
1602 case GIMPLE_OMP_TEAMS:
1603 case GIMPLE_OMP_CRITICAL:
1604 case GIMPLE_WITH_CLEANUP_EXPR:
1605 case GIMPLE_TRANSACTION:
1606 return true;
1608 default:
1609 return false;
1614 /* Return the basic block holding statement G. */
1616 static inline basic_block
1617 gimple_bb (const_gimple g)
1619 return g->bb;
1623 /* Return the lexical scope block holding statement G. */
1625 static inline tree
1626 gimple_block (const_gimple g)
1628 return LOCATION_BLOCK (g->location);
1632 /* Set BLOCK to be the lexical scope block holding statement G. */
1634 static inline void
1635 gimple_set_block (gimple g, tree block)
1637 if (block)
1638 g->location =
1639 COMBINE_LOCATION_DATA (line_table, g->location, block);
1640 else
1641 g->location = LOCATION_LOCUS (g->location);
1645 /* Return location information for statement G. */
1647 static inline location_t
1648 gimple_location (const_gimple g)
1650 return g->location;
1653 /* Return location information for statement G if g is not NULL.
1654 Otherwise, UNKNOWN_LOCATION is returned. */
1656 static inline location_t
1657 gimple_location_safe (const_gimple g)
1659 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1662 /* Return pointer to location information for statement G. */
1664 static inline const location_t *
1665 gimple_location_ptr (const_gimple g)
1667 return &g->location;
1671 /* Set location information for statement G. */
1673 static inline void
1674 gimple_set_location (gimple g, location_t location)
1676 g->location = location;
1680 /* Return true if G contains location information. */
1682 static inline bool
1683 gimple_has_location (const_gimple g)
1685 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1689 /* Return the file name of the location of STMT. */
1691 static inline const char *
1692 gimple_filename (const_gimple stmt)
1694 return LOCATION_FILE (gimple_location (stmt));
1698 /* Return the line number of the location of STMT. */
1700 static inline int
1701 gimple_lineno (const_gimple stmt)
1703 return LOCATION_LINE (gimple_location (stmt));
1707 /* Determine whether SEQ is a singleton. */
1709 static inline bool
1710 gimple_seq_singleton_p (gimple_seq seq)
1712 return ((gimple_seq_first (seq) != NULL)
1713 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1716 /* Return true if no warnings should be emitted for statement STMT. */
1718 static inline bool
1719 gimple_no_warning_p (const_gimple stmt)
1721 return stmt->no_warning;
1724 /* Set the no_warning flag of STMT to NO_WARNING. */
1726 static inline void
1727 gimple_set_no_warning (gimple stmt, bool no_warning)
1729 stmt->no_warning = (unsigned) no_warning;
1732 /* Set the visited status on statement STMT to VISITED_P. */
1734 static inline void
1735 gimple_set_visited (gimple stmt, bool visited_p)
1737 stmt->visited = (unsigned) visited_p;
1741 /* Return the visited status for statement STMT. */
1743 static inline bool
1744 gimple_visited_p (gimple stmt)
1746 return stmt->visited;
1750 /* Set pass local flag PLF on statement STMT to VAL_P. */
1752 static inline void
1753 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1755 if (val_p)
1756 stmt->plf |= (unsigned int) plf;
1757 else
1758 stmt->plf &= ~((unsigned int) plf);
1762 /* Return the value of pass local flag PLF on statement STMT. */
1764 static inline unsigned int
1765 gimple_plf (gimple stmt, enum plf_mask plf)
1767 return stmt->plf & ((unsigned int) plf);
1771 /* Set the UID of statement. */
1773 static inline void
1774 gimple_set_uid (gimple g, unsigned uid)
1776 g->uid = uid;
1780 /* Return the UID of statement. */
1782 static inline unsigned
1783 gimple_uid (const_gimple g)
1785 return g->uid;
1789 /* Make statement G a singleton sequence. */
1791 static inline void
1792 gimple_init_singleton (gimple g)
1794 g->next = NULL;
1795 g->prev = g;
1799 /* Return true if GIMPLE statement G has register or memory operands. */
1801 static inline bool
1802 gimple_has_ops (const_gimple g)
1804 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1807 template <>
1808 template <>
1809 inline bool
1810 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1812 return gimple_has_ops (gs);
1815 template <>
1816 template <>
1817 inline bool
1818 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1820 return gimple_has_ops (gs);
1823 /* Return true if GIMPLE statement G has memory operands. */
1825 static inline bool
1826 gimple_has_mem_ops (const_gimple g)
1828 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1831 template <>
1832 template <>
1833 inline bool
1834 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1836 return gimple_has_mem_ops (gs);
1839 template <>
1840 template <>
1841 inline bool
1842 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1844 return gimple_has_mem_ops (gs);
1847 /* Return the set of USE operands for statement G. */
1849 static inline struct use_optype_d *
1850 gimple_use_ops (const_gimple g)
1852 const gimple_statement_with_ops *ops_stmt =
1853 dyn_cast <const gimple_statement_with_ops *> (g);
1854 if (!ops_stmt)
1855 return NULL;
1856 return ops_stmt->use_ops;
1860 /* Set USE to be the set of USE operands for statement G. */
1862 static inline void
1863 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1865 gimple_statement_with_ops *ops_stmt =
1866 as_a <gimple_statement_with_ops *> (g);
1867 ops_stmt->use_ops = use;
1871 /* Return the single VUSE operand of the statement G. */
1873 static inline tree
1874 gimple_vuse (const_gimple g)
1876 const gimple_statement_with_memory_ops *mem_ops_stmt =
1877 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1878 if (!mem_ops_stmt)
1879 return NULL_TREE;
1880 return mem_ops_stmt->vuse;
1883 /* Return the single VDEF operand of the statement G. */
1885 static inline tree
1886 gimple_vdef (const_gimple g)
1888 const gimple_statement_with_memory_ops *mem_ops_stmt =
1889 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1890 if (!mem_ops_stmt)
1891 return NULL_TREE;
1892 return mem_ops_stmt->vdef;
1895 /* Return the single VUSE operand of the statement G. */
1897 static inline tree *
1898 gimple_vuse_ptr (gimple g)
1900 gimple_statement_with_memory_ops *mem_ops_stmt =
1901 dyn_cast <gimple_statement_with_memory_ops *> (g);
1902 if (!mem_ops_stmt)
1903 return NULL;
1904 return &mem_ops_stmt->vuse;
1907 /* Return the single VDEF operand of the statement G. */
1909 static inline tree *
1910 gimple_vdef_ptr (gimple g)
1912 gimple_statement_with_memory_ops *mem_ops_stmt =
1913 dyn_cast <gimple_statement_with_memory_ops *> (g);
1914 if (!mem_ops_stmt)
1915 return NULL;
1916 return &mem_ops_stmt->vdef;
1919 /* Set the single VUSE operand of the statement G. */
1921 static inline void
1922 gimple_set_vuse (gimple g, tree vuse)
1924 gimple_statement_with_memory_ops *mem_ops_stmt =
1925 as_a <gimple_statement_with_memory_ops *> (g);
1926 mem_ops_stmt->vuse = vuse;
1929 /* Set the single VDEF operand of the statement G. */
1931 static inline void
1932 gimple_set_vdef (gimple g, tree vdef)
1934 gimple_statement_with_memory_ops *mem_ops_stmt =
1935 as_a <gimple_statement_with_memory_ops *> (g);
1936 mem_ops_stmt->vdef = vdef;
1940 /* Return true if statement G has operands and the modified field has
1941 been set. */
1943 static inline bool
1944 gimple_modified_p (const_gimple g)
1946 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1950 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1951 a MODIFIED field. */
1953 static inline void
1954 gimple_set_modified (gimple s, bool modifiedp)
1956 if (gimple_has_ops (s))
1957 s->modified = (unsigned) modifiedp;
1961 /* Return the tree code for the expression computed by STMT. This is
1962 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1963 GIMPLE_CALL, return CALL_EXPR as the expression code for
1964 consistency. This is useful when the caller needs to deal with the
1965 three kinds of computation that GIMPLE supports. */
1967 static inline enum tree_code
1968 gimple_expr_code (const_gimple stmt)
1970 enum gimple_code code = gimple_code (stmt);
1971 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1972 return (enum tree_code) stmt->subcode;
1973 else
1975 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1976 return CALL_EXPR;
1981 /* Return true if statement STMT contains volatile operands. */
1983 static inline bool
1984 gimple_has_volatile_ops (const_gimple stmt)
1986 if (gimple_has_mem_ops (stmt))
1987 return stmt->has_volatile_ops;
1988 else
1989 return false;
1993 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1995 static inline void
1996 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1998 if (gimple_has_mem_ops (stmt))
1999 stmt->has_volatile_ops = (unsigned) volatilep;
2002 /* Return true if STMT is in a transaction. */
2004 static inline bool
2005 gimple_in_transaction (gimple stmt)
2007 return bb_in_transaction (gimple_bb (stmt));
2010 /* Return true if statement STMT may access memory. */
2012 static inline bool
2013 gimple_references_memory_p (gimple stmt)
2015 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2019 /* Return the subcode for OMP statement S. */
2021 static inline unsigned
2022 gimple_omp_subcode (const_gimple s)
2024 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2025 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2026 return s->subcode;
2029 /* Set the subcode for OMP statement S to SUBCODE. */
2031 static inline void
2032 gimple_omp_set_subcode (gimple s, unsigned int subcode)
2034 /* We only have 16 bits for the subcode. Assert that we are not
2035 overflowing it. */
2036 gcc_gimple_checking_assert (subcode < (1 << 16));
2037 s->subcode = subcode;
2040 /* Set the nowait flag on OMP_RETURN statement S. */
2042 static inline void
2043 gimple_omp_return_set_nowait (gimple s)
2045 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2046 s->subcode |= GF_OMP_RETURN_NOWAIT;
2050 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2051 flag set. */
2053 static inline bool
2054 gimple_omp_return_nowait_p (const_gimple g)
2056 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2057 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2061 /* Set the LHS of OMP return. */
2063 static inline void
2064 gimple_omp_return_set_lhs (gimple g, tree lhs)
2066 gimple_statement_omp_return *omp_return_stmt =
2067 as_a <gimple_statement_omp_return *> (g);
2068 omp_return_stmt->val = lhs;
2072 /* Get the LHS of OMP return. */
2074 static inline tree
2075 gimple_omp_return_lhs (const_gimple g)
2077 const gimple_statement_omp_return *omp_return_stmt =
2078 as_a <const gimple_statement_omp_return *> (g);
2079 return omp_return_stmt->val;
2083 /* Return a pointer to the LHS of OMP return. */
2085 static inline tree *
2086 gimple_omp_return_lhs_ptr (gimple g)
2088 gimple_statement_omp_return *omp_return_stmt =
2089 as_a <gimple_statement_omp_return *> (g);
2090 return &omp_return_stmt->val;
2094 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2095 flag set. */
2097 static inline bool
2098 gimple_omp_section_last_p (const_gimple g)
2100 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2101 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2105 /* Set the GF_OMP_SECTION_LAST flag on G. */
2107 static inline void
2108 gimple_omp_section_set_last (gimple g)
2110 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2111 g->subcode |= GF_OMP_SECTION_LAST;
2115 /* Return true if OMP parallel statement G has the
2116 GF_OMP_PARALLEL_COMBINED flag set. */
2118 static inline bool
2119 gimple_omp_parallel_combined_p (const_gimple g)
2121 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2122 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2126 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2127 value of COMBINED_P. */
2129 static inline void
2130 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2132 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2133 if (combined_p)
2134 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2135 else
2136 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2140 /* Return true if OMP atomic load/store statement G has the
2141 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2143 static inline bool
2144 gimple_omp_atomic_need_value_p (const_gimple g)
2146 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2147 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2148 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2152 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2154 static inline void
2155 gimple_omp_atomic_set_need_value (gimple g)
2157 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2158 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2159 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2163 /* Return true if OMP atomic load/store statement G has the
2164 GF_OMP_ATOMIC_SEQ_CST flag set. */
2166 static inline bool
2167 gimple_omp_atomic_seq_cst_p (const_gimple g)
2169 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2170 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2171 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2175 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2177 static inline void
2178 gimple_omp_atomic_set_seq_cst (gimple g)
2180 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2181 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2182 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2186 /* Return the number of operands for statement GS. */
2188 static inline unsigned
2189 gimple_num_ops (const_gimple gs)
2191 return gs->num_ops;
2195 /* Set the number of operands for statement GS. */
2197 static inline void
2198 gimple_set_num_ops (gimple gs, unsigned num_ops)
2200 gs->num_ops = num_ops;
2204 /* Return the array of operands for statement GS. */
2206 static inline tree *
2207 gimple_ops (gimple gs)
2209 size_t off;
2211 /* All the tuples have their operand vector at the very bottom
2212 of the structure. Note that those structures that do not
2213 have an operand vector have a zero offset. */
2214 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2215 gcc_gimple_checking_assert (off != 0);
2217 return (tree *) ((char *) gs + off);
2221 /* Return operand I for statement GS. */
2223 static inline tree
2224 gimple_op (const_gimple gs, unsigned i)
2226 if (gimple_has_ops (gs))
2228 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2229 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2231 else
2232 return NULL_TREE;
2235 /* Return a pointer to operand I for statement GS. */
2237 static inline tree *
2238 gimple_op_ptr (const_gimple gs, unsigned i)
2240 if (gimple_has_ops (gs))
2242 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2243 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2245 else
2246 return NULL;
2249 /* Set operand I of statement GS to OP. */
2251 static inline void
2252 gimple_set_op (gimple gs, unsigned i, tree op)
2254 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2256 /* Note. It may be tempting to assert that OP matches
2257 is_gimple_operand, but that would be wrong. Different tuples
2258 accept slightly different sets of tree operands. Each caller
2259 should perform its own validation. */
2260 gimple_ops (gs)[i] = op;
2263 /* Return true if GS is a GIMPLE_ASSIGN. */
2265 static inline bool
2266 is_gimple_assign (const_gimple gs)
2268 return gimple_code (gs) == GIMPLE_ASSIGN;
2271 /* Determine if expression CODE is one of the valid expressions that can
2272 be used on the RHS of GIMPLE assignments. */
2274 static inline enum gimple_rhs_class
2275 get_gimple_rhs_class (enum tree_code code)
2277 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2280 /* Return the LHS of assignment statement GS. */
2282 static inline tree
2283 gimple_assign_lhs (const_gimple gs)
2285 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2286 return gimple_op (gs, 0);
2290 /* Return a pointer to the LHS of assignment statement GS. */
2292 static inline tree *
2293 gimple_assign_lhs_ptr (const_gimple gs)
2295 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2296 return gimple_op_ptr (gs, 0);
2300 /* Set LHS to be the LHS operand of assignment statement GS. */
2302 static inline void
2303 gimple_assign_set_lhs (gimple gs, tree lhs)
2305 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2306 gimple_set_op (gs, 0, lhs);
2308 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2309 SSA_NAME_DEF_STMT (lhs) = gs;
2313 /* Return the first operand on the RHS of assignment statement GS. */
2315 static inline tree
2316 gimple_assign_rhs1 (const_gimple gs)
2318 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2319 return gimple_op (gs, 1);
2323 /* Return a pointer to the first operand on the RHS of assignment
2324 statement GS. */
2326 static inline tree *
2327 gimple_assign_rhs1_ptr (const_gimple gs)
2329 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2330 return gimple_op_ptr (gs, 1);
2333 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2335 static inline void
2336 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2338 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2340 gimple_set_op (gs, 1, rhs);
2344 /* Return the second operand on the RHS of assignment statement GS.
2345 If GS does not have two operands, NULL is returned instead. */
2347 static inline tree
2348 gimple_assign_rhs2 (const_gimple gs)
2350 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2352 if (gimple_num_ops (gs) >= 3)
2353 return gimple_op (gs, 2);
2354 else
2355 return NULL_TREE;
2359 /* Return a pointer to the second operand on the RHS of assignment
2360 statement GS. */
2362 static inline tree *
2363 gimple_assign_rhs2_ptr (const_gimple gs)
2365 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2366 return gimple_op_ptr (gs, 2);
2370 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2372 static inline void
2373 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2375 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2377 gimple_set_op (gs, 2, rhs);
2380 /* Return the third operand on the RHS of assignment statement GS.
2381 If GS does not have two operands, NULL is returned instead. */
2383 static inline tree
2384 gimple_assign_rhs3 (const_gimple gs)
2386 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2388 if (gimple_num_ops (gs) >= 4)
2389 return gimple_op (gs, 3);
2390 else
2391 return NULL_TREE;
2394 /* Return a pointer to the third operand on the RHS of assignment
2395 statement GS. */
2397 static inline tree *
2398 gimple_assign_rhs3_ptr (const_gimple gs)
2400 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2401 return gimple_op_ptr (gs, 3);
2405 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2407 static inline void
2408 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2410 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2412 gimple_set_op (gs, 3, rhs);
2415 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2416 to see only a maximum of two operands. */
2418 static inline void
2419 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2420 tree op1, tree op2)
2422 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2425 /* Returns true if GS is a nontemporal move. */
2427 static inline bool
2428 gimple_assign_nontemporal_move_p (const_gimple gs)
2430 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2431 return gs->nontemporal_move;
2434 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2436 static inline void
2437 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2439 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2440 gs->nontemporal_move = nontemporal;
2444 /* Return the code of the expression computed on the rhs of assignment
2445 statement GS. In case that the RHS is a single object, returns the
2446 tree code of the object. */
2448 static inline enum tree_code
2449 gimple_assign_rhs_code (const_gimple gs)
2451 enum tree_code code;
2452 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2454 code = (enum tree_code) gs->subcode;
2455 /* While we initially set subcode to the TREE_CODE of the rhs for
2456 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2457 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2458 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2459 code = TREE_CODE (gimple_assign_rhs1 (gs));
2461 return code;
2465 /* Set CODE to be the code for the expression computed on the RHS of
2466 assignment S. */
2468 static inline void
2469 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2471 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2472 s->subcode = code;
2476 /* Return the gimple rhs class of the code of the expression computed on
2477 the rhs of assignment statement GS.
2478 This will never return GIMPLE_INVALID_RHS. */
2480 static inline enum gimple_rhs_class
2481 gimple_assign_rhs_class (const_gimple gs)
2483 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2486 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2487 there is no operator associated with the assignment itself.
2488 Unlike gimple_assign_copy_p, this predicate returns true for
2489 any RHS operand, including those that perform an operation
2490 and do not have the semantics of a copy, such as COND_EXPR. */
2492 static inline bool
2493 gimple_assign_single_p (const_gimple gs)
2495 return (is_gimple_assign (gs)
2496 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2499 /* Return true if GS performs a store to its lhs. */
2501 static inline bool
2502 gimple_store_p (const_gimple gs)
2504 tree lhs = gimple_get_lhs (gs);
2505 return lhs && !is_gimple_reg (lhs);
2508 /* Return true if GS is an assignment that loads from its rhs1. */
2510 static inline bool
2511 gimple_assign_load_p (const_gimple gs)
2513 tree rhs;
2514 if (!gimple_assign_single_p (gs))
2515 return false;
2516 rhs = gimple_assign_rhs1 (gs);
2517 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2518 return true;
2519 rhs = get_base_address (rhs);
2520 return (DECL_P (rhs)
2521 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2525 /* Return true if S is a type-cast assignment. */
2527 static inline bool
2528 gimple_assign_cast_p (const_gimple s)
2530 if (is_gimple_assign (s))
2532 enum tree_code sc = gimple_assign_rhs_code (s);
2533 return CONVERT_EXPR_CODE_P (sc)
2534 || sc == VIEW_CONVERT_EXPR
2535 || sc == FIX_TRUNC_EXPR;
2538 return false;
2541 /* Return true if S is a clobber statement. */
2543 static inline bool
2544 gimple_clobber_p (const_gimple s)
2546 return gimple_assign_single_p (s)
2547 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2550 /* Return true if GS is a GIMPLE_CALL. */
2552 static inline bool
2553 is_gimple_call (const_gimple gs)
2555 return gimple_code (gs) == GIMPLE_CALL;
2558 /* Return the LHS of call statement GS. */
2560 static inline tree
2561 gimple_call_lhs (const_gimple gs)
2563 GIMPLE_CHECK (gs, GIMPLE_CALL);
2564 return gimple_op (gs, 0);
2568 /* Return a pointer to the LHS of call statement GS. */
2570 static inline tree *
2571 gimple_call_lhs_ptr (const_gimple gs)
2573 GIMPLE_CHECK (gs, GIMPLE_CALL);
2574 return gimple_op_ptr (gs, 0);
2578 /* Set LHS to be the LHS operand of call statement GS. */
2580 static inline void
2581 gimple_call_set_lhs (gimple gs, tree lhs)
2583 GIMPLE_CHECK (gs, GIMPLE_CALL);
2584 gimple_set_op (gs, 0, lhs);
2585 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2586 SSA_NAME_DEF_STMT (lhs) = gs;
2590 /* Return true if call GS calls an internal-only function, as enumerated
2591 by internal_fn. */
2593 static inline bool
2594 gimple_call_internal_p (const_gimple gs)
2596 GIMPLE_CHECK (gs, GIMPLE_CALL);
2597 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2601 /* Return the target of internal call GS. */
2603 static inline enum internal_fn
2604 gimple_call_internal_fn (const_gimple gs)
2606 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2607 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2610 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2611 that could alter control flow. */
2613 static inline void
2614 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2616 GIMPLE_CHECK (s, GIMPLE_CALL);
2617 if (ctrl_altering_p)
2618 s->subcode |= GF_CALL_CTRL_ALTERING;
2619 else
2620 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2623 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2624 flag is set. Such call could not be a stmt in the middle of a bb. */
2626 static inline bool
2627 gimple_call_ctrl_altering_p (const_gimple gs)
2629 GIMPLE_CHECK (gs, GIMPLE_CALL);
2630 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2634 /* Return the function type of the function called by GS. */
2636 static inline tree
2637 gimple_call_fntype (const_gimple gs)
2639 const gimple_statement_call *call_stmt =
2640 as_a <const gimple_statement_call *> (gs);
2641 if (gimple_call_internal_p (gs))
2642 return NULL_TREE;
2643 return call_stmt->u.fntype;
2646 /* Set the type of the function called by GS to FNTYPE. */
2648 static inline void
2649 gimple_call_set_fntype (gimple gs, tree fntype)
2651 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2652 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2653 call_stmt->u.fntype = fntype;
2657 /* Return the tree node representing the function called by call
2658 statement GS. */
2660 static inline tree
2661 gimple_call_fn (const_gimple gs)
2663 GIMPLE_CHECK (gs, GIMPLE_CALL);
2664 return gimple_op (gs, 1);
2667 /* Return a pointer to the tree node representing the function called by call
2668 statement GS. */
2670 static inline tree *
2671 gimple_call_fn_ptr (const_gimple gs)
2673 GIMPLE_CHECK (gs, GIMPLE_CALL);
2674 return gimple_op_ptr (gs, 1);
2678 /* Set FN to be the function called by call statement GS. */
2680 static inline void
2681 gimple_call_set_fn (gimple gs, tree fn)
2683 GIMPLE_CHECK (gs, GIMPLE_CALL);
2684 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2685 gimple_set_op (gs, 1, fn);
2689 /* Set FNDECL to be the function called by call statement GS. */
2691 static inline void
2692 gimple_call_set_fndecl (gimple gs, tree decl)
2694 GIMPLE_CHECK (gs, GIMPLE_CALL);
2695 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2696 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2700 /* Set internal function FN to be the function called by call statement CALL_STMT. */
2702 static inline void
2703 gimple_call_set_internal_fn (gimple_call call_stmt, enum internal_fn fn)
2705 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
2706 call_stmt->u.internal_fn = fn;
2710 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2711 Otherwise return NULL. This function is analogous to
2712 get_callee_fndecl in tree land. */
2714 static inline tree
2715 gimple_call_fndecl (const_gimple gs)
2717 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2721 /* Return the type returned by call statement GS. */
2723 static inline tree
2724 gimple_call_return_type (const_gimple_call gs)
2726 tree type = gimple_call_fntype (gs);
2728 if (type == NULL_TREE)
2729 return TREE_TYPE (gimple_call_lhs (gs));
2731 /* The type returned by a function is the type of its
2732 function type. */
2733 return TREE_TYPE (type);
2737 /* Return the static chain for call statement GS. */
2739 static inline tree
2740 gimple_call_chain (const_gimple gs)
2742 GIMPLE_CHECK (gs, GIMPLE_CALL);
2743 return gimple_op (gs, 2);
2747 /* Return a pointer to the static chain for call statement CALL_STMT. */
2749 static inline tree *
2750 gimple_call_chain_ptr (const_gimple_call call_stmt)
2752 return gimple_op_ptr (call_stmt, 2);
2755 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
2757 static inline void
2758 gimple_call_set_chain (gimple_call call_stmt, tree chain)
2760 gimple_set_op (call_stmt, 2, chain);
2764 /* Return the number of arguments used by call statement GS. */
2766 static inline unsigned
2767 gimple_call_num_args (const_gimple gs)
2769 unsigned num_ops;
2770 GIMPLE_CHECK (gs, GIMPLE_CALL);
2771 num_ops = gimple_num_ops (gs);
2772 return num_ops - 3;
2776 /* Return the argument at position INDEX for call statement GS. */
2778 static inline tree
2779 gimple_call_arg (const_gimple gs, unsigned index)
2781 GIMPLE_CHECK (gs, GIMPLE_CALL);
2782 return gimple_op (gs, index + 3);
2786 /* Return a pointer to the argument at position INDEX for call
2787 statement GS. */
2789 static inline tree *
2790 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2792 GIMPLE_CHECK (gs, GIMPLE_CALL);
2793 return gimple_op_ptr (gs, index + 3);
2797 /* Set ARG to be the argument at position INDEX for call statement GS. */
2799 static inline void
2800 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2802 GIMPLE_CHECK (gs, GIMPLE_CALL);
2803 gimple_set_op (gs, index + 3, arg);
2807 /* If TAIL_P is true, mark call statement S as being a tail call
2808 (i.e., a call just before the exit of a function). These calls are
2809 candidate for tail call optimization. */
2811 static inline void
2812 gimple_call_set_tail (gimple s, bool tail_p)
2814 GIMPLE_CHECK (s, GIMPLE_CALL);
2815 if (tail_p)
2816 s->subcode |= GF_CALL_TAILCALL;
2817 else
2818 s->subcode &= ~GF_CALL_TAILCALL;
2822 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2824 static inline bool
2825 gimple_call_tail_p (gimple s)
2827 GIMPLE_CHECK (s, GIMPLE_CALL);
2828 return (s->subcode & GF_CALL_TAILCALL) != 0;
2832 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2833 slot optimization. This transformation uses the target of the call
2834 expansion as the return slot for calls that return in memory. */
2836 static inline void
2837 gimple_call_set_return_slot_opt (gimple_call s, bool return_slot_opt_p)
2839 if (return_slot_opt_p)
2840 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2841 else
2842 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2846 /* Return true if S is marked for return slot optimization. */
2848 static inline bool
2849 gimple_call_return_slot_opt_p (gimple s)
2851 GIMPLE_CHECK (s, GIMPLE_CALL);
2852 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2856 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2857 thunk to the thunked-to function. */
2859 static inline void
2860 gimple_call_set_from_thunk (gimple_call s, bool from_thunk_p)
2862 if (from_thunk_p)
2863 s->subcode |= GF_CALL_FROM_THUNK;
2864 else
2865 s->subcode &= ~GF_CALL_FROM_THUNK;
2869 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2871 static inline bool
2872 gimple_call_from_thunk_p (gimple_call s)
2874 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2878 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2879 argument pack in its argument list. */
2881 static inline void
2882 gimple_call_set_va_arg_pack (gimple_call s, bool pass_arg_pack_p)
2884 if (pass_arg_pack_p)
2885 s->subcode |= GF_CALL_VA_ARG_PACK;
2886 else
2887 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2891 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2892 argument pack in its argument list. */
2894 static inline bool
2895 gimple_call_va_arg_pack_p (gimple_call s)
2897 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2901 /* Return true if S is a noreturn call. */
2903 static inline bool
2904 gimple_call_noreturn_p (gimple s)
2906 GIMPLE_CHECK (s, GIMPLE_CALL);
2907 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2911 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2912 even if the called function can throw in other cases. */
2914 static inline void
2915 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2917 GIMPLE_CHECK (s, GIMPLE_CALL);
2918 if (nothrow_p)
2919 s->subcode |= GF_CALL_NOTHROW;
2920 else
2921 s->subcode &= ~GF_CALL_NOTHROW;
2924 /* Return true if S is a nothrow call. */
2926 static inline bool
2927 gimple_call_nothrow_p (gimple s)
2929 GIMPLE_CHECK (s, GIMPLE_CALL);
2930 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2933 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2934 is known to be emitted for VLA objects. Those are wrapped by
2935 stack_save/stack_restore calls and hence can't lead to unbounded
2936 stack growth even when they occur in loops. */
2938 static inline void
2939 gimple_call_set_alloca_for_var (gimple_call s, bool for_var)
2941 if (for_var)
2942 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2943 else
2944 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2947 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2949 static inline bool
2950 gimple_call_alloca_for_var_p (gimple_call s)
2952 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2955 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2957 static inline void
2958 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2960 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2961 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2962 dest_call->subcode = orig_call->subcode;
2966 /* Return a pointer to the points-to solution for the set of call-used
2967 variables of the call CALL. */
2969 static inline struct pt_solution *
2970 gimple_call_use_set (gimple call)
2972 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2973 return &call_stmt->call_used;
2977 /* Return a pointer to the points-to solution for the set of call-used
2978 variables of the call CALL. */
2980 static inline struct pt_solution *
2981 gimple_call_clobber_set (gimple call)
2983 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2984 return &call_stmt->call_clobbered;
2988 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2989 non-NULL lhs. */
2991 static inline bool
2992 gimple_has_lhs (gimple stmt)
2994 return (is_gimple_assign (stmt)
2995 || (is_gimple_call (stmt)
2996 && gimple_call_lhs (stmt) != NULL_TREE));
3000 /* Return the code of the predicate computed by conditional statement GS. */
3002 static inline enum tree_code
3003 gimple_cond_code (const_gimple gs)
3005 GIMPLE_CHECK (gs, GIMPLE_COND);
3006 return (enum tree_code) gs->subcode;
3010 /* Set CODE to be the predicate code for the conditional statement GS. */
3012 static inline void
3013 gimple_cond_set_code (gimple gs, enum tree_code code)
3015 GIMPLE_CHECK (gs, GIMPLE_COND);
3016 gs->subcode = code;
3020 /* Return the LHS of the predicate computed by conditional statement GS. */
3022 static inline tree
3023 gimple_cond_lhs (const_gimple gs)
3025 GIMPLE_CHECK (gs, GIMPLE_COND);
3026 return gimple_op (gs, 0);
3029 /* Return the pointer to the LHS of the predicate computed by conditional
3030 statement GS. */
3032 static inline tree *
3033 gimple_cond_lhs_ptr (const_gimple gs)
3035 GIMPLE_CHECK (gs, GIMPLE_COND);
3036 return gimple_op_ptr (gs, 0);
3039 /* Set LHS to be the LHS operand of the predicate computed by
3040 conditional statement GS. */
3042 static inline void
3043 gimple_cond_set_lhs (gimple gs, tree lhs)
3045 GIMPLE_CHECK (gs, GIMPLE_COND);
3046 gimple_set_op (gs, 0, lhs);
3050 /* Return the RHS operand of the predicate computed by conditional GS. */
3052 static inline tree
3053 gimple_cond_rhs (const_gimple gs)
3055 GIMPLE_CHECK (gs, GIMPLE_COND);
3056 return gimple_op (gs, 1);
3059 /* Return the pointer to the RHS operand of the predicate computed by
3060 conditional GS. */
3062 static inline tree *
3063 gimple_cond_rhs_ptr (const_gimple gs)
3065 GIMPLE_CHECK (gs, GIMPLE_COND);
3066 return gimple_op_ptr (gs, 1);
3070 /* Set RHS to be the RHS operand of the predicate computed by
3071 conditional statement GS. */
3073 static inline void
3074 gimple_cond_set_rhs (gimple gs, tree rhs)
3076 GIMPLE_CHECK (gs, GIMPLE_COND);
3077 gimple_set_op (gs, 1, rhs);
3081 /* Return the label used by conditional statement GS when its
3082 predicate evaluates to true. */
3084 static inline tree
3085 gimple_cond_true_label (const_gimple gs)
3087 GIMPLE_CHECK (gs, GIMPLE_COND);
3088 return gimple_op (gs, 2);
3092 /* Set LABEL to be the label used by conditional statement GS when its
3093 predicate evaluates to true. */
3095 static inline void
3096 gimple_cond_set_true_label (gimple gs, tree label)
3098 GIMPLE_CHECK (gs, GIMPLE_COND);
3099 gimple_set_op (gs, 2, label);
3103 /* Set LABEL to be the label used by conditional statement GS when its
3104 predicate evaluates to false. */
3106 static inline void
3107 gimple_cond_set_false_label (gimple gs, tree label)
3109 GIMPLE_CHECK (gs, GIMPLE_COND);
3110 gimple_set_op (gs, 3, label);
3114 /* Return the label used by conditional statement GS when its
3115 predicate evaluates to false. */
3117 static inline tree
3118 gimple_cond_false_label (const_gimple gs)
3120 GIMPLE_CHECK (gs, GIMPLE_COND);
3121 return gimple_op (gs, 3);
3125 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3127 static inline void
3128 gimple_cond_make_false (gimple gs)
3130 gimple_cond_set_lhs (gs, boolean_true_node);
3131 gimple_cond_set_rhs (gs, boolean_false_node);
3132 gs->subcode = EQ_EXPR;
3136 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3138 static inline void
3139 gimple_cond_make_true (gimple gs)
3141 gimple_cond_set_lhs (gs, boolean_true_node);
3142 gimple_cond_set_rhs (gs, boolean_true_node);
3143 gs->subcode = EQ_EXPR;
3146 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3147 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3149 static inline bool
3150 gimple_cond_true_p (const_gimple_cond gs)
3152 tree lhs = gimple_cond_lhs (gs);
3153 tree rhs = gimple_cond_rhs (gs);
3154 enum tree_code code = gimple_cond_code (gs);
3156 if (lhs != boolean_true_node && lhs != boolean_false_node)
3157 return false;
3159 if (rhs != boolean_true_node && rhs != boolean_false_node)
3160 return false;
3162 if (code == NE_EXPR && lhs != rhs)
3163 return true;
3165 if (code == EQ_EXPR && lhs == rhs)
3166 return true;
3168 return false;
3171 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3172 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3174 static inline bool
3175 gimple_cond_false_p (const_gimple_cond gs)
3177 tree lhs = gimple_cond_lhs (gs);
3178 tree rhs = gimple_cond_rhs (gs);
3179 enum tree_code code = gimple_cond_code (gs);
3181 if (lhs != boolean_true_node && lhs != boolean_false_node)
3182 return false;
3184 if (rhs != boolean_true_node && rhs != boolean_false_node)
3185 return false;
3187 if (code == NE_EXPR && lhs == rhs)
3188 return true;
3190 if (code == EQ_EXPR && lhs != rhs)
3191 return true;
3193 return false;
3196 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3198 static inline void
3199 gimple_cond_set_condition (gimple_cond stmt, enum tree_code code, tree lhs,
3200 tree rhs)
3202 gimple_cond_set_code (stmt, code);
3203 gimple_cond_set_lhs (stmt, lhs);
3204 gimple_cond_set_rhs (stmt, rhs);
3207 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3209 static inline tree
3210 gimple_label_label (const_gimple gs)
3212 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3213 return gimple_op (gs, 0);
3217 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3218 GS. */
3220 static inline void
3221 gimple_label_set_label (gimple gs, tree label)
3223 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3224 gimple_set_op (gs, 0, label);
3228 /* Return the destination of the unconditional jump GS. */
3230 static inline tree
3231 gimple_goto_dest (const_gimple gs)
3233 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3234 return gimple_op (gs, 0);
3238 /* Set DEST to be the destination of the unconditonal jump GS. */
3240 static inline void
3241 gimple_goto_set_dest (gimple gs, tree dest)
3243 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3244 gimple_set_op (gs, 0, dest);
3248 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3250 static inline tree
3251 gimple_bind_vars (const_gimple_bind bind_stmt)
3253 return bind_stmt->vars;
3257 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3258 statement GS. */
3260 static inline void
3261 gimple_bind_set_vars (gimple_bind bind_stmt, tree vars)
3263 bind_stmt->vars = vars;
3267 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3268 statement GS. */
3270 static inline void
3271 gimple_bind_append_vars (gimple_bind bind_stmt, tree vars)
3273 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3277 static inline gimple_seq *
3278 gimple_bind_body_ptr (gimple_bind bind_stmt)
3280 return &bind_stmt->body;
3283 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3285 static inline gimple_seq
3286 gimple_bind_body (gimple_bind gs)
3288 return *gimple_bind_body_ptr (gs);
3292 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3293 statement GS. */
3295 static inline void
3296 gimple_bind_set_body (gimple_bind bind_stmt, gimple_seq seq)
3298 bind_stmt->body = seq;
3302 /* Append a statement to the end of a GIMPLE_BIND's body. */
3304 static inline void
3305 gimple_bind_add_stmt (gimple_bind bind_stmt, gimple stmt)
3307 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3311 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3313 static inline void
3314 gimple_bind_add_seq (gimple_bind bind_stmt, gimple_seq seq)
3316 gimple_seq_add_seq (&bind_stmt->body, seq);
3320 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3321 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3323 static inline tree
3324 gimple_bind_block (const_gimple_bind bind_stmt)
3326 return bind_stmt->block;
3330 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3331 statement GS. */
3333 static inline void
3334 gimple_bind_set_block (gimple_bind bind_stmt, tree block)
3336 gcc_gimple_checking_assert (block == NULL_TREE
3337 || TREE_CODE (block) == BLOCK);
3338 bind_stmt->block = block;
3342 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3344 static inline unsigned
3345 gimple_asm_ninputs (const_gimple_asm asm_stmt)
3347 return asm_stmt->ni;
3351 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3353 static inline unsigned
3354 gimple_asm_noutputs (const_gimple_asm asm_stmt)
3356 return asm_stmt->no;
3360 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3362 static inline unsigned
3363 gimple_asm_nclobbers (const_gimple_asm asm_stmt)
3365 return asm_stmt->nc;
3368 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3370 static inline unsigned
3371 gimple_asm_nlabels (const_gimple_asm asm_stmt)
3373 return asm_stmt->nl;
3376 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3378 static inline tree
3379 gimple_asm_input_op (const_gimple_asm asm_stmt, unsigned index)
3381 gcc_gimple_checking_assert (index < asm_stmt->ni);
3382 return gimple_op (asm_stmt, index + asm_stmt->no);
3385 /* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */
3387 static inline tree *
3388 gimple_asm_input_op_ptr (const_gimple_asm asm_stmt, unsigned index)
3390 gcc_gimple_checking_assert (index < asm_stmt->ni);
3391 return gimple_op_ptr (asm_stmt, index + asm_stmt->no);
3395 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3397 static inline void
3398 gimple_asm_set_input_op (gimple_asm asm_stmt, unsigned index, tree in_op)
3400 gcc_gimple_checking_assert (index < asm_stmt->ni
3401 && TREE_CODE (in_op) == TREE_LIST);
3402 gimple_set_op (asm_stmt, index + asm_stmt->no, in_op);
3406 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3408 static inline tree
3409 gimple_asm_output_op (const_gimple_asm asm_stmt, unsigned index)
3411 gcc_gimple_checking_assert (index < asm_stmt->no);
3412 return gimple_op (asm_stmt, index);
3415 /* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */
3417 static inline tree *
3418 gimple_asm_output_op_ptr (const_gimple_asm asm_stmt, unsigned index)
3420 gcc_gimple_checking_assert (index < asm_stmt->no);
3421 return gimple_op_ptr (asm_stmt, index);
3425 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3427 static inline void
3428 gimple_asm_set_output_op (gimple_asm asm_stmt, unsigned index, tree out_op)
3430 gcc_gimple_checking_assert (index < asm_stmt->no
3431 && TREE_CODE (out_op) == TREE_LIST);
3432 gimple_set_op (asm_stmt, index, out_op);
3436 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3438 static inline tree
3439 gimple_asm_clobber_op (const_gimple_asm asm_stmt, unsigned index)
3441 gcc_gimple_checking_assert (index < asm_stmt->nc);
3442 return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no);
3446 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3448 static inline void
3449 gimple_asm_set_clobber_op (gimple_asm asm_stmt, unsigned index, tree clobber_op)
3451 gcc_gimple_checking_assert (index < asm_stmt->nc
3452 && TREE_CODE (clobber_op) == TREE_LIST);
3453 gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3456 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3458 static inline tree
3459 gimple_asm_label_op (const_gimple_asm asm_stmt, unsigned index)
3461 gcc_gimple_checking_assert (index < asm_stmt->nl);
3462 return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc);
3465 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3467 static inline void
3468 gimple_asm_set_label_op (gimple_asm asm_stmt, unsigned index, tree label_op)
3470 gcc_gimple_checking_assert (index < asm_stmt->nl
3471 && TREE_CODE (label_op) == TREE_LIST);
3472 gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc, label_op);
3475 /* Return the string representing the assembly instruction in
3476 GIMPLE_ASM ASM_STMT. */
3478 static inline const char *
3479 gimple_asm_string (const_gimple_asm asm_stmt)
3481 return asm_stmt->string;
3485 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3487 static inline bool
3488 gimple_asm_volatile_p (const_gimple_asm asm_stmt)
3490 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3494 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3496 static inline void
3497 gimple_asm_set_volatile (gimple_asm asm_stmt, bool volatile_p)
3499 if (volatile_p)
3500 asm_stmt->subcode |= GF_ASM_VOLATILE;
3501 else
3502 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3506 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3508 static inline void
3509 gimple_asm_set_input (gimple_asm asm_stmt, bool input_p)
3511 if (input_p)
3512 asm_stmt->subcode |= GF_ASM_INPUT;
3513 else
3514 asm_stmt->subcode &= ~GF_ASM_INPUT;
3518 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3520 static inline bool
3521 gimple_asm_input_p (const_gimple_asm asm_stmt)
3523 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3527 /* Return the types handled by GIMPLE_CATCH statement GS. */
3529 static inline tree
3530 gimple_catch_types (const_gimple gs)
3532 const gimple_statement_catch *catch_stmt =
3533 as_a <const gimple_statement_catch *> (gs);
3534 return catch_stmt->types;
3538 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3540 static inline tree *
3541 gimple_catch_types_ptr (gimple_catch catch_stmt)
3543 return &catch_stmt->types;
3547 /* Return a pointer to the GIMPLE sequence representing the body of
3548 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3550 static inline gimple_seq *
3551 gimple_catch_handler_ptr (gimple_catch catch_stmt)
3553 return &catch_stmt->handler;
3557 /* Return the GIMPLE sequence representing the body of the handler of
3558 GIMPLE_CATCH statement CATCH_STMT. */
3560 static inline gimple_seq
3561 gimple_catch_handler (gimple_catch catch_stmt)
3563 return *gimple_catch_handler_ptr (catch_stmt);
3567 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3569 static inline void
3570 gimple_catch_set_types (gimple_catch catch_stmt, tree t)
3572 catch_stmt->types = t;
3576 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3578 static inline void
3579 gimple_catch_set_handler (gimple_catch catch_stmt, gimple_seq handler)
3581 catch_stmt->handler = handler;
3585 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3587 static inline tree
3588 gimple_eh_filter_types (const_gimple gs)
3590 const gimple_statement_eh_filter *eh_filter_stmt =
3591 as_a <const gimple_statement_eh_filter *> (gs);
3592 return eh_filter_stmt->types;
3596 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3597 GS. */
3599 static inline tree *
3600 gimple_eh_filter_types_ptr (gimple gs)
3602 gimple_statement_eh_filter *eh_filter_stmt =
3603 as_a <gimple_statement_eh_filter *> (gs);
3604 return &eh_filter_stmt->types;
3608 /* Return a pointer to the sequence of statement to execute when
3609 GIMPLE_EH_FILTER statement fails. */
3611 static inline gimple_seq *
3612 gimple_eh_filter_failure_ptr (gimple gs)
3614 gimple_statement_eh_filter *eh_filter_stmt =
3615 as_a <gimple_statement_eh_filter *> (gs);
3616 return &eh_filter_stmt->failure;
3620 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3621 statement fails. */
3623 static inline gimple_seq
3624 gimple_eh_filter_failure (gimple gs)
3626 return *gimple_eh_filter_failure_ptr (gs);
3630 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3632 static inline void
3633 gimple_eh_filter_set_types (gimple gs, tree types)
3635 gimple_statement_eh_filter *eh_filter_stmt =
3636 as_a <gimple_statement_eh_filter *> (gs);
3637 eh_filter_stmt->types = types;
3641 /* Set FAILURE to be the sequence of statements to execute on failure
3642 for GIMPLE_EH_FILTER GS. */
3644 static inline void
3645 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3647 gimple_statement_eh_filter *eh_filter_stmt =
3648 as_a <gimple_statement_eh_filter *> (gs);
3649 eh_filter_stmt->failure = failure;
3652 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3654 static inline tree
3655 gimple_eh_must_not_throw_fndecl (gimple_eh_must_not_throw eh_mnt_stmt)
3657 return eh_mnt_stmt->fndecl;
3660 /* Set the function decl to be called by GS to DECL. */
3662 static inline void
3663 gimple_eh_must_not_throw_set_fndecl (gimple_eh_must_not_throw eh_mnt_stmt,
3664 tree decl)
3666 eh_mnt_stmt->fndecl = decl;
3669 /* GIMPLE_EH_ELSE accessors. */
3671 static inline gimple_seq *
3672 gimple_eh_else_n_body_ptr (gimple gs)
3674 gimple_statement_eh_else *eh_else_stmt =
3675 as_a <gimple_statement_eh_else *> (gs);
3676 return &eh_else_stmt->n_body;
3679 static inline gimple_seq
3680 gimple_eh_else_n_body (gimple gs)
3682 return *gimple_eh_else_n_body_ptr (gs);
3685 static inline gimple_seq *
3686 gimple_eh_else_e_body_ptr (gimple gs)
3688 gimple_statement_eh_else *eh_else_stmt =
3689 as_a <gimple_statement_eh_else *> (gs);
3690 return &eh_else_stmt->e_body;
3693 static inline gimple_seq
3694 gimple_eh_else_e_body (gimple gs)
3696 return *gimple_eh_else_e_body_ptr (gs);
3699 static inline void
3700 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3702 gimple_statement_eh_else *eh_else_stmt =
3703 as_a <gimple_statement_eh_else *> (gs);
3704 eh_else_stmt->n_body = seq;
3707 static inline void
3708 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3710 gimple_statement_eh_else *eh_else_stmt =
3711 as_a <gimple_statement_eh_else *> (gs);
3712 eh_else_stmt->e_body = seq;
3715 /* GIMPLE_TRY accessors. */
3717 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3718 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3720 static inline enum gimple_try_flags
3721 gimple_try_kind (const_gimple gs)
3723 GIMPLE_CHECK (gs, GIMPLE_TRY);
3724 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3728 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3730 static inline void
3731 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3733 GIMPLE_CHECK (gs, GIMPLE_TRY);
3734 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3735 || kind == GIMPLE_TRY_FINALLY);
3736 if (gimple_try_kind (gs) != kind)
3737 gs->subcode = (unsigned int) kind;
3741 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3743 static inline bool
3744 gimple_try_catch_is_cleanup (const_gimple gs)
3746 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3747 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3751 /* Return a pointer to the sequence of statements used as the
3752 body for GIMPLE_TRY GS. */
3754 static inline gimple_seq *
3755 gimple_try_eval_ptr (gimple gs)
3757 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3758 return &try_stmt->eval;
3762 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3764 static inline gimple_seq
3765 gimple_try_eval (gimple gs)
3767 return *gimple_try_eval_ptr (gs);
3771 /* Return a pointer to the sequence of statements used as the cleanup body for
3772 GIMPLE_TRY GS. */
3774 static inline gimple_seq *
3775 gimple_try_cleanup_ptr (gimple gs)
3777 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3778 return &try_stmt->cleanup;
3782 /* Return the sequence of statements used as the cleanup body for
3783 GIMPLE_TRY GS. */
3785 static inline gimple_seq
3786 gimple_try_cleanup (gimple gs)
3788 return *gimple_try_cleanup_ptr (gs);
3792 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3794 static inline void
3795 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3797 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3798 if (catch_is_cleanup)
3799 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3800 else
3801 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3805 /* Set EVAL to be the sequence of statements to use as the body for
3806 GIMPLE_TRY GS. */
3808 static inline void
3809 gimple_try_set_eval (gimple gs, gimple_seq eval)
3811 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3812 try_stmt->eval = eval;
3816 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3817 body for GIMPLE_TRY GS. */
3819 static inline void
3820 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3822 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3823 try_stmt->cleanup = cleanup;
3827 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3829 static inline gimple_seq *
3830 gimple_wce_cleanup_ptr (gimple gs)
3832 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3833 return &wce_stmt->cleanup;
3837 /* Return the cleanup sequence for cleanup statement GS. */
3839 static inline gimple_seq
3840 gimple_wce_cleanup (gimple gs)
3842 return *gimple_wce_cleanup_ptr (gs);
3846 /* Set CLEANUP to be the cleanup sequence for GS. */
3848 static inline void
3849 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3851 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3852 wce_stmt->cleanup = cleanup;
3856 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3858 static inline bool
3859 gimple_wce_cleanup_eh_only (const_gimple gs)
3861 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3862 return gs->subcode != 0;
3866 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3868 static inline void
3869 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3871 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3872 gs->subcode = (unsigned int) eh_only_p;
3876 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3878 static inline unsigned
3879 gimple_phi_capacity (const_gimple gs)
3881 const_gimple_phi phi_stmt =
3882 as_a <const_gimple_phi> (gs);
3883 return phi_stmt->capacity;
3887 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3888 be exactly the number of incoming edges for the basic block holding
3889 GS. */
3891 static inline unsigned
3892 gimple_phi_num_args (const_gimple gs)
3894 const_gimple_phi phi_stmt =
3895 as_a <const_gimple_phi> (gs);
3896 return phi_stmt->nargs;
3900 /* Return the SSA name created by GIMPLE_PHI GS. */
3902 static inline tree
3903 gimple_phi_result (const_gimple gs)
3905 const_gimple_phi phi_stmt =
3906 as_a <const_gimple_phi> (gs);
3907 return phi_stmt->result;
3910 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3912 static inline tree *
3913 gimple_phi_result_ptr (gimple gs)
3915 gimple_phi phi_stmt = as_a <gimple_phi> (gs);
3916 return &phi_stmt->result;
3919 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3921 static inline void
3922 gimple_phi_set_result (gimple gs, tree result)
3924 gimple_phi phi_stmt = as_a <gimple_phi> (gs);
3925 phi_stmt->result = result;
3926 if (result && TREE_CODE (result) == SSA_NAME)
3927 SSA_NAME_DEF_STMT (result) = gs;
3931 /* Return the PHI argument corresponding to incoming edge INDEX for
3932 GIMPLE_PHI GS. */
3934 static inline struct phi_arg_d *
3935 gimple_phi_arg (gimple gs, unsigned index)
3937 gimple_phi phi_stmt = as_a <gimple_phi> (gs);
3938 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3939 return &(phi_stmt->args[index]);
3942 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3943 for GIMPLE_PHI GS. */
3945 static inline void
3946 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3948 gimple_phi phi_stmt = as_a <gimple_phi> (gs);
3949 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3950 phi_stmt->args[index] = *phiarg;
3953 /* Return the PHI nodes for basic block BB, or NULL if there are no
3954 PHI nodes. */
3956 static inline gimple_seq
3957 phi_nodes (const_basic_block bb)
3959 gcc_checking_assert (!(bb->flags & BB_RTL));
3960 return bb->il.gimple.phi_nodes;
3963 /* Return a pointer to the PHI nodes for basic block BB. */
3965 static inline gimple_seq *
3966 phi_nodes_ptr (basic_block bb)
3968 gcc_checking_assert (!(bb->flags & BB_RTL));
3969 return &bb->il.gimple.phi_nodes;
3972 /* Return the tree operand for argument I of PHI node GS. */
3974 static inline tree
3975 gimple_phi_arg_def (gimple gs, size_t index)
3977 return gimple_phi_arg (gs, index)->def;
3981 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3983 static inline tree *
3984 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3986 return &gimple_phi_arg (gs, index)->def;
3989 /* Return the edge associated with argument I of phi node GS. */
3991 static inline edge
3992 gimple_phi_arg_edge (gimple gs, size_t i)
3994 return EDGE_PRED (gimple_bb (gs), i);
3997 /* Return the source location of gimple argument I of phi node GS. */
3999 static inline source_location
4000 gimple_phi_arg_location (gimple gs, size_t i)
4002 return gimple_phi_arg (gs, i)->locus;
4005 /* Return the source location of the argument on edge E of phi node GS. */
4007 static inline source_location
4008 gimple_phi_arg_location_from_edge (gimple gs, edge e)
4010 return gimple_phi_arg (gs, e->dest_idx)->locus;
4013 /* Set the source location of gimple argument I of phi node GS to LOC. */
4015 static inline void
4016 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
4018 gimple_phi_arg (gs, i)->locus = loc;
4021 /* Return TRUE if argument I of phi node GS has a location record. */
4023 static inline bool
4024 gimple_phi_arg_has_location (gimple gs, size_t i)
4026 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
4030 /* Return the region number for GIMPLE_RESX GS. */
4032 static inline int
4033 gimple_resx_region (const_gimple gs)
4035 const gimple_statement_resx *resx_stmt =
4036 as_a <const gimple_statement_resx *> (gs);
4037 return resx_stmt->region;
4040 /* Set REGION to be the region number for GIMPLE_RESX GS. */
4042 static inline void
4043 gimple_resx_set_region (gimple gs, int region)
4045 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
4046 resx_stmt->region = region;
4049 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
4051 static inline int
4052 gimple_eh_dispatch_region (const_gimple gs)
4054 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
4055 as_a <const gimple_statement_eh_dispatch *> (gs);
4056 return eh_dispatch_stmt->region;
4059 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
4061 static inline void
4062 gimple_eh_dispatch_set_region (gimple gs, int region)
4064 gimple_statement_eh_dispatch *eh_dispatch_stmt =
4065 as_a <gimple_statement_eh_dispatch *> (gs);
4066 eh_dispatch_stmt->region = region;
4069 /* Return the number of labels associated with the switch statement GS. */
4071 static inline unsigned
4072 gimple_switch_num_labels (const_gimple_switch gs)
4074 unsigned num_ops;
4075 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4076 num_ops = gimple_num_ops (gs);
4077 gcc_gimple_checking_assert (num_ops > 1);
4078 return num_ops - 1;
4082 /* Set NLABELS to be the number of labels for the switch statement GS. */
4084 static inline void
4085 gimple_switch_set_num_labels (gimple_switch g, unsigned nlabels)
4087 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4088 gimple_set_num_ops (g, nlabels + 1);
4092 /* Return the index variable used by the switch statement GS. */
4094 static inline tree
4095 gimple_switch_index (const_gimple gs)
4097 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4098 return gimple_op (gs, 0);
4102 /* Return a pointer to the index variable for the switch statement GS. */
4104 static inline tree *
4105 gimple_switch_index_ptr (const_gimple gs)
4107 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4108 return gimple_op_ptr (gs, 0);
4112 /* Set INDEX to be the index variable for switch statement GS. */
4114 static inline void
4115 gimple_switch_set_index (gimple_switch gs, tree index)
4117 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4118 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4119 gimple_set_op (gs, 0, index);
4123 /* Return the label numbered INDEX. The default label is 0, followed by any
4124 labels in a switch statement. */
4126 static inline tree
4127 gimple_switch_label (const_gimple_switch gs, unsigned index)
4129 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4130 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4131 return gimple_op (gs, index + 1);
4134 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4136 static inline void
4137 gimple_switch_set_label (gimple_switch gs, unsigned index, tree label)
4139 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4140 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4141 && (label == NULL_TREE
4142 || TREE_CODE (label) == CASE_LABEL_EXPR));
4143 gimple_set_op (gs, index + 1, label);
4146 /* Return the default label for a switch statement. */
4148 static inline tree
4149 gimple_switch_default_label (const_gimple_switch gs)
4151 tree label = gimple_switch_label (gs, 0);
4152 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4153 return label;
4156 /* Set the default label for a switch statement. */
4158 static inline void
4159 gimple_switch_set_default_label (gimple_switch gs, tree label)
4161 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4162 gimple_switch_set_label (gs, 0, label);
4165 /* Return true if GS is a GIMPLE_DEBUG statement. */
4167 static inline bool
4168 is_gimple_debug (const_gimple gs)
4170 return gimple_code (gs) == GIMPLE_DEBUG;
4173 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4175 static inline bool
4176 gimple_debug_bind_p (const_gimple s)
4178 if (is_gimple_debug (s))
4179 return s->subcode == GIMPLE_DEBUG_BIND;
4181 return false;
4184 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4186 static inline tree
4187 gimple_debug_bind_get_var (gimple dbg)
4189 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4190 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4191 return gimple_op (dbg, 0);
4194 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4195 statement. */
4197 static inline tree
4198 gimple_debug_bind_get_value (gimple dbg)
4200 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4201 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4202 return gimple_op (dbg, 1);
4205 /* Return a pointer to the value bound to the variable in a
4206 GIMPLE_DEBUG bind statement. */
4208 static inline tree *
4209 gimple_debug_bind_get_value_ptr (gimple dbg)
4211 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4212 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4213 return gimple_op_ptr (dbg, 1);
4216 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4218 static inline void
4219 gimple_debug_bind_set_var (gimple dbg, tree var)
4221 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4222 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4223 gimple_set_op (dbg, 0, var);
4226 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4227 statement. */
4229 static inline void
4230 gimple_debug_bind_set_value (gimple dbg, tree value)
4232 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4233 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4234 gimple_set_op (dbg, 1, value);
4237 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4238 optimized away. */
4239 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4241 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4242 statement. */
4244 static inline void
4245 gimple_debug_bind_reset_value (gimple dbg)
4247 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4248 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4249 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4252 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4253 value. */
4255 static inline bool
4256 gimple_debug_bind_has_value_p (gimple dbg)
4258 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4259 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4260 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4263 #undef GIMPLE_DEBUG_BIND_NOVALUE
4265 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4267 static inline bool
4268 gimple_debug_source_bind_p (const_gimple s)
4270 if (is_gimple_debug (s))
4271 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4273 return false;
4276 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4278 static inline tree
4279 gimple_debug_source_bind_get_var (gimple dbg)
4281 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4282 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4283 return gimple_op (dbg, 0);
4286 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4287 statement. */
4289 static inline tree
4290 gimple_debug_source_bind_get_value (gimple dbg)
4292 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4293 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4294 return gimple_op (dbg, 1);
4297 /* Return a pointer to the value bound to the variable in a
4298 GIMPLE_DEBUG source bind statement. */
4300 static inline tree *
4301 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4303 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4304 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4305 return gimple_op_ptr (dbg, 1);
4308 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4310 static inline void
4311 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4313 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4314 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4315 gimple_set_op (dbg, 0, var);
4318 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4319 statement. */
4321 static inline void
4322 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4324 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4325 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4326 gimple_set_op (dbg, 1, value);
4329 /* Return the line number for EXPR, or return -1 if we have no line
4330 number information for it. */
4331 static inline int
4332 get_lineno (const_gimple stmt)
4334 location_t loc;
4336 if (!stmt)
4337 return -1;
4339 loc = gimple_location (stmt);
4340 if (loc == UNKNOWN_LOCATION)
4341 return -1;
4343 return LOCATION_LINE (loc);
4346 /* Return a pointer to the body for the OMP statement GS. */
4348 static inline gimple_seq *
4349 gimple_omp_body_ptr (gimple gs)
4351 return &static_cast <gimple_statement_omp *> (gs)->body;
4354 /* Return the body for the OMP statement GS. */
4356 static inline gimple_seq
4357 gimple_omp_body (gimple gs)
4359 return *gimple_omp_body_ptr (gs);
4362 /* Set BODY to be the body for the OMP statement GS. */
4364 static inline void
4365 gimple_omp_set_body (gimple gs, gimple_seq body)
4367 static_cast <gimple_statement_omp *> (gs)->body = body;
4371 /* Return the name associated with OMP_CRITICAL statement GS. */
4373 static inline tree
4374 gimple_omp_critical_name (const_gimple gs)
4376 const gimple_statement_omp_critical *omp_critical_stmt =
4377 as_a <const gimple_statement_omp_critical *> (gs);
4378 return omp_critical_stmt->name;
4382 /* Return a pointer to the name associated with OMP critical statement GS. */
4384 static inline tree *
4385 gimple_omp_critical_name_ptr (gimple gs)
4387 gimple_statement_omp_critical *omp_critical_stmt =
4388 as_a <gimple_statement_omp_critical *> (gs);
4389 return &omp_critical_stmt->name;
4393 /* Set NAME to be the name associated with OMP critical statement GS. */
4395 static inline void
4396 gimple_omp_critical_set_name (gimple gs, tree name)
4398 gimple_statement_omp_critical *omp_critical_stmt =
4399 as_a <gimple_statement_omp_critical *> (gs);
4400 omp_critical_stmt->name = name;
4404 /* Return the kind of OMP for statemement. */
4406 static inline int
4407 gimple_omp_for_kind (const_gimple g)
4409 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4410 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4414 /* Set the OMP for kind. */
4416 static inline void
4417 gimple_omp_for_set_kind (gimple g, int kind)
4419 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4420 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4421 | (kind & GF_OMP_FOR_KIND_MASK);
4425 /* Return true if OMP for statement G has the
4426 GF_OMP_FOR_COMBINED flag set. */
4428 static inline bool
4429 gimple_omp_for_combined_p (const_gimple g)
4431 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4432 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4436 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4437 value of COMBINED_P. */
4439 static inline void
4440 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4442 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4443 if (combined_p)
4444 g->subcode |= GF_OMP_FOR_COMBINED;
4445 else
4446 g->subcode &= ~GF_OMP_FOR_COMBINED;
4450 /* Return true if OMP for statement G has the
4451 GF_OMP_FOR_COMBINED_INTO flag set. */
4453 static inline bool
4454 gimple_omp_for_combined_into_p (const_gimple g)
4456 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4457 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4461 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4462 value of COMBINED_P. */
4464 static inline void
4465 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4467 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4468 if (combined_p)
4469 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4470 else
4471 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4475 /* Return the clauses associated with OMP_FOR GS. */
4477 static inline tree
4478 gimple_omp_for_clauses (const_gimple gs)
4480 const gimple_statement_omp_for *omp_for_stmt =
4481 as_a <const gimple_statement_omp_for *> (gs);
4482 return omp_for_stmt->clauses;
4486 /* Return a pointer to the OMP_FOR GS. */
4488 static inline tree *
4489 gimple_omp_for_clauses_ptr (gimple gs)
4491 gimple_statement_omp_for *omp_for_stmt =
4492 as_a <gimple_statement_omp_for *> (gs);
4493 return &omp_for_stmt->clauses;
4497 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4499 static inline void
4500 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4502 gimple_statement_omp_for *omp_for_stmt =
4503 as_a <gimple_statement_omp_for *> (gs);
4504 omp_for_stmt->clauses = clauses;
4508 /* Get the collapse count of OMP_FOR GS. */
4510 static inline size_t
4511 gimple_omp_for_collapse (gimple gs)
4513 gimple_statement_omp_for *omp_for_stmt =
4514 as_a <gimple_statement_omp_for *> (gs);
4515 return omp_for_stmt->collapse;
4519 /* Return the index variable for OMP_FOR GS. */
4521 static inline tree
4522 gimple_omp_for_index (const_gimple gs, size_t i)
4524 const gimple_statement_omp_for *omp_for_stmt =
4525 as_a <const gimple_statement_omp_for *> (gs);
4526 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4527 return omp_for_stmt->iter[i].index;
4531 /* Return a pointer to the index variable for OMP_FOR GS. */
4533 static inline tree *
4534 gimple_omp_for_index_ptr (gimple gs, size_t i)
4536 gimple_statement_omp_for *omp_for_stmt =
4537 as_a <gimple_statement_omp_for *> (gs);
4538 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4539 return &omp_for_stmt->iter[i].index;
4543 /* Set INDEX to be the index variable for OMP_FOR GS. */
4545 static inline void
4546 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4548 gimple_statement_omp_for *omp_for_stmt =
4549 as_a <gimple_statement_omp_for *> (gs);
4550 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4551 omp_for_stmt->iter[i].index = index;
4555 /* Return the initial value for OMP_FOR GS. */
4557 static inline tree
4558 gimple_omp_for_initial (const_gimple gs, size_t i)
4560 const gimple_statement_omp_for *omp_for_stmt =
4561 as_a <const gimple_statement_omp_for *> (gs);
4562 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4563 return omp_for_stmt->iter[i].initial;
4567 /* Return a pointer to the initial value for OMP_FOR GS. */
4569 static inline tree *
4570 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4572 gimple_statement_omp_for *omp_for_stmt =
4573 as_a <gimple_statement_omp_for *> (gs);
4574 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4575 return &omp_for_stmt->iter[i].initial;
4579 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4581 static inline void
4582 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4584 gimple_statement_omp_for *omp_for_stmt =
4585 as_a <gimple_statement_omp_for *> (gs);
4586 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4587 omp_for_stmt->iter[i].initial = initial;
4591 /* Return the final value for OMP_FOR GS. */
4593 static inline tree
4594 gimple_omp_for_final (const_gimple gs, size_t i)
4596 const gimple_statement_omp_for *omp_for_stmt =
4597 as_a <const gimple_statement_omp_for *> (gs);
4598 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4599 return omp_for_stmt->iter[i].final;
4603 /* Return a pointer to the final value for OMP_FOR GS. */
4605 static inline tree *
4606 gimple_omp_for_final_ptr (gimple gs, size_t i)
4608 gimple_statement_omp_for *omp_for_stmt =
4609 as_a <gimple_statement_omp_for *> (gs);
4610 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4611 return &omp_for_stmt->iter[i].final;
4615 /* Set FINAL to be the final value for OMP_FOR GS. */
4617 static inline void
4618 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4620 gimple_statement_omp_for *omp_for_stmt =
4621 as_a <gimple_statement_omp_for *> (gs);
4622 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4623 omp_for_stmt->iter[i].final = final;
4627 /* Return the increment value for OMP_FOR GS. */
4629 static inline tree
4630 gimple_omp_for_incr (const_gimple gs, size_t i)
4632 const gimple_statement_omp_for *omp_for_stmt =
4633 as_a <const gimple_statement_omp_for *> (gs);
4634 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4635 return omp_for_stmt->iter[i].incr;
4639 /* Return a pointer to the increment value for OMP_FOR GS. */
4641 static inline tree *
4642 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4644 gimple_statement_omp_for *omp_for_stmt =
4645 as_a <gimple_statement_omp_for *> (gs);
4646 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4647 return &omp_for_stmt->iter[i].incr;
4651 /* Set INCR to be the increment value for OMP_FOR GS. */
4653 static inline void
4654 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4656 gimple_statement_omp_for *omp_for_stmt =
4657 as_a <gimple_statement_omp_for *> (gs);
4658 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4659 omp_for_stmt->iter[i].incr = incr;
4663 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4664 statement GS starts. */
4666 static inline gimple_seq *
4667 gimple_omp_for_pre_body_ptr (gimple gs)
4669 gimple_statement_omp_for *omp_for_stmt =
4670 as_a <gimple_statement_omp_for *> (gs);
4671 return &omp_for_stmt->pre_body;
4675 /* Return the sequence of statements to execute before the OMP_FOR
4676 statement GS starts. */
4678 static inline gimple_seq
4679 gimple_omp_for_pre_body (gimple gs)
4681 return *gimple_omp_for_pre_body_ptr (gs);
4685 /* Set PRE_BODY to be the sequence of statements to execute before the
4686 OMP_FOR statement GS starts. */
4688 static inline void
4689 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4691 gimple_statement_omp_for *omp_for_stmt =
4692 as_a <gimple_statement_omp_for *> (gs);
4693 omp_for_stmt->pre_body = pre_body;
4697 /* Return the clauses associated with OMP_PARALLEL GS. */
4699 static inline tree
4700 gimple_omp_parallel_clauses (const_gimple gs)
4702 const gimple_statement_omp_parallel *omp_parallel_stmt =
4703 as_a <const gimple_statement_omp_parallel *> (gs);
4704 return omp_parallel_stmt->clauses;
4708 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4710 static inline tree *
4711 gimple_omp_parallel_clauses_ptr (gimple gs)
4713 gimple_statement_omp_parallel *omp_parallel_stmt =
4714 as_a <gimple_statement_omp_parallel *> (gs);
4715 return &omp_parallel_stmt->clauses;
4719 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4720 GS. */
4722 static inline void
4723 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4725 gimple_statement_omp_parallel *omp_parallel_stmt =
4726 as_a <gimple_statement_omp_parallel *> (gs);
4727 omp_parallel_stmt->clauses = clauses;
4731 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4733 static inline tree
4734 gimple_omp_parallel_child_fn (const_gimple gs)
4736 const gimple_statement_omp_parallel *omp_parallel_stmt =
4737 as_a <const gimple_statement_omp_parallel *> (gs);
4738 return omp_parallel_stmt->child_fn;
4741 /* Return a pointer to the child function used to hold the body of
4742 OMP_PARALLEL GS. */
4744 static inline tree *
4745 gimple_omp_parallel_child_fn_ptr (gimple gs)
4747 gimple_statement_omp_parallel *omp_parallel_stmt =
4748 as_a <gimple_statement_omp_parallel *> (gs);
4749 return &omp_parallel_stmt->child_fn;
4753 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4755 static inline void
4756 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4758 gimple_statement_omp_parallel *omp_parallel_stmt =
4759 as_a <gimple_statement_omp_parallel *> (gs);
4760 omp_parallel_stmt->child_fn = child_fn;
4764 /* Return the artificial argument used to send variables and values
4765 from the parent to the children threads in OMP_PARALLEL GS. */
4767 static inline tree
4768 gimple_omp_parallel_data_arg (const_gimple gs)
4770 const gimple_statement_omp_parallel *omp_parallel_stmt =
4771 as_a <const gimple_statement_omp_parallel *> (gs);
4772 return omp_parallel_stmt->data_arg;
4776 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4778 static inline tree *
4779 gimple_omp_parallel_data_arg_ptr (gimple gs)
4781 gimple_statement_omp_parallel *omp_parallel_stmt =
4782 as_a <gimple_statement_omp_parallel *> (gs);
4783 return &omp_parallel_stmt->data_arg;
4787 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4789 static inline void
4790 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4792 gimple_statement_omp_parallel *omp_parallel_stmt =
4793 as_a <gimple_statement_omp_parallel *> (gs);
4794 omp_parallel_stmt->data_arg = data_arg;
4798 /* Return the clauses associated with OMP_TASK GS. */
4800 static inline tree
4801 gimple_omp_task_clauses (const_gimple gs)
4803 const gimple_statement_omp_task *omp_task_stmt =
4804 as_a <const gimple_statement_omp_task *> (gs);
4805 return omp_task_stmt->clauses;
4809 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4811 static inline tree *
4812 gimple_omp_task_clauses_ptr (gimple gs)
4814 gimple_statement_omp_task *omp_task_stmt =
4815 as_a <gimple_statement_omp_task *> (gs);
4816 return &omp_task_stmt->clauses;
4820 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4821 GS. */
4823 static inline void
4824 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4826 gimple_statement_omp_task *omp_task_stmt =
4827 as_a <gimple_statement_omp_task *> (gs);
4828 omp_task_stmt->clauses = clauses;
4832 /* Return the child function used to hold the body of OMP_TASK GS. */
4834 static inline tree
4835 gimple_omp_task_child_fn (const_gimple gs)
4837 const gimple_statement_omp_task *omp_task_stmt =
4838 as_a <const gimple_statement_omp_task *> (gs);
4839 return omp_task_stmt->child_fn;
4842 /* Return a pointer to the child function used to hold the body of
4843 OMP_TASK GS. */
4845 static inline tree *
4846 gimple_omp_task_child_fn_ptr (gimple gs)
4848 gimple_statement_omp_task *omp_task_stmt =
4849 as_a <gimple_statement_omp_task *> (gs);
4850 return &omp_task_stmt->child_fn;
4854 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4856 static inline void
4857 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4859 gimple_statement_omp_task *omp_task_stmt =
4860 as_a <gimple_statement_omp_task *> (gs);
4861 omp_task_stmt->child_fn = child_fn;
4865 /* Return the artificial argument used to send variables and values
4866 from the parent to the children threads in OMP_TASK GS. */
4868 static inline tree
4869 gimple_omp_task_data_arg (const_gimple gs)
4871 const gimple_statement_omp_task *omp_task_stmt =
4872 as_a <const gimple_statement_omp_task *> (gs);
4873 return omp_task_stmt->data_arg;
4877 /* Return a pointer to the data argument for OMP_TASK GS. */
4879 static inline tree *
4880 gimple_omp_task_data_arg_ptr (gimple gs)
4882 gimple_statement_omp_task *omp_task_stmt =
4883 as_a <gimple_statement_omp_task *> (gs);
4884 return &omp_task_stmt->data_arg;
4888 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4890 static inline void
4891 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4893 gimple_statement_omp_task *omp_task_stmt =
4894 as_a <gimple_statement_omp_task *> (gs);
4895 omp_task_stmt->data_arg = data_arg;
4899 /* Return the clauses associated with OMP_TASK GS. */
4901 static inline tree
4902 gimple_omp_taskreg_clauses (const_gimple gs)
4904 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4905 as_a <const gimple_statement_omp_taskreg *> (gs);
4906 return omp_taskreg_stmt->clauses;
4910 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4912 static inline tree *
4913 gimple_omp_taskreg_clauses_ptr (gimple gs)
4915 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4916 as_a <gimple_statement_omp_taskreg *> (gs);
4917 return &omp_taskreg_stmt->clauses;
4921 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4922 GS. */
4924 static inline void
4925 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4927 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4928 as_a <gimple_statement_omp_taskreg *> (gs);
4929 omp_taskreg_stmt->clauses = clauses;
4933 /* Return the child function used to hold the body of OMP_TASK GS. */
4935 static inline tree
4936 gimple_omp_taskreg_child_fn (const_gimple gs)
4938 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4939 as_a <const gimple_statement_omp_taskreg *> (gs);
4940 return omp_taskreg_stmt->child_fn;
4943 /* Return a pointer to the child function used to hold the body of
4944 OMP_TASK GS. */
4946 static inline tree *
4947 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4949 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4950 as_a <gimple_statement_omp_taskreg *> (gs);
4951 return &omp_taskreg_stmt->child_fn;
4955 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4957 static inline void
4958 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4960 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4961 as_a <gimple_statement_omp_taskreg *> (gs);
4962 omp_taskreg_stmt->child_fn = child_fn;
4966 /* Return the artificial argument used to send variables and values
4967 from the parent to the children threads in OMP_TASK GS. */
4969 static inline tree
4970 gimple_omp_taskreg_data_arg (const_gimple gs)
4972 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4973 as_a <const gimple_statement_omp_taskreg *> (gs);
4974 return omp_taskreg_stmt->data_arg;
4978 /* Return a pointer to the data argument for OMP_TASK GS. */
4980 static inline tree *
4981 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4983 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4984 as_a <gimple_statement_omp_taskreg *> (gs);
4985 return &omp_taskreg_stmt->data_arg;
4989 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4991 static inline void
4992 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4994 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4995 as_a <gimple_statement_omp_taskreg *> (gs);
4996 omp_taskreg_stmt->data_arg = data_arg;
5000 /* Return the copy function used to hold the body of OMP_TASK GS. */
5002 static inline tree
5003 gimple_omp_task_copy_fn (const_gimple gs)
5005 const gimple_statement_omp_task *omp_task_stmt =
5006 as_a <const gimple_statement_omp_task *> (gs);
5007 return omp_task_stmt->copy_fn;
5010 /* Return a pointer to the copy function used to hold the body of
5011 OMP_TASK GS. */
5013 static inline tree *
5014 gimple_omp_task_copy_fn_ptr (gimple gs)
5016 gimple_statement_omp_task *omp_task_stmt =
5017 as_a <gimple_statement_omp_task *> (gs);
5018 return &omp_task_stmt->copy_fn;
5022 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5024 static inline void
5025 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
5027 gimple_statement_omp_task *omp_task_stmt =
5028 as_a <gimple_statement_omp_task *> (gs);
5029 omp_task_stmt->copy_fn = copy_fn;
5033 /* Return size of the data block in bytes in OMP_TASK GS. */
5035 static inline tree
5036 gimple_omp_task_arg_size (const_gimple gs)
5038 const gimple_statement_omp_task *omp_task_stmt =
5039 as_a <const gimple_statement_omp_task *> (gs);
5040 return omp_task_stmt->arg_size;
5044 /* Return a pointer to the data block size for OMP_TASK GS. */
5046 static inline tree *
5047 gimple_omp_task_arg_size_ptr (gimple gs)
5049 gimple_statement_omp_task *omp_task_stmt =
5050 as_a <gimple_statement_omp_task *> (gs);
5051 return &omp_task_stmt->arg_size;
5055 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5057 static inline void
5058 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
5060 gimple_statement_omp_task *omp_task_stmt =
5061 as_a <gimple_statement_omp_task *> (gs);
5062 omp_task_stmt->arg_size = arg_size;
5066 /* Return align of the data block in bytes in OMP_TASK GS. */
5068 static inline tree
5069 gimple_omp_task_arg_align (const_gimple gs)
5071 const gimple_statement_omp_task *omp_task_stmt =
5072 as_a <const gimple_statement_omp_task *> (gs);
5073 return omp_task_stmt->arg_align;
5077 /* Return a pointer to the data block align for OMP_TASK GS. */
5079 static inline tree *
5080 gimple_omp_task_arg_align_ptr (gimple gs)
5082 gimple_statement_omp_task *omp_task_stmt =
5083 as_a <gimple_statement_omp_task *> (gs);
5084 return &omp_task_stmt->arg_align;
5088 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5090 static inline void
5091 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5093 gimple_statement_omp_task *omp_task_stmt =
5094 as_a <gimple_statement_omp_task *> (gs);
5095 omp_task_stmt->arg_align = arg_align;
5099 /* Return the clauses associated with OMP_SINGLE GS. */
5101 static inline tree
5102 gimple_omp_single_clauses (const_gimple gs)
5104 const gimple_statement_omp_single *omp_single_stmt =
5105 as_a <const gimple_statement_omp_single *> (gs);
5106 return omp_single_stmt->clauses;
5110 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5112 static inline tree *
5113 gimple_omp_single_clauses_ptr (gimple gs)
5115 gimple_statement_omp_single *omp_single_stmt =
5116 as_a <gimple_statement_omp_single *> (gs);
5117 return &omp_single_stmt->clauses;
5121 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5123 static inline void
5124 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5126 gimple_statement_omp_single *omp_single_stmt =
5127 as_a <gimple_statement_omp_single *> (gs);
5128 omp_single_stmt->clauses = clauses;
5132 /* Return the clauses associated with OMP_TARGET GS. */
5134 static inline tree
5135 gimple_omp_target_clauses (const_gimple gs)
5137 const gimple_statement_omp_target *omp_target_stmt =
5138 as_a <const gimple_statement_omp_target *> (gs);
5139 return omp_target_stmt->clauses;
5143 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5145 static inline tree *
5146 gimple_omp_target_clauses_ptr (gimple gs)
5148 gimple_statement_omp_target *omp_target_stmt =
5149 as_a <gimple_statement_omp_target *> (gs);
5150 return &omp_target_stmt->clauses;
5154 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5156 static inline void
5157 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5159 gimple_statement_omp_target *omp_target_stmt =
5160 as_a <gimple_statement_omp_target *> (gs);
5161 omp_target_stmt->clauses = clauses;
5165 /* Return the kind of OMP target statemement. */
5167 static inline int
5168 gimple_omp_target_kind (const_gimple g)
5170 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5171 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5175 /* Set the OMP target kind. */
5177 static inline void
5178 gimple_omp_target_set_kind (gimple g, int kind)
5180 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5181 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5182 | (kind & GF_OMP_TARGET_KIND_MASK);
5186 /* Return the child function used to hold the body of OMP_TARGET GS. */
5188 static inline tree
5189 gimple_omp_target_child_fn (const_gimple gs)
5191 const gimple_statement_omp_target *omp_target_stmt =
5192 as_a <const gimple_statement_omp_target *> (gs);
5193 return omp_target_stmt->child_fn;
5196 /* Return a pointer to the child function used to hold the body of
5197 OMP_TARGET GS. */
5199 static inline tree *
5200 gimple_omp_target_child_fn_ptr (gimple gs)
5202 gimple_statement_omp_target *omp_target_stmt =
5203 as_a <gimple_statement_omp_target *> (gs);
5204 return &omp_target_stmt->child_fn;
5208 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5210 static inline void
5211 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5213 gimple_statement_omp_target *omp_target_stmt =
5214 as_a <gimple_statement_omp_target *> (gs);
5215 omp_target_stmt->child_fn = child_fn;
5219 /* Return the artificial argument used to send variables and values
5220 from the parent to the children threads in OMP_TARGET GS. */
5222 static inline tree
5223 gimple_omp_target_data_arg (const_gimple gs)
5225 const gimple_statement_omp_target *omp_target_stmt =
5226 as_a <const gimple_statement_omp_target *> (gs);
5227 return omp_target_stmt->data_arg;
5231 /* Return a pointer to the data argument for OMP_TARGET GS. */
5233 static inline tree *
5234 gimple_omp_target_data_arg_ptr (gimple gs)
5236 gimple_statement_omp_target *omp_target_stmt =
5237 as_a <gimple_statement_omp_target *> (gs);
5238 return &omp_target_stmt->data_arg;
5242 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5244 static inline void
5245 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5247 gimple_statement_omp_target *omp_target_stmt =
5248 as_a <gimple_statement_omp_target *> (gs);
5249 omp_target_stmt->data_arg = data_arg;
5253 /* Return the clauses associated with OMP_TEAMS GS. */
5255 static inline tree
5256 gimple_omp_teams_clauses (const_gimple gs)
5258 const gimple_statement_omp_teams *omp_teams_stmt =
5259 as_a <const gimple_statement_omp_teams *> (gs);
5260 return omp_teams_stmt->clauses;
5264 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5266 static inline tree *
5267 gimple_omp_teams_clauses_ptr (gimple gs)
5269 gimple_statement_omp_teams *omp_teams_stmt =
5270 as_a <gimple_statement_omp_teams *> (gs);
5271 return &omp_teams_stmt->clauses;
5275 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5277 static inline void
5278 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5280 gimple_statement_omp_teams *omp_teams_stmt =
5281 as_a <gimple_statement_omp_teams *> (gs);
5282 omp_teams_stmt->clauses = clauses;
5286 /* Return the clauses associated with OMP_SECTIONS GS. */
5288 static inline tree
5289 gimple_omp_sections_clauses (const_gimple gs)
5291 const gimple_statement_omp_sections *omp_sections_stmt =
5292 as_a <const gimple_statement_omp_sections *> (gs);
5293 return omp_sections_stmt->clauses;
5297 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5299 static inline tree *
5300 gimple_omp_sections_clauses_ptr (gimple gs)
5302 gimple_statement_omp_sections *omp_sections_stmt =
5303 as_a <gimple_statement_omp_sections *> (gs);
5304 return &omp_sections_stmt->clauses;
5308 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5309 GS. */
5311 static inline void
5312 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5314 gimple_statement_omp_sections *omp_sections_stmt =
5315 as_a <gimple_statement_omp_sections *> (gs);
5316 omp_sections_stmt->clauses = clauses;
5320 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5321 in GS. */
5323 static inline tree
5324 gimple_omp_sections_control (const_gimple gs)
5326 const gimple_statement_omp_sections *omp_sections_stmt =
5327 as_a <const gimple_statement_omp_sections *> (gs);
5328 return omp_sections_stmt->control;
5332 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5333 GS. */
5335 static inline tree *
5336 gimple_omp_sections_control_ptr (gimple gs)
5338 gimple_statement_omp_sections *omp_sections_stmt =
5339 as_a <gimple_statement_omp_sections *> (gs);
5340 return &omp_sections_stmt->control;
5344 /* Set CONTROL to be the set of clauses associated with the
5345 GIMPLE_OMP_SECTIONS in GS. */
5347 static inline void
5348 gimple_omp_sections_set_control (gimple gs, tree control)
5350 gimple_statement_omp_sections *omp_sections_stmt =
5351 as_a <gimple_statement_omp_sections *> (gs);
5352 omp_sections_stmt->control = control;
5356 /* Set COND to be the condition code for OMP_FOR GS. */
5358 static inline void
5359 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5361 gimple_statement_omp_for *omp_for_stmt =
5362 as_a <gimple_statement_omp_for *> (gs);
5363 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5364 && i < omp_for_stmt->collapse);
5365 omp_for_stmt->iter[i].cond = cond;
5369 /* Return the condition code associated with OMP_FOR GS. */
5371 static inline enum tree_code
5372 gimple_omp_for_cond (const_gimple gs, size_t i)
5374 const gimple_statement_omp_for *omp_for_stmt =
5375 as_a <const gimple_statement_omp_for *> (gs);
5376 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5377 return omp_for_stmt->iter[i].cond;
5381 /* Set the value being stored in an atomic store. */
5383 static inline void
5384 gimple_omp_atomic_store_set_val (gimple g, tree val)
5386 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5387 as_a <gimple_statement_omp_atomic_store *> (g);
5388 omp_atomic_store_stmt->val = val;
5392 /* Return the value being stored in an atomic store. */
5394 static inline tree
5395 gimple_omp_atomic_store_val (const_gimple g)
5397 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5398 as_a <const gimple_statement_omp_atomic_store *> (g);
5399 return omp_atomic_store_stmt->val;
5403 /* Return a pointer to the value being stored in an atomic store. */
5405 static inline tree *
5406 gimple_omp_atomic_store_val_ptr (gimple g)
5408 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5409 as_a <gimple_statement_omp_atomic_store *> (g);
5410 return &omp_atomic_store_stmt->val;
5414 /* Set the LHS of an atomic load. */
5416 static inline void
5417 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5419 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5420 as_a <gimple_statement_omp_atomic_load *> (g);
5421 omp_atomic_load_stmt->lhs = lhs;
5425 /* Get the LHS of an atomic load. */
5427 static inline tree
5428 gimple_omp_atomic_load_lhs (const_gimple g)
5430 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5431 as_a <const gimple_statement_omp_atomic_load *> (g);
5432 return omp_atomic_load_stmt->lhs;
5436 /* Return a pointer to the LHS of an atomic load. */
5438 static inline tree *
5439 gimple_omp_atomic_load_lhs_ptr (gimple g)
5441 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5442 as_a <gimple_statement_omp_atomic_load *> (g);
5443 return &omp_atomic_load_stmt->lhs;
5447 /* Set the RHS of an atomic load. */
5449 static inline void
5450 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5452 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5453 as_a <gimple_statement_omp_atomic_load *> (g);
5454 omp_atomic_load_stmt->rhs = rhs;
5458 /* Get the RHS of an atomic load. */
5460 static inline tree
5461 gimple_omp_atomic_load_rhs (const_gimple g)
5463 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5464 as_a <const gimple_statement_omp_atomic_load *> (g);
5465 return omp_atomic_load_stmt->rhs;
5469 /* Return a pointer to the RHS of an atomic load. */
5471 static inline tree *
5472 gimple_omp_atomic_load_rhs_ptr (gimple g)
5474 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5475 as_a <gimple_statement_omp_atomic_load *> (g);
5476 return &omp_atomic_load_stmt->rhs;
5480 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5482 static inline tree
5483 gimple_omp_continue_control_def (const_gimple g)
5485 const gimple_statement_omp_continue *omp_continue_stmt =
5486 as_a <const gimple_statement_omp_continue *> (g);
5487 return omp_continue_stmt->control_def;
5490 /* The same as above, but return the address. */
5492 static inline tree *
5493 gimple_omp_continue_control_def_ptr (gimple g)
5495 gimple_statement_omp_continue *omp_continue_stmt =
5496 as_a <gimple_statement_omp_continue *> (g);
5497 return &omp_continue_stmt->control_def;
5500 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5502 static inline void
5503 gimple_omp_continue_set_control_def (gimple g, tree def)
5505 gimple_statement_omp_continue *omp_continue_stmt =
5506 as_a <gimple_statement_omp_continue *> (g);
5507 omp_continue_stmt->control_def = def;
5511 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5513 static inline tree
5514 gimple_omp_continue_control_use (const_gimple g)
5516 const gimple_statement_omp_continue *omp_continue_stmt =
5517 as_a <const gimple_statement_omp_continue *> (g);
5518 return omp_continue_stmt->control_use;
5522 /* The same as above, but return the address. */
5524 static inline tree *
5525 gimple_omp_continue_control_use_ptr (gimple g)
5527 gimple_statement_omp_continue *omp_continue_stmt =
5528 as_a <gimple_statement_omp_continue *> (g);
5529 return &omp_continue_stmt->control_use;
5533 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5535 static inline void
5536 gimple_omp_continue_set_control_use (gimple g, tree use)
5538 gimple_statement_omp_continue *omp_continue_stmt =
5539 as_a <gimple_statement_omp_continue *> (g);
5540 omp_continue_stmt->control_use = use;
5543 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5544 TRANSACTION_STMT. */
5546 static inline gimple_seq *
5547 gimple_transaction_body_ptr (gimple_transaction transaction_stmt)
5549 return &transaction_stmt->body;
5552 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5554 static inline gimple_seq
5555 gimple_transaction_body (gimple_transaction transaction_stmt)
5557 return *gimple_transaction_body_ptr (transaction_stmt);
5560 /* Return the label associated with a GIMPLE_TRANSACTION. */
5562 static inline tree
5563 gimple_transaction_label (const_gimple_transaction transaction_stmt)
5565 return transaction_stmt->label;
5568 static inline tree *
5569 gimple_transaction_label_ptr (gimple_transaction transaction_stmt)
5571 return &transaction_stmt->label;
5574 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5576 static inline unsigned int
5577 gimple_transaction_subcode (const_gimple_transaction transaction_stmt)
5579 return transaction_stmt->subcode;
5582 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5583 TRANSACTION_STMT. */
5585 static inline void
5586 gimple_transaction_set_body (gimple_transaction transaction_stmt,
5587 gimple_seq body)
5589 transaction_stmt->body = body;
5592 /* Set the label associated with a GIMPLE_TRANSACTION. */
5594 static inline void
5595 gimple_transaction_set_label (gimple_transaction transaction_stmt, tree label)
5597 transaction_stmt->label = label;
5600 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5602 static inline void
5603 gimple_transaction_set_subcode (gimple_transaction transaction_stmt,
5604 unsigned int subcode)
5606 transaction_stmt->subcode = subcode;
5610 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5612 static inline tree *
5613 gimple_return_retval_ptr (const_gimple gs)
5615 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5616 return gimple_op_ptr (gs, 0);
5619 /* Return the return value for GIMPLE_RETURN GS. */
5621 static inline tree
5622 gimple_return_retval (const_gimple gs)
5624 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5625 return gimple_op (gs, 0);
5629 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5631 static inline void
5632 gimple_return_set_retval (gimple gs, tree retval)
5634 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5635 gimple_set_op (gs, 0, retval);
5639 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5641 #define CASE_GIMPLE_OMP \
5642 case GIMPLE_OMP_PARALLEL: \
5643 case GIMPLE_OMP_TASK: \
5644 case GIMPLE_OMP_FOR: \
5645 case GIMPLE_OMP_SECTIONS: \
5646 case GIMPLE_OMP_SECTIONS_SWITCH: \
5647 case GIMPLE_OMP_SINGLE: \
5648 case GIMPLE_OMP_TARGET: \
5649 case GIMPLE_OMP_TEAMS: \
5650 case GIMPLE_OMP_SECTION: \
5651 case GIMPLE_OMP_MASTER: \
5652 case GIMPLE_OMP_TASKGROUP: \
5653 case GIMPLE_OMP_ORDERED: \
5654 case GIMPLE_OMP_CRITICAL: \
5655 case GIMPLE_OMP_RETURN: \
5656 case GIMPLE_OMP_ATOMIC_LOAD: \
5657 case GIMPLE_OMP_ATOMIC_STORE: \
5658 case GIMPLE_OMP_CONTINUE
5660 static inline bool
5661 is_gimple_omp (const_gimple stmt)
5663 switch (gimple_code (stmt))
5665 CASE_GIMPLE_OMP:
5666 return true;
5667 default:
5668 return false;
5673 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5675 static inline bool
5676 gimple_nop_p (const_gimple g)
5678 return gimple_code (g) == GIMPLE_NOP;
5682 /* Return true if GS is a GIMPLE_RESX. */
5684 static inline bool
5685 is_gimple_resx (const_gimple gs)
5687 return gimple_code (gs) == GIMPLE_RESX;
5690 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5692 static inline enum br_predictor
5693 gimple_predict_predictor (gimple gs)
5695 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5696 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5700 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5702 static inline void
5703 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5705 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5706 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5707 | (unsigned) predictor;
5711 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5713 static inline enum prediction
5714 gimple_predict_outcome (gimple gs)
5716 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5717 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5721 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5723 static inline void
5724 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5726 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5727 if (outcome == TAKEN)
5728 gs->subcode |= GF_PREDICT_TAKEN;
5729 else
5730 gs->subcode &= ~GF_PREDICT_TAKEN;
5734 /* Return the type of the main expression computed by STMT. Return
5735 void_type_node if the statement computes nothing. */
5737 static inline tree
5738 gimple_expr_type (const_gimple stmt)
5740 enum gimple_code code = gimple_code (stmt);
5742 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5744 tree type;
5745 /* In general we want to pass out a type that can be substituted
5746 for both the RHS and the LHS types if there is a possibly
5747 useless conversion involved. That means returning the
5748 original RHS type as far as we can reconstruct it. */
5749 if (code == GIMPLE_CALL)
5751 const_gimple_call call_stmt = as_a <const_gimple_call> (stmt);
5752 if (gimple_call_internal_p (call_stmt)
5753 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
5754 type = TREE_TYPE (gimple_call_arg (call_stmt, 3));
5755 else
5756 type = gimple_call_return_type (call_stmt);
5758 else
5759 switch (gimple_assign_rhs_code (stmt))
5761 case POINTER_PLUS_EXPR:
5762 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5763 break;
5765 default:
5766 /* As fallback use the type of the LHS. */
5767 type = TREE_TYPE (gimple_get_lhs (stmt));
5768 break;
5770 return type;
5772 else if (code == GIMPLE_COND)
5773 return boolean_type_node;
5774 else
5775 return void_type_node;
5778 /* Enum and arrays used for allocation stats. Keep in sync with
5779 gimple.c:gimple_alloc_kind_names. */
5780 enum gimple_alloc_kind
5782 gimple_alloc_kind_assign, /* Assignments. */
5783 gimple_alloc_kind_phi, /* PHI nodes. */
5784 gimple_alloc_kind_cond, /* Conditionals. */
5785 gimple_alloc_kind_rest, /* Everything else. */
5786 gimple_alloc_kind_all
5789 extern int gimple_alloc_counts[];
5790 extern int gimple_alloc_sizes[];
5792 /* Return the allocation kind for a given stmt CODE. */
5793 static inline enum gimple_alloc_kind
5794 gimple_alloc_kind (enum gimple_code code)
5796 switch (code)
5798 case GIMPLE_ASSIGN:
5799 return gimple_alloc_kind_assign;
5800 case GIMPLE_PHI:
5801 return gimple_alloc_kind_phi;
5802 case GIMPLE_COND:
5803 return gimple_alloc_kind_cond;
5804 default:
5805 return gimple_alloc_kind_rest;
5809 /* Return true if a location should not be emitted for this statement
5810 by annotate_all_with_location. */
5812 static inline bool
5813 gimple_do_not_emit_location_p (gimple g)
5815 return gimple_plf (g, GF_PLF_1);
5818 /* Mark statement G so a location will not be emitted by
5819 annotate_one_with_location. */
5821 static inline void
5822 gimple_set_do_not_emit_location (gimple g)
5824 /* The PLF flags are initialized to 0 when a new tuple is created,
5825 so no need to initialize it anywhere. */
5826 gimple_set_plf (g, GF_PLF_1, true);
5830 /* Macros for showing usage statistics. */
5831 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5832 ? (x) \
5833 : ((x) < 1024*1024*10 \
5834 ? (x) / 1024 \
5835 : (x) / (1024*1024))))
5837 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5839 #endif /* GCC_GIMPLE_H */