re PR c++/19476 (Missed null checking elimination with new)
[official-gcc.git] / gcc / gimple.h
blobe7021a40a057a33c427e76b27e1083e847b9f719
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.h"
31 #include "tree-ssa-alias.h"
32 #include "internal-fn.h"
33 #include "gimple-fold.h"
35 typedef gimple gimple_seq_node;
37 /* For each block, the PHI nodes that need to be rewritten are stored into
38 these vectors. */
39 typedef vec<gimple> gimple_vec;
41 enum gimple_code {
42 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
43 #include "gimple.def"
44 #undef DEFGSCODE
45 LAST_AND_UNUSED_GIMPLE_CODE
48 extern const char *const gimple_code_name[];
49 extern const unsigned char gimple_rhs_class_table[];
51 /* Error out if a gimple tuple is addressed incorrectly. */
52 #if defined ENABLE_GIMPLE_CHECKING
53 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
54 extern void gimple_check_failed (const_gimple, const char *, int, \
55 const char *, enum gimple_code, \
56 enum tree_code) ATTRIBUTE_NORETURN;
58 #define GIMPLE_CHECK(GS, CODE) \
59 do { \
60 const_gimple __gs = (GS); \
61 if (gimple_code (__gs) != (CODE)) \
62 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
63 (CODE), ERROR_MARK); \
64 } while (0)
65 #else /* not ENABLE_GIMPLE_CHECKING */
66 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
67 #define GIMPLE_CHECK(GS, CODE) (void)0
68 #endif
70 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
71 get_gimple_rhs_class. */
72 enum gimple_rhs_class
74 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
75 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
76 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
77 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
78 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
79 name, a _DECL, a _REF, etc. */
82 /* Specific flags for individual GIMPLE statements. These flags are
83 always stored in gimple_statement_base.subcode and they may only be
84 defined for statement codes that do not use sub-codes.
86 Values for the masks can overlap as long as the overlapping values
87 are never used in the same statement class.
89 The maximum mask value that can be defined is 1 << 15 (i.e., each
90 statement code can hold up to 16 bitflags).
92 Keep this list sorted. */
93 enum gf_mask {
94 GF_ASM_INPUT = 1 << 0,
95 GF_ASM_VOLATILE = 1 << 1,
96 GF_CALL_FROM_THUNK = 1 << 0,
97 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
98 GF_CALL_TAILCALL = 1 << 2,
99 GF_CALL_VA_ARG_PACK = 1 << 3,
100 GF_CALL_NOTHROW = 1 << 4,
101 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
102 GF_CALL_INTERNAL = 1 << 6,
103 GF_OMP_PARALLEL_COMBINED = 1 << 0,
104 GF_OMP_FOR_KIND_MASK = 3 << 0,
105 GF_OMP_FOR_KIND_FOR = 0 << 0,
106 GF_OMP_FOR_KIND_SIMD = 1 << 0,
108 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
109 a thread synchronization via some sort of barrier. The exact barrier
110 that would otherwise be emitted is dependent on the OMP statement with
111 which this return is associated. */
112 GF_OMP_RETURN_NOWAIT = 1 << 0,
114 GF_OMP_SECTION_LAST = 1 << 0,
115 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
116 GF_PREDICT_TAKEN = 1 << 15
119 /* Currently, there are only two types of gimple debug stmt. Others are
120 envisioned, for example, to enable the generation of is_stmt notes
121 in line number information, to mark sequence points, etc. This
122 subcode is to be used to tell them apart. */
123 enum gimple_debug_subcode {
124 GIMPLE_DEBUG_BIND = 0,
125 GIMPLE_DEBUG_SOURCE_BIND = 1
128 /* Masks for selecting a pass local flag (PLF) to work on. These
129 masks are used by gimple_set_plf and gimple_plf. */
130 enum plf_mask {
131 GF_PLF_1 = 1 << 0,
132 GF_PLF_2 = 1 << 1
135 /* Iterator object for GIMPLE statement sequences. */
137 struct gimple_stmt_iterator_d
139 /* Sequence node holding the current statement. */
140 gimple_seq_node ptr;
142 /* Sequence and basic block holding the statement. These fields
143 are necessary to handle edge cases such as when statement is
144 added to an empty basic block or when the last statement of a
145 block/sequence is removed. */
146 gimple_seq *seq;
147 basic_block bb;
150 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
151 are for 64 bit hosts. */
153 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
154 /* [ WORD 1 ]
155 Main identifying code for a tuple. */
156 ENUM_BITFIELD(gimple_code) code : 8;
158 /* Nonzero if a warning should not be emitted on this tuple. */
159 unsigned int no_warning : 1;
161 /* Nonzero if this tuple has been visited. Passes are responsible
162 for clearing this bit before using it. */
163 unsigned int visited : 1;
165 /* Nonzero if this tuple represents a non-temporal move. */
166 unsigned int nontemporal_move : 1;
168 /* Pass local flags. These flags are free for any pass to use as
169 they see fit. Passes should not assume that these flags contain
170 any useful value when the pass starts. Any initial state that
171 the pass requires should be set on entry to the pass. See
172 gimple_set_plf and gimple_plf for usage. */
173 unsigned int plf : 2;
175 /* Nonzero if this statement has been modified and needs to have its
176 operands rescanned. */
177 unsigned modified : 1;
179 /* Nonzero if this statement contains volatile operands. */
180 unsigned has_volatile_ops : 1;
182 /* The SUBCODE field can be used for tuple-specific flags for tuples
183 that do not require subcodes. Note that SUBCODE should be at
184 least as wide as tree codes, as several tuples store tree codes
185 in there. */
186 unsigned int subcode : 16;
188 /* UID of this statement. This is used by passes that want to
189 assign IDs to statements. It must be assigned and used by each
190 pass. By default it should be assumed to contain garbage. */
191 unsigned uid;
193 /* [ WORD 2 ]
194 Locus information for debug info. */
195 location_t location;
197 /* Number of operands in this tuple. */
198 unsigned num_ops;
200 /* [ WORD 3 ]
201 Basic block holding this statement. */
202 basic_block bb;
204 /* [ WORD 4-5 ]
205 Linked lists of gimple statements. The next pointers form
206 a NULL terminated list, the prev pointers are a cyclic list.
207 A gimple statement is hence also a double-ended list of
208 statements, with the pointer itself being the first element,
209 and the prev pointer being the last. */
210 gimple next;
211 gimple GTY((skip)) prev;
215 /* Base structure for tuples with operands. */
217 struct GTY(()) gimple_statement_with_ops_base
219 /* [ WORD 1-6 ] */
220 struct gimple_statement_base gsbase;
222 /* [ WORD 7 ]
223 SSA operand vectors. NOTE: It should be possible to
224 amalgamate these vectors with the operand vector OP. However,
225 the SSA operand vectors are organized differently and contain
226 more information (like immediate use chaining). */
227 struct use_optype_d GTY((skip (""))) *use_ops;
231 /* Statements that take register operands. */
233 struct GTY(()) gimple_statement_with_ops
235 /* [ WORD 1-7 ] */
236 struct gimple_statement_with_ops_base opbase;
238 /* [ WORD 8 ]
239 Operand vector. NOTE! This must always be the last field
240 of this structure. In particular, this means that this
241 structure cannot be embedded inside another one. */
242 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
246 /* Base for statements that take both memory and register operands. */
248 struct GTY(()) gimple_statement_with_memory_ops_base
250 /* [ WORD 1-7 ] */
251 struct gimple_statement_with_ops_base opbase;
253 /* [ WORD 8-9 ]
254 Virtual operands for this statement. The GC will pick them
255 up via the ssa_names array. */
256 tree GTY((skip (""))) vdef;
257 tree GTY((skip (""))) vuse;
261 /* Statements that take both memory and register operands. */
263 struct GTY(()) gimple_statement_with_memory_ops
265 /* [ WORD 1-9 ] */
266 struct gimple_statement_with_memory_ops_base membase;
268 /* [ WORD 10 ]
269 Operand vector. NOTE! This must always be the last field
270 of this structure. In particular, this means that this
271 structure cannot be embedded inside another one. */
272 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
276 /* Call statements that take both memory and register operands. */
278 struct GTY(()) gimple_statement_call
280 /* [ WORD 1-9 ] */
281 struct gimple_statement_with_memory_ops_base membase;
283 /* [ WORD 10-13 ] */
284 struct pt_solution call_used;
285 struct pt_solution call_clobbered;
287 /* [ WORD 14 ] */
288 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
289 tree GTY ((tag ("0"))) fntype;
290 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
291 } u;
293 /* [ WORD 15 ]
294 Operand vector. NOTE! This must always be the last field
295 of this structure. In particular, this means that this
296 structure cannot be embedded inside another one. */
297 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
301 /* OpenMP statements (#pragma omp). */
303 struct GTY(()) gimple_statement_omp {
304 /* [ WORD 1-6 ] */
305 struct gimple_statement_base gsbase;
307 /* [ WORD 7 ] */
308 gimple_seq body;
312 /* GIMPLE_BIND */
314 struct GTY(()) gimple_statement_bind {
315 /* [ WORD 1-6 ] */
316 struct gimple_statement_base gsbase;
318 /* [ WORD 7 ]
319 Variables declared in this scope. */
320 tree vars;
322 /* [ WORD 8 ]
323 This is different than the BLOCK field in gimple_statement_base,
324 which is analogous to TREE_BLOCK (i.e., the lexical block holding
325 this statement). This field is the equivalent of BIND_EXPR_BLOCK
326 in tree land (i.e., the lexical scope defined by this bind). See
327 gimple-low.c. */
328 tree block;
330 /* [ WORD 9 ] */
331 gimple_seq body;
335 /* GIMPLE_CATCH */
337 struct GTY(()) gimple_statement_catch {
338 /* [ WORD 1-6 ] */
339 struct gimple_statement_base gsbase;
341 /* [ WORD 7 ] */
342 tree types;
344 /* [ WORD 8 ] */
345 gimple_seq handler;
349 /* GIMPLE_EH_FILTER */
351 struct GTY(()) gimple_statement_eh_filter {
352 /* [ WORD 1-6 ] */
353 struct gimple_statement_base gsbase;
355 /* [ WORD 7 ]
356 Filter types. */
357 tree types;
359 /* [ WORD 8 ]
360 Failure actions. */
361 gimple_seq failure;
364 /* GIMPLE_EH_ELSE */
366 struct GTY(()) gimple_statement_eh_else {
367 /* [ WORD 1-6 ] */
368 struct gimple_statement_base gsbase;
370 /* [ WORD 7,8 ] */
371 gimple_seq n_body, e_body;
374 /* GIMPLE_EH_MUST_NOT_THROW */
376 struct GTY(()) gimple_statement_eh_mnt {
377 /* [ WORD 1-6 ] */
378 struct gimple_statement_base gsbase;
380 /* [ WORD 7 ] Abort function decl. */
381 tree fndecl;
384 /* GIMPLE_PHI */
386 struct GTY(()) gimple_statement_phi {
387 /* [ WORD 1-6 ] */
388 struct gimple_statement_base gsbase;
390 /* [ WORD 7 ] */
391 unsigned capacity;
392 unsigned nargs;
394 /* [ WORD 8 ] */
395 tree result;
397 /* [ WORD 9 ] */
398 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
402 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
404 struct GTY(()) gimple_statement_eh_ctrl
406 /* [ WORD 1-6 ] */
407 struct gimple_statement_base gsbase;
409 /* [ WORD 7 ]
410 Exception region number. */
411 int region;
415 /* GIMPLE_TRY */
417 struct GTY(()) gimple_statement_try {
418 /* [ WORD 1-6 ] */
419 struct gimple_statement_base gsbase;
421 /* [ WORD 7 ]
422 Expression to evaluate. */
423 gimple_seq eval;
425 /* [ WORD 8 ]
426 Cleanup expression. */
427 gimple_seq cleanup;
430 /* Kind of GIMPLE_TRY statements. */
431 enum gimple_try_flags
433 /* A try/catch. */
434 GIMPLE_TRY_CATCH = 1 << 0,
436 /* A try/finally. */
437 GIMPLE_TRY_FINALLY = 1 << 1,
438 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
440 /* Analogous to TRY_CATCH_IS_CLEANUP. */
441 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
444 /* GIMPLE_WITH_CLEANUP_EXPR */
446 struct GTY(()) gimple_statement_wce {
447 /* [ WORD 1-6 ] */
448 struct gimple_statement_base gsbase;
450 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
451 executed if an exception is thrown, not on normal exit of its
452 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
453 in TARGET_EXPRs. */
455 /* [ WORD 7 ]
456 Cleanup expression. */
457 gimple_seq cleanup;
461 /* GIMPLE_ASM */
463 struct GTY(()) gimple_statement_asm
465 /* [ WORD 1-9 ] */
466 struct gimple_statement_with_memory_ops_base membase;
468 /* [ WORD 10 ]
469 __asm__ statement. */
470 const char *string;
472 /* [ WORD 11 ]
473 Number of inputs, outputs, clobbers, labels. */
474 unsigned char ni;
475 unsigned char no;
476 unsigned char nc;
477 unsigned char nl;
479 /* [ WORD 12 ]
480 Operand vector. NOTE! This must always be the last field
481 of this structure. In particular, this means that this
482 structure cannot be embedded inside another one. */
483 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
486 /* GIMPLE_OMP_CRITICAL */
488 struct GTY(()) gimple_statement_omp_critical {
489 /* [ WORD 1-7 ] */
490 struct gimple_statement_omp omp;
492 /* [ WORD 8 ]
493 Critical section name. */
494 tree name;
498 struct GTY(()) gimple_omp_for_iter {
499 /* Condition code. */
500 enum tree_code cond;
502 /* Index variable. */
503 tree index;
505 /* Initial value. */
506 tree initial;
508 /* Final value. */
509 tree final;
511 /* Increment. */
512 tree incr;
515 /* GIMPLE_OMP_FOR */
517 struct GTY(()) gimple_statement_omp_for {
518 /* [ WORD 1-7 ] */
519 struct gimple_statement_omp omp;
521 /* [ WORD 8 ] */
522 tree clauses;
524 /* [ WORD 9 ]
525 Number of elements in iter array. */
526 size_t collapse;
528 /* [ WORD 10 ] */
529 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
531 /* [ WORD 11 ]
532 Pre-body evaluated before the loop body begins. */
533 gimple_seq pre_body;
537 /* GIMPLE_OMP_PARALLEL */
539 struct GTY(()) gimple_statement_omp_parallel {
540 /* [ WORD 1-7 ] */
541 struct gimple_statement_omp omp;
543 /* [ WORD 8 ]
544 Clauses. */
545 tree clauses;
547 /* [ WORD 9 ]
548 Child function holding the body of the parallel region. */
549 tree child_fn;
551 /* [ WORD 10 ]
552 Shared data argument. */
553 tree data_arg;
557 /* GIMPLE_OMP_TASK */
559 struct GTY(()) gimple_statement_omp_task {
560 /* [ WORD 1-10 ] */
561 struct gimple_statement_omp_parallel par;
563 /* [ WORD 11 ]
564 Child function holding firstprivate initialization if needed. */
565 tree copy_fn;
567 /* [ WORD 12-13 ]
568 Size and alignment in bytes of the argument data block. */
569 tree arg_size;
570 tree arg_align;
574 /* GIMPLE_OMP_SECTION */
575 /* Uses struct gimple_statement_omp. */
578 /* GIMPLE_OMP_SECTIONS */
580 struct GTY(()) gimple_statement_omp_sections {
581 /* [ WORD 1-7 ] */
582 struct gimple_statement_omp omp;
584 /* [ WORD 8 ] */
585 tree clauses;
587 /* [ WORD 9 ]
588 The control variable used for deciding which of the sections to
589 execute. */
590 tree control;
593 /* GIMPLE_OMP_CONTINUE.
595 Note: This does not inherit from gimple_statement_omp, because we
596 do not need the body field. */
598 struct GTY(()) gimple_statement_omp_continue {
599 /* [ WORD 1-6 ] */
600 struct gimple_statement_base gsbase;
602 /* [ WORD 7 ] */
603 tree control_def;
605 /* [ WORD 8 ] */
606 tree control_use;
609 /* GIMPLE_OMP_SINGLE */
611 struct GTY(()) gimple_statement_omp_single {
612 /* [ WORD 1-7 ] */
613 struct gimple_statement_omp omp;
615 /* [ WORD 7 ] */
616 tree clauses;
620 /* GIMPLE_OMP_ATOMIC_LOAD.
621 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
622 contains a sequence, which we don't need here. */
624 struct GTY(()) gimple_statement_omp_atomic_load {
625 /* [ WORD 1-6 ] */
626 struct gimple_statement_base gsbase;
628 /* [ WORD 7-8 ] */
629 tree rhs, lhs;
632 /* GIMPLE_OMP_ATOMIC_STORE.
633 See note on GIMPLE_OMP_ATOMIC_LOAD. */
635 struct GTY(()) gimple_statement_omp_atomic_store {
636 /* [ WORD 1-6 ] */
637 struct gimple_statement_base gsbase;
639 /* [ WORD 7 ] */
640 tree val;
643 /* GIMPLE_TRANSACTION. */
645 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
647 /* The __transaction_atomic was declared [[outer]] or it is
648 __transaction_relaxed. */
649 #define GTMA_IS_OUTER (1u << 0)
650 #define GTMA_IS_RELAXED (1u << 1)
651 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
653 /* The transaction is seen to not have an abort. */
654 #define GTMA_HAVE_ABORT (1u << 2)
655 /* The transaction is seen to have loads or stores. */
656 #define GTMA_HAVE_LOAD (1u << 3)
657 #define GTMA_HAVE_STORE (1u << 4)
658 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
659 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
660 /* The transaction WILL enter serial irrevocable mode.
661 An irrevocable block post-dominates the entire transaction, such
662 that all invocations of the transaction will go serial-irrevocable.
663 In such case, we don't bother instrumenting the transaction, and
664 tell the runtime that it should begin the transaction in
665 serial-irrevocable mode. */
666 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
667 /* The transaction contains no instrumentation code whatsover, most
668 likely because it is guaranteed to go irrevocable upon entry. */
669 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
671 struct GTY(()) gimple_statement_transaction
673 /* [ WORD 1-9 ] */
674 struct gimple_statement_with_memory_ops_base gsbase;
676 /* [ WORD 10 ] */
677 gimple_seq body;
679 /* [ WORD 11 ] */
680 tree label;
683 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
684 enum gimple_statement_structure_enum {
685 #include "gsstruct.def"
686 LAST_GSS_ENUM
688 #undef DEFGSSTRUCT
691 /* Define the overall contents of a gimple tuple. It may be any of the
692 structures declared above for various types of tuples. */
694 union GTY ((desc ("gimple_statement_structure (&%h)"),
695 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
696 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
697 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
698 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
699 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
700 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
701 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
702 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
703 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
704 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
705 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
706 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
707 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
708 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
709 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
710 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
711 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
712 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
713 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
714 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
715 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
716 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
717 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
718 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
719 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
720 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
721 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
724 /* Offset in bytes to the location of the operand vector.
725 Zero if there is no operand vector for this tuple structure. */
726 extern size_t const gimple_ops_offset_[];
728 /* Map GIMPLE codes to GSS codes. */
729 extern enum gimple_statement_structure_enum const gss_for_code_[];
731 /* This variable holds the currently expanded gimple statement for purposes
732 of comminucating the profile info to the builtin expanders. */
733 extern gimple currently_expanding_gimple_stmt;
735 gimple gimple_build_return (tree);
737 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
738 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
740 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
742 gimple
743 gimple_build_assign_with_ops (enum tree_code, tree,
744 tree, tree CXX_MEM_STAT_INFO);
745 gimple
746 gimple_build_assign_with_ops (enum tree_code, tree,
747 tree, tree, tree CXX_MEM_STAT_INFO);
749 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
750 #define gimple_build_debug_bind(var,val,stmt) \
751 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
752 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
753 #define gimple_build_debug_source_bind(var,val,stmt) \
754 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
756 gimple gimple_build_call_vec (tree, vec<tree> );
757 gimple gimple_build_call (tree, unsigned, ...);
758 gimple gimple_build_call_valist (tree, unsigned, va_list);
759 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
760 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
761 gimple gimple_build_call_from_tree (tree);
762 gimple gimplify_assign (tree, tree, gimple_seq *);
763 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
764 gimple gimple_build_label (tree label);
765 gimple gimple_build_goto (tree dest);
766 gimple gimple_build_nop (void);
767 gimple gimple_build_bind (tree, gimple_seq, tree);
768 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
769 vec<tree, va_gc> *, vec<tree, va_gc> *,
770 vec<tree, va_gc> *);
771 gimple gimple_build_catch (tree, gimple_seq);
772 gimple gimple_build_eh_filter (tree, gimple_seq);
773 gimple gimple_build_eh_must_not_throw (tree);
774 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
775 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
776 gimple gimple_build_wce (gimple_seq);
777 gimple gimple_build_resx (int);
778 gimple gimple_build_eh_dispatch (int);
779 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
780 gimple gimple_build_switch (tree, tree, vec<tree> );
781 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
782 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
783 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
784 gimple gimple_build_omp_critical (gimple_seq, tree);
785 gimple gimple_build_omp_section (gimple_seq);
786 gimple gimple_build_omp_continue (tree, tree);
787 gimple gimple_build_omp_master (gimple_seq);
788 gimple gimple_build_omp_return (bool);
789 gimple gimple_build_omp_ordered (gimple_seq);
790 gimple gimple_build_omp_sections (gimple_seq, tree);
791 gimple gimple_build_omp_sections_switch (void);
792 gimple gimple_build_omp_single (gimple_seq, tree);
793 gimple gimple_build_cdt (tree, tree);
794 gimple gimple_build_omp_atomic_load (tree, tree);
795 gimple gimple_build_omp_atomic_store (tree);
796 gimple gimple_build_transaction (gimple_seq, tree);
797 gimple gimple_build_predict (enum br_predictor, enum prediction);
798 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
799 void sort_case_labels (vec<tree> );
800 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
801 void gimple_set_body (tree, gimple_seq);
802 gimple_seq gimple_body (tree);
803 bool gimple_has_body_p (tree);
804 gimple_seq gimple_seq_alloc (void);
805 void gimple_seq_free (gimple_seq);
806 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
807 gimple_seq gimple_seq_copy (gimple_seq);
808 bool gimple_call_same_target_p (const_gimple, const_gimple);
809 int gimple_call_flags (const_gimple);
810 int gimple_call_return_flags (const_gimple);
811 int gimple_call_arg_flags (const_gimple, unsigned);
812 void gimple_call_reset_alias_info (gimple);
813 bool gimple_assign_copy_p (gimple);
814 bool gimple_assign_ssa_name_copy_p (gimple);
815 bool gimple_assign_unary_nop_p (gimple);
816 void gimple_set_bb (gimple, basic_block);
817 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
818 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
819 tree, tree, tree);
820 tree gimple_get_lhs (const_gimple);
821 void gimple_set_lhs (gimple, tree);
822 void gimple_replace_lhs (gimple, tree);
823 gimple gimple_copy (gimple);
824 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
825 gimple gimple_build_cond_from_tree (tree, tree, tree);
826 void gimple_cond_set_condition_from_tree (gimple, tree);
827 bool gimple_has_side_effects (const_gimple);
828 bool gimple_could_trap_p (gimple);
829 bool gimple_could_trap_p_1 (gimple, bool, bool);
830 bool gimple_assign_rhs_could_trap_p (gimple);
831 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
832 bool empty_body_p (gimple_seq);
833 unsigned get_gimple_rhs_num_ops (enum tree_code);
834 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
835 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
836 const char *gimple_decl_printable_name (tree, int);
838 /* Returns true iff T is a scalar register variable. */
839 extern bool is_gimple_reg (tree);
840 /* Returns true iff T is any sort of variable. */
841 extern bool is_gimple_variable (tree);
842 /* Returns true iff T is any sort of symbol. */
843 extern bool is_gimple_id (tree);
844 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
845 extern bool is_gimple_min_lval (tree);
846 /* Returns true iff T is something whose address can be taken. */
847 extern bool is_gimple_addressable (tree);
848 /* Returns true iff T is any valid GIMPLE lvalue. */
849 extern bool is_gimple_lvalue (tree);
851 /* Returns true iff T is a GIMPLE address. */
852 bool is_gimple_address (const_tree);
853 /* Returns true iff T is a GIMPLE invariant address. */
854 bool is_gimple_invariant_address (const_tree);
855 /* Returns true iff T is a GIMPLE invariant address at interprocedural
856 level. */
857 bool is_gimple_ip_invariant_address (const_tree);
858 /* Returns true iff T is a valid GIMPLE constant. */
859 bool is_gimple_constant (const_tree);
860 /* Returns true iff T is a GIMPLE restricted function invariant. */
861 extern bool is_gimple_min_invariant (const_tree);
862 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
863 extern bool is_gimple_ip_invariant (const_tree);
864 /* Returns true iff T is a GIMPLE rvalue. */
865 extern bool is_gimple_val (tree);
866 /* Returns true iff T is a GIMPLE asm statement input. */
867 extern bool is_gimple_asm_val (tree);
868 /* Returns true iff T is a valid address operand of a MEM_REF. */
869 bool is_gimple_mem_ref_addr (tree);
871 /* Returns true iff T is a valid if-statement condition. */
872 extern bool is_gimple_condexpr (tree);
874 /* Returns true iff T is a valid call address expression. */
875 extern bool is_gimple_call_addr (tree);
877 /* Return TRUE iff stmt is a call to a built-in function. */
878 extern bool is_gimple_builtin_call (gimple stmt);
880 extern void recalculate_side_effects (tree);
881 extern bool gimple_compare_field_offset (tree, tree);
882 extern tree gimple_register_canonical_type (tree);
883 extern void print_gimple_types_stats (const char *);
884 extern void free_gimple_type_tables (void);
885 extern tree gimple_unsigned_type (tree);
886 extern tree gimple_signed_type (tree);
887 extern alias_set_type gimple_get_alias_set (tree);
888 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
889 bool (*)(gimple, tree, void *),
890 bool (*)(gimple, tree, void *),
891 bool (*)(gimple, tree, void *));
892 extern bool walk_stmt_load_store_ops (gimple, void *,
893 bool (*)(gimple, tree, void *),
894 bool (*)(gimple, tree, void *));
895 extern bool gimple_ior_addresses_taken (bitmap, gimple);
896 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
897 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
898 extern bool gimple_asm_clobbers_memory_p (const_gimple);
899 extern bool useless_type_conversion_p (tree, tree);
900 extern bool types_compatible_p (tree, tree);
902 /* In gimplify.c */
903 extern tree create_tmp_var_raw (tree, const char *);
904 extern tree create_tmp_var_name (const char *);
905 extern tree create_tmp_var (tree, const char *);
906 extern tree create_tmp_reg (tree, const char *);
907 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
908 extern tree get_formal_tmp_var (tree, gimple_seq *);
909 extern void declare_vars (tree, gimple, bool);
910 extern void annotate_all_with_location (gimple_seq, location_t);
912 /* Validation of GIMPLE expressions. Note that these predicates only check
913 the basic form of the expression, they don't recurse to make sure that
914 underlying nodes are also of the right form. */
915 typedef bool (*gimple_predicate)(tree);
918 /* FIXME we should deduce this from the predicate. */
919 enum fallback {
920 fb_none = 0, /* Do not generate a temporary. */
922 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
923 gimplified expression. */
925 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
926 gimplified expression. */
928 fb_mayfail = 4, /* Gimplification may fail. Error issued
929 afterwards. */
930 fb_either= fb_rvalue | fb_lvalue
933 typedef int fallback_t;
935 enum gimplify_status {
936 GS_ERROR = -2, /* Something Bad Seen. */
937 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
938 GS_OK = 0, /* We did something, maybe more to do. */
939 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
942 /* Formal (expression) temporary table handling: multiple occurrences of
943 the same scalar expression are evaluated into the same temporary. */
945 typedef struct gimple_temp_hash_elt
947 tree val; /* Key */
948 tree temp; /* Value */
949 } elt_t;
951 /* Gimplify hashtable helper. */
953 struct gimplify_hasher : typed_free_remove <elt_t>
955 typedef elt_t value_type;
956 typedef elt_t compare_type;
957 static inline hashval_t hash (const value_type *);
958 static inline bool equal (const value_type *, const compare_type *);
961 inline hashval_t
962 gimplify_hasher::hash (const value_type *p)
964 tree t = p->val;
965 return iterative_hash_expr (t, 0);
968 inline bool
969 gimplify_hasher::equal (const value_type *p1, const compare_type *p2)
971 tree t1 = p1->val;
972 tree t2 = p2->val;
973 enum tree_code code = TREE_CODE (t1);
975 if (TREE_CODE (t2) != code
976 || TREE_TYPE (t1) != TREE_TYPE (t2))
977 return false;
979 if (!operand_equal_p (t1, t2, 0))
980 return false;
982 #ifdef ENABLE_CHECKING
983 /* Only allow them to compare equal if they also hash equal; otherwise
984 results are nondeterminate, and we fail bootstrap comparison. */
985 gcc_assert (hash (p1) == hash (p2));
986 #endif
988 return true;
991 struct gimplify_ctx
993 struct gimplify_ctx *prev_context;
995 vec<gimple> bind_expr_stack;
996 tree temps;
997 gimple_seq conditional_cleanups;
998 tree exit_label;
999 tree return_temp;
1001 vec<tree> case_labels;
1002 /* The formal temporary table. Should this be persistent? */
1003 hash_table <gimplify_hasher> temp_htab;
1005 int conditions;
1006 bool save_stack;
1007 bool into_ssa;
1008 bool allow_rhs_cond_expr;
1009 bool in_cleanup_point_expr;
1012 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1013 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1014 fields). */
1015 static inline bool
1016 is_gimple_sizepos (tree expr)
1018 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1019 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1020 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1021 function, the gimplifier will want to replace it with a new variable,
1022 but that will cause problems if this type is from outside the function.
1023 It's OK to have that here. */
1024 return (expr == NULL_TREE
1025 || TREE_CONSTANT (expr)
1026 || TREE_CODE (expr) == VAR_DECL
1027 || CONTAINS_PLACEHOLDER_P (expr));
1030 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1031 bool (*) (tree), fallback_t);
1032 extern void gimplify_type_sizes (tree, gimple_seq *);
1033 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1034 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1035 bool, tree);
1036 extern bool gimplify_stmt (tree *, gimple_seq *);
1037 extern gimple gimplify_body (tree, bool);
1038 extern void push_gimplify_context (struct gimplify_ctx *);
1039 extern void pop_gimplify_context (gimple);
1040 extern void gimplify_and_add (tree, gimple_seq *);
1042 /* Miscellaneous helpers. */
1043 extern void gimple_add_tmp_var (tree);
1044 extern gimple gimple_current_bind_expr (void);
1045 extern vec<gimple> gimple_bind_expr_stack (void);
1046 extern tree voidify_wrapper_expr (tree, tree);
1047 extern tree build_and_jump (tree *);
1048 extern tree force_labels_r (tree *, int *, void *);
1049 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1050 gimple_seq *);
1051 struct gimplify_omp_ctx;
1052 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1053 extern tree gimple_boolify (tree);
1054 extern gimple_predicate rhs_predicate_for (tree);
1055 extern tree canonicalize_cond_expr_cond (tree);
1056 extern void dump_decl_set (FILE *, bitmap);
1057 extern bool nonfreeing_call_p (gimple);
1059 /* In omp-low.c. */
1060 extern tree omp_reduction_init (tree, tree);
1062 /* In trans-mem.c. */
1063 extern void diagnose_tm_safe_errors (tree);
1064 extern void compute_transaction_bits (void);
1066 /* In tree-nested.c. */
1067 extern void lower_nested_functions (tree);
1068 extern void insert_field_into_struct (tree, tree);
1070 /* In gimplify.c. */
1071 extern void gimplify_function_tree (tree);
1073 /* In cfgexpand.c. */
1074 extern tree gimple_assign_rhs_to_tree (gimple);
1076 /* In builtins.c */
1077 extern bool validate_gimple_arglist (const_gimple, ...);
1079 /* In tree-ssa-coalesce.c */
1080 extern bool gimple_can_coalesce_p (tree, tree);
1082 /* Return the first node in GIMPLE sequence S. */
1084 static inline gimple_seq_node
1085 gimple_seq_first (gimple_seq s)
1087 return s;
1091 /* Return the first statement in GIMPLE sequence S. */
1093 static inline gimple
1094 gimple_seq_first_stmt (gimple_seq s)
1096 gimple_seq_node n = gimple_seq_first (s);
1097 return n;
1101 /* Return the last node in GIMPLE sequence S. */
1103 static inline gimple_seq_node
1104 gimple_seq_last (gimple_seq s)
1106 return s ? s->gsbase.prev : NULL;
1110 /* Return the last statement in GIMPLE sequence S. */
1112 static inline gimple
1113 gimple_seq_last_stmt (gimple_seq s)
1115 gimple_seq_node n = gimple_seq_last (s);
1116 return n;
1120 /* Set the last node in GIMPLE sequence *PS to LAST. */
1122 static inline void
1123 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1125 (*ps)->gsbase.prev = last;
1129 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1131 static inline void
1132 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1134 *ps = first;
1138 /* Return true if GIMPLE sequence S is empty. */
1140 static inline bool
1141 gimple_seq_empty_p (gimple_seq s)
1143 return s == NULL;
1146 void gimple_seq_add_stmt (gimple_seq *, gimple);
1148 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1149 *SEQ_P is NULL, a new sequence is allocated. This function is
1150 similar to gimple_seq_add_stmt, but does not scan the operands.
1151 During gimplification, we need to manipulate statement sequences
1152 before the def/use vectors have been constructed. */
1153 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1155 /* Allocate a new sequence and initialize its first element with STMT. */
1157 static inline gimple_seq
1158 gimple_seq_alloc_with_stmt (gimple stmt)
1160 gimple_seq seq = NULL;
1161 gimple_seq_add_stmt (&seq, stmt);
1162 return seq;
1166 /* Returns the sequence of statements in BB. */
1168 static inline gimple_seq
1169 bb_seq (const_basic_block bb)
1171 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1174 static inline gimple_seq *
1175 bb_seq_addr (basic_block bb)
1177 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1180 /* Sets the sequence of statements in BB to SEQ. */
1182 static inline void
1183 set_bb_seq (basic_block bb, gimple_seq seq)
1185 gcc_checking_assert (!(bb->flags & BB_RTL));
1186 bb->il.gimple.seq = seq;
1190 /* Return the code for GIMPLE statement G. */
1192 static inline enum gimple_code
1193 gimple_code (const_gimple g)
1195 return g->gsbase.code;
1199 /* Return the GSS code used by a GIMPLE code. */
1201 static inline enum gimple_statement_structure_enum
1202 gss_for_code (enum gimple_code code)
1204 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1205 return gss_for_code_[code];
1209 /* Return which GSS code is used by GS. */
1211 static inline enum gimple_statement_structure_enum
1212 gimple_statement_structure (gimple gs)
1214 return gss_for_code (gimple_code (gs));
1218 /* Return true if statement G has sub-statements. This is only true for
1219 High GIMPLE statements. */
1221 static inline bool
1222 gimple_has_substatements (gimple g)
1224 switch (gimple_code (g))
1226 case GIMPLE_BIND:
1227 case GIMPLE_CATCH:
1228 case GIMPLE_EH_FILTER:
1229 case GIMPLE_EH_ELSE:
1230 case GIMPLE_TRY:
1231 case GIMPLE_OMP_FOR:
1232 case GIMPLE_OMP_MASTER:
1233 case GIMPLE_OMP_ORDERED:
1234 case GIMPLE_OMP_SECTION:
1235 case GIMPLE_OMP_PARALLEL:
1236 case GIMPLE_OMP_TASK:
1237 case GIMPLE_OMP_SECTIONS:
1238 case GIMPLE_OMP_SINGLE:
1239 case GIMPLE_OMP_CRITICAL:
1240 case GIMPLE_WITH_CLEANUP_EXPR:
1241 case GIMPLE_TRANSACTION:
1242 return true;
1244 default:
1245 return false;
1250 /* Return the basic block holding statement G. */
1252 static inline basic_block
1253 gimple_bb (const_gimple g)
1255 return g->gsbase.bb;
1259 /* Return the lexical scope block holding statement G. */
1261 static inline tree
1262 gimple_block (const_gimple g)
1264 return LOCATION_BLOCK (g->gsbase.location);
1268 /* Set BLOCK to be the lexical scope block holding statement G. */
1270 static inline void
1271 gimple_set_block (gimple g, tree block)
1273 if (block)
1274 g->gsbase.location =
1275 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1276 else
1277 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1281 /* Return location information for statement G. */
1283 static inline location_t
1284 gimple_location (const_gimple g)
1286 return g->gsbase.location;
1289 /* Return pointer to location information for statement G. */
1291 static inline const location_t *
1292 gimple_location_ptr (const_gimple g)
1294 return &g->gsbase.location;
1298 /* Set location information for statement G. */
1300 static inline void
1301 gimple_set_location (gimple g, location_t location)
1303 g->gsbase.location = location;
1307 /* Return true if G contains location information. */
1309 static inline bool
1310 gimple_has_location (const_gimple g)
1312 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1316 /* Return the file name of the location of STMT. */
1318 static inline const char *
1319 gimple_filename (const_gimple stmt)
1321 return LOCATION_FILE (gimple_location (stmt));
1325 /* Return the line number of the location of STMT. */
1327 static inline int
1328 gimple_lineno (const_gimple stmt)
1330 return LOCATION_LINE (gimple_location (stmt));
1334 /* Determine whether SEQ is a singleton. */
1336 static inline bool
1337 gimple_seq_singleton_p (gimple_seq seq)
1339 return ((gimple_seq_first (seq) != NULL)
1340 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1343 /* Return true if no warnings should be emitted for statement STMT. */
1345 static inline bool
1346 gimple_no_warning_p (const_gimple stmt)
1348 return stmt->gsbase.no_warning;
1351 /* Set the no_warning flag of STMT to NO_WARNING. */
1353 static inline void
1354 gimple_set_no_warning (gimple stmt, bool no_warning)
1356 stmt->gsbase.no_warning = (unsigned) no_warning;
1359 /* Set the visited status on statement STMT to VISITED_P. */
1361 static inline void
1362 gimple_set_visited (gimple stmt, bool visited_p)
1364 stmt->gsbase.visited = (unsigned) visited_p;
1368 /* Return the visited status for statement STMT. */
1370 static inline bool
1371 gimple_visited_p (gimple stmt)
1373 return stmt->gsbase.visited;
1377 /* Set pass local flag PLF on statement STMT to VAL_P. */
1379 static inline void
1380 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1382 if (val_p)
1383 stmt->gsbase.plf |= (unsigned int) plf;
1384 else
1385 stmt->gsbase.plf &= ~((unsigned int) plf);
1389 /* Return the value of pass local flag PLF on statement STMT. */
1391 static inline unsigned int
1392 gimple_plf (gimple stmt, enum plf_mask plf)
1394 return stmt->gsbase.plf & ((unsigned int) plf);
1398 /* Set the UID of statement. */
1400 static inline void
1401 gimple_set_uid (gimple g, unsigned uid)
1403 g->gsbase.uid = uid;
1407 /* Return the UID of statement. */
1409 static inline unsigned
1410 gimple_uid (const_gimple g)
1412 return g->gsbase.uid;
1416 /* Make statement G a singleton sequence. */
1418 static inline void
1419 gimple_init_singleton (gimple g)
1421 g->gsbase.next = NULL;
1422 g->gsbase.prev = g;
1426 /* Return true if GIMPLE statement G has register or memory operands. */
1428 static inline bool
1429 gimple_has_ops (const_gimple g)
1431 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1435 /* Return true if GIMPLE statement G has memory operands. */
1437 static inline bool
1438 gimple_has_mem_ops (const_gimple g)
1440 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1444 /* Return the set of USE operands for statement G. */
1446 static inline struct use_optype_d *
1447 gimple_use_ops (const_gimple g)
1449 if (!gimple_has_ops (g))
1450 return NULL;
1451 return g->gsops.opbase.use_ops;
1455 /* Set USE to be the set of USE operands for statement G. */
1457 static inline void
1458 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1460 gcc_gimple_checking_assert (gimple_has_ops (g));
1461 g->gsops.opbase.use_ops = use;
1465 /* Return the single VUSE operand of the statement G. */
1467 static inline tree
1468 gimple_vuse (const_gimple g)
1470 if (!gimple_has_mem_ops (g))
1471 return NULL_TREE;
1472 return g->gsmembase.vuse;
1475 /* Return the single VDEF operand of the statement G. */
1477 static inline tree
1478 gimple_vdef (const_gimple g)
1480 if (!gimple_has_mem_ops (g))
1481 return NULL_TREE;
1482 return g->gsmembase.vdef;
1485 /* Return the single VUSE operand of the statement G. */
1487 static inline tree *
1488 gimple_vuse_ptr (gimple g)
1490 if (!gimple_has_mem_ops (g))
1491 return NULL;
1492 return &g->gsmembase.vuse;
1495 /* Return the single VDEF operand of the statement G. */
1497 static inline tree *
1498 gimple_vdef_ptr (gimple g)
1500 if (!gimple_has_mem_ops (g))
1501 return NULL;
1502 return &g->gsmembase.vdef;
1505 /* Set the single VUSE operand of the statement G. */
1507 static inline void
1508 gimple_set_vuse (gimple g, tree vuse)
1510 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1511 g->gsmembase.vuse = vuse;
1514 /* Set the single VDEF operand of the statement G. */
1516 static inline void
1517 gimple_set_vdef (gimple g, tree vdef)
1519 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1520 g->gsmembase.vdef = vdef;
1524 /* Return true if statement G has operands and the modified field has
1525 been set. */
1527 static inline bool
1528 gimple_modified_p (const_gimple g)
1530 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1534 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1535 a MODIFIED field. */
1537 static inline void
1538 gimple_set_modified (gimple s, bool modifiedp)
1540 if (gimple_has_ops (s))
1541 s->gsbase.modified = (unsigned) modifiedp;
1545 /* Return the tree code for the expression computed by STMT. This is
1546 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1547 GIMPLE_CALL, return CALL_EXPR as the expression code for
1548 consistency. This is useful when the caller needs to deal with the
1549 three kinds of computation that GIMPLE supports. */
1551 static inline enum tree_code
1552 gimple_expr_code (const_gimple stmt)
1554 enum gimple_code code = gimple_code (stmt);
1555 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1556 return (enum tree_code) stmt->gsbase.subcode;
1557 else
1559 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1560 return CALL_EXPR;
1565 /* Return true if statement STMT contains volatile operands. */
1567 static inline bool
1568 gimple_has_volatile_ops (const_gimple stmt)
1570 if (gimple_has_mem_ops (stmt))
1571 return stmt->gsbase.has_volatile_ops;
1572 else
1573 return false;
1577 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1579 static inline void
1580 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1582 if (gimple_has_mem_ops (stmt))
1583 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1586 /* Return true if BB is in a transaction. */
1588 static inline bool
1589 block_in_transaction (basic_block bb)
1591 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1594 /* Return true if STMT is in a transaction. */
1596 static inline bool
1597 gimple_in_transaction (gimple stmt)
1599 return block_in_transaction (gimple_bb (stmt));
1602 /* Return true if statement STMT may access memory. */
1604 static inline bool
1605 gimple_references_memory_p (gimple stmt)
1607 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1611 /* Return the subcode for OMP statement S. */
1613 static inline unsigned
1614 gimple_omp_subcode (const_gimple s)
1616 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1617 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1618 return s->gsbase.subcode;
1621 /* Set the subcode for OMP statement S to SUBCODE. */
1623 static inline void
1624 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1626 /* We only have 16 bits for the subcode. Assert that we are not
1627 overflowing it. */
1628 gcc_gimple_checking_assert (subcode < (1 << 16));
1629 s->gsbase.subcode = subcode;
1632 /* Set the nowait flag on OMP_RETURN statement S. */
1634 static inline void
1635 gimple_omp_return_set_nowait (gimple s)
1637 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1638 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1642 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1643 flag set. */
1645 static inline bool
1646 gimple_omp_return_nowait_p (const_gimple g)
1648 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1649 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1653 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1654 flag set. */
1656 static inline bool
1657 gimple_omp_section_last_p (const_gimple g)
1659 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1660 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1664 /* Set the GF_OMP_SECTION_LAST flag on G. */
1666 static inline void
1667 gimple_omp_section_set_last (gimple g)
1669 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1670 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1674 /* Return true if OMP parallel statement G has the
1675 GF_OMP_PARALLEL_COMBINED flag set. */
1677 static inline bool
1678 gimple_omp_parallel_combined_p (const_gimple g)
1680 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1681 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1685 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1686 value of COMBINED_P. */
1688 static inline void
1689 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1691 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1692 if (combined_p)
1693 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1694 else
1695 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1699 /* Return true if OMP atomic load/store statement G has the
1700 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1702 static inline bool
1703 gimple_omp_atomic_need_value_p (const_gimple g)
1705 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1706 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1707 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1711 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1713 static inline void
1714 gimple_omp_atomic_set_need_value (gimple g)
1716 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1717 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1718 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1722 /* Return the number of operands for statement GS. */
1724 static inline unsigned
1725 gimple_num_ops (const_gimple gs)
1727 return gs->gsbase.num_ops;
1731 /* Set the number of operands for statement GS. */
1733 static inline void
1734 gimple_set_num_ops (gimple gs, unsigned num_ops)
1736 gs->gsbase.num_ops = num_ops;
1740 /* Return the array of operands for statement GS. */
1742 static inline tree *
1743 gimple_ops (gimple gs)
1745 size_t off;
1747 /* All the tuples have their operand vector at the very bottom
1748 of the structure. Note that those structures that do not
1749 have an operand vector have a zero offset. */
1750 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1751 gcc_gimple_checking_assert (off != 0);
1753 return (tree *) ((char *) gs + off);
1757 /* Return operand I for statement GS. */
1759 static inline tree
1760 gimple_op (const_gimple gs, unsigned i)
1762 if (gimple_has_ops (gs))
1764 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1765 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1767 else
1768 return NULL_TREE;
1771 /* Return a pointer to operand I for statement GS. */
1773 static inline tree *
1774 gimple_op_ptr (const_gimple gs, unsigned i)
1776 if (gimple_has_ops (gs))
1778 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1779 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1781 else
1782 return NULL;
1785 /* Set operand I of statement GS to OP. */
1787 static inline void
1788 gimple_set_op (gimple gs, unsigned i, tree op)
1790 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1792 /* Note. It may be tempting to assert that OP matches
1793 is_gimple_operand, but that would be wrong. Different tuples
1794 accept slightly different sets of tree operands. Each caller
1795 should perform its own validation. */
1796 gimple_ops (gs)[i] = op;
1799 /* Return true if GS is a GIMPLE_ASSIGN. */
1801 static inline bool
1802 is_gimple_assign (const_gimple gs)
1804 return gimple_code (gs) == GIMPLE_ASSIGN;
1807 /* Determine if expression CODE is one of the valid expressions that can
1808 be used on the RHS of GIMPLE assignments. */
1810 static inline enum gimple_rhs_class
1811 get_gimple_rhs_class (enum tree_code code)
1813 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1816 /* Return the LHS of assignment statement GS. */
1818 static inline tree
1819 gimple_assign_lhs (const_gimple gs)
1821 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1822 return gimple_op (gs, 0);
1826 /* Return a pointer to the LHS of assignment statement GS. */
1828 static inline tree *
1829 gimple_assign_lhs_ptr (const_gimple gs)
1831 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1832 return gimple_op_ptr (gs, 0);
1836 /* Set LHS to be the LHS operand of assignment statement GS. */
1838 static inline void
1839 gimple_assign_set_lhs (gimple gs, tree lhs)
1841 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1842 gimple_set_op (gs, 0, lhs);
1844 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1845 SSA_NAME_DEF_STMT (lhs) = gs;
1849 /* Return the first operand on the RHS of assignment statement GS. */
1851 static inline tree
1852 gimple_assign_rhs1 (const_gimple gs)
1854 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1855 return gimple_op (gs, 1);
1859 /* Return a pointer to the first operand on the RHS of assignment
1860 statement GS. */
1862 static inline tree *
1863 gimple_assign_rhs1_ptr (const_gimple gs)
1865 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1866 return gimple_op_ptr (gs, 1);
1869 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1871 static inline void
1872 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1874 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1876 gimple_set_op (gs, 1, rhs);
1880 /* Return the second operand on the RHS of assignment statement GS.
1881 If GS does not have two operands, NULL is returned instead. */
1883 static inline tree
1884 gimple_assign_rhs2 (const_gimple gs)
1886 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1888 if (gimple_num_ops (gs) >= 3)
1889 return gimple_op (gs, 2);
1890 else
1891 return NULL_TREE;
1895 /* Return a pointer to the second operand on the RHS of assignment
1896 statement GS. */
1898 static inline tree *
1899 gimple_assign_rhs2_ptr (const_gimple gs)
1901 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1902 return gimple_op_ptr (gs, 2);
1906 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1908 static inline void
1909 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1911 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1913 gimple_set_op (gs, 2, rhs);
1916 /* Return the third operand on the RHS of assignment statement GS.
1917 If GS does not have two operands, NULL is returned instead. */
1919 static inline tree
1920 gimple_assign_rhs3 (const_gimple gs)
1922 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1924 if (gimple_num_ops (gs) >= 4)
1925 return gimple_op (gs, 3);
1926 else
1927 return NULL_TREE;
1930 /* Return a pointer to the third operand on the RHS of assignment
1931 statement GS. */
1933 static inline tree *
1934 gimple_assign_rhs3_ptr (const_gimple gs)
1936 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1937 return gimple_op_ptr (gs, 3);
1941 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1943 static inline void
1944 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1946 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1948 gimple_set_op (gs, 3, rhs);
1951 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1952 to see only a maximum of two operands. */
1954 static inline void
1955 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1956 tree op1, tree op2)
1958 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1961 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1962 to see only a maximum of two operands. */
1964 static inline void
1965 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1966 tree *op1)
1968 tree op2;
1969 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1970 gcc_assert (op2 == NULL_TREE);
1973 /* Returns true if GS is a nontemporal move. */
1975 static inline bool
1976 gimple_assign_nontemporal_move_p (const_gimple gs)
1978 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1979 return gs->gsbase.nontemporal_move;
1982 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1984 static inline void
1985 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1987 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1988 gs->gsbase.nontemporal_move = nontemporal;
1992 /* Return the code of the expression computed on the rhs of assignment
1993 statement GS. In case that the RHS is a single object, returns the
1994 tree code of the object. */
1996 static inline enum tree_code
1997 gimple_assign_rhs_code (const_gimple gs)
1999 enum tree_code code;
2000 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2002 code = (enum tree_code) gs->gsbase.subcode;
2003 /* While we initially set subcode to the TREE_CODE of the rhs for
2004 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2005 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2006 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2007 code = TREE_CODE (gimple_assign_rhs1 (gs));
2009 return code;
2013 /* Set CODE to be the code for the expression computed on the RHS of
2014 assignment S. */
2016 static inline void
2017 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2019 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2020 s->gsbase.subcode = code;
2024 /* Return the gimple rhs class of the code of the expression computed on
2025 the rhs of assignment statement GS.
2026 This will never return GIMPLE_INVALID_RHS. */
2028 static inline enum gimple_rhs_class
2029 gimple_assign_rhs_class (const_gimple gs)
2031 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2034 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2035 there is no operator associated with the assignment itself.
2036 Unlike gimple_assign_copy_p, this predicate returns true for
2037 any RHS operand, including those that perform an operation
2038 and do not have the semantics of a copy, such as COND_EXPR. */
2040 static inline bool
2041 gimple_assign_single_p (gimple gs)
2043 return (is_gimple_assign (gs)
2044 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2047 /* Return true if GS performs a store to its lhs. */
2049 static inline bool
2050 gimple_store_p (gimple gs)
2052 tree lhs = gimple_get_lhs (gs);
2053 return lhs && !is_gimple_reg (lhs);
2056 /* Return true if GS is an assignment that loads from its rhs1. */
2058 static inline bool
2059 gimple_assign_load_p (gimple gs)
2061 tree rhs;
2062 if (!gimple_assign_single_p (gs))
2063 return false;
2064 rhs = gimple_assign_rhs1 (gs);
2065 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2066 return true;
2067 rhs = get_base_address (rhs);
2068 return (DECL_P (rhs)
2069 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2073 /* Return true if S is a type-cast assignment. */
2075 static inline bool
2076 gimple_assign_cast_p (gimple s)
2078 if (is_gimple_assign (s))
2080 enum tree_code sc = gimple_assign_rhs_code (s);
2081 return CONVERT_EXPR_CODE_P (sc)
2082 || sc == VIEW_CONVERT_EXPR
2083 || sc == FIX_TRUNC_EXPR;
2086 return false;
2089 /* Return true if S is a clobber statement. */
2091 static inline bool
2092 gimple_clobber_p (gimple s)
2094 return gimple_assign_single_p (s)
2095 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2098 /* Return true if GS is a GIMPLE_CALL. */
2100 static inline bool
2101 is_gimple_call (const_gimple gs)
2103 return gimple_code (gs) == GIMPLE_CALL;
2106 /* Return the LHS of call statement GS. */
2108 static inline tree
2109 gimple_call_lhs (const_gimple gs)
2111 GIMPLE_CHECK (gs, GIMPLE_CALL);
2112 return gimple_op (gs, 0);
2116 /* Return a pointer to the LHS of call statement GS. */
2118 static inline tree *
2119 gimple_call_lhs_ptr (const_gimple gs)
2121 GIMPLE_CHECK (gs, GIMPLE_CALL);
2122 return gimple_op_ptr (gs, 0);
2126 /* Set LHS to be the LHS operand of call statement GS. */
2128 static inline void
2129 gimple_call_set_lhs (gimple gs, tree lhs)
2131 GIMPLE_CHECK (gs, GIMPLE_CALL);
2132 gimple_set_op (gs, 0, lhs);
2133 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2134 SSA_NAME_DEF_STMT (lhs) = gs;
2138 /* Return true if call GS calls an internal-only function, as enumerated
2139 by internal_fn. */
2141 static inline bool
2142 gimple_call_internal_p (const_gimple gs)
2144 GIMPLE_CHECK (gs, GIMPLE_CALL);
2145 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2149 /* Return the target of internal call GS. */
2151 static inline enum internal_fn
2152 gimple_call_internal_fn (const_gimple gs)
2154 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2155 return gs->gimple_call.u.internal_fn;
2159 /* Return the function type of the function called by GS. */
2161 static inline tree
2162 gimple_call_fntype (const_gimple gs)
2164 GIMPLE_CHECK (gs, GIMPLE_CALL);
2165 if (gimple_call_internal_p (gs))
2166 return NULL_TREE;
2167 return gs->gimple_call.u.fntype;
2170 /* Set the type of the function called by GS to FNTYPE. */
2172 static inline void
2173 gimple_call_set_fntype (gimple gs, tree fntype)
2175 GIMPLE_CHECK (gs, GIMPLE_CALL);
2176 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2177 gs->gimple_call.u.fntype = fntype;
2181 /* Return the tree node representing the function called by call
2182 statement GS. */
2184 static inline tree
2185 gimple_call_fn (const_gimple gs)
2187 GIMPLE_CHECK (gs, GIMPLE_CALL);
2188 return gimple_op (gs, 1);
2191 /* Return a pointer to the tree node representing the function called by call
2192 statement GS. */
2194 static inline tree *
2195 gimple_call_fn_ptr (const_gimple gs)
2197 GIMPLE_CHECK (gs, GIMPLE_CALL);
2198 return gimple_op_ptr (gs, 1);
2202 /* Set FN to be the function called by call statement GS. */
2204 static inline void
2205 gimple_call_set_fn (gimple gs, tree fn)
2207 GIMPLE_CHECK (gs, GIMPLE_CALL);
2208 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2209 gimple_set_op (gs, 1, fn);
2213 /* Set FNDECL to be the function called by call statement GS. */
2215 static inline void
2216 gimple_call_set_fndecl (gimple gs, tree decl)
2218 GIMPLE_CHECK (gs, GIMPLE_CALL);
2219 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2220 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2224 /* Set internal function FN to be the function called by call statement GS. */
2226 static inline void
2227 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2229 GIMPLE_CHECK (gs, GIMPLE_CALL);
2230 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2231 gs->gimple_call.u.internal_fn = fn;
2235 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2236 associated with the callee if known. Otherwise return NULL_TREE. */
2238 static inline tree
2239 gimple_call_addr_fndecl (const_tree fn)
2241 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2243 tree fndecl = TREE_OPERAND (fn, 0);
2244 if (TREE_CODE (fndecl) == MEM_REF
2245 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2246 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2247 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2248 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2249 return fndecl;
2251 return NULL_TREE;
2254 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2255 Otherwise return NULL. This function is analogous to
2256 get_callee_fndecl in tree land. */
2258 static inline tree
2259 gimple_call_fndecl (const_gimple gs)
2261 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2265 /* Return the type returned by call statement GS. */
2267 static inline tree
2268 gimple_call_return_type (const_gimple gs)
2270 tree type = gimple_call_fntype (gs);
2272 if (type == NULL_TREE)
2273 return TREE_TYPE (gimple_call_lhs (gs));
2275 /* The type returned by a function is the type of its
2276 function type. */
2277 return TREE_TYPE (type);
2281 /* Return the static chain for call statement GS. */
2283 static inline tree
2284 gimple_call_chain (const_gimple gs)
2286 GIMPLE_CHECK (gs, GIMPLE_CALL);
2287 return gimple_op (gs, 2);
2291 /* Return a pointer to the static chain for call statement GS. */
2293 static inline tree *
2294 gimple_call_chain_ptr (const_gimple gs)
2296 GIMPLE_CHECK (gs, GIMPLE_CALL);
2297 return gimple_op_ptr (gs, 2);
2300 /* Set CHAIN to be the static chain for call statement GS. */
2302 static inline void
2303 gimple_call_set_chain (gimple gs, tree chain)
2305 GIMPLE_CHECK (gs, GIMPLE_CALL);
2307 gimple_set_op (gs, 2, chain);
2311 /* Return the number of arguments used by call statement GS. */
2313 static inline unsigned
2314 gimple_call_num_args (const_gimple gs)
2316 unsigned num_ops;
2317 GIMPLE_CHECK (gs, GIMPLE_CALL);
2318 num_ops = gimple_num_ops (gs);
2319 return num_ops - 3;
2323 /* Return the argument at position INDEX for call statement GS. */
2325 static inline tree
2326 gimple_call_arg (const_gimple gs, unsigned index)
2328 GIMPLE_CHECK (gs, GIMPLE_CALL);
2329 return gimple_op (gs, index + 3);
2333 /* Return a pointer to the argument at position INDEX for call
2334 statement GS. */
2336 static inline tree *
2337 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2339 GIMPLE_CHECK (gs, GIMPLE_CALL);
2340 return gimple_op_ptr (gs, index + 3);
2344 /* Set ARG to be the argument at position INDEX for call statement GS. */
2346 static inline void
2347 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2349 GIMPLE_CHECK (gs, GIMPLE_CALL);
2350 gimple_set_op (gs, index + 3, arg);
2354 /* If TAIL_P is true, mark call statement S as being a tail call
2355 (i.e., a call just before the exit of a function). These calls are
2356 candidate for tail call optimization. */
2358 static inline void
2359 gimple_call_set_tail (gimple s, bool tail_p)
2361 GIMPLE_CHECK (s, GIMPLE_CALL);
2362 if (tail_p)
2363 s->gsbase.subcode |= GF_CALL_TAILCALL;
2364 else
2365 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2369 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2371 static inline bool
2372 gimple_call_tail_p (gimple s)
2374 GIMPLE_CHECK (s, GIMPLE_CALL);
2375 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2379 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2380 slot optimization. This transformation uses the target of the call
2381 expansion as the return slot for calls that return in memory. */
2383 static inline void
2384 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2386 GIMPLE_CHECK (s, GIMPLE_CALL);
2387 if (return_slot_opt_p)
2388 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2389 else
2390 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2394 /* Return true if S is marked for return slot optimization. */
2396 static inline bool
2397 gimple_call_return_slot_opt_p (gimple s)
2399 GIMPLE_CHECK (s, GIMPLE_CALL);
2400 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2404 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2405 thunk to the thunked-to function. */
2407 static inline void
2408 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2410 GIMPLE_CHECK (s, GIMPLE_CALL);
2411 if (from_thunk_p)
2412 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2413 else
2414 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2418 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2420 static inline bool
2421 gimple_call_from_thunk_p (gimple s)
2423 GIMPLE_CHECK (s, GIMPLE_CALL);
2424 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2428 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2429 argument pack in its argument list. */
2431 static inline void
2432 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2434 GIMPLE_CHECK (s, GIMPLE_CALL);
2435 if (pass_arg_pack_p)
2436 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2437 else
2438 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2442 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2443 argument pack in its argument list. */
2445 static inline bool
2446 gimple_call_va_arg_pack_p (gimple s)
2448 GIMPLE_CHECK (s, GIMPLE_CALL);
2449 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2453 /* Return true if S is a noreturn call. */
2455 static inline bool
2456 gimple_call_noreturn_p (gimple s)
2458 GIMPLE_CHECK (s, GIMPLE_CALL);
2459 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2463 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2464 even if the called function can throw in other cases. */
2466 static inline void
2467 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2469 GIMPLE_CHECK (s, GIMPLE_CALL);
2470 if (nothrow_p)
2471 s->gsbase.subcode |= GF_CALL_NOTHROW;
2472 else
2473 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2476 /* Return true if S is a nothrow call. */
2478 static inline bool
2479 gimple_call_nothrow_p (gimple s)
2481 GIMPLE_CHECK (s, GIMPLE_CALL);
2482 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2485 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2486 is known to be emitted for VLA objects. Those are wrapped by
2487 stack_save/stack_restore calls and hence can't lead to unbounded
2488 stack growth even when they occur in loops. */
2490 static inline void
2491 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2493 GIMPLE_CHECK (s, GIMPLE_CALL);
2494 if (for_var)
2495 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2496 else
2497 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2500 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2502 static inline bool
2503 gimple_call_alloca_for_var_p (gimple s)
2505 GIMPLE_CHECK (s, GIMPLE_CALL);
2506 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2509 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2511 static inline void
2512 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2514 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2515 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2516 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2520 /* Return a pointer to the points-to solution for the set of call-used
2521 variables of the call CALL. */
2523 static inline struct pt_solution *
2524 gimple_call_use_set (gimple call)
2526 GIMPLE_CHECK (call, GIMPLE_CALL);
2527 return &call->gimple_call.call_used;
2531 /* Return a pointer to the points-to solution for the set of call-used
2532 variables of the call CALL. */
2534 static inline struct pt_solution *
2535 gimple_call_clobber_set (gimple call)
2537 GIMPLE_CHECK (call, GIMPLE_CALL);
2538 return &call->gimple_call.call_clobbered;
2542 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2543 non-NULL lhs. */
2545 static inline bool
2546 gimple_has_lhs (gimple stmt)
2548 return (is_gimple_assign (stmt)
2549 || (is_gimple_call (stmt)
2550 && gimple_call_lhs (stmt) != NULL_TREE));
2554 /* Return the code of the predicate computed by conditional statement GS. */
2556 static inline enum tree_code
2557 gimple_cond_code (const_gimple gs)
2559 GIMPLE_CHECK (gs, GIMPLE_COND);
2560 return (enum tree_code) gs->gsbase.subcode;
2564 /* Set CODE to be the predicate code for the conditional statement GS. */
2566 static inline void
2567 gimple_cond_set_code (gimple gs, enum tree_code code)
2569 GIMPLE_CHECK (gs, GIMPLE_COND);
2570 gs->gsbase.subcode = code;
2574 /* Return the LHS of the predicate computed by conditional statement GS. */
2576 static inline tree
2577 gimple_cond_lhs (const_gimple gs)
2579 GIMPLE_CHECK (gs, GIMPLE_COND);
2580 return gimple_op (gs, 0);
2583 /* Return the pointer to the LHS of the predicate computed by conditional
2584 statement GS. */
2586 static inline tree *
2587 gimple_cond_lhs_ptr (const_gimple gs)
2589 GIMPLE_CHECK (gs, GIMPLE_COND);
2590 return gimple_op_ptr (gs, 0);
2593 /* Set LHS to be the LHS operand of the predicate computed by
2594 conditional statement GS. */
2596 static inline void
2597 gimple_cond_set_lhs (gimple gs, tree lhs)
2599 GIMPLE_CHECK (gs, GIMPLE_COND);
2600 gimple_set_op (gs, 0, lhs);
2604 /* Return the RHS operand of the predicate computed by conditional GS. */
2606 static inline tree
2607 gimple_cond_rhs (const_gimple gs)
2609 GIMPLE_CHECK (gs, GIMPLE_COND);
2610 return gimple_op (gs, 1);
2613 /* Return the pointer to the RHS operand of the predicate computed by
2614 conditional GS. */
2616 static inline tree *
2617 gimple_cond_rhs_ptr (const_gimple gs)
2619 GIMPLE_CHECK (gs, GIMPLE_COND);
2620 return gimple_op_ptr (gs, 1);
2624 /* Set RHS to be the RHS operand of the predicate computed by
2625 conditional statement GS. */
2627 static inline void
2628 gimple_cond_set_rhs (gimple gs, tree rhs)
2630 GIMPLE_CHECK (gs, GIMPLE_COND);
2631 gimple_set_op (gs, 1, rhs);
2635 /* Return the label used by conditional statement GS when its
2636 predicate evaluates to true. */
2638 static inline tree
2639 gimple_cond_true_label (const_gimple gs)
2641 GIMPLE_CHECK (gs, GIMPLE_COND);
2642 return gimple_op (gs, 2);
2646 /* Set LABEL to be the label used by conditional statement GS when its
2647 predicate evaluates to true. */
2649 static inline void
2650 gimple_cond_set_true_label (gimple gs, tree label)
2652 GIMPLE_CHECK (gs, GIMPLE_COND);
2653 gimple_set_op (gs, 2, label);
2657 /* Set LABEL to be the label used by conditional statement GS when its
2658 predicate evaluates to false. */
2660 static inline void
2661 gimple_cond_set_false_label (gimple gs, tree label)
2663 GIMPLE_CHECK (gs, GIMPLE_COND);
2664 gimple_set_op (gs, 3, label);
2668 /* Return the label used by conditional statement GS when its
2669 predicate evaluates to false. */
2671 static inline tree
2672 gimple_cond_false_label (const_gimple gs)
2674 GIMPLE_CHECK (gs, GIMPLE_COND);
2675 return gimple_op (gs, 3);
2679 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2681 static inline void
2682 gimple_cond_make_false (gimple gs)
2684 gimple_cond_set_lhs (gs, boolean_true_node);
2685 gimple_cond_set_rhs (gs, boolean_false_node);
2686 gs->gsbase.subcode = EQ_EXPR;
2690 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2692 static inline void
2693 gimple_cond_make_true (gimple gs)
2695 gimple_cond_set_lhs (gs, boolean_true_node);
2696 gimple_cond_set_rhs (gs, boolean_true_node);
2697 gs->gsbase.subcode = EQ_EXPR;
2700 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2701 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2703 static inline bool
2704 gimple_cond_true_p (const_gimple gs)
2706 tree lhs = gimple_cond_lhs (gs);
2707 tree rhs = gimple_cond_rhs (gs);
2708 enum tree_code code = gimple_cond_code (gs);
2710 if (lhs != boolean_true_node && lhs != boolean_false_node)
2711 return false;
2713 if (rhs != boolean_true_node && rhs != boolean_false_node)
2714 return false;
2716 if (code == NE_EXPR && lhs != rhs)
2717 return true;
2719 if (code == EQ_EXPR && lhs == rhs)
2720 return true;
2722 return false;
2725 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2726 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2728 static inline bool
2729 gimple_cond_false_p (const_gimple gs)
2731 tree lhs = gimple_cond_lhs (gs);
2732 tree rhs = gimple_cond_rhs (gs);
2733 enum tree_code code = gimple_cond_code (gs);
2735 if (lhs != boolean_true_node && lhs != boolean_false_node)
2736 return false;
2738 if (rhs != boolean_true_node && rhs != boolean_false_node)
2739 return false;
2741 if (code == NE_EXPR && lhs == rhs)
2742 return true;
2744 if (code == EQ_EXPR && lhs != rhs)
2745 return true;
2747 return false;
2750 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2752 static inline void
2753 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2755 gimple_cond_set_code (stmt, code);
2756 gimple_cond_set_lhs (stmt, lhs);
2757 gimple_cond_set_rhs (stmt, rhs);
2760 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2762 static inline tree
2763 gimple_label_label (const_gimple gs)
2765 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2766 return gimple_op (gs, 0);
2770 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2771 GS. */
2773 static inline void
2774 gimple_label_set_label (gimple gs, tree label)
2776 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2777 gimple_set_op (gs, 0, label);
2781 /* Return the destination of the unconditional jump GS. */
2783 static inline tree
2784 gimple_goto_dest (const_gimple gs)
2786 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2787 return gimple_op (gs, 0);
2791 /* Set DEST to be the destination of the unconditonal jump GS. */
2793 static inline void
2794 gimple_goto_set_dest (gimple gs, tree dest)
2796 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2797 gimple_set_op (gs, 0, dest);
2801 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2803 static inline tree
2804 gimple_bind_vars (const_gimple gs)
2806 GIMPLE_CHECK (gs, GIMPLE_BIND);
2807 return gs->gimple_bind.vars;
2811 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2812 statement GS. */
2814 static inline void
2815 gimple_bind_set_vars (gimple gs, tree vars)
2817 GIMPLE_CHECK (gs, GIMPLE_BIND);
2818 gs->gimple_bind.vars = vars;
2822 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2823 statement GS. */
2825 static inline void
2826 gimple_bind_append_vars (gimple gs, tree vars)
2828 GIMPLE_CHECK (gs, GIMPLE_BIND);
2829 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2833 static inline gimple_seq *
2834 gimple_bind_body_ptr (gimple gs)
2836 GIMPLE_CHECK (gs, GIMPLE_BIND);
2837 return &gs->gimple_bind.body;
2840 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2842 static inline gimple_seq
2843 gimple_bind_body (gimple gs)
2845 return *gimple_bind_body_ptr (gs);
2849 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2850 statement GS. */
2852 static inline void
2853 gimple_bind_set_body (gimple gs, gimple_seq seq)
2855 GIMPLE_CHECK (gs, GIMPLE_BIND);
2856 gs->gimple_bind.body = seq;
2860 /* Append a statement to the end of a GIMPLE_BIND's body. */
2862 static inline void
2863 gimple_bind_add_stmt (gimple gs, gimple stmt)
2865 GIMPLE_CHECK (gs, GIMPLE_BIND);
2866 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2870 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2872 static inline void
2873 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2875 GIMPLE_CHECK (gs, GIMPLE_BIND);
2876 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2880 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2881 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2883 static inline tree
2884 gimple_bind_block (const_gimple gs)
2886 GIMPLE_CHECK (gs, GIMPLE_BIND);
2887 return gs->gimple_bind.block;
2891 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2892 statement GS. */
2894 static inline void
2895 gimple_bind_set_block (gimple gs, tree block)
2897 GIMPLE_CHECK (gs, GIMPLE_BIND);
2898 gcc_gimple_checking_assert (block == NULL_TREE
2899 || TREE_CODE (block) == BLOCK);
2900 gs->gimple_bind.block = block;
2904 /* Return the number of input operands for GIMPLE_ASM GS. */
2906 static inline unsigned
2907 gimple_asm_ninputs (const_gimple gs)
2909 GIMPLE_CHECK (gs, GIMPLE_ASM);
2910 return gs->gimple_asm.ni;
2914 /* Return the number of output operands for GIMPLE_ASM GS. */
2916 static inline unsigned
2917 gimple_asm_noutputs (const_gimple gs)
2919 GIMPLE_CHECK (gs, GIMPLE_ASM);
2920 return gs->gimple_asm.no;
2924 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2926 static inline unsigned
2927 gimple_asm_nclobbers (const_gimple gs)
2929 GIMPLE_CHECK (gs, GIMPLE_ASM);
2930 return gs->gimple_asm.nc;
2933 /* Return the number of label operands for GIMPLE_ASM GS. */
2935 static inline unsigned
2936 gimple_asm_nlabels (const_gimple gs)
2938 GIMPLE_CHECK (gs, GIMPLE_ASM);
2939 return gs->gimple_asm.nl;
2942 /* Return input operand INDEX of GIMPLE_ASM GS. */
2944 static inline tree
2945 gimple_asm_input_op (const_gimple gs, unsigned index)
2947 GIMPLE_CHECK (gs, GIMPLE_ASM);
2948 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2949 return gimple_op (gs, index + gs->gimple_asm.no);
2952 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2954 static inline tree *
2955 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2957 GIMPLE_CHECK (gs, GIMPLE_ASM);
2958 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2959 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2963 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2965 static inline void
2966 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2968 GIMPLE_CHECK (gs, GIMPLE_ASM);
2969 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2970 && TREE_CODE (in_op) == TREE_LIST);
2971 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2975 /* Return output operand INDEX of GIMPLE_ASM GS. */
2977 static inline tree
2978 gimple_asm_output_op (const_gimple gs, unsigned index)
2980 GIMPLE_CHECK (gs, GIMPLE_ASM);
2981 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
2982 return gimple_op (gs, index);
2985 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2987 static inline tree *
2988 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2990 GIMPLE_CHECK (gs, GIMPLE_ASM);
2991 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
2992 return gimple_op_ptr (gs, index);
2996 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2998 static inline void
2999 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3001 GIMPLE_CHECK (gs, GIMPLE_ASM);
3002 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3003 && TREE_CODE (out_op) == TREE_LIST);
3004 gimple_set_op (gs, index, out_op);
3008 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3010 static inline tree
3011 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3013 GIMPLE_CHECK (gs, GIMPLE_ASM);
3014 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3015 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3019 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3021 static inline void
3022 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3024 GIMPLE_CHECK (gs, GIMPLE_ASM);
3025 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3026 && TREE_CODE (clobber_op) == TREE_LIST);
3027 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3030 /* Return label operand INDEX of GIMPLE_ASM GS. */
3032 static inline tree
3033 gimple_asm_label_op (const_gimple gs, unsigned index)
3035 GIMPLE_CHECK (gs, GIMPLE_ASM);
3036 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3037 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3040 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3042 static inline void
3043 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3045 GIMPLE_CHECK (gs, GIMPLE_ASM);
3046 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3047 && TREE_CODE (label_op) == TREE_LIST);
3048 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3051 /* Return the string representing the assembly instruction in
3052 GIMPLE_ASM GS. */
3054 static inline const char *
3055 gimple_asm_string (const_gimple gs)
3057 GIMPLE_CHECK (gs, GIMPLE_ASM);
3058 return gs->gimple_asm.string;
3062 /* Return true if GS is an asm statement marked volatile. */
3064 static inline bool
3065 gimple_asm_volatile_p (const_gimple gs)
3067 GIMPLE_CHECK (gs, GIMPLE_ASM);
3068 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3072 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3074 static inline void
3075 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3077 GIMPLE_CHECK (gs, GIMPLE_ASM);
3078 if (volatile_p)
3079 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3080 else
3081 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3085 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3087 static inline void
3088 gimple_asm_set_input (gimple gs, bool input_p)
3090 GIMPLE_CHECK (gs, GIMPLE_ASM);
3091 if (input_p)
3092 gs->gsbase.subcode |= GF_ASM_INPUT;
3093 else
3094 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3098 /* Return true if asm GS is an ASM_INPUT. */
3100 static inline bool
3101 gimple_asm_input_p (const_gimple gs)
3103 GIMPLE_CHECK (gs, GIMPLE_ASM);
3104 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3108 /* Return the types handled by GIMPLE_CATCH statement GS. */
3110 static inline tree
3111 gimple_catch_types (const_gimple gs)
3113 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3114 return gs->gimple_catch.types;
3118 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3120 static inline tree *
3121 gimple_catch_types_ptr (gimple gs)
3123 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3124 return &gs->gimple_catch.types;
3128 /* Return a pointer to the GIMPLE sequence representing the body of
3129 the handler of GIMPLE_CATCH statement GS. */
3131 static inline gimple_seq *
3132 gimple_catch_handler_ptr (gimple gs)
3134 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3135 return &gs->gimple_catch.handler;
3139 /* Return the GIMPLE sequence representing the body of the handler of
3140 GIMPLE_CATCH statement GS. */
3142 static inline gimple_seq
3143 gimple_catch_handler (gimple gs)
3145 return *gimple_catch_handler_ptr (gs);
3149 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3151 static inline void
3152 gimple_catch_set_types (gimple gs, tree t)
3154 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3155 gs->gimple_catch.types = t;
3159 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3161 static inline void
3162 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3164 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3165 gs->gimple_catch.handler = handler;
3169 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3171 static inline tree
3172 gimple_eh_filter_types (const_gimple gs)
3174 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3175 return gs->gimple_eh_filter.types;
3179 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3180 GS. */
3182 static inline tree *
3183 gimple_eh_filter_types_ptr (gimple gs)
3185 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3186 return &gs->gimple_eh_filter.types;
3190 /* Return a pointer to the sequence of statement to execute when
3191 GIMPLE_EH_FILTER statement fails. */
3193 static inline gimple_seq *
3194 gimple_eh_filter_failure_ptr (gimple gs)
3196 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3197 return &gs->gimple_eh_filter.failure;
3201 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3202 statement fails. */
3204 static inline gimple_seq
3205 gimple_eh_filter_failure (gimple gs)
3207 return *gimple_eh_filter_failure_ptr (gs);
3211 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3213 static inline void
3214 gimple_eh_filter_set_types (gimple gs, tree types)
3216 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3217 gs->gimple_eh_filter.types = types;
3221 /* Set FAILURE to be the sequence of statements to execute on failure
3222 for GIMPLE_EH_FILTER GS. */
3224 static inline void
3225 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3227 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3228 gs->gimple_eh_filter.failure = failure;
3231 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3233 static inline tree
3234 gimple_eh_must_not_throw_fndecl (gimple gs)
3236 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3237 return gs->gimple_eh_mnt.fndecl;
3240 /* Set the function decl to be called by GS to DECL. */
3242 static inline void
3243 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3245 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3246 gs->gimple_eh_mnt.fndecl = decl;
3249 /* GIMPLE_EH_ELSE accessors. */
3251 static inline gimple_seq *
3252 gimple_eh_else_n_body_ptr (gimple gs)
3254 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3255 return &gs->gimple_eh_else.n_body;
3258 static inline gimple_seq
3259 gimple_eh_else_n_body (gimple gs)
3261 return *gimple_eh_else_n_body_ptr (gs);
3264 static inline gimple_seq *
3265 gimple_eh_else_e_body_ptr (gimple gs)
3267 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3268 return &gs->gimple_eh_else.e_body;
3271 static inline gimple_seq
3272 gimple_eh_else_e_body (gimple gs)
3274 return *gimple_eh_else_e_body_ptr (gs);
3277 static inline void
3278 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3280 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3281 gs->gimple_eh_else.n_body = seq;
3284 static inline void
3285 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3287 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3288 gs->gimple_eh_else.e_body = seq;
3291 /* GIMPLE_TRY accessors. */
3293 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3294 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3296 static inline enum gimple_try_flags
3297 gimple_try_kind (const_gimple gs)
3299 GIMPLE_CHECK (gs, GIMPLE_TRY);
3300 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3304 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3306 static inline void
3307 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3309 GIMPLE_CHECK (gs, GIMPLE_TRY);
3310 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3311 || kind == GIMPLE_TRY_FINALLY);
3312 if (gimple_try_kind (gs) != kind)
3313 gs->gsbase.subcode = (unsigned int) kind;
3317 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3319 static inline bool
3320 gimple_try_catch_is_cleanup (const_gimple gs)
3322 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3323 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3327 /* Return a pointer to the sequence of statements used as the
3328 body for GIMPLE_TRY GS. */
3330 static inline gimple_seq *
3331 gimple_try_eval_ptr (gimple gs)
3333 GIMPLE_CHECK (gs, GIMPLE_TRY);
3334 return &gs->gimple_try.eval;
3338 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3340 static inline gimple_seq
3341 gimple_try_eval (gimple gs)
3343 return *gimple_try_eval_ptr (gs);
3347 /* Return a pointer to the sequence of statements used as the cleanup body for
3348 GIMPLE_TRY GS. */
3350 static inline gimple_seq *
3351 gimple_try_cleanup_ptr (gimple gs)
3353 GIMPLE_CHECK (gs, GIMPLE_TRY);
3354 return &gs->gimple_try.cleanup;
3358 /* Return the sequence of statements used as the cleanup body for
3359 GIMPLE_TRY GS. */
3361 static inline gimple_seq
3362 gimple_try_cleanup (gimple gs)
3364 return *gimple_try_cleanup_ptr (gs);
3368 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3370 static inline void
3371 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3373 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3374 if (catch_is_cleanup)
3375 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3376 else
3377 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3381 /* Set EVAL to be the sequence of statements to use as the body for
3382 GIMPLE_TRY GS. */
3384 static inline void
3385 gimple_try_set_eval (gimple gs, gimple_seq eval)
3387 GIMPLE_CHECK (gs, GIMPLE_TRY);
3388 gs->gimple_try.eval = eval;
3392 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3393 body for GIMPLE_TRY GS. */
3395 static inline void
3396 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3398 GIMPLE_CHECK (gs, GIMPLE_TRY);
3399 gs->gimple_try.cleanup = cleanup;
3403 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3405 static inline gimple_seq *
3406 gimple_wce_cleanup_ptr (gimple gs)
3408 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3409 return &gs->gimple_wce.cleanup;
3413 /* Return the cleanup sequence for cleanup statement GS. */
3415 static inline gimple_seq
3416 gimple_wce_cleanup (gimple gs)
3418 return *gimple_wce_cleanup_ptr (gs);
3422 /* Set CLEANUP to be the cleanup sequence for GS. */
3424 static inline void
3425 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3427 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3428 gs->gimple_wce.cleanup = cleanup;
3432 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3434 static inline bool
3435 gimple_wce_cleanup_eh_only (const_gimple gs)
3437 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3438 return gs->gsbase.subcode != 0;
3442 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3444 static inline void
3445 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3447 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3448 gs->gsbase.subcode = (unsigned int) eh_only_p;
3452 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3454 static inline unsigned
3455 gimple_phi_capacity (const_gimple gs)
3457 GIMPLE_CHECK (gs, GIMPLE_PHI);
3458 return gs->gimple_phi.capacity;
3462 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3463 be exactly the number of incoming edges for the basic block holding
3464 GS. */
3466 static inline unsigned
3467 gimple_phi_num_args (const_gimple gs)
3469 GIMPLE_CHECK (gs, GIMPLE_PHI);
3470 return gs->gimple_phi.nargs;
3474 /* Return the SSA name created by GIMPLE_PHI GS. */
3476 static inline tree
3477 gimple_phi_result (const_gimple gs)
3479 GIMPLE_CHECK (gs, GIMPLE_PHI);
3480 return gs->gimple_phi.result;
3483 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3485 static inline tree *
3486 gimple_phi_result_ptr (gimple gs)
3488 GIMPLE_CHECK (gs, GIMPLE_PHI);
3489 return &gs->gimple_phi.result;
3492 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3494 static inline void
3495 gimple_phi_set_result (gimple gs, tree result)
3497 GIMPLE_CHECK (gs, GIMPLE_PHI);
3498 gs->gimple_phi.result = result;
3499 if (result && TREE_CODE (result) == SSA_NAME)
3500 SSA_NAME_DEF_STMT (result) = gs;
3504 /* Return the PHI argument corresponding to incoming edge INDEX for
3505 GIMPLE_PHI GS. */
3507 static inline struct phi_arg_d *
3508 gimple_phi_arg (gimple gs, unsigned index)
3510 GIMPLE_CHECK (gs, GIMPLE_PHI);
3511 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3512 return &(gs->gimple_phi.args[index]);
3515 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3516 for GIMPLE_PHI GS. */
3518 static inline void
3519 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3521 GIMPLE_CHECK (gs, GIMPLE_PHI);
3522 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3523 gs->gimple_phi.args[index] = *phiarg;
3526 /* PHI nodes should contain only ssa_names and invariants. A test
3527 for ssa_name is definitely simpler; don't let invalid contents
3528 slip in in the meantime. */
3530 static inline bool
3531 phi_ssa_name_p (const_tree t)
3533 if (TREE_CODE (t) == SSA_NAME)
3534 return true;
3535 gcc_checking_assert (is_gimple_min_invariant (t));
3536 return false;
3539 /* Return the PHI nodes for basic block BB, or NULL if there are no
3540 PHI nodes. */
3542 static inline gimple_seq
3543 phi_nodes (const_basic_block bb)
3545 gcc_checking_assert (!(bb->flags & BB_RTL));
3546 return bb->il.gimple.phi_nodes;
3549 /* Return a pointer to the PHI nodes for basic block BB. */
3551 static inline gimple_seq *
3552 phi_nodes_ptr (basic_block bb)
3554 gcc_checking_assert (!(bb->flags & BB_RTL));
3555 return &bb->il.gimple.phi_nodes;
3558 /* Return the tree operand for argument I of PHI node GS. */
3560 static inline tree
3561 gimple_phi_arg_def (gimple gs, size_t index)
3563 return gimple_phi_arg (gs, index)->def;
3567 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3569 static inline tree *
3570 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3572 return &gimple_phi_arg (gs, index)->def;
3575 /* Return the edge associated with argument I of phi node GS. */
3577 static inline edge
3578 gimple_phi_arg_edge (gimple gs, size_t i)
3580 return EDGE_PRED (gimple_bb (gs), i);
3583 /* Return the source location of gimple argument I of phi node GS. */
3585 static inline source_location
3586 gimple_phi_arg_location (gimple gs, size_t i)
3588 return gimple_phi_arg (gs, i)->locus;
3591 /* Return the source location of the argument on edge E of phi node GS. */
3593 static inline source_location
3594 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3596 return gimple_phi_arg (gs, e->dest_idx)->locus;
3599 /* Set the source location of gimple argument I of phi node GS to LOC. */
3601 static inline void
3602 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3604 gimple_phi_arg (gs, i)->locus = loc;
3607 /* Return TRUE if argument I of phi node GS has a location record. */
3609 static inline bool
3610 gimple_phi_arg_has_location (gimple gs, size_t i)
3612 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3616 /* Return the region number for GIMPLE_RESX GS. */
3618 static inline int
3619 gimple_resx_region (const_gimple gs)
3621 GIMPLE_CHECK (gs, GIMPLE_RESX);
3622 return gs->gimple_eh_ctrl.region;
3625 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3627 static inline void
3628 gimple_resx_set_region (gimple gs, int region)
3630 GIMPLE_CHECK (gs, GIMPLE_RESX);
3631 gs->gimple_eh_ctrl.region = region;
3634 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3636 static inline int
3637 gimple_eh_dispatch_region (const_gimple gs)
3639 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3640 return gs->gimple_eh_ctrl.region;
3643 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3645 static inline void
3646 gimple_eh_dispatch_set_region (gimple gs, int region)
3648 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3649 gs->gimple_eh_ctrl.region = region;
3652 /* Return the number of labels associated with the switch statement GS. */
3654 static inline unsigned
3655 gimple_switch_num_labels (const_gimple gs)
3657 unsigned num_ops;
3658 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3659 num_ops = gimple_num_ops (gs);
3660 gcc_gimple_checking_assert (num_ops > 1);
3661 return num_ops - 1;
3665 /* Set NLABELS to be the number of labels for the switch statement GS. */
3667 static inline void
3668 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3670 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3671 gimple_set_num_ops (g, nlabels + 1);
3675 /* Return the index variable used by the switch statement GS. */
3677 static inline tree
3678 gimple_switch_index (const_gimple gs)
3680 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3681 return gimple_op (gs, 0);
3685 /* Return a pointer to the index variable for the switch statement GS. */
3687 static inline tree *
3688 gimple_switch_index_ptr (const_gimple gs)
3690 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3691 return gimple_op_ptr (gs, 0);
3695 /* Set INDEX to be the index variable for switch statement GS. */
3697 static inline void
3698 gimple_switch_set_index (gimple gs, tree index)
3700 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3701 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3702 gimple_set_op (gs, 0, index);
3706 /* Return the label numbered INDEX. The default label is 0, followed by any
3707 labels in a switch statement. */
3709 static inline tree
3710 gimple_switch_label (const_gimple gs, unsigned index)
3712 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3713 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3714 return gimple_op (gs, index + 1);
3717 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3719 static inline void
3720 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3722 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3723 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3724 && (label == NULL_TREE
3725 || TREE_CODE (label) == CASE_LABEL_EXPR));
3726 gimple_set_op (gs, index + 1, label);
3729 /* Return the default label for a switch statement. */
3731 static inline tree
3732 gimple_switch_default_label (const_gimple gs)
3734 tree label = gimple_switch_label (gs, 0);
3735 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3736 return label;
3739 /* Set the default label for a switch statement. */
3741 static inline void
3742 gimple_switch_set_default_label (gimple gs, tree label)
3744 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3745 gimple_switch_set_label (gs, 0, label);
3748 /* Return true if GS is a GIMPLE_DEBUG statement. */
3750 static inline bool
3751 is_gimple_debug (const_gimple gs)
3753 return gimple_code (gs) == GIMPLE_DEBUG;
3756 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3758 static inline bool
3759 gimple_debug_bind_p (const_gimple s)
3761 if (is_gimple_debug (s))
3762 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3764 return false;
3767 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3769 static inline tree
3770 gimple_debug_bind_get_var (gimple dbg)
3772 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3773 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3774 return gimple_op (dbg, 0);
3777 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3778 statement. */
3780 static inline tree
3781 gimple_debug_bind_get_value (gimple dbg)
3783 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3784 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3785 return gimple_op (dbg, 1);
3788 /* Return a pointer to the value bound to the variable in a
3789 GIMPLE_DEBUG bind statement. */
3791 static inline tree *
3792 gimple_debug_bind_get_value_ptr (gimple dbg)
3794 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3795 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3796 return gimple_op_ptr (dbg, 1);
3799 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3801 static inline void
3802 gimple_debug_bind_set_var (gimple dbg, tree var)
3804 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3805 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3806 gimple_set_op (dbg, 0, var);
3809 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3810 statement. */
3812 static inline void
3813 gimple_debug_bind_set_value (gimple dbg, tree value)
3815 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3816 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3817 gimple_set_op (dbg, 1, value);
3820 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3821 optimized away. */
3822 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3824 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3825 statement. */
3827 static inline void
3828 gimple_debug_bind_reset_value (gimple dbg)
3830 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3831 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3832 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3835 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3836 value. */
3838 static inline bool
3839 gimple_debug_bind_has_value_p (gimple dbg)
3841 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3842 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3843 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3846 #undef GIMPLE_DEBUG_BIND_NOVALUE
3848 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3850 static inline bool
3851 gimple_debug_source_bind_p (const_gimple s)
3853 if (is_gimple_debug (s))
3854 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3856 return false;
3859 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3861 static inline tree
3862 gimple_debug_source_bind_get_var (gimple dbg)
3864 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3865 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3866 return gimple_op (dbg, 0);
3869 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3870 statement. */
3872 static inline tree
3873 gimple_debug_source_bind_get_value (gimple dbg)
3875 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3876 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3877 return gimple_op (dbg, 1);
3880 /* Return a pointer to the value bound to the variable in a
3881 GIMPLE_DEBUG source bind statement. */
3883 static inline tree *
3884 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3886 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3887 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3888 return gimple_op_ptr (dbg, 1);
3891 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3893 static inline void
3894 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3896 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3897 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3898 gimple_set_op (dbg, 0, var);
3901 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3902 statement. */
3904 static inline void
3905 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3907 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3908 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3909 gimple_set_op (dbg, 1, value);
3912 /* Return a pointer to the body for the OMP statement GS. */
3914 static inline gimple_seq *
3915 gimple_omp_body_ptr (gimple gs)
3917 return &gs->omp.body;
3920 /* Return the body for the OMP statement GS. */
3922 static inline gimple_seq
3923 gimple_omp_body (gimple gs)
3925 return *gimple_omp_body_ptr (gs);
3928 /* Set BODY to be the body for the OMP statement GS. */
3930 static inline void
3931 gimple_omp_set_body (gimple gs, gimple_seq body)
3933 gs->omp.body = body;
3937 /* Return the name associated with OMP_CRITICAL statement GS. */
3939 static inline tree
3940 gimple_omp_critical_name (const_gimple gs)
3942 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3943 return gs->gimple_omp_critical.name;
3947 /* Return a pointer to the name associated with OMP critical statement GS. */
3949 static inline tree *
3950 gimple_omp_critical_name_ptr (gimple gs)
3952 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3953 return &gs->gimple_omp_critical.name;
3957 /* Set NAME to be the name associated with OMP critical statement GS. */
3959 static inline void
3960 gimple_omp_critical_set_name (gimple gs, tree name)
3962 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3963 gs->gimple_omp_critical.name = name;
3967 /* Return the kind of OMP for statemement. */
3969 static inline int
3970 gimple_omp_for_kind (const_gimple g)
3972 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3973 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
3977 /* Set the OMP for kind. */
3979 static inline void
3980 gimple_omp_for_set_kind (gimple g, int kind)
3982 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3983 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_FOR_KIND_MASK)
3984 | (kind & GF_OMP_FOR_KIND_MASK);
3988 /* Return the clauses associated with OMP_FOR GS. */
3990 static inline tree
3991 gimple_omp_for_clauses (const_gimple gs)
3993 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3994 return gs->gimple_omp_for.clauses;
3998 /* Return a pointer to the OMP_FOR GS. */
4000 static inline tree *
4001 gimple_omp_for_clauses_ptr (gimple gs)
4003 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4004 return &gs->gimple_omp_for.clauses;
4008 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4010 static inline void
4011 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4013 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4014 gs->gimple_omp_for.clauses = clauses;
4018 /* Get the collapse count of OMP_FOR GS. */
4020 static inline size_t
4021 gimple_omp_for_collapse (gimple gs)
4023 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4024 return gs->gimple_omp_for.collapse;
4028 /* Return the index variable for OMP_FOR GS. */
4030 static inline tree
4031 gimple_omp_for_index (const_gimple gs, size_t i)
4033 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4034 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4035 return gs->gimple_omp_for.iter[i].index;
4039 /* Return a pointer to the index variable for OMP_FOR GS. */
4041 static inline tree *
4042 gimple_omp_for_index_ptr (gimple gs, size_t i)
4044 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4045 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4046 return &gs->gimple_omp_for.iter[i].index;
4050 /* Set INDEX to be the index variable for OMP_FOR GS. */
4052 static inline void
4053 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4055 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4056 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4057 gs->gimple_omp_for.iter[i].index = index;
4061 /* Return the initial value for OMP_FOR GS. */
4063 static inline tree
4064 gimple_omp_for_initial (const_gimple gs, size_t i)
4066 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4067 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4068 return gs->gimple_omp_for.iter[i].initial;
4072 /* Return a pointer to the initial value for OMP_FOR GS. */
4074 static inline tree *
4075 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4077 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4078 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4079 return &gs->gimple_omp_for.iter[i].initial;
4083 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4085 static inline void
4086 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4088 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4089 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4090 gs->gimple_omp_for.iter[i].initial = initial;
4094 /* Return the final value for OMP_FOR GS. */
4096 static inline tree
4097 gimple_omp_for_final (const_gimple gs, size_t i)
4099 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4100 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4101 return gs->gimple_omp_for.iter[i].final;
4105 /* Return a pointer to the final value for OMP_FOR GS. */
4107 static inline tree *
4108 gimple_omp_for_final_ptr (gimple gs, size_t i)
4110 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4111 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4112 return &gs->gimple_omp_for.iter[i].final;
4116 /* Set FINAL to be the final value for OMP_FOR GS. */
4118 static inline void
4119 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4121 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4122 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4123 gs->gimple_omp_for.iter[i].final = final;
4127 /* Return the increment value for OMP_FOR GS. */
4129 static inline tree
4130 gimple_omp_for_incr (const_gimple gs, size_t i)
4132 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4133 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4134 return gs->gimple_omp_for.iter[i].incr;
4138 /* Return a pointer to the increment value for OMP_FOR GS. */
4140 static inline tree *
4141 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4143 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4144 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4145 return &gs->gimple_omp_for.iter[i].incr;
4149 /* Set INCR to be the increment value for OMP_FOR GS. */
4151 static inline void
4152 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4154 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4155 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4156 gs->gimple_omp_for.iter[i].incr = incr;
4160 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4161 statement GS starts. */
4163 static inline gimple_seq *
4164 gimple_omp_for_pre_body_ptr (gimple gs)
4166 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4167 return &gs->gimple_omp_for.pre_body;
4171 /* Return the sequence of statements to execute before the OMP_FOR
4172 statement GS starts. */
4174 static inline gimple_seq
4175 gimple_omp_for_pre_body (gimple gs)
4177 return *gimple_omp_for_pre_body_ptr (gs);
4181 /* Set PRE_BODY to be the sequence of statements to execute before the
4182 OMP_FOR statement GS starts. */
4184 static inline void
4185 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4187 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4188 gs->gimple_omp_for.pre_body = pre_body;
4192 /* Return the clauses associated with OMP_PARALLEL GS. */
4194 static inline tree
4195 gimple_omp_parallel_clauses (const_gimple gs)
4197 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4198 return gs->gimple_omp_parallel.clauses;
4202 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4204 static inline tree *
4205 gimple_omp_parallel_clauses_ptr (gimple gs)
4207 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4208 return &gs->gimple_omp_parallel.clauses;
4212 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4213 GS. */
4215 static inline void
4216 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4218 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4219 gs->gimple_omp_parallel.clauses = clauses;
4223 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4225 static inline tree
4226 gimple_omp_parallel_child_fn (const_gimple gs)
4228 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4229 return gs->gimple_omp_parallel.child_fn;
4232 /* Return a pointer to the child function used to hold the body of
4233 OMP_PARALLEL GS. */
4235 static inline tree *
4236 gimple_omp_parallel_child_fn_ptr (gimple gs)
4238 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4239 return &gs->gimple_omp_parallel.child_fn;
4243 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4245 static inline void
4246 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4248 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4249 gs->gimple_omp_parallel.child_fn = child_fn;
4253 /* Return the artificial argument used to send variables and values
4254 from the parent to the children threads in OMP_PARALLEL GS. */
4256 static inline tree
4257 gimple_omp_parallel_data_arg (const_gimple gs)
4259 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4260 return gs->gimple_omp_parallel.data_arg;
4264 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4266 static inline tree *
4267 gimple_omp_parallel_data_arg_ptr (gimple gs)
4269 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4270 return &gs->gimple_omp_parallel.data_arg;
4274 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4276 static inline void
4277 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4279 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4280 gs->gimple_omp_parallel.data_arg = data_arg;
4284 /* Return the clauses associated with OMP_TASK GS. */
4286 static inline tree
4287 gimple_omp_task_clauses (const_gimple gs)
4289 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4290 return gs->gimple_omp_parallel.clauses;
4294 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4296 static inline tree *
4297 gimple_omp_task_clauses_ptr (gimple gs)
4299 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4300 return &gs->gimple_omp_parallel.clauses;
4304 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4305 GS. */
4307 static inline void
4308 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4310 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4311 gs->gimple_omp_parallel.clauses = clauses;
4315 /* Return the child function used to hold the body of OMP_TASK GS. */
4317 static inline tree
4318 gimple_omp_task_child_fn (const_gimple gs)
4320 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4321 return gs->gimple_omp_parallel.child_fn;
4324 /* Return a pointer to the child function used to hold the body of
4325 OMP_TASK GS. */
4327 static inline tree *
4328 gimple_omp_task_child_fn_ptr (gimple gs)
4330 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4331 return &gs->gimple_omp_parallel.child_fn;
4335 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4337 static inline void
4338 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4340 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4341 gs->gimple_omp_parallel.child_fn = child_fn;
4345 /* Return the artificial argument used to send variables and values
4346 from the parent to the children threads in OMP_TASK GS. */
4348 static inline tree
4349 gimple_omp_task_data_arg (const_gimple gs)
4351 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4352 return gs->gimple_omp_parallel.data_arg;
4356 /* Return a pointer to the data argument for OMP_TASK GS. */
4358 static inline tree *
4359 gimple_omp_task_data_arg_ptr (gimple gs)
4361 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4362 return &gs->gimple_omp_parallel.data_arg;
4366 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4368 static inline void
4369 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4371 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4372 gs->gimple_omp_parallel.data_arg = data_arg;
4376 /* Return the clauses associated with OMP_TASK GS. */
4378 static inline tree
4379 gimple_omp_taskreg_clauses (const_gimple gs)
4381 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4382 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4383 return gs->gimple_omp_parallel.clauses;
4387 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4389 static inline tree *
4390 gimple_omp_taskreg_clauses_ptr (gimple gs)
4392 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4393 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4394 return &gs->gimple_omp_parallel.clauses;
4398 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4399 GS. */
4401 static inline void
4402 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4404 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4405 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4406 gs->gimple_omp_parallel.clauses = clauses;
4410 /* Return the child function used to hold the body of OMP_TASK GS. */
4412 static inline tree
4413 gimple_omp_taskreg_child_fn (const_gimple gs)
4415 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4416 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4417 return gs->gimple_omp_parallel.child_fn;
4420 /* Return a pointer to the child function used to hold the body of
4421 OMP_TASK GS. */
4423 static inline tree *
4424 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4426 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4427 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4428 return &gs->gimple_omp_parallel.child_fn;
4432 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4434 static inline void
4435 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4437 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4438 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4439 gs->gimple_omp_parallel.child_fn = child_fn;
4443 /* Return the artificial argument used to send variables and values
4444 from the parent to the children threads in OMP_TASK GS. */
4446 static inline tree
4447 gimple_omp_taskreg_data_arg (const_gimple gs)
4449 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4450 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4451 return gs->gimple_omp_parallel.data_arg;
4455 /* Return a pointer to the data argument for OMP_TASK GS. */
4457 static inline tree *
4458 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4460 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4461 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4462 return &gs->gimple_omp_parallel.data_arg;
4466 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4468 static inline void
4469 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4471 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4472 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4473 gs->gimple_omp_parallel.data_arg = data_arg;
4477 /* Return the copy function used to hold the body of OMP_TASK GS. */
4479 static inline tree
4480 gimple_omp_task_copy_fn (const_gimple gs)
4482 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4483 return gs->gimple_omp_task.copy_fn;
4486 /* Return a pointer to the copy function used to hold the body of
4487 OMP_TASK GS. */
4489 static inline tree *
4490 gimple_omp_task_copy_fn_ptr (gimple gs)
4492 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4493 return &gs->gimple_omp_task.copy_fn;
4497 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4499 static inline void
4500 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4502 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4503 gs->gimple_omp_task.copy_fn = copy_fn;
4507 /* Return size of the data block in bytes in OMP_TASK GS. */
4509 static inline tree
4510 gimple_omp_task_arg_size (const_gimple gs)
4512 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4513 return gs->gimple_omp_task.arg_size;
4517 /* Return a pointer to the data block size for OMP_TASK GS. */
4519 static inline tree *
4520 gimple_omp_task_arg_size_ptr (gimple gs)
4522 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4523 return &gs->gimple_omp_task.arg_size;
4527 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4529 static inline void
4530 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4532 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4533 gs->gimple_omp_task.arg_size = arg_size;
4537 /* Return align of the data block in bytes in OMP_TASK GS. */
4539 static inline tree
4540 gimple_omp_task_arg_align (const_gimple gs)
4542 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4543 return gs->gimple_omp_task.arg_align;
4547 /* Return a pointer to the data block align for OMP_TASK GS. */
4549 static inline tree *
4550 gimple_omp_task_arg_align_ptr (gimple gs)
4552 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4553 return &gs->gimple_omp_task.arg_align;
4557 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4559 static inline void
4560 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4562 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4563 gs->gimple_omp_task.arg_align = arg_align;
4567 /* Return the clauses associated with OMP_SINGLE GS. */
4569 static inline tree
4570 gimple_omp_single_clauses (const_gimple gs)
4572 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4573 return gs->gimple_omp_single.clauses;
4577 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4579 static inline tree *
4580 gimple_omp_single_clauses_ptr (gimple gs)
4582 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4583 return &gs->gimple_omp_single.clauses;
4587 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4589 static inline void
4590 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4592 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4593 gs->gimple_omp_single.clauses = clauses;
4597 /* Return the clauses associated with OMP_SECTIONS GS. */
4599 static inline tree
4600 gimple_omp_sections_clauses (const_gimple gs)
4602 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4603 return gs->gimple_omp_sections.clauses;
4607 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4609 static inline tree *
4610 gimple_omp_sections_clauses_ptr (gimple gs)
4612 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4613 return &gs->gimple_omp_sections.clauses;
4617 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4618 GS. */
4620 static inline void
4621 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4623 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4624 gs->gimple_omp_sections.clauses = clauses;
4628 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4629 in GS. */
4631 static inline tree
4632 gimple_omp_sections_control (const_gimple gs)
4634 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4635 return gs->gimple_omp_sections.control;
4639 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4640 GS. */
4642 static inline tree *
4643 gimple_omp_sections_control_ptr (gimple gs)
4645 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4646 return &gs->gimple_omp_sections.control;
4650 /* Set CONTROL to be the set of clauses associated with the
4651 GIMPLE_OMP_SECTIONS in GS. */
4653 static inline void
4654 gimple_omp_sections_set_control (gimple gs, tree control)
4656 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4657 gs->gimple_omp_sections.control = control;
4661 /* Set COND to be the condition code for OMP_FOR GS. */
4663 static inline void
4664 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4666 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4667 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4668 && i < gs->gimple_omp_for.collapse);
4669 gs->gimple_omp_for.iter[i].cond = cond;
4673 /* Return the condition code associated with OMP_FOR GS. */
4675 static inline enum tree_code
4676 gimple_omp_for_cond (const_gimple gs, size_t i)
4678 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4679 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4680 return gs->gimple_omp_for.iter[i].cond;
4684 /* Set the value being stored in an atomic store. */
4686 static inline void
4687 gimple_omp_atomic_store_set_val (gimple g, tree val)
4689 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4690 g->gimple_omp_atomic_store.val = val;
4694 /* Return the value being stored in an atomic store. */
4696 static inline tree
4697 gimple_omp_atomic_store_val (const_gimple g)
4699 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4700 return g->gimple_omp_atomic_store.val;
4704 /* Return a pointer to the value being stored in an atomic store. */
4706 static inline tree *
4707 gimple_omp_atomic_store_val_ptr (gimple g)
4709 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4710 return &g->gimple_omp_atomic_store.val;
4714 /* Set the LHS of an atomic load. */
4716 static inline void
4717 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4719 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4720 g->gimple_omp_atomic_load.lhs = lhs;
4724 /* Get the LHS of an atomic load. */
4726 static inline tree
4727 gimple_omp_atomic_load_lhs (const_gimple g)
4729 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4730 return g->gimple_omp_atomic_load.lhs;
4734 /* Return a pointer to the LHS of an atomic load. */
4736 static inline tree *
4737 gimple_omp_atomic_load_lhs_ptr (gimple g)
4739 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4740 return &g->gimple_omp_atomic_load.lhs;
4744 /* Set the RHS of an atomic load. */
4746 static inline void
4747 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4749 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4750 g->gimple_omp_atomic_load.rhs = rhs;
4754 /* Get the RHS of an atomic load. */
4756 static inline tree
4757 gimple_omp_atomic_load_rhs (const_gimple g)
4759 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4760 return g->gimple_omp_atomic_load.rhs;
4764 /* Return a pointer to the RHS of an atomic load. */
4766 static inline tree *
4767 gimple_omp_atomic_load_rhs_ptr (gimple g)
4769 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4770 return &g->gimple_omp_atomic_load.rhs;
4774 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4776 static inline tree
4777 gimple_omp_continue_control_def (const_gimple g)
4779 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4780 return g->gimple_omp_continue.control_def;
4783 /* The same as above, but return the address. */
4785 static inline tree *
4786 gimple_omp_continue_control_def_ptr (gimple g)
4788 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4789 return &g->gimple_omp_continue.control_def;
4792 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4794 static inline void
4795 gimple_omp_continue_set_control_def (gimple g, tree def)
4797 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4798 g->gimple_omp_continue.control_def = def;
4802 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4804 static inline tree
4805 gimple_omp_continue_control_use (const_gimple g)
4807 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4808 return g->gimple_omp_continue.control_use;
4812 /* The same as above, but return the address. */
4814 static inline tree *
4815 gimple_omp_continue_control_use_ptr (gimple g)
4817 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4818 return &g->gimple_omp_continue.control_use;
4822 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4824 static inline void
4825 gimple_omp_continue_set_control_use (gimple g, tree use)
4827 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4828 g->gimple_omp_continue.control_use = use;
4831 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4833 static inline gimple_seq *
4834 gimple_transaction_body_ptr (gimple gs)
4836 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4837 return &gs->gimple_transaction.body;
4840 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4842 static inline gimple_seq
4843 gimple_transaction_body (gimple gs)
4845 return *gimple_transaction_body_ptr (gs);
4848 /* Return the label associated with a GIMPLE_TRANSACTION. */
4850 static inline tree
4851 gimple_transaction_label (const_gimple gs)
4853 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4854 return gs->gimple_transaction.label;
4857 static inline tree *
4858 gimple_transaction_label_ptr (gimple gs)
4860 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4861 return &gs->gimple_transaction.label;
4864 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4866 static inline unsigned int
4867 gimple_transaction_subcode (const_gimple gs)
4869 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4870 return gs->gsbase.subcode;
4873 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4875 static inline void
4876 gimple_transaction_set_body (gimple gs, gimple_seq body)
4878 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4879 gs->gimple_transaction.body = body;
4882 /* Set the label associated with a GIMPLE_TRANSACTION. */
4884 static inline void
4885 gimple_transaction_set_label (gimple gs, tree label)
4887 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4888 gs->gimple_transaction.label = label;
4891 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4893 static inline void
4894 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4896 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4897 gs->gsbase.subcode = subcode;
4901 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4903 static inline tree *
4904 gimple_return_retval_ptr (const_gimple gs)
4906 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4907 return gimple_op_ptr (gs, 0);
4910 /* Return the return value for GIMPLE_RETURN GS. */
4912 static inline tree
4913 gimple_return_retval (const_gimple gs)
4915 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4916 return gimple_op (gs, 0);
4920 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4922 static inline void
4923 gimple_return_set_retval (gimple gs, tree retval)
4925 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4926 gimple_set_op (gs, 0, retval);
4930 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4932 #define CASE_GIMPLE_OMP \
4933 case GIMPLE_OMP_PARALLEL: \
4934 case GIMPLE_OMP_TASK: \
4935 case GIMPLE_OMP_FOR: \
4936 case GIMPLE_OMP_SECTIONS: \
4937 case GIMPLE_OMP_SECTIONS_SWITCH: \
4938 case GIMPLE_OMP_SINGLE: \
4939 case GIMPLE_OMP_SECTION: \
4940 case GIMPLE_OMP_MASTER: \
4941 case GIMPLE_OMP_ORDERED: \
4942 case GIMPLE_OMP_CRITICAL: \
4943 case GIMPLE_OMP_RETURN: \
4944 case GIMPLE_OMP_ATOMIC_LOAD: \
4945 case GIMPLE_OMP_ATOMIC_STORE: \
4946 case GIMPLE_OMP_CONTINUE
4948 static inline bool
4949 is_gimple_omp (const_gimple stmt)
4951 switch (gimple_code (stmt))
4953 CASE_GIMPLE_OMP:
4954 return true;
4955 default:
4956 return false;
4961 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4963 static inline bool
4964 gimple_nop_p (const_gimple g)
4966 return gimple_code (g) == GIMPLE_NOP;
4970 /* Return true if GS is a GIMPLE_RESX. */
4972 static inline bool
4973 is_gimple_resx (const_gimple gs)
4975 return gimple_code (gs) == GIMPLE_RESX;
4978 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4980 static inline enum br_predictor
4981 gimple_predict_predictor (gimple gs)
4983 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4984 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4988 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4990 static inline void
4991 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4993 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4994 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4995 | (unsigned) predictor;
4999 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5001 static inline enum prediction
5002 gimple_predict_outcome (gimple gs)
5004 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5005 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5009 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5011 static inline void
5012 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5014 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5015 if (outcome == TAKEN)
5016 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
5017 else
5018 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
5022 /* Return the type of the main expression computed by STMT. Return
5023 void_type_node if the statement computes nothing. */
5025 static inline tree
5026 gimple_expr_type (const_gimple stmt)
5028 enum gimple_code code = gimple_code (stmt);
5030 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5032 tree type;
5033 /* In general we want to pass out a type that can be substituted
5034 for both the RHS and the LHS types if there is a possibly
5035 useless conversion involved. That means returning the
5036 original RHS type as far as we can reconstruct it. */
5037 if (code == GIMPLE_CALL)
5038 type = gimple_call_return_type (stmt);
5039 else
5040 switch (gimple_assign_rhs_code (stmt))
5042 case POINTER_PLUS_EXPR:
5043 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5044 break;
5046 default:
5047 /* As fallback use the type of the LHS. */
5048 type = TREE_TYPE (gimple_get_lhs (stmt));
5049 break;
5051 return type;
5053 else if (code == GIMPLE_COND)
5054 return boolean_type_node;
5055 else
5056 return void_type_node;
5059 /* Return true if TYPE is a suitable type for a scalar register variable. */
5061 static inline bool
5062 is_gimple_reg_type (tree type)
5064 return !AGGREGATE_TYPE_P (type);
5067 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5069 static inline gimple_stmt_iterator
5070 gsi_start_1 (gimple_seq *seq)
5072 gimple_stmt_iterator i;
5074 i.ptr = gimple_seq_first (*seq);
5075 i.seq = seq;
5076 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5078 return i;
5081 #define gsi_start(x) gsi_start_1 (&(x))
5083 static inline gimple_stmt_iterator
5084 gsi_none (void)
5086 gimple_stmt_iterator i;
5087 i.ptr = NULL;
5088 i.seq = NULL;
5089 i.bb = NULL;
5090 return i;
5093 /* Return a new iterator pointing to the first statement in basic block BB. */
5095 static inline gimple_stmt_iterator
5096 gsi_start_bb (basic_block bb)
5098 gimple_stmt_iterator i;
5099 gimple_seq *seq;
5101 seq = bb_seq_addr (bb);
5102 i.ptr = gimple_seq_first (*seq);
5103 i.seq = seq;
5104 i.bb = bb;
5106 return i;
5110 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5112 static inline gimple_stmt_iterator
5113 gsi_last_1 (gimple_seq *seq)
5115 gimple_stmt_iterator i;
5117 i.ptr = gimple_seq_last (*seq);
5118 i.seq = seq;
5119 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5121 return i;
5124 #define gsi_last(x) gsi_last_1 (&(x))
5126 /* Return a new iterator pointing to the last statement in basic block BB. */
5128 static inline gimple_stmt_iterator
5129 gsi_last_bb (basic_block bb)
5131 gimple_stmt_iterator i;
5132 gimple_seq *seq;
5134 seq = bb_seq_addr (bb);
5135 i.ptr = gimple_seq_last (*seq);
5136 i.seq = seq;
5137 i.bb = bb;
5139 return i;
5143 /* Return true if I is at the end of its sequence. */
5145 static inline bool
5146 gsi_end_p (gimple_stmt_iterator i)
5148 return i.ptr == NULL;
5152 /* Return true if I is one statement before the end of its sequence. */
5154 static inline bool
5155 gsi_one_before_end_p (gimple_stmt_iterator i)
5157 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5161 /* Advance the iterator to the next gimple statement. */
5163 static inline void
5164 gsi_next (gimple_stmt_iterator *i)
5166 i->ptr = i->ptr->gsbase.next;
5169 /* Advance the iterator to the previous gimple statement. */
5171 static inline void
5172 gsi_prev (gimple_stmt_iterator *i)
5174 gimple prev = i->ptr->gsbase.prev;
5175 if (prev->gsbase.next)
5176 i->ptr = prev;
5177 else
5178 i->ptr = NULL;
5181 /* Return the current stmt. */
5183 static inline gimple
5184 gsi_stmt (gimple_stmt_iterator i)
5186 return i.ptr;
5189 /* Return a block statement iterator that points to the first non-label
5190 statement in block BB. */
5192 static inline gimple_stmt_iterator
5193 gsi_after_labels (basic_block bb)
5195 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5197 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5198 gsi_next (&gsi);
5200 return gsi;
5203 /* Advance the iterator to the next non-debug gimple statement. */
5205 static inline void
5206 gsi_next_nondebug (gimple_stmt_iterator *i)
5210 gsi_next (i);
5212 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5215 /* Advance the iterator to the next non-debug gimple statement. */
5217 static inline void
5218 gsi_prev_nondebug (gimple_stmt_iterator *i)
5222 gsi_prev (i);
5224 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5227 /* Return a new iterator pointing to the first non-debug statement in
5228 basic block BB. */
5230 static inline gimple_stmt_iterator
5231 gsi_start_nondebug_bb (basic_block bb)
5233 gimple_stmt_iterator i = gsi_start_bb (bb);
5235 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5236 gsi_next_nondebug (&i);
5238 return i;
5241 /* Return a new iterator pointing to the last non-debug statement in
5242 basic block BB. */
5244 static inline gimple_stmt_iterator
5245 gsi_last_nondebug_bb (basic_block bb)
5247 gimple_stmt_iterator i = gsi_last_bb (bb);
5249 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5250 gsi_prev_nondebug (&i);
5252 return i;
5256 /* Return the basic block associated with this iterator. */
5258 static inline basic_block
5259 gsi_bb (gimple_stmt_iterator i)
5261 return i.bb;
5265 /* Return the sequence associated with this iterator. */
5267 static inline gimple_seq
5268 gsi_seq (gimple_stmt_iterator i)
5270 return *i.seq;
5274 enum gsi_iterator_update
5276 GSI_NEW_STMT, /* Only valid when single statement is added, move
5277 iterator to it. */
5278 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5279 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5280 for linking other statements in the same
5281 direction. */
5284 /* In gimple-iterator.c */
5285 gimple_stmt_iterator gsi_start_phis (basic_block);
5286 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5287 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5288 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5289 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5290 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5291 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5292 enum gsi_iterator_update);
5293 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5294 enum gsi_iterator_update);
5295 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5296 enum gsi_iterator_update);
5297 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5298 enum gsi_iterator_update);
5299 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5300 enum gsi_iterator_update);
5301 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5302 enum gsi_iterator_update);
5303 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5304 enum gsi_iterator_update);
5305 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5306 enum gsi_iterator_update);
5307 bool gsi_remove (gimple_stmt_iterator *, bool);
5308 gimple_stmt_iterator gsi_for_stmt (gimple);
5309 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5310 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5311 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5312 void gsi_insert_on_edge (edge, gimple);
5313 void gsi_insert_seq_on_edge (edge, gimple_seq);
5314 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5315 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5316 void gsi_commit_one_edge_insert (edge, basic_block *);
5317 void gsi_commit_edge_inserts (void);
5318 gimple gimple_call_copy_skip_args (gimple, bitmap);
5321 /* Convenience routines to walk all statements of a gimple function.
5322 Note that this is useful exclusively before the code is converted
5323 into SSA form. Once the program is in SSA form, the standard
5324 operand interface should be used to analyze/modify statements. */
5325 struct walk_stmt_info
5327 /* Points to the current statement being walked. */
5328 gimple_stmt_iterator gsi;
5330 /* Additional data that the callback functions may want to carry
5331 through the recursion. */
5332 void *info;
5334 /* Pointer map used to mark visited tree nodes when calling
5335 walk_tree on each operand. If set to NULL, duplicate tree nodes
5336 will be visited more than once. */
5337 struct pointer_set_t *pset;
5339 /* Operand returned by the callbacks. This is set when calling
5340 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5341 returns non-NULL, this field will contain the tree returned by
5342 the last callback. */
5343 tree callback_result;
5345 /* Indicates whether the operand being examined may be replaced
5346 with something that matches is_gimple_val (if true) or something
5347 slightly more complicated (if false). "Something" technically
5348 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5349 but we never try to form anything more complicated than that, so
5350 we don't bother checking.
5352 Also note that CALLBACK should update this flag while walking the
5353 sub-expressions of a statement. For instance, when walking the
5354 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5355 to true, however, when walking &var, the operand of that
5356 ADDR_EXPR does not need to be a GIMPLE value. */
5357 BOOL_BITFIELD val_only : 1;
5359 /* True if we are currently walking the LHS of an assignment. */
5360 BOOL_BITFIELD is_lhs : 1;
5362 /* Optional. Set to true by the callback functions if they made any
5363 changes. */
5364 BOOL_BITFIELD changed : 1;
5366 /* True if we're interested in location information. */
5367 BOOL_BITFIELD want_locations : 1;
5369 /* True if we've removed the statement that was processed. */
5370 BOOL_BITFIELD removed_stmt : 1;
5373 /* Callback for walk_gimple_stmt. Called for every statement found
5374 during traversal. The first argument points to the statement to
5375 walk. The second argument is a flag that the callback sets to
5376 'true' if it the callback handled all the operands and
5377 sub-statements of the statement (the default value of this flag is
5378 'false'). The third argument is an anonymous pointer to data
5379 to be used by the callback. */
5380 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5381 struct walk_stmt_info *);
5383 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5384 struct walk_stmt_info *);
5385 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5386 struct walk_stmt_info *);
5387 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5388 struct walk_stmt_info *);
5389 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5391 /* Enum and arrays used for allocation stats. Keep in sync with
5392 gimple.c:gimple_alloc_kind_names. */
5393 enum gimple_alloc_kind
5395 gimple_alloc_kind_assign, /* Assignments. */
5396 gimple_alloc_kind_phi, /* PHI nodes. */
5397 gimple_alloc_kind_cond, /* Conditionals. */
5398 gimple_alloc_kind_rest, /* Everything else. */
5399 gimple_alloc_kind_all
5402 extern int gimple_alloc_counts[];
5403 extern int gimple_alloc_sizes[];
5405 /* Return the allocation kind for a given stmt CODE. */
5406 static inline enum gimple_alloc_kind
5407 gimple_alloc_kind (enum gimple_code code)
5409 switch (code)
5411 case GIMPLE_ASSIGN:
5412 return gimple_alloc_kind_assign;
5413 case GIMPLE_PHI:
5414 return gimple_alloc_kind_phi;
5415 case GIMPLE_COND:
5416 return gimple_alloc_kind_cond;
5417 default:
5418 return gimple_alloc_kind_rest;
5422 extern void dump_gimple_statistics (void);
5424 /* Set the location of all statements in SEQ to LOC. */
5426 static inline void
5427 gimple_seq_set_location (gimple_seq seq, location_t loc)
5429 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5430 gimple_set_location (gsi_stmt (i), loc);
5433 #endif /* GCC_GIMPLE_H */