Introduce gimple_bind and use it for accessors.
[official-gcc.git] / gcc / gimple.h
blob812fc2a8cd249c41d021d5aefd84c19cdf1a1df0
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_SWITCH
774 i.e. a switch statement. */
776 struct GTY((tag("GSS_WITH_OPS")))
777 gimple_statement_switch : public gimple_statement_with_ops
779 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
782 template <>
783 template <>
784 inline bool
785 is_a_helper <gimple_statement_asm *>::test (gimple gs)
787 return gs->code == GIMPLE_ASM;
790 template <>
791 template <>
792 inline bool
793 is_a_helper <gimple_statement_bind *>::test (gimple gs)
795 return gs->code == GIMPLE_BIND;
798 template <>
799 template <>
800 inline bool
801 is_a_helper <gimple_statement_call *>::test (gimple gs)
803 return gs->code == GIMPLE_CALL;
806 template <>
807 template <>
808 inline bool
809 is_a_helper <gimple_statement_catch *>::test (gimple gs)
811 return gs->code == GIMPLE_CATCH;
814 template <>
815 template <>
816 inline bool
817 is_a_helper <gimple_statement_resx *>::test (gimple gs)
819 return gs->code == GIMPLE_RESX;
822 template <>
823 template <>
824 inline bool
825 is_a_helper <gimple_statement_eh_dispatch *>::test (gimple gs)
827 return gs->code == GIMPLE_EH_DISPATCH;
830 template <>
831 template <>
832 inline bool
833 is_a_helper <gimple_statement_eh_else *>::test (gimple gs)
835 return gs->code == GIMPLE_EH_ELSE;
838 template <>
839 template <>
840 inline bool
841 is_a_helper <gimple_statement_eh_filter *>::test (gimple gs)
843 return gs->code == GIMPLE_EH_FILTER;
846 template <>
847 template <>
848 inline bool
849 is_a_helper <gimple_statement_eh_mnt *>::test (gimple gs)
851 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
854 template <>
855 template <>
856 inline bool
857 is_a_helper <gimple_statement_omp_atomic_load *>::test (gimple gs)
859 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
862 template <>
863 template <>
864 inline bool
865 is_a_helper <gimple_statement_omp_atomic_store *>::test (gimple gs)
867 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
870 template <>
871 template <>
872 inline bool
873 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
875 return gs->code == GIMPLE_OMP_RETURN;
878 template <>
879 template <>
880 inline bool
881 is_a_helper <gimple_statement_omp_continue *>::test (gimple gs)
883 return gs->code == GIMPLE_OMP_CONTINUE;
886 template <>
887 template <>
888 inline bool
889 is_a_helper <gimple_statement_omp_critical *>::test (gimple gs)
891 return gs->code == GIMPLE_OMP_CRITICAL;
894 template <>
895 template <>
896 inline bool
897 is_a_helper <gimple_statement_omp_for *>::test (gimple gs)
899 return gs->code == GIMPLE_OMP_FOR;
902 template <>
903 template <>
904 inline bool
905 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
907 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
910 template <>
911 template <>
912 inline bool
913 is_a_helper <gimple_statement_omp_parallel *>::test (gimple gs)
915 return gs->code == GIMPLE_OMP_PARALLEL;
918 template <>
919 template <>
920 inline bool
921 is_a_helper <gimple_statement_omp_target *>::test (gimple gs)
923 return gs->code == GIMPLE_OMP_TARGET;
926 template <>
927 template <>
928 inline bool
929 is_a_helper <gimple_statement_omp_sections *>::test (gimple gs)
931 return gs->code == GIMPLE_OMP_SECTIONS;
934 template <>
935 template <>
936 inline bool
937 is_a_helper <gimple_statement_omp_single *>::test (gimple gs)
939 return gs->code == GIMPLE_OMP_SINGLE;
942 template <>
943 template <>
944 inline bool
945 is_a_helper <gimple_statement_omp_teams *>::test (gimple gs)
947 return gs->code == GIMPLE_OMP_TEAMS;
950 template <>
951 template <>
952 inline bool
953 is_a_helper <gimple_statement_omp_task *>::test (gimple gs)
955 return gs->code == GIMPLE_OMP_TASK;
958 template <>
959 template <>
960 inline bool
961 is_a_helper <gimple_statement_phi *>::test (gimple gs)
963 return gs->code == GIMPLE_PHI;
966 template <>
967 template <>
968 inline bool
969 is_a_helper <gimple_statement_transaction *>::test (gimple gs)
971 return gs->code == GIMPLE_TRANSACTION;
974 template <>
975 template <>
976 inline bool
977 is_a_helper <gimple_statement_switch *>::test (gimple gs)
979 return gs->code == GIMPLE_SWITCH;
982 template <>
983 template <>
984 inline bool
985 is_a_helper <gimple_statement_try *>::test (gimple gs)
987 return gs->code == GIMPLE_TRY;
990 template <>
991 template <>
992 inline bool
993 is_a_helper <gimple_statement_wce *>::test (gimple gs)
995 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
998 template <>
999 template <>
1000 inline bool
1001 is_a_helper <const gimple_statement_asm *>::test (const_gimple gs)
1003 return gs->code == GIMPLE_ASM;
1006 template <>
1007 template <>
1008 inline bool
1009 is_a_helper <const gimple_statement_bind *>::test (const_gimple gs)
1011 return gs->code == GIMPLE_BIND;
1014 template <>
1015 template <>
1016 inline bool
1017 is_a_helper <const gimple_statement_call *>::test (const_gimple gs)
1019 return gs->code == GIMPLE_CALL;
1022 template <>
1023 template <>
1024 inline bool
1025 is_a_helper <const gimple_statement_catch *>::test (const_gimple gs)
1027 return gs->code == GIMPLE_CATCH;
1030 template <>
1031 template <>
1032 inline bool
1033 is_a_helper <const gimple_statement_resx *>::test (const_gimple gs)
1035 return gs->code == GIMPLE_RESX;
1038 template <>
1039 template <>
1040 inline bool
1041 is_a_helper <const gimple_statement_eh_dispatch *>::test (const_gimple gs)
1043 return gs->code == GIMPLE_EH_DISPATCH;
1046 template <>
1047 template <>
1048 inline bool
1049 is_a_helper <const gimple_statement_eh_filter *>::test (const_gimple gs)
1051 return gs->code == GIMPLE_EH_FILTER;
1054 template <>
1055 template <>
1056 inline bool
1057 is_a_helper <const gimple_statement_omp_atomic_load *>::test (const_gimple gs)
1059 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1062 template <>
1063 template <>
1064 inline bool
1065 is_a_helper <const gimple_statement_omp_atomic_store *>::test (const_gimple gs)
1067 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1070 template <>
1071 template <>
1072 inline bool
1073 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1075 return gs->code == GIMPLE_OMP_RETURN;
1078 template <>
1079 template <>
1080 inline bool
1081 is_a_helper <const gimple_statement_omp_continue *>::test (const_gimple gs)
1083 return gs->code == GIMPLE_OMP_CONTINUE;
1086 template <>
1087 template <>
1088 inline bool
1089 is_a_helper <const gimple_statement_omp_critical *>::test (const_gimple gs)
1091 return gs->code == GIMPLE_OMP_CRITICAL;
1094 template <>
1095 template <>
1096 inline bool
1097 is_a_helper <const gimple_statement_omp_for *>::test (const_gimple gs)
1099 return gs->code == GIMPLE_OMP_FOR;
1102 template <>
1103 template <>
1104 inline bool
1105 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1107 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1110 template <>
1111 template <>
1112 inline bool
1113 is_a_helper <const gimple_statement_omp_parallel *>::test (const_gimple gs)
1115 return gs->code == GIMPLE_OMP_PARALLEL;
1118 template <>
1119 template <>
1120 inline bool
1121 is_a_helper <const gimple_statement_omp_target *>::test (const_gimple gs)
1123 return gs->code == GIMPLE_OMP_TARGET;
1126 template <>
1127 template <>
1128 inline bool
1129 is_a_helper <const gimple_statement_omp_sections *>::test (const_gimple gs)
1131 return gs->code == GIMPLE_OMP_SECTIONS;
1134 template <>
1135 template <>
1136 inline bool
1137 is_a_helper <const gimple_statement_omp_single *>::test (const_gimple gs)
1139 return gs->code == GIMPLE_OMP_SINGLE;
1142 template <>
1143 template <>
1144 inline bool
1145 is_a_helper <const gimple_statement_omp_teams *>::test (const_gimple gs)
1147 return gs->code == GIMPLE_OMP_TEAMS;
1150 template <>
1151 template <>
1152 inline bool
1153 is_a_helper <const gimple_statement_omp_task *>::test (const_gimple gs)
1155 return gs->code == GIMPLE_OMP_TASK;
1158 template <>
1159 template <>
1160 inline bool
1161 is_a_helper <const gimple_statement_phi *>::test (const_gimple gs)
1163 return gs->code == GIMPLE_PHI;
1166 template <>
1167 template <>
1168 inline bool
1169 is_a_helper <const gimple_statement_transaction *>::test (const_gimple gs)
1171 return gs->code == GIMPLE_TRANSACTION;
1174 /* Offset in bytes to the location of the operand vector.
1175 Zero if there is no operand vector for this tuple structure. */
1176 extern size_t const gimple_ops_offset_[];
1178 /* Map GIMPLE codes to GSS codes. */
1179 extern enum gimple_statement_structure_enum const gss_for_code_[];
1181 /* This variable holds the currently expanded gimple statement for purposes
1182 of comminucating the profile info to the builtin expanders. */
1183 extern gimple currently_expanding_gimple_stmt;
1185 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1186 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1187 gimple gimple_build_return (tree);
1188 void gimple_call_reset_alias_info (gimple);
1189 gimple gimple_build_call_vec (tree, vec<tree> );
1190 gimple gimple_build_call (tree, unsigned, ...);
1191 gimple gimple_build_call_valist (tree, unsigned, va_list);
1192 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1193 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1194 gimple gimple_build_call_from_tree (tree);
1195 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1196 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1197 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1198 tree, tree, tree CXX_MEM_STAT_INFO);
1199 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1200 tree, tree CXX_MEM_STAT_INFO);
1201 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1202 gimple gimple_build_cond_from_tree (tree, tree, tree);
1203 void gimple_cond_set_condition_from_tree (gimple, tree);
1204 gimple gimple_build_label (tree label);
1205 gimple gimple_build_goto (tree dest);
1206 gimple gimple_build_nop (void);
1207 gimple_bind gimple_build_bind (tree, gimple_seq, tree);
1208 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1209 vec<tree, va_gc> *, vec<tree, va_gc> *,
1210 vec<tree, va_gc> *);
1211 gimple gimple_build_catch (tree, gimple_seq);
1212 gimple gimple_build_eh_filter (tree, gimple_seq);
1213 gimple gimple_build_eh_must_not_throw (tree);
1214 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1215 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1216 enum gimple_try_flags);
1217 gimple gimple_build_wce (gimple_seq);
1218 gimple gimple_build_resx (int);
1219 gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
1220 gimple_switch gimple_build_switch (tree, tree, vec<tree> );
1221 gimple gimple_build_eh_dispatch (int);
1222 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1223 #define gimple_build_debug_bind(var,val,stmt) \
1224 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1225 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1226 #define gimple_build_debug_source_bind(var,val,stmt) \
1227 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1228 gimple gimple_build_omp_critical (gimple_seq, tree);
1229 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1230 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1231 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1232 gimple gimple_build_omp_section (gimple_seq);
1233 gimple gimple_build_omp_master (gimple_seq);
1234 gimple gimple_build_omp_taskgroup (gimple_seq);
1235 gimple gimple_build_omp_continue (tree, tree);
1236 gimple gimple_build_omp_ordered (gimple_seq);
1237 gimple gimple_build_omp_return (bool);
1238 gimple gimple_build_omp_sections (gimple_seq, tree);
1239 gimple gimple_build_omp_sections_switch (void);
1240 gimple gimple_build_omp_single (gimple_seq, tree);
1241 gimple gimple_build_omp_target (gimple_seq, int, tree);
1242 gimple gimple_build_omp_teams (gimple_seq, tree);
1243 gimple gimple_build_omp_atomic_load (tree, tree);
1244 gimple gimple_build_omp_atomic_store (tree);
1245 gimple gimple_build_transaction (gimple_seq, tree);
1246 gimple gimple_build_predict (enum br_predictor, enum prediction);
1247 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1248 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1249 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1250 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1251 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1252 location_t);
1253 extern void annotate_all_with_location (gimple_seq, location_t);
1254 bool empty_body_p (gimple_seq);
1255 gimple_seq gimple_seq_copy (gimple_seq);
1256 bool gimple_call_same_target_p (const_gimple, const_gimple);
1257 int gimple_call_flags (const_gimple);
1258 int gimple_call_arg_flags (const_gimple, unsigned);
1259 int gimple_call_return_flags (const_gimple);
1260 bool gimple_assign_copy_p (gimple);
1261 bool gimple_assign_ssa_name_copy_p (gimple);
1262 bool gimple_assign_unary_nop_p (gimple);
1263 void gimple_set_bb (gimple, basic_block);
1264 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1265 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1266 tree, tree, tree);
1267 tree gimple_get_lhs (const_gimple);
1268 void gimple_set_lhs (gimple, tree);
1269 gimple gimple_copy (gimple);
1270 bool gimple_has_side_effects (const_gimple);
1271 bool gimple_could_trap_p_1 (gimple, bool, bool);
1272 bool gimple_could_trap_p (gimple);
1273 bool gimple_assign_rhs_could_trap_p (gimple);
1274 extern void dump_gimple_statistics (void);
1275 unsigned get_gimple_rhs_num_ops (enum tree_code);
1276 extern tree canonicalize_cond_expr_cond (tree);
1277 gimple gimple_call_copy_skip_args (gimple, bitmap);
1278 extern bool gimple_compare_field_offset (tree, tree);
1279 extern tree gimple_unsigned_type (tree);
1280 extern tree gimple_signed_type (tree);
1281 extern alias_set_type gimple_get_alias_set (tree);
1282 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1283 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1284 extern bool gimple_call_builtin_p (const_gimple);
1285 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1286 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1287 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1288 extern void dump_decl_set (FILE *, bitmap);
1289 extern bool nonfreeing_call_p (gimple);
1290 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1291 extern void sort_case_labels (vec<tree> );
1292 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1293 extern void gimple_seq_set_location (gimple_seq , location_t);
1295 /* Formal (expression) temporary table handling: multiple occurrences of
1296 the same scalar expression are evaluated into the same temporary. */
1298 typedef struct gimple_temp_hash_elt
1300 tree val; /* Key */
1301 tree temp; /* Value */
1302 } elt_t;
1304 /* Get the number of the next statement uid to be allocated. */
1305 static inline unsigned int
1306 gimple_stmt_max_uid (struct function *fn)
1308 return fn->last_stmt_uid;
1311 /* Set the number of the next statement uid to be allocated. */
1312 static inline void
1313 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1315 fn->last_stmt_uid = maxid;
1318 /* Set the number of the next statement uid to be allocated. */
1319 static inline unsigned int
1320 inc_gimple_stmt_max_uid (struct function *fn)
1322 return fn->last_stmt_uid++;
1325 /* Return the first node in GIMPLE sequence S. */
1327 static inline gimple_seq_node
1328 gimple_seq_first (gimple_seq s)
1330 return s;
1334 /* Return the first statement in GIMPLE sequence S. */
1336 static inline gimple
1337 gimple_seq_first_stmt (gimple_seq s)
1339 gimple_seq_node n = gimple_seq_first (s);
1340 return n;
1343 /* Return the first statement in GIMPLE sequence S as a gimple_bind,
1344 verifying that it has code GIMPLE_BIND in a checked build. */
1346 static inline gimple_bind
1347 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1349 gimple_seq_node n = gimple_seq_first (s);
1350 return as_a <gimple_bind> (n);
1354 /* Return the last node in GIMPLE sequence S. */
1356 static inline gimple_seq_node
1357 gimple_seq_last (gimple_seq s)
1359 return s ? s->prev : NULL;
1363 /* Return the last statement in GIMPLE sequence S. */
1365 static inline gimple
1366 gimple_seq_last_stmt (gimple_seq s)
1368 gimple_seq_node n = gimple_seq_last (s);
1369 return n;
1373 /* Set the last node in GIMPLE sequence *PS to LAST. */
1375 static inline void
1376 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1378 (*ps)->prev = last;
1382 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1384 static inline void
1385 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1387 *ps = first;
1391 /* Return true if GIMPLE sequence S is empty. */
1393 static inline bool
1394 gimple_seq_empty_p (gimple_seq s)
1396 return s == NULL;
1399 /* Allocate a new sequence and initialize its first element with STMT. */
1401 static inline gimple_seq
1402 gimple_seq_alloc_with_stmt (gimple stmt)
1404 gimple_seq seq = NULL;
1405 gimple_seq_add_stmt (&seq, stmt);
1406 return seq;
1410 /* Returns the sequence of statements in BB. */
1412 static inline gimple_seq
1413 bb_seq (const_basic_block bb)
1415 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1418 static inline gimple_seq *
1419 bb_seq_addr (basic_block bb)
1421 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1424 /* Sets the sequence of statements in BB to SEQ. */
1426 static inline void
1427 set_bb_seq (basic_block bb, gimple_seq seq)
1429 gcc_checking_assert (!(bb->flags & BB_RTL));
1430 bb->il.gimple.seq = seq;
1434 /* Return the code for GIMPLE statement G. */
1436 static inline enum gimple_code
1437 gimple_code (const_gimple g)
1439 return g->code;
1443 /* Return the GSS code used by a GIMPLE code. */
1445 static inline enum gimple_statement_structure_enum
1446 gss_for_code (enum gimple_code code)
1448 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1449 return gss_for_code_[code];
1453 /* Return which GSS code is used by GS. */
1455 static inline enum gimple_statement_structure_enum
1456 gimple_statement_structure (gimple gs)
1458 return gss_for_code (gimple_code (gs));
1462 /* Return true if statement G has sub-statements. This is only true for
1463 High GIMPLE statements. */
1465 static inline bool
1466 gimple_has_substatements (gimple g)
1468 switch (gimple_code (g))
1470 case GIMPLE_BIND:
1471 case GIMPLE_CATCH:
1472 case GIMPLE_EH_FILTER:
1473 case GIMPLE_EH_ELSE:
1474 case GIMPLE_TRY:
1475 case GIMPLE_OMP_FOR:
1476 case GIMPLE_OMP_MASTER:
1477 case GIMPLE_OMP_TASKGROUP:
1478 case GIMPLE_OMP_ORDERED:
1479 case GIMPLE_OMP_SECTION:
1480 case GIMPLE_OMP_PARALLEL:
1481 case GIMPLE_OMP_TASK:
1482 case GIMPLE_OMP_SECTIONS:
1483 case GIMPLE_OMP_SINGLE:
1484 case GIMPLE_OMP_TARGET:
1485 case GIMPLE_OMP_TEAMS:
1486 case GIMPLE_OMP_CRITICAL:
1487 case GIMPLE_WITH_CLEANUP_EXPR:
1488 case GIMPLE_TRANSACTION:
1489 return true;
1491 default:
1492 return false;
1497 /* Return the basic block holding statement G. */
1499 static inline basic_block
1500 gimple_bb (const_gimple g)
1502 return g->bb;
1506 /* Return the lexical scope block holding statement G. */
1508 static inline tree
1509 gimple_block (const_gimple g)
1511 return LOCATION_BLOCK (g->location);
1515 /* Set BLOCK to be the lexical scope block holding statement G. */
1517 static inline void
1518 gimple_set_block (gimple g, tree block)
1520 if (block)
1521 g->location =
1522 COMBINE_LOCATION_DATA (line_table, g->location, block);
1523 else
1524 g->location = LOCATION_LOCUS (g->location);
1528 /* Return location information for statement G. */
1530 static inline location_t
1531 gimple_location (const_gimple g)
1533 return g->location;
1536 /* Return location information for statement G if g is not NULL.
1537 Otherwise, UNKNOWN_LOCATION is returned. */
1539 static inline location_t
1540 gimple_location_safe (const_gimple g)
1542 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1545 /* Return pointer to location information for statement G. */
1547 static inline const location_t *
1548 gimple_location_ptr (const_gimple g)
1550 return &g->location;
1554 /* Set location information for statement G. */
1556 static inline void
1557 gimple_set_location (gimple g, location_t location)
1559 g->location = location;
1563 /* Return true if G contains location information. */
1565 static inline bool
1566 gimple_has_location (const_gimple g)
1568 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1572 /* Return the file name of the location of STMT. */
1574 static inline const char *
1575 gimple_filename (const_gimple stmt)
1577 return LOCATION_FILE (gimple_location (stmt));
1581 /* Return the line number of the location of STMT. */
1583 static inline int
1584 gimple_lineno (const_gimple stmt)
1586 return LOCATION_LINE (gimple_location (stmt));
1590 /* Determine whether SEQ is a singleton. */
1592 static inline bool
1593 gimple_seq_singleton_p (gimple_seq seq)
1595 return ((gimple_seq_first (seq) != NULL)
1596 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1599 /* Return true if no warnings should be emitted for statement STMT. */
1601 static inline bool
1602 gimple_no_warning_p (const_gimple stmt)
1604 return stmt->no_warning;
1607 /* Set the no_warning flag of STMT to NO_WARNING. */
1609 static inline void
1610 gimple_set_no_warning (gimple stmt, bool no_warning)
1612 stmt->no_warning = (unsigned) no_warning;
1615 /* Set the visited status on statement STMT to VISITED_P. */
1617 static inline void
1618 gimple_set_visited (gimple stmt, bool visited_p)
1620 stmt->visited = (unsigned) visited_p;
1624 /* Return the visited status for statement STMT. */
1626 static inline bool
1627 gimple_visited_p (gimple stmt)
1629 return stmt->visited;
1633 /* Set pass local flag PLF on statement STMT to VAL_P. */
1635 static inline void
1636 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1638 if (val_p)
1639 stmt->plf |= (unsigned int) plf;
1640 else
1641 stmt->plf &= ~((unsigned int) plf);
1645 /* Return the value of pass local flag PLF on statement STMT. */
1647 static inline unsigned int
1648 gimple_plf (gimple stmt, enum plf_mask plf)
1650 return stmt->plf & ((unsigned int) plf);
1654 /* Set the UID of statement. */
1656 static inline void
1657 gimple_set_uid (gimple g, unsigned uid)
1659 g->uid = uid;
1663 /* Return the UID of statement. */
1665 static inline unsigned
1666 gimple_uid (const_gimple g)
1668 return g->uid;
1672 /* Make statement G a singleton sequence. */
1674 static inline void
1675 gimple_init_singleton (gimple g)
1677 g->next = NULL;
1678 g->prev = g;
1682 /* Return true if GIMPLE statement G has register or memory operands. */
1684 static inline bool
1685 gimple_has_ops (const_gimple g)
1687 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1690 template <>
1691 template <>
1692 inline bool
1693 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1695 return gimple_has_ops (gs);
1698 template <>
1699 template <>
1700 inline bool
1701 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1703 return gimple_has_ops (gs);
1706 /* Return true if GIMPLE statement G has memory operands. */
1708 static inline bool
1709 gimple_has_mem_ops (const_gimple g)
1711 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1714 template <>
1715 template <>
1716 inline bool
1717 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1719 return gimple_has_mem_ops (gs);
1722 template <>
1723 template <>
1724 inline bool
1725 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1727 return gimple_has_mem_ops (gs);
1730 /* Return the set of USE operands for statement G. */
1732 static inline struct use_optype_d *
1733 gimple_use_ops (const_gimple g)
1735 const gimple_statement_with_ops *ops_stmt =
1736 dyn_cast <const gimple_statement_with_ops *> (g);
1737 if (!ops_stmt)
1738 return NULL;
1739 return ops_stmt->use_ops;
1743 /* Set USE to be the set of USE operands for statement G. */
1745 static inline void
1746 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1748 gimple_statement_with_ops *ops_stmt =
1749 as_a <gimple_statement_with_ops *> (g);
1750 ops_stmt->use_ops = use;
1754 /* Return the single VUSE operand of the statement G. */
1756 static inline tree
1757 gimple_vuse (const_gimple g)
1759 const gimple_statement_with_memory_ops *mem_ops_stmt =
1760 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1761 if (!mem_ops_stmt)
1762 return NULL_TREE;
1763 return mem_ops_stmt->vuse;
1766 /* Return the single VDEF operand of the statement G. */
1768 static inline tree
1769 gimple_vdef (const_gimple g)
1771 const gimple_statement_with_memory_ops *mem_ops_stmt =
1772 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1773 if (!mem_ops_stmt)
1774 return NULL_TREE;
1775 return mem_ops_stmt->vdef;
1778 /* Return the single VUSE operand of the statement G. */
1780 static inline tree *
1781 gimple_vuse_ptr (gimple g)
1783 gimple_statement_with_memory_ops *mem_ops_stmt =
1784 dyn_cast <gimple_statement_with_memory_ops *> (g);
1785 if (!mem_ops_stmt)
1786 return NULL;
1787 return &mem_ops_stmt->vuse;
1790 /* Return the single VDEF operand of the statement G. */
1792 static inline tree *
1793 gimple_vdef_ptr (gimple g)
1795 gimple_statement_with_memory_ops *mem_ops_stmt =
1796 dyn_cast <gimple_statement_with_memory_ops *> (g);
1797 if (!mem_ops_stmt)
1798 return NULL;
1799 return &mem_ops_stmt->vdef;
1802 /* Set the single VUSE operand of the statement G. */
1804 static inline void
1805 gimple_set_vuse (gimple g, tree vuse)
1807 gimple_statement_with_memory_ops *mem_ops_stmt =
1808 as_a <gimple_statement_with_memory_ops *> (g);
1809 mem_ops_stmt->vuse = vuse;
1812 /* Set the single VDEF operand of the statement G. */
1814 static inline void
1815 gimple_set_vdef (gimple g, tree vdef)
1817 gimple_statement_with_memory_ops *mem_ops_stmt =
1818 as_a <gimple_statement_with_memory_ops *> (g);
1819 mem_ops_stmt->vdef = vdef;
1823 /* Return true if statement G has operands and the modified field has
1824 been set. */
1826 static inline bool
1827 gimple_modified_p (const_gimple g)
1829 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1833 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1834 a MODIFIED field. */
1836 static inline void
1837 gimple_set_modified (gimple s, bool modifiedp)
1839 if (gimple_has_ops (s))
1840 s->modified = (unsigned) modifiedp;
1844 /* Return the tree code for the expression computed by STMT. This is
1845 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1846 GIMPLE_CALL, return CALL_EXPR as the expression code for
1847 consistency. This is useful when the caller needs to deal with the
1848 three kinds of computation that GIMPLE supports. */
1850 static inline enum tree_code
1851 gimple_expr_code (const_gimple stmt)
1853 enum gimple_code code = gimple_code (stmt);
1854 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1855 return (enum tree_code) stmt->subcode;
1856 else
1858 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1859 return CALL_EXPR;
1864 /* Return true if statement STMT contains volatile operands. */
1866 static inline bool
1867 gimple_has_volatile_ops (const_gimple stmt)
1869 if (gimple_has_mem_ops (stmt))
1870 return stmt->has_volatile_ops;
1871 else
1872 return false;
1876 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1878 static inline void
1879 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1881 if (gimple_has_mem_ops (stmt))
1882 stmt->has_volatile_ops = (unsigned) volatilep;
1885 /* Return true if STMT is in a transaction. */
1887 static inline bool
1888 gimple_in_transaction (gimple stmt)
1890 return bb_in_transaction (gimple_bb (stmt));
1893 /* Return true if statement STMT may access memory. */
1895 static inline bool
1896 gimple_references_memory_p (gimple stmt)
1898 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1902 /* Return the subcode for OMP statement S. */
1904 static inline unsigned
1905 gimple_omp_subcode (const_gimple s)
1907 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1908 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1909 return s->subcode;
1912 /* Set the subcode for OMP statement S to SUBCODE. */
1914 static inline void
1915 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1917 /* We only have 16 bits for the subcode. Assert that we are not
1918 overflowing it. */
1919 gcc_gimple_checking_assert (subcode < (1 << 16));
1920 s->subcode = subcode;
1923 /* Set the nowait flag on OMP_RETURN statement S. */
1925 static inline void
1926 gimple_omp_return_set_nowait (gimple s)
1928 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1929 s->subcode |= GF_OMP_RETURN_NOWAIT;
1933 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1934 flag set. */
1936 static inline bool
1937 gimple_omp_return_nowait_p (const_gimple g)
1939 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1940 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1944 /* Set the LHS of OMP return. */
1946 static inline void
1947 gimple_omp_return_set_lhs (gimple g, tree lhs)
1949 gimple_statement_omp_return *omp_return_stmt =
1950 as_a <gimple_statement_omp_return *> (g);
1951 omp_return_stmt->val = lhs;
1955 /* Get the LHS of OMP return. */
1957 static inline tree
1958 gimple_omp_return_lhs (const_gimple g)
1960 const gimple_statement_omp_return *omp_return_stmt =
1961 as_a <const gimple_statement_omp_return *> (g);
1962 return omp_return_stmt->val;
1966 /* Return a pointer to the LHS of OMP return. */
1968 static inline tree *
1969 gimple_omp_return_lhs_ptr (gimple g)
1971 gimple_statement_omp_return *omp_return_stmt =
1972 as_a <gimple_statement_omp_return *> (g);
1973 return &omp_return_stmt->val;
1977 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1978 flag set. */
1980 static inline bool
1981 gimple_omp_section_last_p (const_gimple g)
1983 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1984 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1988 /* Set the GF_OMP_SECTION_LAST flag on G. */
1990 static inline void
1991 gimple_omp_section_set_last (gimple g)
1993 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1994 g->subcode |= GF_OMP_SECTION_LAST;
1998 /* Return true if OMP parallel statement G has the
1999 GF_OMP_PARALLEL_COMBINED flag set. */
2001 static inline bool
2002 gimple_omp_parallel_combined_p (const_gimple g)
2004 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2005 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2009 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2010 value of COMBINED_P. */
2012 static inline void
2013 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2015 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2016 if (combined_p)
2017 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2018 else
2019 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2023 /* Return true if OMP atomic load/store statement G has the
2024 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2026 static inline bool
2027 gimple_omp_atomic_need_value_p (const_gimple g)
2029 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2030 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2031 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2035 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2037 static inline void
2038 gimple_omp_atomic_set_need_value (gimple g)
2040 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2041 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2042 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2046 /* Return true if OMP atomic load/store statement G has the
2047 GF_OMP_ATOMIC_SEQ_CST flag set. */
2049 static inline bool
2050 gimple_omp_atomic_seq_cst_p (const_gimple g)
2052 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2053 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2054 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2058 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2060 static inline void
2061 gimple_omp_atomic_set_seq_cst (gimple g)
2063 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2064 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2065 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2069 /* Return the number of operands for statement GS. */
2071 static inline unsigned
2072 gimple_num_ops (const_gimple gs)
2074 return gs->num_ops;
2078 /* Set the number of operands for statement GS. */
2080 static inline void
2081 gimple_set_num_ops (gimple gs, unsigned num_ops)
2083 gs->num_ops = num_ops;
2087 /* Return the array of operands for statement GS. */
2089 static inline tree *
2090 gimple_ops (gimple gs)
2092 size_t off;
2094 /* All the tuples have their operand vector at the very bottom
2095 of the structure. Note that those structures that do not
2096 have an operand vector have a zero offset. */
2097 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2098 gcc_gimple_checking_assert (off != 0);
2100 return (tree *) ((char *) gs + off);
2104 /* Return operand I for statement GS. */
2106 static inline tree
2107 gimple_op (const_gimple gs, unsigned i)
2109 if (gimple_has_ops (gs))
2111 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2112 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2114 else
2115 return NULL_TREE;
2118 /* Return a pointer to operand I for statement GS. */
2120 static inline tree *
2121 gimple_op_ptr (const_gimple gs, unsigned i)
2123 if (gimple_has_ops (gs))
2125 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2126 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2128 else
2129 return NULL;
2132 /* Set operand I of statement GS to OP. */
2134 static inline void
2135 gimple_set_op (gimple gs, unsigned i, tree op)
2137 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2139 /* Note. It may be tempting to assert that OP matches
2140 is_gimple_operand, but that would be wrong. Different tuples
2141 accept slightly different sets of tree operands. Each caller
2142 should perform its own validation. */
2143 gimple_ops (gs)[i] = op;
2146 /* Return true if GS is a GIMPLE_ASSIGN. */
2148 static inline bool
2149 is_gimple_assign (const_gimple gs)
2151 return gimple_code (gs) == GIMPLE_ASSIGN;
2154 /* Determine if expression CODE is one of the valid expressions that can
2155 be used on the RHS of GIMPLE assignments. */
2157 static inline enum gimple_rhs_class
2158 get_gimple_rhs_class (enum tree_code code)
2160 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2163 /* Return the LHS of assignment statement GS. */
2165 static inline tree
2166 gimple_assign_lhs (const_gimple gs)
2168 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2169 return gimple_op (gs, 0);
2173 /* Return a pointer to the LHS of assignment statement GS. */
2175 static inline tree *
2176 gimple_assign_lhs_ptr (const_gimple gs)
2178 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2179 return gimple_op_ptr (gs, 0);
2183 /* Set LHS to be the LHS operand of assignment statement GS. */
2185 static inline void
2186 gimple_assign_set_lhs (gimple gs, tree lhs)
2188 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2189 gimple_set_op (gs, 0, lhs);
2191 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2192 SSA_NAME_DEF_STMT (lhs) = gs;
2196 /* Return the first operand on the RHS of assignment statement GS. */
2198 static inline tree
2199 gimple_assign_rhs1 (const_gimple gs)
2201 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2202 return gimple_op (gs, 1);
2206 /* Return a pointer to the first operand on the RHS of assignment
2207 statement GS. */
2209 static inline tree *
2210 gimple_assign_rhs1_ptr (const_gimple gs)
2212 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2213 return gimple_op_ptr (gs, 1);
2216 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2218 static inline void
2219 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2221 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2223 gimple_set_op (gs, 1, rhs);
2227 /* Return the second operand on the RHS of assignment statement GS.
2228 If GS does not have two operands, NULL is returned instead. */
2230 static inline tree
2231 gimple_assign_rhs2 (const_gimple gs)
2233 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2235 if (gimple_num_ops (gs) >= 3)
2236 return gimple_op (gs, 2);
2237 else
2238 return NULL_TREE;
2242 /* Return a pointer to the second operand on the RHS of assignment
2243 statement GS. */
2245 static inline tree *
2246 gimple_assign_rhs2_ptr (const_gimple gs)
2248 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2249 return gimple_op_ptr (gs, 2);
2253 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2255 static inline void
2256 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2258 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2260 gimple_set_op (gs, 2, rhs);
2263 /* Return the third operand on the RHS of assignment statement GS.
2264 If GS does not have two operands, NULL is returned instead. */
2266 static inline tree
2267 gimple_assign_rhs3 (const_gimple gs)
2269 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2271 if (gimple_num_ops (gs) >= 4)
2272 return gimple_op (gs, 3);
2273 else
2274 return NULL_TREE;
2277 /* Return a pointer to the third operand on the RHS of assignment
2278 statement GS. */
2280 static inline tree *
2281 gimple_assign_rhs3_ptr (const_gimple gs)
2283 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2284 return gimple_op_ptr (gs, 3);
2288 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2290 static inline void
2291 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2293 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2295 gimple_set_op (gs, 3, rhs);
2298 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2299 to see only a maximum of two operands. */
2301 static inline void
2302 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2303 tree op1, tree op2)
2305 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2308 /* Returns true if GS is a nontemporal move. */
2310 static inline bool
2311 gimple_assign_nontemporal_move_p (const_gimple gs)
2313 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2314 return gs->nontemporal_move;
2317 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2319 static inline void
2320 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2322 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2323 gs->nontemporal_move = nontemporal;
2327 /* Return the code of the expression computed on the rhs of assignment
2328 statement GS. In case that the RHS is a single object, returns the
2329 tree code of the object. */
2331 static inline enum tree_code
2332 gimple_assign_rhs_code (const_gimple gs)
2334 enum tree_code code;
2335 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2337 code = (enum tree_code) gs->subcode;
2338 /* While we initially set subcode to the TREE_CODE of the rhs for
2339 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2340 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2341 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2342 code = TREE_CODE (gimple_assign_rhs1 (gs));
2344 return code;
2348 /* Set CODE to be the code for the expression computed on the RHS of
2349 assignment S. */
2351 static inline void
2352 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2354 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2355 s->subcode = code;
2359 /* Return the gimple rhs class of the code of the expression computed on
2360 the rhs of assignment statement GS.
2361 This will never return GIMPLE_INVALID_RHS. */
2363 static inline enum gimple_rhs_class
2364 gimple_assign_rhs_class (const_gimple gs)
2366 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2369 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2370 there is no operator associated with the assignment itself.
2371 Unlike gimple_assign_copy_p, this predicate returns true for
2372 any RHS operand, including those that perform an operation
2373 and do not have the semantics of a copy, such as COND_EXPR. */
2375 static inline bool
2376 gimple_assign_single_p (const_gimple gs)
2378 return (is_gimple_assign (gs)
2379 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2382 /* Return true if GS performs a store to its lhs. */
2384 static inline bool
2385 gimple_store_p (const_gimple gs)
2387 tree lhs = gimple_get_lhs (gs);
2388 return lhs && !is_gimple_reg (lhs);
2391 /* Return true if GS is an assignment that loads from its rhs1. */
2393 static inline bool
2394 gimple_assign_load_p (const_gimple gs)
2396 tree rhs;
2397 if (!gimple_assign_single_p (gs))
2398 return false;
2399 rhs = gimple_assign_rhs1 (gs);
2400 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2401 return true;
2402 rhs = get_base_address (rhs);
2403 return (DECL_P (rhs)
2404 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2408 /* Return true if S is a type-cast assignment. */
2410 static inline bool
2411 gimple_assign_cast_p (const_gimple s)
2413 if (is_gimple_assign (s))
2415 enum tree_code sc = gimple_assign_rhs_code (s);
2416 return CONVERT_EXPR_CODE_P (sc)
2417 || sc == VIEW_CONVERT_EXPR
2418 || sc == FIX_TRUNC_EXPR;
2421 return false;
2424 /* Return true if S is a clobber statement. */
2426 static inline bool
2427 gimple_clobber_p (const_gimple s)
2429 return gimple_assign_single_p (s)
2430 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2433 /* Return true if GS is a GIMPLE_CALL. */
2435 static inline bool
2436 is_gimple_call (const_gimple gs)
2438 return gimple_code (gs) == GIMPLE_CALL;
2441 /* Return the LHS of call statement GS. */
2443 static inline tree
2444 gimple_call_lhs (const_gimple gs)
2446 GIMPLE_CHECK (gs, GIMPLE_CALL);
2447 return gimple_op (gs, 0);
2451 /* Return a pointer to the LHS of call statement GS. */
2453 static inline tree *
2454 gimple_call_lhs_ptr (const_gimple gs)
2456 GIMPLE_CHECK (gs, GIMPLE_CALL);
2457 return gimple_op_ptr (gs, 0);
2461 /* Set LHS to be the LHS operand of call statement GS. */
2463 static inline void
2464 gimple_call_set_lhs (gimple gs, tree lhs)
2466 GIMPLE_CHECK (gs, GIMPLE_CALL);
2467 gimple_set_op (gs, 0, lhs);
2468 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2469 SSA_NAME_DEF_STMT (lhs) = gs;
2473 /* Return true if call GS calls an internal-only function, as enumerated
2474 by internal_fn. */
2476 static inline bool
2477 gimple_call_internal_p (const_gimple gs)
2479 GIMPLE_CHECK (gs, GIMPLE_CALL);
2480 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2484 /* Return the target of internal call GS. */
2486 static inline enum internal_fn
2487 gimple_call_internal_fn (const_gimple gs)
2489 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2490 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2493 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2494 that could alter control flow. */
2496 static inline void
2497 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2499 GIMPLE_CHECK (s, GIMPLE_CALL);
2500 if (ctrl_altering_p)
2501 s->subcode |= GF_CALL_CTRL_ALTERING;
2502 else
2503 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2506 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2507 flag is set. Such call could not be a stmt in the middle of a bb. */
2509 static inline bool
2510 gimple_call_ctrl_altering_p (const_gimple gs)
2512 GIMPLE_CHECK (gs, GIMPLE_CALL);
2513 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2517 /* Return the function type of the function called by GS. */
2519 static inline tree
2520 gimple_call_fntype (const_gimple gs)
2522 const gimple_statement_call *call_stmt =
2523 as_a <const gimple_statement_call *> (gs);
2524 if (gimple_call_internal_p (gs))
2525 return NULL_TREE;
2526 return call_stmt->u.fntype;
2529 /* Set the type of the function called by GS to FNTYPE. */
2531 static inline void
2532 gimple_call_set_fntype (gimple gs, tree fntype)
2534 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2535 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2536 call_stmt->u.fntype = fntype;
2540 /* Return the tree node representing the function called by call
2541 statement GS. */
2543 static inline tree
2544 gimple_call_fn (const_gimple gs)
2546 GIMPLE_CHECK (gs, GIMPLE_CALL);
2547 return gimple_op (gs, 1);
2550 /* Return a pointer to the tree node representing the function called by call
2551 statement GS. */
2553 static inline tree *
2554 gimple_call_fn_ptr (const_gimple gs)
2556 GIMPLE_CHECK (gs, GIMPLE_CALL);
2557 return gimple_op_ptr (gs, 1);
2561 /* Set FN to be the function called by call statement GS. */
2563 static inline void
2564 gimple_call_set_fn (gimple gs, tree fn)
2566 GIMPLE_CHECK (gs, GIMPLE_CALL);
2567 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2568 gimple_set_op (gs, 1, fn);
2572 /* Set FNDECL to be the function called by call statement GS. */
2574 static inline void
2575 gimple_call_set_fndecl (gimple gs, tree decl)
2577 GIMPLE_CHECK (gs, GIMPLE_CALL);
2578 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2579 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2583 /* Set internal function FN to be the function called by call statement GS. */
2585 static inline void
2586 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2588 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2589 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2590 call_stmt->u.internal_fn = fn;
2594 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2595 Otherwise return NULL. This function is analogous to
2596 get_callee_fndecl in tree land. */
2598 static inline tree
2599 gimple_call_fndecl (const_gimple gs)
2601 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2605 /* Return the type returned by call statement GS. */
2607 static inline tree
2608 gimple_call_return_type (const_gimple gs)
2610 tree type = gimple_call_fntype (gs);
2612 if (type == NULL_TREE)
2613 return TREE_TYPE (gimple_call_lhs (gs));
2615 /* The type returned by a function is the type of its
2616 function type. */
2617 return TREE_TYPE (type);
2621 /* Return the static chain for call statement GS. */
2623 static inline tree
2624 gimple_call_chain (const_gimple gs)
2626 GIMPLE_CHECK (gs, GIMPLE_CALL);
2627 return gimple_op (gs, 2);
2631 /* Return a pointer to the static chain for call statement GS. */
2633 static inline tree *
2634 gimple_call_chain_ptr (const_gimple gs)
2636 GIMPLE_CHECK (gs, GIMPLE_CALL);
2637 return gimple_op_ptr (gs, 2);
2640 /* Set CHAIN to be the static chain for call statement GS. */
2642 static inline void
2643 gimple_call_set_chain (gimple gs, tree chain)
2645 GIMPLE_CHECK (gs, GIMPLE_CALL);
2647 gimple_set_op (gs, 2, chain);
2651 /* Return the number of arguments used by call statement GS. */
2653 static inline unsigned
2654 gimple_call_num_args (const_gimple gs)
2656 unsigned num_ops;
2657 GIMPLE_CHECK (gs, GIMPLE_CALL);
2658 num_ops = gimple_num_ops (gs);
2659 return num_ops - 3;
2663 /* Return the argument at position INDEX for call statement GS. */
2665 static inline tree
2666 gimple_call_arg (const_gimple gs, unsigned index)
2668 GIMPLE_CHECK (gs, GIMPLE_CALL);
2669 return gimple_op (gs, index + 3);
2673 /* Return a pointer to the argument at position INDEX for call
2674 statement GS. */
2676 static inline tree *
2677 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2679 GIMPLE_CHECK (gs, GIMPLE_CALL);
2680 return gimple_op_ptr (gs, index + 3);
2684 /* Set ARG to be the argument at position INDEX for call statement GS. */
2686 static inline void
2687 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2689 GIMPLE_CHECK (gs, GIMPLE_CALL);
2690 gimple_set_op (gs, index + 3, arg);
2694 /* If TAIL_P is true, mark call statement S as being a tail call
2695 (i.e., a call just before the exit of a function). These calls are
2696 candidate for tail call optimization. */
2698 static inline void
2699 gimple_call_set_tail (gimple s, bool tail_p)
2701 GIMPLE_CHECK (s, GIMPLE_CALL);
2702 if (tail_p)
2703 s->subcode |= GF_CALL_TAILCALL;
2704 else
2705 s->subcode &= ~GF_CALL_TAILCALL;
2709 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2711 static inline bool
2712 gimple_call_tail_p (gimple s)
2714 GIMPLE_CHECK (s, GIMPLE_CALL);
2715 return (s->subcode & GF_CALL_TAILCALL) != 0;
2719 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2720 slot optimization. This transformation uses the target of the call
2721 expansion as the return slot for calls that return in memory. */
2723 static inline void
2724 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2726 GIMPLE_CHECK (s, GIMPLE_CALL);
2727 if (return_slot_opt_p)
2728 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2729 else
2730 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2734 /* Return true if S is marked for return slot optimization. */
2736 static inline bool
2737 gimple_call_return_slot_opt_p (gimple s)
2739 GIMPLE_CHECK (s, GIMPLE_CALL);
2740 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2744 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2745 thunk to the thunked-to function. */
2747 static inline void
2748 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2750 GIMPLE_CHECK (s, GIMPLE_CALL);
2751 if (from_thunk_p)
2752 s->subcode |= GF_CALL_FROM_THUNK;
2753 else
2754 s->subcode &= ~GF_CALL_FROM_THUNK;
2758 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2760 static inline bool
2761 gimple_call_from_thunk_p (gimple s)
2763 GIMPLE_CHECK (s, GIMPLE_CALL);
2764 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2768 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2769 argument pack in its argument list. */
2771 static inline void
2772 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2774 GIMPLE_CHECK (s, GIMPLE_CALL);
2775 if (pass_arg_pack_p)
2776 s->subcode |= GF_CALL_VA_ARG_PACK;
2777 else
2778 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2782 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2783 argument pack in its argument list. */
2785 static inline bool
2786 gimple_call_va_arg_pack_p (gimple s)
2788 GIMPLE_CHECK (s, GIMPLE_CALL);
2789 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2793 /* Return true if S is a noreturn call. */
2795 static inline bool
2796 gimple_call_noreturn_p (gimple s)
2798 GIMPLE_CHECK (s, GIMPLE_CALL);
2799 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2803 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2804 even if the called function can throw in other cases. */
2806 static inline void
2807 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2809 GIMPLE_CHECK (s, GIMPLE_CALL);
2810 if (nothrow_p)
2811 s->subcode |= GF_CALL_NOTHROW;
2812 else
2813 s->subcode &= ~GF_CALL_NOTHROW;
2816 /* Return true if S is a nothrow call. */
2818 static inline bool
2819 gimple_call_nothrow_p (gimple s)
2821 GIMPLE_CHECK (s, GIMPLE_CALL);
2822 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2825 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2826 is known to be emitted for VLA objects. Those are wrapped by
2827 stack_save/stack_restore calls and hence can't lead to unbounded
2828 stack growth even when they occur in loops. */
2830 static inline void
2831 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2833 GIMPLE_CHECK (s, GIMPLE_CALL);
2834 if (for_var)
2835 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2836 else
2837 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2840 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2842 static inline bool
2843 gimple_call_alloca_for_var_p (gimple s)
2845 GIMPLE_CHECK (s, GIMPLE_CALL);
2846 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2849 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2851 static inline void
2852 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2854 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2855 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2856 dest_call->subcode = orig_call->subcode;
2860 /* Return a pointer to the points-to solution for the set of call-used
2861 variables of the call CALL. */
2863 static inline struct pt_solution *
2864 gimple_call_use_set (gimple call)
2866 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2867 return &call_stmt->call_used;
2871 /* Return a pointer to the points-to solution for the set of call-used
2872 variables of the call CALL. */
2874 static inline struct pt_solution *
2875 gimple_call_clobber_set (gimple call)
2877 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2878 return &call_stmt->call_clobbered;
2882 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2883 non-NULL lhs. */
2885 static inline bool
2886 gimple_has_lhs (gimple stmt)
2888 return (is_gimple_assign (stmt)
2889 || (is_gimple_call (stmt)
2890 && gimple_call_lhs (stmt) != NULL_TREE));
2894 /* Return the code of the predicate computed by conditional statement GS. */
2896 static inline enum tree_code
2897 gimple_cond_code (const_gimple gs)
2899 GIMPLE_CHECK (gs, GIMPLE_COND);
2900 return (enum tree_code) gs->subcode;
2904 /* Set CODE to be the predicate code for the conditional statement GS. */
2906 static inline void
2907 gimple_cond_set_code (gimple gs, enum tree_code code)
2909 GIMPLE_CHECK (gs, GIMPLE_COND);
2910 gs->subcode = code;
2914 /* Return the LHS of the predicate computed by conditional statement GS. */
2916 static inline tree
2917 gimple_cond_lhs (const_gimple gs)
2919 GIMPLE_CHECK (gs, GIMPLE_COND);
2920 return gimple_op (gs, 0);
2923 /* Return the pointer to the LHS of the predicate computed by conditional
2924 statement GS. */
2926 static inline tree *
2927 gimple_cond_lhs_ptr (const_gimple gs)
2929 GIMPLE_CHECK (gs, GIMPLE_COND);
2930 return gimple_op_ptr (gs, 0);
2933 /* Set LHS to be the LHS operand of the predicate computed by
2934 conditional statement GS. */
2936 static inline void
2937 gimple_cond_set_lhs (gimple gs, tree lhs)
2939 GIMPLE_CHECK (gs, GIMPLE_COND);
2940 gimple_set_op (gs, 0, lhs);
2944 /* Return the RHS operand of the predicate computed by conditional GS. */
2946 static inline tree
2947 gimple_cond_rhs (const_gimple gs)
2949 GIMPLE_CHECK (gs, GIMPLE_COND);
2950 return gimple_op (gs, 1);
2953 /* Return the pointer to the RHS operand of the predicate computed by
2954 conditional GS. */
2956 static inline tree *
2957 gimple_cond_rhs_ptr (const_gimple gs)
2959 GIMPLE_CHECK (gs, GIMPLE_COND);
2960 return gimple_op_ptr (gs, 1);
2964 /* Set RHS to be the RHS operand of the predicate computed by
2965 conditional statement GS. */
2967 static inline void
2968 gimple_cond_set_rhs (gimple gs, tree rhs)
2970 GIMPLE_CHECK (gs, GIMPLE_COND);
2971 gimple_set_op (gs, 1, rhs);
2975 /* Return the label used by conditional statement GS when its
2976 predicate evaluates to true. */
2978 static inline tree
2979 gimple_cond_true_label (const_gimple gs)
2981 GIMPLE_CHECK (gs, GIMPLE_COND);
2982 return gimple_op (gs, 2);
2986 /* Set LABEL to be the label used by conditional statement GS when its
2987 predicate evaluates to true. */
2989 static inline void
2990 gimple_cond_set_true_label (gimple gs, tree label)
2992 GIMPLE_CHECK (gs, GIMPLE_COND);
2993 gimple_set_op (gs, 2, label);
2997 /* Set LABEL to be the label used by conditional statement GS when its
2998 predicate evaluates to false. */
3000 static inline void
3001 gimple_cond_set_false_label (gimple gs, tree label)
3003 GIMPLE_CHECK (gs, GIMPLE_COND);
3004 gimple_set_op (gs, 3, label);
3008 /* Return the label used by conditional statement GS when its
3009 predicate evaluates to false. */
3011 static inline tree
3012 gimple_cond_false_label (const_gimple gs)
3014 GIMPLE_CHECK (gs, GIMPLE_COND);
3015 return gimple_op (gs, 3);
3019 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3021 static inline void
3022 gimple_cond_make_false (gimple gs)
3024 gimple_cond_set_lhs (gs, boolean_true_node);
3025 gimple_cond_set_rhs (gs, boolean_false_node);
3026 gs->subcode = EQ_EXPR;
3030 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3032 static inline void
3033 gimple_cond_make_true (gimple gs)
3035 gimple_cond_set_lhs (gs, boolean_true_node);
3036 gimple_cond_set_rhs (gs, boolean_true_node);
3037 gs->subcode = EQ_EXPR;
3040 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3041 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3043 static inline bool
3044 gimple_cond_true_p (const_gimple gs)
3046 tree lhs = gimple_cond_lhs (gs);
3047 tree rhs = gimple_cond_rhs (gs);
3048 enum tree_code code = gimple_cond_code (gs);
3050 if (lhs != boolean_true_node && lhs != boolean_false_node)
3051 return false;
3053 if (rhs != boolean_true_node && rhs != boolean_false_node)
3054 return false;
3056 if (code == NE_EXPR && lhs != rhs)
3057 return true;
3059 if (code == EQ_EXPR && lhs == rhs)
3060 return true;
3062 return false;
3065 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3066 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3068 static inline bool
3069 gimple_cond_false_p (const_gimple gs)
3071 tree lhs = gimple_cond_lhs (gs);
3072 tree rhs = gimple_cond_rhs (gs);
3073 enum tree_code code = gimple_cond_code (gs);
3075 if (lhs != boolean_true_node && lhs != boolean_false_node)
3076 return false;
3078 if (rhs != boolean_true_node && rhs != boolean_false_node)
3079 return false;
3081 if (code == NE_EXPR && lhs == rhs)
3082 return true;
3084 if (code == EQ_EXPR && lhs != rhs)
3085 return true;
3087 return false;
3090 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3092 static inline void
3093 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3095 gimple_cond_set_code (stmt, code);
3096 gimple_cond_set_lhs (stmt, lhs);
3097 gimple_cond_set_rhs (stmt, rhs);
3100 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3102 static inline tree
3103 gimple_label_label (const_gimple gs)
3105 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3106 return gimple_op (gs, 0);
3110 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3111 GS. */
3113 static inline void
3114 gimple_label_set_label (gimple gs, tree label)
3116 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3117 gimple_set_op (gs, 0, label);
3121 /* Return the destination of the unconditional jump GS. */
3123 static inline tree
3124 gimple_goto_dest (const_gimple gs)
3126 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3127 return gimple_op (gs, 0);
3131 /* Set DEST to be the destination of the unconditonal jump GS. */
3133 static inline void
3134 gimple_goto_set_dest (gimple gs, tree dest)
3136 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3137 gimple_set_op (gs, 0, dest);
3141 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3143 static inline tree
3144 gimple_bind_vars (const_gimple_bind bind_stmt)
3146 return bind_stmt->vars;
3150 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3151 statement GS. */
3153 static inline void
3154 gimple_bind_set_vars (gimple_bind bind_stmt, tree vars)
3156 bind_stmt->vars = vars;
3160 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3161 statement GS. */
3163 static inline void
3164 gimple_bind_append_vars (gimple_bind bind_stmt, tree vars)
3166 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3170 static inline gimple_seq *
3171 gimple_bind_body_ptr (gimple_bind bind_stmt)
3173 return &bind_stmt->body;
3176 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3178 static inline gimple_seq
3179 gimple_bind_body (gimple_bind gs)
3181 return *gimple_bind_body_ptr (gs);
3185 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3186 statement GS. */
3188 static inline void
3189 gimple_bind_set_body (gimple_bind bind_stmt, gimple_seq seq)
3191 bind_stmt->body = seq;
3195 /* Append a statement to the end of a GIMPLE_BIND's body. */
3197 static inline void
3198 gimple_bind_add_stmt (gimple_bind bind_stmt, gimple stmt)
3200 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3204 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3206 static inline void
3207 gimple_bind_add_seq (gimple_bind bind_stmt, gimple_seq seq)
3209 gimple_seq_add_seq (&bind_stmt->body, seq);
3213 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3214 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3216 static inline tree
3217 gimple_bind_block (const_gimple_bind bind_stmt)
3219 return bind_stmt->block;
3223 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3224 statement GS. */
3226 static inline void
3227 gimple_bind_set_block (gimple_bind bind_stmt, tree block)
3229 gcc_gimple_checking_assert (block == NULL_TREE
3230 || TREE_CODE (block) == BLOCK);
3231 bind_stmt->block = block;
3235 /* Return the number of input operands for GIMPLE_ASM GS. */
3237 static inline unsigned
3238 gimple_asm_ninputs (const_gimple gs)
3240 const gimple_statement_asm *asm_stmt =
3241 as_a <const gimple_statement_asm *> (gs);
3242 return asm_stmt->ni;
3246 /* Return the number of output operands for GIMPLE_ASM GS. */
3248 static inline unsigned
3249 gimple_asm_noutputs (const_gimple gs)
3251 const gimple_statement_asm *asm_stmt =
3252 as_a <const gimple_statement_asm *> (gs);
3253 return asm_stmt->no;
3257 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3259 static inline unsigned
3260 gimple_asm_nclobbers (const_gimple gs)
3262 const gimple_statement_asm *asm_stmt =
3263 as_a <const gimple_statement_asm *> (gs);
3264 return asm_stmt->nc;
3267 /* Return the number of label operands for GIMPLE_ASM GS. */
3269 static inline unsigned
3270 gimple_asm_nlabels (const_gimple gs)
3272 const gimple_statement_asm *asm_stmt =
3273 as_a <const gimple_statement_asm *> (gs);
3274 return asm_stmt->nl;
3277 /* Return input operand INDEX of GIMPLE_ASM GS. */
3279 static inline tree
3280 gimple_asm_input_op (const_gimple gs, unsigned index)
3282 const gimple_statement_asm *asm_stmt =
3283 as_a <const gimple_statement_asm *> (gs);
3284 gcc_gimple_checking_assert (index < asm_stmt->ni);
3285 return gimple_op (gs, index + asm_stmt->no);
3288 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3290 static inline tree *
3291 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3293 const gimple_statement_asm *asm_stmt =
3294 as_a <const gimple_statement_asm *> (gs);
3295 gcc_gimple_checking_assert (index < asm_stmt->ni);
3296 return gimple_op_ptr (gs, index + asm_stmt->no);
3300 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3302 static inline void
3303 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3305 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3306 gcc_gimple_checking_assert (index < asm_stmt->ni
3307 && TREE_CODE (in_op) == TREE_LIST);
3308 gimple_set_op (gs, index + asm_stmt->no, in_op);
3312 /* Return output operand INDEX of GIMPLE_ASM GS. */
3314 static inline tree
3315 gimple_asm_output_op (const_gimple gs, unsigned index)
3317 const gimple_statement_asm *asm_stmt =
3318 as_a <const gimple_statement_asm *> (gs);
3319 gcc_gimple_checking_assert (index < asm_stmt->no);
3320 return gimple_op (gs, index);
3323 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3325 static inline tree *
3326 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3328 const gimple_statement_asm *asm_stmt =
3329 as_a <const gimple_statement_asm *> (gs);
3330 gcc_gimple_checking_assert (index < asm_stmt->no);
3331 return gimple_op_ptr (gs, index);
3335 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3337 static inline void
3338 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3340 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3341 gcc_gimple_checking_assert (index < asm_stmt->no
3342 && TREE_CODE (out_op) == TREE_LIST);
3343 gimple_set_op (gs, index, out_op);
3347 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3349 static inline tree
3350 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3352 const gimple_statement_asm *asm_stmt =
3353 as_a <const gimple_statement_asm *> (gs);
3354 gcc_gimple_checking_assert (index < asm_stmt->nc);
3355 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3359 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3361 static inline void
3362 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3364 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3365 gcc_gimple_checking_assert (index < asm_stmt->nc
3366 && TREE_CODE (clobber_op) == TREE_LIST);
3367 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3370 /* Return label operand INDEX of GIMPLE_ASM GS. */
3372 static inline tree
3373 gimple_asm_label_op (const_gimple gs, unsigned index)
3375 const gimple_statement_asm *asm_stmt =
3376 as_a <const gimple_statement_asm *> (gs);
3377 gcc_gimple_checking_assert (index < asm_stmt->nl);
3378 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3381 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3383 static inline void
3384 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3386 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3387 gcc_gimple_checking_assert (index < asm_stmt->nl
3388 && TREE_CODE (label_op) == TREE_LIST);
3389 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3392 /* Return the string representing the assembly instruction in
3393 GIMPLE_ASM GS. */
3395 static inline const char *
3396 gimple_asm_string (const_gimple gs)
3398 const gimple_statement_asm *asm_stmt =
3399 as_a <const gimple_statement_asm *> (gs);
3400 return asm_stmt->string;
3404 /* Return true if GS is an asm statement marked volatile. */
3406 static inline bool
3407 gimple_asm_volatile_p (const_gimple gs)
3409 GIMPLE_CHECK (gs, GIMPLE_ASM);
3410 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3414 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3416 static inline void
3417 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3419 GIMPLE_CHECK (gs, GIMPLE_ASM);
3420 if (volatile_p)
3421 gs->subcode |= GF_ASM_VOLATILE;
3422 else
3423 gs->subcode &= ~GF_ASM_VOLATILE;
3427 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3429 static inline void
3430 gimple_asm_set_input (gimple gs, bool input_p)
3432 GIMPLE_CHECK (gs, GIMPLE_ASM);
3433 if (input_p)
3434 gs->subcode |= GF_ASM_INPUT;
3435 else
3436 gs->subcode &= ~GF_ASM_INPUT;
3440 /* Return true if asm GS is an ASM_INPUT. */
3442 static inline bool
3443 gimple_asm_input_p (const_gimple gs)
3445 GIMPLE_CHECK (gs, GIMPLE_ASM);
3446 return (gs->subcode & GF_ASM_INPUT) != 0;
3450 /* Return the types handled by GIMPLE_CATCH statement GS. */
3452 static inline tree
3453 gimple_catch_types (const_gimple gs)
3455 const gimple_statement_catch *catch_stmt =
3456 as_a <const gimple_statement_catch *> (gs);
3457 return catch_stmt->types;
3461 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3463 static inline tree *
3464 gimple_catch_types_ptr (gimple gs)
3466 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3467 return &catch_stmt->types;
3471 /* Return a pointer to the GIMPLE sequence representing the body of
3472 the handler of GIMPLE_CATCH statement GS. */
3474 static inline gimple_seq *
3475 gimple_catch_handler_ptr (gimple gs)
3477 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3478 return &catch_stmt->handler;
3482 /* Return the GIMPLE sequence representing the body of the handler of
3483 GIMPLE_CATCH statement GS. */
3485 static inline gimple_seq
3486 gimple_catch_handler (gimple gs)
3488 return *gimple_catch_handler_ptr (gs);
3492 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3494 static inline void
3495 gimple_catch_set_types (gimple gs, tree t)
3497 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3498 catch_stmt->types = t;
3502 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3504 static inline void
3505 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3507 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3508 catch_stmt->handler = handler;
3512 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3514 static inline tree
3515 gimple_eh_filter_types (const_gimple gs)
3517 const gimple_statement_eh_filter *eh_filter_stmt =
3518 as_a <const gimple_statement_eh_filter *> (gs);
3519 return eh_filter_stmt->types;
3523 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3524 GS. */
3526 static inline tree *
3527 gimple_eh_filter_types_ptr (gimple gs)
3529 gimple_statement_eh_filter *eh_filter_stmt =
3530 as_a <gimple_statement_eh_filter *> (gs);
3531 return &eh_filter_stmt->types;
3535 /* Return a pointer to the sequence of statement to execute when
3536 GIMPLE_EH_FILTER statement fails. */
3538 static inline gimple_seq *
3539 gimple_eh_filter_failure_ptr (gimple gs)
3541 gimple_statement_eh_filter *eh_filter_stmt =
3542 as_a <gimple_statement_eh_filter *> (gs);
3543 return &eh_filter_stmt->failure;
3547 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3548 statement fails. */
3550 static inline gimple_seq
3551 gimple_eh_filter_failure (gimple gs)
3553 return *gimple_eh_filter_failure_ptr (gs);
3557 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3559 static inline void
3560 gimple_eh_filter_set_types (gimple gs, tree types)
3562 gimple_statement_eh_filter *eh_filter_stmt =
3563 as_a <gimple_statement_eh_filter *> (gs);
3564 eh_filter_stmt->types = types;
3568 /* Set FAILURE to be the sequence of statements to execute on failure
3569 for GIMPLE_EH_FILTER GS. */
3571 static inline void
3572 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3574 gimple_statement_eh_filter *eh_filter_stmt =
3575 as_a <gimple_statement_eh_filter *> (gs);
3576 eh_filter_stmt->failure = failure;
3579 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3581 static inline tree
3582 gimple_eh_must_not_throw_fndecl (gimple gs)
3584 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3585 return eh_mnt_stmt->fndecl;
3588 /* Set the function decl to be called by GS to DECL. */
3590 static inline void
3591 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3593 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3594 eh_mnt_stmt->fndecl = decl;
3597 /* GIMPLE_EH_ELSE accessors. */
3599 static inline gimple_seq *
3600 gimple_eh_else_n_body_ptr (gimple gs)
3602 gimple_statement_eh_else *eh_else_stmt =
3603 as_a <gimple_statement_eh_else *> (gs);
3604 return &eh_else_stmt->n_body;
3607 static inline gimple_seq
3608 gimple_eh_else_n_body (gimple gs)
3610 return *gimple_eh_else_n_body_ptr (gs);
3613 static inline gimple_seq *
3614 gimple_eh_else_e_body_ptr (gimple gs)
3616 gimple_statement_eh_else *eh_else_stmt =
3617 as_a <gimple_statement_eh_else *> (gs);
3618 return &eh_else_stmt->e_body;
3621 static inline gimple_seq
3622 gimple_eh_else_e_body (gimple gs)
3624 return *gimple_eh_else_e_body_ptr (gs);
3627 static inline void
3628 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3630 gimple_statement_eh_else *eh_else_stmt =
3631 as_a <gimple_statement_eh_else *> (gs);
3632 eh_else_stmt->n_body = seq;
3635 static inline void
3636 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3638 gimple_statement_eh_else *eh_else_stmt =
3639 as_a <gimple_statement_eh_else *> (gs);
3640 eh_else_stmt->e_body = seq;
3643 /* GIMPLE_TRY accessors. */
3645 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3646 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3648 static inline enum gimple_try_flags
3649 gimple_try_kind (const_gimple gs)
3651 GIMPLE_CHECK (gs, GIMPLE_TRY);
3652 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3656 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3658 static inline void
3659 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3661 GIMPLE_CHECK (gs, GIMPLE_TRY);
3662 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3663 || kind == GIMPLE_TRY_FINALLY);
3664 if (gimple_try_kind (gs) != kind)
3665 gs->subcode = (unsigned int) kind;
3669 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3671 static inline bool
3672 gimple_try_catch_is_cleanup (const_gimple gs)
3674 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3675 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3679 /* Return a pointer to the sequence of statements used as the
3680 body for GIMPLE_TRY GS. */
3682 static inline gimple_seq *
3683 gimple_try_eval_ptr (gimple gs)
3685 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3686 return &try_stmt->eval;
3690 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3692 static inline gimple_seq
3693 gimple_try_eval (gimple gs)
3695 return *gimple_try_eval_ptr (gs);
3699 /* Return a pointer to the sequence of statements used as the cleanup body for
3700 GIMPLE_TRY GS. */
3702 static inline gimple_seq *
3703 gimple_try_cleanup_ptr (gimple gs)
3705 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3706 return &try_stmt->cleanup;
3710 /* Return the sequence of statements used as the cleanup body for
3711 GIMPLE_TRY GS. */
3713 static inline gimple_seq
3714 gimple_try_cleanup (gimple gs)
3716 return *gimple_try_cleanup_ptr (gs);
3720 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3722 static inline void
3723 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3725 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3726 if (catch_is_cleanup)
3727 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3728 else
3729 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3733 /* Set EVAL to be the sequence of statements to use as the body for
3734 GIMPLE_TRY GS. */
3736 static inline void
3737 gimple_try_set_eval (gimple gs, gimple_seq eval)
3739 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3740 try_stmt->eval = eval;
3744 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3745 body for GIMPLE_TRY GS. */
3747 static inline void
3748 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3750 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3751 try_stmt->cleanup = cleanup;
3755 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3757 static inline gimple_seq *
3758 gimple_wce_cleanup_ptr (gimple gs)
3760 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3761 return &wce_stmt->cleanup;
3765 /* Return the cleanup sequence for cleanup statement GS. */
3767 static inline gimple_seq
3768 gimple_wce_cleanup (gimple gs)
3770 return *gimple_wce_cleanup_ptr (gs);
3774 /* Set CLEANUP to be the cleanup sequence for GS. */
3776 static inline void
3777 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3779 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3780 wce_stmt->cleanup = cleanup;
3784 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3786 static inline bool
3787 gimple_wce_cleanup_eh_only (const_gimple gs)
3789 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3790 return gs->subcode != 0;
3794 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3796 static inline void
3797 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3799 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3800 gs->subcode = (unsigned int) eh_only_p;
3804 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3806 static inline unsigned
3807 gimple_phi_capacity (const_gimple gs)
3809 const gimple_statement_phi *phi_stmt =
3810 as_a <const gimple_statement_phi *> (gs);
3811 return phi_stmt->capacity;
3815 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3816 be exactly the number of incoming edges for the basic block holding
3817 GS. */
3819 static inline unsigned
3820 gimple_phi_num_args (const_gimple gs)
3822 const gimple_statement_phi *phi_stmt =
3823 as_a <const gimple_statement_phi *> (gs);
3824 return phi_stmt->nargs;
3828 /* Return the SSA name created by GIMPLE_PHI GS. */
3830 static inline tree
3831 gimple_phi_result (const_gimple gs)
3833 const gimple_statement_phi *phi_stmt =
3834 as_a <const gimple_statement_phi *> (gs);
3835 return phi_stmt->result;
3838 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3840 static inline tree *
3841 gimple_phi_result_ptr (gimple gs)
3843 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3844 return &phi_stmt->result;
3847 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3849 static inline void
3850 gimple_phi_set_result (gimple gs, tree result)
3852 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3853 phi_stmt->result = result;
3854 if (result && TREE_CODE (result) == SSA_NAME)
3855 SSA_NAME_DEF_STMT (result) = gs;
3859 /* Return the PHI argument corresponding to incoming edge INDEX for
3860 GIMPLE_PHI GS. */
3862 static inline struct phi_arg_d *
3863 gimple_phi_arg (gimple gs, unsigned index)
3865 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3866 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3867 return &(phi_stmt->args[index]);
3870 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3871 for GIMPLE_PHI GS. */
3873 static inline void
3874 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3876 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3877 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3878 phi_stmt->args[index] = *phiarg;
3881 /* Return the PHI nodes for basic block BB, or NULL if there are no
3882 PHI nodes. */
3884 static inline gimple_seq
3885 phi_nodes (const_basic_block bb)
3887 gcc_checking_assert (!(bb->flags & BB_RTL));
3888 return bb->il.gimple.phi_nodes;
3891 /* Return a pointer to the PHI nodes for basic block BB. */
3893 static inline gimple_seq *
3894 phi_nodes_ptr (basic_block bb)
3896 gcc_checking_assert (!(bb->flags & BB_RTL));
3897 return &bb->il.gimple.phi_nodes;
3900 /* Return the tree operand for argument I of PHI node GS. */
3902 static inline tree
3903 gimple_phi_arg_def (gimple gs, size_t index)
3905 return gimple_phi_arg (gs, index)->def;
3909 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3911 static inline tree *
3912 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3914 return &gimple_phi_arg (gs, index)->def;
3917 /* Return the edge associated with argument I of phi node GS. */
3919 static inline edge
3920 gimple_phi_arg_edge (gimple gs, size_t i)
3922 return EDGE_PRED (gimple_bb (gs), i);
3925 /* Return the source location of gimple argument I of phi node GS. */
3927 static inline source_location
3928 gimple_phi_arg_location (gimple gs, size_t i)
3930 return gimple_phi_arg (gs, i)->locus;
3933 /* Return the source location of the argument on edge E of phi node GS. */
3935 static inline source_location
3936 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3938 return gimple_phi_arg (gs, e->dest_idx)->locus;
3941 /* Set the source location of gimple argument I of phi node GS to LOC. */
3943 static inline void
3944 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3946 gimple_phi_arg (gs, i)->locus = loc;
3949 /* Return TRUE if argument I of phi node GS has a location record. */
3951 static inline bool
3952 gimple_phi_arg_has_location (gimple gs, size_t i)
3954 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3958 /* Return the region number for GIMPLE_RESX GS. */
3960 static inline int
3961 gimple_resx_region (const_gimple gs)
3963 const gimple_statement_resx *resx_stmt =
3964 as_a <const gimple_statement_resx *> (gs);
3965 return resx_stmt->region;
3968 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3970 static inline void
3971 gimple_resx_set_region (gimple gs, int region)
3973 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
3974 resx_stmt->region = region;
3977 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3979 static inline int
3980 gimple_eh_dispatch_region (const_gimple gs)
3982 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3983 as_a <const gimple_statement_eh_dispatch *> (gs);
3984 return eh_dispatch_stmt->region;
3987 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3989 static inline void
3990 gimple_eh_dispatch_set_region (gimple gs, int region)
3992 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3993 as_a <gimple_statement_eh_dispatch *> (gs);
3994 eh_dispatch_stmt->region = region;
3997 /* Return the number of labels associated with the switch statement GS. */
3999 static inline unsigned
4000 gimple_switch_num_labels (const_gimple_switch gs)
4002 unsigned num_ops;
4003 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4004 num_ops = gimple_num_ops (gs);
4005 gcc_gimple_checking_assert (num_ops > 1);
4006 return num_ops - 1;
4010 /* Set NLABELS to be the number of labels for the switch statement GS. */
4012 static inline void
4013 gimple_switch_set_num_labels (gimple_switch g, unsigned nlabels)
4015 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4016 gimple_set_num_ops (g, nlabels + 1);
4020 /* Return the index variable used by the switch statement GS. */
4022 static inline tree
4023 gimple_switch_index (const_gimple gs)
4025 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4026 return gimple_op (gs, 0);
4030 /* Return a pointer to the index variable for the switch statement GS. */
4032 static inline tree *
4033 gimple_switch_index_ptr (const_gimple gs)
4035 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4036 return gimple_op_ptr (gs, 0);
4040 /* Set INDEX to be the index variable for switch statement GS. */
4042 static inline void
4043 gimple_switch_set_index (gimple_switch gs, tree index)
4045 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4046 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4047 gimple_set_op (gs, 0, index);
4051 /* Return the label numbered INDEX. The default label is 0, followed by any
4052 labels in a switch statement. */
4054 static inline tree
4055 gimple_switch_label (const_gimple_switch gs, unsigned index)
4057 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4058 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4059 return gimple_op (gs, index + 1);
4062 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4064 static inline void
4065 gimple_switch_set_label (gimple_switch gs, unsigned index, tree label)
4067 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4068 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4069 && (label == NULL_TREE
4070 || TREE_CODE (label) == CASE_LABEL_EXPR));
4071 gimple_set_op (gs, index + 1, label);
4074 /* Return the default label for a switch statement. */
4076 static inline tree
4077 gimple_switch_default_label (const_gimple_switch gs)
4079 tree label = gimple_switch_label (gs, 0);
4080 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4081 return label;
4084 /* Set the default label for a switch statement. */
4086 static inline void
4087 gimple_switch_set_default_label (gimple_switch gs, tree label)
4089 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4090 gimple_switch_set_label (gs, 0, label);
4093 /* Return true if GS is a GIMPLE_DEBUG statement. */
4095 static inline bool
4096 is_gimple_debug (const_gimple gs)
4098 return gimple_code (gs) == GIMPLE_DEBUG;
4101 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4103 static inline bool
4104 gimple_debug_bind_p (const_gimple s)
4106 if (is_gimple_debug (s))
4107 return s->subcode == GIMPLE_DEBUG_BIND;
4109 return false;
4112 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4114 static inline tree
4115 gimple_debug_bind_get_var (gimple dbg)
4117 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4118 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4119 return gimple_op (dbg, 0);
4122 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4123 statement. */
4125 static inline tree
4126 gimple_debug_bind_get_value (gimple dbg)
4128 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4129 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4130 return gimple_op (dbg, 1);
4133 /* Return a pointer to the value bound to the variable in a
4134 GIMPLE_DEBUG bind statement. */
4136 static inline tree *
4137 gimple_debug_bind_get_value_ptr (gimple dbg)
4139 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4140 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4141 return gimple_op_ptr (dbg, 1);
4144 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4146 static inline void
4147 gimple_debug_bind_set_var (gimple dbg, tree var)
4149 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4150 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4151 gimple_set_op (dbg, 0, var);
4154 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4155 statement. */
4157 static inline void
4158 gimple_debug_bind_set_value (gimple dbg, tree value)
4160 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4161 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4162 gimple_set_op (dbg, 1, value);
4165 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4166 optimized away. */
4167 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4169 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4170 statement. */
4172 static inline void
4173 gimple_debug_bind_reset_value (gimple dbg)
4175 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4176 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4177 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4180 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4181 value. */
4183 static inline bool
4184 gimple_debug_bind_has_value_p (gimple dbg)
4186 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4187 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4188 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4191 #undef GIMPLE_DEBUG_BIND_NOVALUE
4193 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4195 static inline bool
4196 gimple_debug_source_bind_p (const_gimple s)
4198 if (is_gimple_debug (s))
4199 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4201 return false;
4204 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4206 static inline tree
4207 gimple_debug_source_bind_get_var (gimple dbg)
4209 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4210 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4211 return gimple_op (dbg, 0);
4214 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4215 statement. */
4217 static inline tree
4218 gimple_debug_source_bind_get_value (gimple dbg)
4220 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4221 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4222 return gimple_op (dbg, 1);
4225 /* Return a pointer to the value bound to the variable in a
4226 GIMPLE_DEBUG source bind statement. */
4228 static inline tree *
4229 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4231 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4232 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4233 return gimple_op_ptr (dbg, 1);
4236 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4238 static inline void
4239 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4241 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4242 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4243 gimple_set_op (dbg, 0, var);
4246 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4247 statement. */
4249 static inline void
4250 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4252 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4253 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4254 gimple_set_op (dbg, 1, value);
4257 /* Return the line number for EXPR, or return -1 if we have no line
4258 number information for it. */
4259 static inline int
4260 get_lineno (const_gimple stmt)
4262 location_t loc;
4264 if (!stmt)
4265 return -1;
4267 loc = gimple_location (stmt);
4268 if (loc == UNKNOWN_LOCATION)
4269 return -1;
4271 return LOCATION_LINE (loc);
4274 /* Return a pointer to the body for the OMP statement GS. */
4276 static inline gimple_seq *
4277 gimple_omp_body_ptr (gimple gs)
4279 return &static_cast <gimple_statement_omp *> (gs)->body;
4282 /* Return the body for the OMP statement GS. */
4284 static inline gimple_seq
4285 gimple_omp_body (gimple gs)
4287 return *gimple_omp_body_ptr (gs);
4290 /* Set BODY to be the body for the OMP statement GS. */
4292 static inline void
4293 gimple_omp_set_body (gimple gs, gimple_seq body)
4295 static_cast <gimple_statement_omp *> (gs)->body = body;
4299 /* Return the name associated with OMP_CRITICAL statement GS. */
4301 static inline tree
4302 gimple_omp_critical_name (const_gimple gs)
4304 const gimple_statement_omp_critical *omp_critical_stmt =
4305 as_a <const gimple_statement_omp_critical *> (gs);
4306 return omp_critical_stmt->name;
4310 /* Return a pointer to the name associated with OMP critical statement GS. */
4312 static inline tree *
4313 gimple_omp_critical_name_ptr (gimple gs)
4315 gimple_statement_omp_critical *omp_critical_stmt =
4316 as_a <gimple_statement_omp_critical *> (gs);
4317 return &omp_critical_stmt->name;
4321 /* Set NAME to be the name associated with OMP critical statement GS. */
4323 static inline void
4324 gimple_omp_critical_set_name (gimple gs, tree name)
4326 gimple_statement_omp_critical *omp_critical_stmt =
4327 as_a <gimple_statement_omp_critical *> (gs);
4328 omp_critical_stmt->name = name;
4332 /* Return the kind of OMP for statemement. */
4334 static inline int
4335 gimple_omp_for_kind (const_gimple g)
4337 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4338 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4342 /* Set the OMP for kind. */
4344 static inline void
4345 gimple_omp_for_set_kind (gimple g, int kind)
4347 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4348 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4349 | (kind & GF_OMP_FOR_KIND_MASK);
4353 /* Return true if OMP for statement G has the
4354 GF_OMP_FOR_COMBINED flag set. */
4356 static inline bool
4357 gimple_omp_for_combined_p (const_gimple g)
4359 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4360 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4364 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4365 value of COMBINED_P. */
4367 static inline void
4368 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4370 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4371 if (combined_p)
4372 g->subcode |= GF_OMP_FOR_COMBINED;
4373 else
4374 g->subcode &= ~GF_OMP_FOR_COMBINED;
4378 /* Return true if OMP for statement G has the
4379 GF_OMP_FOR_COMBINED_INTO flag set. */
4381 static inline bool
4382 gimple_omp_for_combined_into_p (const_gimple g)
4384 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4385 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4389 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4390 value of COMBINED_P. */
4392 static inline void
4393 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4395 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4396 if (combined_p)
4397 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4398 else
4399 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4403 /* Return the clauses associated with OMP_FOR GS. */
4405 static inline tree
4406 gimple_omp_for_clauses (const_gimple gs)
4408 const gimple_statement_omp_for *omp_for_stmt =
4409 as_a <const gimple_statement_omp_for *> (gs);
4410 return omp_for_stmt->clauses;
4414 /* Return a pointer to the OMP_FOR GS. */
4416 static inline tree *
4417 gimple_omp_for_clauses_ptr (gimple gs)
4419 gimple_statement_omp_for *omp_for_stmt =
4420 as_a <gimple_statement_omp_for *> (gs);
4421 return &omp_for_stmt->clauses;
4425 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4427 static inline void
4428 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4430 gimple_statement_omp_for *omp_for_stmt =
4431 as_a <gimple_statement_omp_for *> (gs);
4432 omp_for_stmt->clauses = clauses;
4436 /* Get the collapse count of OMP_FOR GS. */
4438 static inline size_t
4439 gimple_omp_for_collapse (gimple gs)
4441 gimple_statement_omp_for *omp_for_stmt =
4442 as_a <gimple_statement_omp_for *> (gs);
4443 return omp_for_stmt->collapse;
4447 /* Return the index variable for OMP_FOR GS. */
4449 static inline tree
4450 gimple_omp_for_index (const_gimple gs, size_t i)
4452 const gimple_statement_omp_for *omp_for_stmt =
4453 as_a <const gimple_statement_omp_for *> (gs);
4454 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4455 return omp_for_stmt->iter[i].index;
4459 /* Return a pointer to the index variable for OMP_FOR GS. */
4461 static inline tree *
4462 gimple_omp_for_index_ptr (gimple gs, size_t i)
4464 gimple_statement_omp_for *omp_for_stmt =
4465 as_a <gimple_statement_omp_for *> (gs);
4466 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4467 return &omp_for_stmt->iter[i].index;
4471 /* Set INDEX to be the index variable for OMP_FOR GS. */
4473 static inline void
4474 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4476 gimple_statement_omp_for *omp_for_stmt =
4477 as_a <gimple_statement_omp_for *> (gs);
4478 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4479 omp_for_stmt->iter[i].index = index;
4483 /* Return the initial value for OMP_FOR GS. */
4485 static inline tree
4486 gimple_omp_for_initial (const_gimple gs, size_t i)
4488 const gimple_statement_omp_for *omp_for_stmt =
4489 as_a <const gimple_statement_omp_for *> (gs);
4490 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4491 return omp_for_stmt->iter[i].initial;
4495 /* Return a pointer to the initial value for OMP_FOR GS. */
4497 static inline tree *
4498 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4500 gimple_statement_omp_for *omp_for_stmt =
4501 as_a <gimple_statement_omp_for *> (gs);
4502 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4503 return &omp_for_stmt->iter[i].initial;
4507 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4509 static inline void
4510 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4512 gimple_statement_omp_for *omp_for_stmt =
4513 as_a <gimple_statement_omp_for *> (gs);
4514 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4515 omp_for_stmt->iter[i].initial = initial;
4519 /* Return the final value for OMP_FOR GS. */
4521 static inline tree
4522 gimple_omp_for_final (const_gimple gs, size_t i)
4524 const gimple_statement_omp_for *omp_for_stmt =
4525 as_a <const gimple_statement_omp_for *> (gs);
4526 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4527 return omp_for_stmt->iter[i].final;
4531 /* Return a pointer to the final value for OMP_FOR GS. */
4533 static inline tree *
4534 gimple_omp_for_final_ptr (gimple gs, size_t i)
4536 gimple_statement_omp_for *omp_for_stmt =
4537 as_a <gimple_statement_omp_for *> (gs);
4538 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4539 return &omp_for_stmt->iter[i].final;
4543 /* Set FINAL to be the final value for OMP_FOR GS. */
4545 static inline void
4546 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4548 gimple_statement_omp_for *omp_for_stmt =
4549 as_a <gimple_statement_omp_for *> (gs);
4550 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4551 omp_for_stmt->iter[i].final = final;
4555 /* Return the increment value for OMP_FOR GS. */
4557 static inline tree
4558 gimple_omp_for_incr (const_gimple gs, size_t i)
4560 const gimple_statement_omp_for *omp_for_stmt =
4561 as_a <const gimple_statement_omp_for *> (gs);
4562 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4563 return omp_for_stmt->iter[i].incr;
4567 /* Return a pointer to the increment value for OMP_FOR GS. */
4569 static inline tree *
4570 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4572 gimple_statement_omp_for *omp_for_stmt =
4573 as_a <gimple_statement_omp_for *> (gs);
4574 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4575 return &omp_for_stmt->iter[i].incr;
4579 /* Set INCR to be the increment value for OMP_FOR GS. */
4581 static inline void
4582 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4584 gimple_statement_omp_for *omp_for_stmt =
4585 as_a <gimple_statement_omp_for *> (gs);
4586 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4587 omp_for_stmt->iter[i].incr = incr;
4591 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4592 statement GS starts. */
4594 static inline gimple_seq *
4595 gimple_omp_for_pre_body_ptr (gimple gs)
4597 gimple_statement_omp_for *omp_for_stmt =
4598 as_a <gimple_statement_omp_for *> (gs);
4599 return &omp_for_stmt->pre_body;
4603 /* Return the sequence of statements to execute before the OMP_FOR
4604 statement GS starts. */
4606 static inline gimple_seq
4607 gimple_omp_for_pre_body (gimple gs)
4609 return *gimple_omp_for_pre_body_ptr (gs);
4613 /* Set PRE_BODY to be the sequence of statements to execute before the
4614 OMP_FOR statement GS starts. */
4616 static inline void
4617 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4619 gimple_statement_omp_for *omp_for_stmt =
4620 as_a <gimple_statement_omp_for *> (gs);
4621 omp_for_stmt->pre_body = pre_body;
4625 /* Return the clauses associated with OMP_PARALLEL GS. */
4627 static inline tree
4628 gimple_omp_parallel_clauses (const_gimple gs)
4630 const gimple_statement_omp_parallel *omp_parallel_stmt =
4631 as_a <const gimple_statement_omp_parallel *> (gs);
4632 return omp_parallel_stmt->clauses;
4636 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4638 static inline tree *
4639 gimple_omp_parallel_clauses_ptr (gimple gs)
4641 gimple_statement_omp_parallel *omp_parallel_stmt =
4642 as_a <gimple_statement_omp_parallel *> (gs);
4643 return &omp_parallel_stmt->clauses;
4647 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4648 GS. */
4650 static inline void
4651 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4653 gimple_statement_omp_parallel *omp_parallel_stmt =
4654 as_a <gimple_statement_omp_parallel *> (gs);
4655 omp_parallel_stmt->clauses = clauses;
4659 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4661 static inline tree
4662 gimple_omp_parallel_child_fn (const_gimple gs)
4664 const gimple_statement_omp_parallel *omp_parallel_stmt =
4665 as_a <const gimple_statement_omp_parallel *> (gs);
4666 return omp_parallel_stmt->child_fn;
4669 /* Return a pointer to the child function used to hold the body of
4670 OMP_PARALLEL GS. */
4672 static inline tree *
4673 gimple_omp_parallel_child_fn_ptr (gimple gs)
4675 gimple_statement_omp_parallel *omp_parallel_stmt =
4676 as_a <gimple_statement_omp_parallel *> (gs);
4677 return &omp_parallel_stmt->child_fn;
4681 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4683 static inline void
4684 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4686 gimple_statement_omp_parallel *omp_parallel_stmt =
4687 as_a <gimple_statement_omp_parallel *> (gs);
4688 omp_parallel_stmt->child_fn = child_fn;
4692 /* Return the artificial argument used to send variables and values
4693 from the parent to the children threads in OMP_PARALLEL GS. */
4695 static inline tree
4696 gimple_omp_parallel_data_arg (const_gimple gs)
4698 const gimple_statement_omp_parallel *omp_parallel_stmt =
4699 as_a <const gimple_statement_omp_parallel *> (gs);
4700 return omp_parallel_stmt->data_arg;
4704 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4706 static inline tree *
4707 gimple_omp_parallel_data_arg_ptr (gimple gs)
4709 gimple_statement_omp_parallel *omp_parallel_stmt =
4710 as_a <gimple_statement_omp_parallel *> (gs);
4711 return &omp_parallel_stmt->data_arg;
4715 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4717 static inline void
4718 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4720 gimple_statement_omp_parallel *omp_parallel_stmt =
4721 as_a <gimple_statement_omp_parallel *> (gs);
4722 omp_parallel_stmt->data_arg = data_arg;
4726 /* Return the clauses associated with OMP_TASK GS. */
4728 static inline tree
4729 gimple_omp_task_clauses (const_gimple gs)
4731 const gimple_statement_omp_task *omp_task_stmt =
4732 as_a <const gimple_statement_omp_task *> (gs);
4733 return omp_task_stmt->clauses;
4737 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4739 static inline tree *
4740 gimple_omp_task_clauses_ptr (gimple gs)
4742 gimple_statement_omp_task *omp_task_stmt =
4743 as_a <gimple_statement_omp_task *> (gs);
4744 return &omp_task_stmt->clauses;
4748 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4749 GS. */
4751 static inline void
4752 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4754 gimple_statement_omp_task *omp_task_stmt =
4755 as_a <gimple_statement_omp_task *> (gs);
4756 omp_task_stmt->clauses = clauses;
4760 /* Return the child function used to hold the body of OMP_TASK GS. */
4762 static inline tree
4763 gimple_omp_task_child_fn (const_gimple gs)
4765 const gimple_statement_omp_task *omp_task_stmt =
4766 as_a <const gimple_statement_omp_task *> (gs);
4767 return omp_task_stmt->child_fn;
4770 /* Return a pointer to the child function used to hold the body of
4771 OMP_TASK GS. */
4773 static inline tree *
4774 gimple_omp_task_child_fn_ptr (gimple gs)
4776 gimple_statement_omp_task *omp_task_stmt =
4777 as_a <gimple_statement_omp_task *> (gs);
4778 return &omp_task_stmt->child_fn;
4782 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4784 static inline void
4785 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4787 gimple_statement_omp_task *omp_task_stmt =
4788 as_a <gimple_statement_omp_task *> (gs);
4789 omp_task_stmt->child_fn = child_fn;
4793 /* Return the artificial argument used to send variables and values
4794 from the parent to the children threads in OMP_TASK GS. */
4796 static inline tree
4797 gimple_omp_task_data_arg (const_gimple gs)
4799 const gimple_statement_omp_task *omp_task_stmt =
4800 as_a <const gimple_statement_omp_task *> (gs);
4801 return omp_task_stmt->data_arg;
4805 /* Return a pointer to the data argument for OMP_TASK GS. */
4807 static inline tree *
4808 gimple_omp_task_data_arg_ptr (gimple gs)
4810 gimple_statement_omp_task *omp_task_stmt =
4811 as_a <gimple_statement_omp_task *> (gs);
4812 return &omp_task_stmt->data_arg;
4816 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4818 static inline void
4819 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4821 gimple_statement_omp_task *omp_task_stmt =
4822 as_a <gimple_statement_omp_task *> (gs);
4823 omp_task_stmt->data_arg = data_arg;
4827 /* Return the clauses associated with OMP_TASK GS. */
4829 static inline tree
4830 gimple_omp_taskreg_clauses (const_gimple gs)
4832 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4833 as_a <const gimple_statement_omp_taskreg *> (gs);
4834 return omp_taskreg_stmt->clauses;
4838 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4840 static inline tree *
4841 gimple_omp_taskreg_clauses_ptr (gimple gs)
4843 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4844 as_a <gimple_statement_omp_taskreg *> (gs);
4845 return &omp_taskreg_stmt->clauses;
4849 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4850 GS. */
4852 static inline void
4853 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4855 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4856 as_a <gimple_statement_omp_taskreg *> (gs);
4857 omp_taskreg_stmt->clauses = clauses;
4861 /* Return the child function used to hold the body of OMP_TASK GS. */
4863 static inline tree
4864 gimple_omp_taskreg_child_fn (const_gimple gs)
4866 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4867 as_a <const gimple_statement_omp_taskreg *> (gs);
4868 return omp_taskreg_stmt->child_fn;
4871 /* Return a pointer to the child function used to hold the body of
4872 OMP_TASK GS. */
4874 static inline tree *
4875 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4877 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4878 as_a <gimple_statement_omp_taskreg *> (gs);
4879 return &omp_taskreg_stmt->child_fn;
4883 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4885 static inline void
4886 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4888 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4889 as_a <gimple_statement_omp_taskreg *> (gs);
4890 omp_taskreg_stmt->child_fn = child_fn;
4894 /* Return the artificial argument used to send variables and values
4895 from the parent to the children threads in OMP_TASK GS. */
4897 static inline tree
4898 gimple_omp_taskreg_data_arg (const_gimple gs)
4900 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4901 as_a <const gimple_statement_omp_taskreg *> (gs);
4902 return omp_taskreg_stmt->data_arg;
4906 /* Return a pointer to the data argument for OMP_TASK GS. */
4908 static inline tree *
4909 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4911 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4912 as_a <gimple_statement_omp_taskreg *> (gs);
4913 return &omp_taskreg_stmt->data_arg;
4917 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4919 static inline void
4920 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4922 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4923 as_a <gimple_statement_omp_taskreg *> (gs);
4924 omp_taskreg_stmt->data_arg = data_arg;
4928 /* Return the copy function used to hold the body of OMP_TASK GS. */
4930 static inline tree
4931 gimple_omp_task_copy_fn (const_gimple gs)
4933 const gimple_statement_omp_task *omp_task_stmt =
4934 as_a <const gimple_statement_omp_task *> (gs);
4935 return omp_task_stmt->copy_fn;
4938 /* Return a pointer to the copy function used to hold the body of
4939 OMP_TASK GS. */
4941 static inline tree *
4942 gimple_omp_task_copy_fn_ptr (gimple gs)
4944 gimple_statement_omp_task *omp_task_stmt =
4945 as_a <gimple_statement_omp_task *> (gs);
4946 return &omp_task_stmt->copy_fn;
4950 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4952 static inline void
4953 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4955 gimple_statement_omp_task *omp_task_stmt =
4956 as_a <gimple_statement_omp_task *> (gs);
4957 omp_task_stmt->copy_fn = copy_fn;
4961 /* Return size of the data block in bytes in OMP_TASK GS. */
4963 static inline tree
4964 gimple_omp_task_arg_size (const_gimple gs)
4966 const gimple_statement_omp_task *omp_task_stmt =
4967 as_a <const gimple_statement_omp_task *> (gs);
4968 return omp_task_stmt->arg_size;
4972 /* Return a pointer to the data block size for OMP_TASK GS. */
4974 static inline tree *
4975 gimple_omp_task_arg_size_ptr (gimple gs)
4977 gimple_statement_omp_task *omp_task_stmt =
4978 as_a <gimple_statement_omp_task *> (gs);
4979 return &omp_task_stmt->arg_size;
4983 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4985 static inline void
4986 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4988 gimple_statement_omp_task *omp_task_stmt =
4989 as_a <gimple_statement_omp_task *> (gs);
4990 omp_task_stmt->arg_size = arg_size;
4994 /* Return align of the data block in bytes in OMP_TASK GS. */
4996 static inline tree
4997 gimple_omp_task_arg_align (const_gimple gs)
4999 const gimple_statement_omp_task *omp_task_stmt =
5000 as_a <const gimple_statement_omp_task *> (gs);
5001 return omp_task_stmt->arg_align;
5005 /* Return a pointer to the data block align for OMP_TASK GS. */
5007 static inline tree *
5008 gimple_omp_task_arg_align_ptr (gimple gs)
5010 gimple_statement_omp_task *omp_task_stmt =
5011 as_a <gimple_statement_omp_task *> (gs);
5012 return &omp_task_stmt->arg_align;
5016 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5018 static inline void
5019 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5021 gimple_statement_omp_task *omp_task_stmt =
5022 as_a <gimple_statement_omp_task *> (gs);
5023 omp_task_stmt->arg_align = arg_align;
5027 /* Return the clauses associated with OMP_SINGLE GS. */
5029 static inline tree
5030 gimple_omp_single_clauses (const_gimple gs)
5032 const gimple_statement_omp_single *omp_single_stmt =
5033 as_a <const gimple_statement_omp_single *> (gs);
5034 return omp_single_stmt->clauses;
5038 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5040 static inline tree *
5041 gimple_omp_single_clauses_ptr (gimple gs)
5043 gimple_statement_omp_single *omp_single_stmt =
5044 as_a <gimple_statement_omp_single *> (gs);
5045 return &omp_single_stmt->clauses;
5049 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5051 static inline void
5052 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5054 gimple_statement_omp_single *omp_single_stmt =
5055 as_a <gimple_statement_omp_single *> (gs);
5056 omp_single_stmt->clauses = clauses;
5060 /* Return the clauses associated with OMP_TARGET GS. */
5062 static inline tree
5063 gimple_omp_target_clauses (const_gimple gs)
5065 const gimple_statement_omp_target *omp_target_stmt =
5066 as_a <const gimple_statement_omp_target *> (gs);
5067 return omp_target_stmt->clauses;
5071 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5073 static inline tree *
5074 gimple_omp_target_clauses_ptr (gimple gs)
5076 gimple_statement_omp_target *omp_target_stmt =
5077 as_a <gimple_statement_omp_target *> (gs);
5078 return &omp_target_stmt->clauses;
5082 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5084 static inline void
5085 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5087 gimple_statement_omp_target *omp_target_stmt =
5088 as_a <gimple_statement_omp_target *> (gs);
5089 omp_target_stmt->clauses = clauses;
5093 /* Return the kind of OMP target statemement. */
5095 static inline int
5096 gimple_omp_target_kind (const_gimple g)
5098 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5099 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5103 /* Set the OMP target kind. */
5105 static inline void
5106 gimple_omp_target_set_kind (gimple g, int kind)
5108 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5109 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5110 | (kind & GF_OMP_TARGET_KIND_MASK);
5114 /* Return the child function used to hold the body of OMP_TARGET GS. */
5116 static inline tree
5117 gimple_omp_target_child_fn (const_gimple gs)
5119 const gimple_statement_omp_target *omp_target_stmt =
5120 as_a <const gimple_statement_omp_target *> (gs);
5121 return omp_target_stmt->child_fn;
5124 /* Return a pointer to the child function used to hold the body of
5125 OMP_TARGET GS. */
5127 static inline tree *
5128 gimple_omp_target_child_fn_ptr (gimple gs)
5130 gimple_statement_omp_target *omp_target_stmt =
5131 as_a <gimple_statement_omp_target *> (gs);
5132 return &omp_target_stmt->child_fn;
5136 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5138 static inline void
5139 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5141 gimple_statement_omp_target *omp_target_stmt =
5142 as_a <gimple_statement_omp_target *> (gs);
5143 omp_target_stmt->child_fn = child_fn;
5147 /* Return the artificial argument used to send variables and values
5148 from the parent to the children threads in OMP_TARGET GS. */
5150 static inline tree
5151 gimple_omp_target_data_arg (const_gimple gs)
5153 const gimple_statement_omp_target *omp_target_stmt =
5154 as_a <const gimple_statement_omp_target *> (gs);
5155 return omp_target_stmt->data_arg;
5159 /* Return a pointer to the data argument for OMP_TARGET GS. */
5161 static inline tree *
5162 gimple_omp_target_data_arg_ptr (gimple gs)
5164 gimple_statement_omp_target *omp_target_stmt =
5165 as_a <gimple_statement_omp_target *> (gs);
5166 return &omp_target_stmt->data_arg;
5170 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5172 static inline void
5173 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5175 gimple_statement_omp_target *omp_target_stmt =
5176 as_a <gimple_statement_omp_target *> (gs);
5177 omp_target_stmt->data_arg = data_arg;
5181 /* Return the clauses associated with OMP_TEAMS GS. */
5183 static inline tree
5184 gimple_omp_teams_clauses (const_gimple gs)
5186 const gimple_statement_omp_teams *omp_teams_stmt =
5187 as_a <const gimple_statement_omp_teams *> (gs);
5188 return omp_teams_stmt->clauses;
5192 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5194 static inline tree *
5195 gimple_omp_teams_clauses_ptr (gimple gs)
5197 gimple_statement_omp_teams *omp_teams_stmt =
5198 as_a <gimple_statement_omp_teams *> (gs);
5199 return &omp_teams_stmt->clauses;
5203 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5205 static inline void
5206 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5208 gimple_statement_omp_teams *omp_teams_stmt =
5209 as_a <gimple_statement_omp_teams *> (gs);
5210 omp_teams_stmt->clauses = clauses;
5214 /* Return the clauses associated with OMP_SECTIONS GS. */
5216 static inline tree
5217 gimple_omp_sections_clauses (const_gimple gs)
5219 const gimple_statement_omp_sections *omp_sections_stmt =
5220 as_a <const gimple_statement_omp_sections *> (gs);
5221 return omp_sections_stmt->clauses;
5225 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5227 static inline tree *
5228 gimple_omp_sections_clauses_ptr (gimple gs)
5230 gimple_statement_omp_sections *omp_sections_stmt =
5231 as_a <gimple_statement_omp_sections *> (gs);
5232 return &omp_sections_stmt->clauses;
5236 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5237 GS. */
5239 static inline void
5240 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5242 gimple_statement_omp_sections *omp_sections_stmt =
5243 as_a <gimple_statement_omp_sections *> (gs);
5244 omp_sections_stmt->clauses = clauses;
5248 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5249 in GS. */
5251 static inline tree
5252 gimple_omp_sections_control (const_gimple gs)
5254 const gimple_statement_omp_sections *omp_sections_stmt =
5255 as_a <const gimple_statement_omp_sections *> (gs);
5256 return omp_sections_stmt->control;
5260 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5261 GS. */
5263 static inline tree *
5264 gimple_omp_sections_control_ptr (gimple gs)
5266 gimple_statement_omp_sections *omp_sections_stmt =
5267 as_a <gimple_statement_omp_sections *> (gs);
5268 return &omp_sections_stmt->control;
5272 /* Set CONTROL to be the set of clauses associated with the
5273 GIMPLE_OMP_SECTIONS in GS. */
5275 static inline void
5276 gimple_omp_sections_set_control (gimple gs, tree control)
5278 gimple_statement_omp_sections *omp_sections_stmt =
5279 as_a <gimple_statement_omp_sections *> (gs);
5280 omp_sections_stmt->control = control;
5284 /* Set COND to be the condition code for OMP_FOR GS. */
5286 static inline void
5287 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5289 gimple_statement_omp_for *omp_for_stmt =
5290 as_a <gimple_statement_omp_for *> (gs);
5291 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5292 && i < omp_for_stmt->collapse);
5293 omp_for_stmt->iter[i].cond = cond;
5297 /* Return the condition code associated with OMP_FOR GS. */
5299 static inline enum tree_code
5300 gimple_omp_for_cond (const_gimple gs, size_t i)
5302 const gimple_statement_omp_for *omp_for_stmt =
5303 as_a <const gimple_statement_omp_for *> (gs);
5304 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5305 return omp_for_stmt->iter[i].cond;
5309 /* Set the value being stored in an atomic store. */
5311 static inline void
5312 gimple_omp_atomic_store_set_val (gimple g, tree val)
5314 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5315 as_a <gimple_statement_omp_atomic_store *> (g);
5316 omp_atomic_store_stmt->val = val;
5320 /* Return the value being stored in an atomic store. */
5322 static inline tree
5323 gimple_omp_atomic_store_val (const_gimple g)
5325 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5326 as_a <const gimple_statement_omp_atomic_store *> (g);
5327 return omp_atomic_store_stmt->val;
5331 /* Return a pointer to the value being stored in an atomic store. */
5333 static inline tree *
5334 gimple_omp_atomic_store_val_ptr (gimple g)
5336 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5337 as_a <gimple_statement_omp_atomic_store *> (g);
5338 return &omp_atomic_store_stmt->val;
5342 /* Set the LHS of an atomic load. */
5344 static inline void
5345 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5347 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5348 as_a <gimple_statement_omp_atomic_load *> (g);
5349 omp_atomic_load_stmt->lhs = lhs;
5353 /* Get the LHS of an atomic load. */
5355 static inline tree
5356 gimple_omp_atomic_load_lhs (const_gimple g)
5358 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5359 as_a <const gimple_statement_omp_atomic_load *> (g);
5360 return omp_atomic_load_stmt->lhs;
5364 /* Return a pointer to the LHS of an atomic load. */
5366 static inline tree *
5367 gimple_omp_atomic_load_lhs_ptr (gimple g)
5369 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5370 as_a <gimple_statement_omp_atomic_load *> (g);
5371 return &omp_atomic_load_stmt->lhs;
5375 /* Set the RHS of an atomic load. */
5377 static inline void
5378 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5380 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5381 as_a <gimple_statement_omp_atomic_load *> (g);
5382 omp_atomic_load_stmt->rhs = rhs;
5386 /* Get the RHS of an atomic load. */
5388 static inline tree
5389 gimple_omp_atomic_load_rhs (const_gimple g)
5391 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5392 as_a <const gimple_statement_omp_atomic_load *> (g);
5393 return omp_atomic_load_stmt->rhs;
5397 /* Return a pointer to the RHS of an atomic load. */
5399 static inline tree *
5400 gimple_omp_atomic_load_rhs_ptr (gimple g)
5402 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5403 as_a <gimple_statement_omp_atomic_load *> (g);
5404 return &omp_atomic_load_stmt->rhs;
5408 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5410 static inline tree
5411 gimple_omp_continue_control_def (const_gimple g)
5413 const gimple_statement_omp_continue *omp_continue_stmt =
5414 as_a <const gimple_statement_omp_continue *> (g);
5415 return omp_continue_stmt->control_def;
5418 /* The same as above, but return the address. */
5420 static inline tree *
5421 gimple_omp_continue_control_def_ptr (gimple g)
5423 gimple_statement_omp_continue *omp_continue_stmt =
5424 as_a <gimple_statement_omp_continue *> (g);
5425 return &omp_continue_stmt->control_def;
5428 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5430 static inline void
5431 gimple_omp_continue_set_control_def (gimple g, tree def)
5433 gimple_statement_omp_continue *omp_continue_stmt =
5434 as_a <gimple_statement_omp_continue *> (g);
5435 omp_continue_stmt->control_def = def;
5439 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5441 static inline tree
5442 gimple_omp_continue_control_use (const_gimple g)
5444 const gimple_statement_omp_continue *omp_continue_stmt =
5445 as_a <const gimple_statement_omp_continue *> (g);
5446 return omp_continue_stmt->control_use;
5450 /* The same as above, but return the address. */
5452 static inline tree *
5453 gimple_omp_continue_control_use_ptr (gimple g)
5455 gimple_statement_omp_continue *omp_continue_stmt =
5456 as_a <gimple_statement_omp_continue *> (g);
5457 return &omp_continue_stmt->control_use;
5461 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5463 static inline void
5464 gimple_omp_continue_set_control_use (gimple g, tree use)
5466 gimple_statement_omp_continue *omp_continue_stmt =
5467 as_a <gimple_statement_omp_continue *> (g);
5468 omp_continue_stmt->control_use = use;
5471 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5473 static inline gimple_seq *
5474 gimple_transaction_body_ptr (gimple gs)
5476 gimple_statement_transaction *transaction_stmt =
5477 as_a <gimple_statement_transaction *> (gs);
5478 return &transaction_stmt->body;
5481 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5483 static inline gimple_seq
5484 gimple_transaction_body (gimple gs)
5486 return *gimple_transaction_body_ptr (gs);
5489 /* Return the label associated with a GIMPLE_TRANSACTION. */
5491 static inline tree
5492 gimple_transaction_label (const_gimple gs)
5494 const gimple_statement_transaction *transaction_stmt =
5495 as_a <const gimple_statement_transaction *> (gs);
5496 return transaction_stmt->label;
5499 static inline tree *
5500 gimple_transaction_label_ptr (gimple gs)
5502 gimple_statement_transaction *transaction_stmt =
5503 as_a <gimple_statement_transaction *> (gs);
5504 return &transaction_stmt->label;
5507 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5509 static inline unsigned int
5510 gimple_transaction_subcode (const_gimple gs)
5512 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5513 return gs->subcode;
5516 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5518 static inline void
5519 gimple_transaction_set_body (gimple gs, gimple_seq body)
5521 gimple_statement_transaction *transaction_stmt =
5522 as_a <gimple_statement_transaction *> (gs);
5523 transaction_stmt->body = body;
5526 /* Set the label associated with a GIMPLE_TRANSACTION. */
5528 static inline void
5529 gimple_transaction_set_label (gimple gs, tree label)
5531 gimple_statement_transaction *transaction_stmt =
5532 as_a <gimple_statement_transaction *> (gs);
5533 transaction_stmt->label = label;
5536 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5538 static inline void
5539 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5541 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5542 gs->subcode = subcode;
5546 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5548 static inline tree *
5549 gimple_return_retval_ptr (const_gimple gs)
5551 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5552 return gimple_op_ptr (gs, 0);
5555 /* Return the return value for GIMPLE_RETURN GS. */
5557 static inline tree
5558 gimple_return_retval (const_gimple gs)
5560 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5561 return gimple_op (gs, 0);
5565 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5567 static inline void
5568 gimple_return_set_retval (gimple gs, tree retval)
5570 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5571 gimple_set_op (gs, 0, retval);
5575 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5577 #define CASE_GIMPLE_OMP \
5578 case GIMPLE_OMP_PARALLEL: \
5579 case GIMPLE_OMP_TASK: \
5580 case GIMPLE_OMP_FOR: \
5581 case GIMPLE_OMP_SECTIONS: \
5582 case GIMPLE_OMP_SECTIONS_SWITCH: \
5583 case GIMPLE_OMP_SINGLE: \
5584 case GIMPLE_OMP_TARGET: \
5585 case GIMPLE_OMP_TEAMS: \
5586 case GIMPLE_OMP_SECTION: \
5587 case GIMPLE_OMP_MASTER: \
5588 case GIMPLE_OMP_TASKGROUP: \
5589 case GIMPLE_OMP_ORDERED: \
5590 case GIMPLE_OMP_CRITICAL: \
5591 case GIMPLE_OMP_RETURN: \
5592 case GIMPLE_OMP_ATOMIC_LOAD: \
5593 case GIMPLE_OMP_ATOMIC_STORE: \
5594 case GIMPLE_OMP_CONTINUE
5596 static inline bool
5597 is_gimple_omp (const_gimple stmt)
5599 switch (gimple_code (stmt))
5601 CASE_GIMPLE_OMP:
5602 return true;
5603 default:
5604 return false;
5609 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5611 static inline bool
5612 gimple_nop_p (const_gimple g)
5614 return gimple_code (g) == GIMPLE_NOP;
5618 /* Return true if GS is a GIMPLE_RESX. */
5620 static inline bool
5621 is_gimple_resx (const_gimple gs)
5623 return gimple_code (gs) == GIMPLE_RESX;
5626 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5628 static inline enum br_predictor
5629 gimple_predict_predictor (gimple gs)
5631 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5632 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5636 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5638 static inline void
5639 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5641 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5642 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5643 | (unsigned) predictor;
5647 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5649 static inline enum prediction
5650 gimple_predict_outcome (gimple gs)
5652 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5653 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5657 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5659 static inline void
5660 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5662 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5663 if (outcome == TAKEN)
5664 gs->subcode |= GF_PREDICT_TAKEN;
5665 else
5666 gs->subcode &= ~GF_PREDICT_TAKEN;
5670 /* Return the type of the main expression computed by STMT. Return
5671 void_type_node if the statement computes nothing. */
5673 static inline tree
5674 gimple_expr_type (const_gimple stmt)
5676 enum gimple_code code = gimple_code (stmt);
5678 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5680 tree type;
5681 /* In general we want to pass out a type that can be substituted
5682 for both the RHS and the LHS types if there is a possibly
5683 useless conversion involved. That means returning the
5684 original RHS type as far as we can reconstruct it. */
5685 if (code == GIMPLE_CALL)
5687 if (gimple_call_internal_p (stmt)
5688 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5689 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5690 else
5691 type = gimple_call_return_type (stmt);
5693 else
5694 switch (gimple_assign_rhs_code (stmt))
5696 case POINTER_PLUS_EXPR:
5697 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5698 break;
5700 default:
5701 /* As fallback use the type of the LHS. */
5702 type = TREE_TYPE (gimple_get_lhs (stmt));
5703 break;
5705 return type;
5707 else if (code == GIMPLE_COND)
5708 return boolean_type_node;
5709 else
5710 return void_type_node;
5713 /* Enum and arrays used for allocation stats. Keep in sync with
5714 gimple.c:gimple_alloc_kind_names. */
5715 enum gimple_alloc_kind
5717 gimple_alloc_kind_assign, /* Assignments. */
5718 gimple_alloc_kind_phi, /* PHI nodes. */
5719 gimple_alloc_kind_cond, /* Conditionals. */
5720 gimple_alloc_kind_rest, /* Everything else. */
5721 gimple_alloc_kind_all
5724 extern int gimple_alloc_counts[];
5725 extern int gimple_alloc_sizes[];
5727 /* Return the allocation kind for a given stmt CODE. */
5728 static inline enum gimple_alloc_kind
5729 gimple_alloc_kind (enum gimple_code code)
5731 switch (code)
5733 case GIMPLE_ASSIGN:
5734 return gimple_alloc_kind_assign;
5735 case GIMPLE_PHI:
5736 return gimple_alloc_kind_phi;
5737 case GIMPLE_COND:
5738 return gimple_alloc_kind_cond;
5739 default:
5740 return gimple_alloc_kind_rest;
5744 /* Return true if a location should not be emitted for this statement
5745 by annotate_all_with_location. */
5747 static inline bool
5748 gimple_do_not_emit_location_p (gimple g)
5750 return gimple_plf (g, GF_PLF_1);
5753 /* Mark statement G so a location will not be emitted by
5754 annotate_one_with_location. */
5756 static inline void
5757 gimple_set_do_not_emit_location (gimple g)
5759 /* The PLF flags are initialized to 0 when a new tuple is created,
5760 so no need to initialize it anywhere. */
5761 gimple_set_plf (g, GF_PLF_1, true);
5765 /* Macros for showing usage statistics. */
5766 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5767 ? (x) \
5768 : ((x) < 1024*1024*10 \
5769 ? (x) / 1024 \
5770 : (x) / (1024*1024))))
5772 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5774 #endif /* GCC_GIMPLE_H */