Introduce gimple_cond and use it in various places
[official-gcc.git] / gcc / gimple.h
blob9683bc2fa96cb59d8108a7c28b7cc8ab1345f612
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 template <>
793 template <>
794 inline bool
795 is_a_helper <gimple_statement_asm *>::test (gimple gs)
797 return gs->code == GIMPLE_ASM;
800 template <>
801 template <>
802 inline bool
803 is_a_helper <gimple_statement_bind *>::test (gimple gs)
805 return gs->code == GIMPLE_BIND;
808 template <>
809 template <>
810 inline bool
811 is_a_helper <gimple_statement_call *>::test (gimple gs)
813 return gs->code == GIMPLE_CALL;
816 template <>
817 template <>
818 inline bool
819 is_a_helper <gimple_statement_catch *>::test (gimple gs)
821 return gs->code == GIMPLE_CATCH;
824 template <>
825 template <>
826 inline bool
827 is_a_helper <gimple_statement_cond *>::test (gimple gs)
829 return gs->code == GIMPLE_COND;
832 template <>
833 template <>
834 inline bool
835 is_a_helper <gimple_statement_resx *>::test (gimple gs)
837 return gs->code == GIMPLE_RESX;
840 template <>
841 template <>
842 inline bool
843 is_a_helper <gimple_statement_eh_dispatch *>::test (gimple gs)
845 return gs->code == GIMPLE_EH_DISPATCH;
848 template <>
849 template <>
850 inline bool
851 is_a_helper <gimple_statement_eh_else *>::test (gimple gs)
853 return gs->code == GIMPLE_EH_ELSE;
856 template <>
857 template <>
858 inline bool
859 is_a_helper <gimple_statement_eh_filter *>::test (gimple gs)
861 return gs->code == GIMPLE_EH_FILTER;
864 template <>
865 template <>
866 inline bool
867 is_a_helper <gimple_statement_eh_mnt *>::test (gimple gs)
869 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
872 template <>
873 template <>
874 inline bool
875 is_a_helper <gimple_statement_omp_atomic_load *>::test (gimple gs)
877 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
880 template <>
881 template <>
882 inline bool
883 is_a_helper <gimple_statement_omp_atomic_store *>::test (gimple gs)
885 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
888 template <>
889 template <>
890 inline bool
891 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
893 return gs->code == GIMPLE_OMP_RETURN;
896 template <>
897 template <>
898 inline bool
899 is_a_helper <gimple_statement_omp_continue *>::test (gimple gs)
901 return gs->code == GIMPLE_OMP_CONTINUE;
904 template <>
905 template <>
906 inline bool
907 is_a_helper <gimple_statement_omp_critical *>::test (gimple gs)
909 return gs->code == GIMPLE_OMP_CRITICAL;
912 template <>
913 template <>
914 inline bool
915 is_a_helper <gimple_statement_omp_for *>::test (gimple gs)
917 return gs->code == GIMPLE_OMP_FOR;
920 template <>
921 template <>
922 inline bool
923 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
925 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
928 template <>
929 template <>
930 inline bool
931 is_a_helper <gimple_statement_omp_parallel *>::test (gimple gs)
933 return gs->code == GIMPLE_OMP_PARALLEL;
936 template <>
937 template <>
938 inline bool
939 is_a_helper <gimple_statement_omp_target *>::test (gimple gs)
941 return gs->code == GIMPLE_OMP_TARGET;
944 template <>
945 template <>
946 inline bool
947 is_a_helper <gimple_statement_omp_sections *>::test (gimple gs)
949 return gs->code == GIMPLE_OMP_SECTIONS;
952 template <>
953 template <>
954 inline bool
955 is_a_helper <gimple_statement_omp_single *>::test (gimple gs)
957 return gs->code == GIMPLE_OMP_SINGLE;
960 template <>
961 template <>
962 inline bool
963 is_a_helper <gimple_statement_omp_teams *>::test (gimple gs)
965 return gs->code == GIMPLE_OMP_TEAMS;
968 template <>
969 template <>
970 inline bool
971 is_a_helper <gimple_statement_omp_task *>::test (gimple gs)
973 return gs->code == GIMPLE_OMP_TASK;
976 template <>
977 template <>
978 inline bool
979 is_a_helper <gimple_statement_phi *>::test (gimple gs)
981 return gs->code == GIMPLE_PHI;
984 template <>
985 template <>
986 inline bool
987 is_a_helper <gimple_statement_transaction *>::test (gimple gs)
989 return gs->code == GIMPLE_TRANSACTION;
992 template <>
993 template <>
994 inline bool
995 is_a_helper <gimple_statement_switch *>::test (gimple gs)
997 return gs->code == GIMPLE_SWITCH;
1000 template <>
1001 template <>
1002 inline bool
1003 is_a_helper <gimple_statement_try *>::test (gimple gs)
1005 return gs->code == GIMPLE_TRY;
1008 template <>
1009 template <>
1010 inline bool
1011 is_a_helper <gimple_statement_wce *>::test (gimple gs)
1013 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1016 template <>
1017 template <>
1018 inline bool
1019 is_a_helper <const gimple_statement_asm *>::test (const_gimple gs)
1021 return gs->code == GIMPLE_ASM;
1024 template <>
1025 template <>
1026 inline bool
1027 is_a_helper <const gimple_statement_bind *>::test (const_gimple gs)
1029 return gs->code == GIMPLE_BIND;
1032 template <>
1033 template <>
1034 inline bool
1035 is_a_helper <const gimple_statement_call *>::test (const_gimple gs)
1037 return gs->code == GIMPLE_CALL;
1040 template <>
1041 template <>
1042 inline bool
1043 is_a_helper <const gimple_statement_catch *>::test (const_gimple gs)
1045 return gs->code == GIMPLE_CATCH;
1048 template <>
1049 template <>
1050 inline bool
1051 is_a_helper <const gimple_statement_resx *>::test (const_gimple gs)
1053 return gs->code == GIMPLE_RESX;
1056 template <>
1057 template <>
1058 inline bool
1059 is_a_helper <const gimple_statement_eh_dispatch *>::test (const_gimple gs)
1061 return gs->code == GIMPLE_EH_DISPATCH;
1064 template <>
1065 template <>
1066 inline bool
1067 is_a_helper <const gimple_statement_eh_filter *>::test (const_gimple gs)
1069 return gs->code == GIMPLE_EH_FILTER;
1072 template <>
1073 template <>
1074 inline bool
1075 is_a_helper <const gimple_statement_omp_atomic_load *>::test (const_gimple gs)
1077 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1080 template <>
1081 template <>
1082 inline bool
1083 is_a_helper <const gimple_statement_omp_atomic_store *>::test (const_gimple gs)
1085 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1088 template <>
1089 template <>
1090 inline bool
1091 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1093 return gs->code == GIMPLE_OMP_RETURN;
1096 template <>
1097 template <>
1098 inline bool
1099 is_a_helper <const gimple_statement_omp_continue *>::test (const_gimple gs)
1101 return gs->code == GIMPLE_OMP_CONTINUE;
1104 template <>
1105 template <>
1106 inline bool
1107 is_a_helper <const gimple_statement_omp_critical *>::test (const_gimple gs)
1109 return gs->code == GIMPLE_OMP_CRITICAL;
1112 template <>
1113 template <>
1114 inline bool
1115 is_a_helper <const gimple_statement_omp_for *>::test (const_gimple gs)
1117 return gs->code == GIMPLE_OMP_FOR;
1120 template <>
1121 template <>
1122 inline bool
1123 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1125 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1128 template <>
1129 template <>
1130 inline bool
1131 is_a_helper <const gimple_statement_omp_parallel *>::test (const_gimple gs)
1133 return gs->code == GIMPLE_OMP_PARALLEL;
1136 template <>
1137 template <>
1138 inline bool
1139 is_a_helper <const gimple_statement_omp_target *>::test (const_gimple gs)
1141 return gs->code == GIMPLE_OMP_TARGET;
1144 template <>
1145 template <>
1146 inline bool
1147 is_a_helper <const gimple_statement_omp_sections *>::test (const_gimple gs)
1149 return gs->code == GIMPLE_OMP_SECTIONS;
1152 template <>
1153 template <>
1154 inline bool
1155 is_a_helper <const gimple_statement_omp_single *>::test (const_gimple gs)
1157 return gs->code == GIMPLE_OMP_SINGLE;
1160 template <>
1161 template <>
1162 inline bool
1163 is_a_helper <const gimple_statement_omp_teams *>::test (const_gimple gs)
1165 return gs->code == GIMPLE_OMP_TEAMS;
1168 template <>
1169 template <>
1170 inline bool
1171 is_a_helper <const gimple_statement_omp_task *>::test (const_gimple gs)
1173 return gs->code == GIMPLE_OMP_TASK;
1176 template <>
1177 template <>
1178 inline bool
1179 is_a_helper <const gimple_statement_phi *>::test (const_gimple gs)
1181 return gs->code == GIMPLE_PHI;
1184 template <>
1185 template <>
1186 inline bool
1187 is_a_helper <const gimple_statement_transaction *>::test (const_gimple gs)
1189 return gs->code == GIMPLE_TRANSACTION;
1192 /* Offset in bytes to the location of the operand vector.
1193 Zero if there is no operand vector for this tuple structure. */
1194 extern size_t const gimple_ops_offset_[];
1196 /* Map GIMPLE codes to GSS codes. */
1197 extern enum gimple_statement_structure_enum const gss_for_code_[];
1199 /* This variable holds the currently expanded gimple statement for purposes
1200 of comminucating the profile info to the builtin expanders. */
1201 extern gimple currently_expanding_gimple_stmt;
1203 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1204 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1205 gimple gimple_build_return (tree);
1206 void gimple_call_reset_alias_info (gimple);
1207 gimple gimple_build_call_vec (tree, vec<tree> );
1208 gimple gimple_build_call (tree, unsigned, ...);
1209 gimple gimple_build_call_valist (tree, unsigned, va_list);
1210 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1211 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1212 gimple gimple_build_call_from_tree (tree);
1213 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1214 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1215 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1216 tree, tree, tree CXX_MEM_STAT_INFO);
1217 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1218 tree, tree CXX_MEM_STAT_INFO);
1219 gimple_cond gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1220 gimple_cond gimple_build_cond_from_tree (tree, tree, tree);
1221 void gimple_cond_set_condition_from_tree (gimple_cond, tree);
1222 gimple gimple_build_label (tree label);
1223 gimple gimple_build_goto (tree dest);
1224 gimple gimple_build_nop (void);
1225 gimple_bind gimple_build_bind (tree, gimple_seq, tree);
1226 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1227 vec<tree, va_gc> *, vec<tree, va_gc> *,
1228 vec<tree, va_gc> *);
1229 gimple gimple_build_catch (tree, gimple_seq);
1230 gimple gimple_build_eh_filter (tree, gimple_seq);
1231 gimple gimple_build_eh_must_not_throw (tree);
1232 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1233 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1234 enum gimple_try_flags);
1235 gimple gimple_build_wce (gimple_seq);
1236 gimple gimple_build_resx (int);
1237 gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
1238 gimple_switch gimple_build_switch (tree, tree, vec<tree> );
1239 gimple gimple_build_eh_dispatch (int);
1240 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1241 #define gimple_build_debug_bind(var,val,stmt) \
1242 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1243 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1244 #define gimple_build_debug_source_bind(var,val,stmt) \
1245 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1246 gimple gimple_build_omp_critical (gimple_seq, tree);
1247 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1248 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1249 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1250 gimple gimple_build_omp_section (gimple_seq);
1251 gimple gimple_build_omp_master (gimple_seq);
1252 gimple gimple_build_omp_taskgroup (gimple_seq);
1253 gimple gimple_build_omp_continue (tree, tree);
1254 gimple gimple_build_omp_ordered (gimple_seq);
1255 gimple gimple_build_omp_return (bool);
1256 gimple gimple_build_omp_sections (gimple_seq, tree);
1257 gimple gimple_build_omp_sections_switch (void);
1258 gimple gimple_build_omp_single (gimple_seq, tree);
1259 gimple gimple_build_omp_target (gimple_seq, int, tree);
1260 gimple gimple_build_omp_teams (gimple_seq, tree);
1261 gimple gimple_build_omp_atomic_load (tree, tree);
1262 gimple gimple_build_omp_atomic_store (tree);
1263 gimple gimple_build_transaction (gimple_seq, tree);
1264 gimple gimple_build_predict (enum br_predictor, enum prediction);
1265 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1266 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1267 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1268 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1269 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1270 location_t);
1271 extern void annotate_all_with_location (gimple_seq, location_t);
1272 bool empty_body_p (gimple_seq);
1273 gimple_seq gimple_seq_copy (gimple_seq);
1274 bool gimple_call_same_target_p (const_gimple, const_gimple);
1275 int gimple_call_flags (const_gimple);
1276 int gimple_call_arg_flags (const_gimple, unsigned);
1277 int gimple_call_return_flags (const_gimple);
1278 bool gimple_assign_copy_p (gimple);
1279 bool gimple_assign_ssa_name_copy_p (gimple);
1280 bool gimple_assign_unary_nop_p (gimple);
1281 void gimple_set_bb (gimple, basic_block);
1282 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1283 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1284 tree, tree, tree);
1285 tree gimple_get_lhs (const_gimple);
1286 void gimple_set_lhs (gimple, tree);
1287 gimple gimple_copy (gimple);
1288 bool gimple_has_side_effects (const_gimple);
1289 bool gimple_could_trap_p_1 (gimple, bool, bool);
1290 bool gimple_could_trap_p (gimple);
1291 bool gimple_assign_rhs_could_trap_p (gimple);
1292 extern void dump_gimple_statistics (void);
1293 unsigned get_gimple_rhs_num_ops (enum tree_code);
1294 extern tree canonicalize_cond_expr_cond (tree);
1295 gimple gimple_call_copy_skip_args (gimple, bitmap);
1296 extern bool gimple_compare_field_offset (tree, tree);
1297 extern tree gimple_unsigned_type (tree);
1298 extern tree gimple_signed_type (tree);
1299 extern alias_set_type gimple_get_alias_set (tree);
1300 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1301 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1302 extern bool gimple_call_builtin_p (const_gimple);
1303 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1304 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1305 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1306 extern void dump_decl_set (FILE *, bitmap);
1307 extern bool nonfreeing_call_p (gimple);
1308 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1309 extern void sort_case_labels (vec<tree> );
1310 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1311 extern void gimple_seq_set_location (gimple_seq , location_t);
1313 /* Formal (expression) temporary table handling: multiple occurrences of
1314 the same scalar expression are evaluated into the same temporary. */
1316 typedef struct gimple_temp_hash_elt
1318 tree val; /* Key */
1319 tree temp; /* Value */
1320 } elt_t;
1322 /* Get the number of the next statement uid to be allocated. */
1323 static inline unsigned int
1324 gimple_stmt_max_uid (struct function *fn)
1326 return fn->last_stmt_uid;
1329 /* Set the number of the next statement uid to be allocated. */
1330 static inline void
1331 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1333 fn->last_stmt_uid = maxid;
1336 /* Set the number of the next statement uid to be allocated. */
1337 static inline unsigned int
1338 inc_gimple_stmt_max_uid (struct function *fn)
1340 return fn->last_stmt_uid++;
1343 /* Return the first node in GIMPLE sequence S. */
1345 static inline gimple_seq_node
1346 gimple_seq_first (gimple_seq s)
1348 return s;
1352 /* Return the first statement in GIMPLE sequence S. */
1354 static inline gimple
1355 gimple_seq_first_stmt (gimple_seq s)
1357 gimple_seq_node n = gimple_seq_first (s);
1358 return n;
1361 /* Return the first statement in GIMPLE sequence S as a gimple_bind,
1362 verifying that it has code GIMPLE_BIND in a checked build. */
1364 static inline gimple_bind
1365 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1367 gimple_seq_node n = gimple_seq_first (s);
1368 return as_a <gimple_bind> (n);
1372 /* Return the last node in GIMPLE sequence S. */
1374 static inline gimple_seq_node
1375 gimple_seq_last (gimple_seq s)
1377 return s ? s->prev : NULL;
1381 /* Return the last statement in GIMPLE sequence S. */
1383 static inline gimple
1384 gimple_seq_last_stmt (gimple_seq s)
1386 gimple_seq_node n = gimple_seq_last (s);
1387 return n;
1391 /* Set the last node in GIMPLE sequence *PS to LAST. */
1393 static inline void
1394 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1396 (*ps)->prev = last;
1400 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1402 static inline void
1403 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1405 *ps = first;
1409 /* Return true if GIMPLE sequence S is empty. */
1411 static inline bool
1412 gimple_seq_empty_p (gimple_seq s)
1414 return s == NULL;
1417 /* Allocate a new sequence and initialize its first element with STMT. */
1419 static inline gimple_seq
1420 gimple_seq_alloc_with_stmt (gimple stmt)
1422 gimple_seq seq = NULL;
1423 gimple_seq_add_stmt (&seq, stmt);
1424 return seq;
1428 /* Returns the sequence of statements in BB. */
1430 static inline gimple_seq
1431 bb_seq (const_basic_block bb)
1433 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1436 static inline gimple_seq *
1437 bb_seq_addr (basic_block bb)
1439 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1442 /* Sets the sequence of statements in BB to SEQ. */
1444 static inline void
1445 set_bb_seq (basic_block bb, gimple_seq seq)
1447 gcc_checking_assert (!(bb->flags & BB_RTL));
1448 bb->il.gimple.seq = seq;
1452 /* Return the code for GIMPLE statement G. */
1454 static inline enum gimple_code
1455 gimple_code (const_gimple g)
1457 return g->code;
1461 /* Return the GSS code used by a GIMPLE code. */
1463 static inline enum gimple_statement_structure_enum
1464 gss_for_code (enum gimple_code code)
1466 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1467 return gss_for_code_[code];
1471 /* Return which GSS code is used by GS. */
1473 static inline enum gimple_statement_structure_enum
1474 gimple_statement_structure (gimple gs)
1476 return gss_for_code (gimple_code (gs));
1480 /* Return true if statement G has sub-statements. This is only true for
1481 High GIMPLE statements. */
1483 static inline bool
1484 gimple_has_substatements (gimple g)
1486 switch (gimple_code (g))
1488 case GIMPLE_BIND:
1489 case GIMPLE_CATCH:
1490 case GIMPLE_EH_FILTER:
1491 case GIMPLE_EH_ELSE:
1492 case GIMPLE_TRY:
1493 case GIMPLE_OMP_FOR:
1494 case GIMPLE_OMP_MASTER:
1495 case GIMPLE_OMP_TASKGROUP:
1496 case GIMPLE_OMP_ORDERED:
1497 case GIMPLE_OMP_SECTION:
1498 case GIMPLE_OMP_PARALLEL:
1499 case GIMPLE_OMP_TASK:
1500 case GIMPLE_OMP_SECTIONS:
1501 case GIMPLE_OMP_SINGLE:
1502 case GIMPLE_OMP_TARGET:
1503 case GIMPLE_OMP_TEAMS:
1504 case GIMPLE_OMP_CRITICAL:
1505 case GIMPLE_WITH_CLEANUP_EXPR:
1506 case GIMPLE_TRANSACTION:
1507 return true;
1509 default:
1510 return false;
1515 /* Return the basic block holding statement G. */
1517 static inline basic_block
1518 gimple_bb (const_gimple g)
1520 return g->bb;
1524 /* Return the lexical scope block holding statement G. */
1526 static inline tree
1527 gimple_block (const_gimple g)
1529 return LOCATION_BLOCK (g->location);
1533 /* Set BLOCK to be the lexical scope block holding statement G. */
1535 static inline void
1536 gimple_set_block (gimple g, tree block)
1538 if (block)
1539 g->location =
1540 COMBINE_LOCATION_DATA (line_table, g->location, block);
1541 else
1542 g->location = LOCATION_LOCUS (g->location);
1546 /* Return location information for statement G. */
1548 static inline location_t
1549 gimple_location (const_gimple g)
1551 return g->location;
1554 /* Return location information for statement G if g is not NULL.
1555 Otherwise, UNKNOWN_LOCATION is returned. */
1557 static inline location_t
1558 gimple_location_safe (const_gimple g)
1560 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1563 /* Return pointer to location information for statement G. */
1565 static inline const location_t *
1566 gimple_location_ptr (const_gimple g)
1568 return &g->location;
1572 /* Set location information for statement G. */
1574 static inline void
1575 gimple_set_location (gimple g, location_t location)
1577 g->location = location;
1581 /* Return true if G contains location information. */
1583 static inline bool
1584 gimple_has_location (const_gimple g)
1586 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1590 /* Return the file name of the location of STMT. */
1592 static inline const char *
1593 gimple_filename (const_gimple stmt)
1595 return LOCATION_FILE (gimple_location (stmt));
1599 /* Return the line number of the location of STMT. */
1601 static inline int
1602 gimple_lineno (const_gimple stmt)
1604 return LOCATION_LINE (gimple_location (stmt));
1608 /* Determine whether SEQ is a singleton. */
1610 static inline bool
1611 gimple_seq_singleton_p (gimple_seq seq)
1613 return ((gimple_seq_first (seq) != NULL)
1614 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1617 /* Return true if no warnings should be emitted for statement STMT. */
1619 static inline bool
1620 gimple_no_warning_p (const_gimple stmt)
1622 return stmt->no_warning;
1625 /* Set the no_warning flag of STMT to NO_WARNING. */
1627 static inline void
1628 gimple_set_no_warning (gimple stmt, bool no_warning)
1630 stmt->no_warning = (unsigned) no_warning;
1633 /* Set the visited status on statement STMT to VISITED_P. */
1635 static inline void
1636 gimple_set_visited (gimple stmt, bool visited_p)
1638 stmt->visited = (unsigned) visited_p;
1642 /* Return the visited status for statement STMT. */
1644 static inline bool
1645 gimple_visited_p (gimple stmt)
1647 return stmt->visited;
1651 /* Set pass local flag PLF on statement STMT to VAL_P. */
1653 static inline void
1654 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1656 if (val_p)
1657 stmt->plf |= (unsigned int) plf;
1658 else
1659 stmt->plf &= ~((unsigned int) plf);
1663 /* Return the value of pass local flag PLF on statement STMT. */
1665 static inline unsigned int
1666 gimple_plf (gimple stmt, enum plf_mask plf)
1668 return stmt->plf & ((unsigned int) plf);
1672 /* Set the UID of statement. */
1674 static inline void
1675 gimple_set_uid (gimple g, unsigned uid)
1677 g->uid = uid;
1681 /* Return the UID of statement. */
1683 static inline unsigned
1684 gimple_uid (const_gimple g)
1686 return g->uid;
1690 /* Make statement G a singleton sequence. */
1692 static inline void
1693 gimple_init_singleton (gimple g)
1695 g->next = NULL;
1696 g->prev = g;
1700 /* Return true if GIMPLE statement G has register or memory operands. */
1702 static inline bool
1703 gimple_has_ops (const_gimple g)
1705 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1708 template <>
1709 template <>
1710 inline bool
1711 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1713 return gimple_has_ops (gs);
1716 template <>
1717 template <>
1718 inline bool
1719 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1721 return gimple_has_ops (gs);
1724 /* Return true if GIMPLE statement G has memory operands. */
1726 static inline bool
1727 gimple_has_mem_ops (const_gimple g)
1729 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1732 template <>
1733 template <>
1734 inline bool
1735 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1737 return gimple_has_mem_ops (gs);
1740 template <>
1741 template <>
1742 inline bool
1743 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1745 return gimple_has_mem_ops (gs);
1748 /* Return the set of USE operands for statement G. */
1750 static inline struct use_optype_d *
1751 gimple_use_ops (const_gimple g)
1753 const gimple_statement_with_ops *ops_stmt =
1754 dyn_cast <const gimple_statement_with_ops *> (g);
1755 if (!ops_stmt)
1756 return NULL;
1757 return ops_stmt->use_ops;
1761 /* Set USE to be the set of USE operands for statement G. */
1763 static inline void
1764 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1766 gimple_statement_with_ops *ops_stmt =
1767 as_a <gimple_statement_with_ops *> (g);
1768 ops_stmt->use_ops = use;
1772 /* Return the single VUSE operand of the statement G. */
1774 static inline tree
1775 gimple_vuse (const_gimple g)
1777 const gimple_statement_with_memory_ops *mem_ops_stmt =
1778 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1779 if (!mem_ops_stmt)
1780 return NULL_TREE;
1781 return mem_ops_stmt->vuse;
1784 /* Return the single VDEF operand of the statement G. */
1786 static inline tree
1787 gimple_vdef (const_gimple g)
1789 const gimple_statement_with_memory_ops *mem_ops_stmt =
1790 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1791 if (!mem_ops_stmt)
1792 return NULL_TREE;
1793 return mem_ops_stmt->vdef;
1796 /* Return the single VUSE operand of the statement G. */
1798 static inline tree *
1799 gimple_vuse_ptr (gimple g)
1801 gimple_statement_with_memory_ops *mem_ops_stmt =
1802 dyn_cast <gimple_statement_with_memory_ops *> (g);
1803 if (!mem_ops_stmt)
1804 return NULL;
1805 return &mem_ops_stmt->vuse;
1808 /* Return the single VDEF operand of the statement G. */
1810 static inline tree *
1811 gimple_vdef_ptr (gimple g)
1813 gimple_statement_with_memory_ops *mem_ops_stmt =
1814 dyn_cast <gimple_statement_with_memory_ops *> (g);
1815 if (!mem_ops_stmt)
1816 return NULL;
1817 return &mem_ops_stmt->vdef;
1820 /* Set the single VUSE operand of the statement G. */
1822 static inline void
1823 gimple_set_vuse (gimple g, tree vuse)
1825 gimple_statement_with_memory_ops *mem_ops_stmt =
1826 as_a <gimple_statement_with_memory_ops *> (g);
1827 mem_ops_stmt->vuse = vuse;
1830 /* Set the single VDEF operand of the statement G. */
1832 static inline void
1833 gimple_set_vdef (gimple g, tree vdef)
1835 gimple_statement_with_memory_ops *mem_ops_stmt =
1836 as_a <gimple_statement_with_memory_ops *> (g);
1837 mem_ops_stmt->vdef = vdef;
1841 /* Return true if statement G has operands and the modified field has
1842 been set. */
1844 static inline bool
1845 gimple_modified_p (const_gimple g)
1847 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1851 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1852 a MODIFIED field. */
1854 static inline void
1855 gimple_set_modified (gimple s, bool modifiedp)
1857 if (gimple_has_ops (s))
1858 s->modified = (unsigned) modifiedp;
1862 /* Return the tree code for the expression computed by STMT. This is
1863 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1864 GIMPLE_CALL, return CALL_EXPR as the expression code for
1865 consistency. This is useful when the caller needs to deal with the
1866 three kinds of computation that GIMPLE supports. */
1868 static inline enum tree_code
1869 gimple_expr_code (const_gimple stmt)
1871 enum gimple_code code = gimple_code (stmt);
1872 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1873 return (enum tree_code) stmt->subcode;
1874 else
1876 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1877 return CALL_EXPR;
1882 /* Return true if statement STMT contains volatile operands. */
1884 static inline bool
1885 gimple_has_volatile_ops (const_gimple stmt)
1887 if (gimple_has_mem_ops (stmt))
1888 return stmt->has_volatile_ops;
1889 else
1890 return false;
1894 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1896 static inline void
1897 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1899 if (gimple_has_mem_ops (stmt))
1900 stmt->has_volatile_ops = (unsigned) volatilep;
1903 /* Return true if STMT is in a transaction. */
1905 static inline bool
1906 gimple_in_transaction (gimple stmt)
1908 return bb_in_transaction (gimple_bb (stmt));
1911 /* Return true if statement STMT may access memory. */
1913 static inline bool
1914 gimple_references_memory_p (gimple stmt)
1916 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1920 /* Return the subcode for OMP statement S. */
1922 static inline unsigned
1923 gimple_omp_subcode (const_gimple s)
1925 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1926 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1927 return s->subcode;
1930 /* Set the subcode for OMP statement S to SUBCODE. */
1932 static inline void
1933 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1935 /* We only have 16 bits for the subcode. Assert that we are not
1936 overflowing it. */
1937 gcc_gimple_checking_assert (subcode < (1 << 16));
1938 s->subcode = subcode;
1941 /* Set the nowait flag on OMP_RETURN statement S. */
1943 static inline void
1944 gimple_omp_return_set_nowait (gimple s)
1946 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1947 s->subcode |= GF_OMP_RETURN_NOWAIT;
1951 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1952 flag set. */
1954 static inline bool
1955 gimple_omp_return_nowait_p (const_gimple g)
1957 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1958 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1962 /* Set the LHS of OMP return. */
1964 static inline void
1965 gimple_omp_return_set_lhs (gimple g, tree lhs)
1967 gimple_statement_omp_return *omp_return_stmt =
1968 as_a <gimple_statement_omp_return *> (g);
1969 omp_return_stmt->val = lhs;
1973 /* Get the LHS of OMP return. */
1975 static inline tree
1976 gimple_omp_return_lhs (const_gimple g)
1978 const gimple_statement_omp_return *omp_return_stmt =
1979 as_a <const gimple_statement_omp_return *> (g);
1980 return omp_return_stmt->val;
1984 /* Return a pointer to the LHS of OMP return. */
1986 static inline tree *
1987 gimple_omp_return_lhs_ptr (gimple g)
1989 gimple_statement_omp_return *omp_return_stmt =
1990 as_a <gimple_statement_omp_return *> (g);
1991 return &omp_return_stmt->val;
1995 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1996 flag set. */
1998 static inline bool
1999 gimple_omp_section_last_p (const_gimple g)
2001 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2002 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2006 /* Set the GF_OMP_SECTION_LAST flag on G. */
2008 static inline void
2009 gimple_omp_section_set_last (gimple g)
2011 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2012 g->subcode |= GF_OMP_SECTION_LAST;
2016 /* Return true if OMP parallel statement G has the
2017 GF_OMP_PARALLEL_COMBINED flag set. */
2019 static inline bool
2020 gimple_omp_parallel_combined_p (const_gimple g)
2022 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2023 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2027 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2028 value of COMBINED_P. */
2030 static inline void
2031 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2033 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2034 if (combined_p)
2035 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2036 else
2037 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2041 /* Return true if OMP atomic load/store statement G has the
2042 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2044 static inline bool
2045 gimple_omp_atomic_need_value_p (const_gimple g)
2047 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2048 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2049 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2053 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2055 static inline void
2056 gimple_omp_atomic_set_need_value (gimple g)
2058 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2059 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2060 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2064 /* Return true if OMP atomic load/store statement G has the
2065 GF_OMP_ATOMIC_SEQ_CST flag set. */
2067 static inline bool
2068 gimple_omp_atomic_seq_cst_p (const_gimple g)
2070 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2071 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2072 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2076 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2078 static inline void
2079 gimple_omp_atomic_set_seq_cst (gimple g)
2081 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2082 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2083 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2087 /* Return the number of operands for statement GS. */
2089 static inline unsigned
2090 gimple_num_ops (const_gimple gs)
2092 return gs->num_ops;
2096 /* Set the number of operands for statement GS. */
2098 static inline void
2099 gimple_set_num_ops (gimple gs, unsigned num_ops)
2101 gs->num_ops = num_ops;
2105 /* Return the array of operands for statement GS. */
2107 static inline tree *
2108 gimple_ops (gimple gs)
2110 size_t off;
2112 /* All the tuples have their operand vector at the very bottom
2113 of the structure. Note that those structures that do not
2114 have an operand vector have a zero offset. */
2115 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2116 gcc_gimple_checking_assert (off != 0);
2118 return (tree *) ((char *) gs + off);
2122 /* Return operand I for statement GS. */
2124 static inline tree
2125 gimple_op (const_gimple gs, unsigned i)
2127 if (gimple_has_ops (gs))
2129 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2130 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2132 else
2133 return NULL_TREE;
2136 /* Return a pointer to operand I for statement GS. */
2138 static inline tree *
2139 gimple_op_ptr (const_gimple gs, unsigned i)
2141 if (gimple_has_ops (gs))
2143 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2144 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2146 else
2147 return NULL;
2150 /* Set operand I of statement GS to OP. */
2152 static inline void
2153 gimple_set_op (gimple gs, unsigned i, tree op)
2155 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2157 /* Note. It may be tempting to assert that OP matches
2158 is_gimple_operand, but that would be wrong. Different tuples
2159 accept slightly different sets of tree operands. Each caller
2160 should perform its own validation. */
2161 gimple_ops (gs)[i] = op;
2164 /* Return true if GS is a GIMPLE_ASSIGN. */
2166 static inline bool
2167 is_gimple_assign (const_gimple gs)
2169 return gimple_code (gs) == GIMPLE_ASSIGN;
2172 /* Determine if expression CODE is one of the valid expressions that can
2173 be used on the RHS of GIMPLE assignments. */
2175 static inline enum gimple_rhs_class
2176 get_gimple_rhs_class (enum tree_code code)
2178 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2181 /* Return the LHS of assignment statement GS. */
2183 static inline tree
2184 gimple_assign_lhs (const_gimple gs)
2186 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2187 return gimple_op (gs, 0);
2191 /* Return a pointer to the LHS of assignment statement GS. */
2193 static inline tree *
2194 gimple_assign_lhs_ptr (const_gimple gs)
2196 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2197 return gimple_op_ptr (gs, 0);
2201 /* Set LHS to be the LHS operand of assignment statement GS. */
2203 static inline void
2204 gimple_assign_set_lhs (gimple gs, tree lhs)
2206 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2207 gimple_set_op (gs, 0, lhs);
2209 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2210 SSA_NAME_DEF_STMT (lhs) = gs;
2214 /* Return the first operand on the RHS of assignment statement GS. */
2216 static inline tree
2217 gimple_assign_rhs1 (const_gimple gs)
2219 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2220 return gimple_op (gs, 1);
2224 /* Return a pointer to the first operand on the RHS of assignment
2225 statement GS. */
2227 static inline tree *
2228 gimple_assign_rhs1_ptr (const_gimple gs)
2230 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2231 return gimple_op_ptr (gs, 1);
2234 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2236 static inline void
2237 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2239 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2241 gimple_set_op (gs, 1, rhs);
2245 /* Return the second operand on the RHS of assignment statement GS.
2246 If GS does not have two operands, NULL is returned instead. */
2248 static inline tree
2249 gimple_assign_rhs2 (const_gimple gs)
2251 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2253 if (gimple_num_ops (gs) >= 3)
2254 return gimple_op (gs, 2);
2255 else
2256 return NULL_TREE;
2260 /* Return a pointer to the second operand on the RHS of assignment
2261 statement GS. */
2263 static inline tree *
2264 gimple_assign_rhs2_ptr (const_gimple gs)
2266 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2267 return gimple_op_ptr (gs, 2);
2271 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2273 static inline void
2274 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2276 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2278 gimple_set_op (gs, 2, rhs);
2281 /* Return the third operand on the RHS of assignment statement GS.
2282 If GS does not have two operands, NULL is returned instead. */
2284 static inline tree
2285 gimple_assign_rhs3 (const_gimple gs)
2287 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2289 if (gimple_num_ops (gs) >= 4)
2290 return gimple_op (gs, 3);
2291 else
2292 return NULL_TREE;
2295 /* Return a pointer to the third operand on the RHS of assignment
2296 statement GS. */
2298 static inline tree *
2299 gimple_assign_rhs3_ptr (const_gimple gs)
2301 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2302 return gimple_op_ptr (gs, 3);
2306 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2308 static inline void
2309 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2311 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2313 gimple_set_op (gs, 3, rhs);
2316 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2317 to see only a maximum of two operands. */
2319 static inline void
2320 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2321 tree op1, tree op2)
2323 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2326 /* Returns true if GS is a nontemporal move. */
2328 static inline bool
2329 gimple_assign_nontemporal_move_p (const_gimple gs)
2331 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2332 return gs->nontemporal_move;
2335 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2337 static inline void
2338 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2340 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2341 gs->nontemporal_move = nontemporal;
2345 /* Return the code of the expression computed on the rhs of assignment
2346 statement GS. In case that the RHS is a single object, returns the
2347 tree code of the object. */
2349 static inline enum tree_code
2350 gimple_assign_rhs_code (const_gimple gs)
2352 enum tree_code code;
2353 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2355 code = (enum tree_code) gs->subcode;
2356 /* While we initially set subcode to the TREE_CODE of the rhs for
2357 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2358 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2359 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2360 code = TREE_CODE (gimple_assign_rhs1 (gs));
2362 return code;
2366 /* Set CODE to be the code for the expression computed on the RHS of
2367 assignment S. */
2369 static inline void
2370 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2372 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2373 s->subcode = code;
2377 /* Return the gimple rhs class of the code of the expression computed on
2378 the rhs of assignment statement GS.
2379 This will never return GIMPLE_INVALID_RHS. */
2381 static inline enum gimple_rhs_class
2382 gimple_assign_rhs_class (const_gimple gs)
2384 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2387 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2388 there is no operator associated with the assignment itself.
2389 Unlike gimple_assign_copy_p, this predicate returns true for
2390 any RHS operand, including those that perform an operation
2391 and do not have the semantics of a copy, such as COND_EXPR. */
2393 static inline bool
2394 gimple_assign_single_p (const_gimple gs)
2396 return (is_gimple_assign (gs)
2397 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2400 /* Return true if GS performs a store to its lhs. */
2402 static inline bool
2403 gimple_store_p (const_gimple gs)
2405 tree lhs = gimple_get_lhs (gs);
2406 return lhs && !is_gimple_reg (lhs);
2409 /* Return true if GS is an assignment that loads from its rhs1. */
2411 static inline bool
2412 gimple_assign_load_p (const_gimple gs)
2414 tree rhs;
2415 if (!gimple_assign_single_p (gs))
2416 return false;
2417 rhs = gimple_assign_rhs1 (gs);
2418 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2419 return true;
2420 rhs = get_base_address (rhs);
2421 return (DECL_P (rhs)
2422 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2426 /* Return true if S is a type-cast assignment. */
2428 static inline bool
2429 gimple_assign_cast_p (const_gimple s)
2431 if (is_gimple_assign (s))
2433 enum tree_code sc = gimple_assign_rhs_code (s);
2434 return CONVERT_EXPR_CODE_P (sc)
2435 || sc == VIEW_CONVERT_EXPR
2436 || sc == FIX_TRUNC_EXPR;
2439 return false;
2442 /* Return true if S is a clobber statement. */
2444 static inline bool
2445 gimple_clobber_p (const_gimple s)
2447 return gimple_assign_single_p (s)
2448 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2451 /* Return true if GS is a GIMPLE_CALL. */
2453 static inline bool
2454 is_gimple_call (const_gimple gs)
2456 return gimple_code (gs) == GIMPLE_CALL;
2459 /* Return the LHS of call statement GS. */
2461 static inline tree
2462 gimple_call_lhs (const_gimple gs)
2464 GIMPLE_CHECK (gs, GIMPLE_CALL);
2465 return gimple_op (gs, 0);
2469 /* Return a pointer to the LHS of call statement GS. */
2471 static inline tree *
2472 gimple_call_lhs_ptr (const_gimple gs)
2474 GIMPLE_CHECK (gs, GIMPLE_CALL);
2475 return gimple_op_ptr (gs, 0);
2479 /* Set LHS to be the LHS operand of call statement GS. */
2481 static inline void
2482 gimple_call_set_lhs (gimple gs, tree lhs)
2484 GIMPLE_CHECK (gs, GIMPLE_CALL);
2485 gimple_set_op (gs, 0, lhs);
2486 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2487 SSA_NAME_DEF_STMT (lhs) = gs;
2491 /* Return true if call GS calls an internal-only function, as enumerated
2492 by internal_fn. */
2494 static inline bool
2495 gimple_call_internal_p (const_gimple gs)
2497 GIMPLE_CHECK (gs, GIMPLE_CALL);
2498 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2502 /* Return the target of internal call GS. */
2504 static inline enum internal_fn
2505 gimple_call_internal_fn (const_gimple gs)
2507 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2508 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2511 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2512 that could alter control flow. */
2514 static inline void
2515 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2517 GIMPLE_CHECK (s, GIMPLE_CALL);
2518 if (ctrl_altering_p)
2519 s->subcode |= GF_CALL_CTRL_ALTERING;
2520 else
2521 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2524 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2525 flag is set. Such call could not be a stmt in the middle of a bb. */
2527 static inline bool
2528 gimple_call_ctrl_altering_p (const_gimple gs)
2530 GIMPLE_CHECK (gs, GIMPLE_CALL);
2531 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2535 /* Return the function type of the function called by GS. */
2537 static inline tree
2538 gimple_call_fntype (const_gimple gs)
2540 const gimple_statement_call *call_stmt =
2541 as_a <const gimple_statement_call *> (gs);
2542 if (gimple_call_internal_p (gs))
2543 return NULL_TREE;
2544 return call_stmt->u.fntype;
2547 /* Set the type of the function called by GS to FNTYPE. */
2549 static inline void
2550 gimple_call_set_fntype (gimple gs, tree fntype)
2552 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2553 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2554 call_stmt->u.fntype = fntype;
2558 /* Return the tree node representing the function called by call
2559 statement GS. */
2561 static inline tree
2562 gimple_call_fn (const_gimple gs)
2564 GIMPLE_CHECK (gs, GIMPLE_CALL);
2565 return gimple_op (gs, 1);
2568 /* Return a pointer to the tree node representing the function called by call
2569 statement GS. */
2571 static inline tree *
2572 gimple_call_fn_ptr (const_gimple gs)
2574 GIMPLE_CHECK (gs, GIMPLE_CALL);
2575 return gimple_op_ptr (gs, 1);
2579 /* Set FN to be the function called by call statement GS. */
2581 static inline void
2582 gimple_call_set_fn (gimple gs, tree fn)
2584 GIMPLE_CHECK (gs, GIMPLE_CALL);
2585 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2586 gimple_set_op (gs, 1, fn);
2590 /* Set FNDECL to be the function called by call statement GS. */
2592 static inline void
2593 gimple_call_set_fndecl (gimple gs, tree decl)
2595 GIMPLE_CHECK (gs, GIMPLE_CALL);
2596 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2597 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2601 /* Set internal function FN to be the function called by call statement GS. */
2603 static inline void
2604 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2606 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2607 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2608 call_stmt->u.internal_fn = fn;
2612 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2613 Otherwise return NULL. This function is analogous to
2614 get_callee_fndecl in tree land. */
2616 static inline tree
2617 gimple_call_fndecl (const_gimple gs)
2619 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2623 /* Return the type returned by call statement GS. */
2625 static inline tree
2626 gimple_call_return_type (const_gimple gs)
2628 tree type = gimple_call_fntype (gs);
2630 if (type == NULL_TREE)
2631 return TREE_TYPE (gimple_call_lhs (gs));
2633 /* The type returned by a function is the type of its
2634 function type. */
2635 return TREE_TYPE (type);
2639 /* Return the static chain for call statement GS. */
2641 static inline tree
2642 gimple_call_chain (const_gimple gs)
2644 GIMPLE_CHECK (gs, GIMPLE_CALL);
2645 return gimple_op (gs, 2);
2649 /* Return a pointer to the static chain for call statement GS. */
2651 static inline tree *
2652 gimple_call_chain_ptr (const_gimple gs)
2654 GIMPLE_CHECK (gs, GIMPLE_CALL);
2655 return gimple_op_ptr (gs, 2);
2658 /* Set CHAIN to be the static chain for call statement GS. */
2660 static inline void
2661 gimple_call_set_chain (gimple gs, tree chain)
2663 GIMPLE_CHECK (gs, GIMPLE_CALL);
2665 gimple_set_op (gs, 2, chain);
2669 /* Return the number of arguments used by call statement GS. */
2671 static inline unsigned
2672 gimple_call_num_args (const_gimple gs)
2674 unsigned num_ops;
2675 GIMPLE_CHECK (gs, GIMPLE_CALL);
2676 num_ops = gimple_num_ops (gs);
2677 return num_ops - 3;
2681 /* Return the argument at position INDEX for call statement GS. */
2683 static inline tree
2684 gimple_call_arg (const_gimple gs, unsigned index)
2686 GIMPLE_CHECK (gs, GIMPLE_CALL);
2687 return gimple_op (gs, index + 3);
2691 /* Return a pointer to the argument at position INDEX for call
2692 statement GS. */
2694 static inline tree *
2695 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2697 GIMPLE_CHECK (gs, GIMPLE_CALL);
2698 return gimple_op_ptr (gs, index + 3);
2702 /* Set ARG to be the argument at position INDEX for call statement GS. */
2704 static inline void
2705 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2707 GIMPLE_CHECK (gs, GIMPLE_CALL);
2708 gimple_set_op (gs, index + 3, arg);
2712 /* If TAIL_P is true, mark call statement S as being a tail call
2713 (i.e., a call just before the exit of a function). These calls are
2714 candidate for tail call optimization. */
2716 static inline void
2717 gimple_call_set_tail (gimple s, bool tail_p)
2719 GIMPLE_CHECK (s, GIMPLE_CALL);
2720 if (tail_p)
2721 s->subcode |= GF_CALL_TAILCALL;
2722 else
2723 s->subcode &= ~GF_CALL_TAILCALL;
2727 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2729 static inline bool
2730 gimple_call_tail_p (gimple s)
2732 GIMPLE_CHECK (s, GIMPLE_CALL);
2733 return (s->subcode & GF_CALL_TAILCALL) != 0;
2737 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2738 slot optimization. This transformation uses the target of the call
2739 expansion as the return slot for calls that return in memory. */
2741 static inline void
2742 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2744 GIMPLE_CHECK (s, GIMPLE_CALL);
2745 if (return_slot_opt_p)
2746 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2747 else
2748 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2752 /* Return true if S is marked for return slot optimization. */
2754 static inline bool
2755 gimple_call_return_slot_opt_p (gimple s)
2757 GIMPLE_CHECK (s, GIMPLE_CALL);
2758 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2762 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2763 thunk to the thunked-to function. */
2765 static inline void
2766 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2768 GIMPLE_CHECK (s, GIMPLE_CALL);
2769 if (from_thunk_p)
2770 s->subcode |= GF_CALL_FROM_THUNK;
2771 else
2772 s->subcode &= ~GF_CALL_FROM_THUNK;
2776 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2778 static inline bool
2779 gimple_call_from_thunk_p (gimple s)
2781 GIMPLE_CHECK (s, GIMPLE_CALL);
2782 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2786 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2787 argument pack in its argument list. */
2789 static inline void
2790 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2792 GIMPLE_CHECK (s, GIMPLE_CALL);
2793 if (pass_arg_pack_p)
2794 s->subcode |= GF_CALL_VA_ARG_PACK;
2795 else
2796 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2800 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2801 argument pack in its argument list. */
2803 static inline bool
2804 gimple_call_va_arg_pack_p (gimple s)
2806 GIMPLE_CHECK (s, GIMPLE_CALL);
2807 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2811 /* Return true if S is a noreturn call. */
2813 static inline bool
2814 gimple_call_noreturn_p (gimple s)
2816 GIMPLE_CHECK (s, GIMPLE_CALL);
2817 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2821 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2822 even if the called function can throw in other cases. */
2824 static inline void
2825 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2827 GIMPLE_CHECK (s, GIMPLE_CALL);
2828 if (nothrow_p)
2829 s->subcode |= GF_CALL_NOTHROW;
2830 else
2831 s->subcode &= ~GF_CALL_NOTHROW;
2834 /* Return true if S is a nothrow call. */
2836 static inline bool
2837 gimple_call_nothrow_p (gimple s)
2839 GIMPLE_CHECK (s, GIMPLE_CALL);
2840 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2843 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2844 is known to be emitted for VLA objects. Those are wrapped by
2845 stack_save/stack_restore calls and hence can't lead to unbounded
2846 stack growth even when they occur in loops. */
2848 static inline void
2849 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2851 GIMPLE_CHECK (s, GIMPLE_CALL);
2852 if (for_var)
2853 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2854 else
2855 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2858 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2860 static inline bool
2861 gimple_call_alloca_for_var_p (gimple s)
2863 GIMPLE_CHECK (s, GIMPLE_CALL);
2864 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2867 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2869 static inline void
2870 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2872 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2873 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2874 dest_call->subcode = orig_call->subcode;
2878 /* Return a pointer to the points-to solution for the set of call-used
2879 variables of the call CALL. */
2881 static inline struct pt_solution *
2882 gimple_call_use_set (gimple call)
2884 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2885 return &call_stmt->call_used;
2889 /* Return a pointer to the points-to solution for the set of call-used
2890 variables of the call CALL. */
2892 static inline struct pt_solution *
2893 gimple_call_clobber_set (gimple call)
2895 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2896 return &call_stmt->call_clobbered;
2900 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2901 non-NULL lhs. */
2903 static inline bool
2904 gimple_has_lhs (gimple stmt)
2906 return (is_gimple_assign (stmt)
2907 || (is_gimple_call (stmt)
2908 && gimple_call_lhs (stmt) != NULL_TREE));
2912 /* Return the code of the predicate computed by conditional statement GS. */
2914 static inline enum tree_code
2915 gimple_cond_code (const_gimple gs)
2917 GIMPLE_CHECK (gs, GIMPLE_COND);
2918 return (enum tree_code) gs->subcode;
2922 /* Set CODE to be the predicate code for the conditional statement GS. */
2924 static inline void
2925 gimple_cond_set_code (gimple gs, enum tree_code code)
2927 GIMPLE_CHECK (gs, GIMPLE_COND);
2928 gs->subcode = code;
2932 /* Return the LHS of the predicate computed by conditional statement GS. */
2934 static inline tree
2935 gimple_cond_lhs (const_gimple gs)
2937 GIMPLE_CHECK (gs, GIMPLE_COND);
2938 return gimple_op (gs, 0);
2941 /* Return the pointer to the LHS of the predicate computed by conditional
2942 statement GS. */
2944 static inline tree *
2945 gimple_cond_lhs_ptr (const_gimple gs)
2947 GIMPLE_CHECK (gs, GIMPLE_COND);
2948 return gimple_op_ptr (gs, 0);
2951 /* Set LHS to be the LHS operand of the predicate computed by
2952 conditional statement GS. */
2954 static inline void
2955 gimple_cond_set_lhs (gimple gs, tree lhs)
2957 GIMPLE_CHECK (gs, GIMPLE_COND);
2958 gimple_set_op (gs, 0, lhs);
2962 /* Return the RHS operand of the predicate computed by conditional GS. */
2964 static inline tree
2965 gimple_cond_rhs (const_gimple gs)
2967 GIMPLE_CHECK (gs, GIMPLE_COND);
2968 return gimple_op (gs, 1);
2971 /* Return the pointer to the RHS operand of the predicate computed by
2972 conditional GS. */
2974 static inline tree *
2975 gimple_cond_rhs_ptr (const_gimple gs)
2977 GIMPLE_CHECK (gs, GIMPLE_COND);
2978 return gimple_op_ptr (gs, 1);
2982 /* Set RHS to be the RHS operand of the predicate computed by
2983 conditional statement GS. */
2985 static inline void
2986 gimple_cond_set_rhs (gimple gs, tree rhs)
2988 GIMPLE_CHECK (gs, GIMPLE_COND);
2989 gimple_set_op (gs, 1, rhs);
2993 /* Return the label used by conditional statement GS when its
2994 predicate evaluates to true. */
2996 static inline tree
2997 gimple_cond_true_label (const_gimple gs)
2999 GIMPLE_CHECK (gs, GIMPLE_COND);
3000 return gimple_op (gs, 2);
3004 /* Set LABEL to be the label used by conditional statement GS when its
3005 predicate evaluates to true. */
3007 static inline void
3008 gimple_cond_set_true_label (gimple gs, tree label)
3010 GIMPLE_CHECK (gs, GIMPLE_COND);
3011 gimple_set_op (gs, 2, label);
3015 /* Set LABEL to be the label used by conditional statement GS when its
3016 predicate evaluates to false. */
3018 static inline void
3019 gimple_cond_set_false_label (gimple gs, tree label)
3021 GIMPLE_CHECK (gs, GIMPLE_COND);
3022 gimple_set_op (gs, 3, label);
3026 /* Return the label used by conditional statement GS when its
3027 predicate evaluates to false. */
3029 static inline tree
3030 gimple_cond_false_label (const_gimple gs)
3032 GIMPLE_CHECK (gs, GIMPLE_COND);
3033 return gimple_op (gs, 3);
3037 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3039 static inline void
3040 gimple_cond_make_false (gimple gs)
3042 gimple_cond_set_lhs (gs, boolean_true_node);
3043 gimple_cond_set_rhs (gs, boolean_false_node);
3044 gs->subcode = EQ_EXPR;
3048 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3050 static inline void
3051 gimple_cond_make_true (gimple gs)
3053 gimple_cond_set_lhs (gs, boolean_true_node);
3054 gimple_cond_set_rhs (gs, boolean_true_node);
3055 gs->subcode = EQ_EXPR;
3058 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3059 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3061 static inline bool
3062 gimple_cond_true_p (const_gimple_cond gs)
3064 tree lhs = gimple_cond_lhs (gs);
3065 tree rhs = gimple_cond_rhs (gs);
3066 enum tree_code code = gimple_cond_code (gs);
3068 if (lhs != boolean_true_node && lhs != boolean_false_node)
3069 return false;
3071 if (rhs != boolean_true_node && rhs != boolean_false_node)
3072 return false;
3074 if (code == NE_EXPR && lhs != rhs)
3075 return true;
3077 if (code == EQ_EXPR && lhs == rhs)
3078 return true;
3080 return false;
3083 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3084 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3086 static inline bool
3087 gimple_cond_false_p (const_gimple_cond gs)
3089 tree lhs = gimple_cond_lhs (gs);
3090 tree rhs = gimple_cond_rhs (gs);
3091 enum tree_code code = gimple_cond_code (gs);
3093 if (lhs != boolean_true_node && lhs != boolean_false_node)
3094 return false;
3096 if (rhs != boolean_true_node && rhs != boolean_false_node)
3097 return false;
3099 if (code == NE_EXPR && lhs == rhs)
3100 return true;
3102 if (code == EQ_EXPR && lhs != rhs)
3103 return true;
3105 return false;
3108 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3110 static inline void
3111 gimple_cond_set_condition (gimple_cond stmt, enum tree_code code, tree lhs,
3112 tree rhs)
3114 gimple_cond_set_code (stmt, code);
3115 gimple_cond_set_lhs (stmt, lhs);
3116 gimple_cond_set_rhs (stmt, rhs);
3119 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3121 static inline tree
3122 gimple_label_label (const_gimple gs)
3124 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3125 return gimple_op (gs, 0);
3129 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3130 GS. */
3132 static inline void
3133 gimple_label_set_label (gimple gs, tree label)
3135 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3136 gimple_set_op (gs, 0, label);
3140 /* Return the destination of the unconditional jump GS. */
3142 static inline tree
3143 gimple_goto_dest (const_gimple gs)
3145 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3146 return gimple_op (gs, 0);
3150 /* Set DEST to be the destination of the unconditonal jump GS. */
3152 static inline void
3153 gimple_goto_set_dest (gimple gs, tree dest)
3155 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3156 gimple_set_op (gs, 0, dest);
3160 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3162 static inline tree
3163 gimple_bind_vars (const_gimple_bind bind_stmt)
3165 return bind_stmt->vars;
3169 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3170 statement GS. */
3172 static inline void
3173 gimple_bind_set_vars (gimple_bind bind_stmt, tree vars)
3175 bind_stmt->vars = vars;
3179 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3180 statement GS. */
3182 static inline void
3183 gimple_bind_append_vars (gimple_bind bind_stmt, tree vars)
3185 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3189 static inline gimple_seq *
3190 gimple_bind_body_ptr (gimple_bind bind_stmt)
3192 return &bind_stmt->body;
3195 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3197 static inline gimple_seq
3198 gimple_bind_body (gimple_bind gs)
3200 return *gimple_bind_body_ptr (gs);
3204 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3205 statement GS. */
3207 static inline void
3208 gimple_bind_set_body (gimple_bind bind_stmt, gimple_seq seq)
3210 bind_stmt->body = seq;
3214 /* Append a statement to the end of a GIMPLE_BIND's body. */
3216 static inline void
3217 gimple_bind_add_stmt (gimple_bind bind_stmt, gimple stmt)
3219 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3223 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3225 static inline void
3226 gimple_bind_add_seq (gimple_bind bind_stmt, gimple_seq seq)
3228 gimple_seq_add_seq (&bind_stmt->body, seq);
3232 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3233 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3235 static inline tree
3236 gimple_bind_block (const_gimple_bind bind_stmt)
3238 return bind_stmt->block;
3242 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3243 statement GS. */
3245 static inline void
3246 gimple_bind_set_block (gimple_bind bind_stmt, tree block)
3248 gcc_gimple_checking_assert (block == NULL_TREE
3249 || TREE_CODE (block) == BLOCK);
3250 bind_stmt->block = block;
3254 /* Return the number of input operands for GIMPLE_ASM GS. */
3256 static inline unsigned
3257 gimple_asm_ninputs (const_gimple gs)
3259 const gimple_statement_asm *asm_stmt =
3260 as_a <const gimple_statement_asm *> (gs);
3261 return asm_stmt->ni;
3265 /* Return the number of output operands for GIMPLE_ASM GS. */
3267 static inline unsigned
3268 gimple_asm_noutputs (const_gimple gs)
3270 const gimple_statement_asm *asm_stmt =
3271 as_a <const gimple_statement_asm *> (gs);
3272 return asm_stmt->no;
3276 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3278 static inline unsigned
3279 gimple_asm_nclobbers (const_gimple gs)
3281 const gimple_statement_asm *asm_stmt =
3282 as_a <const gimple_statement_asm *> (gs);
3283 return asm_stmt->nc;
3286 /* Return the number of label operands for GIMPLE_ASM GS. */
3288 static inline unsigned
3289 gimple_asm_nlabels (const_gimple gs)
3291 const gimple_statement_asm *asm_stmt =
3292 as_a <const gimple_statement_asm *> (gs);
3293 return asm_stmt->nl;
3296 /* Return input operand INDEX of GIMPLE_ASM GS. */
3298 static inline tree
3299 gimple_asm_input_op (const_gimple gs, unsigned index)
3301 const gimple_statement_asm *asm_stmt =
3302 as_a <const gimple_statement_asm *> (gs);
3303 gcc_gimple_checking_assert (index < asm_stmt->ni);
3304 return gimple_op (gs, index + asm_stmt->no);
3307 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3309 static inline tree *
3310 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3312 const gimple_statement_asm *asm_stmt =
3313 as_a <const gimple_statement_asm *> (gs);
3314 gcc_gimple_checking_assert (index < asm_stmt->ni);
3315 return gimple_op_ptr (gs, index + asm_stmt->no);
3319 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3321 static inline void
3322 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3324 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3325 gcc_gimple_checking_assert (index < asm_stmt->ni
3326 && TREE_CODE (in_op) == TREE_LIST);
3327 gimple_set_op (gs, index + asm_stmt->no, in_op);
3331 /* Return output operand INDEX of GIMPLE_ASM GS. */
3333 static inline tree
3334 gimple_asm_output_op (const_gimple gs, unsigned index)
3336 const gimple_statement_asm *asm_stmt =
3337 as_a <const gimple_statement_asm *> (gs);
3338 gcc_gimple_checking_assert (index < asm_stmt->no);
3339 return gimple_op (gs, index);
3342 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3344 static inline tree *
3345 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3347 const gimple_statement_asm *asm_stmt =
3348 as_a <const gimple_statement_asm *> (gs);
3349 gcc_gimple_checking_assert (index < asm_stmt->no);
3350 return gimple_op_ptr (gs, index);
3354 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3356 static inline void
3357 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3359 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3360 gcc_gimple_checking_assert (index < asm_stmt->no
3361 && TREE_CODE (out_op) == TREE_LIST);
3362 gimple_set_op (gs, index, out_op);
3366 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3368 static inline tree
3369 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3371 const gimple_statement_asm *asm_stmt =
3372 as_a <const gimple_statement_asm *> (gs);
3373 gcc_gimple_checking_assert (index < asm_stmt->nc);
3374 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3378 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3380 static inline void
3381 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3383 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3384 gcc_gimple_checking_assert (index < asm_stmt->nc
3385 && TREE_CODE (clobber_op) == TREE_LIST);
3386 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3389 /* Return label operand INDEX of GIMPLE_ASM GS. */
3391 static inline tree
3392 gimple_asm_label_op (const_gimple gs, unsigned index)
3394 const gimple_statement_asm *asm_stmt =
3395 as_a <const gimple_statement_asm *> (gs);
3396 gcc_gimple_checking_assert (index < asm_stmt->nl);
3397 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3400 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3402 static inline void
3403 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3405 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3406 gcc_gimple_checking_assert (index < asm_stmt->nl
3407 && TREE_CODE (label_op) == TREE_LIST);
3408 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3411 /* Return the string representing the assembly instruction in
3412 GIMPLE_ASM GS. */
3414 static inline const char *
3415 gimple_asm_string (const_gimple gs)
3417 const gimple_statement_asm *asm_stmt =
3418 as_a <const gimple_statement_asm *> (gs);
3419 return asm_stmt->string;
3423 /* Return true if GS is an asm statement marked volatile. */
3425 static inline bool
3426 gimple_asm_volatile_p (const_gimple gs)
3428 GIMPLE_CHECK (gs, GIMPLE_ASM);
3429 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3433 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3435 static inline void
3436 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3438 GIMPLE_CHECK (gs, GIMPLE_ASM);
3439 if (volatile_p)
3440 gs->subcode |= GF_ASM_VOLATILE;
3441 else
3442 gs->subcode &= ~GF_ASM_VOLATILE;
3446 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3448 static inline void
3449 gimple_asm_set_input (gimple gs, bool input_p)
3451 GIMPLE_CHECK (gs, GIMPLE_ASM);
3452 if (input_p)
3453 gs->subcode |= GF_ASM_INPUT;
3454 else
3455 gs->subcode &= ~GF_ASM_INPUT;
3459 /* Return true if asm GS is an ASM_INPUT. */
3461 static inline bool
3462 gimple_asm_input_p (const_gimple gs)
3464 GIMPLE_CHECK (gs, GIMPLE_ASM);
3465 return (gs->subcode & GF_ASM_INPUT) != 0;
3469 /* Return the types handled by GIMPLE_CATCH statement GS. */
3471 static inline tree
3472 gimple_catch_types (const_gimple gs)
3474 const gimple_statement_catch *catch_stmt =
3475 as_a <const gimple_statement_catch *> (gs);
3476 return catch_stmt->types;
3480 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3482 static inline tree *
3483 gimple_catch_types_ptr (gimple gs)
3485 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3486 return &catch_stmt->types;
3490 /* Return a pointer to the GIMPLE sequence representing the body of
3491 the handler of GIMPLE_CATCH statement GS. */
3493 static inline gimple_seq *
3494 gimple_catch_handler_ptr (gimple gs)
3496 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3497 return &catch_stmt->handler;
3501 /* Return the GIMPLE sequence representing the body of the handler of
3502 GIMPLE_CATCH statement GS. */
3504 static inline gimple_seq
3505 gimple_catch_handler (gimple gs)
3507 return *gimple_catch_handler_ptr (gs);
3511 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3513 static inline void
3514 gimple_catch_set_types (gimple gs, tree t)
3516 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3517 catch_stmt->types = t;
3521 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3523 static inline void
3524 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3526 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3527 catch_stmt->handler = handler;
3531 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3533 static inline tree
3534 gimple_eh_filter_types (const_gimple gs)
3536 const gimple_statement_eh_filter *eh_filter_stmt =
3537 as_a <const gimple_statement_eh_filter *> (gs);
3538 return eh_filter_stmt->types;
3542 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3543 GS. */
3545 static inline tree *
3546 gimple_eh_filter_types_ptr (gimple gs)
3548 gimple_statement_eh_filter *eh_filter_stmt =
3549 as_a <gimple_statement_eh_filter *> (gs);
3550 return &eh_filter_stmt->types;
3554 /* Return a pointer to the sequence of statement to execute when
3555 GIMPLE_EH_FILTER statement fails. */
3557 static inline gimple_seq *
3558 gimple_eh_filter_failure_ptr (gimple gs)
3560 gimple_statement_eh_filter *eh_filter_stmt =
3561 as_a <gimple_statement_eh_filter *> (gs);
3562 return &eh_filter_stmt->failure;
3566 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3567 statement fails. */
3569 static inline gimple_seq
3570 gimple_eh_filter_failure (gimple gs)
3572 return *gimple_eh_filter_failure_ptr (gs);
3576 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3578 static inline void
3579 gimple_eh_filter_set_types (gimple gs, tree types)
3581 gimple_statement_eh_filter *eh_filter_stmt =
3582 as_a <gimple_statement_eh_filter *> (gs);
3583 eh_filter_stmt->types = types;
3587 /* Set FAILURE to be the sequence of statements to execute on failure
3588 for GIMPLE_EH_FILTER GS. */
3590 static inline void
3591 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3593 gimple_statement_eh_filter *eh_filter_stmt =
3594 as_a <gimple_statement_eh_filter *> (gs);
3595 eh_filter_stmt->failure = failure;
3598 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3600 static inline tree
3601 gimple_eh_must_not_throw_fndecl (gimple gs)
3603 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3604 return eh_mnt_stmt->fndecl;
3607 /* Set the function decl to be called by GS to DECL. */
3609 static inline void
3610 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3612 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3613 eh_mnt_stmt->fndecl = decl;
3616 /* GIMPLE_EH_ELSE accessors. */
3618 static inline gimple_seq *
3619 gimple_eh_else_n_body_ptr (gimple gs)
3621 gimple_statement_eh_else *eh_else_stmt =
3622 as_a <gimple_statement_eh_else *> (gs);
3623 return &eh_else_stmt->n_body;
3626 static inline gimple_seq
3627 gimple_eh_else_n_body (gimple gs)
3629 return *gimple_eh_else_n_body_ptr (gs);
3632 static inline gimple_seq *
3633 gimple_eh_else_e_body_ptr (gimple gs)
3635 gimple_statement_eh_else *eh_else_stmt =
3636 as_a <gimple_statement_eh_else *> (gs);
3637 return &eh_else_stmt->e_body;
3640 static inline gimple_seq
3641 gimple_eh_else_e_body (gimple gs)
3643 return *gimple_eh_else_e_body_ptr (gs);
3646 static inline void
3647 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3649 gimple_statement_eh_else *eh_else_stmt =
3650 as_a <gimple_statement_eh_else *> (gs);
3651 eh_else_stmt->n_body = seq;
3654 static inline void
3655 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3657 gimple_statement_eh_else *eh_else_stmt =
3658 as_a <gimple_statement_eh_else *> (gs);
3659 eh_else_stmt->e_body = seq;
3662 /* GIMPLE_TRY accessors. */
3664 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3665 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3667 static inline enum gimple_try_flags
3668 gimple_try_kind (const_gimple gs)
3670 GIMPLE_CHECK (gs, GIMPLE_TRY);
3671 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3675 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3677 static inline void
3678 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3680 GIMPLE_CHECK (gs, GIMPLE_TRY);
3681 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3682 || kind == GIMPLE_TRY_FINALLY);
3683 if (gimple_try_kind (gs) != kind)
3684 gs->subcode = (unsigned int) kind;
3688 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3690 static inline bool
3691 gimple_try_catch_is_cleanup (const_gimple gs)
3693 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3694 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3698 /* Return a pointer to the sequence of statements used as the
3699 body for GIMPLE_TRY GS. */
3701 static inline gimple_seq *
3702 gimple_try_eval_ptr (gimple gs)
3704 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3705 return &try_stmt->eval;
3709 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3711 static inline gimple_seq
3712 gimple_try_eval (gimple gs)
3714 return *gimple_try_eval_ptr (gs);
3718 /* Return a pointer to the sequence of statements used as the cleanup body for
3719 GIMPLE_TRY GS. */
3721 static inline gimple_seq *
3722 gimple_try_cleanup_ptr (gimple gs)
3724 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3725 return &try_stmt->cleanup;
3729 /* Return the sequence of statements used as the cleanup body for
3730 GIMPLE_TRY GS. */
3732 static inline gimple_seq
3733 gimple_try_cleanup (gimple gs)
3735 return *gimple_try_cleanup_ptr (gs);
3739 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3741 static inline void
3742 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3744 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3745 if (catch_is_cleanup)
3746 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3747 else
3748 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3752 /* Set EVAL to be the sequence of statements to use as the body for
3753 GIMPLE_TRY GS. */
3755 static inline void
3756 gimple_try_set_eval (gimple gs, gimple_seq eval)
3758 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3759 try_stmt->eval = eval;
3763 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3764 body for GIMPLE_TRY GS. */
3766 static inline void
3767 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3769 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3770 try_stmt->cleanup = cleanup;
3774 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3776 static inline gimple_seq *
3777 gimple_wce_cleanup_ptr (gimple gs)
3779 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3780 return &wce_stmt->cleanup;
3784 /* Return the cleanup sequence for cleanup statement GS. */
3786 static inline gimple_seq
3787 gimple_wce_cleanup (gimple gs)
3789 return *gimple_wce_cleanup_ptr (gs);
3793 /* Set CLEANUP to be the cleanup sequence for GS. */
3795 static inline void
3796 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3798 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3799 wce_stmt->cleanup = cleanup;
3803 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3805 static inline bool
3806 gimple_wce_cleanup_eh_only (const_gimple gs)
3808 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3809 return gs->subcode != 0;
3813 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3815 static inline void
3816 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3818 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3819 gs->subcode = (unsigned int) eh_only_p;
3823 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3825 static inline unsigned
3826 gimple_phi_capacity (const_gimple gs)
3828 const gimple_statement_phi *phi_stmt =
3829 as_a <const gimple_statement_phi *> (gs);
3830 return phi_stmt->capacity;
3834 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3835 be exactly the number of incoming edges for the basic block holding
3836 GS. */
3838 static inline unsigned
3839 gimple_phi_num_args (const_gimple gs)
3841 const gimple_statement_phi *phi_stmt =
3842 as_a <const gimple_statement_phi *> (gs);
3843 return phi_stmt->nargs;
3847 /* Return the SSA name created by GIMPLE_PHI GS. */
3849 static inline tree
3850 gimple_phi_result (const_gimple gs)
3852 const gimple_statement_phi *phi_stmt =
3853 as_a <const gimple_statement_phi *> (gs);
3854 return phi_stmt->result;
3857 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3859 static inline tree *
3860 gimple_phi_result_ptr (gimple gs)
3862 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3863 return &phi_stmt->result;
3866 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3868 static inline void
3869 gimple_phi_set_result (gimple gs, tree result)
3871 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3872 phi_stmt->result = result;
3873 if (result && TREE_CODE (result) == SSA_NAME)
3874 SSA_NAME_DEF_STMT (result) = gs;
3878 /* Return the PHI argument corresponding to incoming edge INDEX for
3879 GIMPLE_PHI GS. */
3881 static inline struct phi_arg_d *
3882 gimple_phi_arg (gimple gs, unsigned index)
3884 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3885 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3886 return &(phi_stmt->args[index]);
3889 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3890 for GIMPLE_PHI GS. */
3892 static inline void
3893 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3895 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3896 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3897 phi_stmt->args[index] = *phiarg;
3900 /* Return the PHI nodes for basic block BB, or NULL if there are no
3901 PHI nodes. */
3903 static inline gimple_seq
3904 phi_nodes (const_basic_block bb)
3906 gcc_checking_assert (!(bb->flags & BB_RTL));
3907 return bb->il.gimple.phi_nodes;
3910 /* Return a pointer to the PHI nodes for basic block BB. */
3912 static inline gimple_seq *
3913 phi_nodes_ptr (basic_block bb)
3915 gcc_checking_assert (!(bb->flags & BB_RTL));
3916 return &bb->il.gimple.phi_nodes;
3919 /* Return the tree operand for argument I of PHI node GS. */
3921 static inline tree
3922 gimple_phi_arg_def (gimple gs, size_t index)
3924 return gimple_phi_arg (gs, index)->def;
3928 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3930 static inline tree *
3931 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3933 return &gimple_phi_arg (gs, index)->def;
3936 /* Return the edge associated with argument I of phi node GS. */
3938 static inline edge
3939 gimple_phi_arg_edge (gimple gs, size_t i)
3941 return EDGE_PRED (gimple_bb (gs), i);
3944 /* Return the source location of gimple argument I of phi node GS. */
3946 static inline source_location
3947 gimple_phi_arg_location (gimple gs, size_t i)
3949 return gimple_phi_arg (gs, i)->locus;
3952 /* Return the source location of the argument on edge E of phi node GS. */
3954 static inline source_location
3955 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3957 return gimple_phi_arg (gs, e->dest_idx)->locus;
3960 /* Set the source location of gimple argument I of phi node GS to LOC. */
3962 static inline void
3963 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3965 gimple_phi_arg (gs, i)->locus = loc;
3968 /* Return TRUE if argument I of phi node GS has a location record. */
3970 static inline bool
3971 gimple_phi_arg_has_location (gimple gs, size_t i)
3973 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3977 /* Return the region number for GIMPLE_RESX GS. */
3979 static inline int
3980 gimple_resx_region (const_gimple gs)
3982 const gimple_statement_resx *resx_stmt =
3983 as_a <const gimple_statement_resx *> (gs);
3984 return resx_stmt->region;
3987 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3989 static inline void
3990 gimple_resx_set_region (gimple gs, int region)
3992 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
3993 resx_stmt->region = region;
3996 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3998 static inline int
3999 gimple_eh_dispatch_region (const_gimple gs)
4001 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
4002 as_a <const gimple_statement_eh_dispatch *> (gs);
4003 return eh_dispatch_stmt->region;
4006 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
4008 static inline void
4009 gimple_eh_dispatch_set_region (gimple gs, int region)
4011 gimple_statement_eh_dispatch *eh_dispatch_stmt =
4012 as_a <gimple_statement_eh_dispatch *> (gs);
4013 eh_dispatch_stmt->region = region;
4016 /* Return the number of labels associated with the switch statement GS. */
4018 static inline unsigned
4019 gimple_switch_num_labels (const_gimple_switch gs)
4021 unsigned num_ops;
4022 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4023 num_ops = gimple_num_ops (gs);
4024 gcc_gimple_checking_assert (num_ops > 1);
4025 return num_ops - 1;
4029 /* Set NLABELS to be the number of labels for the switch statement GS. */
4031 static inline void
4032 gimple_switch_set_num_labels (gimple_switch g, unsigned nlabels)
4034 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4035 gimple_set_num_ops (g, nlabels + 1);
4039 /* Return the index variable used by the switch statement GS. */
4041 static inline tree
4042 gimple_switch_index (const_gimple gs)
4044 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4045 return gimple_op (gs, 0);
4049 /* Return a pointer to the index variable for the switch statement GS. */
4051 static inline tree *
4052 gimple_switch_index_ptr (const_gimple gs)
4054 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4055 return gimple_op_ptr (gs, 0);
4059 /* Set INDEX to be the index variable for switch statement GS. */
4061 static inline void
4062 gimple_switch_set_index (gimple_switch gs, tree index)
4064 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4065 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4066 gimple_set_op (gs, 0, index);
4070 /* Return the label numbered INDEX. The default label is 0, followed by any
4071 labels in a switch statement. */
4073 static inline tree
4074 gimple_switch_label (const_gimple_switch gs, unsigned index)
4076 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4077 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4078 return gimple_op (gs, index + 1);
4081 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4083 static inline void
4084 gimple_switch_set_label (gimple_switch gs, unsigned index, tree label)
4086 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4087 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4088 && (label == NULL_TREE
4089 || TREE_CODE (label) == CASE_LABEL_EXPR));
4090 gimple_set_op (gs, index + 1, label);
4093 /* Return the default label for a switch statement. */
4095 static inline tree
4096 gimple_switch_default_label (const_gimple_switch gs)
4098 tree label = gimple_switch_label (gs, 0);
4099 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4100 return label;
4103 /* Set the default label for a switch statement. */
4105 static inline void
4106 gimple_switch_set_default_label (gimple_switch gs, tree label)
4108 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4109 gimple_switch_set_label (gs, 0, label);
4112 /* Return true if GS is a GIMPLE_DEBUG statement. */
4114 static inline bool
4115 is_gimple_debug (const_gimple gs)
4117 return gimple_code (gs) == GIMPLE_DEBUG;
4120 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4122 static inline bool
4123 gimple_debug_bind_p (const_gimple s)
4125 if (is_gimple_debug (s))
4126 return s->subcode == GIMPLE_DEBUG_BIND;
4128 return false;
4131 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4133 static inline tree
4134 gimple_debug_bind_get_var (gimple dbg)
4136 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4137 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4138 return gimple_op (dbg, 0);
4141 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4142 statement. */
4144 static inline tree
4145 gimple_debug_bind_get_value (gimple dbg)
4147 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4148 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4149 return gimple_op (dbg, 1);
4152 /* Return a pointer to the value bound to the variable in a
4153 GIMPLE_DEBUG bind statement. */
4155 static inline tree *
4156 gimple_debug_bind_get_value_ptr (gimple dbg)
4158 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4159 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4160 return gimple_op_ptr (dbg, 1);
4163 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4165 static inline void
4166 gimple_debug_bind_set_var (gimple dbg, tree var)
4168 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4169 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4170 gimple_set_op (dbg, 0, var);
4173 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4174 statement. */
4176 static inline void
4177 gimple_debug_bind_set_value (gimple dbg, tree value)
4179 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4180 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4181 gimple_set_op (dbg, 1, value);
4184 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4185 optimized away. */
4186 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4188 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4189 statement. */
4191 static inline void
4192 gimple_debug_bind_reset_value (gimple dbg)
4194 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4195 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4196 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4199 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4200 value. */
4202 static inline bool
4203 gimple_debug_bind_has_value_p (gimple dbg)
4205 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4206 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4207 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4210 #undef GIMPLE_DEBUG_BIND_NOVALUE
4212 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4214 static inline bool
4215 gimple_debug_source_bind_p (const_gimple s)
4217 if (is_gimple_debug (s))
4218 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4220 return false;
4223 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4225 static inline tree
4226 gimple_debug_source_bind_get_var (gimple dbg)
4228 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4229 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4230 return gimple_op (dbg, 0);
4233 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4234 statement. */
4236 static inline tree
4237 gimple_debug_source_bind_get_value (gimple dbg)
4239 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4240 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4241 return gimple_op (dbg, 1);
4244 /* Return a pointer to the value bound to the variable in a
4245 GIMPLE_DEBUG source bind statement. */
4247 static inline tree *
4248 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4250 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4251 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4252 return gimple_op_ptr (dbg, 1);
4255 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4257 static inline void
4258 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4260 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4261 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4262 gimple_set_op (dbg, 0, var);
4265 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4266 statement. */
4268 static inline void
4269 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4271 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4272 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4273 gimple_set_op (dbg, 1, value);
4276 /* Return the line number for EXPR, or return -1 if we have no line
4277 number information for it. */
4278 static inline int
4279 get_lineno (const_gimple stmt)
4281 location_t loc;
4283 if (!stmt)
4284 return -1;
4286 loc = gimple_location (stmt);
4287 if (loc == UNKNOWN_LOCATION)
4288 return -1;
4290 return LOCATION_LINE (loc);
4293 /* Return a pointer to the body for the OMP statement GS. */
4295 static inline gimple_seq *
4296 gimple_omp_body_ptr (gimple gs)
4298 return &static_cast <gimple_statement_omp *> (gs)->body;
4301 /* Return the body for the OMP statement GS. */
4303 static inline gimple_seq
4304 gimple_omp_body (gimple gs)
4306 return *gimple_omp_body_ptr (gs);
4309 /* Set BODY to be the body for the OMP statement GS. */
4311 static inline void
4312 gimple_omp_set_body (gimple gs, gimple_seq body)
4314 static_cast <gimple_statement_omp *> (gs)->body = body;
4318 /* Return the name associated with OMP_CRITICAL statement GS. */
4320 static inline tree
4321 gimple_omp_critical_name (const_gimple gs)
4323 const gimple_statement_omp_critical *omp_critical_stmt =
4324 as_a <const gimple_statement_omp_critical *> (gs);
4325 return omp_critical_stmt->name;
4329 /* Return a pointer to the name associated with OMP critical statement GS. */
4331 static inline tree *
4332 gimple_omp_critical_name_ptr (gimple gs)
4334 gimple_statement_omp_critical *omp_critical_stmt =
4335 as_a <gimple_statement_omp_critical *> (gs);
4336 return &omp_critical_stmt->name;
4340 /* Set NAME to be the name associated with OMP critical statement GS. */
4342 static inline void
4343 gimple_omp_critical_set_name (gimple gs, tree name)
4345 gimple_statement_omp_critical *omp_critical_stmt =
4346 as_a <gimple_statement_omp_critical *> (gs);
4347 omp_critical_stmt->name = name;
4351 /* Return the kind of OMP for statemement. */
4353 static inline int
4354 gimple_omp_for_kind (const_gimple g)
4356 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4357 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4361 /* Set the OMP for kind. */
4363 static inline void
4364 gimple_omp_for_set_kind (gimple g, int kind)
4366 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4367 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4368 | (kind & GF_OMP_FOR_KIND_MASK);
4372 /* Return true if OMP for statement G has the
4373 GF_OMP_FOR_COMBINED flag set. */
4375 static inline bool
4376 gimple_omp_for_combined_p (const_gimple g)
4378 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4379 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4383 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4384 value of COMBINED_P. */
4386 static inline void
4387 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4389 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4390 if (combined_p)
4391 g->subcode |= GF_OMP_FOR_COMBINED;
4392 else
4393 g->subcode &= ~GF_OMP_FOR_COMBINED;
4397 /* Return true if OMP for statement G has the
4398 GF_OMP_FOR_COMBINED_INTO flag set. */
4400 static inline bool
4401 gimple_omp_for_combined_into_p (const_gimple g)
4403 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4404 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4408 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4409 value of COMBINED_P. */
4411 static inline void
4412 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4414 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4415 if (combined_p)
4416 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4417 else
4418 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4422 /* Return the clauses associated with OMP_FOR GS. */
4424 static inline tree
4425 gimple_omp_for_clauses (const_gimple gs)
4427 const gimple_statement_omp_for *omp_for_stmt =
4428 as_a <const gimple_statement_omp_for *> (gs);
4429 return omp_for_stmt->clauses;
4433 /* Return a pointer to the OMP_FOR GS. */
4435 static inline tree *
4436 gimple_omp_for_clauses_ptr (gimple gs)
4438 gimple_statement_omp_for *omp_for_stmt =
4439 as_a <gimple_statement_omp_for *> (gs);
4440 return &omp_for_stmt->clauses;
4444 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4446 static inline void
4447 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4449 gimple_statement_omp_for *omp_for_stmt =
4450 as_a <gimple_statement_omp_for *> (gs);
4451 omp_for_stmt->clauses = clauses;
4455 /* Get the collapse count of OMP_FOR GS. */
4457 static inline size_t
4458 gimple_omp_for_collapse (gimple gs)
4460 gimple_statement_omp_for *omp_for_stmt =
4461 as_a <gimple_statement_omp_for *> (gs);
4462 return omp_for_stmt->collapse;
4466 /* Return the index variable for OMP_FOR GS. */
4468 static inline tree
4469 gimple_omp_for_index (const_gimple gs, size_t i)
4471 const gimple_statement_omp_for *omp_for_stmt =
4472 as_a <const gimple_statement_omp_for *> (gs);
4473 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4474 return omp_for_stmt->iter[i].index;
4478 /* Return a pointer to the index variable for OMP_FOR GS. */
4480 static inline tree *
4481 gimple_omp_for_index_ptr (gimple gs, size_t i)
4483 gimple_statement_omp_for *omp_for_stmt =
4484 as_a <gimple_statement_omp_for *> (gs);
4485 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4486 return &omp_for_stmt->iter[i].index;
4490 /* Set INDEX to be the index variable for OMP_FOR GS. */
4492 static inline void
4493 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4495 gimple_statement_omp_for *omp_for_stmt =
4496 as_a <gimple_statement_omp_for *> (gs);
4497 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4498 omp_for_stmt->iter[i].index = index;
4502 /* Return the initial value for OMP_FOR GS. */
4504 static inline tree
4505 gimple_omp_for_initial (const_gimple gs, size_t i)
4507 const gimple_statement_omp_for *omp_for_stmt =
4508 as_a <const gimple_statement_omp_for *> (gs);
4509 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4510 return omp_for_stmt->iter[i].initial;
4514 /* Return a pointer to the initial value for OMP_FOR GS. */
4516 static inline tree *
4517 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4519 gimple_statement_omp_for *omp_for_stmt =
4520 as_a <gimple_statement_omp_for *> (gs);
4521 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4522 return &omp_for_stmt->iter[i].initial;
4526 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4528 static inline void
4529 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4531 gimple_statement_omp_for *omp_for_stmt =
4532 as_a <gimple_statement_omp_for *> (gs);
4533 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4534 omp_for_stmt->iter[i].initial = initial;
4538 /* Return the final value for OMP_FOR GS. */
4540 static inline tree
4541 gimple_omp_for_final (const_gimple gs, size_t i)
4543 const gimple_statement_omp_for *omp_for_stmt =
4544 as_a <const gimple_statement_omp_for *> (gs);
4545 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4546 return omp_for_stmt->iter[i].final;
4550 /* Return a pointer to the final value for OMP_FOR GS. */
4552 static inline tree *
4553 gimple_omp_for_final_ptr (gimple gs, size_t i)
4555 gimple_statement_omp_for *omp_for_stmt =
4556 as_a <gimple_statement_omp_for *> (gs);
4557 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4558 return &omp_for_stmt->iter[i].final;
4562 /* Set FINAL to be the final value for OMP_FOR GS. */
4564 static inline void
4565 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4567 gimple_statement_omp_for *omp_for_stmt =
4568 as_a <gimple_statement_omp_for *> (gs);
4569 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4570 omp_for_stmt->iter[i].final = final;
4574 /* Return the increment value for OMP_FOR GS. */
4576 static inline tree
4577 gimple_omp_for_incr (const_gimple gs, size_t i)
4579 const gimple_statement_omp_for *omp_for_stmt =
4580 as_a <const gimple_statement_omp_for *> (gs);
4581 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4582 return omp_for_stmt->iter[i].incr;
4586 /* Return a pointer to the increment value for OMP_FOR GS. */
4588 static inline tree *
4589 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4591 gimple_statement_omp_for *omp_for_stmt =
4592 as_a <gimple_statement_omp_for *> (gs);
4593 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4594 return &omp_for_stmt->iter[i].incr;
4598 /* Set INCR to be the increment value for OMP_FOR GS. */
4600 static inline void
4601 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4603 gimple_statement_omp_for *omp_for_stmt =
4604 as_a <gimple_statement_omp_for *> (gs);
4605 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4606 omp_for_stmt->iter[i].incr = incr;
4610 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4611 statement GS starts. */
4613 static inline gimple_seq *
4614 gimple_omp_for_pre_body_ptr (gimple gs)
4616 gimple_statement_omp_for *omp_for_stmt =
4617 as_a <gimple_statement_omp_for *> (gs);
4618 return &omp_for_stmt->pre_body;
4622 /* Return the sequence of statements to execute before the OMP_FOR
4623 statement GS starts. */
4625 static inline gimple_seq
4626 gimple_omp_for_pre_body (gimple gs)
4628 return *gimple_omp_for_pre_body_ptr (gs);
4632 /* Set PRE_BODY to be the sequence of statements to execute before the
4633 OMP_FOR statement GS starts. */
4635 static inline void
4636 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4638 gimple_statement_omp_for *omp_for_stmt =
4639 as_a <gimple_statement_omp_for *> (gs);
4640 omp_for_stmt->pre_body = pre_body;
4644 /* Return the clauses associated with OMP_PARALLEL GS. */
4646 static inline tree
4647 gimple_omp_parallel_clauses (const_gimple gs)
4649 const gimple_statement_omp_parallel *omp_parallel_stmt =
4650 as_a <const gimple_statement_omp_parallel *> (gs);
4651 return omp_parallel_stmt->clauses;
4655 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4657 static inline tree *
4658 gimple_omp_parallel_clauses_ptr (gimple gs)
4660 gimple_statement_omp_parallel *omp_parallel_stmt =
4661 as_a <gimple_statement_omp_parallel *> (gs);
4662 return &omp_parallel_stmt->clauses;
4666 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4667 GS. */
4669 static inline void
4670 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4672 gimple_statement_omp_parallel *omp_parallel_stmt =
4673 as_a <gimple_statement_omp_parallel *> (gs);
4674 omp_parallel_stmt->clauses = clauses;
4678 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4680 static inline tree
4681 gimple_omp_parallel_child_fn (const_gimple gs)
4683 const gimple_statement_omp_parallel *omp_parallel_stmt =
4684 as_a <const gimple_statement_omp_parallel *> (gs);
4685 return omp_parallel_stmt->child_fn;
4688 /* Return a pointer to the child function used to hold the body of
4689 OMP_PARALLEL GS. */
4691 static inline tree *
4692 gimple_omp_parallel_child_fn_ptr (gimple gs)
4694 gimple_statement_omp_parallel *omp_parallel_stmt =
4695 as_a <gimple_statement_omp_parallel *> (gs);
4696 return &omp_parallel_stmt->child_fn;
4700 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4702 static inline void
4703 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4705 gimple_statement_omp_parallel *omp_parallel_stmt =
4706 as_a <gimple_statement_omp_parallel *> (gs);
4707 omp_parallel_stmt->child_fn = child_fn;
4711 /* Return the artificial argument used to send variables and values
4712 from the parent to the children threads in OMP_PARALLEL GS. */
4714 static inline tree
4715 gimple_omp_parallel_data_arg (const_gimple gs)
4717 const gimple_statement_omp_parallel *omp_parallel_stmt =
4718 as_a <const gimple_statement_omp_parallel *> (gs);
4719 return omp_parallel_stmt->data_arg;
4723 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4725 static inline tree *
4726 gimple_omp_parallel_data_arg_ptr (gimple gs)
4728 gimple_statement_omp_parallel *omp_parallel_stmt =
4729 as_a <gimple_statement_omp_parallel *> (gs);
4730 return &omp_parallel_stmt->data_arg;
4734 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4736 static inline void
4737 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4739 gimple_statement_omp_parallel *omp_parallel_stmt =
4740 as_a <gimple_statement_omp_parallel *> (gs);
4741 omp_parallel_stmt->data_arg = data_arg;
4745 /* Return the clauses associated with OMP_TASK GS. */
4747 static inline tree
4748 gimple_omp_task_clauses (const_gimple gs)
4750 const gimple_statement_omp_task *omp_task_stmt =
4751 as_a <const gimple_statement_omp_task *> (gs);
4752 return omp_task_stmt->clauses;
4756 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4758 static inline tree *
4759 gimple_omp_task_clauses_ptr (gimple gs)
4761 gimple_statement_omp_task *omp_task_stmt =
4762 as_a <gimple_statement_omp_task *> (gs);
4763 return &omp_task_stmt->clauses;
4767 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4768 GS. */
4770 static inline void
4771 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4773 gimple_statement_omp_task *omp_task_stmt =
4774 as_a <gimple_statement_omp_task *> (gs);
4775 omp_task_stmt->clauses = clauses;
4779 /* Return the child function used to hold the body of OMP_TASK GS. */
4781 static inline tree
4782 gimple_omp_task_child_fn (const_gimple gs)
4784 const gimple_statement_omp_task *omp_task_stmt =
4785 as_a <const gimple_statement_omp_task *> (gs);
4786 return omp_task_stmt->child_fn;
4789 /* Return a pointer to the child function used to hold the body of
4790 OMP_TASK GS. */
4792 static inline tree *
4793 gimple_omp_task_child_fn_ptr (gimple gs)
4795 gimple_statement_omp_task *omp_task_stmt =
4796 as_a <gimple_statement_omp_task *> (gs);
4797 return &omp_task_stmt->child_fn;
4801 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4803 static inline void
4804 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4806 gimple_statement_omp_task *omp_task_stmt =
4807 as_a <gimple_statement_omp_task *> (gs);
4808 omp_task_stmt->child_fn = child_fn;
4812 /* Return the artificial argument used to send variables and values
4813 from the parent to the children threads in OMP_TASK GS. */
4815 static inline tree
4816 gimple_omp_task_data_arg (const_gimple gs)
4818 const gimple_statement_omp_task *omp_task_stmt =
4819 as_a <const gimple_statement_omp_task *> (gs);
4820 return omp_task_stmt->data_arg;
4824 /* Return a pointer to the data argument for OMP_TASK GS. */
4826 static inline tree *
4827 gimple_omp_task_data_arg_ptr (gimple gs)
4829 gimple_statement_omp_task *omp_task_stmt =
4830 as_a <gimple_statement_omp_task *> (gs);
4831 return &omp_task_stmt->data_arg;
4835 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4837 static inline void
4838 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4840 gimple_statement_omp_task *omp_task_stmt =
4841 as_a <gimple_statement_omp_task *> (gs);
4842 omp_task_stmt->data_arg = data_arg;
4846 /* Return the clauses associated with OMP_TASK GS. */
4848 static inline tree
4849 gimple_omp_taskreg_clauses (const_gimple gs)
4851 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4852 as_a <const gimple_statement_omp_taskreg *> (gs);
4853 return omp_taskreg_stmt->clauses;
4857 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4859 static inline tree *
4860 gimple_omp_taskreg_clauses_ptr (gimple gs)
4862 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4863 as_a <gimple_statement_omp_taskreg *> (gs);
4864 return &omp_taskreg_stmt->clauses;
4868 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4869 GS. */
4871 static inline void
4872 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4874 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4875 as_a <gimple_statement_omp_taskreg *> (gs);
4876 omp_taskreg_stmt->clauses = clauses;
4880 /* Return the child function used to hold the body of OMP_TASK GS. */
4882 static inline tree
4883 gimple_omp_taskreg_child_fn (const_gimple gs)
4885 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4886 as_a <const gimple_statement_omp_taskreg *> (gs);
4887 return omp_taskreg_stmt->child_fn;
4890 /* Return a pointer to the child function used to hold the body of
4891 OMP_TASK GS. */
4893 static inline tree *
4894 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4896 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4897 as_a <gimple_statement_omp_taskreg *> (gs);
4898 return &omp_taskreg_stmt->child_fn;
4902 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4904 static inline void
4905 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4907 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4908 as_a <gimple_statement_omp_taskreg *> (gs);
4909 omp_taskreg_stmt->child_fn = child_fn;
4913 /* Return the artificial argument used to send variables and values
4914 from the parent to the children threads in OMP_TASK GS. */
4916 static inline tree
4917 gimple_omp_taskreg_data_arg (const_gimple gs)
4919 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4920 as_a <const gimple_statement_omp_taskreg *> (gs);
4921 return omp_taskreg_stmt->data_arg;
4925 /* Return a pointer to the data argument for OMP_TASK GS. */
4927 static inline tree *
4928 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4930 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4931 as_a <gimple_statement_omp_taskreg *> (gs);
4932 return &omp_taskreg_stmt->data_arg;
4936 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4938 static inline void
4939 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4941 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4942 as_a <gimple_statement_omp_taskreg *> (gs);
4943 omp_taskreg_stmt->data_arg = data_arg;
4947 /* Return the copy function used to hold the body of OMP_TASK GS. */
4949 static inline tree
4950 gimple_omp_task_copy_fn (const_gimple gs)
4952 const gimple_statement_omp_task *omp_task_stmt =
4953 as_a <const gimple_statement_omp_task *> (gs);
4954 return omp_task_stmt->copy_fn;
4957 /* Return a pointer to the copy function used to hold the body of
4958 OMP_TASK GS. */
4960 static inline tree *
4961 gimple_omp_task_copy_fn_ptr (gimple gs)
4963 gimple_statement_omp_task *omp_task_stmt =
4964 as_a <gimple_statement_omp_task *> (gs);
4965 return &omp_task_stmt->copy_fn;
4969 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4971 static inline void
4972 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4974 gimple_statement_omp_task *omp_task_stmt =
4975 as_a <gimple_statement_omp_task *> (gs);
4976 omp_task_stmt->copy_fn = copy_fn;
4980 /* Return size of the data block in bytes in OMP_TASK GS. */
4982 static inline tree
4983 gimple_omp_task_arg_size (const_gimple gs)
4985 const gimple_statement_omp_task *omp_task_stmt =
4986 as_a <const gimple_statement_omp_task *> (gs);
4987 return omp_task_stmt->arg_size;
4991 /* Return a pointer to the data block size for OMP_TASK GS. */
4993 static inline tree *
4994 gimple_omp_task_arg_size_ptr (gimple gs)
4996 gimple_statement_omp_task *omp_task_stmt =
4997 as_a <gimple_statement_omp_task *> (gs);
4998 return &omp_task_stmt->arg_size;
5002 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5004 static inline void
5005 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
5007 gimple_statement_omp_task *omp_task_stmt =
5008 as_a <gimple_statement_omp_task *> (gs);
5009 omp_task_stmt->arg_size = arg_size;
5013 /* Return align of the data block in bytes in OMP_TASK GS. */
5015 static inline tree
5016 gimple_omp_task_arg_align (const_gimple gs)
5018 const gimple_statement_omp_task *omp_task_stmt =
5019 as_a <const gimple_statement_omp_task *> (gs);
5020 return omp_task_stmt->arg_align;
5024 /* Return a pointer to the data block align for OMP_TASK GS. */
5026 static inline tree *
5027 gimple_omp_task_arg_align_ptr (gimple gs)
5029 gimple_statement_omp_task *omp_task_stmt =
5030 as_a <gimple_statement_omp_task *> (gs);
5031 return &omp_task_stmt->arg_align;
5035 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5037 static inline void
5038 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5040 gimple_statement_omp_task *omp_task_stmt =
5041 as_a <gimple_statement_omp_task *> (gs);
5042 omp_task_stmt->arg_align = arg_align;
5046 /* Return the clauses associated with OMP_SINGLE GS. */
5048 static inline tree
5049 gimple_omp_single_clauses (const_gimple gs)
5051 const gimple_statement_omp_single *omp_single_stmt =
5052 as_a <const gimple_statement_omp_single *> (gs);
5053 return omp_single_stmt->clauses;
5057 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5059 static inline tree *
5060 gimple_omp_single_clauses_ptr (gimple gs)
5062 gimple_statement_omp_single *omp_single_stmt =
5063 as_a <gimple_statement_omp_single *> (gs);
5064 return &omp_single_stmt->clauses;
5068 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5070 static inline void
5071 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5073 gimple_statement_omp_single *omp_single_stmt =
5074 as_a <gimple_statement_omp_single *> (gs);
5075 omp_single_stmt->clauses = clauses;
5079 /* Return the clauses associated with OMP_TARGET GS. */
5081 static inline tree
5082 gimple_omp_target_clauses (const_gimple gs)
5084 const gimple_statement_omp_target *omp_target_stmt =
5085 as_a <const gimple_statement_omp_target *> (gs);
5086 return omp_target_stmt->clauses;
5090 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5092 static inline tree *
5093 gimple_omp_target_clauses_ptr (gimple gs)
5095 gimple_statement_omp_target *omp_target_stmt =
5096 as_a <gimple_statement_omp_target *> (gs);
5097 return &omp_target_stmt->clauses;
5101 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5103 static inline void
5104 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5106 gimple_statement_omp_target *omp_target_stmt =
5107 as_a <gimple_statement_omp_target *> (gs);
5108 omp_target_stmt->clauses = clauses;
5112 /* Return the kind of OMP target statemement. */
5114 static inline int
5115 gimple_omp_target_kind (const_gimple g)
5117 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5118 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5122 /* Set the OMP target kind. */
5124 static inline void
5125 gimple_omp_target_set_kind (gimple g, int kind)
5127 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5128 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5129 | (kind & GF_OMP_TARGET_KIND_MASK);
5133 /* Return the child function used to hold the body of OMP_TARGET GS. */
5135 static inline tree
5136 gimple_omp_target_child_fn (const_gimple gs)
5138 const gimple_statement_omp_target *omp_target_stmt =
5139 as_a <const gimple_statement_omp_target *> (gs);
5140 return omp_target_stmt->child_fn;
5143 /* Return a pointer to the child function used to hold the body of
5144 OMP_TARGET GS. */
5146 static inline tree *
5147 gimple_omp_target_child_fn_ptr (gimple gs)
5149 gimple_statement_omp_target *omp_target_stmt =
5150 as_a <gimple_statement_omp_target *> (gs);
5151 return &omp_target_stmt->child_fn;
5155 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5157 static inline void
5158 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5160 gimple_statement_omp_target *omp_target_stmt =
5161 as_a <gimple_statement_omp_target *> (gs);
5162 omp_target_stmt->child_fn = child_fn;
5166 /* Return the artificial argument used to send variables and values
5167 from the parent to the children threads in OMP_TARGET GS. */
5169 static inline tree
5170 gimple_omp_target_data_arg (const_gimple gs)
5172 const gimple_statement_omp_target *omp_target_stmt =
5173 as_a <const gimple_statement_omp_target *> (gs);
5174 return omp_target_stmt->data_arg;
5178 /* Return a pointer to the data argument for OMP_TARGET GS. */
5180 static inline tree *
5181 gimple_omp_target_data_arg_ptr (gimple gs)
5183 gimple_statement_omp_target *omp_target_stmt =
5184 as_a <gimple_statement_omp_target *> (gs);
5185 return &omp_target_stmt->data_arg;
5189 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5191 static inline void
5192 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5194 gimple_statement_omp_target *omp_target_stmt =
5195 as_a <gimple_statement_omp_target *> (gs);
5196 omp_target_stmt->data_arg = data_arg;
5200 /* Return the clauses associated with OMP_TEAMS GS. */
5202 static inline tree
5203 gimple_omp_teams_clauses (const_gimple gs)
5205 const gimple_statement_omp_teams *omp_teams_stmt =
5206 as_a <const gimple_statement_omp_teams *> (gs);
5207 return omp_teams_stmt->clauses;
5211 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5213 static inline tree *
5214 gimple_omp_teams_clauses_ptr (gimple gs)
5216 gimple_statement_omp_teams *omp_teams_stmt =
5217 as_a <gimple_statement_omp_teams *> (gs);
5218 return &omp_teams_stmt->clauses;
5222 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5224 static inline void
5225 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5227 gimple_statement_omp_teams *omp_teams_stmt =
5228 as_a <gimple_statement_omp_teams *> (gs);
5229 omp_teams_stmt->clauses = clauses;
5233 /* Return the clauses associated with OMP_SECTIONS GS. */
5235 static inline tree
5236 gimple_omp_sections_clauses (const_gimple gs)
5238 const gimple_statement_omp_sections *omp_sections_stmt =
5239 as_a <const gimple_statement_omp_sections *> (gs);
5240 return omp_sections_stmt->clauses;
5244 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5246 static inline tree *
5247 gimple_omp_sections_clauses_ptr (gimple gs)
5249 gimple_statement_omp_sections *omp_sections_stmt =
5250 as_a <gimple_statement_omp_sections *> (gs);
5251 return &omp_sections_stmt->clauses;
5255 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5256 GS. */
5258 static inline void
5259 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5261 gimple_statement_omp_sections *omp_sections_stmt =
5262 as_a <gimple_statement_omp_sections *> (gs);
5263 omp_sections_stmt->clauses = clauses;
5267 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5268 in GS. */
5270 static inline tree
5271 gimple_omp_sections_control (const_gimple gs)
5273 const gimple_statement_omp_sections *omp_sections_stmt =
5274 as_a <const gimple_statement_omp_sections *> (gs);
5275 return omp_sections_stmt->control;
5279 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5280 GS. */
5282 static inline tree *
5283 gimple_omp_sections_control_ptr (gimple gs)
5285 gimple_statement_omp_sections *omp_sections_stmt =
5286 as_a <gimple_statement_omp_sections *> (gs);
5287 return &omp_sections_stmt->control;
5291 /* Set CONTROL to be the set of clauses associated with the
5292 GIMPLE_OMP_SECTIONS in GS. */
5294 static inline void
5295 gimple_omp_sections_set_control (gimple gs, tree control)
5297 gimple_statement_omp_sections *omp_sections_stmt =
5298 as_a <gimple_statement_omp_sections *> (gs);
5299 omp_sections_stmt->control = control;
5303 /* Set COND to be the condition code for OMP_FOR GS. */
5305 static inline void
5306 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5308 gimple_statement_omp_for *omp_for_stmt =
5309 as_a <gimple_statement_omp_for *> (gs);
5310 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5311 && i < omp_for_stmt->collapse);
5312 omp_for_stmt->iter[i].cond = cond;
5316 /* Return the condition code associated with OMP_FOR GS. */
5318 static inline enum tree_code
5319 gimple_omp_for_cond (const_gimple gs, size_t i)
5321 const gimple_statement_omp_for *omp_for_stmt =
5322 as_a <const gimple_statement_omp_for *> (gs);
5323 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5324 return omp_for_stmt->iter[i].cond;
5328 /* Set the value being stored in an atomic store. */
5330 static inline void
5331 gimple_omp_atomic_store_set_val (gimple g, tree val)
5333 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5334 as_a <gimple_statement_omp_atomic_store *> (g);
5335 omp_atomic_store_stmt->val = val;
5339 /* Return the value being stored in an atomic store. */
5341 static inline tree
5342 gimple_omp_atomic_store_val (const_gimple g)
5344 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5345 as_a <const gimple_statement_omp_atomic_store *> (g);
5346 return omp_atomic_store_stmt->val;
5350 /* Return a pointer to the value being stored in an atomic store. */
5352 static inline tree *
5353 gimple_omp_atomic_store_val_ptr (gimple g)
5355 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5356 as_a <gimple_statement_omp_atomic_store *> (g);
5357 return &omp_atomic_store_stmt->val;
5361 /* Set the LHS of an atomic load. */
5363 static inline void
5364 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5366 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5367 as_a <gimple_statement_omp_atomic_load *> (g);
5368 omp_atomic_load_stmt->lhs = lhs;
5372 /* Get the LHS of an atomic load. */
5374 static inline tree
5375 gimple_omp_atomic_load_lhs (const_gimple g)
5377 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5378 as_a <const gimple_statement_omp_atomic_load *> (g);
5379 return omp_atomic_load_stmt->lhs;
5383 /* Return a pointer to the LHS of an atomic load. */
5385 static inline tree *
5386 gimple_omp_atomic_load_lhs_ptr (gimple g)
5388 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5389 as_a <gimple_statement_omp_atomic_load *> (g);
5390 return &omp_atomic_load_stmt->lhs;
5394 /* Set the RHS of an atomic load. */
5396 static inline void
5397 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5399 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5400 as_a <gimple_statement_omp_atomic_load *> (g);
5401 omp_atomic_load_stmt->rhs = rhs;
5405 /* Get the RHS of an atomic load. */
5407 static inline tree
5408 gimple_omp_atomic_load_rhs (const_gimple g)
5410 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5411 as_a <const gimple_statement_omp_atomic_load *> (g);
5412 return omp_atomic_load_stmt->rhs;
5416 /* Return a pointer to the RHS of an atomic load. */
5418 static inline tree *
5419 gimple_omp_atomic_load_rhs_ptr (gimple g)
5421 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5422 as_a <gimple_statement_omp_atomic_load *> (g);
5423 return &omp_atomic_load_stmt->rhs;
5427 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5429 static inline tree
5430 gimple_omp_continue_control_def (const_gimple g)
5432 const gimple_statement_omp_continue *omp_continue_stmt =
5433 as_a <const gimple_statement_omp_continue *> (g);
5434 return omp_continue_stmt->control_def;
5437 /* The same as above, but return the address. */
5439 static inline tree *
5440 gimple_omp_continue_control_def_ptr (gimple g)
5442 gimple_statement_omp_continue *omp_continue_stmt =
5443 as_a <gimple_statement_omp_continue *> (g);
5444 return &omp_continue_stmt->control_def;
5447 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5449 static inline void
5450 gimple_omp_continue_set_control_def (gimple g, tree def)
5452 gimple_statement_omp_continue *omp_continue_stmt =
5453 as_a <gimple_statement_omp_continue *> (g);
5454 omp_continue_stmt->control_def = def;
5458 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5460 static inline tree
5461 gimple_omp_continue_control_use (const_gimple g)
5463 const gimple_statement_omp_continue *omp_continue_stmt =
5464 as_a <const gimple_statement_omp_continue *> (g);
5465 return omp_continue_stmt->control_use;
5469 /* The same as above, but return the address. */
5471 static inline tree *
5472 gimple_omp_continue_control_use_ptr (gimple g)
5474 gimple_statement_omp_continue *omp_continue_stmt =
5475 as_a <gimple_statement_omp_continue *> (g);
5476 return &omp_continue_stmt->control_use;
5480 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5482 static inline void
5483 gimple_omp_continue_set_control_use (gimple g, tree use)
5485 gimple_statement_omp_continue *omp_continue_stmt =
5486 as_a <gimple_statement_omp_continue *> (g);
5487 omp_continue_stmt->control_use = use;
5490 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5492 static inline gimple_seq *
5493 gimple_transaction_body_ptr (gimple gs)
5495 gimple_statement_transaction *transaction_stmt =
5496 as_a <gimple_statement_transaction *> (gs);
5497 return &transaction_stmt->body;
5500 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5502 static inline gimple_seq
5503 gimple_transaction_body (gimple gs)
5505 return *gimple_transaction_body_ptr (gs);
5508 /* Return the label associated with a GIMPLE_TRANSACTION. */
5510 static inline tree
5511 gimple_transaction_label (const_gimple gs)
5513 const gimple_statement_transaction *transaction_stmt =
5514 as_a <const gimple_statement_transaction *> (gs);
5515 return transaction_stmt->label;
5518 static inline tree *
5519 gimple_transaction_label_ptr (gimple gs)
5521 gimple_statement_transaction *transaction_stmt =
5522 as_a <gimple_statement_transaction *> (gs);
5523 return &transaction_stmt->label;
5526 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5528 static inline unsigned int
5529 gimple_transaction_subcode (const_gimple gs)
5531 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5532 return gs->subcode;
5535 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5537 static inline void
5538 gimple_transaction_set_body (gimple gs, gimple_seq body)
5540 gimple_statement_transaction *transaction_stmt =
5541 as_a <gimple_statement_transaction *> (gs);
5542 transaction_stmt->body = body;
5545 /* Set the label associated with a GIMPLE_TRANSACTION. */
5547 static inline void
5548 gimple_transaction_set_label (gimple gs, tree label)
5550 gimple_statement_transaction *transaction_stmt =
5551 as_a <gimple_statement_transaction *> (gs);
5552 transaction_stmt->label = label;
5555 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5557 static inline void
5558 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5560 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5561 gs->subcode = subcode;
5565 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5567 static inline tree *
5568 gimple_return_retval_ptr (const_gimple gs)
5570 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5571 return gimple_op_ptr (gs, 0);
5574 /* Return the return value for GIMPLE_RETURN GS. */
5576 static inline tree
5577 gimple_return_retval (const_gimple gs)
5579 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5580 return gimple_op (gs, 0);
5584 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5586 static inline void
5587 gimple_return_set_retval (gimple gs, tree retval)
5589 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5590 gimple_set_op (gs, 0, retval);
5594 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5596 #define CASE_GIMPLE_OMP \
5597 case GIMPLE_OMP_PARALLEL: \
5598 case GIMPLE_OMP_TASK: \
5599 case GIMPLE_OMP_FOR: \
5600 case GIMPLE_OMP_SECTIONS: \
5601 case GIMPLE_OMP_SECTIONS_SWITCH: \
5602 case GIMPLE_OMP_SINGLE: \
5603 case GIMPLE_OMP_TARGET: \
5604 case GIMPLE_OMP_TEAMS: \
5605 case GIMPLE_OMP_SECTION: \
5606 case GIMPLE_OMP_MASTER: \
5607 case GIMPLE_OMP_TASKGROUP: \
5608 case GIMPLE_OMP_ORDERED: \
5609 case GIMPLE_OMP_CRITICAL: \
5610 case GIMPLE_OMP_RETURN: \
5611 case GIMPLE_OMP_ATOMIC_LOAD: \
5612 case GIMPLE_OMP_ATOMIC_STORE: \
5613 case GIMPLE_OMP_CONTINUE
5615 static inline bool
5616 is_gimple_omp (const_gimple stmt)
5618 switch (gimple_code (stmt))
5620 CASE_GIMPLE_OMP:
5621 return true;
5622 default:
5623 return false;
5628 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5630 static inline bool
5631 gimple_nop_p (const_gimple g)
5633 return gimple_code (g) == GIMPLE_NOP;
5637 /* Return true if GS is a GIMPLE_RESX. */
5639 static inline bool
5640 is_gimple_resx (const_gimple gs)
5642 return gimple_code (gs) == GIMPLE_RESX;
5645 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5647 static inline enum br_predictor
5648 gimple_predict_predictor (gimple gs)
5650 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5651 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5655 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5657 static inline void
5658 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5660 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5661 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5662 | (unsigned) predictor;
5666 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5668 static inline enum prediction
5669 gimple_predict_outcome (gimple gs)
5671 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5672 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5676 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5678 static inline void
5679 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5681 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5682 if (outcome == TAKEN)
5683 gs->subcode |= GF_PREDICT_TAKEN;
5684 else
5685 gs->subcode &= ~GF_PREDICT_TAKEN;
5689 /* Return the type of the main expression computed by STMT. Return
5690 void_type_node if the statement computes nothing. */
5692 static inline tree
5693 gimple_expr_type (const_gimple stmt)
5695 enum gimple_code code = gimple_code (stmt);
5697 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5699 tree type;
5700 /* In general we want to pass out a type that can be substituted
5701 for both the RHS and the LHS types if there is a possibly
5702 useless conversion involved. That means returning the
5703 original RHS type as far as we can reconstruct it. */
5704 if (code == GIMPLE_CALL)
5706 if (gimple_call_internal_p (stmt)
5707 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5708 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5709 else
5710 type = gimple_call_return_type (stmt);
5712 else
5713 switch (gimple_assign_rhs_code (stmt))
5715 case POINTER_PLUS_EXPR:
5716 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5717 break;
5719 default:
5720 /* As fallback use the type of the LHS. */
5721 type = TREE_TYPE (gimple_get_lhs (stmt));
5722 break;
5724 return type;
5726 else if (code == GIMPLE_COND)
5727 return boolean_type_node;
5728 else
5729 return void_type_node;
5732 /* Enum and arrays used for allocation stats. Keep in sync with
5733 gimple.c:gimple_alloc_kind_names. */
5734 enum gimple_alloc_kind
5736 gimple_alloc_kind_assign, /* Assignments. */
5737 gimple_alloc_kind_phi, /* PHI nodes. */
5738 gimple_alloc_kind_cond, /* Conditionals. */
5739 gimple_alloc_kind_rest, /* Everything else. */
5740 gimple_alloc_kind_all
5743 extern int gimple_alloc_counts[];
5744 extern int gimple_alloc_sizes[];
5746 /* Return the allocation kind for a given stmt CODE. */
5747 static inline enum gimple_alloc_kind
5748 gimple_alloc_kind (enum gimple_code code)
5750 switch (code)
5752 case GIMPLE_ASSIGN:
5753 return gimple_alloc_kind_assign;
5754 case GIMPLE_PHI:
5755 return gimple_alloc_kind_phi;
5756 case GIMPLE_COND:
5757 return gimple_alloc_kind_cond;
5758 default:
5759 return gimple_alloc_kind_rest;
5763 /* Return true if a location should not be emitted for this statement
5764 by annotate_all_with_location. */
5766 static inline bool
5767 gimple_do_not_emit_location_p (gimple g)
5769 return gimple_plf (g, GF_PLF_1);
5772 /* Mark statement G so a location will not be emitted by
5773 annotate_one_with_location. */
5775 static inline void
5776 gimple_set_do_not_emit_location (gimple g)
5778 /* The PLF flags are initialized to 0 when a new tuple is created,
5779 so no need to initialize it anywhere. */
5780 gimple_set_plf (g, GF_PLF_1, true);
5784 /* Macros for showing usage statistics. */
5785 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5786 ? (x) \
5787 : ((x) < 1024*1024*10 \
5788 ? (x) / 1024 \
5789 : (x) / (1024*1024))))
5791 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5793 #endif /* GCC_GIMPLE_H */