* gimple.h (block_in_transaction): Move to basic-block.h and rename.
[official-gcc.git] / gcc / gimple.h
blob33e790c18da5881d3bf431117f934465d38ebd06
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2013 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 #include "pointer-set.h"
26 #include "hash-table.h"
27 #include "vec.h"
28 #include "ggc.h"
29 #include "basic-block.h"
30 #include "tree-ssa-alias.h"
31 #include "internal-fn.h"
32 #include "gimple-fold.h"
33 #include "tree-eh.h"
34 #include "gimple-expr.h"
36 typedef gimple gimple_seq_node;
38 /* For each block, the PHI nodes that need to be rewritten are stored into
39 these vectors. */
40 typedef vec<gimple> gimple_vec;
42 enum gimple_code {
43 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
44 #include "gimple.def"
45 #undef DEFGSCODE
46 LAST_AND_UNUSED_GIMPLE_CODE
49 extern const char *const gimple_code_name[];
50 extern const unsigned char gimple_rhs_class_table[];
52 /* Error out if a gimple tuple is addressed incorrectly. */
53 #if defined ENABLE_GIMPLE_CHECKING
54 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
55 extern void gimple_check_failed (const_gimple, const char *, int, \
56 const char *, enum gimple_code, \
57 enum tree_code) ATTRIBUTE_NORETURN;
59 #define GIMPLE_CHECK(GS, CODE) \
60 do { \
61 const_gimple __gs = (GS); \
62 if (gimple_code (__gs) != (CODE)) \
63 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
64 (CODE), ERROR_MARK); \
65 } while (0)
66 #else /* not ENABLE_GIMPLE_CHECKING */
67 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
68 #define GIMPLE_CHECK(GS, CODE) (void)0
69 #endif
71 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
72 get_gimple_rhs_class. */
73 enum gimple_rhs_class
75 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
76 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
77 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
78 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
79 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
80 name, a _DECL, a _REF, etc. */
83 /* Specific flags for individual GIMPLE statements. These flags are
84 always stored in gimple_statement_base.subcode and they may only be
85 defined for statement codes that do not use subcodes.
87 Values for the masks can overlap as long as the overlapping values
88 are never used in the same statement class.
90 The maximum mask value that can be defined is 1 << 15 (i.e., each
91 statement code can hold up to 16 bitflags).
93 Keep this list sorted. */
94 enum gf_mask {
95 GF_ASM_INPUT = 1 << 0,
96 GF_ASM_VOLATILE = 1 << 1,
97 GF_CALL_FROM_THUNK = 1 << 0,
98 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
99 GF_CALL_TAILCALL = 1 << 2,
100 GF_CALL_VA_ARG_PACK = 1 << 3,
101 GF_CALL_NOTHROW = 1 << 4,
102 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
103 GF_CALL_INTERNAL = 1 << 6,
104 GF_OMP_PARALLEL_COMBINED = 1 << 0,
105 GF_OMP_FOR_KIND_MASK = 3 << 0,
106 GF_OMP_FOR_KIND_FOR = 0 << 0,
107 GF_OMP_FOR_KIND_SIMD = 1 << 0,
108 GF_OMP_FOR_KIND_DISTRIBUTE = 2 << 0,
109 GF_OMP_FOR_COMBINED = 1 << 2,
110 GF_OMP_FOR_COMBINED_INTO = 1 << 3,
111 GF_OMP_TARGET_KIND_MASK = 3 << 0,
112 GF_OMP_TARGET_KIND_REGION = 0 << 0,
113 GF_OMP_TARGET_KIND_DATA = 1 << 0,
114 GF_OMP_TARGET_KIND_UPDATE = 2 << 0,
116 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
117 a thread synchronization via some sort of barrier. The exact barrier
118 that would otherwise be emitted is dependent on the OMP statement with
119 which this return is associated. */
120 GF_OMP_RETURN_NOWAIT = 1 << 0,
122 GF_OMP_SECTION_LAST = 1 << 0,
123 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
124 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
125 GF_PREDICT_TAKEN = 1 << 15
128 /* Currently, there are only two types of gimple debug stmt. Others are
129 envisioned, for example, to enable the generation of is_stmt notes
130 in line number information, to mark sequence points, etc. This
131 subcode is to be used to tell them apart. */
132 enum gimple_debug_subcode {
133 GIMPLE_DEBUG_BIND = 0,
134 GIMPLE_DEBUG_SOURCE_BIND = 1
137 /* Masks for selecting a pass local flag (PLF) to work on. These
138 masks are used by gimple_set_plf and gimple_plf. */
139 enum plf_mask {
140 GF_PLF_1 = 1 << 0,
141 GF_PLF_2 = 1 << 1
144 /* Iterator object for GIMPLE statement sequences. */
146 struct gimple_stmt_iterator_d
148 /* Sequence node holding the current statement. */
149 gimple_seq_node ptr;
151 /* Sequence and basic block holding the statement. These fields
152 are necessary to handle edge cases such as when statement is
153 added to an empty basic block or when the last statement of a
154 block/sequence is removed. */
155 gimple_seq *seq;
156 basic_block bb;
159 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
160 are for 64 bit hosts. */
162 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
163 /* [ WORD 1 ]
164 Main identifying code for a tuple. */
165 ENUM_BITFIELD(gimple_code) code : 8;
167 /* Nonzero if a warning should not be emitted on this tuple. */
168 unsigned int no_warning : 1;
170 /* Nonzero if this tuple has been visited. Passes are responsible
171 for clearing this bit before using it. */
172 unsigned int visited : 1;
174 /* Nonzero if this tuple represents a non-temporal move. */
175 unsigned int nontemporal_move : 1;
177 /* Pass local flags. These flags are free for any pass to use as
178 they see fit. Passes should not assume that these flags contain
179 any useful value when the pass starts. Any initial state that
180 the pass requires should be set on entry to the pass. See
181 gimple_set_plf and gimple_plf for usage. */
182 unsigned int plf : 2;
184 /* Nonzero if this statement has been modified and needs to have its
185 operands rescanned. */
186 unsigned modified : 1;
188 /* Nonzero if this statement contains volatile operands. */
189 unsigned has_volatile_ops : 1;
191 /* The SUBCODE field can be used for tuple-specific flags for tuples
192 that do not require subcodes. Note that SUBCODE should be at
193 least as wide as tree codes, as several tuples store tree codes
194 in there. */
195 unsigned int subcode : 16;
197 /* UID of this statement. This is used by passes that want to
198 assign IDs to statements. It must be assigned and used by each
199 pass. By default it should be assumed to contain garbage. */
200 unsigned uid;
202 /* [ WORD 2 ]
203 Locus information for debug info. */
204 location_t location;
206 /* Number of operands in this tuple. */
207 unsigned num_ops;
209 /* [ WORD 3 ]
210 Basic block holding this statement. */
211 basic_block bb;
213 /* [ WORD 4-5 ]
214 Linked lists of gimple statements. The next pointers form
215 a NULL terminated list, the prev pointers are a cyclic list.
216 A gimple statement is hence also a double-ended list of
217 statements, with the pointer itself being the first element,
218 and the prev pointer being the last. */
219 gimple next;
220 gimple GTY((skip)) prev;
224 /* Base structure for tuples with operands. */
226 struct GTY(()) gimple_statement_with_ops_base
228 /* [ WORD 1-6 ] */
229 struct gimple_statement_base gsbase;
231 /* [ WORD 7 ]
232 SSA operand vectors. NOTE: It should be possible to
233 amalgamate these vectors with the operand vector OP. However,
234 the SSA operand vectors are organized differently and contain
235 more information (like immediate use chaining). */
236 struct use_optype_d GTY((skip (""))) *use_ops;
240 /* Statements that take register operands. */
242 struct GTY(()) gimple_statement_with_ops
244 /* [ WORD 1-7 ] */
245 struct gimple_statement_with_ops_base opbase;
247 /* [ WORD 8 ]
248 Operand vector. NOTE! This must always be the last field
249 of this structure. In particular, this means that this
250 structure cannot be embedded inside another one. */
251 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
255 /* Base for statements that take both memory and register operands. */
257 struct GTY(()) gimple_statement_with_memory_ops_base
259 /* [ WORD 1-7 ] */
260 struct gimple_statement_with_ops_base opbase;
262 /* [ WORD 8-9 ]
263 Virtual operands for this statement. The GC will pick them
264 up via the ssa_names array. */
265 tree GTY((skip (""))) vdef;
266 tree GTY((skip (""))) vuse;
270 /* Statements that take both memory and register operands. */
272 struct GTY(()) gimple_statement_with_memory_ops
274 /* [ WORD 1-9 ] */
275 struct gimple_statement_with_memory_ops_base membase;
277 /* [ WORD 10 ]
278 Operand vector. NOTE! This must always be the last field
279 of this structure. In particular, this means that this
280 structure cannot be embedded inside another one. */
281 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
285 /* Call statements that take both memory and register operands. */
287 struct GTY(()) gimple_statement_call
289 /* [ WORD 1-9 ] */
290 struct gimple_statement_with_memory_ops_base membase;
292 /* [ WORD 10-13 ] */
293 struct pt_solution call_used;
294 struct pt_solution call_clobbered;
296 /* [ WORD 14 ] */
297 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
298 tree GTY ((tag ("0"))) fntype;
299 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
300 } u;
302 /* [ WORD 15 ]
303 Operand vector. NOTE! This must always be the last field
304 of this structure. In particular, this means that this
305 structure cannot be embedded inside another one. */
306 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
310 /* OpenMP statements (#pragma omp). */
312 struct GTY(()) gimple_statement_omp {
313 /* [ WORD 1-6 ] */
314 struct gimple_statement_base gsbase;
316 /* [ WORD 7 ] */
317 gimple_seq body;
321 /* GIMPLE_BIND */
323 struct GTY(()) gimple_statement_bind {
324 /* [ WORD 1-6 ] */
325 struct gimple_statement_base gsbase;
327 /* [ WORD 7 ]
328 Variables declared in this scope. */
329 tree vars;
331 /* [ WORD 8 ]
332 This is different than the BLOCK field in gimple_statement_base,
333 which is analogous to TREE_BLOCK (i.e., the lexical block holding
334 this statement). This field is the equivalent of BIND_EXPR_BLOCK
335 in tree land (i.e., the lexical scope defined by this bind). See
336 gimple-low.c. */
337 tree block;
339 /* [ WORD 9 ] */
340 gimple_seq body;
344 /* GIMPLE_CATCH */
346 struct GTY(()) gimple_statement_catch {
347 /* [ WORD 1-6 ] */
348 struct gimple_statement_base gsbase;
350 /* [ WORD 7 ] */
351 tree types;
353 /* [ WORD 8 ] */
354 gimple_seq handler;
358 /* GIMPLE_EH_FILTER */
360 struct GTY(()) gimple_statement_eh_filter {
361 /* [ WORD 1-6 ] */
362 struct gimple_statement_base gsbase;
364 /* [ WORD 7 ]
365 Filter types. */
366 tree types;
368 /* [ WORD 8 ]
369 Failure actions. */
370 gimple_seq failure;
373 /* GIMPLE_EH_ELSE */
375 struct GTY(()) gimple_statement_eh_else {
376 /* [ WORD 1-6 ] */
377 struct gimple_statement_base gsbase;
379 /* [ WORD 7,8 ] */
380 gimple_seq n_body, e_body;
383 /* GIMPLE_EH_MUST_NOT_THROW */
385 struct GTY(()) gimple_statement_eh_mnt {
386 /* [ WORD 1-6 ] */
387 struct gimple_statement_base gsbase;
389 /* [ WORD 7 ] Abort function decl. */
390 tree fndecl;
393 /* GIMPLE_PHI */
395 struct GTY(()) gimple_statement_phi {
396 /* [ WORD 1-6 ] */
397 struct gimple_statement_base gsbase;
399 /* [ WORD 7 ] */
400 unsigned capacity;
401 unsigned nargs;
403 /* [ WORD 8 ] */
404 tree result;
406 /* [ WORD 9 ] */
407 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
411 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
413 struct GTY(()) gimple_statement_eh_ctrl
415 /* [ WORD 1-6 ] */
416 struct gimple_statement_base gsbase;
418 /* [ WORD 7 ]
419 Exception region number. */
420 int region;
424 /* GIMPLE_TRY */
426 struct GTY(()) gimple_statement_try {
427 /* [ WORD 1-6 ] */
428 struct gimple_statement_base gsbase;
430 /* [ WORD 7 ]
431 Expression to evaluate. */
432 gimple_seq eval;
434 /* [ WORD 8 ]
435 Cleanup expression. */
436 gimple_seq cleanup;
439 /* Kind of GIMPLE_TRY statements. */
440 enum gimple_try_flags
442 /* A try/catch. */
443 GIMPLE_TRY_CATCH = 1 << 0,
445 /* A try/finally. */
446 GIMPLE_TRY_FINALLY = 1 << 1,
447 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
449 /* Analogous to TRY_CATCH_IS_CLEANUP. */
450 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
453 /* GIMPLE_WITH_CLEANUP_EXPR */
455 struct GTY(()) gimple_statement_wce {
456 /* [ WORD 1-6 ] */
457 struct gimple_statement_base gsbase;
459 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
460 executed if an exception is thrown, not on normal exit of its
461 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
462 in TARGET_EXPRs. */
464 /* [ WORD 7 ]
465 Cleanup expression. */
466 gimple_seq cleanup;
470 /* GIMPLE_ASM */
472 struct GTY(()) gimple_statement_asm
474 /* [ WORD 1-9 ] */
475 struct gimple_statement_with_memory_ops_base membase;
477 /* [ WORD 10 ]
478 __asm__ statement. */
479 const char *string;
481 /* [ WORD 11 ]
482 Number of inputs, outputs, clobbers, labels. */
483 unsigned char ni;
484 unsigned char no;
485 unsigned char nc;
486 unsigned char nl;
488 /* [ WORD 12 ]
489 Operand vector. NOTE! This must always be the last field
490 of this structure. In particular, this means that this
491 structure cannot be embedded inside another one. */
492 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
495 /* GIMPLE_OMP_CRITICAL */
497 struct GTY(()) gimple_statement_omp_critical {
498 /* [ WORD 1-7 ] */
499 struct gimple_statement_omp omp;
501 /* [ WORD 8 ]
502 Critical section name. */
503 tree name;
507 struct GTY(()) gimple_omp_for_iter {
508 /* Condition code. */
509 enum tree_code cond;
511 /* Index variable. */
512 tree index;
514 /* Initial value. */
515 tree initial;
517 /* Final value. */
518 tree final;
520 /* Increment. */
521 tree incr;
524 /* GIMPLE_OMP_FOR */
526 struct GTY(()) gimple_statement_omp_for {
527 /* [ WORD 1-7 ] */
528 struct gimple_statement_omp omp;
530 /* [ WORD 8 ] */
531 tree clauses;
533 /* [ WORD 9 ]
534 Number of elements in iter array. */
535 size_t collapse;
537 /* [ WORD 10 ] */
538 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
540 /* [ WORD 11 ]
541 Pre-body evaluated before the loop body begins. */
542 gimple_seq pre_body;
546 /* GIMPLE_OMP_PARALLEL */
548 struct GTY(()) gimple_statement_omp_parallel {
549 /* [ WORD 1-7 ] */
550 struct gimple_statement_omp omp;
552 /* [ WORD 8 ]
553 Clauses. */
554 tree clauses;
556 /* [ WORD 9 ]
557 Child function holding the body of the parallel region. */
558 tree child_fn;
560 /* [ WORD 10 ]
561 Shared data argument. */
562 tree data_arg;
566 /* GIMPLE_OMP_TASK */
568 struct GTY(()) gimple_statement_omp_task {
569 /* [ WORD 1-10 ] */
570 struct gimple_statement_omp_parallel par;
572 /* [ WORD 11 ]
573 Child function holding firstprivate initialization if needed. */
574 tree copy_fn;
576 /* [ WORD 12-13 ]
577 Size and alignment in bytes of the argument data block. */
578 tree arg_size;
579 tree arg_align;
583 /* GIMPLE_OMP_SECTION */
584 /* Uses struct gimple_statement_omp. */
587 /* GIMPLE_OMP_SECTIONS */
589 struct GTY(()) gimple_statement_omp_sections {
590 /* [ WORD 1-7 ] */
591 struct gimple_statement_omp omp;
593 /* [ WORD 8 ] */
594 tree clauses;
596 /* [ WORD 9 ]
597 The control variable used for deciding which of the sections to
598 execute. */
599 tree control;
602 /* GIMPLE_OMP_CONTINUE.
604 Note: This does not inherit from gimple_statement_omp, because we
605 do not need the body field. */
607 struct GTY(()) gimple_statement_omp_continue {
608 /* [ WORD 1-6 ] */
609 struct gimple_statement_base gsbase;
611 /* [ WORD 7 ] */
612 tree control_def;
614 /* [ WORD 8 ] */
615 tree control_use;
618 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS */
620 struct GTY(()) gimple_statement_omp_single {
621 /* [ WORD 1-7 ] */
622 struct gimple_statement_omp omp;
624 /* [ WORD 7 ] */
625 tree clauses;
629 /* GIMPLE_OMP_ATOMIC_LOAD.
630 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
631 contains a sequence, which we don't need here. */
633 struct GTY(()) gimple_statement_omp_atomic_load {
634 /* [ WORD 1-6 ] */
635 struct gimple_statement_base gsbase;
637 /* [ WORD 7-8 ] */
638 tree rhs, lhs;
641 /* GIMPLE_OMP_ATOMIC_STORE.
642 See note on GIMPLE_OMP_ATOMIC_LOAD. */
644 struct GTY(()) gimple_statement_omp_atomic_store {
645 /* [ WORD 1-6 ] */
646 struct gimple_statement_base gsbase;
648 /* [ WORD 7 ] */
649 tree val;
652 /* GIMPLE_TRANSACTION. */
654 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
656 /* The __transaction_atomic was declared [[outer]] or it is
657 __transaction_relaxed. */
658 #define GTMA_IS_OUTER (1u << 0)
659 #define GTMA_IS_RELAXED (1u << 1)
660 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
662 /* The transaction is seen to not have an abort. */
663 #define GTMA_HAVE_ABORT (1u << 2)
664 /* The transaction is seen to have loads or stores. */
665 #define GTMA_HAVE_LOAD (1u << 3)
666 #define GTMA_HAVE_STORE (1u << 4)
667 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
668 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
669 /* The transaction WILL enter serial irrevocable mode.
670 An irrevocable block post-dominates the entire transaction, such
671 that all invocations of the transaction will go serial-irrevocable.
672 In such case, we don't bother instrumenting the transaction, and
673 tell the runtime that it should begin the transaction in
674 serial-irrevocable mode. */
675 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
676 /* The transaction contains no instrumentation code whatsover, most
677 likely because it is guaranteed to go irrevocable upon entry. */
678 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
680 struct GTY(()) gimple_statement_transaction
682 /* [ WORD 1-9 ] */
683 struct gimple_statement_with_memory_ops_base gsbase;
685 /* [ WORD 10 ] */
686 gimple_seq body;
688 /* [ WORD 11 ] */
689 tree label;
692 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
693 enum gimple_statement_structure_enum {
694 #include "gsstruct.def"
695 LAST_GSS_ENUM
697 #undef DEFGSSTRUCT
700 /* Define the overall contents of a gimple tuple. It may be any of the
701 structures declared above for various types of tuples. */
703 union GTY ((desc ("gimple_statement_structure (&%h)"),
704 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
705 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
706 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
707 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
708 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
709 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
710 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
711 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
712 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
713 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
714 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
715 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
716 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
717 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
718 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
719 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
720 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
721 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
722 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
723 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
724 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
725 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
726 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
727 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
728 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
729 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
730 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
733 /* Offset in bytes to the location of the operand vector.
734 Zero if there is no operand vector for this tuple structure. */
735 extern size_t const gimple_ops_offset_[];
737 /* Map GIMPLE codes to GSS codes. */
738 extern enum gimple_statement_structure_enum const gss_for_code_[];
740 /* This variable holds the currently expanded gimple statement for purposes
741 of comminucating the profile info to the builtin expanders. */
742 extern gimple currently_expanding_gimple_stmt;
744 gimple gimple_build_return (tree);
746 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
747 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
749 gimple
750 gimple_build_assign_with_ops (enum tree_code, tree,
751 tree, tree CXX_MEM_STAT_INFO);
752 gimple
753 gimple_build_assign_with_ops (enum tree_code, tree,
754 tree, tree, tree CXX_MEM_STAT_INFO);
756 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
757 #define gimple_build_debug_bind(var,val,stmt) \
758 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
759 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
760 #define gimple_build_debug_source_bind(var,val,stmt) \
761 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
763 gimple gimple_build_call_vec (tree, vec<tree> );
764 gimple gimple_build_call (tree, unsigned, ...);
765 gimple gimple_build_call_valist (tree, unsigned, va_list);
766 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
767 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
768 gimple gimple_build_call_from_tree (tree);
769 gimple gimplify_assign (tree, tree, gimple_seq *);
770 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
771 gimple gimple_build_label (tree label);
772 gimple gimple_build_goto (tree dest);
773 gimple gimple_build_nop (void);
774 gimple gimple_build_bind (tree, gimple_seq, tree);
775 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
776 vec<tree, va_gc> *, vec<tree, va_gc> *,
777 vec<tree, va_gc> *);
778 gimple gimple_build_catch (tree, gimple_seq);
779 gimple gimple_build_eh_filter (tree, gimple_seq);
780 gimple gimple_build_eh_must_not_throw (tree);
781 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
782 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
783 gimple gimple_build_wce (gimple_seq);
784 gimple gimple_build_resx (int);
785 gimple gimple_build_eh_dispatch (int);
786 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
787 gimple gimple_build_switch (tree, tree, vec<tree> );
788 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
789 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
790 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
791 gimple gimple_build_omp_critical (gimple_seq, tree);
792 gimple gimple_build_omp_section (gimple_seq);
793 gimple gimple_build_omp_continue (tree, tree);
794 gimple gimple_build_omp_master (gimple_seq);
795 gimple gimple_build_omp_taskgroup (gimple_seq);
796 gimple gimple_build_omp_return (bool);
797 gimple gimple_build_omp_ordered (gimple_seq);
798 gimple gimple_build_omp_sections (gimple_seq, tree);
799 gimple gimple_build_omp_sections_switch (void);
800 gimple gimple_build_omp_single (gimple_seq, tree);
801 gimple gimple_build_omp_target (gimple_seq, int, tree);
802 gimple gimple_build_omp_teams (gimple_seq, tree);
803 gimple gimple_build_cdt (tree, tree);
804 gimple gimple_build_omp_atomic_load (tree, tree);
805 gimple gimple_build_omp_atomic_store (tree);
806 gimple gimple_build_transaction (gimple_seq, tree);
807 gimple gimple_build_predict (enum br_predictor, enum prediction);
808 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
809 void sort_case_labels (vec<tree> );
810 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
811 gimple_seq gimple_seq_alloc (void);
812 void gimple_seq_free (gimple_seq);
813 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
814 gimple_seq gimple_seq_copy (gimple_seq);
815 bool gimple_call_same_target_p (const_gimple, const_gimple);
816 int gimple_call_flags (const_gimple);
817 int gimple_call_return_flags (const_gimple);
818 int gimple_call_arg_flags (const_gimple, unsigned);
819 void gimple_call_reset_alias_info (gimple);
820 bool gimple_assign_copy_p (gimple);
821 bool gimple_assign_ssa_name_copy_p (gimple);
822 bool gimple_assign_unary_nop_p (gimple);
823 void gimple_set_bb (gimple, basic_block);
824 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
825 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
826 tree, tree, tree);
827 tree gimple_get_lhs (const_gimple);
828 void gimple_set_lhs (gimple, tree);
829 void gimple_replace_lhs (gimple, tree);
830 gimple gimple_copy (gimple);
831 gimple gimple_build_cond_from_tree (tree, tree, tree);
832 void gimple_cond_set_condition_from_tree (gimple, tree);
833 bool gimple_has_side_effects (const_gimple);
834 bool gimple_could_trap_p (gimple);
835 bool gimple_could_trap_p_1 (gimple, bool, bool);
836 bool gimple_assign_rhs_could_trap_p (gimple);
837 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
838 bool empty_body_p (gimple_seq);
839 unsigned get_gimple_rhs_num_ops (enum tree_code);
840 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
841 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
843 /* Return TRUE iff stmt is a call to a built-in function. */
844 extern bool is_gimple_builtin_call (gimple stmt);
846 extern void recalculate_side_effects (tree);
847 extern bool gimple_compare_field_offset (tree, tree);
848 extern tree gimple_unsigned_type (tree);
849 extern tree gimple_signed_type (tree);
850 extern alias_set_type gimple_get_alias_set (tree);
851 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
852 bool (*)(gimple, tree, void *),
853 bool (*)(gimple, tree, void *),
854 bool (*)(gimple, tree, void *));
855 extern bool walk_stmt_load_store_ops (gimple, void *,
856 bool (*)(gimple, tree, void *),
857 bool (*)(gimple, tree, void *));
858 extern bool gimple_ior_addresses_taken (bitmap, gimple);
859 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
860 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
861 extern bool gimple_asm_clobbers_memory_p (const_gimple);
863 /* In gimplify.c */
864 extern tree create_tmp_var_raw (tree, const char *);
865 extern tree create_tmp_var_name (const char *);
866 extern tree create_tmp_var (tree, const char *);
867 extern tree create_tmp_reg (tree, const char *);
868 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
869 extern tree get_formal_tmp_var (tree, gimple_seq *);
870 extern void declare_vars (tree, gimple, bool);
871 extern void annotate_all_with_location (gimple_seq, location_t);
872 extern unsigned gimple_call_get_nobnd_arg_index (const_gimple, unsigned);
874 /* Validation of GIMPLE expressions. Note that these predicates only check
875 the basic form of the expression, they don't recurse to make sure that
876 underlying nodes are also of the right form. */
877 typedef bool (*gimple_predicate)(tree);
880 /* FIXME we should deduce this from the predicate. */
881 enum fallback {
882 fb_none = 0, /* Do not generate a temporary. */
884 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
885 gimplified expression. */
887 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
888 gimplified expression. */
890 fb_mayfail = 4, /* Gimplification may fail. Error issued
891 afterwards. */
892 fb_either= fb_rvalue | fb_lvalue
895 typedef int fallback_t;
897 enum gimplify_status {
898 GS_ERROR = -2, /* Something Bad Seen. */
899 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
900 GS_OK = 0, /* We did something, maybe more to do. */
901 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
904 /* Formal (expression) temporary table handling: multiple occurrences of
905 the same scalar expression are evaluated into the same temporary. */
907 typedef struct gimple_temp_hash_elt
909 tree val; /* Key */
910 tree temp; /* Value */
911 } elt_t;
913 /* Gimplify hashtable helper. */
915 struct gimplify_hasher : typed_free_remove <elt_t>
917 typedef elt_t value_type;
918 typedef elt_t compare_type;
919 static inline hashval_t hash (const value_type *);
920 static inline bool equal (const value_type *, const compare_type *);
923 inline hashval_t
924 gimplify_hasher::hash (const value_type *p)
926 tree t = p->val;
927 return iterative_hash_expr (t, 0);
930 inline bool
931 gimplify_hasher::equal (const value_type *p1, const compare_type *p2)
933 tree t1 = p1->val;
934 tree t2 = p2->val;
935 enum tree_code code = TREE_CODE (t1);
937 if (TREE_CODE (t2) != code
938 || TREE_TYPE (t1) != TREE_TYPE (t2))
939 return false;
941 if (!operand_equal_p (t1, t2, 0))
942 return false;
944 #ifdef ENABLE_CHECKING
945 /* Only allow them to compare equal if they also hash equal; otherwise
946 results are nondeterminate, and we fail bootstrap comparison. */
947 gcc_assert (hash (p1) == hash (p2));
948 #endif
950 return true;
953 struct gimplify_ctx
955 struct gimplify_ctx *prev_context;
957 vec<gimple> bind_expr_stack;
958 tree temps;
959 gimple_seq conditional_cleanups;
960 tree exit_label;
961 tree return_temp;
963 vec<tree> case_labels;
964 /* The formal temporary table. Should this be persistent? */
965 hash_table <gimplify_hasher> temp_htab;
967 int conditions;
968 bool save_stack;
969 bool into_ssa;
970 bool allow_rhs_cond_expr;
971 bool in_cleanup_point_expr;
974 /* Return true if gimplify_one_sizepos doesn't need to gimplify
975 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
976 fields). */
977 static inline bool
978 is_gimple_sizepos (tree expr)
980 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
981 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
982 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
983 function, the gimplifier will want to replace it with a new variable,
984 but that will cause problems if this type is from outside the function.
985 It's OK to have that here. */
986 return (expr == NULL_TREE
987 || TREE_CONSTANT (expr)
988 || TREE_CODE (expr) == VAR_DECL
989 || CONTAINS_PLACEHOLDER_P (expr));
992 /* Get the number of the next statement uid to be allocated. */
993 static inline unsigned int
994 gimple_stmt_max_uid (struct function *fn)
996 return fn->last_stmt_uid;
999 /* Set the number of the next statement uid to be allocated. */
1000 static inline void
1001 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1003 fn->last_stmt_uid = maxid;
1006 /* Set the number of the next statement uid to be allocated. */
1007 static inline unsigned int
1008 inc_gimple_stmt_max_uid (struct function *fn)
1010 return fn->last_stmt_uid++;
1013 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1014 bool (*) (tree), fallback_t);
1015 extern void gimplify_type_sizes (tree, gimple_seq *);
1016 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1017 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1018 bool, tree);
1019 extern bool gimplify_stmt (tree *, gimple_seq *);
1020 extern gimple gimplify_body (tree, bool);
1021 extern void push_gimplify_context (struct gimplify_ctx *);
1022 extern void pop_gimplify_context (gimple);
1023 extern void gimplify_and_add (tree, gimple_seq *);
1025 /* Miscellaneous helpers. */
1026 extern void gimple_add_tmp_var (tree);
1027 extern gimple gimple_current_bind_expr (void);
1028 extern vec<gimple> gimple_bind_expr_stack (void);
1029 extern tree voidify_wrapper_expr (tree, tree);
1030 extern tree build_and_jump (tree *);
1031 extern tree force_labels_r (tree *, int *, void *);
1032 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1033 gimple_seq *);
1034 struct gimplify_omp_ctx;
1035 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1036 extern tree gimple_boolify (tree);
1037 extern gimple_predicate rhs_predicate_for (tree);
1038 extern tree canonicalize_cond_expr_cond (tree);
1039 extern void dump_decl_set (FILE *, bitmap);
1040 extern bool nonfreeing_call_p (gimple);
1041 extern bool infer_nonnull_range (gimple, tree);
1043 /* In trans-mem.c. */
1044 extern void diagnose_tm_safe_errors (tree);
1045 extern void compute_transaction_bits (void);
1047 /* In tree-nested.c. */
1048 extern void lower_nested_functions (tree);
1049 extern void insert_field_into_struct (tree, tree);
1051 /* In gimplify.c. */
1052 extern void gimplify_function_tree (tree);
1054 /* In cfgexpand.c. */
1055 extern tree gimple_assign_rhs_to_tree (gimple);
1057 /* In builtins.c */
1058 extern bool validate_gimple_arglist (const_gimple, ...);
1060 /* Return the first node in GIMPLE sequence S. */
1062 static inline gimple_seq_node
1063 gimple_seq_first (gimple_seq s)
1065 return s;
1069 /* Return the first statement in GIMPLE sequence S. */
1071 static inline gimple
1072 gimple_seq_first_stmt (gimple_seq s)
1074 gimple_seq_node n = gimple_seq_first (s);
1075 return n;
1079 /* Return the last node in GIMPLE sequence S. */
1081 static inline gimple_seq_node
1082 gimple_seq_last (gimple_seq s)
1084 return s ? s->gsbase.prev : NULL;
1088 /* Return the last statement in GIMPLE sequence S. */
1090 static inline gimple
1091 gimple_seq_last_stmt (gimple_seq s)
1093 gimple_seq_node n = gimple_seq_last (s);
1094 return n;
1098 /* Set the last node in GIMPLE sequence *PS to LAST. */
1100 static inline void
1101 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1103 (*ps)->gsbase.prev = last;
1107 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1109 static inline void
1110 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1112 *ps = first;
1116 /* Return true if GIMPLE sequence S is empty. */
1118 static inline bool
1119 gimple_seq_empty_p (gimple_seq s)
1121 return s == NULL;
1124 void gimple_seq_add_stmt (gimple_seq *, gimple);
1126 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1127 *SEQ_P is NULL, a new sequence is allocated. This function is
1128 similar to gimple_seq_add_stmt, but does not scan the operands.
1129 During gimplification, we need to manipulate statement sequences
1130 before the def/use vectors have been constructed. */
1131 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1133 /* Allocate a new sequence and initialize its first element with STMT. */
1135 static inline gimple_seq
1136 gimple_seq_alloc_with_stmt (gimple stmt)
1138 gimple_seq seq = NULL;
1139 gimple_seq_add_stmt (&seq, stmt);
1140 return seq;
1144 /* Returns the sequence of statements in BB. */
1146 static inline gimple_seq
1147 bb_seq (const_basic_block bb)
1149 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1152 static inline gimple_seq *
1153 bb_seq_addr (basic_block bb)
1155 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1158 /* Sets the sequence of statements in BB to SEQ. */
1160 static inline void
1161 set_bb_seq (basic_block bb, gimple_seq seq)
1163 gcc_checking_assert (!(bb->flags & BB_RTL));
1164 bb->il.gimple.seq = seq;
1168 /* Return the code for GIMPLE statement G. */
1170 static inline enum gimple_code
1171 gimple_code (const_gimple g)
1173 return g->gsbase.code;
1177 /* Return the GSS code used by a GIMPLE code. */
1179 static inline enum gimple_statement_structure_enum
1180 gss_for_code (enum gimple_code code)
1182 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1183 return gss_for_code_[code];
1187 /* Return which GSS code is used by GS. */
1189 static inline enum gimple_statement_structure_enum
1190 gimple_statement_structure (gimple gs)
1192 return gss_for_code (gimple_code (gs));
1196 /* Return true if statement G has sub-statements. This is only true for
1197 High GIMPLE statements. */
1199 static inline bool
1200 gimple_has_substatements (gimple g)
1202 switch (gimple_code (g))
1204 case GIMPLE_BIND:
1205 case GIMPLE_CATCH:
1206 case GIMPLE_EH_FILTER:
1207 case GIMPLE_EH_ELSE:
1208 case GIMPLE_TRY:
1209 case GIMPLE_OMP_FOR:
1210 case GIMPLE_OMP_MASTER:
1211 case GIMPLE_OMP_TASKGROUP:
1212 case GIMPLE_OMP_ORDERED:
1213 case GIMPLE_OMP_SECTION:
1214 case GIMPLE_OMP_PARALLEL:
1215 case GIMPLE_OMP_TASK:
1216 case GIMPLE_OMP_SECTIONS:
1217 case GIMPLE_OMP_SINGLE:
1218 case GIMPLE_OMP_TARGET:
1219 case GIMPLE_OMP_TEAMS:
1220 case GIMPLE_OMP_CRITICAL:
1221 case GIMPLE_WITH_CLEANUP_EXPR:
1222 case GIMPLE_TRANSACTION:
1223 return true;
1225 default:
1226 return false;
1231 /* Return the basic block holding statement G. */
1233 static inline basic_block
1234 gimple_bb (const_gimple g)
1236 return g->gsbase.bb;
1240 /* Return the lexical scope block holding statement G. */
1242 static inline tree
1243 gimple_block (const_gimple g)
1245 return LOCATION_BLOCK (g->gsbase.location);
1249 /* Set BLOCK to be the lexical scope block holding statement G. */
1251 static inline void
1252 gimple_set_block (gimple g, tree block)
1254 if (block)
1255 g->gsbase.location =
1256 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1257 else
1258 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1262 /* Return location information for statement G. */
1264 static inline location_t
1265 gimple_location (const_gimple g)
1267 return g->gsbase.location;
1270 /* Return pointer to location information for statement G. */
1272 static inline const location_t *
1273 gimple_location_ptr (const_gimple g)
1275 return &g->gsbase.location;
1279 /* Set location information for statement G. */
1281 static inline void
1282 gimple_set_location (gimple g, location_t location)
1284 g->gsbase.location = location;
1288 /* Return true if G contains location information. */
1290 static inline bool
1291 gimple_has_location (const_gimple g)
1293 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1297 /* Return the file name of the location of STMT. */
1299 static inline const char *
1300 gimple_filename (const_gimple stmt)
1302 return LOCATION_FILE (gimple_location (stmt));
1306 /* Return the line number of the location of STMT. */
1308 static inline int
1309 gimple_lineno (const_gimple stmt)
1311 return LOCATION_LINE (gimple_location (stmt));
1315 /* Determine whether SEQ is a singleton. */
1317 static inline bool
1318 gimple_seq_singleton_p (gimple_seq seq)
1320 return ((gimple_seq_first (seq) != NULL)
1321 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1324 /* Return true if no warnings should be emitted for statement STMT. */
1326 static inline bool
1327 gimple_no_warning_p (const_gimple stmt)
1329 return stmt->gsbase.no_warning;
1332 /* Set the no_warning flag of STMT to NO_WARNING. */
1334 static inline void
1335 gimple_set_no_warning (gimple stmt, bool no_warning)
1337 stmt->gsbase.no_warning = (unsigned) no_warning;
1340 /* Set the visited status on statement STMT to VISITED_P. */
1342 static inline void
1343 gimple_set_visited (gimple stmt, bool visited_p)
1345 stmt->gsbase.visited = (unsigned) visited_p;
1349 /* Return the visited status for statement STMT. */
1351 static inline bool
1352 gimple_visited_p (gimple stmt)
1354 return stmt->gsbase.visited;
1358 /* Set pass local flag PLF on statement STMT to VAL_P. */
1360 static inline void
1361 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1363 if (val_p)
1364 stmt->gsbase.plf |= (unsigned int) plf;
1365 else
1366 stmt->gsbase.plf &= ~((unsigned int) plf);
1370 /* Return the value of pass local flag PLF on statement STMT. */
1372 static inline unsigned int
1373 gimple_plf (gimple stmt, enum plf_mask plf)
1375 return stmt->gsbase.plf & ((unsigned int) plf);
1379 /* Set the UID of statement. */
1381 static inline void
1382 gimple_set_uid (gimple g, unsigned uid)
1384 g->gsbase.uid = uid;
1388 /* Return the UID of statement. */
1390 static inline unsigned
1391 gimple_uid (const_gimple g)
1393 return g->gsbase.uid;
1397 /* Make statement G a singleton sequence. */
1399 static inline void
1400 gimple_init_singleton (gimple g)
1402 g->gsbase.next = NULL;
1403 g->gsbase.prev = g;
1407 /* Return true if GIMPLE statement G has register or memory operands. */
1409 static inline bool
1410 gimple_has_ops (const_gimple g)
1412 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1416 /* Return true if GIMPLE statement G has memory operands. */
1418 static inline bool
1419 gimple_has_mem_ops (const_gimple g)
1421 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1425 /* Return the set of USE operands for statement G. */
1427 static inline struct use_optype_d *
1428 gimple_use_ops (const_gimple g)
1430 if (!gimple_has_ops (g))
1431 return NULL;
1432 return g->gsops.opbase.use_ops;
1436 /* Set USE to be the set of USE operands for statement G. */
1438 static inline void
1439 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1441 gcc_gimple_checking_assert (gimple_has_ops (g));
1442 g->gsops.opbase.use_ops = use;
1446 /* Return the single VUSE operand of the statement G. */
1448 static inline tree
1449 gimple_vuse (const_gimple g)
1451 if (!gimple_has_mem_ops (g))
1452 return NULL_TREE;
1453 return g->gsmembase.vuse;
1456 /* Return the single VDEF operand of the statement G. */
1458 static inline tree
1459 gimple_vdef (const_gimple g)
1461 if (!gimple_has_mem_ops (g))
1462 return NULL_TREE;
1463 return g->gsmembase.vdef;
1466 /* Return the single VUSE operand of the statement G. */
1468 static inline tree *
1469 gimple_vuse_ptr (gimple g)
1471 if (!gimple_has_mem_ops (g))
1472 return NULL;
1473 return &g->gsmembase.vuse;
1476 /* Return the single VDEF operand of the statement G. */
1478 static inline tree *
1479 gimple_vdef_ptr (gimple g)
1481 if (!gimple_has_mem_ops (g))
1482 return NULL;
1483 return &g->gsmembase.vdef;
1486 /* Set the single VUSE operand of the statement G. */
1488 static inline void
1489 gimple_set_vuse (gimple g, tree vuse)
1491 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1492 g->gsmembase.vuse = vuse;
1495 /* Set the single VDEF operand of the statement G. */
1497 static inline void
1498 gimple_set_vdef (gimple g, tree vdef)
1500 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1501 g->gsmembase.vdef = vdef;
1505 /* Return true if statement G has operands and the modified field has
1506 been set. */
1508 static inline bool
1509 gimple_modified_p (const_gimple g)
1511 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1515 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1516 a MODIFIED field. */
1518 static inline void
1519 gimple_set_modified (gimple s, bool modifiedp)
1521 if (gimple_has_ops (s))
1522 s->gsbase.modified = (unsigned) modifiedp;
1526 /* Return the tree code for the expression computed by STMT. This is
1527 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1528 GIMPLE_CALL, return CALL_EXPR as the expression code for
1529 consistency. This is useful when the caller needs to deal with the
1530 three kinds of computation that GIMPLE supports. */
1532 static inline enum tree_code
1533 gimple_expr_code (const_gimple stmt)
1535 enum gimple_code code = gimple_code (stmt);
1536 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1537 return (enum tree_code) stmt->gsbase.subcode;
1538 else
1540 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1541 return CALL_EXPR;
1546 /* Return true if statement STMT contains volatile operands. */
1548 static inline bool
1549 gimple_has_volatile_ops (const_gimple stmt)
1551 if (gimple_has_mem_ops (stmt))
1552 return stmt->gsbase.has_volatile_ops;
1553 else
1554 return false;
1558 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1560 static inline void
1561 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1563 if (gimple_has_mem_ops (stmt))
1564 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1567 /* Return true if STMT is in a transaction. */
1569 static inline bool
1570 gimple_in_transaction (gimple stmt)
1572 return bb_in_transaction (gimple_bb (stmt));
1575 /* Return true if statement STMT may access memory. */
1577 static inline bool
1578 gimple_references_memory_p (gimple stmt)
1580 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1584 /* Return the subcode for OMP statement S. */
1586 static inline unsigned
1587 gimple_omp_subcode (const_gimple s)
1589 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1590 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1591 return s->gsbase.subcode;
1594 /* Set the subcode for OMP statement S to SUBCODE. */
1596 static inline void
1597 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1599 /* We only have 16 bits for the subcode. Assert that we are not
1600 overflowing it. */
1601 gcc_gimple_checking_assert (subcode < (1 << 16));
1602 s->gsbase.subcode = subcode;
1605 /* Set the nowait flag on OMP_RETURN statement S. */
1607 static inline void
1608 gimple_omp_return_set_nowait (gimple s)
1610 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1611 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1615 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1616 flag set. */
1618 static inline bool
1619 gimple_omp_return_nowait_p (const_gimple g)
1621 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1622 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1626 /* Set the LHS of OMP return. */
1628 static inline void
1629 gimple_omp_return_set_lhs (gimple g, tree lhs)
1631 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1632 g->gimple_omp_atomic_store.val = lhs;
1636 /* Get the LHS of OMP return. */
1638 static inline tree
1639 gimple_omp_return_lhs (const_gimple g)
1641 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1642 return g->gimple_omp_atomic_store.val;
1646 /* Return a pointer to the LHS of OMP return. */
1648 static inline tree *
1649 gimple_omp_return_lhs_ptr (gimple g)
1651 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1652 return &g->gimple_omp_atomic_store.val;
1656 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1657 flag set. */
1659 static inline bool
1660 gimple_omp_section_last_p (const_gimple g)
1662 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1663 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1667 /* Set the GF_OMP_SECTION_LAST flag on G. */
1669 static inline void
1670 gimple_omp_section_set_last (gimple g)
1672 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1673 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1677 /* Return true if OMP parallel statement G has the
1678 GF_OMP_PARALLEL_COMBINED flag set. */
1680 static inline bool
1681 gimple_omp_parallel_combined_p (const_gimple g)
1683 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1684 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1688 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1689 value of COMBINED_P. */
1691 static inline void
1692 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1694 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1695 if (combined_p)
1696 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1697 else
1698 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1702 /* Return true if OMP atomic load/store statement G has the
1703 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1705 static inline bool
1706 gimple_omp_atomic_need_value_p (const_gimple g)
1708 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1709 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1710 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1714 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1716 static inline void
1717 gimple_omp_atomic_set_need_value (gimple g)
1719 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1720 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1721 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1725 /* Return true if OMP atomic load/store statement G has the
1726 GF_OMP_ATOMIC_SEQ_CST flag set. */
1728 static inline bool
1729 gimple_omp_atomic_seq_cst_p (const_gimple g)
1731 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1732 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1733 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
1737 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
1739 static inline void
1740 gimple_omp_atomic_set_seq_cst (gimple g)
1742 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1743 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1744 g->gsbase.subcode |= GF_OMP_ATOMIC_SEQ_CST;
1748 /* Return the number of operands for statement GS. */
1750 static inline unsigned
1751 gimple_num_ops (const_gimple gs)
1753 return gs->gsbase.num_ops;
1757 /* Set the number of operands for statement GS. */
1759 static inline void
1760 gimple_set_num_ops (gimple gs, unsigned num_ops)
1762 gs->gsbase.num_ops = num_ops;
1766 /* Return the array of operands for statement GS. */
1768 static inline tree *
1769 gimple_ops (gimple gs)
1771 size_t off;
1773 /* All the tuples have their operand vector at the very bottom
1774 of the structure. Note that those structures that do not
1775 have an operand vector have a zero offset. */
1776 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1777 gcc_gimple_checking_assert (off != 0);
1779 return (tree *) ((char *) gs + off);
1783 /* Return operand I for statement GS. */
1785 static inline tree
1786 gimple_op (const_gimple gs, unsigned i)
1788 if (gimple_has_ops (gs))
1790 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1791 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1793 else
1794 return NULL_TREE;
1797 /* Return a pointer to operand I for statement GS. */
1799 static inline tree *
1800 gimple_op_ptr (const_gimple gs, unsigned i)
1802 if (gimple_has_ops (gs))
1804 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1805 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1807 else
1808 return NULL;
1811 /* Set operand I of statement GS to OP. */
1813 static inline void
1814 gimple_set_op (gimple gs, unsigned i, tree op)
1816 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1818 /* Note. It may be tempting to assert that OP matches
1819 is_gimple_operand, but that would be wrong. Different tuples
1820 accept slightly different sets of tree operands. Each caller
1821 should perform its own validation. */
1822 gimple_ops (gs)[i] = op;
1825 /* Return true if GS is a GIMPLE_ASSIGN. */
1827 static inline bool
1828 is_gimple_assign (const_gimple gs)
1830 return gimple_code (gs) == GIMPLE_ASSIGN;
1833 /* Determine if expression CODE is one of the valid expressions that can
1834 be used on the RHS of GIMPLE assignments. */
1836 static inline enum gimple_rhs_class
1837 get_gimple_rhs_class (enum tree_code code)
1839 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1842 /* Return the LHS of assignment statement GS. */
1844 static inline tree
1845 gimple_assign_lhs (const_gimple gs)
1847 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1848 return gimple_op (gs, 0);
1852 /* Return a pointer to the LHS of assignment statement GS. */
1854 static inline tree *
1855 gimple_assign_lhs_ptr (const_gimple gs)
1857 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1858 return gimple_op_ptr (gs, 0);
1862 /* Set LHS to be the LHS operand of assignment statement GS. */
1864 static inline void
1865 gimple_assign_set_lhs (gimple gs, tree lhs)
1867 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1868 gimple_set_op (gs, 0, lhs);
1870 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1871 SSA_NAME_DEF_STMT (lhs) = gs;
1875 /* Return the first operand on the RHS of assignment statement GS. */
1877 static inline tree
1878 gimple_assign_rhs1 (const_gimple gs)
1880 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1881 return gimple_op (gs, 1);
1885 /* Return a pointer to the first operand on the RHS of assignment
1886 statement GS. */
1888 static inline tree *
1889 gimple_assign_rhs1_ptr (const_gimple gs)
1891 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1892 return gimple_op_ptr (gs, 1);
1895 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1897 static inline void
1898 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1900 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1902 gimple_set_op (gs, 1, rhs);
1906 /* Return the second operand on the RHS of assignment statement GS.
1907 If GS does not have two operands, NULL is returned instead. */
1909 static inline tree
1910 gimple_assign_rhs2 (const_gimple gs)
1912 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1914 if (gimple_num_ops (gs) >= 3)
1915 return gimple_op (gs, 2);
1916 else
1917 return NULL_TREE;
1921 /* Return a pointer to the second operand on the RHS of assignment
1922 statement GS. */
1924 static inline tree *
1925 gimple_assign_rhs2_ptr (const_gimple gs)
1927 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1928 return gimple_op_ptr (gs, 2);
1932 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1934 static inline void
1935 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1937 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1939 gimple_set_op (gs, 2, rhs);
1942 /* Return the third operand on the RHS of assignment statement GS.
1943 If GS does not have two operands, NULL is returned instead. */
1945 static inline tree
1946 gimple_assign_rhs3 (const_gimple gs)
1948 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1950 if (gimple_num_ops (gs) >= 4)
1951 return gimple_op (gs, 3);
1952 else
1953 return NULL_TREE;
1956 /* Return a pointer to the third operand on the RHS of assignment
1957 statement GS. */
1959 static inline tree *
1960 gimple_assign_rhs3_ptr (const_gimple gs)
1962 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1963 return gimple_op_ptr (gs, 3);
1967 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1969 static inline void
1970 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1972 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1974 gimple_set_op (gs, 3, rhs);
1977 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1978 to see only a maximum of two operands. */
1980 static inline void
1981 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1982 tree op1, tree op2)
1984 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1987 /* Returns true if GS is a nontemporal move. */
1989 static inline bool
1990 gimple_assign_nontemporal_move_p (const_gimple gs)
1992 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1993 return gs->gsbase.nontemporal_move;
1996 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1998 static inline void
1999 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2001 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2002 gs->gsbase.nontemporal_move = nontemporal;
2006 /* Return the code of the expression computed on the rhs of assignment
2007 statement GS. In case that the RHS is a single object, returns the
2008 tree code of the object. */
2010 static inline enum tree_code
2011 gimple_assign_rhs_code (const_gimple gs)
2013 enum tree_code code;
2014 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2016 code = (enum tree_code) gs->gsbase.subcode;
2017 /* While we initially set subcode to the TREE_CODE of the rhs for
2018 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2019 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2020 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2021 code = TREE_CODE (gimple_assign_rhs1 (gs));
2023 return code;
2027 /* Set CODE to be the code for the expression computed on the RHS of
2028 assignment S. */
2030 static inline void
2031 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2033 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2034 s->gsbase.subcode = code;
2038 /* Return the gimple rhs class of the code of the expression computed on
2039 the rhs of assignment statement GS.
2040 This will never return GIMPLE_INVALID_RHS. */
2042 static inline enum gimple_rhs_class
2043 gimple_assign_rhs_class (const_gimple gs)
2045 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2048 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2049 there is no operator associated with the assignment itself.
2050 Unlike gimple_assign_copy_p, this predicate returns true for
2051 any RHS operand, including those that perform an operation
2052 and do not have the semantics of a copy, such as COND_EXPR. */
2054 static inline bool
2055 gimple_assign_single_p (gimple gs)
2057 return (is_gimple_assign (gs)
2058 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2061 /* Return true if GS performs a store to its lhs. */
2063 static inline bool
2064 gimple_store_p (gimple gs)
2066 tree lhs = gimple_get_lhs (gs);
2067 return lhs && !is_gimple_reg (lhs);
2070 /* Return true if GS is an assignment that loads from its rhs1. */
2072 static inline bool
2073 gimple_assign_load_p (gimple gs)
2075 tree rhs;
2076 if (!gimple_assign_single_p (gs))
2077 return false;
2078 rhs = gimple_assign_rhs1 (gs);
2079 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2080 return true;
2081 rhs = get_base_address (rhs);
2082 return (DECL_P (rhs)
2083 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2087 /* Return true if S is a type-cast assignment. */
2089 static inline bool
2090 gimple_assign_cast_p (gimple s)
2092 if (is_gimple_assign (s))
2094 enum tree_code sc = gimple_assign_rhs_code (s);
2095 return CONVERT_EXPR_CODE_P (sc)
2096 || sc == VIEW_CONVERT_EXPR
2097 || sc == FIX_TRUNC_EXPR;
2100 return false;
2103 /* Return true if S is a clobber statement. */
2105 static inline bool
2106 gimple_clobber_p (gimple s)
2108 return gimple_assign_single_p (s)
2109 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2112 /* Return true if GS is a GIMPLE_CALL. */
2114 static inline bool
2115 is_gimple_call (const_gimple gs)
2117 return gimple_code (gs) == GIMPLE_CALL;
2120 /* Return the LHS of call statement GS. */
2122 static inline tree
2123 gimple_call_lhs (const_gimple gs)
2125 GIMPLE_CHECK (gs, GIMPLE_CALL);
2126 return gimple_op (gs, 0);
2130 /* Return a pointer to the LHS of call statement GS. */
2132 static inline tree *
2133 gimple_call_lhs_ptr (const_gimple gs)
2135 GIMPLE_CHECK (gs, GIMPLE_CALL);
2136 return gimple_op_ptr (gs, 0);
2140 /* Set LHS to be the LHS operand of call statement GS. */
2142 static inline void
2143 gimple_call_set_lhs (gimple gs, tree lhs)
2145 GIMPLE_CHECK (gs, GIMPLE_CALL);
2146 gimple_set_op (gs, 0, lhs);
2147 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2148 SSA_NAME_DEF_STMT (lhs) = gs;
2152 /* Return true if call GS calls an internal-only function, as enumerated
2153 by internal_fn. */
2155 static inline bool
2156 gimple_call_internal_p (const_gimple gs)
2158 GIMPLE_CHECK (gs, GIMPLE_CALL);
2159 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2163 /* Return the target of internal call GS. */
2165 static inline enum internal_fn
2166 gimple_call_internal_fn (const_gimple gs)
2168 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2169 return gs->gimple_call.u.internal_fn;
2173 /* Return the function type of the function called by GS. */
2175 static inline tree
2176 gimple_call_fntype (const_gimple gs)
2178 GIMPLE_CHECK (gs, GIMPLE_CALL);
2179 if (gimple_call_internal_p (gs))
2180 return NULL_TREE;
2181 return gs->gimple_call.u.fntype;
2184 /* Set the type of the function called by GS to FNTYPE. */
2186 static inline void
2187 gimple_call_set_fntype (gimple gs, tree fntype)
2189 GIMPLE_CHECK (gs, GIMPLE_CALL);
2190 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2191 gs->gimple_call.u.fntype = fntype;
2195 /* Return the tree node representing the function called by call
2196 statement GS. */
2198 static inline tree
2199 gimple_call_fn (const_gimple gs)
2201 GIMPLE_CHECK (gs, GIMPLE_CALL);
2202 return gimple_op (gs, 1);
2205 /* Return a pointer to the tree node representing the function called by call
2206 statement GS. */
2208 static inline tree *
2209 gimple_call_fn_ptr (const_gimple gs)
2211 GIMPLE_CHECK (gs, GIMPLE_CALL);
2212 return gimple_op_ptr (gs, 1);
2216 /* Set FN to be the function called by call statement GS. */
2218 static inline void
2219 gimple_call_set_fn (gimple gs, tree fn)
2221 GIMPLE_CHECK (gs, GIMPLE_CALL);
2222 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2223 gimple_set_op (gs, 1, fn);
2227 /* Set FNDECL to be the function called by call statement GS. */
2229 static inline void
2230 gimple_call_set_fndecl (gimple gs, tree decl)
2232 GIMPLE_CHECK (gs, GIMPLE_CALL);
2233 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2234 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2238 /* Set internal function FN to be the function called by call statement GS. */
2240 static inline void
2241 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2243 GIMPLE_CHECK (gs, GIMPLE_CALL);
2244 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2245 gs->gimple_call.u.internal_fn = fn;
2249 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2250 Otherwise return NULL. This function is analogous to
2251 get_callee_fndecl in tree land. */
2253 static inline tree
2254 gimple_call_fndecl (const_gimple gs)
2256 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2260 /* Return the type returned by call statement GS. */
2262 static inline tree
2263 gimple_call_return_type (const_gimple gs)
2265 tree type = gimple_call_fntype (gs);
2267 if (type == NULL_TREE)
2268 return TREE_TYPE (gimple_call_lhs (gs));
2270 /* The type returned by a function is the type of its
2271 function type. */
2272 return TREE_TYPE (type);
2276 /* Return the static chain for call statement GS. */
2278 static inline tree
2279 gimple_call_chain (const_gimple gs)
2281 GIMPLE_CHECK (gs, GIMPLE_CALL);
2282 return gimple_op (gs, 2);
2286 /* Return a pointer to the static chain for call statement GS. */
2288 static inline tree *
2289 gimple_call_chain_ptr (const_gimple gs)
2291 GIMPLE_CHECK (gs, GIMPLE_CALL);
2292 return gimple_op_ptr (gs, 2);
2295 /* Set CHAIN to be the static chain for call statement GS. */
2297 static inline void
2298 gimple_call_set_chain (gimple gs, tree chain)
2300 GIMPLE_CHECK (gs, GIMPLE_CALL);
2302 gimple_set_op (gs, 2, chain);
2306 /* Return the number of arguments used by call statement GS. */
2308 static inline unsigned
2309 gimple_call_num_args (const_gimple gs)
2311 unsigned num_ops;
2312 GIMPLE_CHECK (gs, GIMPLE_CALL);
2313 num_ops = gimple_num_ops (gs);
2314 return num_ops - 3;
2318 /* Return the argument at position INDEX for call statement GS. */
2320 static inline tree
2321 gimple_call_arg (const_gimple gs, unsigned index)
2323 GIMPLE_CHECK (gs, GIMPLE_CALL);
2324 return gimple_op (gs, index + 3);
2328 /* Return the number of arguments used by call statement GS
2329 ignoring bound ones. */
2331 static inline unsigned
2332 gimple_call_num_nobnd_args (const_gimple gs)
2334 unsigned num_args = gimple_call_num_args (gs);
2335 unsigned res = num_args;
2336 for (unsigned n = 0; n < num_args; n++)
2337 if (POINTER_BOUNDS_P (gimple_call_arg (gs, n)))
2338 res--;
2339 return res;
2343 /* Return INDEX's call argument ignoring bound ones. */
2344 static inline tree
2345 gimple_call_nobnd_arg (const_gimple gs, unsigned index)
2347 /* No bound args may exist if pointers checker is off. */
2348 if (!flag_check_pointer_bounds)
2349 return gimple_call_arg (gs, index);
2350 return gimple_call_arg (gs, gimple_call_get_nobnd_arg_index (gs, index));
2354 /* Return a pointer to the argument at position INDEX for call
2355 statement GS. */
2357 static inline tree *
2358 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2360 GIMPLE_CHECK (gs, GIMPLE_CALL);
2361 return gimple_op_ptr (gs, index + 3);
2365 /* Set ARG to be the argument at position INDEX for call statement GS. */
2367 static inline void
2368 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2370 GIMPLE_CHECK (gs, GIMPLE_CALL);
2371 gimple_set_op (gs, index + 3, arg);
2375 /* If TAIL_P is true, mark call statement S as being a tail call
2376 (i.e., a call just before the exit of a function). These calls are
2377 candidate for tail call optimization. */
2379 static inline void
2380 gimple_call_set_tail (gimple s, bool tail_p)
2382 GIMPLE_CHECK (s, GIMPLE_CALL);
2383 if (tail_p)
2384 s->gsbase.subcode |= GF_CALL_TAILCALL;
2385 else
2386 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2390 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2392 static inline bool
2393 gimple_call_tail_p (gimple s)
2395 GIMPLE_CHECK (s, GIMPLE_CALL);
2396 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2400 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2401 slot optimization. This transformation uses the target of the call
2402 expansion as the return slot for calls that return in memory. */
2404 static inline void
2405 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2407 GIMPLE_CHECK (s, GIMPLE_CALL);
2408 if (return_slot_opt_p)
2409 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2410 else
2411 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2415 /* Return true if S is marked for return slot optimization. */
2417 static inline bool
2418 gimple_call_return_slot_opt_p (gimple s)
2420 GIMPLE_CHECK (s, GIMPLE_CALL);
2421 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2425 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2426 thunk to the thunked-to function. */
2428 static inline void
2429 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2431 GIMPLE_CHECK (s, GIMPLE_CALL);
2432 if (from_thunk_p)
2433 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2434 else
2435 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2439 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2441 static inline bool
2442 gimple_call_from_thunk_p (gimple s)
2444 GIMPLE_CHECK (s, GIMPLE_CALL);
2445 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2449 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2450 argument pack in its argument list. */
2452 static inline void
2453 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2455 GIMPLE_CHECK (s, GIMPLE_CALL);
2456 if (pass_arg_pack_p)
2457 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2458 else
2459 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2463 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2464 argument pack in its argument list. */
2466 static inline bool
2467 gimple_call_va_arg_pack_p (gimple s)
2469 GIMPLE_CHECK (s, GIMPLE_CALL);
2470 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2474 /* Return true if S is a noreturn call. */
2476 static inline bool
2477 gimple_call_noreturn_p (gimple s)
2479 GIMPLE_CHECK (s, GIMPLE_CALL);
2480 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2484 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2485 even if the called function can throw in other cases. */
2487 static inline void
2488 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2490 GIMPLE_CHECK (s, GIMPLE_CALL);
2491 if (nothrow_p)
2492 s->gsbase.subcode |= GF_CALL_NOTHROW;
2493 else
2494 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2497 /* Return true if S is a nothrow call. */
2499 static inline bool
2500 gimple_call_nothrow_p (gimple s)
2502 GIMPLE_CHECK (s, GIMPLE_CALL);
2503 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2506 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2507 is known to be emitted for VLA objects. Those are wrapped by
2508 stack_save/stack_restore calls and hence can't lead to unbounded
2509 stack growth even when they occur in loops. */
2511 static inline void
2512 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2514 GIMPLE_CHECK (s, GIMPLE_CALL);
2515 if (for_var)
2516 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2517 else
2518 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2521 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2523 static inline bool
2524 gimple_call_alloca_for_var_p (gimple s)
2526 GIMPLE_CHECK (s, GIMPLE_CALL);
2527 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2530 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2532 static inline void
2533 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2535 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2536 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2537 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2541 /* Return a pointer to the points-to solution for the set of call-used
2542 variables of the call CALL. */
2544 static inline struct pt_solution *
2545 gimple_call_use_set (gimple call)
2547 GIMPLE_CHECK (call, GIMPLE_CALL);
2548 return &call->gimple_call.call_used;
2552 /* Return a pointer to the points-to solution for the set of call-used
2553 variables of the call CALL. */
2555 static inline struct pt_solution *
2556 gimple_call_clobber_set (gimple call)
2558 GIMPLE_CHECK (call, GIMPLE_CALL);
2559 return &call->gimple_call.call_clobbered;
2563 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2564 non-NULL lhs. */
2566 static inline bool
2567 gimple_has_lhs (gimple stmt)
2569 return (is_gimple_assign (stmt)
2570 || (is_gimple_call (stmt)
2571 && gimple_call_lhs (stmt) != NULL_TREE));
2575 /* Return the code of the predicate computed by conditional statement GS. */
2577 static inline enum tree_code
2578 gimple_cond_code (const_gimple gs)
2580 GIMPLE_CHECK (gs, GIMPLE_COND);
2581 return (enum tree_code) gs->gsbase.subcode;
2585 /* Set CODE to be the predicate code for the conditional statement GS. */
2587 static inline void
2588 gimple_cond_set_code (gimple gs, enum tree_code code)
2590 GIMPLE_CHECK (gs, GIMPLE_COND);
2591 gs->gsbase.subcode = code;
2595 /* Return the LHS of the predicate computed by conditional statement GS. */
2597 static inline tree
2598 gimple_cond_lhs (const_gimple gs)
2600 GIMPLE_CHECK (gs, GIMPLE_COND);
2601 return gimple_op (gs, 0);
2604 /* Return the pointer to the LHS of the predicate computed by conditional
2605 statement GS. */
2607 static inline tree *
2608 gimple_cond_lhs_ptr (const_gimple gs)
2610 GIMPLE_CHECK (gs, GIMPLE_COND);
2611 return gimple_op_ptr (gs, 0);
2614 /* Set LHS to be the LHS operand of the predicate computed by
2615 conditional statement GS. */
2617 static inline void
2618 gimple_cond_set_lhs (gimple gs, tree lhs)
2620 GIMPLE_CHECK (gs, GIMPLE_COND);
2621 gimple_set_op (gs, 0, lhs);
2625 /* Return the RHS operand of the predicate computed by conditional GS. */
2627 static inline tree
2628 gimple_cond_rhs (const_gimple gs)
2630 GIMPLE_CHECK (gs, GIMPLE_COND);
2631 return gimple_op (gs, 1);
2634 /* Return the pointer to the RHS operand of the predicate computed by
2635 conditional GS. */
2637 static inline tree *
2638 gimple_cond_rhs_ptr (const_gimple gs)
2640 GIMPLE_CHECK (gs, GIMPLE_COND);
2641 return gimple_op_ptr (gs, 1);
2645 /* Set RHS to be the RHS operand of the predicate computed by
2646 conditional statement GS. */
2648 static inline void
2649 gimple_cond_set_rhs (gimple gs, tree rhs)
2651 GIMPLE_CHECK (gs, GIMPLE_COND);
2652 gimple_set_op (gs, 1, rhs);
2656 /* Return the label used by conditional statement GS when its
2657 predicate evaluates to true. */
2659 static inline tree
2660 gimple_cond_true_label (const_gimple gs)
2662 GIMPLE_CHECK (gs, GIMPLE_COND);
2663 return gimple_op (gs, 2);
2667 /* Set LABEL to be the label used by conditional statement GS when its
2668 predicate evaluates to true. */
2670 static inline void
2671 gimple_cond_set_true_label (gimple gs, tree label)
2673 GIMPLE_CHECK (gs, GIMPLE_COND);
2674 gimple_set_op (gs, 2, label);
2678 /* Set LABEL to be the label used by conditional statement GS when its
2679 predicate evaluates to false. */
2681 static inline void
2682 gimple_cond_set_false_label (gimple gs, tree label)
2684 GIMPLE_CHECK (gs, GIMPLE_COND);
2685 gimple_set_op (gs, 3, label);
2689 /* Return the label used by conditional statement GS when its
2690 predicate evaluates to false. */
2692 static inline tree
2693 gimple_cond_false_label (const_gimple gs)
2695 GIMPLE_CHECK (gs, GIMPLE_COND);
2696 return gimple_op (gs, 3);
2700 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2702 static inline void
2703 gimple_cond_make_false (gimple gs)
2705 gimple_cond_set_lhs (gs, boolean_true_node);
2706 gimple_cond_set_rhs (gs, boolean_false_node);
2707 gs->gsbase.subcode = EQ_EXPR;
2711 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2713 static inline void
2714 gimple_cond_make_true (gimple gs)
2716 gimple_cond_set_lhs (gs, boolean_true_node);
2717 gimple_cond_set_rhs (gs, boolean_true_node);
2718 gs->gsbase.subcode = EQ_EXPR;
2721 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2722 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2724 static inline bool
2725 gimple_cond_true_p (const_gimple gs)
2727 tree lhs = gimple_cond_lhs (gs);
2728 tree rhs = gimple_cond_rhs (gs);
2729 enum tree_code code = gimple_cond_code (gs);
2731 if (lhs != boolean_true_node && lhs != boolean_false_node)
2732 return false;
2734 if (rhs != boolean_true_node && rhs != boolean_false_node)
2735 return false;
2737 if (code == NE_EXPR && lhs != rhs)
2738 return true;
2740 if (code == EQ_EXPR && lhs == rhs)
2741 return true;
2743 return false;
2746 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2747 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2749 static inline bool
2750 gimple_cond_false_p (const_gimple gs)
2752 tree lhs = gimple_cond_lhs (gs);
2753 tree rhs = gimple_cond_rhs (gs);
2754 enum tree_code code = gimple_cond_code (gs);
2756 if (lhs != boolean_true_node && lhs != boolean_false_node)
2757 return false;
2759 if (rhs != boolean_true_node && rhs != boolean_false_node)
2760 return false;
2762 if (code == NE_EXPR && lhs == rhs)
2763 return true;
2765 if (code == EQ_EXPR && lhs != rhs)
2766 return true;
2768 return false;
2771 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2773 static inline void
2774 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2776 gimple_cond_set_code (stmt, code);
2777 gimple_cond_set_lhs (stmt, lhs);
2778 gimple_cond_set_rhs (stmt, rhs);
2781 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2783 static inline tree
2784 gimple_label_label (const_gimple gs)
2786 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2787 return gimple_op (gs, 0);
2791 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2792 GS. */
2794 static inline void
2795 gimple_label_set_label (gimple gs, tree label)
2797 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2798 gimple_set_op (gs, 0, label);
2802 /* Return the destination of the unconditional jump GS. */
2804 static inline tree
2805 gimple_goto_dest (const_gimple gs)
2807 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2808 return gimple_op (gs, 0);
2812 /* Set DEST to be the destination of the unconditonal jump GS. */
2814 static inline void
2815 gimple_goto_set_dest (gimple gs, tree dest)
2817 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2818 gimple_set_op (gs, 0, dest);
2822 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2824 static inline tree
2825 gimple_bind_vars (const_gimple gs)
2827 GIMPLE_CHECK (gs, GIMPLE_BIND);
2828 return gs->gimple_bind.vars;
2832 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2833 statement GS. */
2835 static inline void
2836 gimple_bind_set_vars (gimple gs, tree vars)
2838 GIMPLE_CHECK (gs, GIMPLE_BIND);
2839 gs->gimple_bind.vars = vars;
2843 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2844 statement GS. */
2846 static inline void
2847 gimple_bind_append_vars (gimple gs, tree vars)
2849 GIMPLE_CHECK (gs, GIMPLE_BIND);
2850 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2854 static inline gimple_seq *
2855 gimple_bind_body_ptr (gimple gs)
2857 GIMPLE_CHECK (gs, GIMPLE_BIND);
2858 return &gs->gimple_bind.body;
2861 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2863 static inline gimple_seq
2864 gimple_bind_body (gimple gs)
2866 return *gimple_bind_body_ptr (gs);
2870 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2871 statement GS. */
2873 static inline void
2874 gimple_bind_set_body (gimple gs, gimple_seq seq)
2876 GIMPLE_CHECK (gs, GIMPLE_BIND);
2877 gs->gimple_bind.body = seq;
2881 /* Append a statement to the end of a GIMPLE_BIND's body. */
2883 static inline void
2884 gimple_bind_add_stmt (gimple gs, gimple stmt)
2886 GIMPLE_CHECK (gs, GIMPLE_BIND);
2887 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2891 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2893 static inline void
2894 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2896 GIMPLE_CHECK (gs, GIMPLE_BIND);
2897 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2901 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2902 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2904 static inline tree
2905 gimple_bind_block (const_gimple gs)
2907 GIMPLE_CHECK (gs, GIMPLE_BIND);
2908 return gs->gimple_bind.block;
2912 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2913 statement GS. */
2915 static inline void
2916 gimple_bind_set_block (gimple gs, tree block)
2918 GIMPLE_CHECK (gs, GIMPLE_BIND);
2919 gcc_gimple_checking_assert (block == NULL_TREE
2920 || TREE_CODE (block) == BLOCK);
2921 gs->gimple_bind.block = block;
2925 /* Return the number of input operands for GIMPLE_ASM GS. */
2927 static inline unsigned
2928 gimple_asm_ninputs (const_gimple gs)
2930 GIMPLE_CHECK (gs, GIMPLE_ASM);
2931 return gs->gimple_asm.ni;
2935 /* Return the number of output operands for GIMPLE_ASM GS. */
2937 static inline unsigned
2938 gimple_asm_noutputs (const_gimple gs)
2940 GIMPLE_CHECK (gs, GIMPLE_ASM);
2941 return gs->gimple_asm.no;
2945 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2947 static inline unsigned
2948 gimple_asm_nclobbers (const_gimple gs)
2950 GIMPLE_CHECK (gs, GIMPLE_ASM);
2951 return gs->gimple_asm.nc;
2954 /* Return the number of label operands for GIMPLE_ASM GS. */
2956 static inline unsigned
2957 gimple_asm_nlabels (const_gimple gs)
2959 GIMPLE_CHECK (gs, GIMPLE_ASM);
2960 return gs->gimple_asm.nl;
2963 /* Return input operand INDEX of GIMPLE_ASM GS. */
2965 static inline tree
2966 gimple_asm_input_op (const_gimple gs, unsigned index)
2968 GIMPLE_CHECK (gs, GIMPLE_ASM);
2969 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2970 return gimple_op (gs, index + gs->gimple_asm.no);
2973 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2975 static inline tree *
2976 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2978 GIMPLE_CHECK (gs, GIMPLE_ASM);
2979 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2980 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2984 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2986 static inline void
2987 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2989 GIMPLE_CHECK (gs, GIMPLE_ASM);
2990 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2991 && TREE_CODE (in_op) == TREE_LIST);
2992 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2996 /* Return output operand INDEX of GIMPLE_ASM GS. */
2998 static inline tree
2999 gimple_asm_output_op (const_gimple gs, unsigned index)
3001 GIMPLE_CHECK (gs, GIMPLE_ASM);
3002 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3003 return gimple_op (gs, index);
3006 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3008 static inline tree *
3009 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3011 GIMPLE_CHECK (gs, GIMPLE_ASM);
3012 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3013 return gimple_op_ptr (gs, index);
3017 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3019 static inline void
3020 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3022 GIMPLE_CHECK (gs, GIMPLE_ASM);
3023 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3024 && TREE_CODE (out_op) == TREE_LIST);
3025 gimple_set_op (gs, index, out_op);
3029 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3031 static inline tree
3032 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3034 GIMPLE_CHECK (gs, GIMPLE_ASM);
3035 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3036 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3040 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3042 static inline void
3043 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3045 GIMPLE_CHECK (gs, GIMPLE_ASM);
3046 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3047 && TREE_CODE (clobber_op) == TREE_LIST);
3048 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3051 /* Return label operand INDEX of GIMPLE_ASM GS. */
3053 static inline tree
3054 gimple_asm_label_op (const_gimple gs, unsigned index)
3056 GIMPLE_CHECK (gs, GIMPLE_ASM);
3057 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3058 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3061 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3063 static inline void
3064 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3066 GIMPLE_CHECK (gs, GIMPLE_ASM);
3067 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3068 && TREE_CODE (label_op) == TREE_LIST);
3069 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3072 /* Return the string representing the assembly instruction in
3073 GIMPLE_ASM GS. */
3075 static inline const char *
3076 gimple_asm_string (const_gimple gs)
3078 GIMPLE_CHECK (gs, GIMPLE_ASM);
3079 return gs->gimple_asm.string;
3083 /* Return true if GS is an asm statement marked volatile. */
3085 static inline bool
3086 gimple_asm_volatile_p (const_gimple gs)
3088 GIMPLE_CHECK (gs, GIMPLE_ASM);
3089 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3093 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3095 static inline void
3096 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3098 GIMPLE_CHECK (gs, GIMPLE_ASM);
3099 if (volatile_p)
3100 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3101 else
3102 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3106 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3108 static inline void
3109 gimple_asm_set_input (gimple gs, bool input_p)
3111 GIMPLE_CHECK (gs, GIMPLE_ASM);
3112 if (input_p)
3113 gs->gsbase.subcode |= GF_ASM_INPUT;
3114 else
3115 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3119 /* Return true if asm GS is an ASM_INPUT. */
3121 static inline bool
3122 gimple_asm_input_p (const_gimple gs)
3124 GIMPLE_CHECK (gs, GIMPLE_ASM);
3125 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3129 /* Return the types handled by GIMPLE_CATCH statement GS. */
3131 static inline tree
3132 gimple_catch_types (const_gimple gs)
3134 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3135 return gs->gimple_catch.types;
3139 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3141 static inline tree *
3142 gimple_catch_types_ptr (gimple gs)
3144 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3145 return &gs->gimple_catch.types;
3149 /* Return a pointer to the GIMPLE sequence representing the body of
3150 the handler of GIMPLE_CATCH statement GS. */
3152 static inline gimple_seq *
3153 gimple_catch_handler_ptr (gimple gs)
3155 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3156 return &gs->gimple_catch.handler;
3160 /* Return the GIMPLE sequence representing the body of the handler of
3161 GIMPLE_CATCH statement GS. */
3163 static inline gimple_seq
3164 gimple_catch_handler (gimple gs)
3166 return *gimple_catch_handler_ptr (gs);
3170 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3172 static inline void
3173 gimple_catch_set_types (gimple gs, tree t)
3175 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3176 gs->gimple_catch.types = t;
3180 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3182 static inline void
3183 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3185 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3186 gs->gimple_catch.handler = handler;
3190 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3192 static inline tree
3193 gimple_eh_filter_types (const_gimple gs)
3195 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3196 return gs->gimple_eh_filter.types;
3200 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3201 GS. */
3203 static inline tree *
3204 gimple_eh_filter_types_ptr (gimple gs)
3206 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3207 return &gs->gimple_eh_filter.types;
3211 /* Return a pointer to the sequence of statement to execute when
3212 GIMPLE_EH_FILTER statement fails. */
3214 static inline gimple_seq *
3215 gimple_eh_filter_failure_ptr (gimple gs)
3217 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3218 return &gs->gimple_eh_filter.failure;
3222 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3223 statement fails. */
3225 static inline gimple_seq
3226 gimple_eh_filter_failure (gimple gs)
3228 return *gimple_eh_filter_failure_ptr (gs);
3232 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3234 static inline void
3235 gimple_eh_filter_set_types (gimple gs, tree types)
3237 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3238 gs->gimple_eh_filter.types = types;
3242 /* Set FAILURE to be the sequence of statements to execute on failure
3243 for GIMPLE_EH_FILTER GS. */
3245 static inline void
3246 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3248 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3249 gs->gimple_eh_filter.failure = failure;
3252 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3254 static inline tree
3255 gimple_eh_must_not_throw_fndecl (gimple gs)
3257 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3258 return gs->gimple_eh_mnt.fndecl;
3261 /* Set the function decl to be called by GS to DECL. */
3263 static inline void
3264 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3266 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3267 gs->gimple_eh_mnt.fndecl = decl;
3270 /* GIMPLE_EH_ELSE accessors. */
3272 static inline gimple_seq *
3273 gimple_eh_else_n_body_ptr (gimple gs)
3275 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3276 return &gs->gimple_eh_else.n_body;
3279 static inline gimple_seq
3280 gimple_eh_else_n_body (gimple gs)
3282 return *gimple_eh_else_n_body_ptr (gs);
3285 static inline gimple_seq *
3286 gimple_eh_else_e_body_ptr (gimple gs)
3288 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3289 return &gs->gimple_eh_else.e_body;
3292 static inline gimple_seq
3293 gimple_eh_else_e_body (gimple gs)
3295 return *gimple_eh_else_e_body_ptr (gs);
3298 static inline void
3299 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3301 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3302 gs->gimple_eh_else.n_body = seq;
3305 static inline void
3306 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3308 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3309 gs->gimple_eh_else.e_body = seq;
3312 /* GIMPLE_TRY accessors. */
3314 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3315 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3317 static inline enum gimple_try_flags
3318 gimple_try_kind (const_gimple gs)
3320 GIMPLE_CHECK (gs, GIMPLE_TRY);
3321 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3325 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3327 static inline void
3328 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3330 GIMPLE_CHECK (gs, GIMPLE_TRY);
3331 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3332 || kind == GIMPLE_TRY_FINALLY);
3333 if (gimple_try_kind (gs) != kind)
3334 gs->gsbase.subcode = (unsigned int) kind;
3338 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3340 static inline bool
3341 gimple_try_catch_is_cleanup (const_gimple gs)
3343 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3344 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3348 /* Return a pointer to the sequence of statements used as the
3349 body for GIMPLE_TRY GS. */
3351 static inline gimple_seq *
3352 gimple_try_eval_ptr (gimple gs)
3354 GIMPLE_CHECK (gs, GIMPLE_TRY);
3355 return &gs->gimple_try.eval;
3359 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3361 static inline gimple_seq
3362 gimple_try_eval (gimple gs)
3364 return *gimple_try_eval_ptr (gs);
3368 /* Return a pointer to the sequence of statements used as the cleanup body for
3369 GIMPLE_TRY GS. */
3371 static inline gimple_seq *
3372 gimple_try_cleanup_ptr (gimple gs)
3374 GIMPLE_CHECK (gs, GIMPLE_TRY);
3375 return &gs->gimple_try.cleanup;
3379 /* Return the sequence of statements used as the cleanup body for
3380 GIMPLE_TRY GS. */
3382 static inline gimple_seq
3383 gimple_try_cleanup (gimple gs)
3385 return *gimple_try_cleanup_ptr (gs);
3389 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3391 static inline void
3392 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3394 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3395 if (catch_is_cleanup)
3396 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3397 else
3398 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3402 /* Set EVAL to be the sequence of statements to use as the body for
3403 GIMPLE_TRY GS. */
3405 static inline void
3406 gimple_try_set_eval (gimple gs, gimple_seq eval)
3408 GIMPLE_CHECK (gs, GIMPLE_TRY);
3409 gs->gimple_try.eval = eval;
3413 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3414 body for GIMPLE_TRY GS. */
3416 static inline void
3417 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3419 GIMPLE_CHECK (gs, GIMPLE_TRY);
3420 gs->gimple_try.cleanup = cleanup;
3424 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3426 static inline gimple_seq *
3427 gimple_wce_cleanup_ptr (gimple gs)
3429 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3430 return &gs->gimple_wce.cleanup;
3434 /* Return the cleanup sequence for cleanup statement GS. */
3436 static inline gimple_seq
3437 gimple_wce_cleanup (gimple gs)
3439 return *gimple_wce_cleanup_ptr (gs);
3443 /* Set CLEANUP to be the cleanup sequence for GS. */
3445 static inline void
3446 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3448 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3449 gs->gimple_wce.cleanup = cleanup;
3453 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3455 static inline bool
3456 gimple_wce_cleanup_eh_only (const_gimple gs)
3458 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3459 return gs->gsbase.subcode != 0;
3463 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3465 static inline void
3466 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3468 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3469 gs->gsbase.subcode = (unsigned int) eh_only_p;
3473 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3475 static inline unsigned
3476 gimple_phi_capacity (const_gimple gs)
3478 GIMPLE_CHECK (gs, GIMPLE_PHI);
3479 return gs->gimple_phi.capacity;
3483 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3484 be exactly the number of incoming edges for the basic block holding
3485 GS. */
3487 static inline unsigned
3488 gimple_phi_num_args (const_gimple gs)
3490 GIMPLE_CHECK (gs, GIMPLE_PHI);
3491 return gs->gimple_phi.nargs;
3495 /* Return the SSA name created by GIMPLE_PHI GS. */
3497 static inline tree
3498 gimple_phi_result (const_gimple gs)
3500 GIMPLE_CHECK (gs, GIMPLE_PHI);
3501 return gs->gimple_phi.result;
3504 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3506 static inline tree *
3507 gimple_phi_result_ptr (gimple gs)
3509 GIMPLE_CHECK (gs, GIMPLE_PHI);
3510 return &gs->gimple_phi.result;
3513 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3515 static inline void
3516 gimple_phi_set_result (gimple gs, tree result)
3518 GIMPLE_CHECK (gs, GIMPLE_PHI);
3519 gs->gimple_phi.result = result;
3520 if (result && TREE_CODE (result) == SSA_NAME)
3521 SSA_NAME_DEF_STMT (result) = gs;
3525 /* Return the PHI argument corresponding to incoming edge INDEX for
3526 GIMPLE_PHI GS. */
3528 static inline struct phi_arg_d *
3529 gimple_phi_arg (gimple gs, unsigned index)
3531 GIMPLE_CHECK (gs, GIMPLE_PHI);
3532 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3533 return &(gs->gimple_phi.args[index]);
3536 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3537 for GIMPLE_PHI GS. */
3539 static inline void
3540 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3542 GIMPLE_CHECK (gs, GIMPLE_PHI);
3543 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3544 gs->gimple_phi.args[index] = *phiarg;
3547 /* Return the PHI nodes for basic block BB, or NULL if there are no
3548 PHI nodes. */
3550 static inline gimple_seq
3551 phi_nodes (const_basic_block bb)
3553 gcc_checking_assert (!(bb->flags & BB_RTL));
3554 return bb->il.gimple.phi_nodes;
3557 /* Return a pointer to the PHI nodes for basic block BB. */
3559 static inline gimple_seq *
3560 phi_nodes_ptr (basic_block bb)
3562 gcc_checking_assert (!(bb->flags & BB_RTL));
3563 return &bb->il.gimple.phi_nodes;
3566 /* Return the tree operand for argument I of PHI node GS. */
3568 static inline tree
3569 gimple_phi_arg_def (gimple gs, size_t index)
3571 return gimple_phi_arg (gs, index)->def;
3575 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3577 static inline tree *
3578 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3580 return &gimple_phi_arg (gs, index)->def;
3583 /* Return the edge associated with argument I of phi node GS. */
3585 static inline edge
3586 gimple_phi_arg_edge (gimple gs, size_t i)
3588 return EDGE_PRED (gimple_bb (gs), i);
3591 /* Return the source location of gimple argument I of phi node GS. */
3593 static inline source_location
3594 gimple_phi_arg_location (gimple gs, size_t i)
3596 return gimple_phi_arg (gs, i)->locus;
3599 /* Return the source location of the argument on edge E of phi node GS. */
3601 static inline source_location
3602 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3604 return gimple_phi_arg (gs, e->dest_idx)->locus;
3607 /* Set the source location of gimple argument I of phi node GS to LOC. */
3609 static inline void
3610 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3612 gimple_phi_arg (gs, i)->locus = loc;
3615 /* Return TRUE if argument I of phi node GS has a location record. */
3617 static inline bool
3618 gimple_phi_arg_has_location (gimple gs, size_t i)
3620 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3624 /* Return the region number for GIMPLE_RESX GS. */
3626 static inline int
3627 gimple_resx_region (const_gimple gs)
3629 GIMPLE_CHECK (gs, GIMPLE_RESX);
3630 return gs->gimple_eh_ctrl.region;
3633 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3635 static inline void
3636 gimple_resx_set_region (gimple gs, int region)
3638 GIMPLE_CHECK (gs, GIMPLE_RESX);
3639 gs->gimple_eh_ctrl.region = region;
3642 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3644 static inline int
3645 gimple_eh_dispatch_region (const_gimple gs)
3647 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3648 return gs->gimple_eh_ctrl.region;
3651 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3653 static inline void
3654 gimple_eh_dispatch_set_region (gimple gs, int region)
3656 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3657 gs->gimple_eh_ctrl.region = region;
3660 /* Return the number of labels associated with the switch statement GS. */
3662 static inline unsigned
3663 gimple_switch_num_labels (const_gimple gs)
3665 unsigned num_ops;
3666 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3667 num_ops = gimple_num_ops (gs);
3668 gcc_gimple_checking_assert (num_ops > 1);
3669 return num_ops - 1;
3673 /* Set NLABELS to be the number of labels for the switch statement GS. */
3675 static inline void
3676 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3678 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3679 gimple_set_num_ops (g, nlabels + 1);
3683 /* Return the index variable used by the switch statement GS. */
3685 static inline tree
3686 gimple_switch_index (const_gimple gs)
3688 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3689 return gimple_op (gs, 0);
3693 /* Return a pointer to the index variable for the switch statement GS. */
3695 static inline tree *
3696 gimple_switch_index_ptr (const_gimple gs)
3698 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3699 return gimple_op_ptr (gs, 0);
3703 /* Set INDEX to be the index variable for switch statement GS. */
3705 static inline void
3706 gimple_switch_set_index (gimple gs, tree index)
3708 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3709 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3710 gimple_set_op (gs, 0, index);
3714 /* Return the label numbered INDEX. The default label is 0, followed by any
3715 labels in a switch statement. */
3717 static inline tree
3718 gimple_switch_label (const_gimple gs, unsigned index)
3720 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3721 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3722 return gimple_op (gs, index + 1);
3725 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3727 static inline void
3728 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3730 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3731 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3732 && (label == NULL_TREE
3733 || TREE_CODE (label) == CASE_LABEL_EXPR));
3734 gimple_set_op (gs, index + 1, label);
3737 /* Return the default label for a switch statement. */
3739 static inline tree
3740 gimple_switch_default_label (const_gimple gs)
3742 tree label = gimple_switch_label (gs, 0);
3743 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3744 return label;
3747 /* Set the default label for a switch statement. */
3749 static inline void
3750 gimple_switch_set_default_label (gimple gs, tree label)
3752 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3753 gimple_switch_set_label (gs, 0, label);
3756 /* Return true if GS is a GIMPLE_DEBUG statement. */
3758 static inline bool
3759 is_gimple_debug (const_gimple gs)
3761 return gimple_code (gs) == GIMPLE_DEBUG;
3764 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3766 static inline bool
3767 gimple_debug_bind_p (const_gimple s)
3769 if (is_gimple_debug (s))
3770 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3772 return false;
3775 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3777 static inline tree
3778 gimple_debug_bind_get_var (gimple dbg)
3780 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3781 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3782 return gimple_op (dbg, 0);
3785 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3786 statement. */
3788 static inline tree
3789 gimple_debug_bind_get_value (gimple dbg)
3791 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3792 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3793 return gimple_op (dbg, 1);
3796 /* Return a pointer to the value bound to the variable in a
3797 GIMPLE_DEBUG bind statement. */
3799 static inline tree *
3800 gimple_debug_bind_get_value_ptr (gimple dbg)
3802 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3803 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3804 return gimple_op_ptr (dbg, 1);
3807 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3809 static inline void
3810 gimple_debug_bind_set_var (gimple dbg, tree var)
3812 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3813 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3814 gimple_set_op (dbg, 0, var);
3817 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3818 statement. */
3820 static inline void
3821 gimple_debug_bind_set_value (gimple dbg, tree value)
3823 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3824 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3825 gimple_set_op (dbg, 1, value);
3828 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3829 optimized away. */
3830 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3832 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3833 statement. */
3835 static inline void
3836 gimple_debug_bind_reset_value (gimple dbg)
3838 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3839 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3840 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3843 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3844 value. */
3846 static inline bool
3847 gimple_debug_bind_has_value_p (gimple dbg)
3849 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3850 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3851 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3854 #undef GIMPLE_DEBUG_BIND_NOVALUE
3856 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3858 static inline bool
3859 gimple_debug_source_bind_p (const_gimple s)
3861 if (is_gimple_debug (s))
3862 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3864 return false;
3867 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3869 static inline tree
3870 gimple_debug_source_bind_get_var (gimple dbg)
3872 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3873 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3874 return gimple_op (dbg, 0);
3877 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3878 statement. */
3880 static inline tree
3881 gimple_debug_source_bind_get_value (gimple dbg)
3883 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3884 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3885 return gimple_op (dbg, 1);
3888 /* Return a pointer to the value bound to the variable in a
3889 GIMPLE_DEBUG source bind statement. */
3891 static inline tree *
3892 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3894 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3895 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3896 return gimple_op_ptr (dbg, 1);
3899 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3901 static inline void
3902 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3904 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3905 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3906 gimple_set_op (dbg, 0, var);
3909 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3910 statement. */
3912 static inline void
3913 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3915 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3916 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3917 gimple_set_op (dbg, 1, value);
3920 /* Return the line number for EXPR, or return -1 if we have no line
3921 number information for it. */
3922 static inline int
3923 get_lineno (const_gimple stmt)
3925 location_t loc;
3927 if (!stmt)
3928 return -1;
3930 loc = gimple_location (stmt);
3931 if (loc == UNKNOWN_LOCATION)
3932 return -1;
3934 return LOCATION_LINE (loc);
3937 /* Return a pointer to the body for the OMP statement GS. */
3939 static inline gimple_seq *
3940 gimple_omp_body_ptr (gimple gs)
3942 return &gs->omp.body;
3945 /* Return the body for the OMP statement GS. */
3947 static inline gimple_seq
3948 gimple_omp_body (gimple gs)
3950 return *gimple_omp_body_ptr (gs);
3953 /* Set BODY to be the body for the OMP statement GS. */
3955 static inline void
3956 gimple_omp_set_body (gimple gs, gimple_seq body)
3958 gs->omp.body = body;
3962 /* Return the name associated with OMP_CRITICAL statement GS. */
3964 static inline tree
3965 gimple_omp_critical_name (const_gimple gs)
3967 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3968 return gs->gimple_omp_critical.name;
3972 /* Return a pointer to the name associated with OMP critical statement GS. */
3974 static inline tree *
3975 gimple_omp_critical_name_ptr (gimple gs)
3977 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3978 return &gs->gimple_omp_critical.name;
3982 /* Set NAME to be the name associated with OMP critical statement GS. */
3984 static inline void
3985 gimple_omp_critical_set_name (gimple gs, tree name)
3987 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3988 gs->gimple_omp_critical.name = name;
3992 /* Return the kind of OMP for statemement. */
3994 static inline int
3995 gimple_omp_for_kind (const_gimple g)
3997 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3998 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4002 /* Set the OMP for kind. */
4004 static inline void
4005 gimple_omp_for_set_kind (gimple g, int kind)
4007 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4008 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_FOR_KIND_MASK)
4009 | (kind & GF_OMP_FOR_KIND_MASK);
4013 /* Return true if OMP for statement G has the
4014 GF_OMP_FOR_COMBINED flag set. */
4016 static inline bool
4017 gimple_omp_for_combined_p (const_gimple g)
4019 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4020 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4024 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4025 value of COMBINED_P. */
4027 static inline void
4028 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4030 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4031 if (combined_p)
4032 g->gsbase.subcode |= GF_OMP_FOR_COMBINED;
4033 else
4034 g->gsbase.subcode &= ~GF_OMP_FOR_COMBINED;
4038 /* Return true if OMP for statement G has the
4039 GF_OMP_FOR_COMBINED_INTO flag set. */
4041 static inline bool
4042 gimple_omp_for_combined_into_p (const_gimple g)
4044 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4045 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4049 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4050 value of COMBINED_P. */
4052 static inline void
4053 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4055 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4056 if (combined_p)
4057 g->gsbase.subcode |= GF_OMP_FOR_COMBINED_INTO;
4058 else
4059 g->gsbase.subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4063 /* Return the clauses associated with OMP_FOR GS. */
4065 static inline tree
4066 gimple_omp_for_clauses (const_gimple gs)
4068 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4069 return gs->gimple_omp_for.clauses;
4073 /* Return a pointer to the OMP_FOR GS. */
4075 static inline tree *
4076 gimple_omp_for_clauses_ptr (gimple gs)
4078 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4079 return &gs->gimple_omp_for.clauses;
4083 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4085 static inline void
4086 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4088 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4089 gs->gimple_omp_for.clauses = clauses;
4093 /* Get the collapse count of OMP_FOR GS. */
4095 static inline size_t
4096 gimple_omp_for_collapse (gimple gs)
4098 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4099 return gs->gimple_omp_for.collapse;
4103 /* Return the index variable for OMP_FOR GS. */
4105 static inline tree
4106 gimple_omp_for_index (const_gimple gs, size_t i)
4108 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4109 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4110 return gs->gimple_omp_for.iter[i].index;
4114 /* Return a pointer to the index variable for OMP_FOR GS. */
4116 static inline tree *
4117 gimple_omp_for_index_ptr (gimple gs, size_t i)
4119 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4120 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4121 return &gs->gimple_omp_for.iter[i].index;
4125 /* Set INDEX to be the index variable for OMP_FOR GS. */
4127 static inline void
4128 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4130 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4131 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4132 gs->gimple_omp_for.iter[i].index = index;
4136 /* Return the initial value for OMP_FOR GS. */
4138 static inline tree
4139 gimple_omp_for_initial (const_gimple gs, size_t i)
4141 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4142 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4143 return gs->gimple_omp_for.iter[i].initial;
4147 /* Return a pointer to the initial value for OMP_FOR GS. */
4149 static inline tree *
4150 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4152 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4153 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4154 return &gs->gimple_omp_for.iter[i].initial;
4158 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4160 static inline void
4161 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4163 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4164 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4165 gs->gimple_omp_for.iter[i].initial = initial;
4169 /* Return the final value for OMP_FOR GS. */
4171 static inline tree
4172 gimple_omp_for_final (const_gimple gs, size_t i)
4174 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4175 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4176 return gs->gimple_omp_for.iter[i].final;
4180 /* Return a pointer to the final value for OMP_FOR GS. */
4182 static inline tree *
4183 gimple_omp_for_final_ptr (gimple gs, size_t i)
4185 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4186 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4187 return &gs->gimple_omp_for.iter[i].final;
4191 /* Set FINAL to be the final value for OMP_FOR GS. */
4193 static inline void
4194 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4196 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4197 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4198 gs->gimple_omp_for.iter[i].final = final;
4202 /* Return the increment value for OMP_FOR GS. */
4204 static inline tree
4205 gimple_omp_for_incr (const_gimple gs, size_t i)
4207 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4208 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4209 return gs->gimple_omp_for.iter[i].incr;
4213 /* Return a pointer to the increment value for OMP_FOR GS. */
4215 static inline tree *
4216 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4218 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4219 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4220 return &gs->gimple_omp_for.iter[i].incr;
4224 /* Set INCR to be the increment value for OMP_FOR GS. */
4226 static inline void
4227 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4229 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4230 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4231 gs->gimple_omp_for.iter[i].incr = incr;
4235 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4236 statement GS starts. */
4238 static inline gimple_seq *
4239 gimple_omp_for_pre_body_ptr (gimple gs)
4241 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4242 return &gs->gimple_omp_for.pre_body;
4246 /* Return the sequence of statements to execute before the OMP_FOR
4247 statement GS starts. */
4249 static inline gimple_seq
4250 gimple_omp_for_pre_body (gimple gs)
4252 return *gimple_omp_for_pre_body_ptr (gs);
4256 /* Set PRE_BODY to be the sequence of statements to execute before the
4257 OMP_FOR statement GS starts. */
4259 static inline void
4260 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4262 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4263 gs->gimple_omp_for.pre_body = pre_body;
4267 /* Return the clauses associated with OMP_PARALLEL GS. */
4269 static inline tree
4270 gimple_omp_parallel_clauses (const_gimple gs)
4272 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4273 return gs->gimple_omp_parallel.clauses;
4277 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4279 static inline tree *
4280 gimple_omp_parallel_clauses_ptr (gimple gs)
4282 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4283 return &gs->gimple_omp_parallel.clauses;
4287 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4288 GS. */
4290 static inline void
4291 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4293 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4294 gs->gimple_omp_parallel.clauses = clauses;
4298 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4300 static inline tree
4301 gimple_omp_parallel_child_fn (const_gimple gs)
4303 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4304 return gs->gimple_omp_parallel.child_fn;
4307 /* Return a pointer to the child function used to hold the body of
4308 OMP_PARALLEL GS. */
4310 static inline tree *
4311 gimple_omp_parallel_child_fn_ptr (gimple gs)
4313 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4314 return &gs->gimple_omp_parallel.child_fn;
4318 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4320 static inline void
4321 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4323 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4324 gs->gimple_omp_parallel.child_fn = child_fn;
4328 /* Return the artificial argument used to send variables and values
4329 from the parent to the children threads in OMP_PARALLEL GS. */
4331 static inline tree
4332 gimple_omp_parallel_data_arg (const_gimple gs)
4334 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4335 return gs->gimple_omp_parallel.data_arg;
4339 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4341 static inline tree *
4342 gimple_omp_parallel_data_arg_ptr (gimple gs)
4344 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4345 return &gs->gimple_omp_parallel.data_arg;
4349 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4351 static inline void
4352 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4354 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4355 gs->gimple_omp_parallel.data_arg = data_arg;
4359 /* Return the clauses associated with OMP_TASK GS. */
4361 static inline tree
4362 gimple_omp_task_clauses (const_gimple gs)
4364 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4365 return gs->gimple_omp_parallel.clauses;
4369 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4371 static inline tree *
4372 gimple_omp_task_clauses_ptr (gimple gs)
4374 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4375 return &gs->gimple_omp_parallel.clauses;
4379 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4380 GS. */
4382 static inline void
4383 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4385 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4386 gs->gimple_omp_parallel.clauses = clauses;
4390 /* Return the child function used to hold the body of OMP_TASK GS. */
4392 static inline tree
4393 gimple_omp_task_child_fn (const_gimple gs)
4395 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4396 return gs->gimple_omp_parallel.child_fn;
4399 /* Return a pointer to the child function used to hold the body of
4400 OMP_TASK GS. */
4402 static inline tree *
4403 gimple_omp_task_child_fn_ptr (gimple gs)
4405 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4406 return &gs->gimple_omp_parallel.child_fn;
4410 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4412 static inline void
4413 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4415 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4416 gs->gimple_omp_parallel.child_fn = child_fn;
4420 /* Return the artificial argument used to send variables and values
4421 from the parent to the children threads in OMP_TASK GS. */
4423 static inline tree
4424 gimple_omp_task_data_arg (const_gimple gs)
4426 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4427 return gs->gimple_omp_parallel.data_arg;
4431 /* Return a pointer to the data argument for OMP_TASK GS. */
4433 static inline tree *
4434 gimple_omp_task_data_arg_ptr (gimple gs)
4436 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4437 return &gs->gimple_omp_parallel.data_arg;
4441 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4443 static inline void
4444 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4446 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4447 gs->gimple_omp_parallel.data_arg = data_arg;
4451 /* Return the clauses associated with OMP_TASK GS. */
4453 static inline tree
4454 gimple_omp_taskreg_clauses (const_gimple gs)
4456 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4457 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4458 return gs->gimple_omp_parallel.clauses;
4462 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4464 static inline tree *
4465 gimple_omp_taskreg_clauses_ptr (gimple gs)
4467 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4468 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4469 return &gs->gimple_omp_parallel.clauses;
4473 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4474 GS. */
4476 static inline void
4477 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4479 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4480 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4481 gs->gimple_omp_parallel.clauses = clauses;
4485 /* Return the child function used to hold the body of OMP_TASK GS. */
4487 static inline tree
4488 gimple_omp_taskreg_child_fn (const_gimple gs)
4490 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4491 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4492 return gs->gimple_omp_parallel.child_fn;
4495 /* Return a pointer to the child function used to hold the body of
4496 OMP_TASK GS. */
4498 static inline tree *
4499 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4501 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4502 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4503 return &gs->gimple_omp_parallel.child_fn;
4507 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4509 static inline void
4510 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4512 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4513 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4514 gs->gimple_omp_parallel.child_fn = child_fn;
4518 /* Return the artificial argument used to send variables and values
4519 from the parent to the children threads in OMP_TASK GS. */
4521 static inline tree
4522 gimple_omp_taskreg_data_arg (const_gimple gs)
4524 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4525 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4526 return gs->gimple_omp_parallel.data_arg;
4530 /* Return a pointer to the data argument for OMP_TASK GS. */
4532 static inline tree *
4533 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4535 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4536 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4537 return &gs->gimple_omp_parallel.data_arg;
4541 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4543 static inline void
4544 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4546 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4547 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4548 gs->gimple_omp_parallel.data_arg = data_arg;
4552 /* Return the copy function used to hold the body of OMP_TASK GS. */
4554 static inline tree
4555 gimple_omp_task_copy_fn (const_gimple gs)
4557 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4558 return gs->gimple_omp_task.copy_fn;
4561 /* Return a pointer to the copy function used to hold the body of
4562 OMP_TASK GS. */
4564 static inline tree *
4565 gimple_omp_task_copy_fn_ptr (gimple gs)
4567 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4568 return &gs->gimple_omp_task.copy_fn;
4572 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4574 static inline void
4575 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4577 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4578 gs->gimple_omp_task.copy_fn = copy_fn;
4582 /* Return size of the data block in bytes in OMP_TASK GS. */
4584 static inline tree
4585 gimple_omp_task_arg_size (const_gimple gs)
4587 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4588 return gs->gimple_omp_task.arg_size;
4592 /* Return a pointer to the data block size for OMP_TASK GS. */
4594 static inline tree *
4595 gimple_omp_task_arg_size_ptr (gimple gs)
4597 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4598 return &gs->gimple_omp_task.arg_size;
4602 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4604 static inline void
4605 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4607 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4608 gs->gimple_omp_task.arg_size = arg_size;
4612 /* Return align of the data block in bytes in OMP_TASK GS. */
4614 static inline tree
4615 gimple_omp_task_arg_align (const_gimple gs)
4617 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4618 return gs->gimple_omp_task.arg_align;
4622 /* Return a pointer to the data block align for OMP_TASK GS. */
4624 static inline tree *
4625 gimple_omp_task_arg_align_ptr (gimple gs)
4627 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4628 return &gs->gimple_omp_task.arg_align;
4632 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4634 static inline void
4635 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4637 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4638 gs->gimple_omp_task.arg_align = arg_align;
4642 /* Return the clauses associated with OMP_SINGLE GS. */
4644 static inline tree
4645 gimple_omp_single_clauses (const_gimple gs)
4647 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4648 return gs->gimple_omp_single.clauses;
4652 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4654 static inline tree *
4655 gimple_omp_single_clauses_ptr (gimple gs)
4657 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4658 return &gs->gimple_omp_single.clauses;
4662 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4664 static inline void
4665 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4667 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4668 gs->gimple_omp_single.clauses = clauses;
4672 /* Return the clauses associated with OMP_TARGET GS. */
4674 static inline tree
4675 gimple_omp_target_clauses (const_gimple gs)
4677 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4678 return gs->gimple_omp_parallel.clauses;
4682 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
4684 static inline tree *
4685 gimple_omp_target_clauses_ptr (gimple gs)
4687 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4688 return &gs->gimple_omp_parallel.clauses;
4692 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
4694 static inline void
4695 gimple_omp_target_set_clauses (gimple gs, tree clauses)
4697 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4698 gs->gimple_omp_parallel.clauses = clauses;
4702 /* Return the kind of OMP target statemement. */
4704 static inline int
4705 gimple_omp_target_kind (const_gimple g)
4707 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
4708 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
4712 /* Set the OMP target kind. */
4714 static inline void
4715 gimple_omp_target_set_kind (gimple g, int kind)
4717 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
4718 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_TARGET_KIND_MASK)
4719 | (kind & GF_OMP_TARGET_KIND_MASK);
4723 /* Return the child function used to hold the body of OMP_TARGET GS. */
4725 static inline tree
4726 gimple_omp_target_child_fn (const_gimple gs)
4728 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4729 return gs->gimple_omp_parallel.child_fn;
4732 /* Return a pointer to the child function used to hold the body of
4733 OMP_TARGET GS. */
4735 static inline tree *
4736 gimple_omp_target_child_fn_ptr (gimple gs)
4738 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4739 return &gs->gimple_omp_parallel.child_fn;
4743 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
4745 static inline void
4746 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
4748 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4749 gs->gimple_omp_parallel.child_fn = child_fn;
4753 /* Return the artificial argument used to send variables and values
4754 from the parent to the children threads in OMP_TARGET GS. */
4756 static inline tree
4757 gimple_omp_target_data_arg (const_gimple gs)
4759 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4760 return gs->gimple_omp_parallel.data_arg;
4764 /* Return a pointer to the data argument for OMP_TARGET GS. */
4766 static inline tree *
4767 gimple_omp_target_data_arg_ptr (gimple gs)
4769 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4770 return &gs->gimple_omp_parallel.data_arg;
4774 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
4776 static inline void
4777 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
4779 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4780 gs->gimple_omp_parallel.data_arg = data_arg;
4784 /* Return the clauses associated with OMP_TEAMS GS. */
4786 static inline tree
4787 gimple_omp_teams_clauses (const_gimple gs)
4789 GIMPLE_CHECK (gs, GIMPLE_OMP_TEAMS);
4790 return gs->gimple_omp_single.clauses;
4794 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
4796 static inline tree *
4797 gimple_omp_teams_clauses_ptr (gimple gs)
4799 GIMPLE_CHECK (gs, GIMPLE_OMP_TEAMS);
4800 return &gs->gimple_omp_single.clauses;
4804 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
4806 static inline void
4807 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
4809 GIMPLE_CHECK (gs, GIMPLE_OMP_TEAMS);
4810 gs->gimple_omp_single.clauses = clauses;
4814 /* Return the clauses associated with OMP_SECTIONS GS. */
4816 static inline tree
4817 gimple_omp_sections_clauses (const_gimple gs)
4819 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4820 return gs->gimple_omp_sections.clauses;
4824 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4826 static inline tree *
4827 gimple_omp_sections_clauses_ptr (gimple gs)
4829 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4830 return &gs->gimple_omp_sections.clauses;
4834 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4835 GS. */
4837 static inline void
4838 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4840 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4841 gs->gimple_omp_sections.clauses = clauses;
4845 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4846 in GS. */
4848 static inline tree
4849 gimple_omp_sections_control (const_gimple gs)
4851 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4852 return gs->gimple_omp_sections.control;
4856 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4857 GS. */
4859 static inline tree *
4860 gimple_omp_sections_control_ptr (gimple gs)
4862 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4863 return &gs->gimple_omp_sections.control;
4867 /* Set CONTROL to be the set of clauses associated with the
4868 GIMPLE_OMP_SECTIONS in GS. */
4870 static inline void
4871 gimple_omp_sections_set_control (gimple gs, tree control)
4873 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4874 gs->gimple_omp_sections.control = control;
4878 /* Set COND to be the condition code for OMP_FOR GS. */
4880 static inline void
4881 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4883 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4884 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4885 && i < gs->gimple_omp_for.collapse);
4886 gs->gimple_omp_for.iter[i].cond = cond;
4890 /* Return the condition code associated with OMP_FOR GS. */
4892 static inline enum tree_code
4893 gimple_omp_for_cond (const_gimple gs, size_t i)
4895 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4896 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4897 return gs->gimple_omp_for.iter[i].cond;
4901 /* Set the value being stored in an atomic store. */
4903 static inline void
4904 gimple_omp_atomic_store_set_val (gimple g, tree val)
4906 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4907 g->gimple_omp_atomic_store.val = val;
4911 /* Return the value being stored in an atomic store. */
4913 static inline tree
4914 gimple_omp_atomic_store_val (const_gimple g)
4916 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4917 return g->gimple_omp_atomic_store.val;
4921 /* Return a pointer to the value being stored in an atomic store. */
4923 static inline tree *
4924 gimple_omp_atomic_store_val_ptr (gimple g)
4926 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4927 return &g->gimple_omp_atomic_store.val;
4931 /* Set the LHS of an atomic load. */
4933 static inline void
4934 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4936 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4937 g->gimple_omp_atomic_load.lhs = lhs;
4941 /* Get the LHS of an atomic load. */
4943 static inline tree
4944 gimple_omp_atomic_load_lhs (const_gimple g)
4946 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4947 return g->gimple_omp_atomic_load.lhs;
4951 /* Return a pointer to the LHS of an atomic load. */
4953 static inline tree *
4954 gimple_omp_atomic_load_lhs_ptr (gimple g)
4956 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4957 return &g->gimple_omp_atomic_load.lhs;
4961 /* Set the RHS of an atomic load. */
4963 static inline void
4964 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4966 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4967 g->gimple_omp_atomic_load.rhs = rhs;
4971 /* Get the RHS of an atomic load. */
4973 static inline tree
4974 gimple_omp_atomic_load_rhs (const_gimple g)
4976 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4977 return g->gimple_omp_atomic_load.rhs;
4981 /* Return a pointer to the RHS of an atomic load. */
4983 static inline tree *
4984 gimple_omp_atomic_load_rhs_ptr (gimple g)
4986 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4987 return &g->gimple_omp_atomic_load.rhs;
4991 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4993 static inline tree
4994 gimple_omp_continue_control_def (const_gimple g)
4996 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4997 return g->gimple_omp_continue.control_def;
5000 /* The same as above, but return the address. */
5002 static inline tree *
5003 gimple_omp_continue_control_def_ptr (gimple g)
5005 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5006 return &g->gimple_omp_continue.control_def;
5009 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5011 static inline void
5012 gimple_omp_continue_set_control_def (gimple g, tree def)
5014 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5015 g->gimple_omp_continue.control_def = def;
5019 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5021 static inline tree
5022 gimple_omp_continue_control_use (const_gimple g)
5024 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5025 return g->gimple_omp_continue.control_use;
5029 /* The same as above, but return the address. */
5031 static inline tree *
5032 gimple_omp_continue_control_use_ptr (gimple g)
5034 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5035 return &g->gimple_omp_continue.control_use;
5039 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5041 static inline void
5042 gimple_omp_continue_set_control_use (gimple g, tree use)
5044 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5045 g->gimple_omp_continue.control_use = use;
5048 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5050 static inline gimple_seq *
5051 gimple_transaction_body_ptr (gimple gs)
5053 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5054 return &gs->gimple_transaction.body;
5057 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5059 static inline gimple_seq
5060 gimple_transaction_body (gimple gs)
5062 return *gimple_transaction_body_ptr (gs);
5065 /* Return the label associated with a GIMPLE_TRANSACTION. */
5067 static inline tree
5068 gimple_transaction_label (const_gimple gs)
5070 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5071 return gs->gimple_transaction.label;
5074 static inline tree *
5075 gimple_transaction_label_ptr (gimple gs)
5077 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5078 return &gs->gimple_transaction.label;
5081 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5083 static inline unsigned int
5084 gimple_transaction_subcode (const_gimple gs)
5086 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5087 return gs->gsbase.subcode;
5090 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5092 static inline void
5093 gimple_transaction_set_body (gimple gs, gimple_seq body)
5095 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5096 gs->gimple_transaction.body = body;
5099 /* Set the label associated with a GIMPLE_TRANSACTION. */
5101 static inline void
5102 gimple_transaction_set_label (gimple gs, tree label)
5104 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5105 gs->gimple_transaction.label = label;
5108 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5110 static inline void
5111 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5113 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5114 gs->gsbase.subcode = subcode;
5118 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5120 static inline tree *
5121 gimple_return_retval_ptr (const_gimple gs)
5123 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5124 return gimple_op_ptr (gs, 0);
5127 /* Return the return value for GIMPLE_RETURN GS. */
5129 static inline tree
5130 gimple_return_retval (const_gimple gs)
5132 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5133 return gimple_op (gs, 0);
5137 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5139 static inline void
5140 gimple_return_set_retval (gimple gs, tree retval)
5142 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5143 gimple_set_op (gs, 0, retval);
5147 /* Return the return bounds for GIMPLE_RETURN GS. */
5149 static inline tree
5150 gimple_return_retbnd (const_gimple gs)
5152 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5153 return gimple_op (gs, 1);
5157 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5159 static inline void
5160 gimple_return_set_retbnd (gimple gs, tree retval)
5162 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5163 gimple_set_op (gs, 1, retval);
5167 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5169 #define CASE_GIMPLE_OMP \
5170 case GIMPLE_OMP_PARALLEL: \
5171 case GIMPLE_OMP_TASK: \
5172 case GIMPLE_OMP_FOR: \
5173 case GIMPLE_OMP_SECTIONS: \
5174 case GIMPLE_OMP_SECTIONS_SWITCH: \
5175 case GIMPLE_OMP_SINGLE: \
5176 case GIMPLE_OMP_TARGET: \
5177 case GIMPLE_OMP_TEAMS: \
5178 case GIMPLE_OMP_SECTION: \
5179 case GIMPLE_OMP_MASTER: \
5180 case GIMPLE_OMP_TASKGROUP: \
5181 case GIMPLE_OMP_ORDERED: \
5182 case GIMPLE_OMP_CRITICAL: \
5183 case GIMPLE_OMP_RETURN: \
5184 case GIMPLE_OMP_ATOMIC_LOAD: \
5185 case GIMPLE_OMP_ATOMIC_STORE: \
5186 case GIMPLE_OMP_CONTINUE
5188 static inline bool
5189 is_gimple_omp (const_gimple stmt)
5191 switch (gimple_code (stmt))
5193 CASE_GIMPLE_OMP:
5194 return true;
5195 default:
5196 return false;
5201 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5203 static inline bool
5204 gimple_nop_p (const_gimple g)
5206 return gimple_code (g) == GIMPLE_NOP;
5210 /* Return true if GS is a GIMPLE_RESX. */
5212 static inline bool
5213 is_gimple_resx (const_gimple gs)
5215 return gimple_code (gs) == GIMPLE_RESX;
5218 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5220 static inline enum br_predictor
5221 gimple_predict_predictor (gimple gs)
5223 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5224 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
5228 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5230 static inline void
5231 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5233 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5234 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
5235 | (unsigned) predictor;
5239 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5241 static inline enum prediction
5242 gimple_predict_outcome (gimple gs)
5244 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5245 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5249 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5251 static inline void
5252 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5254 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5255 if (outcome == TAKEN)
5256 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
5257 else
5258 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
5262 /* Return the type of the main expression computed by STMT. Return
5263 void_type_node if the statement computes nothing. */
5265 static inline tree
5266 gimple_expr_type (const_gimple stmt)
5268 enum gimple_code code = gimple_code (stmt);
5270 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5272 tree type;
5273 /* In general we want to pass out a type that can be substituted
5274 for both the RHS and the LHS types if there is a possibly
5275 useless conversion involved. That means returning the
5276 original RHS type as far as we can reconstruct it. */
5277 if (code == GIMPLE_CALL)
5278 type = gimple_call_return_type (stmt);
5279 else
5280 switch (gimple_assign_rhs_code (stmt))
5282 case POINTER_PLUS_EXPR:
5283 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5284 break;
5286 default:
5287 /* As fallback use the type of the LHS. */
5288 type = TREE_TYPE (gimple_get_lhs (stmt));
5289 break;
5291 return type;
5293 else if (code == GIMPLE_COND)
5294 return boolean_type_node;
5295 else
5296 return void_type_node;
5299 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5301 static inline gimple_stmt_iterator
5302 gsi_start_1 (gimple_seq *seq)
5304 gimple_stmt_iterator i;
5306 i.ptr = gimple_seq_first (*seq);
5307 i.seq = seq;
5308 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5310 return i;
5313 #define gsi_start(x) gsi_start_1 (&(x))
5315 static inline gimple_stmt_iterator
5316 gsi_none (void)
5318 gimple_stmt_iterator i;
5319 i.ptr = NULL;
5320 i.seq = NULL;
5321 i.bb = NULL;
5322 return i;
5325 /* Return a new iterator pointing to the first statement in basic block BB. */
5327 static inline gimple_stmt_iterator
5328 gsi_start_bb (basic_block bb)
5330 gimple_stmt_iterator i;
5331 gimple_seq *seq;
5333 seq = bb_seq_addr (bb);
5334 i.ptr = gimple_seq_first (*seq);
5335 i.seq = seq;
5336 i.bb = bb;
5338 return i;
5342 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5344 static inline gimple_stmt_iterator
5345 gsi_last_1 (gimple_seq *seq)
5347 gimple_stmt_iterator i;
5349 i.ptr = gimple_seq_last (*seq);
5350 i.seq = seq;
5351 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5353 return i;
5356 #define gsi_last(x) gsi_last_1 (&(x))
5358 /* Return a new iterator pointing to the last statement in basic block BB. */
5360 static inline gimple_stmt_iterator
5361 gsi_last_bb (basic_block bb)
5363 gimple_stmt_iterator i;
5364 gimple_seq *seq;
5366 seq = bb_seq_addr (bb);
5367 i.ptr = gimple_seq_last (*seq);
5368 i.seq = seq;
5369 i.bb = bb;
5371 return i;
5375 /* Return true if I is at the end of its sequence. */
5377 static inline bool
5378 gsi_end_p (gimple_stmt_iterator i)
5380 return i.ptr == NULL;
5384 /* Return true if I is one statement before the end of its sequence. */
5386 static inline bool
5387 gsi_one_before_end_p (gimple_stmt_iterator i)
5389 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5393 /* Advance the iterator to the next gimple statement. */
5395 static inline void
5396 gsi_next (gimple_stmt_iterator *i)
5398 i->ptr = i->ptr->gsbase.next;
5401 /* Advance the iterator to the previous gimple statement. */
5403 static inline void
5404 gsi_prev (gimple_stmt_iterator *i)
5406 gimple prev = i->ptr->gsbase.prev;
5407 if (prev->gsbase.next)
5408 i->ptr = prev;
5409 else
5410 i->ptr = NULL;
5413 /* Return the current stmt. */
5415 static inline gimple
5416 gsi_stmt (gimple_stmt_iterator i)
5418 return i.ptr;
5421 /* Return a block statement iterator that points to the first non-label
5422 statement in block BB. */
5424 static inline gimple_stmt_iterator
5425 gsi_after_labels (basic_block bb)
5427 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5429 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5430 gsi_next (&gsi);
5432 return gsi;
5435 /* Advance the iterator to the next non-debug gimple statement. */
5437 static inline void
5438 gsi_next_nondebug (gimple_stmt_iterator *i)
5442 gsi_next (i);
5444 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5447 /* Advance the iterator to the next non-debug gimple statement. */
5449 static inline void
5450 gsi_prev_nondebug (gimple_stmt_iterator *i)
5454 gsi_prev (i);
5456 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5459 /* Return a new iterator pointing to the first non-debug statement in
5460 basic block BB. */
5462 static inline gimple_stmt_iterator
5463 gsi_start_nondebug_bb (basic_block bb)
5465 gimple_stmt_iterator i = gsi_start_bb (bb);
5467 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5468 gsi_next_nondebug (&i);
5470 return i;
5473 /* Return a new iterator pointing to the first non-debug non-label statement in
5474 basic block BB. */
5476 static inline gimple_stmt_iterator
5477 gsi_start_nondebug_after_labels_bb (basic_block bb)
5479 gimple_stmt_iterator i = gsi_after_labels (bb);
5481 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5482 gsi_next_nondebug (&i);
5484 return i;
5487 /* Return a new iterator pointing to the last non-debug statement in
5488 basic block BB. */
5490 static inline gimple_stmt_iterator
5491 gsi_last_nondebug_bb (basic_block bb)
5493 gimple_stmt_iterator i = gsi_last_bb (bb);
5495 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5496 gsi_prev_nondebug (&i);
5498 return i;
5502 /* Return the basic block associated with this iterator. */
5504 static inline basic_block
5505 gsi_bb (gimple_stmt_iterator i)
5507 return i.bb;
5511 /* Return the sequence associated with this iterator. */
5513 static inline gimple_seq
5514 gsi_seq (gimple_stmt_iterator i)
5516 return *i.seq;
5520 enum gsi_iterator_update
5522 GSI_NEW_STMT, /* Only valid when single statement is added, move
5523 iterator to it. */
5524 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5525 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5526 for linking other statements in the same
5527 direction. */
5530 /* In gimple-iterator.c */
5531 gimple_stmt_iterator gsi_start_phis (basic_block);
5532 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5533 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5534 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5535 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5536 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5537 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5538 enum gsi_iterator_update);
5539 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5540 enum gsi_iterator_update);
5541 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5542 enum gsi_iterator_update);
5543 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5544 enum gsi_iterator_update);
5545 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5546 enum gsi_iterator_update);
5547 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5548 enum gsi_iterator_update);
5549 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5550 enum gsi_iterator_update);
5551 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5552 enum gsi_iterator_update);
5553 bool gsi_remove (gimple_stmt_iterator *, bool);
5554 gimple_stmt_iterator gsi_for_stmt (gimple);
5555 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5556 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5557 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5558 void gsi_insert_on_edge (edge, gimple);
5559 void gsi_insert_seq_on_edge (edge, gimple_seq);
5560 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5561 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5562 void gsi_commit_one_edge_insert (edge, basic_block *);
5563 void gsi_commit_edge_inserts (void);
5564 gimple gimple_call_copy_skip_args (gimple, bitmap);
5566 /* In gimplify.c. */
5567 tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree);
5568 tree force_gimple_operand (tree, gimple_seq *, bool, tree);
5569 tree force_gimple_operand_gsi_1 (gimple_stmt_iterator *, tree,
5570 gimple_predicate, tree,
5571 bool, enum gsi_iterator_update);
5572 tree force_gimple_operand_gsi (gimple_stmt_iterator *, tree, bool, tree,
5573 bool, enum gsi_iterator_update);
5575 /* Convenience routines to walk all statements of a gimple function.
5576 Note that this is useful exclusively before the code is converted
5577 into SSA form. Once the program is in SSA form, the standard
5578 operand interface should be used to analyze/modify statements. */
5579 struct walk_stmt_info
5581 /* Points to the current statement being walked. */
5582 gimple_stmt_iterator gsi;
5584 /* Additional data that the callback functions may want to carry
5585 through the recursion. */
5586 void *info;
5588 /* Pointer map used to mark visited tree nodes when calling
5589 walk_tree on each operand. If set to NULL, duplicate tree nodes
5590 will be visited more than once. */
5591 struct pointer_set_t *pset;
5593 /* Operand returned by the callbacks. This is set when calling
5594 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5595 returns non-NULL, this field will contain the tree returned by
5596 the last callback. */
5597 tree callback_result;
5599 /* Indicates whether the operand being examined may be replaced
5600 with something that matches is_gimple_val (if true) or something
5601 slightly more complicated (if false). "Something" technically
5602 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5603 but we never try to form anything more complicated than that, so
5604 we don't bother checking.
5606 Also note that CALLBACK should update this flag while walking the
5607 sub-expressions of a statement. For instance, when walking the
5608 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5609 to true, however, when walking &var, the operand of that
5610 ADDR_EXPR does not need to be a GIMPLE value. */
5611 BOOL_BITFIELD val_only : 1;
5613 /* True if we are currently walking the LHS of an assignment. */
5614 BOOL_BITFIELD is_lhs : 1;
5616 /* Optional. Set to true by the callback functions if they made any
5617 changes. */
5618 BOOL_BITFIELD changed : 1;
5620 /* True if we're interested in location information. */
5621 BOOL_BITFIELD want_locations : 1;
5623 /* True if we've removed the statement that was processed. */
5624 BOOL_BITFIELD removed_stmt : 1;
5627 /* Callback for walk_gimple_stmt. Called for every statement found
5628 during traversal. The first argument points to the statement to
5629 walk. The second argument is a flag that the callback sets to
5630 'true' if it the callback handled all the operands and
5631 sub-statements of the statement (the default value of this flag is
5632 'false'). The third argument is an anonymous pointer to data
5633 to be used by the callback. */
5634 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5635 struct walk_stmt_info *);
5637 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5638 struct walk_stmt_info *);
5639 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5640 struct walk_stmt_info *);
5641 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5642 struct walk_stmt_info *);
5643 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5645 /* Enum and arrays used for allocation stats. Keep in sync with
5646 gimple.c:gimple_alloc_kind_names. */
5647 enum gimple_alloc_kind
5649 gimple_alloc_kind_assign, /* Assignments. */
5650 gimple_alloc_kind_phi, /* PHI nodes. */
5651 gimple_alloc_kind_cond, /* Conditionals. */
5652 gimple_alloc_kind_rest, /* Everything else. */
5653 gimple_alloc_kind_all
5656 extern int gimple_alloc_counts[];
5657 extern int gimple_alloc_sizes[];
5659 /* Return the allocation kind for a given stmt CODE. */
5660 static inline enum gimple_alloc_kind
5661 gimple_alloc_kind (enum gimple_code code)
5663 switch (code)
5665 case GIMPLE_ASSIGN:
5666 return gimple_alloc_kind_assign;
5667 case GIMPLE_PHI:
5668 return gimple_alloc_kind_phi;
5669 case GIMPLE_COND:
5670 return gimple_alloc_kind_cond;
5671 default:
5672 return gimple_alloc_kind_rest;
5676 extern void dump_gimple_statistics (void);
5678 /* Set the location of all statements in SEQ to LOC. */
5680 static inline void
5681 gimple_seq_set_location (gimple_seq seq, location_t loc)
5683 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5684 gimple_set_location (gsi_stmt (i), loc);
5687 /* Macros for showing usage statistics. */
5688 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5689 ? (x) \
5690 : ((x) < 1024*1024*10 \
5691 ? (x) / 1024 \
5692 : (x) / (1024*1024))))
5694 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5696 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
5698 #endif /* GCC_GIMPLE_H */