Introduce gimple_assign and use it in various places
[official-gcc.git] / gcc / gimple.h
blob285b1f2c4938e5e8b6eba0bcf6fac9c678bf3dd1
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2014 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 typedef gimple gimple_seq_node;
27 /* For each block, the PHI nodes that need to be rewritten are stored into
28 these vectors. */
29 typedef vec<gimple> gimple_vec;
31 enum gimple_code {
32 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
33 #include "gimple.def"
34 #undef DEFGSCODE
35 LAST_AND_UNUSED_GIMPLE_CODE
38 extern const char *const gimple_code_name[];
39 extern const unsigned char gimple_rhs_class_table[];
41 /* Error out if a gimple tuple is addressed incorrectly. */
42 #if defined ENABLE_GIMPLE_CHECKING
43 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
44 extern void gimple_check_failed (const_gimple, const char *, int, \
45 const char *, enum gimple_code, \
46 enum tree_code) ATTRIBUTE_NORETURN;
48 #define GIMPLE_CHECK(GS, CODE) \
49 do { \
50 const_gimple __gs = (GS); \
51 if (gimple_code (__gs) != (CODE)) \
52 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
53 (CODE), ERROR_MARK); \
54 } while (0)
55 #else /* not ENABLE_GIMPLE_CHECKING */
56 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
57 #define GIMPLE_CHECK(GS, CODE) (void)0
58 #endif
60 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
61 get_gimple_rhs_class. */
62 enum gimple_rhs_class
64 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
65 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
66 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
67 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
68 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
69 name, a _DECL, a _REF, etc. */
72 /* Specific flags for individual GIMPLE statements. These flags are
73 always stored in gimple_statement_base.subcode and they may only be
74 defined for statement codes that do not use subcodes.
76 Values for the masks can overlap as long as the overlapping values
77 are never used in the same statement class.
79 The maximum mask value that can be defined is 1 << 15 (i.e., each
80 statement code can hold up to 16 bitflags).
82 Keep this list sorted. */
83 enum gf_mask {
84 GF_ASM_INPUT = 1 << 0,
85 GF_ASM_VOLATILE = 1 << 1,
86 GF_CALL_FROM_THUNK = 1 << 0,
87 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
88 GF_CALL_TAILCALL = 1 << 2,
89 GF_CALL_VA_ARG_PACK = 1 << 3,
90 GF_CALL_NOTHROW = 1 << 4,
91 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
92 GF_CALL_INTERNAL = 1 << 6,
93 GF_CALL_CTRL_ALTERING = 1 << 7,
94 GF_OMP_PARALLEL_COMBINED = 1 << 0,
95 GF_OMP_FOR_KIND_MASK = 7 << 0,
96 GF_OMP_FOR_KIND_FOR = 0,
97 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
98 GF_OMP_FOR_KIND_CILKFOR = 2,
99 /* Flag for SIMD variants of OMP_FOR kinds. */
100 GF_OMP_FOR_SIMD = 1 << 2,
101 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
102 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
103 GF_OMP_FOR_COMBINED = 1 << 3,
104 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
105 GF_OMP_TARGET_KIND_MASK = (1 << 2) - 1,
106 GF_OMP_TARGET_KIND_REGION = 0,
107 GF_OMP_TARGET_KIND_DATA = 1,
108 GF_OMP_TARGET_KIND_UPDATE = 2,
110 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
111 a thread synchronization via some sort of barrier. The exact barrier
112 that would otherwise be emitted is dependent on the OMP statement with
113 which this return is associated. */
114 GF_OMP_RETURN_NOWAIT = 1 << 0,
116 GF_OMP_SECTION_LAST = 1 << 0,
117 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
118 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
119 GF_PREDICT_TAKEN = 1 << 15
122 /* Currently, there are only two types of gimple debug stmt. Others are
123 envisioned, for example, to enable the generation of is_stmt notes
124 in line number information, to mark sequence points, etc. This
125 subcode is to be used to tell them apart. */
126 enum gimple_debug_subcode {
127 GIMPLE_DEBUG_BIND = 0,
128 GIMPLE_DEBUG_SOURCE_BIND = 1
131 /* Masks for selecting a pass local flag (PLF) to work on. These
132 masks are used by gimple_set_plf and gimple_plf. */
133 enum plf_mask {
134 GF_PLF_1 = 1 << 0,
135 GF_PLF_2 = 1 << 1
138 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
139 are for 64 bit hosts. */
141 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
142 chain_next ("%h.next"), variable_size))
143 gimple_statement_base
145 /* [ WORD 1 ]
146 Main identifying code for a tuple. */
147 ENUM_BITFIELD(gimple_code) code : 8;
149 /* Nonzero if a warning should not be emitted on this tuple. */
150 unsigned int no_warning : 1;
152 /* Nonzero if this tuple has been visited. Passes are responsible
153 for clearing this bit before using it. */
154 unsigned int visited : 1;
156 /* Nonzero if this tuple represents a non-temporal move. */
157 unsigned int nontemporal_move : 1;
159 /* Pass local flags. These flags are free for any pass to use as
160 they see fit. Passes should not assume that these flags contain
161 any useful value when the pass starts. Any initial state that
162 the pass requires should be set on entry to the pass. See
163 gimple_set_plf and gimple_plf for usage. */
164 unsigned int plf : 2;
166 /* Nonzero if this statement has been modified and needs to have its
167 operands rescanned. */
168 unsigned modified : 1;
170 /* Nonzero if this statement contains volatile operands. */
171 unsigned has_volatile_ops : 1;
173 /* Padding to get subcode to 16 bit alignment. */
174 unsigned pad : 1;
176 /* The SUBCODE field can be used for tuple-specific flags for tuples
177 that do not require subcodes. Note that SUBCODE should be at
178 least as wide as tree codes, as several tuples store tree codes
179 in there. */
180 unsigned int subcode : 16;
182 /* UID of this statement. This is used by passes that want to
183 assign IDs to statements. It must be assigned and used by each
184 pass. By default it should be assumed to contain garbage. */
185 unsigned uid;
187 /* [ WORD 2 ]
188 Locus information for debug info. */
189 location_t location;
191 /* Number of operands in this tuple. */
192 unsigned num_ops;
194 /* [ WORD 3 ]
195 Basic block holding this statement. */
196 basic_block bb;
198 /* [ WORD 4-5 ]
199 Linked lists of gimple statements. The next pointers form
200 a NULL terminated list, the prev pointers are a cyclic list.
201 A gimple statement is hence also a double-ended list of
202 statements, with the pointer itself being the first element,
203 and the prev pointer being the last. */
204 gimple next;
205 gimple GTY((skip)) prev;
210 /* Base structure for tuples with operands. */
212 /* This gimple subclass has no tag value. */
213 struct GTY(())
214 gimple_statement_with_ops_base : public gimple_statement_base
216 /* [ WORD 1-6 ] : base class */
218 /* [ WORD 7 ]
219 SSA operand vectors. NOTE: It should be possible to
220 amalgamate these vectors with the operand vector OP. However,
221 the SSA operand vectors are organized differently and contain
222 more information (like immediate use chaining). */
223 struct use_optype_d GTY((skip (""))) *use_ops;
227 /* Statements that take register operands. */
229 struct GTY((tag("GSS_WITH_OPS")))
230 gimple_statement_with_ops : public gimple_statement_with_ops_base
232 /* [ WORD 1-7 ] : base class */
234 /* [ WORD 8 ]
235 Operand vector. NOTE! This must always be the last field
236 of this structure. In particular, this means that this
237 structure cannot be embedded inside another one. */
238 tree GTY((length ("%h.num_ops"))) op[1];
242 /* Base for statements that take both memory and register operands. */
244 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
245 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
247 /* [ WORD 1-7 ] : base class */
249 /* [ WORD 8-9 ]
250 Virtual operands for this statement. The GC will pick them
251 up via the ssa_names array. */
252 tree GTY((skip (""))) vdef;
253 tree GTY((skip (""))) vuse;
257 /* Statements that take both memory and register operands. */
259 struct GTY((tag("GSS_WITH_MEM_OPS")))
260 gimple_statement_with_memory_ops :
261 public gimple_statement_with_memory_ops_base
263 /* [ WORD 1-9 ] : base class */
265 /* [ WORD 10 ]
266 Operand vector. NOTE! This must always be the last field
267 of this structure. In particular, this means that this
268 structure cannot be embedded inside another one. */
269 tree GTY((length ("%h.num_ops"))) op[1];
273 /* Call statements that take both memory and register operands. */
275 struct GTY((tag("GSS_CALL")))
276 gimple_statement_call : public gimple_statement_with_memory_ops_base
278 /* [ WORD 1-9 ] : base class */
280 /* [ WORD 10-13 ] */
281 struct pt_solution call_used;
282 struct pt_solution call_clobbered;
284 /* [ WORD 14 ] */
285 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
286 tree GTY ((tag ("0"))) fntype;
287 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
288 } u;
290 /* [ WORD 15 ]
291 Operand vector. NOTE! This must always be the last field
292 of this structure. In particular, this means that this
293 structure cannot be embedded inside another one. */
294 tree GTY((length ("%h.num_ops"))) op[1];
298 /* OpenMP statements (#pragma omp). */
300 struct GTY((tag("GSS_OMP")))
301 gimple_statement_omp : public gimple_statement_base
303 /* [ WORD 1-6 ] : base class */
305 /* [ WORD 7 ] */
306 gimple_seq body;
310 /* GIMPLE_BIND */
312 struct GTY((tag("GSS_BIND")))
313 gimple_statement_bind : public gimple_statement_base
315 /* [ WORD 1-6 ] : base class */
317 /* [ WORD 7 ]
318 Variables declared in this scope. */
319 tree vars;
321 /* [ WORD 8 ]
322 This is different than the BLOCK field in gimple_statement_base,
323 which is analogous to TREE_BLOCK (i.e., the lexical block holding
324 this statement). This field is the equivalent of BIND_EXPR_BLOCK
325 in tree land (i.e., the lexical scope defined by this bind). See
326 gimple-low.c. */
327 tree block;
329 /* [ WORD 9 ] */
330 gimple_seq body;
334 /* GIMPLE_CATCH */
336 struct GTY((tag("GSS_CATCH")))
337 gimple_statement_catch : public gimple_statement_base
339 /* [ WORD 1-6 ] : base class */
341 /* [ WORD 7 ] */
342 tree types;
344 /* [ WORD 8 ] */
345 gimple_seq handler;
349 /* GIMPLE_EH_FILTER */
351 struct GTY((tag("GSS_EH_FILTER")))
352 gimple_statement_eh_filter : public gimple_statement_base
354 /* [ WORD 1-6 ] : base class */
356 /* [ WORD 7 ]
357 Filter types. */
358 tree types;
360 /* [ WORD 8 ]
361 Failure actions. */
362 gimple_seq failure;
365 /* GIMPLE_EH_ELSE */
367 struct GTY((tag("GSS_EH_ELSE")))
368 gimple_statement_eh_else : public gimple_statement_base
370 /* [ WORD 1-6 ] : base class */
372 /* [ WORD 7,8 ] */
373 gimple_seq n_body, e_body;
376 /* GIMPLE_EH_MUST_NOT_THROW */
378 struct GTY((tag("GSS_EH_MNT")))
379 gimple_statement_eh_mnt : public gimple_statement_base
381 /* [ WORD 1-6 ] : base class */
383 /* [ WORD 7 ] Abort function decl. */
384 tree fndecl;
387 /* GIMPLE_PHI */
389 struct GTY((tag("GSS_PHI")))
390 gimple_statement_phi : public gimple_statement_base
392 /* [ WORD 1-6 ] : base class */
394 /* [ WORD 7 ] */
395 unsigned capacity;
396 unsigned nargs;
398 /* [ WORD 8 ] */
399 tree result;
401 /* [ WORD 9 ] */
402 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
406 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
408 struct GTY((tag("GSS_EH_CTRL")))
409 gimple_statement_eh_ctrl : public gimple_statement_base
411 /* [ WORD 1-6 ] : base class */
413 /* [ WORD 7 ]
414 Exception region number. */
415 int region;
418 struct GTY((tag("GSS_EH_CTRL")))
419 gimple_statement_resx : public gimple_statement_eh_ctrl
421 /* No extra fields; adds invariant:
422 stmt->code == GIMPLE_RESX. */
425 struct GTY((tag("GSS_EH_CTRL")))
426 gimple_statement_eh_dispatch : public gimple_statement_eh_ctrl
428 /* No extra fields; adds invariant:
429 stmt->code == GIMPLE_EH_DISPATH. */
433 /* GIMPLE_TRY */
435 struct GTY((tag("GSS_TRY")))
436 gimple_statement_try : public gimple_statement_base
438 /* [ WORD 1-6 ] : base class */
440 /* [ WORD 7 ]
441 Expression to evaluate. */
442 gimple_seq eval;
444 /* [ WORD 8 ]
445 Cleanup expression. */
446 gimple_seq cleanup;
449 /* Kind of GIMPLE_TRY statements. */
450 enum gimple_try_flags
452 /* A try/catch. */
453 GIMPLE_TRY_CATCH = 1 << 0,
455 /* A try/finally. */
456 GIMPLE_TRY_FINALLY = 1 << 1,
457 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
459 /* Analogous to TRY_CATCH_IS_CLEANUP. */
460 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
463 /* GIMPLE_WITH_CLEANUP_EXPR */
465 struct GTY((tag("GSS_WCE")))
466 gimple_statement_wce : public gimple_statement_base
468 /* [ WORD 1-6 ] : base class */
470 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
471 executed if an exception is thrown, not on normal exit of its
472 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
473 in TARGET_EXPRs. */
475 /* [ WORD 7 ]
476 Cleanup expression. */
477 gimple_seq cleanup;
481 /* GIMPLE_ASM */
483 struct GTY((tag("GSS_ASM")))
484 gimple_statement_asm : public gimple_statement_with_memory_ops_base
486 /* [ WORD 1-9 ] : base class */
488 /* [ WORD 10 ]
489 __asm__ statement. */
490 const char *string;
492 /* [ WORD 11 ]
493 Number of inputs, outputs, clobbers, labels. */
494 unsigned char ni;
495 unsigned char no;
496 unsigned char nc;
497 unsigned char nl;
499 /* [ WORD 12 ]
500 Operand vector. NOTE! This must always be the last field
501 of this structure. In particular, this means that this
502 structure cannot be embedded inside another one. */
503 tree GTY((length ("%h.num_ops"))) op[1];
506 /* GIMPLE_OMP_CRITICAL */
508 struct GTY((tag("GSS_OMP_CRITICAL")))
509 gimple_statement_omp_critical : public gimple_statement_omp
511 /* [ WORD 1-7 ] : base class */
513 /* [ WORD 8 ]
514 Critical section name. */
515 tree name;
519 struct GTY(()) gimple_omp_for_iter {
520 /* Condition code. */
521 enum tree_code cond;
523 /* Index variable. */
524 tree index;
526 /* Initial value. */
527 tree initial;
529 /* Final value. */
530 tree final;
532 /* Increment. */
533 tree incr;
536 /* GIMPLE_OMP_FOR */
538 struct GTY((tag("GSS_OMP_FOR")))
539 gimple_statement_omp_for : public gimple_statement_omp
541 /* [ WORD 1-7 ] : base class */
543 /* [ WORD 8 ] */
544 tree clauses;
546 /* [ WORD 9 ]
547 Number of elements in iter array. */
548 size_t collapse;
550 /* [ WORD 10 ] */
551 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
553 /* [ WORD 11 ]
554 Pre-body evaluated before the loop body begins. */
555 gimple_seq pre_body;
559 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
560 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
561 gimple_statement_omp_parallel_layout : public gimple_statement_omp
563 /* [ WORD 1-7 ] : base class */
565 /* [ WORD 8 ]
566 Clauses. */
567 tree clauses;
569 /* [ WORD 9 ]
570 Child function holding the body of the parallel region. */
571 tree child_fn;
573 /* [ WORD 10 ]
574 Shared data argument. */
575 tree data_arg;
578 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
579 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
580 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
582 /* No extra fields; adds invariant:
583 stmt->code == GIMPLE_OMP_PARALLEL
584 || stmt->code == GIMPLE_OMP_TASK. */
588 /* GIMPLE_OMP_PARALLEL */
589 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
590 gimple_statement_omp_parallel : public gimple_statement_omp_taskreg
592 /* No extra fields; adds invariant:
593 stmt->code == GIMPLE_OMP_PARALLEL. */
596 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
597 gimple_statement_omp_target : public gimple_statement_omp_parallel_layout
599 /* No extra fields; adds invariant:
600 stmt->code == GIMPLE_OMP_TARGET. */
603 /* GIMPLE_OMP_TASK */
605 struct GTY((tag("GSS_OMP_TASK")))
606 gimple_statement_omp_task : public gimple_statement_omp_taskreg
608 /* [ WORD 1-10 ] : base class */
610 /* [ WORD 11 ]
611 Child function holding firstprivate initialization if needed. */
612 tree copy_fn;
614 /* [ WORD 12-13 ]
615 Size and alignment in bytes of the argument data block. */
616 tree arg_size;
617 tree arg_align;
621 /* GIMPLE_OMP_SECTION */
622 /* Uses struct gimple_statement_omp. */
625 /* GIMPLE_OMP_SECTIONS */
627 struct GTY((tag("GSS_OMP_SECTIONS")))
628 gimple_statement_omp_sections : public gimple_statement_omp
630 /* [ WORD 1-7 ] : base class */
632 /* [ WORD 8 ] */
633 tree clauses;
635 /* [ WORD 9 ]
636 The control variable used for deciding which of the sections to
637 execute. */
638 tree control;
641 /* GIMPLE_OMP_CONTINUE.
643 Note: This does not inherit from gimple_statement_omp, because we
644 do not need the body field. */
646 struct GTY((tag("GSS_OMP_CONTINUE")))
647 gimple_statement_omp_continue : public gimple_statement_base
649 /* [ WORD 1-6 ] : base class */
651 /* [ WORD 7 ] */
652 tree control_def;
654 /* [ WORD 8 ] */
655 tree control_use;
658 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
660 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
661 gimple_statement_omp_single_layout : public gimple_statement_omp
663 /* [ WORD 1-7 ] : base class */
665 /* [ WORD 7 ] */
666 tree clauses;
669 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
670 gimple_statement_omp_single : public gimple_statement_omp_single_layout
672 /* No extra fields; adds invariant:
673 stmt->code == GIMPLE_OMP_SINGLE. */
676 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
677 gimple_statement_omp_teams : public gimple_statement_omp_single_layout
679 /* No extra fields; adds invariant:
680 stmt->code == GIMPLE_OMP_TEAMS. */
684 /* GIMPLE_OMP_ATOMIC_LOAD.
685 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
686 contains a sequence, which we don't need here. */
688 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
689 gimple_statement_omp_atomic_load : public gimple_statement_base
691 /* [ WORD 1-6 ] : base class */
693 /* [ WORD 7-8 ] */
694 tree rhs, lhs;
697 /* GIMPLE_OMP_ATOMIC_STORE.
698 See note on GIMPLE_OMP_ATOMIC_LOAD. */
700 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
701 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
703 /* [ WORD 1-6 ] : base class */
705 /* [ WORD 7 ] */
706 tree val;
709 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
710 gimple_statement_omp_atomic_store :
711 public gimple_statement_omp_atomic_store_layout
713 /* No extra fields; adds invariant:
714 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
717 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
718 gimple_statement_omp_return :
719 public gimple_statement_omp_atomic_store_layout
721 /* No extra fields; adds invariant:
722 stmt->code == GIMPLE_OMP_RETURN. */
725 /* GIMPLE_TRANSACTION. */
727 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
729 /* The __transaction_atomic was declared [[outer]] or it is
730 __transaction_relaxed. */
731 #define GTMA_IS_OUTER (1u << 0)
732 #define GTMA_IS_RELAXED (1u << 1)
733 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
735 /* The transaction is seen to not have an abort. */
736 #define GTMA_HAVE_ABORT (1u << 2)
737 /* The transaction is seen to have loads or stores. */
738 #define GTMA_HAVE_LOAD (1u << 3)
739 #define GTMA_HAVE_STORE (1u << 4)
740 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
741 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
742 /* The transaction WILL enter serial irrevocable mode.
743 An irrevocable block post-dominates the entire transaction, such
744 that all invocations of the transaction will go serial-irrevocable.
745 In such case, we don't bother instrumenting the transaction, and
746 tell the runtime that it should begin the transaction in
747 serial-irrevocable mode. */
748 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
749 /* The transaction contains no instrumentation code whatsover, most
750 likely because it is guaranteed to go irrevocable upon entry. */
751 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
753 struct GTY((tag("GSS_TRANSACTION")))
754 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
756 /* [ WORD 1-9 ] : base class */
758 /* [ WORD 10 ] */
759 gimple_seq body;
761 /* [ WORD 11 ] */
762 tree label;
765 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
766 enum gimple_statement_structure_enum {
767 #include "gsstruct.def"
768 LAST_GSS_ENUM
770 #undef DEFGSSTRUCT
772 /* A statement with the invariant that
773 stmt->code == GIMPLE_COND
774 i.e. a conditional jump statement. */
776 struct GTY((tag("GSS_WITH_OPS")))
777 gimple_statement_cond : public gimple_statement_with_ops
779 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
782 /* A statement with the invariant that
783 stmt->code == GIMPLE_SWITCH
784 i.e. a switch statement. */
786 struct GTY((tag("GSS_WITH_OPS")))
787 gimple_statement_switch : public gimple_statement_with_ops
789 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
792 /* A statement with the invariant that
793 stmt->code == GIMPLE_ASSIGN
794 i.e. an assignment statement. */
796 struct GTY((tag("GSS_WITH_MEM_OPS")))
797 gimple_statement_assign : public gimple_statement_with_memory_ops
799 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
802 template <>
803 template <>
804 inline bool
805 is_a_helper <gimple_statement_asm *>::test (gimple gs)
807 return gs->code == GIMPLE_ASM;
810 template <>
811 template <>
812 inline bool
813 is_a_helper <gimple_statement_assign *>::test (gimple gs)
815 return gs->code == GIMPLE_ASSIGN;
818 template <>
819 template <>
820 inline bool
821 is_a_helper <gimple_statement_bind *>::test (gimple gs)
823 return gs->code == GIMPLE_BIND;
826 template <>
827 template <>
828 inline bool
829 is_a_helper <gimple_statement_call *>::test (gimple gs)
831 return gs->code == GIMPLE_CALL;
834 template <>
835 template <>
836 inline bool
837 is_a_helper <gimple_statement_catch *>::test (gimple gs)
839 return gs->code == GIMPLE_CATCH;
842 template <>
843 template <>
844 inline bool
845 is_a_helper <gimple_statement_cond *>::test (gimple gs)
847 return gs->code == GIMPLE_COND;
850 template <>
851 template <>
852 inline bool
853 is_a_helper <gimple_statement_resx *>::test (gimple gs)
855 return gs->code == GIMPLE_RESX;
858 template <>
859 template <>
860 inline bool
861 is_a_helper <gimple_statement_eh_dispatch *>::test (gimple gs)
863 return gs->code == GIMPLE_EH_DISPATCH;
866 template <>
867 template <>
868 inline bool
869 is_a_helper <gimple_statement_eh_else *>::test (gimple gs)
871 return gs->code == GIMPLE_EH_ELSE;
874 template <>
875 template <>
876 inline bool
877 is_a_helper <gimple_statement_eh_filter *>::test (gimple gs)
879 return gs->code == GIMPLE_EH_FILTER;
882 template <>
883 template <>
884 inline bool
885 is_a_helper <gimple_statement_eh_mnt *>::test (gimple gs)
887 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
890 template <>
891 template <>
892 inline bool
893 is_a_helper <gimple_statement_omp_atomic_load *>::test (gimple gs)
895 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
898 template <>
899 template <>
900 inline bool
901 is_a_helper <gimple_statement_omp_atomic_store *>::test (gimple gs)
903 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
906 template <>
907 template <>
908 inline bool
909 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
911 return gs->code == GIMPLE_OMP_RETURN;
914 template <>
915 template <>
916 inline bool
917 is_a_helper <gimple_statement_omp_continue *>::test (gimple gs)
919 return gs->code == GIMPLE_OMP_CONTINUE;
922 template <>
923 template <>
924 inline bool
925 is_a_helper <gimple_statement_omp_critical *>::test (gimple gs)
927 return gs->code == GIMPLE_OMP_CRITICAL;
930 template <>
931 template <>
932 inline bool
933 is_a_helper <gimple_statement_omp_for *>::test (gimple gs)
935 return gs->code == GIMPLE_OMP_FOR;
938 template <>
939 template <>
940 inline bool
941 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
943 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
946 template <>
947 template <>
948 inline bool
949 is_a_helper <gimple_statement_omp_parallel *>::test (gimple gs)
951 return gs->code == GIMPLE_OMP_PARALLEL;
954 template <>
955 template <>
956 inline bool
957 is_a_helper <gimple_statement_omp_target *>::test (gimple gs)
959 return gs->code == GIMPLE_OMP_TARGET;
962 template <>
963 template <>
964 inline bool
965 is_a_helper <gimple_statement_omp_sections *>::test (gimple gs)
967 return gs->code == GIMPLE_OMP_SECTIONS;
970 template <>
971 template <>
972 inline bool
973 is_a_helper <gimple_statement_omp_single *>::test (gimple gs)
975 return gs->code == GIMPLE_OMP_SINGLE;
978 template <>
979 template <>
980 inline bool
981 is_a_helper <gimple_statement_omp_teams *>::test (gimple gs)
983 return gs->code == GIMPLE_OMP_TEAMS;
986 template <>
987 template <>
988 inline bool
989 is_a_helper <gimple_statement_omp_task *>::test (gimple gs)
991 return gs->code == GIMPLE_OMP_TASK;
994 template <>
995 template <>
996 inline bool
997 is_a_helper <gimple_statement_phi *>::test (gimple gs)
999 return gs->code == GIMPLE_PHI;
1002 template <>
1003 template <>
1004 inline bool
1005 is_a_helper <gimple_statement_transaction *>::test (gimple gs)
1007 return gs->code == GIMPLE_TRANSACTION;
1010 template <>
1011 template <>
1012 inline bool
1013 is_a_helper <gimple_statement_switch *>::test (gimple gs)
1015 return gs->code == GIMPLE_SWITCH;
1018 template <>
1019 template <>
1020 inline bool
1021 is_a_helper <gimple_statement_try *>::test (gimple gs)
1023 return gs->code == GIMPLE_TRY;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <gimple_statement_wce *>::test (gimple gs)
1031 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <const gimple_statement_asm *>::test (const_gimple gs)
1039 return gs->code == GIMPLE_ASM;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <const gimple_statement_bind *>::test (const_gimple gs)
1047 return gs->code == GIMPLE_BIND;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <const gimple_statement_call *>::test (const_gimple gs)
1055 return gs->code == GIMPLE_CALL;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <const gimple_statement_catch *>::test (const_gimple gs)
1063 return gs->code == GIMPLE_CATCH;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <const gimple_statement_resx *>::test (const_gimple gs)
1071 return gs->code == GIMPLE_RESX;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <const gimple_statement_eh_dispatch *>::test (const_gimple gs)
1079 return gs->code == GIMPLE_EH_DISPATCH;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <const gimple_statement_eh_filter *>::test (const_gimple gs)
1087 return gs->code == GIMPLE_EH_FILTER;
1090 template <>
1091 template <>
1092 inline bool
1093 is_a_helper <const gimple_statement_omp_atomic_load *>::test (const_gimple gs)
1095 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <const gimple_statement_omp_atomic_store *>::test (const_gimple gs)
1103 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1111 return gs->code == GIMPLE_OMP_RETURN;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <const gimple_statement_omp_continue *>::test (const_gimple gs)
1119 return gs->code == GIMPLE_OMP_CONTINUE;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <const gimple_statement_omp_critical *>::test (const_gimple gs)
1127 return gs->code == GIMPLE_OMP_CRITICAL;
1130 template <>
1131 template <>
1132 inline bool
1133 is_a_helper <const gimple_statement_omp_for *>::test (const_gimple gs)
1135 return gs->code == GIMPLE_OMP_FOR;
1138 template <>
1139 template <>
1140 inline bool
1141 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1143 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1146 template <>
1147 template <>
1148 inline bool
1149 is_a_helper <const gimple_statement_omp_parallel *>::test (const_gimple gs)
1151 return gs->code == GIMPLE_OMP_PARALLEL;
1154 template <>
1155 template <>
1156 inline bool
1157 is_a_helper <const gimple_statement_omp_target *>::test (const_gimple gs)
1159 return gs->code == GIMPLE_OMP_TARGET;
1162 template <>
1163 template <>
1164 inline bool
1165 is_a_helper <const gimple_statement_omp_sections *>::test (const_gimple gs)
1167 return gs->code == GIMPLE_OMP_SECTIONS;
1170 template <>
1171 template <>
1172 inline bool
1173 is_a_helper <const gimple_statement_omp_single *>::test (const_gimple gs)
1175 return gs->code == GIMPLE_OMP_SINGLE;
1178 template <>
1179 template <>
1180 inline bool
1181 is_a_helper <const gimple_statement_omp_teams *>::test (const_gimple gs)
1183 return gs->code == GIMPLE_OMP_TEAMS;
1186 template <>
1187 template <>
1188 inline bool
1189 is_a_helper <const gimple_statement_omp_task *>::test (const_gimple gs)
1191 return gs->code == GIMPLE_OMP_TASK;
1194 template <>
1195 template <>
1196 inline bool
1197 is_a_helper <const gimple_statement_phi *>::test (const_gimple gs)
1199 return gs->code == GIMPLE_PHI;
1202 template <>
1203 template <>
1204 inline bool
1205 is_a_helper <const gimple_statement_transaction *>::test (const_gimple gs)
1207 return gs->code == GIMPLE_TRANSACTION;
1210 /* Offset in bytes to the location of the operand vector.
1211 Zero if there is no operand vector for this tuple structure. */
1212 extern size_t const gimple_ops_offset_[];
1214 /* Map GIMPLE codes to GSS codes. */
1215 extern enum gimple_statement_structure_enum const gss_for_code_[];
1217 /* This variable holds the currently expanded gimple statement for purposes
1218 of comminucating the profile info to the builtin expanders. */
1219 extern gimple currently_expanding_gimple_stmt;
1221 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1222 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1223 gimple gimple_build_return (tree);
1224 void gimple_call_reset_alias_info (gimple);
1225 gimple gimple_build_call_vec (tree, vec<tree> );
1226 gimple gimple_build_call (tree, unsigned, ...);
1227 gimple gimple_build_call_valist (tree, unsigned, va_list);
1228 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1229 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1230 gimple gimple_build_call_from_tree (tree);
1231 gimple_assign gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1232 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1233 gimple_assign gimple_build_assign_with_ops (enum tree_code, tree,
1234 tree, tree,
1235 tree CXX_MEM_STAT_INFO);
1236 gimple_assign gimple_build_assign_with_ops (enum tree_code, tree,
1237 tree, tree CXX_MEM_STAT_INFO);
1238 gimple_cond gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1239 gimple_cond gimple_build_cond_from_tree (tree, tree, tree);
1240 void gimple_cond_set_condition_from_tree (gimple_cond, tree);
1241 gimple gimple_build_label (tree label);
1242 gimple gimple_build_goto (tree dest);
1243 gimple gimple_build_nop (void);
1244 gimple_bind gimple_build_bind (tree, gimple_seq, tree);
1245 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1246 vec<tree, va_gc> *, vec<tree, va_gc> *,
1247 vec<tree, va_gc> *);
1248 gimple gimple_build_catch (tree, gimple_seq);
1249 gimple gimple_build_eh_filter (tree, gimple_seq);
1250 gimple gimple_build_eh_must_not_throw (tree);
1251 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1252 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1253 enum gimple_try_flags);
1254 gimple gimple_build_wce (gimple_seq);
1255 gimple gimple_build_resx (int);
1256 gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
1257 gimple_switch gimple_build_switch (tree, tree, vec<tree> );
1258 gimple gimple_build_eh_dispatch (int);
1259 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1260 #define gimple_build_debug_bind(var,val,stmt) \
1261 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1262 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1263 #define gimple_build_debug_source_bind(var,val,stmt) \
1264 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1265 gimple gimple_build_omp_critical (gimple_seq, tree);
1266 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1267 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1268 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1269 gimple gimple_build_omp_section (gimple_seq);
1270 gimple gimple_build_omp_master (gimple_seq);
1271 gimple gimple_build_omp_taskgroup (gimple_seq);
1272 gimple gimple_build_omp_continue (tree, tree);
1273 gimple gimple_build_omp_ordered (gimple_seq);
1274 gimple gimple_build_omp_return (bool);
1275 gimple gimple_build_omp_sections (gimple_seq, tree);
1276 gimple gimple_build_omp_sections_switch (void);
1277 gimple gimple_build_omp_single (gimple_seq, tree);
1278 gimple gimple_build_omp_target (gimple_seq, int, tree);
1279 gimple gimple_build_omp_teams (gimple_seq, tree);
1280 gimple gimple_build_omp_atomic_load (tree, tree);
1281 gimple gimple_build_omp_atomic_store (tree);
1282 gimple gimple_build_transaction (gimple_seq, tree);
1283 gimple gimple_build_predict (enum br_predictor, enum prediction);
1284 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1285 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1286 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1287 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1288 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1289 location_t);
1290 extern void annotate_all_with_location (gimple_seq, location_t);
1291 bool empty_body_p (gimple_seq);
1292 gimple_seq gimple_seq_copy (gimple_seq);
1293 bool gimple_call_same_target_p (const_gimple, const_gimple);
1294 int gimple_call_flags (const_gimple);
1295 int gimple_call_arg_flags (const_gimple, unsigned);
1296 int gimple_call_return_flags (const_gimple);
1297 bool gimple_assign_copy_p (gimple);
1298 bool gimple_assign_ssa_name_copy_p (gimple);
1299 bool gimple_assign_unary_nop_p (gimple);
1300 void gimple_set_bb (gimple, basic_block);
1301 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1302 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1303 tree, tree, tree);
1304 tree gimple_get_lhs (const_gimple);
1305 void gimple_set_lhs (gimple, tree);
1306 gimple gimple_copy (gimple);
1307 bool gimple_has_side_effects (const_gimple);
1308 bool gimple_could_trap_p_1 (gimple, bool, bool);
1309 bool gimple_could_trap_p (gimple);
1310 bool gimple_assign_rhs_could_trap_p (gimple);
1311 extern void dump_gimple_statistics (void);
1312 unsigned get_gimple_rhs_num_ops (enum tree_code);
1313 extern tree canonicalize_cond_expr_cond (tree);
1314 gimple gimple_call_copy_skip_args (gimple, bitmap);
1315 extern bool gimple_compare_field_offset (tree, tree);
1316 extern tree gimple_unsigned_type (tree);
1317 extern tree gimple_signed_type (tree);
1318 extern alias_set_type gimple_get_alias_set (tree);
1319 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1320 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1321 extern bool gimple_call_builtin_p (const_gimple);
1322 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1323 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1324 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1325 extern void dump_decl_set (FILE *, bitmap);
1326 extern bool nonfreeing_call_p (gimple);
1327 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1328 extern void sort_case_labels (vec<tree> );
1329 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1330 extern void gimple_seq_set_location (gimple_seq , location_t);
1332 /* Formal (expression) temporary table handling: multiple occurrences of
1333 the same scalar expression are evaluated into the same temporary. */
1335 typedef struct gimple_temp_hash_elt
1337 tree val; /* Key */
1338 tree temp; /* Value */
1339 } elt_t;
1341 /* Get the number of the next statement uid to be allocated. */
1342 static inline unsigned int
1343 gimple_stmt_max_uid (struct function *fn)
1345 return fn->last_stmt_uid;
1348 /* Set the number of the next statement uid to be allocated. */
1349 static inline void
1350 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1352 fn->last_stmt_uid = maxid;
1355 /* Set the number of the next statement uid to be allocated. */
1356 static inline unsigned int
1357 inc_gimple_stmt_max_uid (struct function *fn)
1359 return fn->last_stmt_uid++;
1362 /* Return the first node in GIMPLE sequence S. */
1364 static inline gimple_seq_node
1365 gimple_seq_first (gimple_seq s)
1367 return s;
1371 /* Return the first statement in GIMPLE sequence S. */
1373 static inline gimple
1374 gimple_seq_first_stmt (gimple_seq s)
1376 gimple_seq_node n = gimple_seq_first (s);
1377 return n;
1380 /* Return the first statement in GIMPLE sequence S as a gimple_bind,
1381 verifying that it has code GIMPLE_BIND in a checked build. */
1383 static inline gimple_bind
1384 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1386 gimple_seq_node n = gimple_seq_first (s);
1387 return as_a <gimple_bind> (n);
1391 /* Return the last node in GIMPLE sequence S. */
1393 static inline gimple_seq_node
1394 gimple_seq_last (gimple_seq s)
1396 return s ? s->prev : NULL;
1400 /* Return the last statement in GIMPLE sequence S. */
1402 static inline gimple
1403 gimple_seq_last_stmt (gimple_seq s)
1405 gimple_seq_node n = gimple_seq_last (s);
1406 return n;
1410 /* Set the last node in GIMPLE sequence *PS to LAST. */
1412 static inline void
1413 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1415 (*ps)->prev = last;
1419 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1421 static inline void
1422 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1424 *ps = first;
1428 /* Return true if GIMPLE sequence S is empty. */
1430 static inline bool
1431 gimple_seq_empty_p (gimple_seq s)
1433 return s == NULL;
1436 /* Allocate a new sequence and initialize its first element with STMT. */
1438 static inline gimple_seq
1439 gimple_seq_alloc_with_stmt (gimple stmt)
1441 gimple_seq seq = NULL;
1442 gimple_seq_add_stmt (&seq, stmt);
1443 return seq;
1447 /* Returns the sequence of statements in BB. */
1449 static inline gimple_seq
1450 bb_seq (const_basic_block bb)
1452 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1455 static inline gimple_seq *
1456 bb_seq_addr (basic_block bb)
1458 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1461 /* Sets the sequence of statements in BB to SEQ. */
1463 static inline void
1464 set_bb_seq (basic_block bb, gimple_seq seq)
1466 gcc_checking_assert (!(bb->flags & BB_RTL));
1467 bb->il.gimple.seq = seq;
1471 /* Return the code for GIMPLE statement G. */
1473 static inline enum gimple_code
1474 gimple_code (const_gimple g)
1476 return g->code;
1480 /* Return the GSS code used by a GIMPLE code. */
1482 static inline enum gimple_statement_structure_enum
1483 gss_for_code (enum gimple_code code)
1485 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1486 return gss_for_code_[code];
1490 /* Return which GSS code is used by GS. */
1492 static inline enum gimple_statement_structure_enum
1493 gimple_statement_structure (gimple gs)
1495 return gss_for_code (gimple_code (gs));
1499 /* Return true if statement G has sub-statements. This is only true for
1500 High GIMPLE statements. */
1502 static inline bool
1503 gimple_has_substatements (gimple g)
1505 switch (gimple_code (g))
1507 case GIMPLE_BIND:
1508 case GIMPLE_CATCH:
1509 case GIMPLE_EH_FILTER:
1510 case GIMPLE_EH_ELSE:
1511 case GIMPLE_TRY:
1512 case GIMPLE_OMP_FOR:
1513 case GIMPLE_OMP_MASTER:
1514 case GIMPLE_OMP_TASKGROUP:
1515 case GIMPLE_OMP_ORDERED:
1516 case GIMPLE_OMP_SECTION:
1517 case GIMPLE_OMP_PARALLEL:
1518 case GIMPLE_OMP_TASK:
1519 case GIMPLE_OMP_SECTIONS:
1520 case GIMPLE_OMP_SINGLE:
1521 case GIMPLE_OMP_TARGET:
1522 case GIMPLE_OMP_TEAMS:
1523 case GIMPLE_OMP_CRITICAL:
1524 case GIMPLE_WITH_CLEANUP_EXPR:
1525 case GIMPLE_TRANSACTION:
1526 return true;
1528 default:
1529 return false;
1534 /* Return the basic block holding statement G. */
1536 static inline basic_block
1537 gimple_bb (const_gimple g)
1539 return g->bb;
1543 /* Return the lexical scope block holding statement G. */
1545 static inline tree
1546 gimple_block (const_gimple g)
1548 return LOCATION_BLOCK (g->location);
1552 /* Set BLOCK to be the lexical scope block holding statement G. */
1554 static inline void
1555 gimple_set_block (gimple g, tree block)
1557 if (block)
1558 g->location =
1559 COMBINE_LOCATION_DATA (line_table, g->location, block);
1560 else
1561 g->location = LOCATION_LOCUS (g->location);
1565 /* Return location information for statement G. */
1567 static inline location_t
1568 gimple_location (const_gimple g)
1570 return g->location;
1573 /* Return location information for statement G if g is not NULL.
1574 Otherwise, UNKNOWN_LOCATION is returned. */
1576 static inline location_t
1577 gimple_location_safe (const_gimple g)
1579 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1582 /* Return pointer to location information for statement G. */
1584 static inline const location_t *
1585 gimple_location_ptr (const_gimple g)
1587 return &g->location;
1591 /* Set location information for statement G. */
1593 static inline void
1594 gimple_set_location (gimple g, location_t location)
1596 g->location = location;
1600 /* Return true if G contains location information. */
1602 static inline bool
1603 gimple_has_location (const_gimple g)
1605 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1609 /* Return the file name of the location of STMT. */
1611 static inline const char *
1612 gimple_filename (const_gimple stmt)
1614 return LOCATION_FILE (gimple_location (stmt));
1618 /* Return the line number of the location of STMT. */
1620 static inline int
1621 gimple_lineno (const_gimple stmt)
1623 return LOCATION_LINE (gimple_location (stmt));
1627 /* Determine whether SEQ is a singleton. */
1629 static inline bool
1630 gimple_seq_singleton_p (gimple_seq seq)
1632 return ((gimple_seq_first (seq) != NULL)
1633 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1636 /* Return true if no warnings should be emitted for statement STMT. */
1638 static inline bool
1639 gimple_no_warning_p (const_gimple stmt)
1641 return stmt->no_warning;
1644 /* Set the no_warning flag of STMT to NO_WARNING. */
1646 static inline void
1647 gimple_set_no_warning (gimple stmt, bool no_warning)
1649 stmt->no_warning = (unsigned) no_warning;
1652 /* Set the visited status on statement STMT to VISITED_P. */
1654 static inline void
1655 gimple_set_visited (gimple stmt, bool visited_p)
1657 stmt->visited = (unsigned) visited_p;
1661 /* Return the visited status for statement STMT. */
1663 static inline bool
1664 gimple_visited_p (gimple stmt)
1666 return stmt->visited;
1670 /* Set pass local flag PLF on statement STMT to VAL_P. */
1672 static inline void
1673 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1675 if (val_p)
1676 stmt->plf |= (unsigned int) plf;
1677 else
1678 stmt->plf &= ~((unsigned int) plf);
1682 /* Return the value of pass local flag PLF on statement STMT. */
1684 static inline unsigned int
1685 gimple_plf (gimple stmt, enum plf_mask plf)
1687 return stmt->plf & ((unsigned int) plf);
1691 /* Set the UID of statement. */
1693 static inline void
1694 gimple_set_uid (gimple g, unsigned uid)
1696 g->uid = uid;
1700 /* Return the UID of statement. */
1702 static inline unsigned
1703 gimple_uid (const_gimple g)
1705 return g->uid;
1709 /* Make statement G a singleton sequence. */
1711 static inline void
1712 gimple_init_singleton (gimple g)
1714 g->next = NULL;
1715 g->prev = g;
1719 /* Return true if GIMPLE statement G has register or memory operands. */
1721 static inline bool
1722 gimple_has_ops (const_gimple g)
1724 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1727 template <>
1728 template <>
1729 inline bool
1730 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1732 return gimple_has_ops (gs);
1735 template <>
1736 template <>
1737 inline bool
1738 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1740 return gimple_has_ops (gs);
1743 /* Return true if GIMPLE statement G has memory operands. */
1745 static inline bool
1746 gimple_has_mem_ops (const_gimple g)
1748 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1751 template <>
1752 template <>
1753 inline bool
1754 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1756 return gimple_has_mem_ops (gs);
1759 template <>
1760 template <>
1761 inline bool
1762 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1764 return gimple_has_mem_ops (gs);
1767 /* Return the set of USE operands for statement G. */
1769 static inline struct use_optype_d *
1770 gimple_use_ops (const_gimple g)
1772 const gimple_statement_with_ops *ops_stmt =
1773 dyn_cast <const gimple_statement_with_ops *> (g);
1774 if (!ops_stmt)
1775 return NULL;
1776 return ops_stmt->use_ops;
1780 /* Set USE to be the set of USE operands for statement G. */
1782 static inline void
1783 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1785 gimple_statement_with_ops *ops_stmt =
1786 as_a <gimple_statement_with_ops *> (g);
1787 ops_stmt->use_ops = use;
1791 /* Return the single VUSE operand of the statement G. */
1793 static inline tree
1794 gimple_vuse (const_gimple g)
1796 const gimple_statement_with_memory_ops *mem_ops_stmt =
1797 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1798 if (!mem_ops_stmt)
1799 return NULL_TREE;
1800 return mem_ops_stmt->vuse;
1803 /* Return the single VDEF operand of the statement G. */
1805 static inline tree
1806 gimple_vdef (const_gimple g)
1808 const gimple_statement_with_memory_ops *mem_ops_stmt =
1809 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1810 if (!mem_ops_stmt)
1811 return NULL_TREE;
1812 return mem_ops_stmt->vdef;
1815 /* Return the single VUSE operand of the statement G. */
1817 static inline tree *
1818 gimple_vuse_ptr (gimple g)
1820 gimple_statement_with_memory_ops *mem_ops_stmt =
1821 dyn_cast <gimple_statement_with_memory_ops *> (g);
1822 if (!mem_ops_stmt)
1823 return NULL;
1824 return &mem_ops_stmt->vuse;
1827 /* Return the single VDEF operand of the statement G. */
1829 static inline tree *
1830 gimple_vdef_ptr (gimple g)
1832 gimple_statement_with_memory_ops *mem_ops_stmt =
1833 dyn_cast <gimple_statement_with_memory_ops *> (g);
1834 if (!mem_ops_stmt)
1835 return NULL;
1836 return &mem_ops_stmt->vdef;
1839 /* Set the single VUSE operand of the statement G. */
1841 static inline void
1842 gimple_set_vuse (gimple g, tree vuse)
1844 gimple_statement_with_memory_ops *mem_ops_stmt =
1845 as_a <gimple_statement_with_memory_ops *> (g);
1846 mem_ops_stmt->vuse = vuse;
1849 /* Set the single VDEF operand of the statement G. */
1851 static inline void
1852 gimple_set_vdef (gimple g, tree vdef)
1854 gimple_statement_with_memory_ops *mem_ops_stmt =
1855 as_a <gimple_statement_with_memory_ops *> (g);
1856 mem_ops_stmt->vdef = vdef;
1860 /* Return true if statement G has operands and the modified field has
1861 been set. */
1863 static inline bool
1864 gimple_modified_p (const_gimple g)
1866 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1870 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1871 a MODIFIED field. */
1873 static inline void
1874 gimple_set_modified (gimple s, bool modifiedp)
1876 if (gimple_has_ops (s))
1877 s->modified = (unsigned) modifiedp;
1881 /* Return the tree code for the expression computed by STMT. This is
1882 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1883 GIMPLE_CALL, return CALL_EXPR as the expression code for
1884 consistency. This is useful when the caller needs to deal with the
1885 three kinds of computation that GIMPLE supports. */
1887 static inline enum tree_code
1888 gimple_expr_code (const_gimple stmt)
1890 enum gimple_code code = gimple_code (stmt);
1891 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1892 return (enum tree_code) stmt->subcode;
1893 else
1895 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1896 return CALL_EXPR;
1901 /* Return true if statement STMT contains volatile operands. */
1903 static inline bool
1904 gimple_has_volatile_ops (const_gimple stmt)
1906 if (gimple_has_mem_ops (stmt))
1907 return stmt->has_volatile_ops;
1908 else
1909 return false;
1913 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1915 static inline void
1916 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1918 if (gimple_has_mem_ops (stmt))
1919 stmt->has_volatile_ops = (unsigned) volatilep;
1922 /* Return true if STMT is in a transaction. */
1924 static inline bool
1925 gimple_in_transaction (gimple stmt)
1927 return bb_in_transaction (gimple_bb (stmt));
1930 /* Return true if statement STMT may access memory. */
1932 static inline bool
1933 gimple_references_memory_p (gimple stmt)
1935 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1939 /* Return the subcode for OMP statement S. */
1941 static inline unsigned
1942 gimple_omp_subcode (const_gimple s)
1944 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1945 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1946 return s->subcode;
1949 /* Set the subcode for OMP statement S to SUBCODE. */
1951 static inline void
1952 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1954 /* We only have 16 bits for the subcode. Assert that we are not
1955 overflowing it. */
1956 gcc_gimple_checking_assert (subcode < (1 << 16));
1957 s->subcode = subcode;
1960 /* Set the nowait flag on OMP_RETURN statement S. */
1962 static inline void
1963 gimple_omp_return_set_nowait (gimple s)
1965 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1966 s->subcode |= GF_OMP_RETURN_NOWAIT;
1970 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1971 flag set. */
1973 static inline bool
1974 gimple_omp_return_nowait_p (const_gimple g)
1976 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1977 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1981 /* Set the LHS of OMP return. */
1983 static inline void
1984 gimple_omp_return_set_lhs (gimple g, tree lhs)
1986 gimple_statement_omp_return *omp_return_stmt =
1987 as_a <gimple_statement_omp_return *> (g);
1988 omp_return_stmt->val = lhs;
1992 /* Get the LHS of OMP return. */
1994 static inline tree
1995 gimple_omp_return_lhs (const_gimple g)
1997 const gimple_statement_omp_return *omp_return_stmt =
1998 as_a <const gimple_statement_omp_return *> (g);
1999 return omp_return_stmt->val;
2003 /* Return a pointer to the LHS of OMP return. */
2005 static inline tree *
2006 gimple_omp_return_lhs_ptr (gimple g)
2008 gimple_statement_omp_return *omp_return_stmt =
2009 as_a <gimple_statement_omp_return *> (g);
2010 return &omp_return_stmt->val;
2014 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2015 flag set. */
2017 static inline bool
2018 gimple_omp_section_last_p (const_gimple g)
2020 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2021 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2025 /* Set the GF_OMP_SECTION_LAST flag on G. */
2027 static inline void
2028 gimple_omp_section_set_last (gimple g)
2030 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2031 g->subcode |= GF_OMP_SECTION_LAST;
2035 /* Return true if OMP parallel statement G has the
2036 GF_OMP_PARALLEL_COMBINED flag set. */
2038 static inline bool
2039 gimple_omp_parallel_combined_p (const_gimple g)
2041 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2042 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2046 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2047 value of COMBINED_P. */
2049 static inline void
2050 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2052 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2053 if (combined_p)
2054 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2055 else
2056 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2060 /* Return true if OMP atomic load/store statement G has the
2061 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2063 static inline bool
2064 gimple_omp_atomic_need_value_p (const_gimple g)
2066 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2067 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2068 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2072 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2074 static inline void
2075 gimple_omp_atomic_set_need_value (gimple g)
2077 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2078 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2079 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2083 /* Return true if OMP atomic load/store statement G has the
2084 GF_OMP_ATOMIC_SEQ_CST flag set. */
2086 static inline bool
2087 gimple_omp_atomic_seq_cst_p (const_gimple g)
2089 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2090 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2091 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2095 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2097 static inline void
2098 gimple_omp_atomic_set_seq_cst (gimple g)
2100 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2101 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2102 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2106 /* Return the number of operands for statement GS. */
2108 static inline unsigned
2109 gimple_num_ops (const_gimple gs)
2111 return gs->num_ops;
2115 /* Set the number of operands for statement GS. */
2117 static inline void
2118 gimple_set_num_ops (gimple gs, unsigned num_ops)
2120 gs->num_ops = num_ops;
2124 /* Return the array of operands for statement GS. */
2126 static inline tree *
2127 gimple_ops (gimple gs)
2129 size_t off;
2131 /* All the tuples have their operand vector at the very bottom
2132 of the structure. Note that those structures that do not
2133 have an operand vector have a zero offset. */
2134 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2135 gcc_gimple_checking_assert (off != 0);
2137 return (tree *) ((char *) gs + off);
2141 /* Return operand I for statement GS. */
2143 static inline tree
2144 gimple_op (const_gimple gs, unsigned i)
2146 if (gimple_has_ops (gs))
2148 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2149 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2151 else
2152 return NULL_TREE;
2155 /* Return a pointer to operand I for statement GS. */
2157 static inline tree *
2158 gimple_op_ptr (const_gimple gs, unsigned i)
2160 if (gimple_has_ops (gs))
2162 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2163 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2165 else
2166 return NULL;
2169 /* Set operand I of statement GS to OP. */
2171 static inline void
2172 gimple_set_op (gimple gs, unsigned i, tree op)
2174 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2176 /* Note. It may be tempting to assert that OP matches
2177 is_gimple_operand, but that would be wrong. Different tuples
2178 accept slightly different sets of tree operands. Each caller
2179 should perform its own validation. */
2180 gimple_ops (gs)[i] = op;
2183 /* Return true if GS is a GIMPLE_ASSIGN. */
2185 static inline bool
2186 is_gimple_assign (const_gimple gs)
2188 return gimple_code (gs) == GIMPLE_ASSIGN;
2191 /* Determine if expression CODE is one of the valid expressions that can
2192 be used on the RHS of GIMPLE assignments. */
2194 static inline enum gimple_rhs_class
2195 get_gimple_rhs_class (enum tree_code code)
2197 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2200 /* Return the LHS of assignment statement GS. */
2202 static inline tree
2203 gimple_assign_lhs (const_gimple gs)
2205 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2206 return gimple_op (gs, 0);
2210 /* Return a pointer to the LHS of assignment statement GS. */
2212 static inline tree *
2213 gimple_assign_lhs_ptr (const_gimple gs)
2215 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2216 return gimple_op_ptr (gs, 0);
2220 /* Set LHS to be the LHS operand of assignment statement GS. */
2222 static inline void
2223 gimple_assign_set_lhs (gimple gs, tree lhs)
2225 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2226 gimple_set_op (gs, 0, lhs);
2228 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2229 SSA_NAME_DEF_STMT (lhs) = gs;
2233 /* Return the first operand on the RHS of assignment statement GS. */
2235 static inline tree
2236 gimple_assign_rhs1 (const_gimple gs)
2238 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2239 return gimple_op (gs, 1);
2243 /* Return a pointer to the first operand on the RHS of assignment
2244 statement GS. */
2246 static inline tree *
2247 gimple_assign_rhs1_ptr (const_gimple gs)
2249 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2250 return gimple_op_ptr (gs, 1);
2253 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2255 static inline void
2256 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2258 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2260 gimple_set_op (gs, 1, rhs);
2264 /* Return the second operand on the RHS of assignment statement GS.
2265 If GS does not have two operands, NULL is returned instead. */
2267 static inline tree
2268 gimple_assign_rhs2 (const_gimple gs)
2270 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2272 if (gimple_num_ops (gs) >= 3)
2273 return gimple_op (gs, 2);
2274 else
2275 return NULL_TREE;
2279 /* Return a pointer to the second operand on the RHS of assignment
2280 statement GS. */
2282 static inline tree *
2283 gimple_assign_rhs2_ptr (const_gimple gs)
2285 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2286 return gimple_op_ptr (gs, 2);
2290 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2292 static inline void
2293 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2295 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2297 gimple_set_op (gs, 2, rhs);
2300 /* Return the third operand on the RHS of assignment statement GS.
2301 If GS does not have two operands, NULL is returned instead. */
2303 static inline tree
2304 gimple_assign_rhs3 (const_gimple gs)
2306 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2308 if (gimple_num_ops (gs) >= 4)
2309 return gimple_op (gs, 3);
2310 else
2311 return NULL_TREE;
2314 /* Return a pointer to the third operand on the RHS of assignment
2315 statement GS. */
2317 static inline tree *
2318 gimple_assign_rhs3_ptr (const_gimple gs)
2320 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2321 return gimple_op_ptr (gs, 3);
2325 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2327 static inline void
2328 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2330 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2332 gimple_set_op (gs, 3, rhs);
2335 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2336 to see only a maximum of two operands. */
2338 static inline void
2339 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2340 tree op1, tree op2)
2342 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2345 /* Returns true if GS is a nontemporal move. */
2347 static inline bool
2348 gimple_assign_nontemporal_move_p (const_gimple gs)
2350 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2351 return gs->nontemporal_move;
2354 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2356 static inline void
2357 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2359 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2360 gs->nontemporal_move = nontemporal;
2364 /* Return the code of the expression computed on the rhs of assignment
2365 statement GS. In case that the RHS is a single object, returns the
2366 tree code of the object. */
2368 static inline enum tree_code
2369 gimple_assign_rhs_code (const_gimple gs)
2371 enum tree_code code;
2372 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2374 code = (enum tree_code) gs->subcode;
2375 /* While we initially set subcode to the TREE_CODE of the rhs for
2376 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2377 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2378 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2379 code = TREE_CODE (gimple_assign_rhs1 (gs));
2381 return code;
2385 /* Set CODE to be the code for the expression computed on the RHS of
2386 assignment S. */
2388 static inline void
2389 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2391 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2392 s->subcode = code;
2396 /* Return the gimple rhs class of the code of the expression computed on
2397 the rhs of assignment statement GS.
2398 This will never return GIMPLE_INVALID_RHS. */
2400 static inline enum gimple_rhs_class
2401 gimple_assign_rhs_class (const_gimple gs)
2403 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2406 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2407 there is no operator associated with the assignment itself.
2408 Unlike gimple_assign_copy_p, this predicate returns true for
2409 any RHS operand, including those that perform an operation
2410 and do not have the semantics of a copy, such as COND_EXPR. */
2412 static inline bool
2413 gimple_assign_single_p (const_gimple gs)
2415 return (is_gimple_assign (gs)
2416 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2419 /* Return true if GS performs a store to its lhs. */
2421 static inline bool
2422 gimple_store_p (const_gimple gs)
2424 tree lhs = gimple_get_lhs (gs);
2425 return lhs && !is_gimple_reg (lhs);
2428 /* Return true if GS is an assignment that loads from its rhs1. */
2430 static inline bool
2431 gimple_assign_load_p (const_gimple gs)
2433 tree rhs;
2434 if (!gimple_assign_single_p (gs))
2435 return false;
2436 rhs = gimple_assign_rhs1 (gs);
2437 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2438 return true;
2439 rhs = get_base_address (rhs);
2440 return (DECL_P (rhs)
2441 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2445 /* Return true if S is a type-cast assignment. */
2447 static inline bool
2448 gimple_assign_cast_p (const_gimple s)
2450 if (is_gimple_assign (s))
2452 enum tree_code sc = gimple_assign_rhs_code (s);
2453 return CONVERT_EXPR_CODE_P (sc)
2454 || sc == VIEW_CONVERT_EXPR
2455 || sc == FIX_TRUNC_EXPR;
2458 return false;
2461 /* Return true if S is a clobber statement. */
2463 static inline bool
2464 gimple_clobber_p (const_gimple s)
2466 return gimple_assign_single_p (s)
2467 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2470 /* Return true if GS is a GIMPLE_CALL. */
2472 static inline bool
2473 is_gimple_call (const_gimple gs)
2475 return gimple_code (gs) == GIMPLE_CALL;
2478 /* Return the LHS of call statement GS. */
2480 static inline tree
2481 gimple_call_lhs (const_gimple gs)
2483 GIMPLE_CHECK (gs, GIMPLE_CALL);
2484 return gimple_op (gs, 0);
2488 /* Return a pointer to the LHS of call statement GS. */
2490 static inline tree *
2491 gimple_call_lhs_ptr (const_gimple gs)
2493 GIMPLE_CHECK (gs, GIMPLE_CALL);
2494 return gimple_op_ptr (gs, 0);
2498 /* Set LHS to be the LHS operand of call statement GS. */
2500 static inline void
2501 gimple_call_set_lhs (gimple gs, tree lhs)
2503 GIMPLE_CHECK (gs, GIMPLE_CALL);
2504 gimple_set_op (gs, 0, lhs);
2505 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2506 SSA_NAME_DEF_STMT (lhs) = gs;
2510 /* Return true if call GS calls an internal-only function, as enumerated
2511 by internal_fn. */
2513 static inline bool
2514 gimple_call_internal_p (const_gimple gs)
2516 GIMPLE_CHECK (gs, GIMPLE_CALL);
2517 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2521 /* Return the target of internal call GS. */
2523 static inline enum internal_fn
2524 gimple_call_internal_fn (const_gimple gs)
2526 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2527 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2530 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2531 that could alter control flow. */
2533 static inline void
2534 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2536 GIMPLE_CHECK (s, GIMPLE_CALL);
2537 if (ctrl_altering_p)
2538 s->subcode |= GF_CALL_CTRL_ALTERING;
2539 else
2540 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2543 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2544 flag is set. Such call could not be a stmt in the middle of a bb. */
2546 static inline bool
2547 gimple_call_ctrl_altering_p (const_gimple gs)
2549 GIMPLE_CHECK (gs, GIMPLE_CALL);
2550 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2554 /* Return the function type of the function called by GS. */
2556 static inline tree
2557 gimple_call_fntype (const_gimple gs)
2559 const gimple_statement_call *call_stmt =
2560 as_a <const gimple_statement_call *> (gs);
2561 if (gimple_call_internal_p (gs))
2562 return NULL_TREE;
2563 return call_stmt->u.fntype;
2566 /* Set the type of the function called by GS to FNTYPE. */
2568 static inline void
2569 gimple_call_set_fntype (gimple gs, tree fntype)
2571 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2572 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2573 call_stmt->u.fntype = fntype;
2577 /* Return the tree node representing the function called by call
2578 statement GS. */
2580 static inline tree
2581 gimple_call_fn (const_gimple gs)
2583 GIMPLE_CHECK (gs, GIMPLE_CALL);
2584 return gimple_op (gs, 1);
2587 /* Return a pointer to the tree node representing the function called by call
2588 statement GS. */
2590 static inline tree *
2591 gimple_call_fn_ptr (const_gimple gs)
2593 GIMPLE_CHECK (gs, GIMPLE_CALL);
2594 return gimple_op_ptr (gs, 1);
2598 /* Set FN to be the function called by call statement GS. */
2600 static inline void
2601 gimple_call_set_fn (gimple gs, tree fn)
2603 GIMPLE_CHECK (gs, GIMPLE_CALL);
2604 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2605 gimple_set_op (gs, 1, fn);
2609 /* Set FNDECL to be the function called by call statement GS. */
2611 static inline void
2612 gimple_call_set_fndecl (gimple gs, tree decl)
2614 GIMPLE_CHECK (gs, GIMPLE_CALL);
2615 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2616 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2620 /* Set internal function FN to be the function called by call statement GS. */
2622 static inline void
2623 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2625 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2626 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2627 call_stmt->u.internal_fn = fn;
2631 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2632 Otherwise return NULL. This function is analogous to
2633 get_callee_fndecl in tree land. */
2635 static inline tree
2636 gimple_call_fndecl (const_gimple gs)
2638 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2642 /* Return the type returned by call statement GS. */
2644 static inline tree
2645 gimple_call_return_type (const_gimple gs)
2647 tree type = gimple_call_fntype (gs);
2649 if (type == NULL_TREE)
2650 return TREE_TYPE (gimple_call_lhs (gs));
2652 /* The type returned by a function is the type of its
2653 function type. */
2654 return TREE_TYPE (type);
2658 /* Return the static chain for call statement GS. */
2660 static inline tree
2661 gimple_call_chain (const_gimple gs)
2663 GIMPLE_CHECK (gs, GIMPLE_CALL);
2664 return gimple_op (gs, 2);
2668 /* Return a pointer to the static chain for call statement GS. */
2670 static inline tree *
2671 gimple_call_chain_ptr (const_gimple gs)
2673 GIMPLE_CHECK (gs, GIMPLE_CALL);
2674 return gimple_op_ptr (gs, 2);
2677 /* Set CHAIN to be the static chain for call statement GS. */
2679 static inline void
2680 gimple_call_set_chain (gimple gs, tree chain)
2682 GIMPLE_CHECK (gs, GIMPLE_CALL);
2684 gimple_set_op (gs, 2, chain);
2688 /* Return the number of arguments used by call statement GS. */
2690 static inline unsigned
2691 gimple_call_num_args (const_gimple gs)
2693 unsigned num_ops;
2694 GIMPLE_CHECK (gs, GIMPLE_CALL);
2695 num_ops = gimple_num_ops (gs);
2696 return num_ops - 3;
2700 /* Return the argument at position INDEX for call statement GS. */
2702 static inline tree
2703 gimple_call_arg (const_gimple gs, unsigned index)
2705 GIMPLE_CHECK (gs, GIMPLE_CALL);
2706 return gimple_op (gs, index + 3);
2710 /* Return a pointer to the argument at position INDEX for call
2711 statement GS. */
2713 static inline tree *
2714 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2716 GIMPLE_CHECK (gs, GIMPLE_CALL);
2717 return gimple_op_ptr (gs, index + 3);
2721 /* Set ARG to be the argument at position INDEX for call statement GS. */
2723 static inline void
2724 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2726 GIMPLE_CHECK (gs, GIMPLE_CALL);
2727 gimple_set_op (gs, index + 3, arg);
2731 /* If TAIL_P is true, mark call statement S as being a tail call
2732 (i.e., a call just before the exit of a function). These calls are
2733 candidate for tail call optimization. */
2735 static inline void
2736 gimple_call_set_tail (gimple s, bool tail_p)
2738 GIMPLE_CHECK (s, GIMPLE_CALL);
2739 if (tail_p)
2740 s->subcode |= GF_CALL_TAILCALL;
2741 else
2742 s->subcode &= ~GF_CALL_TAILCALL;
2746 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2748 static inline bool
2749 gimple_call_tail_p (gimple s)
2751 GIMPLE_CHECK (s, GIMPLE_CALL);
2752 return (s->subcode & GF_CALL_TAILCALL) != 0;
2756 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2757 slot optimization. This transformation uses the target of the call
2758 expansion as the return slot for calls that return in memory. */
2760 static inline void
2761 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2763 GIMPLE_CHECK (s, GIMPLE_CALL);
2764 if (return_slot_opt_p)
2765 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2766 else
2767 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2771 /* Return true if S is marked for return slot optimization. */
2773 static inline bool
2774 gimple_call_return_slot_opt_p (gimple s)
2776 GIMPLE_CHECK (s, GIMPLE_CALL);
2777 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2781 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2782 thunk to the thunked-to function. */
2784 static inline void
2785 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2787 GIMPLE_CHECK (s, GIMPLE_CALL);
2788 if (from_thunk_p)
2789 s->subcode |= GF_CALL_FROM_THUNK;
2790 else
2791 s->subcode &= ~GF_CALL_FROM_THUNK;
2795 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2797 static inline bool
2798 gimple_call_from_thunk_p (gimple s)
2800 GIMPLE_CHECK (s, GIMPLE_CALL);
2801 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2805 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2806 argument pack in its argument list. */
2808 static inline void
2809 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2811 GIMPLE_CHECK (s, GIMPLE_CALL);
2812 if (pass_arg_pack_p)
2813 s->subcode |= GF_CALL_VA_ARG_PACK;
2814 else
2815 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2819 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2820 argument pack in its argument list. */
2822 static inline bool
2823 gimple_call_va_arg_pack_p (gimple s)
2825 GIMPLE_CHECK (s, GIMPLE_CALL);
2826 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2830 /* Return true if S is a noreturn call. */
2832 static inline bool
2833 gimple_call_noreturn_p (gimple s)
2835 GIMPLE_CHECK (s, GIMPLE_CALL);
2836 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2840 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2841 even if the called function can throw in other cases. */
2843 static inline void
2844 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2846 GIMPLE_CHECK (s, GIMPLE_CALL);
2847 if (nothrow_p)
2848 s->subcode |= GF_CALL_NOTHROW;
2849 else
2850 s->subcode &= ~GF_CALL_NOTHROW;
2853 /* Return true if S is a nothrow call. */
2855 static inline bool
2856 gimple_call_nothrow_p (gimple s)
2858 GIMPLE_CHECK (s, GIMPLE_CALL);
2859 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2862 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2863 is known to be emitted for VLA objects. Those are wrapped by
2864 stack_save/stack_restore calls and hence can't lead to unbounded
2865 stack growth even when they occur in loops. */
2867 static inline void
2868 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2870 GIMPLE_CHECK (s, GIMPLE_CALL);
2871 if (for_var)
2872 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2873 else
2874 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2877 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2879 static inline bool
2880 gimple_call_alloca_for_var_p (gimple s)
2882 GIMPLE_CHECK (s, GIMPLE_CALL);
2883 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2886 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2888 static inline void
2889 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2891 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2892 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2893 dest_call->subcode = orig_call->subcode;
2897 /* Return a pointer to the points-to solution for the set of call-used
2898 variables of the call CALL. */
2900 static inline struct pt_solution *
2901 gimple_call_use_set (gimple call)
2903 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2904 return &call_stmt->call_used;
2908 /* Return a pointer to the points-to solution for the set of call-used
2909 variables of the call CALL. */
2911 static inline struct pt_solution *
2912 gimple_call_clobber_set (gimple call)
2914 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2915 return &call_stmt->call_clobbered;
2919 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2920 non-NULL lhs. */
2922 static inline bool
2923 gimple_has_lhs (gimple stmt)
2925 return (is_gimple_assign (stmt)
2926 || (is_gimple_call (stmt)
2927 && gimple_call_lhs (stmt) != NULL_TREE));
2931 /* Return the code of the predicate computed by conditional statement GS. */
2933 static inline enum tree_code
2934 gimple_cond_code (const_gimple gs)
2936 GIMPLE_CHECK (gs, GIMPLE_COND);
2937 return (enum tree_code) gs->subcode;
2941 /* Set CODE to be the predicate code for the conditional statement GS. */
2943 static inline void
2944 gimple_cond_set_code (gimple gs, enum tree_code code)
2946 GIMPLE_CHECK (gs, GIMPLE_COND);
2947 gs->subcode = code;
2951 /* Return the LHS of the predicate computed by conditional statement GS. */
2953 static inline tree
2954 gimple_cond_lhs (const_gimple gs)
2956 GIMPLE_CHECK (gs, GIMPLE_COND);
2957 return gimple_op (gs, 0);
2960 /* Return the pointer to the LHS of the predicate computed by conditional
2961 statement GS. */
2963 static inline tree *
2964 gimple_cond_lhs_ptr (const_gimple gs)
2966 GIMPLE_CHECK (gs, GIMPLE_COND);
2967 return gimple_op_ptr (gs, 0);
2970 /* Set LHS to be the LHS operand of the predicate computed by
2971 conditional statement GS. */
2973 static inline void
2974 gimple_cond_set_lhs (gimple gs, tree lhs)
2976 GIMPLE_CHECK (gs, GIMPLE_COND);
2977 gimple_set_op (gs, 0, lhs);
2981 /* Return the RHS operand of the predicate computed by conditional GS. */
2983 static inline tree
2984 gimple_cond_rhs (const_gimple gs)
2986 GIMPLE_CHECK (gs, GIMPLE_COND);
2987 return gimple_op (gs, 1);
2990 /* Return the pointer to the RHS operand of the predicate computed by
2991 conditional GS. */
2993 static inline tree *
2994 gimple_cond_rhs_ptr (const_gimple gs)
2996 GIMPLE_CHECK (gs, GIMPLE_COND);
2997 return gimple_op_ptr (gs, 1);
3001 /* Set RHS to be the RHS operand of the predicate computed by
3002 conditional statement GS. */
3004 static inline void
3005 gimple_cond_set_rhs (gimple gs, tree rhs)
3007 GIMPLE_CHECK (gs, GIMPLE_COND);
3008 gimple_set_op (gs, 1, rhs);
3012 /* Return the label used by conditional statement GS when its
3013 predicate evaluates to true. */
3015 static inline tree
3016 gimple_cond_true_label (const_gimple gs)
3018 GIMPLE_CHECK (gs, GIMPLE_COND);
3019 return gimple_op (gs, 2);
3023 /* Set LABEL to be the label used by conditional statement GS when its
3024 predicate evaluates to true. */
3026 static inline void
3027 gimple_cond_set_true_label (gimple gs, tree label)
3029 GIMPLE_CHECK (gs, GIMPLE_COND);
3030 gimple_set_op (gs, 2, label);
3034 /* Set LABEL to be the label used by conditional statement GS when its
3035 predicate evaluates to false. */
3037 static inline void
3038 gimple_cond_set_false_label (gimple gs, tree label)
3040 GIMPLE_CHECK (gs, GIMPLE_COND);
3041 gimple_set_op (gs, 3, label);
3045 /* Return the label used by conditional statement GS when its
3046 predicate evaluates to false. */
3048 static inline tree
3049 gimple_cond_false_label (const_gimple gs)
3051 GIMPLE_CHECK (gs, GIMPLE_COND);
3052 return gimple_op (gs, 3);
3056 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3058 static inline void
3059 gimple_cond_make_false (gimple gs)
3061 gimple_cond_set_lhs (gs, boolean_true_node);
3062 gimple_cond_set_rhs (gs, boolean_false_node);
3063 gs->subcode = EQ_EXPR;
3067 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3069 static inline void
3070 gimple_cond_make_true (gimple gs)
3072 gimple_cond_set_lhs (gs, boolean_true_node);
3073 gimple_cond_set_rhs (gs, boolean_true_node);
3074 gs->subcode = EQ_EXPR;
3077 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3078 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3080 static inline bool
3081 gimple_cond_true_p (const_gimple_cond gs)
3083 tree lhs = gimple_cond_lhs (gs);
3084 tree rhs = gimple_cond_rhs (gs);
3085 enum tree_code code = gimple_cond_code (gs);
3087 if (lhs != boolean_true_node && lhs != boolean_false_node)
3088 return false;
3090 if (rhs != boolean_true_node && rhs != boolean_false_node)
3091 return false;
3093 if (code == NE_EXPR && lhs != rhs)
3094 return true;
3096 if (code == EQ_EXPR && lhs == rhs)
3097 return true;
3099 return false;
3102 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3103 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3105 static inline bool
3106 gimple_cond_false_p (const_gimple_cond gs)
3108 tree lhs = gimple_cond_lhs (gs);
3109 tree rhs = gimple_cond_rhs (gs);
3110 enum tree_code code = gimple_cond_code (gs);
3112 if (lhs != boolean_true_node && lhs != boolean_false_node)
3113 return false;
3115 if (rhs != boolean_true_node && rhs != boolean_false_node)
3116 return false;
3118 if (code == NE_EXPR && lhs == rhs)
3119 return true;
3121 if (code == EQ_EXPR && lhs != rhs)
3122 return true;
3124 return false;
3127 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3129 static inline void
3130 gimple_cond_set_condition (gimple_cond stmt, enum tree_code code, tree lhs,
3131 tree rhs)
3133 gimple_cond_set_code (stmt, code);
3134 gimple_cond_set_lhs (stmt, lhs);
3135 gimple_cond_set_rhs (stmt, rhs);
3138 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3140 static inline tree
3141 gimple_label_label (const_gimple gs)
3143 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3144 return gimple_op (gs, 0);
3148 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3149 GS. */
3151 static inline void
3152 gimple_label_set_label (gimple gs, tree label)
3154 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3155 gimple_set_op (gs, 0, label);
3159 /* Return the destination of the unconditional jump GS. */
3161 static inline tree
3162 gimple_goto_dest (const_gimple gs)
3164 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3165 return gimple_op (gs, 0);
3169 /* Set DEST to be the destination of the unconditonal jump GS. */
3171 static inline void
3172 gimple_goto_set_dest (gimple gs, tree dest)
3174 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3175 gimple_set_op (gs, 0, dest);
3179 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3181 static inline tree
3182 gimple_bind_vars (const_gimple_bind bind_stmt)
3184 return bind_stmt->vars;
3188 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3189 statement GS. */
3191 static inline void
3192 gimple_bind_set_vars (gimple_bind bind_stmt, tree vars)
3194 bind_stmt->vars = vars;
3198 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3199 statement GS. */
3201 static inline void
3202 gimple_bind_append_vars (gimple_bind bind_stmt, tree vars)
3204 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3208 static inline gimple_seq *
3209 gimple_bind_body_ptr (gimple_bind bind_stmt)
3211 return &bind_stmt->body;
3214 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3216 static inline gimple_seq
3217 gimple_bind_body (gimple_bind gs)
3219 return *gimple_bind_body_ptr (gs);
3223 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3224 statement GS. */
3226 static inline void
3227 gimple_bind_set_body (gimple_bind bind_stmt, gimple_seq seq)
3229 bind_stmt->body = seq;
3233 /* Append a statement to the end of a GIMPLE_BIND's body. */
3235 static inline void
3236 gimple_bind_add_stmt (gimple_bind bind_stmt, gimple stmt)
3238 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3242 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3244 static inline void
3245 gimple_bind_add_seq (gimple_bind bind_stmt, gimple_seq seq)
3247 gimple_seq_add_seq (&bind_stmt->body, seq);
3251 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3252 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3254 static inline tree
3255 gimple_bind_block (const_gimple_bind bind_stmt)
3257 return bind_stmt->block;
3261 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3262 statement GS. */
3264 static inline void
3265 gimple_bind_set_block (gimple_bind bind_stmt, tree block)
3267 gcc_gimple_checking_assert (block == NULL_TREE
3268 || TREE_CODE (block) == BLOCK);
3269 bind_stmt->block = block;
3273 /* Return the number of input operands for GIMPLE_ASM GS. */
3275 static inline unsigned
3276 gimple_asm_ninputs (const_gimple gs)
3278 const gimple_statement_asm *asm_stmt =
3279 as_a <const gimple_statement_asm *> (gs);
3280 return asm_stmt->ni;
3284 /* Return the number of output operands for GIMPLE_ASM GS. */
3286 static inline unsigned
3287 gimple_asm_noutputs (const_gimple gs)
3289 const gimple_statement_asm *asm_stmt =
3290 as_a <const gimple_statement_asm *> (gs);
3291 return asm_stmt->no;
3295 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3297 static inline unsigned
3298 gimple_asm_nclobbers (const_gimple gs)
3300 const gimple_statement_asm *asm_stmt =
3301 as_a <const gimple_statement_asm *> (gs);
3302 return asm_stmt->nc;
3305 /* Return the number of label operands for GIMPLE_ASM GS. */
3307 static inline unsigned
3308 gimple_asm_nlabels (const_gimple gs)
3310 const gimple_statement_asm *asm_stmt =
3311 as_a <const gimple_statement_asm *> (gs);
3312 return asm_stmt->nl;
3315 /* Return input operand INDEX of GIMPLE_ASM GS. */
3317 static inline tree
3318 gimple_asm_input_op (const_gimple gs, unsigned index)
3320 const gimple_statement_asm *asm_stmt =
3321 as_a <const gimple_statement_asm *> (gs);
3322 gcc_gimple_checking_assert (index < asm_stmt->ni);
3323 return gimple_op (gs, index + asm_stmt->no);
3326 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3328 static inline tree *
3329 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3331 const gimple_statement_asm *asm_stmt =
3332 as_a <const gimple_statement_asm *> (gs);
3333 gcc_gimple_checking_assert (index < asm_stmt->ni);
3334 return gimple_op_ptr (gs, index + asm_stmt->no);
3338 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3340 static inline void
3341 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3343 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3344 gcc_gimple_checking_assert (index < asm_stmt->ni
3345 && TREE_CODE (in_op) == TREE_LIST);
3346 gimple_set_op (gs, index + asm_stmt->no, in_op);
3350 /* Return output operand INDEX of GIMPLE_ASM GS. */
3352 static inline tree
3353 gimple_asm_output_op (const_gimple gs, unsigned index)
3355 const gimple_statement_asm *asm_stmt =
3356 as_a <const gimple_statement_asm *> (gs);
3357 gcc_gimple_checking_assert (index < asm_stmt->no);
3358 return gimple_op (gs, index);
3361 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3363 static inline tree *
3364 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3366 const gimple_statement_asm *asm_stmt =
3367 as_a <const gimple_statement_asm *> (gs);
3368 gcc_gimple_checking_assert (index < asm_stmt->no);
3369 return gimple_op_ptr (gs, index);
3373 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3375 static inline void
3376 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3378 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3379 gcc_gimple_checking_assert (index < asm_stmt->no
3380 && TREE_CODE (out_op) == TREE_LIST);
3381 gimple_set_op (gs, index, out_op);
3385 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3387 static inline tree
3388 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3390 const gimple_statement_asm *asm_stmt =
3391 as_a <const gimple_statement_asm *> (gs);
3392 gcc_gimple_checking_assert (index < asm_stmt->nc);
3393 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3397 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3399 static inline void
3400 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3402 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3403 gcc_gimple_checking_assert (index < asm_stmt->nc
3404 && TREE_CODE (clobber_op) == TREE_LIST);
3405 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3408 /* Return label operand INDEX of GIMPLE_ASM GS. */
3410 static inline tree
3411 gimple_asm_label_op (const_gimple gs, unsigned index)
3413 const gimple_statement_asm *asm_stmt =
3414 as_a <const gimple_statement_asm *> (gs);
3415 gcc_gimple_checking_assert (index < asm_stmt->nl);
3416 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3419 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3421 static inline void
3422 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3424 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3425 gcc_gimple_checking_assert (index < asm_stmt->nl
3426 && TREE_CODE (label_op) == TREE_LIST);
3427 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3430 /* Return the string representing the assembly instruction in
3431 GIMPLE_ASM GS. */
3433 static inline const char *
3434 gimple_asm_string (const_gimple gs)
3436 const gimple_statement_asm *asm_stmt =
3437 as_a <const gimple_statement_asm *> (gs);
3438 return asm_stmt->string;
3442 /* Return true if GS is an asm statement marked volatile. */
3444 static inline bool
3445 gimple_asm_volatile_p (const_gimple gs)
3447 GIMPLE_CHECK (gs, GIMPLE_ASM);
3448 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3452 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3454 static inline void
3455 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3457 GIMPLE_CHECK (gs, GIMPLE_ASM);
3458 if (volatile_p)
3459 gs->subcode |= GF_ASM_VOLATILE;
3460 else
3461 gs->subcode &= ~GF_ASM_VOLATILE;
3465 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3467 static inline void
3468 gimple_asm_set_input (gimple gs, bool input_p)
3470 GIMPLE_CHECK (gs, GIMPLE_ASM);
3471 if (input_p)
3472 gs->subcode |= GF_ASM_INPUT;
3473 else
3474 gs->subcode &= ~GF_ASM_INPUT;
3478 /* Return true if asm GS is an ASM_INPUT. */
3480 static inline bool
3481 gimple_asm_input_p (const_gimple gs)
3483 GIMPLE_CHECK (gs, GIMPLE_ASM);
3484 return (gs->subcode & GF_ASM_INPUT) != 0;
3488 /* Return the types handled by GIMPLE_CATCH statement GS. */
3490 static inline tree
3491 gimple_catch_types (const_gimple gs)
3493 const gimple_statement_catch *catch_stmt =
3494 as_a <const gimple_statement_catch *> (gs);
3495 return catch_stmt->types;
3499 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3501 static inline tree *
3502 gimple_catch_types_ptr (gimple gs)
3504 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3505 return &catch_stmt->types;
3509 /* Return a pointer to the GIMPLE sequence representing the body of
3510 the handler of GIMPLE_CATCH statement GS. */
3512 static inline gimple_seq *
3513 gimple_catch_handler_ptr (gimple gs)
3515 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3516 return &catch_stmt->handler;
3520 /* Return the GIMPLE sequence representing the body of the handler of
3521 GIMPLE_CATCH statement GS. */
3523 static inline gimple_seq
3524 gimple_catch_handler (gimple gs)
3526 return *gimple_catch_handler_ptr (gs);
3530 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3532 static inline void
3533 gimple_catch_set_types (gimple gs, tree t)
3535 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3536 catch_stmt->types = t;
3540 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3542 static inline void
3543 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3545 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3546 catch_stmt->handler = handler;
3550 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3552 static inline tree
3553 gimple_eh_filter_types (const_gimple gs)
3555 const gimple_statement_eh_filter *eh_filter_stmt =
3556 as_a <const gimple_statement_eh_filter *> (gs);
3557 return eh_filter_stmt->types;
3561 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3562 GS. */
3564 static inline tree *
3565 gimple_eh_filter_types_ptr (gimple gs)
3567 gimple_statement_eh_filter *eh_filter_stmt =
3568 as_a <gimple_statement_eh_filter *> (gs);
3569 return &eh_filter_stmt->types;
3573 /* Return a pointer to the sequence of statement to execute when
3574 GIMPLE_EH_FILTER statement fails. */
3576 static inline gimple_seq *
3577 gimple_eh_filter_failure_ptr (gimple gs)
3579 gimple_statement_eh_filter *eh_filter_stmt =
3580 as_a <gimple_statement_eh_filter *> (gs);
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 (gimple gs)
3591 return *gimple_eh_filter_failure_ptr (gs);
3595 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3597 static inline void
3598 gimple_eh_filter_set_types (gimple gs, tree types)
3600 gimple_statement_eh_filter *eh_filter_stmt =
3601 as_a <gimple_statement_eh_filter *> (gs);
3602 eh_filter_stmt->types = types;
3606 /* Set FAILURE to be the sequence of statements to execute on failure
3607 for GIMPLE_EH_FILTER GS. */
3609 static inline void
3610 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3612 gimple_statement_eh_filter *eh_filter_stmt =
3613 as_a <gimple_statement_eh_filter *> (gs);
3614 eh_filter_stmt->failure = failure;
3617 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3619 static inline tree
3620 gimple_eh_must_not_throw_fndecl (gimple gs)
3622 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3623 return eh_mnt_stmt->fndecl;
3626 /* Set the function decl to be called by GS to DECL. */
3628 static inline void
3629 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3631 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3632 eh_mnt_stmt->fndecl = decl;
3635 /* GIMPLE_EH_ELSE accessors. */
3637 static inline gimple_seq *
3638 gimple_eh_else_n_body_ptr (gimple gs)
3640 gimple_statement_eh_else *eh_else_stmt =
3641 as_a <gimple_statement_eh_else *> (gs);
3642 return &eh_else_stmt->n_body;
3645 static inline gimple_seq
3646 gimple_eh_else_n_body (gimple gs)
3648 return *gimple_eh_else_n_body_ptr (gs);
3651 static inline gimple_seq *
3652 gimple_eh_else_e_body_ptr (gimple gs)
3654 gimple_statement_eh_else *eh_else_stmt =
3655 as_a <gimple_statement_eh_else *> (gs);
3656 return &eh_else_stmt->e_body;
3659 static inline gimple_seq
3660 gimple_eh_else_e_body (gimple gs)
3662 return *gimple_eh_else_e_body_ptr (gs);
3665 static inline void
3666 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3668 gimple_statement_eh_else *eh_else_stmt =
3669 as_a <gimple_statement_eh_else *> (gs);
3670 eh_else_stmt->n_body = seq;
3673 static inline void
3674 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3676 gimple_statement_eh_else *eh_else_stmt =
3677 as_a <gimple_statement_eh_else *> (gs);
3678 eh_else_stmt->e_body = seq;
3681 /* GIMPLE_TRY accessors. */
3683 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3684 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3686 static inline enum gimple_try_flags
3687 gimple_try_kind (const_gimple gs)
3689 GIMPLE_CHECK (gs, GIMPLE_TRY);
3690 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3694 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3696 static inline void
3697 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3699 GIMPLE_CHECK (gs, GIMPLE_TRY);
3700 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3701 || kind == GIMPLE_TRY_FINALLY);
3702 if (gimple_try_kind (gs) != kind)
3703 gs->subcode = (unsigned int) kind;
3707 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3709 static inline bool
3710 gimple_try_catch_is_cleanup (const_gimple gs)
3712 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3713 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3717 /* Return a pointer to the sequence of statements used as the
3718 body for GIMPLE_TRY GS. */
3720 static inline gimple_seq *
3721 gimple_try_eval_ptr (gimple gs)
3723 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3724 return &try_stmt->eval;
3728 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3730 static inline gimple_seq
3731 gimple_try_eval (gimple gs)
3733 return *gimple_try_eval_ptr (gs);
3737 /* Return a pointer to the sequence of statements used as the cleanup body for
3738 GIMPLE_TRY GS. */
3740 static inline gimple_seq *
3741 gimple_try_cleanup_ptr (gimple gs)
3743 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3744 return &try_stmt->cleanup;
3748 /* Return the sequence of statements used as the cleanup body for
3749 GIMPLE_TRY GS. */
3751 static inline gimple_seq
3752 gimple_try_cleanup (gimple gs)
3754 return *gimple_try_cleanup_ptr (gs);
3758 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3760 static inline void
3761 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3763 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3764 if (catch_is_cleanup)
3765 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3766 else
3767 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3771 /* Set EVAL to be the sequence of statements to use as the body for
3772 GIMPLE_TRY GS. */
3774 static inline void
3775 gimple_try_set_eval (gimple gs, gimple_seq eval)
3777 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3778 try_stmt->eval = eval;
3782 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3783 body for GIMPLE_TRY GS. */
3785 static inline void
3786 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3788 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3789 try_stmt->cleanup = cleanup;
3793 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3795 static inline gimple_seq *
3796 gimple_wce_cleanup_ptr (gimple gs)
3798 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3799 return &wce_stmt->cleanup;
3803 /* Return the cleanup sequence for cleanup statement GS. */
3805 static inline gimple_seq
3806 gimple_wce_cleanup (gimple gs)
3808 return *gimple_wce_cleanup_ptr (gs);
3812 /* Set CLEANUP to be the cleanup sequence for GS. */
3814 static inline void
3815 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3817 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3818 wce_stmt->cleanup = cleanup;
3822 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3824 static inline bool
3825 gimple_wce_cleanup_eh_only (const_gimple gs)
3827 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3828 return gs->subcode != 0;
3832 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3834 static inline void
3835 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3837 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3838 gs->subcode = (unsigned int) eh_only_p;
3842 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3844 static inline unsigned
3845 gimple_phi_capacity (const_gimple gs)
3847 const gimple_statement_phi *phi_stmt =
3848 as_a <const gimple_statement_phi *> (gs);
3849 return phi_stmt->capacity;
3853 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3854 be exactly the number of incoming edges for the basic block holding
3855 GS. */
3857 static inline unsigned
3858 gimple_phi_num_args (const_gimple gs)
3860 const gimple_statement_phi *phi_stmt =
3861 as_a <const gimple_statement_phi *> (gs);
3862 return phi_stmt->nargs;
3866 /* Return the SSA name created by GIMPLE_PHI GS. */
3868 static inline tree
3869 gimple_phi_result (const_gimple gs)
3871 const gimple_statement_phi *phi_stmt =
3872 as_a <const gimple_statement_phi *> (gs);
3873 return phi_stmt->result;
3876 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3878 static inline tree *
3879 gimple_phi_result_ptr (gimple gs)
3881 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3882 return &phi_stmt->result;
3885 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3887 static inline void
3888 gimple_phi_set_result (gimple gs, tree result)
3890 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3891 phi_stmt->result = result;
3892 if (result && TREE_CODE (result) == SSA_NAME)
3893 SSA_NAME_DEF_STMT (result) = gs;
3897 /* Return the PHI argument corresponding to incoming edge INDEX for
3898 GIMPLE_PHI GS. */
3900 static inline struct phi_arg_d *
3901 gimple_phi_arg (gimple gs, unsigned index)
3903 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3904 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3905 return &(phi_stmt->args[index]);
3908 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3909 for GIMPLE_PHI GS. */
3911 static inline void
3912 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3914 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3915 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3916 phi_stmt->args[index] = *phiarg;
3919 /* Return the PHI nodes for basic block BB, or NULL if there are no
3920 PHI nodes. */
3922 static inline gimple_seq
3923 phi_nodes (const_basic_block bb)
3925 gcc_checking_assert (!(bb->flags & BB_RTL));
3926 return bb->il.gimple.phi_nodes;
3929 /* Return a pointer to the PHI nodes for basic block BB. */
3931 static inline gimple_seq *
3932 phi_nodes_ptr (basic_block bb)
3934 gcc_checking_assert (!(bb->flags & BB_RTL));
3935 return &bb->il.gimple.phi_nodes;
3938 /* Return the tree operand for argument I of PHI node GS. */
3940 static inline tree
3941 gimple_phi_arg_def (gimple gs, size_t index)
3943 return gimple_phi_arg (gs, index)->def;
3947 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3949 static inline tree *
3950 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3952 return &gimple_phi_arg (gs, index)->def;
3955 /* Return the edge associated with argument I of phi node GS. */
3957 static inline edge
3958 gimple_phi_arg_edge (gimple gs, size_t i)
3960 return EDGE_PRED (gimple_bb (gs), i);
3963 /* Return the source location of gimple argument I of phi node GS. */
3965 static inline source_location
3966 gimple_phi_arg_location (gimple gs, size_t i)
3968 return gimple_phi_arg (gs, i)->locus;
3971 /* Return the source location of the argument on edge E of phi node GS. */
3973 static inline source_location
3974 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3976 return gimple_phi_arg (gs, e->dest_idx)->locus;
3979 /* Set the source location of gimple argument I of phi node GS to LOC. */
3981 static inline void
3982 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3984 gimple_phi_arg (gs, i)->locus = loc;
3987 /* Return TRUE if argument I of phi node GS has a location record. */
3989 static inline bool
3990 gimple_phi_arg_has_location (gimple gs, size_t i)
3992 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3996 /* Return the region number for GIMPLE_RESX GS. */
3998 static inline int
3999 gimple_resx_region (const_gimple gs)
4001 const gimple_statement_resx *resx_stmt =
4002 as_a <const gimple_statement_resx *> (gs);
4003 return resx_stmt->region;
4006 /* Set REGION to be the region number for GIMPLE_RESX GS. */
4008 static inline void
4009 gimple_resx_set_region (gimple gs, int region)
4011 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
4012 resx_stmt->region = region;
4015 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
4017 static inline int
4018 gimple_eh_dispatch_region (const_gimple gs)
4020 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
4021 as_a <const gimple_statement_eh_dispatch *> (gs);
4022 return eh_dispatch_stmt->region;
4025 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
4027 static inline void
4028 gimple_eh_dispatch_set_region (gimple gs, int region)
4030 gimple_statement_eh_dispatch *eh_dispatch_stmt =
4031 as_a <gimple_statement_eh_dispatch *> (gs);
4032 eh_dispatch_stmt->region = region;
4035 /* Return the number of labels associated with the switch statement GS. */
4037 static inline unsigned
4038 gimple_switch_num_labels (const_gimple_switch gs)
4040 unsigned num_ops;
4041 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4042 num_ops = gimple_num_ops (gs);
4043 gcc_gimple_checking_assert (num_ops > 1);
4044 return num_ops - 1;
4048 /* Set NLABELS to be the number of labels for the switch statement GS. */
4050 static inline void
4051 gimple_switch_set_num_labels (gimple_switch g, unsigned nlabels)
4053 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4054 gimple_set_num_ops (g, nlabels + 1);
4058 /* Return the index variable used by the switch statement GS. */
4060 static inline tree
4061 gimple_switch_index (const_gimple gs)
4063 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4064 return gimple_op (gs, 0);
4068 /* Return a pointer to the index variable for the switch statement GS. */
4070 static inline tree *
4071 gimple_switch_index_ptr (const_gimple gs)
4073 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4074 return gimple_op_ptr (gs, 0);
4078 /* Set INDEX to be the index variable for switch statement GS. */
4080 static inline void
4081 gimple_switch_set_index (gimple_switch gs, tree index)
4083 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4084 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4085 gimple_set_op (gs, 0, index);
4089 /* Return the label numbered INDEX. The default label is 0, followed by any
4090 labels in a switch statement. */
4092 static inline tree
4093 gimple_switch_label (const_gimple_switch gs, unsigned index)
4095 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4096 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4097 return gimple_op (gs, index + 1);
4100 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4102 static inline void
4103 gimple_switch_set_label (gimple_switch gs, unsigned index, tree label)
4105 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4106 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4107 && (label == NULL_TREE
4108 || TREE_CODE (label) == CASE_LABEL_EXPR));
4109 gimple_set_op (gs, index + 1, label);
4112 /* Return the default label for a switch statement. */
4114 static inline tree
4115 gimple_switch_default_label (const_gimple_switch gs)
4117 tree label = gimple_switch_label (gs, 0);
4118 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4119 return label;
4122 /* Set the default label for a switch statement. */
4124 static inline void
4125 gimple_switch_set_default_label (gimple_switch gs, tree label)
4127 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4128 gimple_switch_set_label (gs, 0, label);
4131 /* Return true if GS is a GIMPLE_DEBUG statement. */
4133 static inline bool
4134 is_gimple_debug (const_gimple gs)
4136 return gimple_code (gs) == GIMPLE_DEBUG;
4139 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4141 static inline bool
4142 gimple_debug_bind_p (const_gimple s)
4144 if (is_gimple_debug (s))
4145 return s->subcode == GIMPLE_DEBUG_BIND;
4147 return false;
4150 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4152 static inline tree
4153 gimple_debug_bind_get_var (gimple dbg)
4155 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4156 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4157 return gimple_op (dbg, 0);
4160 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4161 statement. */
4163 static inline tree
4164 gimple_debug_bind_get_value (gimple dbg)
4166 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4167 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4168 return gimple_op (dbg, 1);
4171 /* Return a pointer to the value bound to the variable in a
4172 GIMPLE_DEBUG bind statement. */
4174 static inline tree *
4175 gimple_debug_bind_get_value_ptr (gimple dbg)
4177 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4178 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4179 return gimple_op_ptr (dbg, 1);
4182 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4184 static inline void
4185 gimple_debug_bind_set_var (gimple dbg, tree var)
4187 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4188 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4189 gimple_set_op (dbg, 0, var);
4192 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4193 statement. */
4195 static inline void
4196 gimple_debug_bind_set_value (gimple dbg, tree value)
4198 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4199 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4200 gimple_set_op (dbg, 1, value);
4203 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4204 optimized away. */
4205 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4207 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4208 statement. */
4210 static inline void
4211 gimple_debug_bind_reset_value (gimple dbg)
4213 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4214 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4215 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4218 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4219 value. */
4221 static inline bool
4222 gimple_debug_bind_has_value_p (gimple dbg)
4224 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4225 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4226 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4229 #undef GIMPLE_DEBUG_BIND_NOVALUE
4231 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4233 static inline bool
4234 gimple_debug_source_bind_p (const_gimple s)
4236 if (is_gimple_debug (s))
4237 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4239 return false;
4242 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4244 static inline tree
4245 gimple_debug_source_bind_get_var (gimple dbg)
4247 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4248 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4249 return gimple_op (dbg, 0);
4252 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4253 statement. */
4255 static inline tree
4256 gimple_debug_source_bind_get_value (gimple dbg)
4258 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4259 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4260 return gimple_op (dbg, 1);
4263 /* Return a pointer to the value bound to the variable in a
4264 GIMPLE_DEBUG source bind statement. */
4266 static inline tree *
4267 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4269 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4270 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4271 return gimple_op_ptr (dbg, 1);
4274 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4276 static inline void
4277 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4279 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4280 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4281 gimple_set_op (dbg, 0, var);
4284 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4285 statement. */
4287 static inline void
4288 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4290 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4291 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4292 gimple_set_op (dbg, 1, value);
4295 /* Return the line number for EXPR, or return -1 if we have no line
4296 number information for it. */
4297 static inline int
4298 get_lineno (const_gimple stmt)
4300 location_t loc;
4302 if (!stmt)
4303 return -1;
4305 loc = gimple_location (stmt);
4306 if (loc == UNKNOWN_LOCATION)
4307 return -1;
4309 return LOCATION_LINE (loc);
4312 /* Return a pointer to the body for the OMP statement GS. */
4314 static inline gimple_seq *
4315 gimple_omp_body_ptr (gimple gs)
4317 return &static_cast <gimple_statement_omp *> (gs)->body;
4320 /* Return the body for the OMP statement GS. */
4322 static inline gimple_seq
4323 gimple_omp_body (gimple gs)
4325 return *gimple_omp_body_ptr (gs);
4328 /* Set BODY to be the body for the OMP statement GS. */
4330 static inline void
4331 gimple_omp_set_body (gimple gs, gimple_seq body)
4333 static_cast <gimple_statement_omp *> (gs)->body = body;
4337 /* Return the name associated with OMP_CRITICAL statement GS. */
4339 static inline tree
4340 gimple_omp_critical_name (const_gimple gs)
4342 const gimple_statement_omp_critical *omp_critical_stmt =
4343 as_a <const gimple_statement_omp_critical *> (gs);
4344 return omp_critical_stmt->name;
4348 /* Return a pointer to the name associated with OMP critical statement GS. */
4350 static inline tree *
4351 gimple_omp_critical_name_ptr (gimple gs)
4353 gimple_statement_omp_critical *omp_critical_stmt =
4354 as_a <gimple_statement_omp_critical *> (gs);
4355 return &omp_critical_stmt->name;
4359 /* Set NAME to be the name associated with OMP critical statement GS. */
4361 static inline void
4362 gimple_omp_critical_set_name (gimple gs, tree name)
4364 gimple_statement_omp_critical *omp_critical_stmt =
4365 as_a <gimple_statement_omp_critical *> (gs);
4366 omp_critical_stmt->name = name;
4370 /* Return the kind of OMP for statemement. */
4372 static inline int
4373 gimple_omp_for_kind (const_gimple g)
4375 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4376 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4380 /* Set the OMP for kind. */
4382 static inline void
4383 gimple_omp_for_set_kind (gimple g, int kind)
4385 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4386 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4387 | (kind & GF_OMP_FOR_KIND_MASK);
4391 /* Return true if OMP for statement G has the
4392 GF_OMP_FOR_COMBINED flag set. */
4394 static inline bool
4395 gimple_omp_for_combined_p (const_gimple g)
4397 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4398 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4402 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4403 value of COMBINED_P. */
4405 static inline void
4406 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4408 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4409 if (combined_p)
4410 g->subcode |= GF_OMP_FOR_COMBINED;
4411 else
4412 g->subcode &= ~GF_OMP_FOR_COMBINED;
4416 /* Return true if OMP for statement G has the
4417 GF_OMP_FOR_COMBINED_INTO flag set. */
4419 static inline bool
4420 gimple_omp_for_combined_into_p (const_gimple g)
4422 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4423 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4427 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4428 value of COMBINED_P. */
4430 static inline void
4431 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4433 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4434 if (combined_p)
4435 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4436 else
4437 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4441 /* Return the clauses associated with OMP_FOR GS. */
4443 static inline tree
4444 gimple_omp_for_clauses (const_gimple gs)
4446 const gimple_statement_omp_for *omp_for_stmt =
4447 as_a <const gimple_statement_omp_for *> (gs);
4448 return omp_for_stmt->clauses;
4452 /* Return a pointer to the OMP_FOR GS. */
4454 static inline tree *
4455 gimple_omp_for_clauses_ptr (gimple gs)
4457 gimple_statement_omp_for *omp_for_stmt =
4458 as_a <gimple_statement_omp_for *> (gs);
4459 return &omp_for_stmt->clauses;
4463 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4465 static inline void
4466 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4468 gimple_statement_omp_for *omp_for_stmt =
4469 as_a <gimple_statement_omp_for *> (gs);
4470 omp_for_stmt->clauses = clauses;
4474 /* Get the collapse count of OMP_FOR GS. */
4476 static inline size_t
4477 gimple_omp_for_collapse (gimple gs)
4479 gimple_statement_omp_for *omp_for_stmt =
4480 as_a <gimple_statement_omp_for *> (gs);
4481 return omp_for_stmt->collapse;
4485 /* Return the index variable for OMP_FOR GS. */
4487 static inline tree
4488 gimple_omp_for_index (const_gimple gs, size_t i)
4490 const gimple_statement_omp_for *omp_for_stmt =
4491 as_a <const gimple_statement_omp_for *> (gs);
4492 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4493 return omp_for_stmt->iter[i].index;
4497 /* Return a pointer to the index variable for OMP_FOR GS. */
4499 static inline tree *
4500 gimple_omp_for_index_ptr (gimple gs, size_t i)
4502 gimple_statement_omp_for *omp_for_stmt =
4503 as_a <gimple_statement_omp_for *> (gs);
4504 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4505 return &omp_for_stmt->iter[i].index;
4509 /* Set INDEX to be the index variable for OMP_FOR GS. */
4511 static inline void
4512 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4514 gimple_statement_omp_for *omp_for_stmt =
4515 as_a <gimple_statement_omp_for *> (gs);
4516 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4517 omp_for_stmt->iter[i].index = index;
4521 /* Return the initial value for OMP_FOR GS. */
4523 static inline tree
4524 gimple_omp_for_initial (const_gimple gs, size_t i)
4526 const gimple_statement_omp_for *omp_for_stmt =
4527 as_a <const gimple_statement_omp_for *> (gs);
4528 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4529 return omp_for_stmt->iter[i].initial;
4533 /* Return a pointer to the initial value for OMP_FOR GS. */
4535 static inline tree *
4536 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4538 gimple_statement_omp_for *omp_for_stmt =
4539 as_a <gimple_statement_omp_for *> (gs);
4540 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4541 return &omp_for_stmt->iter[i].initial;
4545 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4547 static inline void
4548 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4550 gimple_statement_omp_for *omp_for_stmt =
4551 as_a <gimple_statement_omp_for *> (gs);
4552 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4553 omp_for_stmt->iter[i].initial = initial;
4557 /* Return the final value for OMP_FOR GS. */
4559 static inline tree
4560 gimple_omp_for_final (const_gimple gs, size_t i)
4562 const gimple_statement_omp_for *omp_for_stmt =
4563 as_a <const gimple_statement_omp_for *> (gs);
4564 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4565 return omp_for_stmt->iter[i].final;
4569 /* Return a pointer to the final value for OMP_FOR GS. */
4571 static inline tree *
4572 gimple_omp_for_final_ptr (gimple gs, size_t i)
4574 gimple_statement_omp_for *omp_for_stmt =
4575 as_a <gimple_statement_omp_for *> (gs);
4576 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4577 return &omp_for_stmt->iter[i].final;
4581 /* Set FINAL to be the final value for OMP_FOR GS. */
4583 static inline void
4584 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4586 gimple_statement_omp_for *omp_for_stmt =
4587 as_a <gimple_statement_omp_for *> (gs);
4588 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4589 omp_for_stmt->iter[i].final = final;
4593 /* Return the increment value for OMP_FOR GS. */
4595 static inline tree
4596 gimple_omp_for_incr (const_gimple gs, size_t i)
4598 const gimple_statement_omp_for *omp_for_stmt =
4599 as_a <const gimple_statement_omp_for *> (gs);
4600 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4601 return omp_for_stmt->iter[i].incr;
4605 /* Return a pointer to the increment value for OMP_FOR GS. */
4607 static inline tree *
4608 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4610 gimple_statement_omp_for *omp_for_stmt =
4611 as_a <gimple_statement_omp_for *> (gs);
4612 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4613 return &omp_for_stmt->iter[i].incr;
4617 /* Set INCR to be the increment value for OMP_FOR GS. */
4619 static inline void
4620 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4622 gimple_statement_omp_for *omp_for_stmt =
4623 as_a <gimple_statement_omp_for *> (gs);
4624 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4625 omp_for_stmt->iter[i].incr = incr;
4629 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4630 statement GS starts. */
4632 static inline gimple_seq *
4633 gimple_omp_for_pre_body_ptr (gimple gs)
4635 gimple_statement_omp_for *omp_for_stmt =
4636 as_a <gimple_statement_omp_for *> (gs);
4637 return &omp_for_stmt->pre_body;
4641 /* Return the sequence of statements to execute before the OMP_FOR
4642 statement GS starts. */
4644 static inline gimple_seq
4645 gimple_omp_for_pre_body (gimple gs)
4647 return *gimple_omp_for_pre_body_ptr (gs);
4651 /* Set PRE_BODY to be the sequence of statements to execute before the
4652 OMP_FOR statement GS starts. */
4654 static inline void
4655 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4657 gimple_statement_omp_for *omp_for_stmt =
4658 as_a <gimple_statement_omp_for *> (gs);
4659 omp_for_stmt->pre_body = pre_body;
4663 /* Return the clauses associated with OMP_PARALLEL GS. */
4665 static inline tree
4666 gimple_omp_parallel_clauses (const_gimple gs)
4668 const gimple_statement_omp_parallel *omp_parallel_stmt =
4669 as_a <const gimple_statement_omp_parallel *> (gs);
4670 return omp_parallel_stmt->clauses;
4674 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4676 static inline tree *
4677 gimple_omp_parallel_clauses_ptr (gimple gs)
4679 gimple_statement_omp_parallel *omp_parallel_stmt =
4680 as_a <gimple_statement_omp_parallel *> (gs);
4681 return &omp_parallel_stmt->clauses;
4685 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4686 GS. */
4688 static inline void
4689 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4691 gimple_statement_omp_parallel *omp_parallel_stmt =
4692 as_a <gimple_statement_omp_parallel *> (gs);
4693 omp_parallel_stmt->clauses = clauses;
4697 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4699 static inline tree
4700 gimple_omp_parallel_child_fn (const_gimple gs)
4702 const gimple_statement_omp_parallel *omp_parallel_stmt =
4703 as_a <const gimple_statement_omp_parallel *> (gs);
4704 return omp_parallel_stmt->child_fn;
4707 /* Return a pointer to the child function used to hold the body of
4708 OMP_PARALLEL GS. */
4710 static inline tree *
4711 gimple_omp_parallel_child_fn_ptr (gimple gs)
4713 gimple_statement_omp_parallel *omp_parallel_stmt =
4714 as_a <gimple_statement_omp_parallel *> (gs);
4715 return &omp_parallel_stmt->child_fn;
4719 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4721 static inline void
4722 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4724 gimple_statement_omp_parallel *omp_parallel_stmt =
4725 as_a <gimple_statement_omp_parallel *> (gs);
4726 omp_parallel_stmt->child_fn = child_fn;
4730 /* Return the artificial argument used to send variables and values
4731 from the parent to the children threads in OMP_PARALLEL GS. */
4733 static inline tree
4734 gimple_omp_parallel_data_arg (const_gimple gs)
4736 const gimple_statement_omp_parallel *omp_parallel_stmt =
4737 as_a <const gimple_statement_omp_parallel *> (gs);
4738 return omp_parallel_stmt->data_arg;
4742 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4744 static inline tree *
4745 gimple_omp_parallel_data_arg_ptr (gimple gs)
4747 gimple_statement_omp_parallel *omp_parallel_stmt =
4748 as_a <gimple_statement_omp_parallel *> (gs);
4749 return &omp_parallel_stmt->data_arg;
4753 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4755 static inline void
4756 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4758 gimple_statement_omp_parallel *omp_parallel_stmt =
4759 as_a <gimple_statement_omp_parallel *> (gs);
4760 omp_parallel_stmt->data_arg = data_arg;
4764 /* Return the clauses associated with OMP_TASK GS. */
4766 static inline tree
4767 gimple_omp_task_clauses (const_gimple gs)
4769 const gimple_statement_omp_task *omp_task_stmt =
4770 as_a <const gimple_statement_omp_task *> (gs);
4771 return omp_task_stmt->clauses;
4775 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4777 static inline tree *
4778 gimple_omp_task_clauses_ptr (gimple gs)
4780 gimple_statement_omp_task *omp_task_stmt =
4781 as_a <gimple_statement_omp_task *> (gs);
4782 return &omp_task_stmt->clauses;
4786 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4787 GS. */
4789 static inline void
4790 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4792 gimple_statement_omp_task *omp_task_stmt =
4793 as_a <gimple_statement_omp_task *> (gs);
4794 omp_task_stmt->clauses = clauses;
4798 /* Return the child function used to hold the body of OMP_TASK GS. */
4800 static inline tree
4801 gimple_omp_task_child_fn (const_gimple gs)
4803 const gimple_statement_omp_task *omp_task_stmt =
4804 as_a <const gimple_statement_omp_task *> (gs);
4805 return omp_task_stmt->child_fn;
4808 /* Return a pointer to the child function used to hold the body of
4809 OMP_TASK GS. */
4811 static inline tree *
4812 gimple_omp_task_child_fn_ptr (gimple gs)
4814 gimple_statement_omp_task *omp_task_stmt =
4815 as_a <gimple_statement_omp_task *> (gs);
4816 return &omp_task_stmt->child_fn;
4820 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4822 static inline void
4823 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4825 gimple_statement_omp_task *omp_task_stmt =
4826 as_a <gimple_statement_omp_task *> (gs);
4827 omp_task_stmt->child_fn = child_fn;
4831 /* Return the artificial argument used to send variables and values
4832 from the parent to the children threads in OMP_TASK GS. */
4834 static inline tree
4835 gimple_omp_task_data_arg (const_gimple gs)
4837 const gimple_statement_omp_task *omp_task_stmt =
4838 as_a <const gimple_statement_omp_task *> (gs);
4839 return omp_task_stmt->data_arg;
4843 /* Return a pointer to the data argument for OMP_TASK GS. */
4845 static inline tree *
4846 gimple_omp_task_data_arg_ptr (gimple gs)
4848 gimple_statement_omp_task *omp_task_stmt =
4849 as_a <gimple_statement_omp_task *> (gs);
4850 return &omp_task_stmt->data_arg;
4854 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4856 static inline void
4857 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4859 gimple_statement_omp_task *omp_task_stmt =
4860 as_a <gimple_statement_omp_task *> (gs);
4861 omp_task_stmt->data_arg = data_arg;
4865 /* Return the clauses associated with OMP_TASK GS. */
4867 static inline tree
4868 gimple_omp_taskreg_clauses (const_gimple gs)
4870 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4871 as_a <const gimple_statement_omp_taskreg *> (gs);
4872 return omp_taskreg_stmt->clauses;
4876 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4878 static inline tree *
4879 gimple_omp_taskreg_clauses_ptr (gimple gs)
4881 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4882 as_a <gimple_statement_omp_taskreg *> (gs);
4883 return &omp_taskreg_stmt->clauses;
4887 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4888 GS. */
4890 static inline void
4891 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4893 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4894 as_a <gimple_statement_omp_taskreg *> (gs);
4895 omp_taskreg_stmt->clauses = clauses;
4899 /* Return the child function used to hold the body of OMP_TASK GS. */
4901 static inline tree
4902 gimple_omp_taskreg_child_fn (const_gimple gs)
4904 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4905 as_a <const gimple_statement_omp_taskreg *> (gs);
4906 return omp_taskreg_stmt->child_fn;
4909 /* Return a pointer to the child function used to hold the body of
4910 OMP_TASK GS. */
4912 static inline tree *
4913 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4915 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4916 as_a <gimple_statement_omp_taskreg *> (gs);
4917 return &omp_taskreg_stmt->child_fn;
4921 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4923 static inline void
4924 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4926 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4927 as_a <gimple_statement_omp_taskreg *> (gs);
4928 omp_taskreg_stmt->child_fn = child_fn;
4932 /* Return the artificial argument used to send variables and values
4933 from the parent to the children threads in OMP_TASK GS. */
4935 static inline tree
4936 gimple_omp_taskreg_data_arg (const_gimple gs)
4938 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4939 as_a <const gimple_statement_omp_taskreg *> (gs);
4940 return omp_taskreg_stmt->data_arg;
4944 /* Return a pointer to the data argument for OMP_TASK GS. */
4946 static inline tree *
4947 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4949 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4950 as_a <gimple_statement_omp_taskreg *> (gs);
4951 return &omp_taskreg_stmt->data_arg;
4955 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4957 static inline void
4958 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4960 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4961 as_a <gimple_statement_omp_taskreg *> (gs);
4962 omp_taskreg_stmt->data_arg = data_arg;
4966 /* Return the copy function used to hold the body of OMP_TASK GS. */
4968 static inline tree
4969 gimple_omp_task_copy_fn (const_gimple gs)
4971 const gimple_statement_omp_task *omp_task_stmt =
4972 as_a <const gimple_statement_omp_task *> (gs);
4973 return omp_task_stmt->copy_fn;
4976 /* Return a pointer to the copy function used to hold the body of
4977 OMP_TASK GS. */
4979 static inline tree *
4980 gimple_omp_task_copy_fn_ptr (gimple gs)
4982 gimple_statement_omp_task *omp_task_stmt =
4983 as_a <gimple_statement_omp_task *> (gs);
4984 return &omp_task_stmt->copy_fn;
4988 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4990 static inline void
4991 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4993 gimple_statement_omp_task *omp_task_stmt =
4994 as_a <gimple_statement_omp_task *> (gs);
4995 omp_task_stmt->copy_fn = copy_fn;
4999 /* Return size of the data block in bytes in OMP_TASK GS. */
5001 static inline tree
5002 gimple_omp_task_arg_size (const_gimple gs)
5004 const gimple_statement_omp_task *omp_task_stmt =
5005 as_a <const gimple_statement_omp_task *> (gs);
5006 return omp_task_stmt->arg_size;
5010 /* Return a pointer to the data block size for OMP_TASK GS. */
5012 static inline tree *
5013 gimple_omp_task_arg_size_ptr (gimple gs)
5015 gimple_statement_omp_task *omp_task_stmt =
5016 as_a <gimple_statement_omp_task *> (gs);
5017 return &omp_task_stmt->arg_size;
5021 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5023 static inline void
5024 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
5026 gimple_statement_omp_task *omp_task_stmt =
5027 as_a <gimple_statement_omp_task *> (gs);
5028 omp_task_stmt->arg_size = arg_size;
5032 /* Return align of the data block in bytes in OMP_TASK GS. */
5034 static inline tree
5035 gimple_omp_task_arg_align (const_gimple gs)
5037 const gimple_statement_omp_task *omp_task_stmt =
5038 as_a <const gimple_statement_omp_task *> (gs);
5039 return omp_task_stmt->arg_align;
5043 /* Return a pointer to the data block align for OMP_TASK GS. */
5045 static inline tree *
5046 gimple_omp_task_arg_align_ptr (gimple gs)
5048 gimple_statement_omp_task *omp_task_stmt =
5049 as_a <gimple_statement_omp_task *> (gs);
5050 return &omp_task_stmt->arg_align;
5054 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5056 static inline void
5057 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5059 gimple_statement_omp_task *omp_task_stmt =
5060 as_a <gimple_statement_omp_task *> (gs);
5061 omp_task_stmt->arg_align = arg_align;
5065 /* Return the clauses associated with OMP_SINGLE GS. */
5067 static inline tree
5068 gimple_omp_single_clauses (const_gimple gs)
5070 const gimple_statement_omp_single *omp_single_stmt =
5071 as_a <const gimple_statement_omp_single *> (gs);
5072 return omp_single_stmt->clauses;
5076 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5078 static inline tree *
5079 gimple_omp_single_clauses_ptr (gimple gs)
5081 gimple_statement_omp_single *omp_single_stmt =
5082 as_a <gimple_statement_omp_single *> (gs);
5083 return &omp_single_stmt->clauses;
5087 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5089 static inline void
5090 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5092 gimple_statement_omp_single *omp_single_stmt =
5093 as_a <gimple_statement_omp_single *> (gs);
5094 omp_single_stmt->clauses = clauses;
5098 /* Return the clauses associated with OMP_TARGET GS. */
5100 static inline tree
5101 gimple_omp_target_clauses (const_gimple gs)
5103 const gimple_statement_omp_target *omp_target_stmt =
5104 as_a <const gimple_statement_omp_target *> (gs);
5105 return omp_target_stmt->clauses;
5109 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5111 static inline tree *
5112 gimple_omp_target_clauses_ptr (gimple gs)
5114 gimple_statement_omp_target *omp_target_stmt =
5115 as_a <gimple_statement_omp_target *> (gs);
5116 return &omp_target_stmt->clauses;
5120 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5122 static inline void
5123 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5125 gimple_statement_omp_target *omp_target_stmt =
5126 as_a <gimple_statement_omp_target *> (gs);
5127 omp_target_stmt->clauses = clauses;
5131 /* Return the kind of OMP target statemement. */
5133 static inline int
5134 gimple_omp_target_kind (const_gimple g)
5136 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5137 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5141 /* Set the OMP target kind. */
5143 static inline void
5144 gimple_omp_target_set_kind (gimple g, int kind)
5146 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5147 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5148 | (kind & GF_OMP_TARGET_KIND_MASK);
5152 /* Return the child function used to hold the body of OMP_TARGET GS. */
5154 static inline tree
5155 gimple_omp_target_child_fn (const_gimple gs)
5157 const gimple_statement_omp_target *omp_target_stmt =
5158 as_a <const gimple_statement_omp_target *> (gs);
5159 return omp_target_stmt->child_fn;
5162 /* Return a pointer to the child function used to hold the body of
5163 OMP_TARGET GS. */
5165 static inline tree *
5166 gimple_omp_target_child_fn_ptr (gimple gs)
5168 gimple_statement_omp_target *omp_target_stmt =
5169 as_a <gimple_statement_omp_target *> (gs);
5170 return &omp_target_stmt->child_fn;
5174 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5176 static inline void
5177 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5179 gimple_statement_omp_target *omp_target_stmt =
5180 as_a <gimple_statement_omp_target *> (gs);
5181 omp_target_stmt->child_fn = child_fn;
5185 /* Return the artificial argument used to send variables and values
5186 from the parent to the children threads in OMP_TARGET GS. */
5188 static inline tree
5189 gimple_omp_target_data_arg (const_gimple gs)
5191 const gimple_statement_omp_target *omp_target_stmt =
5192 as_a <const gimple_statement_omp_target *> (gs);
5193 return omp_target_stmt->data_arg;
5197 /* Return a pointer to the data argument for OMP_TARGET GS. */
5199 static inline tree *
5200 gimple_omp_target_data_arg_ptr (gimple gs)
5202 gimple_statement_omp_target *omp_target_stmt =
5203 as_a <gimple_statement_omp_target *> (gs);
5204 return &omp_target_stmt->data_arg;
5208 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5210 static inline void
5211 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5213 gimple_statement_omp_target *omp_target_stmt =
5214 as_a <gimple_statement_omp_target *> (gs);
5215 omp_target_stmt->data_arg = data_arg;
5219 /* Return the clauses associated with OMP_TEAMS GS. */
5221 static inline tree
5222 gimple_omp_teams_clauses (const_gimple gs)
5224 const gimple_statement_omp_teams *omp_teams_stmt =
5225 as_a <const gimple_statement_omp_teams *> (gs);
5226 return omp_teams_stmt->clauses;
5230 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5232 static inline tree *
5233 gimple_omp_teams_clauses_ptr (gimple gs)
5235 gimple_statement_omp_teams *omp_teams_stmt =
5236 as_a <gimple_statement_omp_teams *> (gs);
5237 return &omp_teams_stmt->clauses;
5241 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5243 static inline void
5244 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5246 gimple_statement_omp_teams *omp_teams_stmt =
5247 as_a <gimple_statement_omp_teams *> (gs);
5248 omp_teams_stmt->clauses = clauses;
5252 /* Return the clauses associated with OMP_SECTIONS GS. */
5254 static inline tree
5255 gimple_omp_sections_clauses (const_gimple gs)
5257 const gimple_statement_omp_sections *omp_sections_stmt =
5258 as_a <const gimple_statement_omp_sections *> (gs);
5259 return omp_sections_stmt->clauses;
5263 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5265 static inline tree *
5266 gimple_omp_sections_clauses_ptr (gimple gs)
5268 gimple_statement_omp_sections *omp_sections_stmt =
5269 as_a <gimple_statement_omp_sections *> (gs);
5270 return &omp_sections_stmt->clauses;
5274 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5275 GS. */
5277 static inline void
5278 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5280 gimple_statement_omp_sections *omp_sections_stmt =
5281 as_a <gimple_statement_omp_sections *> (gs);
5282 omp_sections_stmt->clauses = clauses;
5286 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5287 in GS. */
5289 static inline tree
5290 gimple_omp_sections_control (const_gimple gs)
5292 const gimple_statement_omp_sections *omp_sections_stmt =
5293 as_a <const gimple_statement_omp_sections *> (gs);
5294 return omp_sections_stmt->control;
5298 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5299 GS. */
5301 static inline tree *
5302 gimple_omp_sections_control_ptr (gimple gs)
5304 gimple_statement_omp_sections *omp_sections_stmt =
5305 as_a <gimple_statement_omp_sections *> (gs);
5306 return &omp_sections_stmt->control;
5310 /* Set CONTROL to be the set of clauses associated with the
5311 GIMPLE_OMP_SECTIONS in GS. */
5313 static inline void
5314 gimple_omp_sections_set_control (gimple gs, tree control)
5316 gimple_statement_omp_sections *omp_sections_stmt =
5317 as_a <gimple_statement_omp_sections *> (gs);
5318 omp_sections_stmt->control = control;
5322 /* Set COND to be the condition code for OMP_FOR GS. */
5324 static inline void
5325 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5327 gimple_statement_omp_for *omp_for_stmt =
5328 as_a <gimple_statement_omp_for *> (gs);
5329 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5330 && i < omp_for_stmt->collapse);
5331 omp_for_stmt->iter[i].cond = cond;
5335 /* Return the condition code associated with OMP_FOR GS. */
5337 static inline enum tree_code
5338 gimple_omp_for_cond (const_gimple gs, size_t i)
5340 const gimple_statement_omp_for *omp_for_stmt =
5341 as_a <const gimple_statement_omp_for *> (gs);
5342 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5343 return omp_for_stmt->iter[i].cond;
5347 /* Set the value being stored in an atomic store. */
5349 static inline void
5350 gimple_omp_atomic_store_set_val (gimple g, tree val)
5352 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5353 as_a <gimple_statement_omp_atomic_store *> (g);
5354 omp_atomic_store_stmt->val = val;
5358 /* Return the value being stored in an atomic store. */
5360 static inline tree
5361 gimple_omp_atomic_store_val (const_gimple g)
5363 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5364 as_a <const gimple_statement_omp_atomic_store *> (g);
5365 return omp_atomic_store_stmt->val;
5369 /* Return a pointer to the value being stored in an atomic store. */
5371 static inline tree *
5372 gimple_omp_atomic_store_val_ptr (gimple g)
5374 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5375 as_a <gimple_statement_omp_atomic_store *> (g);
5376 return &omp_atomic_store_stmt->val;
5380 /* Set the LHS of an atomic load. */
5382 static inline void
5383 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5385 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5386 as_a <gimple_statement_omp_atomic_load *> (g);
5387 omp_atomic_load_stmt->lhs = lhs;
5391 /* Get the LHS of an atomic load. */
5393 static inline tree
5394 gimple_omp_atomic_load_lhs (const_gimple g)
5396 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5397 as_a <const gimple_statement_omp_atomic_load *> (g);
5398 return omp_atomic_load_stmt->lhs;
5402 /* Return a pointer to the LHS of an atomic load. */
5404 static inline tree *
5405 gimple_omp_atomic_load_lhs_ptr (gimple g)
5407 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5408 as_a <gimple_statement_omp_atomic_load *> (g);
5409 return &omp_atomic_load_stmt->lhs;
5413 /* Set the RHS of an atomic load. */
5415 static inline void
5416 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5418 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5419 as_a <gimple_statement_omp_atomic_load *> (g);
5420 omp_atomic_load_stmt->rhs = rhs;
5424 /* Get the RHS of an atomic load. */
5426 static inline tree
5427 gimple_omp_atomic_load_rhs (const_gimple g)
5429 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5430 as_a <const gimple_statement_omp_atomic_load *> (g);
5431 return omp_atomic_load_stmt->rhs;
5435 /* Return a pointer to the RHS of an atomic load. */
5437 static inline tree *
5438 gimple_omp_atomic_load_rhs_ptr (gimple g)
5440 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5441 as_a <gimple_statement_omp_atomic_load *> (g);
5442 return &omp_atomic_load_stmt->rhs;
5446 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5448 static inline tree
5449 gimple_omp_continue_control_def (const_gimple g)
5451 const gimple_statement_omp_continue *omp_continue_stmt =
5452 as_a <const gimple_statement_omp_continue *> (g);
5453 return omp_continue_stmt->control_def;
5456 /* The same as above, but return the address. */
5458 static inline tree *
5459 gimple_omp_continue_control_def_ptr (gimple g)
5461 gimple_statement_omp_continue *omp_continue_stmt =
5462 as_a <gimple_statement_omp_continue *> (g);
5463 return &omp_continue_stmt->control_def;
5466 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5468 static inline void
5469 gimple_omp_continue_set_control_def (gimple g, tree def)
5471 gimple_statement_omp_continue *omp_continue_stmt =
5472 as_a <gimple_statement_omp_continue *> (g);
5473 omp_continue_stmt->control_def = def;
5477 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5479 static inline tree
5480 gimple_omp_continue_control_use (const_gimple g)
5482 const gimple_statement_omp_continue *omp_continue_stmt =
5483 as_a <const gimple_statement_omp_continue *> (g);
5484 return omp_continue_stmt->control_use;
5488 /* The same as above, but return the address. */
5490 static inline tree *
5491 gimple_omp_continue_control_use_ptr (gimple g)
5493 gimple_statement_omp_continue *omp_continue_stmt =
5494 as_a <gimple_statement_omp_continue *> (g);
5495 return &omp_continue_stmt->control_use;
5499 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5501 static inline void
5502 gimple_omp_continue_set_control_use (gimple g, tree use)
5504 gimple_statement_omp_continue *omp_continue_stmt =
5505 as_a <gimple_statement_omp_continue *> (g);
5506 omp_continue_stmt->control_use = use;
5509 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5511 static inline gimple_seq *
5512 gimple_transaction_body_ptr (gimple gs)
5514 gimple_statement_transaction *transaction_stmt =
5515 as_a <gimple_statement_transaction *> (gs);
5516 return &transaction_stmt->body;
5519 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5521 static inline gimple_seq
5522 gimple_transaction_body (gimple gs)
5524 return *gimple_transaction_body_ptr (gs);
5527 /* Return the label associated with a GIMPLE_TRANSACTION. */
5529 static inline tree
5530 gimple_transaction_label (const_gimple gs)
5532 const gimple_statement_transaction *transaction_stmt =
5533 as_a <const gimple_statement_transaction *> (gs);
5534 return transaction_stmt->label;
5537 static inline tree *
5538 gimple_transaction_label_ptr (gimple gs)
5540 gimple_statement_transaction *transaction_stmt =
5541 as_a <gimple_statement_transaction *> (gs);
5542 return &transaction_stmt->label;
5545 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5547 static inline unsigned int
5548 gimple_transaction_subcode (const_gimple gs)
5550 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5551 return gs->subcode;
5554 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5556 static inline void
5557 gimple_transaction_set_body (gimple gs, gimple_seq body)
5559 gimple_statement_transaction *transaction_stmt =
5560 as_a <gimple_statement_transaction *> (gs);
5561 transaction_stmt->body = body;
5564 /* Set the label associated with a GIMPLE_TRANSACTION. */
5566 static inline void
5567 gimple_transaction_set_label (gimple gs, tree label)
5569 gimple_statement_transaction *transaction_stmt =
5570 as_a <gimple_statement_transaction *> (gs);
5571 transaction_stmt->label = label;
5574 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5576 static inline void
5577 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5579 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5580 gs->subcode = subcode;
5584 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5586 static inline tree *
5587 gimple_return_retval_ptr (const_gimple gs)
5589 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5590 return gimple_op_ptr (gs, 0);
5593 /* Return the return value for GIMPLE_RETURN GS. */
5595 static inline tree
5596 gimple_return_retval (const_gimple gs)
5598 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5599 return gimple_op (gs, 0);
5603 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5605 static inline void
5606 gimple_return_set_retval (gimple gs, tree retval)
5608 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5609 gimple_set_op (gs, 0, retval);
5613 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5615 #define CASE_GIMPLE_OMP \
5616 case GIMPLE_OMP_PARALLEL: \
5617 case GIMPLE_OMP_TASK: \
5618 case GIMPLE_OMP_FOR: \
5619 case GIMPLE_OMP_SECTIONS: \
5620 case GIMPLE_OMP_SECTIONS_SWITCH: \
5621 case GIMPLE_OMP_SINGLE: \
5622 case GIMPLE_OMP_TARGET: \
5623 case GIMPLE_OMP_TEAMS: \
5624 case GIMPLE_OMP_SECTION: \
5625 case GIMPLE_OMP_MASTER: \
5626 case GIMPLE_OMP_TASKGROUP: \
5627 case GIMPLE_OMP_ORDERED: \
5628 case GIMPLE_OMP_CRITICAL: \
5629 case GIMPLE_OMP_RETURN: \
5630 case GIMPLE_OMP_ATOMIC_LOAD: \
5631 case GIMPLE_OMP_ATOMIC_STORE: \
5632 case GIMPLE_OMP_CONTINUE
5634 static inline bool
5635 is_gimple_omp (const_gimple stmt)
5637 switch (gimple_code (stmt))
5639 CASE_GIMPLE_OMP:
5640 return true;
5641 default:
5642 return false;
5647 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5649 static inline bool
5650 gimple_nop_p (const_gimple g)
5652 return gimple_code (g) == GIMPLE_NOP;
5656 /* Return true if GS is a GIMPLE_RESX. */
5658 static inline bool
5659 is_gimple_resx (const_gimple gs)
5661 return gimple_code (gs) == GIMPLE_RESX;
5664 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5666 static inline enum br_predictor
5667 gimple_predict_predictor (gimple gs)
5669 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5670 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5674 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5676 static inline void
5677 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5679 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5680 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5681 | (unsigned) predictor;
5685 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5687 static inline enum prediction
5688 gimple_predict_outcome (gimple gs)
5690 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5691 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5695 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5697 static inline void
5698 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5700 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5701 if (outcome == TAKEN)
5702 gs->subcode |= GF_PREDICT_TAKEN;
5703 else
5704 gs->subcode &= ~GF_PREDICT_TAKEN;
5708 /* Return the type of the main expression computed by STMT. Return
5709 void_type_node if the statement computes nothing. */
5711 static inline tree
5712 gimple_expr_type (const_gimple stmt)
5714 enum gimple_code code = gimple_code (stmt);
5716 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5718 tree type;
5719 /* In general we want to pass out a type that can be substituted
5720 for both the RHS and the LHS types if there is a possibly
5721 useless conversion involved. That means returning the
5722 original RHS type as far as we can reconstruct it. */
5723 if (code == GIMPLE_CALL)
5725 if (gimple_call_internal_p (stmt)
5726 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5727 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5728 else
5729 type = gimple_call_return_type (stmt);
5731 else
5732 switch (gimple_assign_rhs_code (stmt))
5734 case POINTER_PLUS_EXPR:
5735 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5736 break;
5738 default:
5739 /* As fallback use the type of the LHS. */
5740 type = TREE_TYPE (gimple_get_lhs (stmt));
5741 break;
5743 return type;
5745 else if (code == GIMPLE_COND)
5746 return boolean_type_node;
5747 else
5748 return void_type_node;
5751 /* Enum and arrays used for allocation stats. Keep in sync with
5752 gimple.c:gimple_alloc_kind_names. */
5753 enum gimple_alloc_kind
5755 gimple_alloc_kind_assign, /* Assignments. */
5756 gimple_alloc_kind_phi, /* PHI nodes. */
5757 gimple_alloc_kind_cond, /* Conditionals. */
5758 gimple_alloc_kind_rest, /* Everything else. */
5759 gimple_alloc_kind_all
5762 extern int gimple_alloc_counts[];
5763 extern int gimple_alloc_sizes[];
5765 /* Return the allocation kind for a given stmt CODE. */
5766 static inline enum gimple_alloc_kind
5767 gimple_alloc_kind (enum gimple_code code)
5769 switch (code)
5771 case GIMPLE_ASSIGN:
5772 return gimple_alloc_kind_assign;
5773 case GIMPLE_PHI:
5774 return gimple_alloc_kind_phi;
5775 case GIMPLE_COND:
5776 return gimple_alloc_kind_cond;
5777 default:
5778 return gimple_alloc_kind_rest;
5782 /* Return true if a location should not be emitted for this statement
5783 by annotate_all_with_location. */
5785 static inline bool
5786 gimple_do_not_emit_location_p (gimple g)
5788 return gimple_plf (g, GF_PLF_1);
5791 /* Mark statement G so a location will not be emitted by
5792 annotate_one_with_location. */
5794 static inline void
5795 gimple_set_do_not_emit_location (gimple g)
5797 /* The PLF flags are initialized to 0 when a new tuple is created,
5798 so no need to initialize it anywhere. */
5799 gimple_set_plf (g, GF_PLF_1, true);
5803 /* Macros for showing usage statistics. */
5804 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5805 ? (x) \
5806 : ((x) < 1024*1024*10 \
5807 ? (x) / 1024 \
5808 : (x) / (1024*1024))))
5810 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5812 #endif /* GCC_GIMPLE_H */