Introduce gpredict subclass and use it for all gimple_predict_ accessors
[official-gcc.git] / gcc / gimple.h
blob582bbbbb70ace8e0ac39bc4ef378c996840a1789
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 gcall : 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 gbind : 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 gcatch : 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 geh_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 geh_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 geh_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 gphi : 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 gresx : public gimple_statement_eh_ctrl
417 /* No extra fields; adds invariant:
418 stmt->code == GIMPLE_RESX. */
421 struct GTY((tag("GSS_EH_CTRL")))
422 geh_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 gtry : 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 gwce : 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 gasm : 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 gomp_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 gomp_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 gomp_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 gomp_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 gomp_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 gomp_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 gomp_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 gomp_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 gomp_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 gomp_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 gomp_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 gomp_return : public gimple_statement_omp_atomic_store_layout
716 /* No extra fields; adds invariant:
717 stmt->code == GIMPLE_OMP_RETURN. */
720 /* GIMPLE_TRANSACTION. */
722 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
724 /* The __transaction_atomic was declared [[outer]] or it is
725 __transaction_relaxed. */
726 #define GTMA_IS_OUTER (1u << 0)
727 #define GTMA_IS_RELAXED (1u << 1)
728 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
730 /* The transaction is seen to not have an abort. */
731 #define GTMA_HAVE_ABORT (1u << 2)
732 /* The transaction is seen to have loads or stores. */
733 #define GTMA_HAVE_LOAD (1u << 3)
734 #define GTMA_HAVE_STORE (1u << 4)
735 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
736 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
737 /* The transaction WILL enter serial irrevocable mode.
738 An irrevocable block post-dominates the entire transaction, such
739 that all invocations of the transaction will go serial-irrevocable.
740 In such case, we don't bother instrumenting the transaction, and
741 tell the runtime that it should begin the transaction in
742 serial-irrevocable mode. */
743 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
744 /* The transaction contains no instrumentation code whatsover, most
745 likely because it is guaranteed to go irrevocable upon entry. */
746 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
748 struct GTY((tag("GSS_TRANSACTION")))
749 gtransaction : public gimple_statement_with_memory_ops_base
751 /* [ WORD 1-9 ] : base class */
753 /* [ WORD 10 ] */
754 gimple_seq body;
756 /* [ WORD 11 ] */
757 tree label;
760 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
761 enum gimple_statement_structure_enum {
762 #include "gsstruct.def"
763 LAST_GSS_ENUM
765 #undef DEFGSSTRUCT
767 /* A statement with the invariant that
768 stmt->code == GIMPLE_COND
769 i.e. a conditional jump statement. */
771 struct GTY((tag("GSS_WITH_OPS")))
772 gcond : public gimple_statement_with_ops
774 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
777 /* A statement with the invariant that
778 stmt->code == GIMPLE_DEBUG
779 i.e. a debug statement. */
781 struct GTY((tag("GSS_WITH_OPS")))
782 gdebug : public gimple_statement_with_ops
784 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
787 /* A statement with the invariant that
788 stmt->code == GIMPLE_GOTO
789 i.e. a goto statement. */
791 struct GTY((tag("GSS_WITH_OPS")))
792 ggoto : public gimple_statement_with_ops
794 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
797 /* A statement with the invariant that
798 stmt->code == GIMPLE_LABEL
799 i.e. a label statement. */
801 struct GTY((tag("GSS_WITH_OPS")))
802 glabel : public gimple_statement_with_ops
804 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
807 /* A statement with the invariant that
808 stmt->code == GIMPLE_SWITCH
809 i.e. a switch statement. */
811 struct GTY((tag("GSS_WITH_OPS")))
812 gswitch : public gimple_statement_with_ops
814 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
817 /* A statement with the invariant that
818 stmt->code == GIMPLE_ASSIGN
819 i.e. an assignment statement. */
821 struct GTY((tag("GSS_WITH_MEM_OPS")))
822 gassign : public gimple_statement_with_memory_ops
824 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
827 /* A statement with the invariant that
828 stmt->code == GIMPLE_RETURN
829 i.e. a return statement. */
831 struct GTY((tag("GSS_WITH_MEM_OPS")))
832 greturn : public gimple_statement_with_memory_ops
834 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
837 /* A statement with the invariant that
838 stmt->code == GIMPLE_PREDICT
839 i.e. a hint for branch prediction. */
841 struct GTY(())
842 gpredict : public gimple_statement_base
844 /* no additional fields; this uses the layout for GSS_BASE. */
847 template <>
848 template <>
849 inline bool
850 is_a_helper <gasm *>::test (gimple gs)
852 return gs->code == GIMPLE_ASM;
855 template <>
856 template <>
857 inline bool
858 is_a_helper <gassign *>::test (gimple gs)
860 return gs->code == GIMPLE_ASSIGN;
863 template <>
864 template <>
865 inline bool
866 is_a_helper <gbind *>::test (gimple gs)
868 return gs->code == GIMPLE_BIND;
871 template <>
872 template <>
873 inline bool
874 is_a_helper <gcall *>::test (gimple gs)
876 return gs->code == GIMPLE_CALL;
879 template <>
880 template <>
881 inline bool
882 is_a_helper <gcatch *>::test (gimple gs)
884 return gs->code == GIMPLE_CATCH;
887 template <>
888 template <>
889 inline bool
890 is_a_helper <gcond *>::test (gimple gs)
892 return gs->code == GIMPLE_COND;
895 template <>
896 template <>
897 inline bool
898 is_a_helper <gdebug *>::test (gimple gs)
900 return gs->code == GIMPLE_DEBUG;
903 template <>
904 template <>
905 inline bool
906 is_a_helper <ggoto *>::test (gimple gs)
908 return gs->code == GIMPLE_GOTO;
911 template <>
912 template <>
913 inline bool
914 is_a_helper <glabel *>::test (gimple gs)
916 return gs->code == GIMPLE_LABEL;
919 template <>
920 template <>
921 inline bool
922 is_a_helper <gresx *>::test (gimple gs)
924 return gs->code == GIMPLE_RESX;
927 template <>
928 template <>
929 inline bool
930 is_a_helper <geh_dispatch *>::test (gimple gs)
932 return gs->code == GIMPLE_EH_DISPATCH;
935 template <>
936 template <>
937 inline bool
938 is_a_helper <geh_else *>::test (gimple gs)
940 return gs->code == GIMPLE_EH_ELSE;
943 template <>
944 template <>
945 inline bool
946 is_a_helper <geh_filter *>::test (gimple gs)
948 return gs->code == GIMPLE_EH_FILTER;
951 template <>
952 template <>
953 inline bool
954 is_a_helper <geh_mnt *>::test (gimple gs)
956 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
959 template <>
960 template <>
961 inline bool
962 is_a_helper <gomp_atomic_load *>::test (gimple gs)
964 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
967 template <>
968 template <>
969 inline bool
970 is_a_helper <gomp_atomic_store *>::test (gimple gs)
972 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
975 template <>
976 template <>
977 inline bool
978 is_a_helper <gomp_return *>::test (gimple gs)
980 return gs->code == GIMPLE_OMP_RETURN;
983 template <>
984 template <>
985 inline bool
986 is_a_helper <gomp_continue *>::test (gimple gs)
988 return gs->code == GIMPLE_OMP_CONTINUE;
991 template <>
992 template <>
993 inline bool
994 is_a_helper <gomp_critical *>::test (gimple gs)
996 return gs->code == GIMPLE_OMP_CRITICAL;
999 template <>
1000 template <>
1001 inline bool
1002 is_a_helper <gomp_for *>::test (gimple gs)
1004 return gs->code == GIMPLE_OMP_FOR;
1007 template <>
1008 template <>
1009 inline bool
1010 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
1012 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1015 template <>
1016 template <>
1017 inline bool
1018 is_a_helper <gomp_parallel *>::test (gimple gs)
1020 return gs->code == GIMPLE_OMP_PARALLEL;
1023 template <>
1024 template <>
1025 inline bool
1026 is_a_helper <gomp_target *>::test (gimple gs)
1028 return gs->code == GIMPLE_OMP_TARGET;
1031 template <>
1032 template <>
1033 inline bool
1034 is_a_helper <gomp_sections *>::test (gimple gs)
1036 return gs->code == GIMPLE_OMP_SECTIONS;
1039 template <>
1040 template <>
1041 inline bool
1042 is_a_helper <gomp_single *>::test (gimple gs)
1044 return gs->code == GIMPLE_OMP_SINGLE;
1047 template <>
1048 template <>
1049 inline bool
1050 is_a_helper <gomp_teams *>::test (gimple gs)
1052 return gs->code == GIMPLE_OMP_TEAMS;
1055 template <>
1056 template <>
1057 inline bool
1058 is_a_helper <gomp_task *>::test (gimple gs)
1060 return gs->code == GIMPLE_OMP_TASK;
1063 template <>
1064 template <>
1065 inline bool
1066 is_a_helper <gphi *>::test (gimple gs)
1068 return gs->code == GIMPLE_PHI;
1071 template <>
1072 template <>
1073 inline bool
1074 is_a_helper <gpredict *>::test (gimple gs)
1076 return gs->code == GIMPLE_PREDICT;
1079 template <>
1080 template <>
1081 inline bool
1082 is_a_helper <greturn *>::test (gimple gs)
1084 return gs->code == GIMPLE_RETURN;
1087 template <>
1088 template <>
1089 inline bool
1090 is_a_helper <gswitch *>::test (gimple gs)
1092 return gs->code == GIMPLE_SWITCH;
1095 template <>
1096 template <>
1097 inline bool
1098 is_a_helper <gtransaction *>::test (gimple gs)
1100 return gs->code == GIMPLE_TRANSACTION;
1103 template <>
1104 template <>
1105 inline bool
1106 is_a_helper <gtry *>::test (gimple gs)
1108 return gs->code == GIMPLE_TRY;
1111 template <>
1112 template <>
1113 inline bool
1114 is_a_helper <gwce *>::test (gimple gs)
1116 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1119 template <>
1120 template <>
1121 inline bool
1122 is_a_helper <const gasm *>::test (const_gimple gs)
1124 return gs->code == GIMPLE_ASM;
1127 template <>
1128 template <>
1129 inline bool
1130 is_a_helper <const gbind *>::test (const_gimple gs)
1132 return gs->code == GIMPLE_BIND;
1135 template <>
1136 template <>
1137 inline bool
1138 is_a_helper <const gcall *>::test (const_gimple gs)
1140 return gs->code == GIMPLE_CALL;
1143 template <>
1144 template <>
1145 inline bool
1146 is_a_helper <const gcatch *>::test (const_gimple gs)
1148 return gs->code == GIMPLE_CATCH;
1151 template <>
1152 template <>
1153 inline bool
1154 is_a_helper <const gresx *>::test (const_gimple gs)
1156 return gs->code == GIMPLE_RESX;
1159 template <>
1160 template <>
1161 inline bool
1162 is_a_helper <const geh_dispatch *>::test (const_gimple gs)
1164 return gs->code == GIMPLE_EH_DISPATCH;
1167 template <>
1168 template <>
1169 inline bool
1170 is_a_helper <const geh_filter *>::test (const_gimple gs)
1172 return gs->code == GIMPLE_EH_FILTER;
1175 template <>
1176 template <>
1177 inline bool
1178 is_a_helper <const gomp_atomic_load *>::test (const_gimple gs)
1180 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1183 template <>
1184 template <>
1185 inline bool
1186 is_a_helper <const gomp_atomic_store *>::test (const_gimple gs)
1188 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1191 template <>
1192 template <>
1193 inline bool
1194 is_a_helper <const gomp_return *>::test (const_gimple gs)
1196 return gs->code == GIMPLE_OMP_RETURN;
1199 template <>
1200 template <>
1201 inline bool
1202 is_a_helper <const gomp_continue *>::test (const_gimple gs)
1204 return gs->code == GIMPLE_OMP_CONTINUE;
1207 template <>
1208 template <>
1209 inline bool
1210 is_a_helper <const gomp_critical *>::test (const_gimple gs)
1212 return gs->code == GIMPLE_OMP_CRITICAL;
1215 template <>
1216 template <>
1217 inline bool
1218 is_a_helper <const gomp_for *>::test (const_gimple gs)
1220 return gs->code == GIMPLE_OMP_FOR;
1223 template <>
1224 template <>
1225 inline bool
1226 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1228 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1231 template <>
1232 template <>
1233 inline bool
1234 is_a_helper <const gomp_parallel *>::test (const_gimple gs)
1236 return gs->code == GIMPLE_OMP_PARALLEL;
1239 template <>
1240 template <>
1241 inline bool
1242 is_a_helper <const gomp_target *>::test (const_gimple gs)
1244 return gs->code == GIMPLE_OMP_TARGET;
1247 template <>
1248 template <>
1249 inline bool
1250 is_a_helper <const gomp_sections *>::test (const_gimple gs)
1252 return gs->code == GIMPLE_OMP_SECTIONS;
1255 template <>
1256 template <>
1257 inline bool
1258 is_a_helper <const gomp_single *>::test (const_gimple gs)
1260 return gs->code == GIMPLE_OMP_SINGLE;
1263 template <>
1264 template <>
1265 inline bool
1266 is_a_helper <const gomp_teams *>::test (const_gimple gs)
1268 return gs->code == GIMPLE_OMP_TEAMS;
1271 template <>
1272 template <>
1273 inline bool
1274 is_a_helper <const gomp_task *>::test (const_gimple gs)
1276 return gs->code == GIMPLE_OMP_TASK;
1279 template <>
1280 template <>
1281 inline bool
1282 is_a_helper <const gphi *>::test (const_gimple gs)
1284 return gs->code == GIMPLE_PHI;
1287 template <>
1288 template <>
1289 inline bool
1290 is_a_helper <const gtransaction *>::test (const_gimple gs)
1292 return gs->code == GIMPLE_TRANSACTION;
1295 /* Offset in bytes to the location of the operand vector.
1296 Zero if there is no operand vector for this tuple structure. */
1297 extern size_t const gimple_ops_offset_[];
1299 /* Map GIMPLE codes to GSS codes. */
1300 extern enum gimple_statement_structure_enum const gss_for_code_[];
1302 /* This variable holds the currently expanded gimple statement for purposes
1303 of comminucating the profile info to the builtin expanders. */
1304 extern gimple currently_expanding_gimple_stmt;
1306 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1307 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1308 greturn *gimple_build_return (tree);
1309 void gimple_call_reset_alias_info (gcall *);
1310 gcall *gimple_build_call_vec (tree, vec<tree> );
1311 gcall *gimple_build_call (tree, unsigned, ...);
1312 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1313 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1314 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1315 gcall *gimple_build_call_from_tree (tree);
1316 gassign *gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1317 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1318 gassign *gimple_build_assign_with_ops (enum tree_code, tree,
1319 tree, tree,
1320 tree CXX_MEM_STAT_INFO);
1321 gassign *gimple_build_assign_with_ops (enum tree_code, tree,
1322 tree, tree CXX_MEM_STAT_INFO);
1323 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1324 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1325 void gimple_cond_set_condition_from_tree (gcond *, tree);
1326 glabel *gimple_build_label (tree label);
1327 ggoto *gimple_build_goto (tree dest);
1328 gimple gimple_build_nop (void);
1329 gbind *gimple_build_bind (tree, gimple_seq, tree);
1330 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1331 vec<tree, va_gc> *, vec<tree, va_gc> *,
1332 vec<tree, va_gc> *);
1333 gcatch *gimple_build_catch (tree, gimple_seq);
1334 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1335 geh_mnt *gimple_build_eh_must_not_throw (tree);
1336 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1337 gtry *gimple_build_try (gimple_seq, gimple_seq,
1338 enum gimple_try_flags);
1339 gwce *gimple_build_wce (gimple_seq);
1340 gresx *gimple_build_resx (int);
1341 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1342 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1343 geh_dispatch *gimple_build_eh_dispatch (int);
1344 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1345 #define gimple_build_debug_bind(var,val,stmt) \
1346 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1347 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1348 #define gimple_build_debug_source_bind(var,val,stmt) \
1349 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1350 gomp_critical *gimple_build_omp_critical (gimple_seq, tree);
1351 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1352 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1353 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1354 tree, tree);
1355 gimple gimple_build_omp_section (gimple_seq);
1356 gimple gimple_build_omp_master (gimple_seq);
1357 gimple gimple_build_omp_taskgroup (gimple_seq);
1358 gomp_continue *gimple_build_omp_continue (tree, tree);
1359 gimple gimple_build_omp_ordered (gimple_seq);
1360 gomp_return *gimple_build_omp_return (bool);
1361 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1362 gimple gimple_build_omp_sections_switch (void);
1363 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1364 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1365 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1366 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1367 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1368 gtransaction *gimple_build_transaction (gimple_seq, tree);
1369 gpredict *gimple_build_predict (enum br_predictor, enum prediction);
1370 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1371 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1372 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1373 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1374 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1375 location_t);
1376 extern void annotate_all_with_location (gimple_seq, location_t);
1377 bool empty_body_p (gimple_seq);
1378 gimple_seq gimple_seq_copy (gimple_seq);
1379 bool gimple_call_same_target_p (const_gimple, const_gimple);
1380 int gimple_call_flags (const_gimple);
1381 int gimple_call_arg_flags (const gcall *, unsigned);
1382 int gimple_call_return_flags (const gcall *);
1383 bool gimple_assign_copy_p (gimple);
1384 bool gimple_assign_ssa_name_copy_p (gimple);
1385 bool gimple_assign_unary_nop_p (gimple);
1386 void gimple_set_bb (gimple, basic_block);
1387 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1388 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1389 tree, tree, tree);
1390 tree gimple_get_lhs (const_gimple);
1391 void gimple_set_lhs (gimple, tree);
1392 gimple gimple_copy (gimple);
1393 bool gimple_has_side_effects (const_gimple);
1394 bool gimple_could_trap_p_1 (gimple, bool, bool);
1395 bool gimple_could_trap_p (gimple);
1396 bool gimple_assign_rhs_could_trap_p (gimple);
1397 extern void dump_gimple_statistics (void);
1398 unsigned get_gimple_rhs_num_ops (enum tree_code);
1399 extern tree canonicalize_cond_expr_cond (tree);
1400 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1401 extern bool gimple_compare_field_offset (tree, tree);
1402 extern tree gimple_unsigned_type (tree);
1403 extern tree gimple_signed_type (tree);
1404 extern alias_set_type gimple_get_alias_set (tree);
1405 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1406 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1407 extern bool gimple_call_builtin_p (const_gimple);
1408 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1409 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1410 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1411 extern void dump_decl_set (FILE *, bitmap);
1412 extern bool nonfreeing_call_p (gimple);
1413 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1414 extern void sort_case_labels (vec<tree>);
1415 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1416 extern void gimple_seq_set_location (gimple_seq, location_t);
1417 extern void gimple_seq_discard (gimple_seq);
1419 /* Formal (expression) temporary table handling: multiple occurrences of
1420 the same scalar expression are evaluated into the same temporary. */
1422 typedef struct gimple_temp_hash_elt
1424 tree val; /* Key */
1425 tree temp; /* Value */
1426 } elt_t;
1428 /* Get the number of the next statement uid to be allocated. */
1429 static inline unsigned int
1430 gimple_stmt_max_uid (struct function *fn)
1432 return fn->last_stmt_uid;
1435 /* Set the number of the next statement uid to be allocated. */
1436 static inline void
1437 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1439 fn->last_stmt_uid = maxid;
1442 /* Set the number of the next statement uid to be allocated. */
1443 static inline unsigned int
1444 inc_gimple_stmt_max_uid (struct function *fn)
1446 return fn->last_stmt_uid++;
1449 /* Return the first node in GIMPLE sequence S. */
1451 static inline gimple_seq_node
1452 gimple_seq_first (gimple_seq s)
1454 return s;
1458 /* Return the first statement in GIMPLE sequence S. */
1460 static inline gimple
1461 gimple_seq_first_stmt (gimple_seq s)
1463 gimple_seq_node n = gimple_seq_first (s);
1464 return n;
1467 /* Return the first statement in GIMPLE sequence S as a gbind *,
1468 verifying that it has code GIMPLE_BIND in a checked build. */
1470 static inline gbind *
1471 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1473 gimple_seq_node n = gimple_seq_first (s);
1474 return as_a <gbind *> (n);
1478 /* Return the last node in GIMPLE sequence S. */
1480 static inline gimple_seq_node
1481 gimple_seq_last (gimple_seq s)
1483 return s ? s->prev : NULL;
1487 /* Return the last statement in GIMPLE sequence S. */
1489 static inline gimple
1490 gimple_seq_last_stmt (gimple_seq s)
1492 gimple_seq_node n = gimple_seq_last (s);
1493 return n;
1497 /* Set the last node in GIMPLE sequence *PS to LAST. */
1499 static inline void
1500 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1502 (*ps)->prev = last;
1506 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1508 static inline void
1509 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1511 *ps = first;
1515 /* Return true if GIMPLE sequence S is empty. */
1517 static inline bool
1518 gimple_seq_empty_p (gimple_seq s)
1520 return s == NULL;
1523 /* Allocate a new sequence and initialize its first element with STMT. */
1525 static inline gimple_seq
1526 gimple_seq_alloc_with_stmt (gimple stmt)
1528 gimple_seq seq = NULL;
1529 gimple_seq_add_stmt (&seq, stmt);
1530 return seq;
1534 /* Returns the sequence of statements in BB. */
1536 static inline gimple_seq
1537 bb_seq (const_basic_block bb)
1539 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1542 static inline gimple_seq *
1543 bb_seq_addr (basic_block bb)
1545 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1548 /* Sets the sequence of statements in BB to SEQ. */
1550 static inline void
1551 set_bb_seq (basic_block bb, gimple_seq seq)
1553 gcc_checking_assert (!(bb->flags & BB_RTL));
1554 bb->il.gimple.seq = seq;
1558 /* Return the code for GIMPLE statement G. */
1560 static inline enum gimple_code
1561 gimple_code (const_gimple g)
1563 return g->code;
1567 /* Return the GSS code used by a GIMPLE code. */
1569 static inline enum gimple_statement_structure_enum
1570 gss_for_code (enum gimple_code code)
1572 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1573 return gss_for_code_[code];
1577 /* Return which GSS code is used by GS. */
1579 static inline enum gimple_statement_structure_enum
1580 gimple_statement_structure (gimple gs)
1582 return gss_for_code (gimple_code (gs));
1586 /* Return true if statement G has sub-statements. This is only true for
1587 High GIMPLE statements. */
1589 static inline bool
1590 gimple_has_substatements (gimple g)
1592 switch (gimple_code (g))
1594 case GIMPLE_BIND:
1595 case GIMPLE_CATCH:
1596 case GIMPLE_EH_FILTER:
1597 case GIMPLE_EH_ELSE:
1598 case GIMPLE_TRY:
1599 case GIMPLE_OMP_FOR:
1600 case GIMPLE_OMP_MASTER:
1601 case GIMPLE_OMP_TASKGROUP:
1602 case GIMPLE_OMP_ORDERED:
1603 case GIMPLE_OMP_SECTION:
1604 case GIMPLE_OMP_PARALLEL:
1605 case GIMPLE_OMP_TASK:
1606 case GIMPLE_OMP_SECTIONS:
1607 case GIMPLE_OMP_SINGLE:
1608 case GIMPLE_OMP_TARGET:
1609 case GIMPLE_OMP_TEAMS:
1610 case GIMPLE_OMP_CRITICAL:
1611 case GIMPLE_WITH_CLEANUP_EXPR:
1612 case GIMPLE_TRANSACTION:
1613 return true;
1615 default:
1616 return false;
1621 /* Return the basic block holding statement G. */
1623 static inline basic_block
1624 gimple_bb (const_gimple g)
1626 return g->bb;
1630 /* Return the lexical scope block holding statement G. */
1632 static inline tree
1633 gimple_block (const_gimple g)
1635 return LOCATION_BLOCK (g->location);
1639 /* Set BLOCK to be the lexical scope block holding statement G. */
1641 static inline void
1642 gimple_set_block (gimple g, tree block)
1644 if (block)
1645 g->location =
1646 COMBINE_LOCATION_DATA (line_table, g->location, block);
1647 else
1648 g->location = LOCATION_LOCUS (g->location);
1652 /* Return location information for statement G. */
1654 static inline location_t
1655 gimple_location (const_gimple g)
1657 return g->location;
1660 /* Return location information for statement G if g is not NULL.
1661 Otherwise, UNKNOWN_LOCATION is returned. */
1663 static inline location_t
1664 gimple_location_safe (const_gimple g)
1666 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1669 /* Return pointer to location information for statement G. */
1671 static inline const location_t *
1672 gimple_location_ptr (const_gimple g)
1674 return &g->location;
1678 /* Set location information for statement G. */
1680 static inline void
1681 gimple_set_location (gimple g, location_t location)
1683 g->location = location;
1687 /* Return true if G contains location information. */
1689 static inline bool
1690 gimple_has_location (const_gimple g)
1692 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1696 /* Return the file name of the location of STMT. */
1698 static inline const char *
1699 gimple_filename (const_gimple stmt)
1701 return LOCATION_FILE (gimple_location (stmt));
1705 /* Return the line number of the location of STMT. */
1707 static inline int
1708 gimple_lineno (const_gimple stmt)
1710 return LOCATION_LINE (gimple_location (stmt));
1714 /* Determine whether SEQ is a singleton. */
1716 static inline bool
1717 gimple_seq_singleton_p (gimple_seq seq)
1719 return ((gimple_seq_first (seq) != NULL)
1720 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1723 /* Return true if no warnings should be emitted for statement STMT. */
1725 static inline bool
1726 gimple_no_warning_p (const_gimple stmt)
1728 return stmt->no_warning;
1731 /* Set the no_warning flag of STMT to NO_WARNING. */
1733 static inline void
1734 gimple_set_no_warning (gimple stmt, bool no_warning)
1736 stmt->no_warning = (unsigned) no_warning;
1739 /* Set the visited status on statement STMT to VISITED_P. */
1741 static inline void
1742 gimple_set_visited (gimple stmt, bool visited_p)
1744 stmt->visited = (unsigned) visited_p;
1748 /* Return the visited status for statement STMT. */
1750 static inline bool
1751 gimple_visited_p (gimple stmt)
1753 return stmt->visited;
1757 /* Set pass local flag PLF on statement STMT to VAL_P. */
1759 static inline void
1760 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1762 if (val_p)
1763 stmt->plf |= (unsigned int) plf;
1764 else
1765 stmt->plf &= ~((unsigned int) plf);
1769 /* Return the value of pass local flag PLF on statement STMT. */
1771 static inline unsigned int
1772 gimple_plf (gimple stmt, enum plf_mask plf)
1774 return stmt->plf & ((unsigned int) plf);
1778 /* Set the UID of statement. */
1780 static inline void
1781 gimple_set_uid (gimple g, unsigned uid)
1783 g->uid = uid;
1787 /* Return the UID of statement. */
1789 static inline unsigned
1790 gimple_uid (const_gimple g)
1792 return g->uid;
1796 /* Make statement G a singleton sequence. */
1798 static inline void
1799 gimple_init_singleton (gimple g)
1801 g->next = NULL;
1802 g->prev = g;
1806 /* Return true if GIMPLE statement G has register or memory operands. */
1808 static inline bool
1809 gimple_has_ops (const_gimple g)
1811 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1814 template <>
1815 template <>
1816 inline bool
1817 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1819 return gimple_has_ops (gs);
1822 template <>
1823 template <>
1824 inline bool
1825 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1827 return gimple_has_ops (gs);
1830 /* Return true if GIMPLE statement G has memory operands. */
1832 static inline bool
1833 gimple_has_mem_ops (const_gimple g)
1835 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1838 template <>
1839 template <>
1840 inline bool
1841 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1843 return gimple_has_mem_ops (gs);
1846 template <>
1847 template <>
1848 inline bool
1849 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1851 return gimple_has_mem_ops (gs);
1854 /* Return the set of USE operands for statement G. */
1856 static inline struct use_optype_d *
1857 gimple_use_ops (const_gimple g)
1859 const gimple_statement_with_ops *ops_stmt =
1860 dyn_cast <const gimple_statement_with_ops *> (g);
1861 if (!ops_stmt)
1862 return NULL;
1863 return ops_stmt->use_ops;
1867 /* Set USE to be the set of USE operands for statement G. */
1869 static inline void
1870 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1872 gimple_statement_with_ops *ops_stmt =
1873 as_a <gimple_statement_with_ops *> (g);
1874 ops_stmt->use_ops = use;
1878 /* Return the single VUSE operand of the statement G. */
1880 static inline tree
1881 gimple_vuse (const_gimple g)
1883 const gimple_statement_with_memory_ops *mem_ops_stmt =
1884 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1885 if (!mem_ops_stmt)
1886 return NULL_TREE;
1887 return mem_ops_stmt->vuse;
1890 /* Return the single VDEF operand of the statement G. */
1892 static inline tree
1893 gimple_vdef (const_gimple g)
1895 const gimple_statement_with_memory_ops *mem_ops_stmt =
1896 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1897 if (!mem_ops_stmt)
1898 return NULL_TREE;
1899 return mem_ops_stmt->vdef;
1902 /* Return the single VUSE operand of the statement G. */
1904 static inline tree *
1905 gimple_vuse_ptr (gimple g)
1907 gimple_statement_with_memory_ops *mem_ops_stmt =
1908 dyn_cast <gimple_statement_with_memory_ops *> (g);
1909 if (!mem_ops_stmt)
1910 return NULL;
1911 return &mem_ops_stmt->vuse;
1914 /* Return the single VDEF operand of the statement G. */
1916 static inline tree *
1917 gimple_vdef_ptr (gimple g)
1919 gimple_statement_with_memory_ops *mem_ops_stmt =
1920 dyn_cast <gimple_statement_with_memory_ops *> (g);
1921 if (!mem_ops_stmt)
1922 return NULL;
1923 return &mem_ops_stmt->vdef;
1926 /* Set the single VUSE operand of the statement G. */
1928 static inline void
1929 gimple_set_vuse (gimple g, tree vuse)
1931 gimple_statement_with_memory_ops *mem_ops_stmt =
1932 as_a <gimple_statement_with_memory_ops *> (g);
1933 mem_ops_stmt->vuse = vuse;
1936 /* Set the single VDEF operand of the statement G. */
1938 static inline void
1939 gimple_set_vdef (gimple g, tree vdef)
1941 gimple_statement_with_memory_ops *mem_ops_stmt =
1942 as_a <gimple_statement_with_memory_ops *> (g);
1943 mem_ops_stmt->vdef = vdef;
1947 /* Return true if statement G has operands and the modified field has
1948 been set. */
1950 static inline bool
1951 gimple_modified_p (const_gimple g)
1953 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1957 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1958 a MODIFIED field. */
1960 static inline void
1961 gimple_set_modified (gimple s, bool modifiedp)
1963 if (gimple_has_ops (s))
1964 s->modified = (unsigned) modifiedp;
1968 /* Return the tree code for the expression computed by STMT. This is
1969 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1970 GIMPLE_CALL, return CALL_EXPR as the expression code for
1971 consistency. This is useful when the caller needs to deal with the
1972 three kinds of computation that GIMPLE supports. */
1974 static inline enum tree_code
1975 gimple_expr_code (const_gimple stmt)
1977 enum gimple_code code = gimple_code (stmt);
1978 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1979 return (enum tree_code) stmt->subcode;
1980 else
1982 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1983 return CALL_EXPR;
1988 /* Return true if statement STMT contains volatile operands. */
1990 static inline bool
1991 gimple_has_volatile_ops (const_gimple stmt)
1993 if (gimple_has_mem_ops (stmt))
1994 return stmt->has_volatile_ops;
1995 else
1996 return false;
2000 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2002 static inline void
2003 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
2005 if (gimple_has_mem_ops (stmt))
2006 stmt->has_volatile_ops = (unsigned) volatilep;
2009 /* Return true if STMT is in a transaction. */
2011 static inline bool
2012 gimple_in_transaction (gimple stmt)
2014 return bb_in_transaction (gimple_bb (stmt));
2017 /* Return true if statement STMT may access memory. */
2019 static inline bool
2020 gimple_references_memory_p (gimple stmt)
2022 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2026 /* Return the subcode for OMP statement S. */
2028 static inline unsigned
2029 gimple_omp_subcode (const_gimple s)
2031 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2032 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2033 return s->subcode;
2036 /* Set the subcode for OMP statement S to SUBCODE. */
2038 static inline void
2039 gimple_omp_set_subcode (gimple s, unsigned int subcode)
2041 /* We only have 16 bits for the subcode. Assert that we are not
2042 overflowing it. */
2043 gcc_gimple_checking_assert (subcode < (1 << 16));
2044 s->subcode = subcode;
2047 /* Set the nowait flag on OMP_RETURN statement S. */
2049 static inline void
2050 gimple_omp_return_set_nowait (gomp_return *s)
2052 s->subcode |= GF_OMP_RETURN_NOWAIT;
2056 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2057 flag set. */
2059 static inline bool
2060 gimple_omp_return_nowait_p (const gomp_return *g)
2062 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2066 /* Set the LHS of OMP return. */
2068 static inline void
2069 gimple_omp_return_set_lhs (gomp_return *omp_return_stmt, tree lhs)
2071 omp_return_stmt->val = lhs;
2075 /* Get the LHS of OMP return. */
2077 static inline tree
2078 gimple_omp_return_lhs (const gomp_return *omp_return_stmt)
2080 return omp_return_stmt->val;
2084 /* Return a pointer to the LHS of OMP return. */
2086 static inline tree *
2087 gimple_omp_return_lhs_ptr (gomp_return *omp_return_stmt)
2089 return &omp_return_stmt->val;
2093 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2094 flag set. */
2096 static inline bool
2097 gimple_omp_section_last_p (const_gimple g)
2099 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2100 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2104 /* Set the GF_OMP_SECTION_LAST flag on G. */
2106 static inline void
2107 gimple_omp_section_set_last (gimple g)
2109 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2110 g->subcode |= GF_OMP_SECTION_LAST;
2114 /* Return true if OMP parallel statement G has the
2115 GF_OMP_PARALLEL_COMBINED flag set. */
2117 static inline bool
2118 gimple_omp_parallel_combined_p (const gomp_parallel *g)
2120 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2124 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2125 value of COMBINED_P. */
2127 static inline void
2128 gimple_omp_parallel_set_combined_p (gomp_parallel *g, bool combined_p)
2130 if (combined_p)
2131 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2132 else
2133 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2137 /* Return true if OMP atomic load/store statement G has the
2138 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2140 static inline bool
2141 gimple_omp_atomic_need_value_p (const_gimple g)
2143 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2144 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2145 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2149 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2151 static inline void
2152 gimple_omp_atomic_set_need_value (gimple g)
2154 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2155 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2156 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2160 /* Return true if OMP atomic load/store statement G has the
2161 GF_OMP_ATOMIC_SEQ_CST flag set. */
2163 static inline bool
2164 gimple_omp_atomic_seq_cst_p (const_gimple g)
2166 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2167 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2168 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2172 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2174 static inline void
2175 gimple_omp_atomic_set_seq_cst (gimple g)
2177 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2178 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2179 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2183 /* Return the number of operands for statement GS. */
2185 static inline unsigned
2186 gimple_num_ops (const_gimple gs)
2188 return gs->num_ops;
2192 /* Set the number of operands for statement GS. */
2194 static inline void
2195 gimple_set_num_ops (gimple gs, unsigned num_ops)
2197 gs->num_ops = num_ops;
2201 /* Return the array of operands for statement GS. */
2203 static inline tree *
2204 gimple_ops (gimple gs)
2206 size_t off;
2208 /* All the tuples have their operand vector at the very bottom
2209 of the structure. Note that those structures that do not
2210 have an operand vector have a zero offset. */
2211 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2212 gcc_gimple_checking_assert (off != 0);
2214 return (tree *) ((char *) gs + off);
2218 /* Return operand I for statement GS. */
2220 static inline tree
2221 gimple_op (const_gimple gs, unsigned i)
2223 if (gimple_has_ops (gs))
2225 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2226 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2228 else
2229 return NULL_TREE;
2232 /* Return a pointer to operand I for statement GS. */
2234 static inline tree *
2235 gimple_op_ptr (const_gimple gs, unsigned i)
2237 if (gimple_has_ops (gs))
2239 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2240 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2242 else
2243 return NULL;
2246 /* Set operand I of statement GS to OP. */
2248 static inline void
2249 gimple_set_op (gimple gs, unsigned i, tree op)
2251 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2253 /* Note. It may be tempting to assert that OP matches
2254 is_gimple_operand, but that would be wrong. Different tuples
2255 accept slightly different sets of tree operands. Each caller
2256 should perform its own validation. */
2257 gimple_ops (gs)[i] = op;
2260 /* Return true if GS is a GIMPLE_ASSIGN. */
2262 static inline bool
2263 is_gimple_assign (const_gimple gs)
2265 return gimple_code (gs) == GIMPLE_ASSIGN;
2268 /* Determine if expression CODE is one of the valid expressions that can
2269 be used on the RHS of GIMPLE assignments. */
2271 static inline enum gimple_rhs_class
2272 get_gimple_rhs_class (enum tree_code code)
2274 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2277 /* Return the LHS of assignment statement GS. */
2279 static inline tree
2280 gimple_assign_lhs (const_gimple gs)
2282 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2283 return gimple_op (gs, 0);
2287 /* Return a pointer to the LHS of assignment statement GS. */
2289 static inline tree *
2290 gimple_assign_lhs_ptr (const_gimple gs)
2292 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2293 return gimple_op_ptr (gs, 0);
2297 /* Set LHS to be the LHS operand of assignment statement GS. */
2299 static inline void
2300 gimple_assign_set_lhs (gimple gs, tree lhs)
2302 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2303 gimple_set_op (gs, 0, lhs);
2305 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2306 SSA_NAME_DEF_STMT (lhs) = gs;
2310 /* Return the first operand on the RHS of assignment statement GS. */
2312 static inline tree
2313 gimple_assign_rhs1 (const_gimple gs)
2315 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2316 return gimple_op (gs, 1);
2320 /* Return a pointer to the first operand on the RHS of assignment
2321 statement GS. */
2323 static inline tree *
2324 gimple_assign_rhs1_ptr (const_gimple gs)
2326 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2327 return gimple_op_ptr (gs, 1);
2330 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2332 static inline void
2333 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2335 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2337 gimple_set_op (gs, 1, rhs);
2341 /* Return the second operand on the RHS of assignment statement GS.
2342 If GS does not have two operands, NULL is returned instead. */
2344 static inline tree
2345 gimple_assign_rhs2 (const_gimple gs)
2347 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2349 if (gimple_num_ops (gs) >= 3)
2350 return gimple_op (gs, 2);
2351 else
2352 return NULL_TREE;
2356 /* Return a pointer to the second operand on the RHS of assignment
2357 statement GS. */
2359 static inline tree *
2360 gimple_assign_rhs2_ptr (const_gimple gs)
2362 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2363 return gimple_op_ptr (gs, 2);
2367 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2369 static inline void
2370 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2372 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2374 gimple_set_op (gs, 2, rhs);
2377 /* Return the third operand on the RHS of assignment statement GS.
2378 If GS does not have two operands, NULL is returned instead. */
2380 static inline tree
2381 gimple_assign_rhs3 (const_gimple gs)
2383 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2385 if (gimple_num_ops (gs) >= 4)
2386 return gimple_op (gs, 3);
2387 else
2388 return NULL_TREE;
2391 /* Return a pointer to the third operand on the RHS of assignment
2392 statement GS. */
2394 static inline tree *
2395 gimple_assign_rhs3_ptr (const_gimple gs)
2397 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2398 return gimple_op_ptr (gs, 3);
2402 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2404 static inline void
2405 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2407 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2409 gimple_set_op (gs, 3, rhs);
2412 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2413 to see only a maximum of two operands. */
2415 static inline void
2416 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2417 tree op1, tree op2)
2419 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2422 /* Returns true if GS is a nontemporal move. */
2424 static inline bool
2425 gimple_assign_nontemporal_move_p (const gassign *gs)
2427 return gs->nontemporal_move;
2430 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2432 static inline void
2433 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2435 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2436 gs->nontemporal_move = nontemporal;
2440 /* Return the code of the expression computed on the rhs of assignment
2441 statement GS. In case that the RHS is a single object, returns the
2442 tree code of the object. */
2444 static inline enum tree_code
2445 gimple_assign_rhs_code (const_gimple gs)
2447 enum tree_code code;
2448 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2450 code = (enum tree_code) gs->subcode;
2451 /* While we initially set subcode to the TREE_CODE of the rhs for
2452 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2453 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2454 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2455 code = TREE_CODE (gimple_assign_rhs1 (gs));
2457 return code;
2461 /* Set CODE to be the code for the expression computed on the RHS of
2462 assignment S. */
2464 static inline void
2465 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2467 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2468 s->subcode = code;
2472 /* Return the gimple rhs class of the code of the expression computed on
2473 the rhs of assignment statement GS.
2474 This will never return GIMPLE_INVALID_RHS. */
2476 static inline enum gimple_rhs_class
2477 gimple_assign_rhs_class (const_gimple gs)
2479 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2482 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2483 there is no operator associated with the assignment itself.
2484 Unlike gimple_assign_copy_p, this predicate returns true for
2485 any RHS operand, including those that perform an operation
2486 and do not have the semantics of a copy, such as COND_EXPR. */
2488 static inline bool
2489 gimple_assign_single_p (const_gimple gs)
2491 return (is_gimple_assign (gs)
2492 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2495 /* Return true if GS performs a store to its lhs. */
2497 static inline bool
2498 gimple_store_p (const_gimple gs)
2500 tree lhs = gimple_get_lhs (gs);
2501 return lhs && !is_gimple_reg (lhs);
2504 /* Return true if GS is an assignment that loads from its rhs1. */
2506 static inline bool
2507 gimple_assign_load_p (const_gimple gs)
2509 tree rhs;
2510 if (!gimple_assign_single_p (gs))
2511 return false;
2512 rhs = gimple_assign_rhs1 (gs);
2513 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2514 return true;
2515 rhs = get_base_address (rhs);
2516 return (DECL_P (rhs)
2517 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2521 /* Return true if S is a type-cast assignment. */
2523 static inline bool
2524 gimple_assign_cast_p (const_gimple s)
2526 if (is_gimple_assign (s))
2528 enum tree_code sc = gimple_assign_rhs_code (s);
2529 return CONVERT_EXPR_CODE_P (sc)
2530 || sc == VIEW_CONVERT_EXPR
2531 || sc == FIX_TRUNC_EXPR;
2534 return false;
2537 /* Return true if S is a clobber statement. */
2539 static inline bool
2540 gimple_clobber_p (const_gimple s)
2542 return gimple_assign_single_p (s)
2543 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2546 /* Return true if GS is a GIMPLE_CALL. */
2548 static inline bool
2549 is_gimple_call (const_gimple gs)
2551 return gimple_code (gs) == GIMPLE_CALL;
2554 /* Return the LHS of call statement GS. */
2556 static inline tree
2557 gimple_call_lhs (const_gimple gs)
2559 GIMPLE_CHECK (gs, GIMPLE_CALL);
2560 return gimple_op (gs, 0);
2564 /* Return a pointer to the LHS of call statement GS. */
2566 static inline tree *
2567 gimple_call_lhs_ptr (const_gimple gs)
2569 GIMPLE_CHECK (gs, GIMPLE_CALL);
2570 return gimple_op_ptr (gs, 0);
2574 /* Set LHS to be the LHS operand of call statement GS. */
2576 static inline void
2577 gimple_call_set_lhs (gimple gs, tree lhs)
2579 GIMPLE_CHECK (gs, GIMPLE_CALL);
2580 gimple_set_op (gs, 0, lhs);
2581 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2582 SSA_NAME_DEF_STMT (lhs) = gs;
2586 /* Return true if call GS calls an internal-only function, as enumerated
2587 by internal_fn. */
2589 static inline bool
2590 gimple_call_internal_p (const_gimple gs)
2592 GIMPLE_CHECK (gs, GIMPLE_CALL);
2593 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2597 /* Return the target of internal call GS. */
2599 static inline enum internal_fn
2600 gimple_call_internal_fn (const_gimple gs)
2602 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2603 return static_cast <const gcall *> (gs)->u.internal_fn;
2606 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2607 that could alter control flow. */
2609 static inline void
2610 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2612 GIMPLE_CHECK (s, GIMPLE_CALL);
2613 if (ctrl_altering_p)
2614 s->subcode |= GF_CALL_CTRL_ALTERING;
2615 else
2616 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2619 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2620 flag is set. Such call could not be a stmt in the middle of a bb. */
2622 static inline bool
2623 gimple_call_ctrl_altering_p (const_gimple gs)
2625 GIMPLE_CHECK (gs, GIMPLE_CALL);
2626 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2630 /* Return the function type of the function called by GS. */
2632 static inline tree
2633 gimple_call_fntype (const_gimple gs)
2635 const gcall *call_stmt =
2636 as_a <const gcall *> (gs);
2637 if (gimple_call_internal_p (gs))
2638 return NULL_TREE;
2639 return call_stmt->u.fntype;
2642 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2644 static inline void
2645 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2647 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2648 call_stmt->u.fntype = fntype;
2652 /* Return the tree node representing the function called by call
2653 statement GS. */
2655 static inline tree
2656 gimple_call_fn (const_gimple gs)
2658 GIMPLE_CHECK (gs, GIMPLE_CALL);
2659 return gimple_op (gs, 1);
2662 /* Return a pointer to the tree node representing the function called by call
2663 statement GS. */
2665 static inline tree *
2666 gimple_call_fn_ptr (const_gimple gs)
2668 GIMPLE_CHECK (gs, GIMPLE_CALL);
2669 return gimple_op_ptr (gs, 1);
2673 /* Set FN to be the function called by call statement GS. */
2675 static inline void
2676 gimple_call_set_fn (gcall *gs, tree fn)
2678 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2679 gimple_set_op (gs, 1, fn);
2683 /* Set FNDECL to be the function called by call statement GS. */
2685 static inline void
2686 gimple_call_set_fndecl (gimple gs, tree decl)
2688 GIMPLE_CHECK (gs, GIMPLE_CALL);
2689 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2690 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2694 /* Set internal function FN to be the function called by call statement CALL_STMT. */
2696 static inline void
2697 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
2699 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
2700 call_stmt->u.internal_fn = fn;
2704 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2705 Otherwise return NULL. This function is analogous to
2706 get_callee_fndecl in tree land. */
2708 static inline tree
2709 gimple_call_fndecl (const_gimple gs)
2711 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2715 /* Return the type returned by call statement GS. */
2717 static inline tree
2718 gimple_call_return_type (const gcall *gs)
2720 tree type = gimple_call_fntype (gs);
2722 if (type == NULL_TREE)
2723 return TREE_TYPE (gimple_call_lhs (gs));
2725 /* The type returned by a function is the type of its
2726 function type. */
2727 return TREE_TYPE (type);
2731 /* Return the static chain for call statement GS. */
2733 static inline tree
2734 gimple_call_chain (const_gimple gs)
2736 GIMPLE_CHECK (gs, GIMPLE_CALL);
2737 return gimple_op (gs, 2);
2741 /* Return a pointer to the static chain for call statement CALL_STMT. */
2743 static inline tree *
2744 gimple_call_chain_ptr (const gcall *call_stmt)
2746 return gimple_op_ptr (call_stmt, 2);
2749 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
2751 static inline void
2752 gimple_call_set_chain (gcall *call_stmt, tree chain)
2754 gimple_set_op (call_stmt, 2, chain);
2758 /* Return the number of arguments used by call statement GS. */
2760 static inline unsigned
2761 gimple_call_num_args (const_gimple gs)
2763 unsigned num_ops;
2764 GIMPLE_CHECK (gs, GIMPLE_CALL);
2765 num_ops = gimple_num_ops (gs);
2766 return num_ops - 3;
2770 /* Return the argument at position INDEX for call statement GS. */
2772 static inline tree
2773 gimple_call_arg (const_gimple gs, unsigned index)
2775 GIMPLE_CHECK (gs, GIMPLE_CALL);
2776 return gimple_op (gs, index + 3);
2780 /* Return a pointer to the argument at position INDEX for call
2781 statement GS. */
2783 static inline tree *
2784 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2786 GIMPLE_CHECK (gs, GIMPLE_CALL);
2787 return gimple_op_ptr (gs, index + 3);
2791 /* Set ARG to be the argument at position INDEX for call statement GS. */
2793 static inline void
2794 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2796 GIMPLE_CHECK (gs, GIMPLE_CALL);
2797 gimple_set_op (gs, index + 3, arg);
2801 /* If TAIL_P is true, mark call statement S as being a tail call
2802 (i.e., a call just before the exit of a function). These calls are
2803 candidate for tail call optimization. */
2805 static inline void
2806 gimple_call_set_tail (gcall *s, bool tail_p)
2808 if (tail_p)
2809 s->subcode |= GF_CALL_TAILCALL;
2810 else
2811 s->subcode &= ~GF_CALL_TAILCALL;
2815 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2817 static inline bool
2818 gimple_call_tail_p (gcall *s)
2820 return (s->subcode & GF_CALL_TAILCALL) != 0;
2824 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2825 slot optimization. This transformation uses the target of the call
2826 expansion as the return slot for calls that return in memory. */
2828 static inline void
2829 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
2831 if (return_slot_opt_p)
2832 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2833 else
2834 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2838 /* Return true if S is marked for return slot optimization. */
2840 static inline bool
2841 gimple_call_return_slot_opt_p (gcall *s)
2843 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2847 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2848 thunk to the thunked-to function. */
2850 static inline void
2851 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
2853 if (from_thunk_p)
2854 s->subcode |= GF_CALL_FROM_THUNK;
2855 else
2856 s->subcode &= ~GF_CALL_FROM_THUNK;
2860 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2862 static inline bool
2863 gimple_call_from_thunk_p (gcall *s)
2865 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2869 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2870 argument pack in its argument list. */
2872 static inline void
2873 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
2875 if (pass_arg_pack_p)
2876 s->subcode |= GF_CALL_VA_ARG_PACK;
2877 else
2878 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2882 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2883 argument pack in its argument list. */
2885 static inline bool
2886 gimple_call_va_arg_pack_p (gcall *s)
2888 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2892 /* Return true if S is a noreturn call. */
2894 static inline bool
2895 gimple_call_noreturn_p (gimple s)
2897 GIMPLE_CHECK (s, GIMPLE_CALL);
2898 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2902 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2903 even if the called function can throw in other cases. */
2905 static inline void
2906 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
2908 if (nothrow_p)
2909 s->subcode |= GF_CALL_NOTHROW;
2910 else
2911 s->subcode &= ~GF_CALL_NOTHROW;
2914 /* Return true if S is a nothrow call. */
2916 static inline bool
2917 gimple_call_nothrow_p (gcall *s)
2919 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2922 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2923 is known to be emitted for VLA objects. Those are wrapped by
2924 stack_save/stack_restore calls and hence can't lead to unbounded
2925 stack growth even when they occur in loops. */
2927 static inline void
2928 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
2930 if (for_var)
2931 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2932 else
2933 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2936 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2938 static inline bool
2939 gimple_call_alloca_for_var_p (gcall *s)
2941 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2944 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2946 static inline void
2947 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
2949 dest_call->subcode = orig_call->subcode;
2953 /* Return a pointer to the points-to solution for the set of call-used
2954 variables of the call CALL_STMT. */
2956 static inline struct pt_solution *
2957 gimple_call_use_set (gcall *call_stmt)
2959 return &call_stmt->call_used;
2963 /* Return a pointer to the points-to solution for the set of call-used
2964 variables of the call CALL_STMT. */
2966 static inline struct pt_solution *
2967 gimple_call_clobber_set (gcall *call_stmt)
2969 return &call_stmt->call_clobbered;
2973 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2974 non-NULL lhs. */
2976 static inline bool
2977 gimple_has_lhs (gimple stmt)
2979 return (is_gimple_assign (stmt)
2980 || (is_gimple_call (stmt)
2981 && gimple_call_lhs (stmt) != NULL_TREE));
2985 /* Return the code of the predicate computed by conditional statement GS. */
2987 static inline enum tree_code
2988 gimple_cond_code (const_gimple gs)
2990 GIMPLE_CHECK (gs, GIMPLE_COND);
2991 return (enum tree_code) gs->subcode;
2995 /* Set CODE to be the predicate code for the conditional statement GS. */
2997 static inline void
2998 gimple_cond_set_code (gcond *gs, enum tree_code code)
3000 gs->subcode = code;
3004 /* Return the LHS of the predicate computed by conditional statement GS. */
3006 static inline tree
3007 gimple_cond_lhs (const_gimple gs)
3009 GIMPLE_CHECK (gs, GIMPLE_COND);
3010 return gimple_op (gs, 0);
3013 /* Return the pointer to the LHS of the predicate computed by conditional
3014 statement GS. */
3016 static inline tree *
3017 gimple_cond_lhs_ptr (const gcond *gs)
3019 return gimple_op_ptr (gs, 0);
3022 /* Set LHS to be the LHS operand of the predicate computed by
3023 conditional statement GS. */
3025 static inline void
3026 gimple_cond_set_lhs (gcond *gs, tree lhs)
3028 gimple_set_op (gs, 0, lhs);
3032 /* Return the RHS operand of the predicate computed by conditional GS. */
3034 static inline tree
3035 gimple_cond_rhs (const_gimple gs)
3037 GIMPLE_CHECK (gs, GIMPLE_COND);
3038 return gimple_op (gs, 1);
3041 /* Return the pointer to the RHS operand of the predicate computed by
3042 conditional GS. */
3044 static inline tree *
3045 gimple_cond_rhs_ptr (const gcond *gs)
3047 return gimple_op_ptr (gs, 1);
3051 /* Set RHS to be the RHS operand of the predicate computed by
3052 conditional statement GS. */
3054 static inline void
3055 gimple_cond_set_rhs (gcond *gs, tree rhs)
3057 gimple_set_op (gs, 1, rhs);
3061 /* Return the label used by conditional statement GS when its
3062 predicate evaluates to true. */
3064 static inline tree
3065 gimple_cond_true_label (const gcond *gs)
3067 return gimple_op (gs, 2);
3071 /* Set LABEL to be the label used by conditional statement GS when its
3072 predicate evaluates to true. */
3074 static inline void
3075 gimple_cond_set_true_label (gcond *gs, tree label)
3077 gimple_set_op (gs, 2, label);
3081 /* Set LABEL to be the label used by conditional statement GS when its
3082 predicate evaluates to false. */
3084 static inline void
3085 gimple_cond_set_false_label (gcond *gs, tree label)
3087 gimple_set_op (gs, 3, label);
3091 /* Return the label used by conditional statement GS when its
3092 predicate evaluates to false. */
3094 static inline tree
3095 gimple_cond_false_label (const gcond *gs)
3098 return gimple_op (gs, 3);
3102 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3104 static inline void
3105 gimple_cond_make_false (gcond *gs)
3107 gimple_cond_set_lhs (gs, boolean_true_node);
3108 gimple_cond_set_rhs (gs, boolean_false_node);
3109 gs->subcode = EQ_EXPR;
3113 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3115 static inline void
3116 gimple_cond_make_true (gcond *gs)
3118 gimple_cond_set_lhs (gs, boolean_true_node);
3119 gimple_cond_set_rhs (gs, boolean_true_node);
3120 gs->subcode = EQ_EXPR;
3123 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3124 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3126 static inline bool
3127 gimple_cond_true_p (const gcond *gs)
3129 tree lhs = gimple_cond_lhs (gs);
3130 tree rhs = gimple_cond_rhs (gs);
3131 enum tree_code code = gimple_cond_code (gs);
3133 if (lhs != boolean_true_node && lhs != boolean_false_node)
3134 return false;
3136 if (rhs != boolean_true_node && rhs != boolean_false_node)
3137 return false;
3139 if (code == NE_EXPR && lhs != rhs)
3140 return true;
3142 if (code == EQ_EXPR && lhs == rhs)
3143 return true;
3145 return false;
3148 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3149 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3151 static inline bool
3152 gimple_cond_false_p (const gcond *gs)
3154 tree lhs = gimple_cond_lhs (gs);
3155 tree rhs = gimple_cond_rhs (gs);
3156 enum tree_code code = gimple_cond_code (gs);
3158 if (lhs != boolean_true_node && lhs != boolean_false_node)
3159 return false;
3161 if (rhs != boolean_true_node && rhs != boolean_false_node)
3162 return false;
3164 if (code == NE_EXPR && lhs == rhs)
3165 return true;
3167 if (code == EQ_EXPR && lhs != rhs)
3168 return true;
3170 return false;
3173 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3175 static inline void
3176 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3177 tree rhs)
3179 gimple_cond_set_code (stmt, code);
3180 gimple_cond_set_lhs (stmt, lhs);
3181 gimple_cond_set_rhs (stmt, rhs);
3184 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3186 static inline tree
3187 gimple_label_label (const glabel *gs)
3189 return gimple_op (gs, 0);
3193 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3194 GS. */
3196 static inline void
3197 gimple_label_set_label (glabel *gs, tree label)
3199 gimple_set_op (gs, 0, label);
3203 /* Return the destination of the unconditional jump GS. */
3205 static inline tree
3206 gimple_goto_dest (const ggoto *gs)
3208 return gimple_op (gs, 0);
3212 /* Set DEST to be the destination of the unconditonal jump GS. */
3214 static inline void
3215 gimple_goto_set_dest (ggoto *gs, tree dest)
3217 gimple_set_op (gs, 0, dest);
3221 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3223 static inline tree
3224 gimple_bind_vars (const gbind *bind_stmt)
3226 return bind_stmt->vars;
3230 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3231 statement GS. */
3233 static inline void
3234 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3236 bind_stmt->vars = vars;
3240 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3241 statement GS. */
3243 static inline void
3244 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3246 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3250 static inline gimple_seq *
3251 gimple_bind_body_ptr (gbind *bind_stmt)
3253 return &bind_stmt->body;
3256 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3258 static inline gimple_seq
3259 gimple_bind_body (gbind *gs)
3261 return *gimple_bind_body_ptr (gs);
3265 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3266 statement GS. */
3268 static inline void
3269 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3271 bind_stmt->body = seq;
3275 /* Append a statement to the end of a GIMPLE_BIND's body. */
3277 static inline void
3278 gimple_bind_add_stmt (gbind *bind_stmt, gimple stmt)
3280 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3284 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3286 static inline void
3287 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3289 gimple_seq_add_seq (&bind_stmt->body, seq);
3293 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3294 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3296 static inline tree
3297 gimple_bind_block (const gbind *bind_stmt)
3299 return bind_stmt->block;
3303 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3304 statement GS. */
3306 static inline void
3307 gimple_bind_set_block (gbind *bind_stmt, tree block)
3309 gcc_gimple_checking_assert (block == NULL_TREE
3310 || TREE_CODE (block) == BLOCK);
3311 bind_stmt->block = block;
3315 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3317 static inline unsigned
3318 gimple_asm_ninputs (const gasm *asm_stmt)
3320 return asm_stmt->ni;
3324 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3326 static inline unsigned
3327 gimple_asm_noutputs (const gasm *asm_stmt)
3329 return asm_stmt->no;
3333 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3335 static inline unsigned
3336 gimple_asm_nclobbers (const gasm *asm_stmt)
3338 return asm_stmt->nc;
3341 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3343 static inline unsigned
3344 gimple_asm_nlabels (const gasm *asm_stmt)
3346 return asm_stmt->nl;
3349 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3351 static inline tree
3352 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3354 gcc_gimple_checking_assert (index < asm_stmt->ni);
3355 return gimple_op (asm_stmt, index + asm_stmt->no);
3358 /* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */
3360 static inline tree *
3361 gimple_asm_input_op_ptr (const gasm *asm_stmt, unsigned index)
3363 gcc_gimple_checking_assert (index < asm_stmt->ni);
3364 return gimple_op_ptr (asm_stmt, index + asm_stmt->no);
3368 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3370 static inline void
3371 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3373 gcc_gimple_checking_assert (index < asm_stmt->ni
3374 && TREE_CODE (in_op) == TREE_LIST);
3375 gimple_set_op (asm_stmt, index + asm_stmt->no, in_op);
3379 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3381 static inline tree
3382 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3384 gcc_gimple_checking_assert (index < asm_stmt->no);
3385 return gimple_op (asm_stmt, index);
3388 /* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */
3390 static inline tree *
3391 gimple_asm_output_op_ptr (const gasm *asm_stmt, unsigned index)
3393 gcc_gimple_checking_assert (index < asm_stmt->no);
3394 return gimple_op_ptr (asm_stmt, index);
3398 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3400 static inline void
3401 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3403 gcc_gimple_checking_assert (index < asm_stmt->no
3404 && TREE_CODE (out_op) == TREE_LIST);
3405 gimple_set_op (asm_stmt, index, out_op);
3409 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3411 static inline tree
3412 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3414 gcc_gimple_checking_assert (index < asm_stmt->nc);
3415 return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no);
3419 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3421 static inline void
3422 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3424 gcc_gimple_checking_assert (index < asm_stmt->nc
3425 && TREE_CODE (clobber_op) == TREE_LIST);
3426 gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3429 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3431 static inline tree
3432 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3434 gcc_gimple_checking_assert (index < asm_stmt->nl);
3435 return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc);
3438 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3440 static inline void
3441 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3443 gcc_gimple_checking_assert (index < asm_stmt->nl
3444 && TREE_CODE (label_op) == TREE_LIST);
3445 gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc, label_op);
3448 /* Return the string representing the assembly instruction in
3449 GIMPLE_ASM ASM_STMT. */
3451 static inline const char *
3452 gimple_asm_string (const gasm *asm_stmt)
3454 return asm_stmt->string;
3458 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3460 static inline bool
3461 gimple_asm_volatile_p (const gasm *asm_stmt)
3463 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3467 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3469 static inline void
3470 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3472 if (volatile_p)
3473 asm_stmt->subcode |= GF_ASM_VOLATILE;
3474 else
3475 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3479 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3481 static inline void
3482 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3484 if (input_p)
3485 asm_stmt->subcode |= GF_ASM_INPUT;
3486 else
3487 asm_stmt->subcode &= ~GF_ASM_INPUT;
3491 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3493 static inline bool
3494 gimple_asm_input_p (const gasm *asm_stmt)
3496 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3500 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3502 static inline tree
3503 gimple_catch_types (const gcatch *catch_stmt)
3505 return catch_stmt->types;
3509 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3511 static inline tree *
3512 gimple_catch_types_ptr (gcatch *catch_stmt)
3514 return &catch_stmt->types;
3518 /* Return a pointer to the GIMPLE sequence representing the body of
3519 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3521 static inline gimple_seq *
3522 gimple_catch_handler_ptr (gcatch *catch_stmt)
3524 return &catch_stmt->handler;
3528 /* Return the GIMPLE sequence representing the body of the handler of
3529 GIMPLE_CATCH statement CATCH_STMT. */
3531 static inline gimple_seq
3532 gimple_catch_handler (gcatch *catch_stmt)
3534 return *gimple_catch_handler_ptr (catch_stmt);
3538 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3540 static inline void
3541 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3543 catch_stmt->types = t;
3547 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3549 static inline void
3550 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3552 catch_stmt->handler = handler;
3556 /* Return the types handled by GIMPLE_EH_FILTER statement EH_FILTER_STMT. */
3558 static inline tree
3559 gimple_eh_filter_types (const geh_filter *eh_filter_stmt)
3561 return eh_filter_stmt->types;
3565 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3566 EH_FILTER_STMT. */
3568 static inline tree *
3569 gimple_eh_filter_types_ptr (geh_filter *eh_filter_stmt)
3571 return &eh_filter_stmt->types;
3575 /* Return a pointer to the sequence of statement to execute when
3576 GIMPLE_EH_FILTER statement fails. */
3578 static inline gimple_seq *
3579 gimple_eh_filter_failure_ptr (geh_filter *eh_filter_stmt)
3581 return &eh_filter_stmt->failure;
3585 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3586 statement fails. */
3588 static inline gimple_seq
3589 gimple_eh_filter_failure (geh_filter *gs)
3591 return *gimple_eh_filter_failure_ptr (gs);
3595 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3596 EH_FILTER_STMT. */
3598 static inline void
3599 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3601 eh_filter_stmt->types = types;
3605 /* Set FAILURE to be the sequence of statements to execute on failure
3606 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3608 static inline void
3609 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
3610 gimple_seq failure)
3612 eh_filter_stmt->failure = failure;
3615 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3617 static inline tree
3618 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
3620 return eh_mnt_stmt->fndecl;
3623 /* Set the function decl to be called by GS to DECL. */
3625 static inline void
3626 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
3627 tree decl)
3629 eh_mnt_stmt->fndecl = decl;
3632 /* GIMPLE_EH_ELSE accessors. */
3634 static inline gimple_seq *
3635 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
3637 return &eh_else_stmt->n_body;
3640 static inline gimple_seq
3641 gimple_eh_else_n_body (geh_else *eh_else_stmt)
3643 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
3646 static inline gimple_seq *
3647 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
3649 return &eh_else_stmt->e_body;
3652 static inline gimple_seq
3653 gimple_eh_else_e_body (geh_else *eh_else_stmt)
3655 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
3658 static inline void
3659 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
3661 eh_else_stmt->n_body = seq;
3664 static inline void
3665 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
3667 eh_else_stmt->e_body = seq;
3670 /* GIMPLE_TRY accessors. */
3672 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3673 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3675 static inline enum gimple_try_flags
3676 gimple_try_kind (const gtry *gs)
3678 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3682 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3684 static inline void
3685 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
3687 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3688 || kind == GIMPLE_TRY_FINALLY);
3689 if (gimple_try_kind (gs) != kind)
3690 gs->subcode = (unsigned int) kind;
3694 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3696 static inline bool
3697 gimple_try_catch_is_cleanup (const gtry *gs)
3699 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3700 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3704 /* Return a pointer to the sequence of statements used as the
3705 body for GIMPLE_TRY TRY_STMT. */
3707 static inline gimple_seq *
3708 gimple_try_eval_ptr (gtry *try_stmt)
3710 return &try_stmt->eval;
3714 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3716 static inline gimple_seq
3717 gimple_try_eval (gtry *gs)
3719 return *gimple_try_eval_ptr (gs);
3723 /* Return a pointer to the sequence of statements used as the cleanup body for
3724 GIMPLE_TRY TRY_STMT. */
3726 static inline gimple_seq *
3727 gimple_try_cleanup_ptr (gtry *try_stmt)
3729 return &try_stmt->cleanup;
3733 /* Return the sequence of statements used as the cleanup body for
3734 GIMPLE_TRY GS. */
3736 static inline gimple_seq
3737 gimple_try_cleanup (gtry *gs)
3739 return *gimple_try_cleanup_ptr (gs);
3743 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3745 static inline void
3746 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
3748 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3749 if (catch_is_cleanup)
3750 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3751 else
3752 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3756 /* Set EVAL to be the sequence of statements to use as the body for
3757 GIMPLE_TRY TRY_STMT. */
3759 static inline void
3760 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
3762 try_stmt->eval = eval;
3766 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3767 body for GIMPLE_TRY TRY_STMT. */
3769 static inline void
3770 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
3772 try_stmt->cleanup = cleanup;
3776 /* Return a pointer to the cleanup sequence for cleanup statement
3777 WCE_STMT. */
3779 static inline gimple_seq *
3780 gimple_wce_cleanup_ptr (gwce *wce_stmt)
3782 return &wce_stmt->cleanup;
3786 /* Return the cleanup sequence for cleanup statement GS. */
3788 static inline gimple_seq
3789 gimple_wce_cleanup (gwce *gs)
3791 return *gimple_wce_cleanup_ptr (gs);
3795 /* Set CLEANUP to be the cleanup sequence for WCE_STMT. */
3797 static inline void
3798 gimple_wce_set_cleanup (gwce *wce_stmt, gimple_seq cleanup)
3800 wce_stmt->cleanup = cleanup;
3804 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3806 static inline bool
3807 gimple_wce_cleanup_eh_only (const gwce *gs)
3809 return gs->subcode != 0;
3813 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3815 static inline void
3816 gimple_wce_set_cleanup_eh_only (gwce *gs, bool eh_only_p)
3818 gs->subcode = (unsigned int) eh_only_p;
3822 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3824 static inline unsigned
3825 gimple_phi_capacity (const_gimple gs)
3827 const gphi *phi_stmt =
3828 as_a <const gphi *> (gs);
3829 return phi_stmt->capacity;
3833 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3834 be exactly the number of incoming edges for the basic block holding
3835 GS. */
3837 static inline unsigned
3838 gimple_phi_num_args (const_gimple gs)
3840 const gphi *phi_stmt =
3841 as_a <const gphi *> (gs);
3842 return phi_stmt->nargs;
3846 /* Return the SSA name created by GIMPLE_PHI GS. */
3848 static inline tree
3849 gimple_phi_result (const_gimple gs)
3851 const gphi *phi_stmt =
3852 as_a <const gphi *> (gs);
3853 return phi_stmt->result;
3856 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3858 static inline tree *
3859 gimple_phi_result_ptr (gimple gs)
3861 gphi *phi_stmt = as_a <gphi *> (gs);
3862 return &phi_stmt->result;
3865 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
3867 static inline void
3868 gimple_phi_set_result (gphi *phi, tree result)
3870 phi->result = result;
3871 if (result && TREE_CODE (result) == SSA_NAME)
3872 SSA_NAME_DEF_STMT (result) = phi;
3876 /* Return the PHI argument corresponding to incoming edge INDEX for
3877 GIMPLE_PHI GS. */
3879 static inline struct phi_arg_d *
3880 gimple_phi_arg (gimple gs, unsigned index)
3882 gphi *phi_stmt = as_a <gphi *> (gs);
3883 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3884 return &(phi_stmt->args[index]);
3887 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3888 for GIMPLE_PHI PHI. */
3890 static inline void
3891 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
3893 gcc_gimple_checking_assert (index <= phi->nargs);
3894 phi->args[index] = *phiarg;
3897 /* Return the PHI nodes for basic block BB, or NULL if there are no
3898 PHI nodes. */
3900 static inline gimple_seq
3901 phi_nodes (const_basic_block bb)
3903 gcc_checking_assert (!(bb->flags & BB_RTL));
3904 return bb->il.gimple.phi_nodes;
3907 /* Return a pointer to the PHI nodes for basic block BB. */
3909 static inline gimple_seq *
3910 phi_nodes_ptr (basic_block bb)
3912 gcc_checking_assert (!(bb->flags & BB_RTL));
3913 return &bb->il.gimple.phi_nodes;
3916 /* Return the tree operand for argument I of PHI node GS. */
3918 static inline tree
3919 gimple_phi_arg_def (gimple gs, size_t index)
3921 return gimple_phi_arg (gs, index)->def;
3925 /* Return a pointer to the tree operand for argument I of phi node PHI. */
3927 static inline tree *
3928 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
3930 return &gimple_phi_arg (phi, index)->def;
3933 /* Return the edge associated with argument I of phi node PHI. */
3935 static inline edge
3936 gimple_phi_arg_edge (gphi *phi, size_t i)
3938 return EDGE_PRED (gimple_bb (phi), i);
3941 /* Return the source location of gimple argument I of phi node PHI. */
3943 static inline source_location
3944 gimple_phi_arg_location (gphi *phi, size_t i)
3946 return gimple_phi_arg (phi, i)->locus;
3949 /* Return the source location of the argument on edge E of phi node PHI. */
3951 static inline source_location
3952 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
3954 return gimple_phi_arg (phi, e->dest_idx)->locus;
3957 /* Set the source location of gimple argument I of phi node PHI to LOC. */
3959 static inline void
3960 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
3962 gimple_phi_arg (phi, i)->locus = loc;
3965 /* Return TRUE if argument I of phi node PHI has a location record. */
3967 static inline bool
3968 gimple_phi_arg_has_location (gphi *phi, size_t i)
3970 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
3974 /* Return the region number for GIMPLE_RESX RESX_STMT. */
3976 static inline int
3977 gimple_resx_region (const gresx *resx_stmt)
3979 return resx_stmt->region;
3982 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
3984 static inline void
3985 gimple_resx_set_region (gresx *resx_stmt, int region)
3987 resx_stmt->region = region;
3990 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
3992 static inline int
3993 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
3995 return eh_dispatch_stmt->region;
3998 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
3999 EH_DISPATCH_STMT. */
4001 static inline void
4002 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4004 eh_dispatch_stmt->region = region;
4007 /* Return the number of labels associated with the switch statement GS. */
4009 static inline unsigned
4010 gimple_switch_num_labels (const gswitch *gs)
4012 unsigned num_ops;
4013 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4014 num_ops = gimple_num_ops (gs);
4015 gcc_gimple_checking_assert (num_ops > 1);
4016 return num_ops - 1;
4020 /* Set NLABELS to be the number of labels for the switch statement GS. */
4022 static inline void
4023 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4025 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4026 gimple_set_num_ops (g, nlabels + 1);
4030 /* Return the index variable used by the switch statement GS. */
4032 static inline tree
4033 gimple_switch_index (const gswitch *gs)
4035 return gimple_op (gs, 0);
4039 /* Return a pointer to the index variable for the switch statement GS. */
4041 static inline tree *
4042 gimple_switch_index_ptr (const gswitch *gs)
4044 return gimple_op_ptr (gs, 0);
4048 /* Set INDEX to be the index variable for switch statement GS. */
4050 static inline void
4051 gimple_switch_set_index (gswitch *gs, tree index)
4053 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4054 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4055 gimple_set_op (gs, 0, index);
4059 /* Return the label numbered INDEX. The default label is 0, followed by any
4060 labels in a switch statement. */
4062 static inline tree
4063 gimple_switch_label (const gswitch *gs, unsigned index)
4065 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4066 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4067 return gimple_op (gs, index + 1);
4070 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4072 static inline void
4073 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4075 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4076 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4077 && (label == NULL_TREE
4078 || TREE_CODE (label) == CASE_LABEL_EXPR));
4079 gimple_set_op (gs, index + 1, label);
4082 /* Return the default label for a switch statement. */
4084 static inline tree
4085 gimple_switch_default_label (const gswitch *gs)
4087 tree label = gimple_switch_label (gs, 0);
4088 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4089 return label;
4092 /* Set the default label for a switch statement. */
4094 static inline void
4095 gimple_switch_set_default_label (gswitch *gs, tree label)
4097 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4098 gimple_switch_set_label (gs, 0, label);
4101 /* Return true if GS is a GIMPLE_DEBUG statement. */
4103 static inline bool
4104 is_gimple_debug (const_gimple gs)
4106 return gimple_code (gs) == GIMPLE_DEBUG;
4109 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4111 static inline bool
4112 gimple_debug_bind_p (const_gimple s)
4114 if (is_gimple_debug (s))
4115 return s->subcode == GIMPLE_DEBUG_BIND;
4117 return false;
4120 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4122 static inline tree
4123 gimple_debug_bind_get_var (gimple dbg)
4125 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4126 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4127 return gimple_op (dbg, 0);
4130 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4131 statement. */
4133 static inline tree
4134 gimple_debug_bind_get_value (gimple dbg)
4136 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4137 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4138 return gimple_op (dbg, 1);
4141 /* Return a pointer to the value bound to the variable in a
4142 GIMPLE_DEBUG bind statement. */
4144 static inline tree *
4145 gimple_debug_bind_get_value_ptr (gimple dbg)
4147 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4148 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4149 return gimple_op_ptr (dbg, 1);
4152 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4154 static inline void
4155 gimple_debug_bind_set_var (gimple dbg, tree var)
4157 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4158 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4159 gimple_set_op (dbg, 0, var);
4162 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4163 statement. */
4165 static inline void
4166 gimple_debug_bind_set_value (gimple dbg, tree value)
4168 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4169 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4170 gimple_set_op (dbg, 1, value);
4173 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4174 optimized away. */
4175 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4177 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4178 statement. */
4180 static inline void
4181 gimple_debug_bind_reset_value (gimple dbg)
4183 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4184 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4185 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4188 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4189 value. */
4191 static inline bool
4192 gimple_debug_bind_has_value_p (gimple dbg)
4194 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4195 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4196 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4199 #undef GIMPLE_DEBUG_BIND_NOVALUE
4201 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4203 static inline bool
4204 gimple_debug_source_bind_p (const_gimple s)
4206 if (is_gimple_debug (s))
4207 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4209 return false;
4212 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4214 static inline tree
4215 gimple_debug_source_bind_get_var (gimple dbg)
4217 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4218 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4219 return gimple_op (dbg, 0);
4222 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4223 statement. */
4225 static inline tree
4226 gimple_debug_source_bind_get_value (gimple dbg)
4228 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4229 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4230 return gimple_op (dbg, 1);
4233 /* Return a pointer to the value bound to the variable in a
4234 GIMPLE_DEBUG source bind statement. */
4236 static inline tree *
4237 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4239 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4240 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4241 return gimple_op_ptr (dbg, 1);
4244 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4246 static inline void
4247 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4249 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4250 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4251 gimple_set_op (dbg, 0, var);
4254 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4255 statement. */
4257 static inline void
4258 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4260 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4261 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4262 gimple_set_op (dbg, 1, value);
4265 /* Return the line number for EXPR, or return -1 if we have no line
4266 number information for it. */
4267 static inline int
4268 get_lineno (const_gimple stmt)
4270 location_t loc;
4272 if (!stmt)
4273 return -1;
4275 loc = gimple_location (stmt);
4276 if (loc == UNKNOWN_LOCATION)
4277 return -1;
4279 return LOCATION_LINE (loc);
4282 /* Return a pointer to the body for the OMP statement GS. */
4284 static inline gimple_seq *
4285 gimple_omp_body_ptr (gimple gs)
4287 return &static_cast <gimple_statement_omp *> (gs)->body;
4290 /* Return the body for the OMP statement GS. */
4292 static inline gimple_seq
4293 gimple_omp_body (gimple gs)
4295 return *gimple_omp_body_ptr (gs);
4298 /* Set BODY to be the body for the OMP statement GS. */
4300 static inline void
4301 gimple_omp_set_body (gimple gs, gimple_seq body)
4303 static_cast <gimple_statement_omp *> (gs)->body = body;
4307 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4309 static inline tree
4310 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4312 return crit_stmt->name;
4316 /* Return a pointer to the name associated with OMP critical statement GS. */
4318 static inline tree *
4319 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4321 return &crit_stmt->name;
4325 /* Set NAME to be the name associated with OMP critical statement GS. */
4327 static inline void
4328 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4330 crit_stmt->name = name;
4334 /* Return the kind of OMP for statemement. */
4336 static inline int
4337 gimple_omp_for_kind (const gomp_for *g)
4339 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4343 /* Set the OMP for kind. */
4345 static inline void
4346 gimple_omp_for_set_kind (gomp_for *g, int kind)
4348 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4349 | (kind & GF_OMP_FOR_KIND_MASK);
4353 /* Return true if OMP for statement G has the
4354 GF_OMP_FOR_COMBINED flag set. */
4356 static inline bool
4357 gimple_omp_for_combined_p (const gomp_for *g)
4359 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4363 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4364 value of COMBINED_P. */
4366 static inline void
4367 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4369 if (combined_p)
4370 g->subcode |= GF_OMP_FOR_COMBINED;
4371 else
4372 g->subcode &= ~GF_OMP_FOR_COMBINED;
4376 /* Return true if OMP for statement G has the
4377 GF_OMP_FOR_COMBINED_INTO flag set. */
4379 static inline bool
4380 gimple_omp_for_combined_into_p (const gomp_for *g)
4382 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4386 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4387 value of COMBINED_P. */
4389 static inline void
4390 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4392 if (combined_p)
4393 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4394 else
4395 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4399 /* Return the clauses associated with OMP_FOR OMP_FOR_STMT. */
4401 static inline tree
4402 gimple_omp_for_clauses (const gomp_for *omp_for_stmt)
4404 return omp_for_stmt->clauses;
4408 /* Return a pointer to the OMP_FOR OMP_FOR_STMT. */
4410 static inline tree *
4411 gimple_omp_for_clauses_ptr (gomp_for *omp_for_stmt)
4413 return &omp_for_stmt->clauses;
4417 /* Set CLAUSES to be the list of clauses associated with OMP_FOR
4418 OMP_FOR_STMT. */
4420 static inline void
4421 gimple_omp_for_set_clauses (gomp_for *omp_for_stmt, tree clauses)
4423 omp_for_stmt->clauses = clauses;
4427 /* Get the collapse count of OMP_FOR OMP_FOR_STMT. */
4429 static inline size_t
4430 gimple_omp_for_collapse (const gomp_for *omp_for_stmt)
4432 return omp_for_stmt->collapse;
4436 /* Return the index variable for OMP_FOR OMP_FOR_STMT. */
4438 static inline tree
4439 gimple_omp_for_index (const gomp_for *omp_for_stmt, size_t i)
4441 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4442 return omp_for_stmt->iter[i].index;
4446 /* Return a pointer to the index variable for OMP_FOR OMP_FOR_STMT. */
4448 static inline tree *
4449 gimple_omp_for_index_ptr (gomp_for *omp_for_stmt, size_t i)
4451 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4452 return &omp_for_stmt->iter[i].index;
4456 /* Set INDEX to be the index variable for OMP_FOR OMP_FOR_STMT. */
4458 static inline void
4459 gimple_omp_for_set_index (gomp_for *omp_for_stmt, size_t i, tree index)
4461 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4462 omp_for_stmt->iter[i].index = index;
4466 /* Return the initial value for OMP_FOR OMP_FOR_STMT. */
4468 static inline tree
4469 gimple_omp_for_initial (const gomp_for *omp_for_stmt, size_t i)
4471 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4472 return omp_for_stmt->iter[i].initial;
4476 /* Return a pointer to the initial value for OMP_FOR OMP_FOR_STMT. */
4478 static inline tree *
4479 gimple_omp_for_initial_ptr (gomp_for *omp_for_stmt, size_t i)
4481 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4482 return &omp_for_stmt->iter[i].initial;
4486 /* Set INITIAL to be the initial value for OMP_FOR OMP_FOR_STMT. */
4488 static inline void
4489 gimple_omp_for_set_initial (gomp_for *omp_for_stmt, size_t i, tree initial)
4491 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4492 omp_for_stmt->iter[i].initial = initial;
4496 /* Return the final value for OMP_FOR OMP_FOR_STMT. */
4498 static inline tree
4499 gimple_omp_for_final (const gomp_for *omp_for_stmt, size_t i)
4501 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4502 return omp_for_stmt->iter[i].final;
4506 /* Return a pointer to the final value for OMP_FOR OMP_FOR_STMT. */
4508 static inline tree *
4509 gimple_omp_for_final_ptr (gomp_for *omp_for_stmt, size_t i)
4511 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4512 return &omp_for_stmt->iter[i].final;
4516 /* Set FINAL to be the final value for OMP_FOR OMP_FOR_STMT. */
4518 static inline void
4519 gimple_omp_for_set_final (gomp_for *omp_for_stmt, size_t i, tree final)
4521 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4522 omp_for_stmt->iter[i].final = final;
4526 /* Return the increment value for OMP_FOR OMP_FOR_STMT. */
4528 static inline tree
4529 gimple_omp_for_incr (const gomp_for *omp_for_stmt, size_t i)
4531 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4532 return omp_for_stmt->iter[i].incr;
4536 /* Return a pointer to the increment value for OMP_FOR OMP_FOR_STMT. */
4538 static inline tree *
4539 gimple_omp_for_incr_ptr (gomp_for *omp_for_stmt, size_t i)
4541 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4542 return &omp_for_stmt->iter[i].incr;
4546 /* Set INCR to be the increment value for OMP_FOR OMP_FOR_STMT. */
4548 static inline void
4549 gimple_omp_for_set_incr (gomp_for *omp_for_stmt, size_t i, tree incr)
4551 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4552 omp_for_stmt->iter[i].incr = incr;
4556 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4557 statement OMP_FOR_STMT starts. */
4559 static inline gimple_seq *
4560 gimple_omp_for_pre_body_ptr (gomp_for *omp_for_stmt)
4562 return &omp_for_stmt->pre_body;
4566 /* Return the sequence of statements to execute before the OMP_FOR
4567 statement OMP_FOR_STMT starts. */
4569 static inline gimple_seq
4570 gimple_omp_for_pre_body (gomp_for *omp_for_stmt)
4572 return *gimple_omp_for_pre_body_ptr (omp_for_stmt);
4576 /* Set PRE_BODY to be the sequence of statements to execute before the
4577 OMP_FOR statement OMP_FOR_STMT starts. */
4579 static inline void
4580 gimple_omp_for_set_pre_body (gomp_for *omp_for_stmt, gimple_seq pre_body)
4582 omp_for_stmt->pre_body = pre_body;
4586 /* Return the clauses associated with OMP_PARALLEL OMP_PARALLEL_STMT. */
4588 static inline tree
4589 gimple_omp_parallel_clauses (const gomp_parallel *omp_parallel_stmt)
4591 return omp_parallel_stmt->clauses;
4595 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
4597 static inline tree *
4598 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
4600 return &omp_parallel_stmt->clauses;
4604 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
4606 static inline void
4607 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
4608 tree clauses)
4610 omp_parallel_stmt->clauses = clauses;
4614 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
4616 static inline tree
4617 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
4619 return omp_parallel_stmt->child_fn;
4622 /* Return a pointer to the child function used to hold the body of
4623 OMP_PARALLEL_STMT. */
4625 static inline tree *
4626 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
4628 return &omp_parallel_stmt->child_fn;
4632 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
4634 static inline void
4635 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
4636 tree child_fn)
4638 omp_parallel_stmt->child_fn = child_fn;
4642 /* Return the artificial argument used to send variables and values
4643 from the parent to the children threads in OMP_PARALLEL_STMT. */
4645 static inline tree
4646 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
4648 return omp_parallel_stmt->data_arg;
4652 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
4654 static inline tree *
4655 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
4657 return &omp_parallel_stmt->data_arg;
4661 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
4663 static inline void
4664 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
4665 tree data_arg)
4667 omp_parallel_stmt->data_arg = data_arg;
4671 /* Return the clauses associated with OMP_TASK OMP_TASK_STMT. */
4673 static inline tree
4674 gimple_omp_task_clauses (const gomp_task *omp_task_stmt)
4676 return omp_task_stmt->clauses;
4680 /* Return a pointer to the clauses associated with OMP_TASK
4681 OMP_TASK_STMT. */
4683 static inline tree *
4684 gimple_omp_task_clauses_ptr (gomp_task *omp_task_stmt)
4686 return &omp_task_stmt->clauses;
4690 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4691 OMP_TASK_STMT. */
4693 static inline void
4694 gimple_omp_task_set_clauses (gomp_task *omp_task_stmt, tree clauses)
4696 omp_task_stmt->clauses = clauses;
4700 /* Return the child function used to hold the body of OMP_TASK
4701 OMP_TASK_STMT. */
4703 static inline tree
4704 gimple_omp_task_child_fn (const gomp_task *omp_task_stmt)
4706 return omp_task_stmt->child_fn;
4709 /* Return a pointer to the child function used to hold the body of
4710 OMP_TASK OMP_TASK_STMT. */
4712 static inline tree *
4713 gimple_omp_task_child_fn_ptr (gomp_task *omp_task_stmt)
4715 return &omp_task_stmt->child_fn;
4719 /* Set CHILD_FN to be the child function for OMP_TASK OMP_TASK_STMT. */
4721 static inline void
4722 gimple_omp_task_set_child_fn (gomp_task *omp_task_stmt, tree child_fn)
4724 omp_task_stmt->child_fn = child_fn;
4728 /* Return the artificial argument used to send variables and values
4729 from the parent to the children threads in OMP_TASK OMP_TASK_STMT. */
4731 static inline tree
4732 gimple_omp_task_data_arg (const gomp_task *omp_task_stmt)
4734 return omp_task_stmt->data_arg;
4738 /* Return a pointer to the data argument for OMP_TASK OMP_TASK_STMT. */
4740 static inline tree *
4741 gimple_omp_task_data_arg_ptr (gomp_task *omp_task_stmt)
4743 return &omp_task_stmt->data_arg;
4747 /* Set DATA_ARG to be the data argument for OMP_TASK OMP_TASK_STMT. */
4749 static inline void
4750 gimple_omp_task_set_data_arg (gomp_task *omp_task_stmt, tree data_arg)
4752 omp_task_stmt->data_arg = data_arg;
4756 /* Return the clauses associated with OMP_TASK GS. */
4758 static inline tree
4759 gimple_omp_taskreg_clauses (const_gimple gs)
4761 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4762 as_a <const gimple_statement_omp_taskreg *> (gs);
4763 return omp_taskreg_stmt->clauses;
4767 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4769 static inline tree *
4770 gimple_omp_taskreg_clauses_ptr (gimple gs)
4772 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4773 as_a <gimple_statement_omp_taskreg *> (gs);
4774 return &omp_taskreg_stmt->clauses;
4778 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4779 GS. */
4781 static inline void
4782 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4784 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4785 as_a <gimple_statement_omp_taskreg *> (gs);
4786 omp_taskreg_stmt->clauses = clauses;
4790 /* Return the child function used to hold the body of OMP_TASK GS. */
4792 static inline tree
4793 gimple_omp_taskreg_child_fn (const_gimple gs)
4795 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4796 as_a <const gimple_statement_omp_taskreg *> (gs);
4797 return omp_taskreg_stmt->child_fn;
4800 /* Return a pointer to the child function used to hold the body of
4801 OMP_TASK GS. */
4803 static inline tree *
4804 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4806 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4807 as_a <gimple_statement_omp_taskreg *> (gs);
4808 return &omp_taskreg_stmt->child_fn;
4812 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4814 static inline void
4815 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4817 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4818 as_a <gimple_statement_omp_taskreg *> (gs);
4819 omp_taskreg_stmt->child_fn = child_fn;
4823 /* Return the artificial argument used to send variables and values
4824 from the parent to the children threads in OMP_TASK GS. */
4826 static inline tree
4827 gimple_omp_taskreg_data_arg (const_gimple gs)
4829 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4830 as_a <const gimple_statement_omp_taskreg *> (gs);
4831 return omp_taskreg_stmt->data_arg;
4835 /* Return a pointer to the data argument for OMP_TASK GS. */
4837 static inline tree *
4838 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4840 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4841 as_a <gimple_statement_omp_taskreg *> (gs);
4842 return &omp_taskreg_stmt->data_arg;
4846 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4848 static inline void
4849 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4851 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4852 as_a <gimple_statement_omp_taskreg *> (gs);
4853 omp_taskreg_stmt->data_arg = data_arg;
4857 /* Return the copy function used to hold the body of OMP_TASK
4858 OMP_TASK_STMT. */
4860 static inline tree
4861 gimple_omp_task_copy_fn (const gomp_task *omp_task_stmt)
4863 return omp_task_stmt->copy_fn;
4866 /* Return a pointer to the copy function used to hold the body of
4867 OMP_TASK OMP_TASK_STMT. */
4869 static inline tree *
4870 gimple_omp_task_copy_fn_ptr (gomp_task *omp_task_stmt)
4872 return &omp_task_stmt->copy_fn;
4876 /* Set CHILD_FN to be the copy function for OMP_TASK OMP_TASK_STMT. */
4878 static inline void
4879 gimple_omp_task_set_copy_fn (gomp_task *omp_task_stmt, tree copy_fn)
4881 omp_task_stmt->copy_fn = copy_fn;
4885 /* Return size of the data block in bytes in OMP_TASK OMP_TASK_STMT. */
4887 static inline tree
4888 gimple_omp_task_arg_size (const gomp_task *omp_task_stmt)
4890 return omp_task_stmt->arg_size;
4894 /* Return a pointer to the data block size for OMP_TASK OMP_TASK_STMT. */
4896 static inline tree *
4897 gimple_omp_task_arg_size_ptr (gomp_task *omp_task_stmt)
4899 return &omp_task_stmt->arg_size;
4903 /* Set ARG_SIZE to be the data block size for OMP_TASK OMP_TASK_STMT. */
4905 static inline void
4906 gimple_omp_task_set_arg_size (gomp_task *omp_task_stmt, tree arg_size)
4908 omp_task_stmt->arg_size = arg_size;
4912 /* Return align of the data block in bytes in OMP_TASK OMP_TASK_STMT. */
4914 static inline tree
4915 gimple_omp_task_arg_align (const gomp_task *omp_task_stmt)
4917 return omp_task_stmt->arg_align;
4921 /* Return a pointer to the data block align for OMP_TASK OMP_TASK_STMT. */
4923 static inline tree *
4924 gimple_omp_task_arg_align_ptr (gomp_task *omp_task_stmt)
4926 return &omp_task_stmt->arg_align;
4930 /* Set ARG_SIZE to be the data block align for OMP_TASK OMP_TASK_STMT. */
4932 static inline void
4933 gimple_omp_task_set_arg_align (gomp_task *omp_task_stmt, tree arg_align)
4935 omp_task_stmt->arg_align = arg_align;
4939 /* Return the clauses associated with OMP_SINGLE OMP_SINGLE_STMT. */
4941 static inline tree
4942 gimple_omp_single_clauses (const gomp_single *omp_single_stmt)
4944 return omp_single_stmt->clauses;
4948 /* Return a pointer to the clauses associated with OMP_SINGLE
4949 OMP_SINGLE_STMT. */
4951 static inline tree *
4952 gimple_omp_single_clauses_ptr (gomp_single *omp_single_stmt)
4954 return &omp_single_stmt->clauses;
4958 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
4960 static inline void
4961 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
4963 omp_single_stmt->clauses = clauses;
4967 /* Return the clauses associated with OMP_TARGET OMP_TARGET_STMT. */
4969 static inline tree
4970 gimple_omp_target_clauses (const gomp_target *omp_target_stmt)
4972 return omp_target_stmt->clauses;
4976 /* Return a pointer to the clauses associated with OMP_TARGET
4977 OMP_TARGET_STMT. */
4979 static inline tree *
4980 gimple_omp_target_clauses_ptr (gomp_target *omp_target_stmt)
4982 return &omp_target_stmt->clauses;
4986 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
4988 static inline void
4989 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
4990 tree clauses)
4992 omp_target_stmt->clauses = clauses;
4996 /* Return the kind of OMP target statemement. */
4998 static inline int
4999 gimple_omp_target_kind (const gomp_target *g)
5001 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5005 /* Set the OMP target kind. */
5007 static inline void
5008 gimple_omp_target_set_kind (gomp_target *g, int kind)
5010 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5011 | (kind & GF_OMP_TARGET_KIND_MASK);
5015 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5017 static inline tree
5018 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5020 return omp_target_stmt->child_fn;
5023 /* Return a pointer to the child function used to hold the body of
5024 OMP_TARGET_STMT. */
5026 static inline tree *
5027 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5029 return &omp_target_stmt->child_fn;
5033 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5035 static inline void
5036 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5037 tree child_fn)
5039 omp_target_stmt->child_fn = child_fn;
5043 /* Return the artificial argument used to send variables and values
5044 from the parent to the children threads in OMP_TARGET_STMT. */
5046 static inline tree
5047 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5049 return omp_target_stmt->data_arg;
5053 /* Return a pointer to the data argument for OMP_TARGET GS. */
5055 static inline tree *
5056 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5058 return &omp_target_stmt->data_arg;
5062 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5064 static inline void
5065 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5066 tree data_arg)
5068 omp_target_stmt->data_arg = data_arg;
5072 /* Return the clauses associated with OMP_TEAMS OMP_TEAMS_STMT. */
5074 static inline tree
5075 gimple_omp_teams_clauses (const gomp_teams *omp_teams_stmt)
5077 return omp_teams_stmt->clauses;
5081 /* Return a pointer to the clauses associated with OMP_TEAMS
5082 OMP_TEAMS_STMT. */
5084 static inline tree *
5085 gimple_omp_teams_clauses_ptr (gomp_teams *omp_teams_stmt)
5087 return &omp_teams_stmt->clauses;
5091 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5093 static inline void
5094 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5096 omp_teams_stmt->clauses = clauses;
5100 /* Return the clauses associated with OMP_SECTIONS OMP_SECTIONS_STMT. */
5102 static inline tree
5103 gimple_omp_sections_clauses (const gomp_sections *omp_sections_stmt)
5105 return omp_sections_stmt->clauses;
5109 /* Return a pointer to the clauses associated with OMP_SECTIONS
5110 OMP_SECTIONS_STMT. */
5112 static inline tree *
5113 gimple_omp_sections_clauses_ptr (gomp_sections *omp_sections_stmt)
5115 return &omp_sections_stmt->clauses;
5119 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5120 OMP_SECTIONS_STMT. */
5122 static inline void
5123 gimple_omp_sections_set_clauses (gomp_sections *omp_sections_stmt, tree clauses)
5125 omp_sections_stmt->clauses = clauses;
5129 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5130 in OMP_SECTIONS_STMT. */
5132 static inline tree
5133 gimple_omp_sections_control (const gomp_sections *omp_sections_stmt)
5135 return omp_sections_stmt->control;
5139 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5140 OMP_SECTIONS_STMT. */
5142 static inline tree *
5143 gimple_omp_sections_control_ptr (gomp_sections *omp_sections_stmt)
5145 return &omp_sections_stmt->control;
5149 /* Set CONTROL to be the set of clauses associated with the
5150 GIMPLE_OMP_SECTIONS in OMP_SECTIONS_STMT. */
5152 static inline void
5153 gimple_omp_sections_set_control (gomp_sections *omp_sections_stmt, tree control)
5155 omp_sections_stmt->control = control;
5159 /* Set COND to be the condition code for OMP_FOR OMP_FOR_STMT. */
5161 static inline void
5162 gimple_omp_for_set_cond (gomp_for *omp_for_stmt, size_t i, enum tree_code cond)
5164 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5165 && i < omp_for_stmt->collapse);
5166 omp_for_stmt->iter[i].cond = cond;
5170 /* Return the condition code associated with OMP_FOR OMP_FOR_STMT. */
5172 static inline enum tree_code
5173 gimple_omp_for_cond (const gomp_for *omp_for_stmt, size_t i)
5175 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5176 return omp_for_stmt->iter[i].cond;
5180 /* Set the value being stored in an atomic store. */
5182 static inline void
5183 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5185 store_stmt->val = val;
5189 /* Return the value being stored in an atomic store. */
5191 static inline tree
5192 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5194 return store_stmt->val;
5198 /* Return a pointer to the value being stored in an atomic store. */
5200 static inline tree *
5201 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5203 return &store_stmt->val;
5207 /* Set the LHS of an atomic load. */
5209 static inline void
5210 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5212 load_stmt->lhs = lhs;
5216 /* Get the LHS of an atomic load. */
5218 static inline tree
5219 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5221 return load_stmt->lhs;
5225 /* Return a pointer to the LHS of an atomic load. */
5227 static inline tree *
5228 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5230 return &load_stmt->lhs;
5234 /* Set the RHS of an atomic load. */
5236 static inline void
5237 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5239 load_stmt->rhs = rhs;
5243 /* Get the RHS of an atomic load. */
5245 static inline tree
5246 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5248 return load_stmt->rhs;
5252 /* Return a pointer to the RHS of an atomic load. */
5254 static inline tree *
5255 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5257 return &load_stmt->rhs;
5261 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5263 static inline tree
5264 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5266 return cont_stmt->control_def;
5269 /* The same as above, but return the address. */
5271 static inline tree *
5272 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5274 return &cont_stmt->control_def;
5277 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5279 static inline void
5280 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5282 cont_stmt->control_def = def;
5286 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5288 static inline tree
5289 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5291 return cont_stmt->control_use;
5295 /* The same as above, but return the address. */
5297 static inline tree *
5298 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5300 return &cont_stmt->control_use;
5304 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5306 static inline void
5307 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5309 cont_stmt->control_use = use;
5312 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5313 TRANSACTION_STMT. */
5315 static inline gimple_seq *
5316 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5318 return &transaction_stmt->body;
5321 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5323 static inline gimple_seq
5324 gimple_transaction_body (gtransaction *transaction_stmt)
5326 return *gimple_transaction_body_ptr (transaction_stmt);
5329 /* Return the label associated with a GIMPLE_TRANSACTION. */
5331 static inline tree
5332 gimple_transaction_label (const gtransaction *transaction_stmt)
5334 return transaction_stmt->label;
5337 static inline tree *
5338 gimple_transaction_label_ptr (gtransaction *transaction_stmt)
5340 return &transaction_stmt->label;
5343 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5345 static inline unsigned int
5346 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5348 return transaction_stmt->subcode;
5351 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5352 TRANSACTION_STMT. */
5354 static inline void
5355 gimple_transaction_set_body (gtransaction *transaction_stmt,
5356 gimple_seq body)
5358 transaction_stmt->body = body;
5361 /* Set the label associated with a GIMPLE_TRANSACTION. */
5363 static inline void
5364 gimple_transaction_set_label (gtransaction *transaction_stmt, tree label)
5366 transaction_stmt->label = label;
5369 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5371 static inline void
5372 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5373 unsigned int subcode)
5375 transaction_stmt->subcode = subcode;
5379 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5381 static inline tree *
5382 gimple_return_retval_ptr (const greturn *gs)
5384 return gimple_op_ptr (gs, 0);
5387 /* Return the return value for GIMPLE_RETURN GS. */
5389 static inline tree
5390 gimple_return_retval (const greturn *gs)
5392 return gimple_op (gs, 0);
5396 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5398 static inline void
5399 gimple_return_set_retval (greturn *gs, tree retval)
5401 gimple_set_op (gs, 0, retval);
5405 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5407 #define CASE_GIMPLE_OMP \
5408 case GIMPLE_OMP_PARALLEL: \
5409 case GIMPLE_OMP_TASK: \
5410 case GIMPLE_OMP_FOR: \
5411 case GIMPLE_OMP_SECTIONS: \
5412 case GIMPLE_OMP_SECTIONS_SWITCH: \
5413 case GIMPLE_OMP_SINGLE: \
5414 case GIMPLE_OMP_TARGET: \
5415 case GIMPLE_OMP_TEAMS: \
5416 case GIMPLE_OMP_SECTION: \
5417 case GIMPLE_OMP_MASTER: \
5418 case GIMPLE_OMP_TASKGROUP: \
5419 case GIMPLE_OMP_ORDERED: \
5420 case GIMPLE_OMP_CRITICAL: \
5421 case GIMPLE_OMP_RETURN: \
5422 case GIMPLE_OMP_ATOMIC_LOAD: \
5423 case GIMPLE_OMP_ATOMIC_STORE: \
5424 case GIMPLE_OMP_CONTINUE
5426 static inline bool
5427 is_gimple_omp (const_gimple stmt)
5429 switch (gimple_code (stmt))
5431 CASE_GIMPLE_OMP:
5432 return true;
5433 default:
5434 return false;
5439 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5441 static inline bool
5442 gimple_nop_p (const_gimple g)
5444 return gimple_code (g) == GIMPLE_NOP;
5448 /* Return true if GS is a GIMPLE_RESX. */
5450 static inline bool
5451 is_gimple_resx (const_gimple gs)
5453 return gimple_code (gs) == GIMPLE_RESX;
5456 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5458 static inline enum br_predictor
5459 gimple_predict_predictor (const gpredict *gs)
5461 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5465 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5467 static inline void
5468 gimple_predict_set_predictor (gpredict *gs, enum br_predictor predictor)
5470 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5471 | (unsigned) predictor;
5475 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5477 static inline enum prediction
5478 gimple_predict_outcome (const gpredict *gs)
5480 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5484 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5486 static inline void
5487 gimple_predict_set_outcome (gpredict *gs, enum prediction outcome)
5489 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5490 if (outcome == TAKEN)
5491 gs->subcode |= GF_PREDICT_TAKEN;
5492 else
5493 gs->subcode &= ~GF_PREDICT_TAKEN;
5497 /* Return the type of the main expression computed by STMT. Return
5498 void_type_node if the statement computes nothing. */
5500 static inline tree
5501 gimple_expr_type (const_gimple stmt)
5503 enum gimple_code code = gimple_code (stmt);
5505 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5507 tree type;
5508 /* In general we want to pass out a type that can be substituted
5509 for both the RHS and the LHS types if there is a possibly
5510 useless conversion involved. That means returning the
5511 original RHS type as far as we can reconstruct it. */
5512 if (code == GIMPLE_CALL)
5514 const gcall *call_stmt = as_a <const gcall *> (stmt);
5515 if (gimple_call_internal_p (call_stmt)
5516 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
5517 type = TREE_TYPE (gimple_call_arg (call_stmt, 3));
5518 else
5519 type = gimple_call_return_type (call_stmt);
5521 else
5522 switch (gimple_assign_rhs_code (stmt))
5524 case POINTER_PLUS_EXPR:
5525 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5526 break;
5528 default:
5529 /* As fallback use the type of the LHS. */
5530 type = TREE_TYPE (gimple_get_lhs (stmt));
5531 break;
5533 return type;
5535 else if (code == GIMPLE_COND)
5536 return boolean_type_node;
5537 else
5538 return void_type_node;
5541 /* Enum and arrays used for allocation stats. Keep in sync with
5542 gimple.c:gimple_alloc_kind_names. */
5543 enum gimple_alloc_kind
5545 gimple_alloc_kind_assign, /* Assignments. */
5546 gimple_alloc_kind_phi, /* PHI nodes. */
5547 gimple_alloc_kind_cond, /* Conditionals. */
5548 gimple_alloc_kind_rest, /* Everything else. */
5549 gimple_alloc_kind_all
5552 extern int gimple_alloc_counts[];
5553 extern int gimple_alloc_sizes[];
5555 /* Return the allocation kind for a given stmt CODE. */
5556 static inline enum gimple_alloc_kind
5557 gimple_alloc_kind (enum gimple_code code)
5559 switch (code)
5561 case GIMPLE_ASSIGN:
5562 return gimple_alloc_kind_assign;
5563 case GIMPLE_PHI:
5564 return gimple_alloc_kind_phi;
5565 case GIMPLE_COND:
5566 return gimple_alloc_kind_cond;
5567 default:
5568 return gimple_alloc_kind_rest;
5572 /* Return true if a location should not be emitted for this statement
5573 by annotate_all_with_location. */
5575 static inline bool
5576 gimple_do_not_emit_location_p (gimple g)
5578 return gimple_plf (g, GF_PLF_1);
5581 /* Mark statement G so a location will not be emitted by
5582 annotate_one_with_location. */
5584 static inline void
5585 gimple_set_do_not_emit_location (gimple g)
5587 /* The PLF flags are initialized to 0 when a new tuple is created,
5588 so no need to initialize it anywhere. */
5589 gimple_set_plf (g, GF_PLF_1, true);
5593 /* Macros for showing usage statistics. */
5594 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5595 ? (x) \
5596 : ((x) < 1024*1024*10 \
5597 ? (x) / 1024 \
5598 : (x) / (1024*1024))))
5600 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5602 #endif /* GCC_GIMPLE_H */