vectorizer cost model enhancement
[official-gcc.git] / gcc / gimple.h
bloba031c8d777c7b3383daa87d23cb5c7c9b61487b3
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-operands.h"
32 #include "tree-ssa-alias.h"
33 #include "internal-fn.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);
837 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
838 tree gimple_extract_devirt_binfo_from_cst (tree, tree);
840 /* Returns true iff T is a scalar register variable. */
841 extern bool is_gimple_reg (tree);
842 /* Returns true iff T is any sort of variable. */
843 extern bool is_gimple_variable (tree);
844 /* Returns true iff T is any sort of symbol. */
845 extern bool is_gimple_id (tree);
846 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
847 extern bool is_gimple_min_lval (tree);
848 /* Returns true iff T is something whose address can be taken. */
849 extern bool is_gimple_addressable (tree);
850 /* Returns true iff T is any valid GIMPLE lvalue. */
851 extern bool is_gimple_lvalue (tree);
853 /* Returns true iff T is a GIMPLE address. */
854 bool is_gimple_address (const_tree);
855 /* Returns true iff T is a GIMPLE invariant address. */
856 bool is_gimple_invariant_address (const_tree);
857 /* Returns true iff T is a GIMPLE invariant address at interprocedural
858 level. */
859 bool is_gimple_ip_invariant_address (const_tree);
860 /* Returns true iff T is a valid GIMPLE constant. */
861 bool is_gimple_constant (const_tree);
862 /* Returns true iff T is a GIMPLE restricted function invariant. */
863 extern bool is_gimple_min_invariant (const_tree);
864 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
865 extern bool is_gimple_ip_invariant (const_tree);
866 /* Returns true iff T is a GIMPLE rvalue. */
867 extern bool is_gimple_val (tree);
868 /* Returns true iff T is a GIMPLE asm statement input. */
869 extern bool is_gimple_asm_val (tree);
870 /* Returns true iff T is a valid address operand of a MEM_REF. */
871 bool is_gimple_mem_ref_addr (tree);
873 /* Returns true iff T is a valid if-statement condition. */
874 extern bool is_gimple_condexpr (tree);
876 /* Returns true iff T is a valid call address expression. */
877 extern bool is_gimple_call_addr (tree);
879 /* Return TRUE iff stmt is a call to a built-in function. */
880 extern bool is_gimple_builtin_call (gimple stmt);
882 extern void recalculate_side_effects (tree);
883 extern bool gimple_compare_field_offset (tree, tree);
884 extern tree gimple_register_canonical_type (tree);
885 extern void print_gimple_types_stats (const char *);
886 extern void free_gimple_type_tables (void);
887 extern tree gimple_unsigned_type (tree);
888 extern tree gimple_signed_type (tree);
889 extern alias_set_type gimple_get_alias_set (tree);
890 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
891 bool (*)(gimple, tree, void *),
892 bool (*)(gimple, tree, void *),
893 bool (*)(gimple, tree, void *));
894 extern bool walk_stmt_load_store_ops (gimple, void *,
895 bool (*)(gimple, tree, void *),
896 bool (*)(gimple, tree, void *));
897 extern bool gimple_ior_addresses_taken (bitmap, gimple);
898 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
899 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
900 extern bool gimple_asm_clobbers_memory_p (const_gimple);
901 extern bool useless_type_conversion_p (tree, tree);
902 extern bool types_compatible_p (tree, tree);
904 /* In gimplify.c */
905 extern tree create_tmp_var_raw (tree, const char *);
906 extern tree create_tmp_var_name (const char *);
907 extern tree create_tmp_var (tree, const char *);
908 extern tree create_tmp_reg (tree, const char *);
909 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
910 extern tree get_formal_tmp_var (tree, gimple_seq *);
911 extern void declare_vars (tree, gimple, bool);
912 extern void annotate_all_with_location (gimple_seq, location_t);
914 /* Validation of GIMPLE expressions. Note that these predicates only check
915 the basic form of the expression, they don't recurse to make sure that
916 underlying nodes are also of the right form. */
917 typedef bool (*gimple_predicate)(tree);
920 /* FIXME we should deduce this from the predicate. */
921 enum fallback {
922 fb_none = 0, /* Do not generate a temporary. */
924 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
925 gimplified expression. */
927 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
928 gimplified expression. */
930 fb_mayfail = 4, /* Gimplification may fail. Error issued
931 afterwards. */
932 fb_either= fb_rvalue | fb_lvalue
935 typedef int fallback_t;
937 enum gimplify_status {
938 GS_ERROR = -2, /* Something Bad Seen. */
939 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
940 GS_OK = 0, /* We did something, maybe more to do. */
941 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
944 /* Formal (expression) temporary table handling: multiple occurrences of
945 the same scalar expression are evaluated into the same temporary. */
947 typedef struct gimple_temp_hash_elt
949 tree val; /* Key */
950 tree temp; /* Value */
951 } elt_t;
953 /* Gimplify hashtable helper. */
955 struct gimplify_hasher : typed_free_remove <elt_t>
957 typedef elt_t value_type;
958 typedef elt_t compare_type;
959 static inline hashval_t hash (const value_type *);
960 static inline bool equal (const value_type *, const compare_type *);
963 inline hashval_t
964 gimplify_hasher::hash (const value_type *p)
966 tree t = p->val;
967 return iterative_hash_expr (t, 0);
970 inline bool
971 gimplify_hasher::equal (const value_type *p1, const compare_type *p2)
973 tree t1 = p1->val;
974 tree t2 = p2->val;
975 enum tree_code code = TREE_CODE (t1);
977 if (TREE_CODE (t2) != code
978 || TREE_TYPE (t1) != TREE_TYPE (t2))
979 return false;
981 if (!operand_equal_p (t1, t2, 0))
982 return false;
984 #ifdef ENABLE_CHECKING
985 /* Only allow them to compare equal if they also hash equal; otherwise
986 results are nondeterminate, and we fail bootstrap comparison. */
987 gcc_assert (hash (p1) == hash (p2));
988 #endif
990 return true;
993 struct gimplify_ctx
995 struct gimplify_ctx *prev_context;
997 vec<gimple> bind_expr_stack;
998 tree temps;
999 gimple_seq conditional_cleanups;
1000 tree exit_label;
1001 tree return_temp;
1003 vec<tree> case_labels;
1004 /* The formal temporary table. Should this be persistent? */
1005 hash_table <gimplify_hasher> temp_htab;
1007 int conditions;
1008 bool save_stack;
1009 bool into_ssa;
1010 bool allow_rhs_cond_expr;
1011 bool in_cleanup_point_expr;
1014 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1015 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1016 fields). */
1017 static inline bool
1018 is_gimple_sizepos (tree expr)
1020 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1021 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1022 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1023 function, the gimplifier will want to replace it with a new variable,
1024 but that will cause problems if this type is from outside the function.
1025 It's OK to have that here. */
1026 return (expr == NULL_TREE
1027 || TREE_CONSTANT (expr)
1028 || TREE_CODE (expr) == VAR_DECL
1029 || CONTAINS_PLACEHOLDER_P (expr));
1032 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1033 bool (*) (tree), fallback_t);
1034 extern void gimplify_type_sizes (tree, gimple_seq *);
1035 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1036 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1037 bool, tree);
1038 extern bool gimplify_stmt (tree *, gimple_seq *);
1039 extern gimple gimplify_body (tree, bool);
1040 extern void push_gimplify_context (struct gimplify_ctx *);
1041 extern void pop_gimplify_context (gimple);
1042 extern void gimplify_and_add (tree, gimple_seq *);
1044 /* Miscellaneous helpers. */
1045 extern void gimple_add_tmp_var (tree);
1046 extern gimple gimple_current_bind_expr (void);
1047 extern vec<gimple> gimple_bind_expr_stack (void);
1048 extern tree voidify_wrapper_expr (tree, tree);
1049 extern tree build_and_jump (tree *);
1050 extern tree force_labels_r (tree *, int *, void *);
1051 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1052 gimple_seq *);
1053 struct gimplify_omp_ctx;
1054 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1055 extern tree gimple_boolify (tree);
1056 extern gimple_predicate rhs_predicate_for (tree);
1057 extern tree canonicalize_cond_expr_cond (tree);
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 set of VUSE operand for statement G. */
1467 static inline use_operand_p
1468 gimple_vuse_op (const_gimple g)
1470 struct use_optype_d *ops;
1471 if (!gimple_has_mem_ops (g))
1472 return NULL_USE_OPERAND_P;
1473 ops = g->gsops.opbase.use_ops;
1474 if (ops
1475 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1476 return USE_OP_PTR (ops);
1477 return NULL_USE_OPERAND_P;
1480 /* Return the set of VDEF operand for statement G. */
1482 static inline def_operand_p
1483 gimple_vdef_op (gimple g)
1485 if (!gimple_has_mem_ops (g))
1486 return NULL_DEF_OPERAND_P;
1487 if (g->gsmembase.vdef)
1488 return &g->gsmembase.vdef;
1489 return NULL_DEF_OPERAND_P;
1493 /* Return the single VUSE operand of the statement G. */
1495 static inline tree
1496 gimple_vuse (const_gimple g)
1498 if (!gimple_has_mem_ops (g))
1499 return NULL_TREE;
1500 return g->gsmembase.vuse;
1503 /* Return the single VDEF operand of the statement G. */
1505 static inline tree
1506 gimple_vdef (const_gimple g)
1508 if (!gimple_has_mem_ops (g))
1509 return NULL_TREE;
1510 return g->gsmembase.vdef;
1513 /* Return the single VUSE operand of the statement G. */
1515 static inline tree *
1516 gimple_vuse_ptr (gimple g)
1518 if (!gimple_has_mem_ops (g))
1519 return NULL;
1520 return &g->gsmembase.vuse;
1523 /* Return the single VDEF operand of the statement G. */
1525 static inline tree *
1526 gimple_vdef_ptr (gimple g)
1528 if (!gimple_has_mem_ops (g))
1529 return NULL;
1530 return &g->gsmembase.vdef;
1533 /* Set the single VUSE operand of the statement G. */
1535 static inline void
1536 gimple_set_vuse (gimple g, tree vuse)
1538 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1539 g->gsmembase.vuse = vuse;
1542 /* Set the single VDEF operand of the statement G. */
1544 static inline void
1545 gimple_set_vdef (gimple g, tree vdef)
1547 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1548 g->gsmembase.vdef = vdef;
1552 /* Return true if statement G has operands and the modified field has
1553 been set. */
1555 static inline bool
1556 gimple_modified_p (const_gimple g)
1558 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1562 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1563 a MODIFIED field. */
1565 static inline void
1566 gimple_set_modified (gimple s, bool modifiedp)
1568 if (gimple_has_ops (s))
1569 s->gsbase.modified = (unsigned) modifiedp;
1573 /* Return the tree code for the expression computed by STMT. This is
1574 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1575 GIMPLE_CALL, return CALL_EXPR as the expression code for
1576 consistency. This is useful when the caller needs to deal with the
1577 three kinds of computation that GIMPLE supports. */
1579 static inline enum tree_code
1580 gimple_expr_code (const_gimple stmt)
1582 enum gimple_code code = gimple_code (stmt);
1583 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1584 return (enum tree_code) stmt->gsbase.subcode;
1585 else
1587 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1588 return CALL_EXPR;
1593 /* Mark statement S as modified, and update it. */
1595 static inline void
1596 update_stmt (gimple s)
1598 if (gimple_has_ops (s))
1600 gimple_set_modified (s, true);
1601 update_stmt_operands (s);
1605 /* Update statement S if it has been optimized. */
1607 static inline void
1608 update_stmt_if_modified (gimple s)
1610 if (gimple_modified_p (s))
1611 update_stmt_operands (s);
1614 /* Return true if statement STMT contains volatile operands. */
1616 static inline bool
1617 gimple_has_volatile_ops (const_gimple stmt)
1619 if (gimple_has_mem_ops (stmt))
1620 return stmt->gsbase.has_volatile_ops;
1621 else
1622 return false;
1626 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1628 static inline void
1629 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1631 if (gimple_has_mem_ops (stmt))
1632 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1635 /* Return true if BB is in a transaction. */
1637 static inline bool
1638 block_in_transaction (basic_block bb)
1640 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1643 /* Return true if STMT is in a transaction. */
1645 static inline bool
1646 gimple_in_transaction (gimple stmt)
1648 return block_in_transaction (gimple_bb (stmt));
1651 /* Return true if statement STMT may access memory. */
1653 static inline bool
1654 gimple_references_memory_p (gimple stmt)
1656 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1660 /* Return the subcode for OMP statement S. */
1662 static inline unsigned
1663 gimple_omp_subcode (const_gimple s)
1665 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1666 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1667 return s->gsbase.subcode;
1670 /* Set the subcode for OMP statement S to SUBCODE. */
1672 static inline void
1673 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1675 /* We only have 16 bits for the subcode. Assert that we are not
1676 overflowing it. */
1677 gcc_gimple_checking_assert (subcode < (1 << 16));
1678 s->gsbase.subcode = subcode;
1681 /* Set the nowait flag on OMP_RETURN statement S. */
1683 static inline void
1684 gimple_omp_return_set_nowait (gimple s)
1686 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1687 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1691 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1692 flag set. */
1694 static inline bool
1695 gimple_omp_return_nowait_p (const_gimple g)
1697 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1698 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1702 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1703 flag set. */
1705 static inline bool
1706 gimple_omp_section_last_p (const_gimple g)
1708 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1709 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1713 /* Set the GF_OMP_SECTION_LAST flag on G. */
1715 static inline void
1716 gimple_omp_section_set_last (gimple g)
1718 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1719 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1723 /* Return true if OMP parallel statement G has the
1724 GF_OMP_PARALLEL_COMBINED flag set. */
1726 static inline bool
1727 gimple_omp_parallel_combined_p (const_gimple g)
1729 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1730 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1734 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1735 value of COMBINED_P. */
1737 static inline void
1738 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1740 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1741 if (combined_p)
1742 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1743 else
1744 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1748 /* Return true if OMP atomic load/store statement G has the
1749 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1751 static inline bool
1752 gimple_omp_atomic_need_value_p (const_gimple g)
1754 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1755 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1756 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1760 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1762 static inline void
1763 gimple_omp_atomic_set_need_value (gimple g)
1765 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1766 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1767 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1771 /* Return the number of operands for statement GS. */
1773 static inline unsigned
1774 gimple_num_ops (const_gimple gs)
1776 return gs->gsbase.num_ops;
1780 /* Set the number of operands for statement GS. */
1782 static inline void
1783 gimple_set_num_ops (gimple gs, unsigned num_ops)
1785 gs->gsbase.num_ops = num_ops;
1789 /* Return the array of operands for statement GS. */
1791 static inline tree *
1792 gimple_ops (gimple gs)
1794 size_t off;
1796 /* All the tuples have their operand vector at the very bottom
1797 of the structure. Note that those structures that do not
1798 have an operand vector have a zero offset. */
1799 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1800 gcc_gimple_checking_assert (off != 0);
1802 return (tree *) ((char *) gs + off);
1806 /* Return operand I for statement GS. */
1808 static inline tree
1809 gimple_op (const_gimple gs, unsigned i)
1811 if (gimple_has_ops (gs))
1813 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1814 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1816 else
1817 return NULL_TREE;
1820 /* Return a pointer to operand I for statement GS. */
1822 static inline tree *
1823 gimple_op_ptr (const_gimple gs, unsigned i)
1825 if (gimple_has_ops (gs))
1827 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1828 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1830 else
1831 return NULL;
1834 /* Set operand I of statement GS to OP. */
1836 static inline void
1837 gimple_set_op (gimple gs, unsigned i, tree op)
1839 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1841 /* Note. It may be tempting to assert that OP matches
1842 is_gimple_operand, but that would be wrong. Different tuples
1843 accept slightly different sets of tree operands. Each caller
1844 should perform its own validation. */
1845 gimple_ops (gs)[i] = op;
1848 /* Return true if GS is a GIMPLE_ASSIGN. */
1850 static inline bool
1851 is_gimple_assign (const_gimple gs)
1853 return gimple_code (gs) == GIMPLE_ASSIGN;
1856 /* Determine if expression CODE is one of the valid expressions that can
1857 be used on the RHS of GIMPLE assignments. */
1859 static inline enum gimple_rhs_class
1860 get_gimple_rhs_class (enum tree_code code)
1862 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1865 /* Return the LHS of assignment statement GS. */
1867 static inline tree
1868 gimple_assign_lhs (const_gimple gs)
1870 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1871 return gimple_op (gs, 0);
1875 /* Return a pointer to the LHS of assignment statement GS. */
1877 static inline tree *
1878 gimple_assign_lhs_ptr (const_gimple gs)
1880 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1881 return gimple_op_ptr (gs, 0);
1885 /* Set LHS to be the LHS operand of assignment statement GS. */
1887 static inline void
1888 gimple_assign_set_lhs (gimple gs, tree lhs)
1890 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1891 gimple_set_op (gs, 0, lhs);
1893 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1894 SSA_NAME_DEF_STMT (lhs) = gs;
1898 /* Return the first operand on the RHS of assignment statement GS. */
1900 static inline tree
1901 gimple_assign_rhs1 (const_gimple gs)
1903 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1904 return gimple_op (gs, 1);
1908 /* Return a pointer to the first operand on the RHS of assignment
1909 statement GS. */
1911 static inline tree *
1912 gimple_assign_rhs1_ptr (const_gimple gs)
1914 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1915 return gimple_op_ptr (gs, 1);
1918 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1920 static inline void
1921 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1923 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1925 gimple_set_op (gs, 1, rhs);
1929 /* Return the second operand on the RHS of assignment statement GS.
1930 If GS does not have two operands, NULL is returned instead. */
1932 static inline tree
1933 gimple_assign_rhs2 (const_gimple gs)
1935 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1937 if (gimple_num_ops (gs) >= 3)
1938 return gimple_op (gs, 2);
1939 else
1940 return NULL_TREE;
1944 /* Return a pointer to the second operand on the RHS of assignment
1945 statement GS. */
1947 static inline tree *
1948 gimple_assign_rhs2_ptr (const_gimple gs)
1950 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1951 return gimple_op_ptr (gs, 2);
1955 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1957 static inline void
1958 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1960 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1962 gimple_set_op (gs, 2, rhs);
1965 /* Return the third operand on the RHS of assignment statement GS.
1966 If GS does not have two operands, NULL is returned instead. */
1968 static inline tree
1969 gimple_assign_rhs3 (const_gimple gs)
1971 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1973 if (gimple_num_ops (gs) >= 4)
1974 return gimple_op (gs, 3);
1975 else
1976 return NULL_TREE;
1979 /* Return a pointer to the third operand on the RHS of assignment
1980 statement GS. */
1982 static inline tree *
1983 gimple_assign_rhs3_ptr (const_gimple gs)
1985 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1986 return gimple_op_ptr (gs, 3);
1990 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1992 static inline void
1993 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1995 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1997 gimple_set_op (gs, 3, rhs);
2000 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2001 to see only a maximum of two operands. */
2003 static inline void
2004 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2005 tree op1, tree op2)
2007 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2010 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2011 to see only a maximum of two operands. */
2013 static inline void
2014 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
2015 tree *op1)
2017 tree op2;
2018 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
2019 gcc_assert (op2 == NULL_TREE);
2022 /* Returns true if GS is a nontemporal move. */
2024 static inline bool
2025 gimple_assign_nontemporal_move_p (const_gimple gs)
2027 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2028 return gs->gsbase.nontemporal_move;
2031 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2033 static inline void
2034 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2036 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2037 gs->gsbase.nontemporal_move = nontemporal;
2041 /* Return the code of the expression computed on the rhs of assignment
2042 statement GS. In case that the RHS is a single object, returns the
2043 tree code of the object. */
2045 static inline enum tree_code
2046 gimple_assign_rhs_code (const_gimple gs)
2048 enum tree_code code;
2049 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2051 code = (enum tree_code) gs->gsbase.subcode;
2052 /* While we initially set subcode to the TREE_CODE of the rhs for
2053 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2054 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2055 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2056 code = TREE_CODE (gimple_assign_rhs1 (gs));
2058 return code;
2062 /* Set CODE to be the code for the expression computed on the RHS of
2063 assignment S. */
2065 static inline void
2066 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2068 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2069 s->gsbase.subcode = code;
2073 /* Return the gimple rhs class of the code of the expression computed on
2074 the rhs of assignment statement GS.
2075 This will never return GIMPLE_INVALID_RHS. */
2077 static inline enum gimple_rhs_class
2078 gimple_assign_rhs_class (const_gimple gs)
2080 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2083 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2084 there is no operator associated with the assignment itself.
2085 Unlike gimple_assign_copy_p, this predicate returns true for
2086 any RHS operand, including those that perform an operation
2087 and do not have the semantics of a copy, such as COND_EXPR. */
2089 static inline bool
2090 gimple_assign_single_p (gimple gs)
2092 return (is_gimple_assign (gs)
2093 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2096 /* Return true if GS performs a store to its lhs. */
2098 static inline bool
2099 gimple_store_p (gimple gs)
2101 tree lhs = gimple_get_lhs (gs);
2102 return lhs && !is_gimple_reg (lhs);
2105 /* Return true if GS is an assignment that loads from its rhs1. */
2107 static inline bool
2108 gimple_assign_load_p (gimple gs)
2110 tree rhs;
2111 if (!gimple_assign_single_p (gs))
2112 return false;
2113 rhs = gimple_assign_rhs1 (gs);
2114 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2115 return true;
2116 rhs = get_base_address (rhs);
2117 return (DECL_P (rhs)
2118 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2122 /* Return true if S is a type-cast assignment. */
2124 static inline bool
2125 gimple_assign_cast_p (gimple s)
2127 if (is_gimple_assign (s))
2129 enum tree_code sc = gimple_assign_rhs_code (s);
2130 return CONVERT_EXPR_CODE_P (sc)
2131 || sc == VIEW_CONVERT_EXPR
2132 || sc == FIX_TRUNC_EXPR;
2135 return false;
2138 /* Return true if S is a clobber statement. */
2140 static inline bool
2141 gimple_clobber_p (gimple s)
2143 return gimple_assign_single_p (s)
2144 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2147 /* Return true if GS is a GIMPLE_CALL. */
2149 static inline bool
2150 is_gimple_call (const_gimple gs)
2152 return gimple_code (gs) == GIMPLE_CALL;
2155 /* Return the LHS of call statement GS. */
2157 static inline tree
2158 gimple_call_lhs (const_gimple gs)
2160 GIMPLE_CHECK (gs, GIMPLE_CALL);
2161 return gimple_op (gs, 0);
2165 /* Return a pointer to the LHS of call statement GS. */
2167 static inline tree *
2168 gimple_call_lhs_ptr (const_gimple gs)
2170 GIMPLE_CHECK (gs, GIMPLE_CALL);
2171 return gimple_op_ptr (gs, 0);
2175 /* Set LHS to be the LHS operand of call statement GS. */
2177 static inline void
2178 gimple_call_set_lhs (gimple gs, tree lhs)
2180 GIMPLE_CHECK (gs, GIMPLE_CALL);
2181 gimple_set_op (gs, 0, lhs);
2182 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2183 SSA_NAME_DEF_STMT (lhs) = gs;
2187 /* Return true if call GS calls an internal-only function, as enumerated
2188 by internal_fn. */
2190 static inline bool
2191 gimple_call_internal_p (const_gimple gs)
2193 GIMPLE_CHECK (gs, GIMPLE_CALL);
2194 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2198 /* Return the target of internal call GS. */
2200 static inline enum internal_fn
2201 gimple_call_internal_fn (const_gimple gs)
2203 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2204 return gs->gimple_call.u.internal_fn;
2208 /* Return the function type of the function called by GS. */
2210 static inline tree
2211 gimple_call_fntype (const_gimple gs)
2213 GIMPLE_CHECK (gs, GIMPLE_CALL);
2214 if (gimple_call_internal_p (gs))
2215 return NULL_TREE;
2216 return gs->gimple_call.u.fntype;
2219 /* Set the type of the function called by GS to FNTYPE. */
2221 static inline void
2222 gimple_call_set_fntype (gimple gs, tree fntype)
2224 GIMPLE_CHECK (gs, GIMPLE_CALL);
2225 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2226 gs->gimple_call.u.fntype = fntype;
2230 /* Return the tree node representing the function called by call
2231 statement GS. */
2233 static inline tree
2234 gimple_call_fn (const_gimple gs)
2236 GIMPLE_CHECK (gs, GIMPLE_CALL);
2237 return gimple_op (gs, 1);
2240 /* Return a pointer to the tree node representing the function called by call
2241 statement GS. */
2243 static inline tree *
2244 gimple_call_fn_ptr (const_gimple gs)
2246 GIMPLE_CHECK (gs, GIMPLE_CALL);
2247 return gimple_op_ptr (gs, 1);
2251 /* Set FN to be the function called by call statement GS. */
2253 static inline void
2254 gimple_call_set_fn (gimple gs, tree fn)
2256 GIMPLE_CHECK (gs, GIMPLE_CALL);
2257 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2258 gimple_set_op (gs, 1, fn);
2262 /* Set FNDECL to be the function called by call statement GS. */
2264 static inline void
2265 gimple_call_set_fndecl (gimple gs, tree decl)
2267 GIMPLE_CHECK (gs, GIMPLE_CALL);
2268 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2269 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2273 /* Set internal function FN to be the function called by call statement GS. */
2275 static inline void
2276 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2278 GIMPLE_CHECK (gs, GIMPLE_CALL);
2279 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2280 gs->gimple_call.u.internal_fn = fn;
2284 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2285 associated with the callee if known. Otherwise return NULL_TREE. */
2287 static inline tree
2288 gimple_call_addr_fndecl (const_tree fn)
2290 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2292 tree fndecl = TREE_OPERAND (fn, 0);
2293 if (TREE_CODE (fndecl) == MEM_REF
2294 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2295 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2296 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2297 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2298 return fndecl;
2300 return NULL_TREE;
2303 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2304 Otherwise return NULL. This function is analogous to
2305 get_callee_fndecl in tree land. */
2307 static inline tree
2308 gimple_call_fndecl (const_gimple gs)
2310 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2314 /* Return the type returned by call statement GS. */
2316 static inline tree
2317 gimple_call_return_type (const_gimple gs)
2319 tree type = gimple_call_fntype (gs);
2321 if (type == NULL_TREE)
2322 return TREE_TYPE (gimple_call_lhs (gs));
2324 /* The type returned by a function is the type of its
2325 function type. */
2326 return TREE_TYPE (type);
2330 /* Return the static chain for call statement GS. */
2332 static inline tree
2333 gimple_call_chain (const_gimple gs)
2335 GIMPLE_CHECK (gs, GIMPLE_CALL);
2336 return gimple_op (gs, 2);
2340 /* Return a pointer to the static chain for call statement GS. */
2342 static inline tree *
2343 gimple_call_chain_ptr (const_gimple gs)
2345 GIMPLE_CHECK (gs, GIMPLE_CALL);
2346 return gimple_op_ptr (gs, 2);
2349 /* Set CHAIN to be the static chain for call statement GS. */
2351 static inline void
2352 gimple_call_set_chain (gimple gs, tree chain)
2354 GIMPLE_CHECK (gs, GIMPLE_CALL);
2356 gimple_set_op (gs, 2, chain);
2360 /* Return the number of arguments used by call statement GS. */
2362 static inline unsigned
2363 gimple_call_num_args (const_gimple gs)
2365 unsigned num_ops;
2366 GIMPLE_CHECK (gs, GIMPLE_CALL);
2367 num_ops = gimple_num_ops (gs);
2368 return num_ops - 3;
2372 /* Return the argument at position INDEX for call statement GS. */
2374 static inline tree
2375 gimple_call_arg (const_gimple gs, unsigned index)
2377 GIMPLE_CHECK (gs, GIMPLE_CALL);
2378 return gimple_op (gs, index + 3);
2382 /* Return a pointer to the argument at position INDEX for call
2383 statement GS. */
2385 static inline tree *
2386 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2388 GIMPLE_CHECK (gs, GIMPLE_CALL);
2389 return gimple_op_ptr (gs, index + 3);
2393 /* Set ARG to be the argument at position INDEX for call statement GS. */
2395 static inline void
2396 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2398 GIMPLE_CHECK (gs, GIMPLE_CALL);
2399 gimple_set_op (gs, index + 3, arg);
2403 /* If TAIL_P is true, mark call statement S as being a tail call
2404 (i.e., a call just before the exit of a function). These calls are
2405 candidate for tail call optimization. */
2407 static inline void
2408 gimple_call_set_tail (gimple s, bool tail_p)
2410 GIMPLE_CHECK (s, GIMPLE_CALL);
2411 if (tail_p)
2412 s->gsbase.subcode |= GF_CALL_TAILCALL;
2413 else
2414 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2418 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2420 static inline bool
2421 gimple_call_tail_p (gimple s)
2423 GIMPLE_CHECK (s, GIMPLE_CALL);
2424 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2428 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2429 slot optimization. This transformation uses the target of the call
2430 expansion as the return slot for calls that return in memory. */
2432 static inline void
2433 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2435 GIMPLE_CHECK (s, GIMPLE_CALL);
2436 if (return_slot_opt_p)
2437 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2438 else
2439 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2443 /* Return true if S is marked for return slot optimization. */
2445 static inline bool
2446 gimple_call_return_slot_opt_p (gimple s)
2448 GIMPLE_CHECK (s, GIMPLE_CALL);
2449 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2453 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2454 thunk to the thunked-to function. */
2456 static inline void
2457 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2459 GIMPLE_CHECK (s, GIMPLE_CALL);
2460 if (from_thunk_p)
2461 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2462 else
2463 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2467 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2469 static inline bool
2470 gimple_call_from_thunk_p (gimple s)
2472 GIMPLE_CHECK (s, GIMPLE_CALL);
2473 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2477 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2478 argument pack in its argument list. */
2480 static inline void
2481 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2483 GIMPLE_CHECK (s, GIMPLE_CALL);
2484 if (pass_arg_pack_p)
2485 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2486 else
2487 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2491 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2492 argument pack in its argument list. */
2494 static inline bool
2495 gimple_call_va_arg_pack_p (gimple s)
2497 GIMPLE_CHECK (s, GIMPLE_CALL);
2498 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2502 /* Return true if S is a noreturn call. */
2504 static inline bool
2505 gimple_call_noreturn_p (gimple s)
2507 GIMPLE_CHECK (s, GIMPLE_CALL);
2508 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2512 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2513 even if the called function can throw in other cases. */
2515 static inline void
2516 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2518 GIMPLE_CHECK (s, GIMPLE_CALL);
2519 if (nothrow_p)
2520 s->gsbase.subcode |= GF_CALL_NOTHROW;
2521 else
2522 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2525 /* Return true if S is a nothrow call. */
2527 static inline bool
2528 gimple_call_nothrow_p (gimple s)
2530 GIMPLE_CHECK (s, GIMPLE_CALL);
2531 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2534 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2535 is known to be emitted for VLA objects. Those are wrapped by
2536 stack_save/stack_restore calls and hence can't lead to unbounded
2537 stack growth even when they occur in loops. */
2539 static inline void
2540 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2542 GIMPLE_CHECK (s, GIMPLE_CALL);
2543 if (for_var)
2544 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2545 else
2546 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2549 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2551 static inline bool
2552 gimple_call_alloca_for_var_p (gimple s)
2554 GIMPLE_CHECK (s, GIMPLE_CALL);
2555 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2558 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2560 static inline void
2561 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2563 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2564 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2565 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2569 /* Return a pointer to the points-to solution for the set of call-used
2570 variables of the call CALL. */
2572 static inline struct pt_solution *
2573 gimple_call_use_set (gimple call)
2575 GIMPLE_CHECK (call, GIMPLE_CALL);
2576 return &call->gimple_call.call_used;
2580 /* Return a pointer to the points-to solution for the set of call-used
2581 variables of the call CALL. */
2583 static inline struct pt_solution *
2584 gimple_call_clobber_set (gimple call)
2586 GIMPLE_CHECK (call, GIMPLE_CALL);
2587 return &call->gimple_call.call_clobbered;
2591 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2592 non-NULL lhs. */
2594 static inline bool
2595 gimple_has_lhs (gimple stmt)
2597 return (is_gimple_assign (stmt)
2598 || (is_gimple_call (stmt)
2599 && gimple_call_lhs (stmt) != NULL_TREE));
2603 /* Return the code of the predicate computed by conditional statement GS. */
2605 static inline enum tree_code
2606 gimple_cond_code (const_gimple gs)
2608 GIMPLE_CHECK (gs, GIMPLE_COND);
2609 return (enum tree_code) gs->gsbase.subcode;
2613 /* Set CODE to be the predicate code for the conditional statement GS. */
2615 static inline void
2616 gimple_cond_set_code (gimple gs, enum tree_code code)
2618 GIMPLE_CHECK (gs, GIMPLE_COND);
2619 gs->gsbase.subcode = code;
2623 /* Return the LHS of the predicate computed by conditional statement GS. */
2625 static inline tree
2626 gimple_cond_lhs (const_gimple gs)
2628 GIMPLE_CHECK (gs, GIMPLE_COND);
2629 return gimple_op (gs, 0);
2632 /* Return the pointer to the LHS of the predicate computed by conditional
2633 statement GS. */
2635 static inline tree *
2636 gimple_cond_lhs_ptr (const_gimple gs)
2638 GIMPLE_CHECK (gs, GIMPLE_COND);
2639 return gimple_op_ptr (gs, 0);
2642 /* Set LHS to be the LHS operand of the predicate computed by
2643 conditional statement GS. */
2645 static inline void
2646 gimple_cond_set_lhs (gimple gs, tree lhs)
2648 GIMPLE_CHECK (gs, GIMPLE_COND);
2649 gimple_set_op (gs, 0, lhs);
2653 /* Return the RHS operand of the predicate computed by conditional GS. */
2655 static inline tree
2656 gimple_cond_rhs (const_gimple gs)
2658 GIMPLE_CHECK (gs, GIMPLE_COND);
2659 return gimple_op (gs, 1);
2662 /* Return the pointer to the RHS operand of the predicate computed by
2663 conditional GS. */
2665 static inline tree *
2666 gimple_cond_rhs_ptr (const_gimple gs)
2668 GIMPLE_CHECK (gs, GIMPLE_COND);
2669 return gimple_op_ptr (gs, 1);
2673 /* Set RHS to be the RHS operand of the predicate computed by
2674 conditional statement GS. */
2676 static inline void
2677 gimple_cond_set_rhs (gimple gs, tree rhs)
2679 GIMPLE_CHECK (gs, GIMPLE_COND);
2680 gimple_set_op (gs, 1, rhs);
2684 /* Return the label used by conditional statement GS when its
2685 predicate evaluates to true. */
2687 static inline tree
2688 gimple_cond_true_label (const_gimple gs)
2690 GIMPLE_CHECK (gs, GIMPLE_COND);
2691 return gimple_op (gs, 2);
2695 /* Set LABEL to be the label used by conditional statement GS when its
2696 predicate evaluates to true. */
2698 static inline void
2699 gimple_cond_set_true_label (gimple gs, tree label)
2701 GIMPLE_CHECK (gs, GIMPLE_COND);
2702 gimple_set_op (gs, 2, label);
2706 /* Set LABEL to be the label used by conditional statement GS when its
2707 predicate evaluates to false. */
2709 static inline void
2710 gimple_cond_set_false_label (gimple gs, tree label)
2712 GIMPLE_CHECK (gs, GIMPLE_COND);
2713 gimple_set_op (gs, 3, label);
2717 /* Return the label used by conditional statement GS when its
2718 predicate evaluates to false. */
2720 static inline tree
2721 gimple_cond_false_label (const_gimple gs)
2723 GIMPLE_CHECK (gs, GIMPLE_COND);
2724 return gimple_op (gs, 3);
2728 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2730 static inline void
2731 gimple_cond_make_false (gimple gs)
2733 gimple_cond_set_lhs (gs, boolean_true_node);
2734 gimple_cond_set_rhs (gs, boolean_false_node);
2735 gs->gsbase.subcode = EQ_EXPR;
2739 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2741 static inline void
2742 gimple_cond_make_true (gimple gs)
2744 gimple_cond_set_lhs (gs, boolean_true_node);
2745 gimple_cond_set_rhs (gs, boolean_true_node);
2746 gs->gsbase.subcode = EQ_EXPR;
2749 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2750 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2752 static inline bool
2753 gimple_cond_true_p (const_gimple gs)
2755 tree lhs = gimple_cond_lhs (gs);
2756 tree rhs = gimple_cond_rhs (gs);
2757 enum tree_code code = gimple_cond_code (gs);
2759 if (lhs != boolean_true_node && lhs != boolean_false_node)
2760 return false;
2762 if (rhs != boolean_true_node && rhs != boolean_false_node)
2763 return false;
2765 if (code == NE_EXPR && lhs != rhs)
2766 return true;
2768 if (code == EQ_EXPR && lhs == rhs)
2769 return true;
2771 return false;
2774 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2775 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2777 static inline bool
2778 gimple_cond_false_p (const_gimple gs)
2780 tree lhs = gimple_cond_lhs (gs);
2781 tree rhs = gimple_cond_rhs (gs);
2782 enum tree_code code = gimple_cond_code (gs);
2784 if (lhs != boolean_true_node && lhs != boolean_false_node)
2785 return false;
2787 if (rhs != boolean_true_node && rhs != boolean_false_node)
2788 return false;
2790 if (code == NE_EXPR && lhs == rhs)
2791 return true;
2793 if (code == EQ_EXPR && lhs != rhs)
2794 return true;
2796 return false;
2799 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2801 static inline void
2802 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2804 gimple_cond_set_code (stmt, code);
2805 gimple_cond_set_lhs (stmt, lhs);
2806 gimple_cond_set_rhs (stmt, rhs);
2809 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2811 static inline tree
2812 gimple_label_label (const_gimple gs)
2814 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2815 return gimple_op (gs, 0);
2819 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2820 GS. */
2822 static inline void
2823 gimple_label_set_label (gimple gs, tree label)
2825 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2826 gimple_set_op (gs, 0, label);
2830 /* Return the destination of the unconditional jump GS. */
2832 static inline tree
2833 gimple_goto_dest (const_gimple gs)
2835 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2836 return gimple_op (gs, 0);
2840 /* Set DEST to be the destination of the unconditonal jump GS. */
2842 static inline void
2843 gimple_goto_set_dest (gimple gs, tree dest)
2845 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2846 gimple_set_op (gs, 0, dest);
2850 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2852 static inline tree
2853 gimple_bind_vars (const_gimple gs)
2855 GIMPLE_CHECK (gs, GIMPLE_BIND);
2856 return gs->gimple_bind.vars;
2860 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2861 statement GS. */
2863 static inline void
2864 gimple_bind_set_vars (gimple gs, tree vars)
2866 GIMPLE_CHECK (gs, GIMPLE_BIND);
2867 gs->gimple_bind.vars = vars;
2871 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2872 statement GS. */
2874 static inline void
2875 gimple_bind_append_vars (gimple gs, tree vars)
2877 GIMPLE_CHECK (gs, GIMPLE_BIND);
2878 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2882 static inline gimple_seq *
2883 gimple_bind_body_ptr (gimple gs)
2885 GIMPLE_CHECK (gs, GIMPLE_BIND);
2886 return &gs->gimple_bind.body;
2889 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2891 static inline gimple_seq
2892 gimple_bind_body (gimple gs)
2894 return *gimple_bind_body_ptr (gs);
2898 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2899 statement GS. */
2901 static inline void
2902 gimple_bind_set_body (gimple gs, gimple_seq seq)
2904 GIMPLE_CHECK (gs, GIMPLE_BIND);
2905 gs->gimple_bind.body = seq;
2909 /* Append a statement to the end of a GIMPLE_BIND's body. */
2911 static inline void
2912 gimple_bind_add_stmt (gimple gs, gimple stmt)
2914 GIMPLE_CHECK (gs, GIMPLE_BIND);
2915 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2919 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2921 static inline void
2922 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2924 GIMPLE_CHECK (gs, GIMPLE_BIND);
2925 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2929 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2930 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2932 static inline tree
2933 gimple_bind_block (const_gimple gs)
2935 GIMPLE_CHECK (gs, GIMPLE_BIND);
2936 return gs->gimple_bind.block;
2940 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2941 statement GS. */
2943 static inline void
2944 gimple_bind_set_block (gimple gs, tree block)
2946 GIMPLE_CHECK (gs, GIMPLE_BIND);
2947 gcc_gimple_checking_assert (block == NULL_TREE
2948 || TREE_CODE (block) == BLOCK);
2949 gs->gimple_bind.block = block;
2953 /* Return the number of input operands for GIMPLE_ASM GS. */
2955 static inline unsigned
2956 gimple_asm_ninputs (const_gimple gs)
2958 GIMPLE_CHECK (gs, GIMPLE_ASM);
2959 return gs->gimple_asm.ni;
2963 /* Return the number of output operands for GIMPLE_ASM GS. */
2965 static inline unsigned
2966 gimple_asm_noutputs (const_gimple gs)
2968 GIMPLE_CHECK (gs, GIMPLE_ASM);
2969 return gs->gimple_asm.no;
2973 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2975 static inline unsigned
2976 gimple_asm_nclobbers (const_gimple gs)
2978 GIMPLE_CHECK (gs, GIMPLE_ASM);
2979 return gs->gimple_asm.nc;
2982 /* Return the number of label operands for GIMPLE_ASM GS. */
2984 static inline unsigned
2985 gimple_asm_nlabels (const_gimple gs)
2987 GIMPLE_CHECK (gs, GIMPLE_ASM);
2988 return gs->gimple_asm.nl;
2991 /* Return input operand INDEX of GIMPLE_ASM GS. */
2993 static inline tree
2994 gimple_asm_input_op (const_gimple gs, unsigned index)
2996 GIMPLE_CHECK (gs, GIMPLE_ASM);
2997 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2998 return gimple_op (gs, index + gs->gimple_asm.no);
3001 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3003 static inline tree *
3004 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3006 GIMPLE_CHECK (gs, GIMPLE_ASM);
3007 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3008 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
3012 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3014 static inline void
3015 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3017 GIMPLE_CHECK (gs, GIMPLE_ASM);
3018 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
3019 && TREE_CODE (in_op) == TREE_LIST);
3020 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
3024 /* Return output operand INDEX of GIMPLE_ASM GS. */
3026 static inline tree
3027 gimple_asm_output_op (const_gimple gs, unsigned index)
3029 GIMPLE_CHECK (gs, GIMPLE_ASM);
3030 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3031 return gimple_op (gs, index);
3034 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3036 static inline tree *
3037 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3039 GIMPLE_CHECK (gs, GIMPLE_ASM);
3040 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3041 return gimple_op_ptr (gs, index);
3045 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3047 static inline void
3048 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3050 GIMPLE_CHECK (gs, GIMPLE_ASM);
3051 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3052 && TREE_CODE (out_op) == TREE_LIST);
3053 gimple_set_op (gs, index, out_op);
3057 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3059 static inline tree
3060 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3062 GIMPLE_CHECK (gs, GIMPLE_ASM);
3063 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3064 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3068 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3070 static inline void
3071 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3073 GIMPLE_CHECK (gs, GIMPLE_ASM);
3074 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3075 && TREE_CODE (clobber_op) == TREE_LIST);
3076 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3079 /* Return label operand INDEX of GIMPLE_ASM GS. */
3081 static inline tree
3082 gimple_asm_label_op (const_gimple gs, unsigned index)
3084 GIMPLE_CHECK (gs, GIMPLE_ASM);
3085 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3086 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3089 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3091 static inline void
3092 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3094 GIMPLE_CHECK (gs, GIMPLE_ASM);
3095 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3096 && TREE_CODE (label_op) == TREE_LIST);
3097 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3100 /* Return the string representing the assembly instruction in
3101 GIMPLE_ASM GS. */
3103 static inline const char *
3104 gimple_asm_string (const_gimple gs)
3106 GIMPLE_CHECK (gs, GIMPLE_ASM);
3107 return gs->gimple_asm.string;
3111 /* Return true if GS is an asm statement marked volatile. */
3113 static inline bool
3114 gimple_asm_volatile_p (const_gimple gs)
3116 GIMPLE_CHECK (gs, GIMPLE_ASM);
3117 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3121 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3123 static inline void
3124 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3126 GIMPLE_CHECK (gs, GIMPLE_ASM);
3127 if (volatile_p)
3128 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3129 else
3130 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3134 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3136 static inline void
3137 gimple_asm_set_input (gimple gs, bool input_p)
3139 GIMPLE_CHECK (gs, GIMPLE_ASM);
3140 if (input_p)
3141 gs->gsbase.subcode |= GF_ASM_INPUT;
3142 else
3143 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3147 /* Return true if asm GS is an ASM_INPUT. */
3149 static inline bool
3150 gimple_asm_input_p (const_gimple gs)
3152 GIMPLE_CHECK (gs, GIMPLE_ASM);
3153 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3157 /* Return the types handled by GIMPLE_CATCH statement GS. */
3159 static inline tree
3160 gimple_catch_types (const_gimple gs)
3162 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3163 return gs->gimple_catch.types;
3167 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3169 static inline tree *
3170 gimple_catch_types_ptr (gimple gs)
3172 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3173 return &gs->gimple_catch.types;
3177 /* Return a pointer to the GIMPLE sequence representing the body of
3178 the handler of GIMPLE_CATCH statement GS. */
3180 static inline gimple_seq *
3181 gimple_catch_handler_ptr (gimple gs)
3183 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3184 return &gs->gimple_catch.handler;
3188 /* Return the GIMPLE sequence representing the body of the handler of
3189 GIMPLE_CATCH statement GS. */
3191 static inline gimple_seq
3192 gimple_catch_handler (gimple gs)
3194 return *gimple_catch_handler_ptr (gs);
3198 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3200 static inline void
3201 gimple_catch_set_types (gimple gs, tree t)
3203 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3204 gs->gimple_catch.types = t;
3208 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3210 static inline void
3211 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3213 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3214 gs->gimple_catch.handler = handler;
3218 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3220 static inline tree
3221 gimple_eh_filter_types (const_gimple gs)
3223 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3224 return gs->gimple_eh_filter.types;
3228 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3229 GS. */
3231 static inline tree *
3232 gimple_eh_filter_types_ptr (gimple gs)
3234 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3235 return &gs->gimple_eh_filter.types;
3239 /* Return a pointer to the sequence of statement to execute when
3240 GIMPLE_EH_FILTER statement fails. */
3242 static inline gimple_seq *
3243 gimple_eh_filter_failure_ptr (gimple gs)
3245 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3246 return &gs->gimple_eh_filter.failure;
3250 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3251 statement fails. */
3253 static inline gimple_seq
3254 gimple_eh_filter_failure (gimple gs)
3256 return *gimple_eh_filter_failure_ptr (gs);
3260 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3262 static inline void
3263 gimple_eh_filter_set_types (gimple gs, tree types)
3265 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3266 gs->gimple_eh_filter.types = types;
3270 /* Set FAILURE to be the sequence of statements to execute on failure
3271 for GIMPLE_EH_FILTER GS. */
3273 static inline void
3274 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3276 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3277 gs->gimple_eh_filter.failure = failure;
3280 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3282 static inline tree
3283 gimple_eh_must_not_throw_fndecl (gimple gs)
3285 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3286 return gs->gimple_eh_mnt.fndecl;
3289 /* Set the function decl to be called by GS to DECL. */
3291 static inline void
3292 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3294 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3295 gs->gimple_eh_mnt.fndecl = decl;
3298 /* GIMPLE_EH_ELSE accessors. */
3300 static inline gimple_seq *
3301 gimple_eh_else_n_body_ptr (gimple gs)
3303 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3304 return &gs->gimple_eh_else.n_body;
3307 static inline gimple_seq
3308 gimple_eh_else_n_body (gimple gs)
3310 return *gimple_eh_else_n_body_ptr (gs);
3313 static inline gimple_seq *
3314 gimple_eh_else_e_body_ptr (gimple gs)
3316 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3317 return &gs->gimple_eh_else.e_body;
3320 static inline gimple_seq
3321 gimple_eh_else_e_body (gimple gs)
3323 return *gimple_eh_else_e_body_ptr (gs);
3326 static inline void
3327 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3329 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3330 gs->gimple_eh_else.n_body = seq;
3333 static inline void
3334 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3336 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3337 gs->gimple_eh_else.e_body = seq;
3340 /* GIMPLE_TRY accessors. */
3342 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3343 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3345 static inline enum gimple_try_flags
3346 gimple_try_kind (const_gimple gs)
3348 GIMPLE_CHECK (gs, GIMPLE_TRY);
3349 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3353 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3355 static inline void
3356 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3358 GIMPLE_CHECK (gs, GIMPLE_TRY);
3359 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3360 || kind == GIMPLE_TRY_FINALLY);
3361 if (gimple_try_kind (gs) != kind)
3362 gs->gsbase.subcode = (unsigned int) kind;
3366 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3368 static inline bool
3369 gimple_try_catch_is_cleanup (const_gimple gs)
3371 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3372 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3376 /* Return a pointer to the sequence of statements used as the
3377 body for GIMPLE_TRY GS. */
3379 static inline gimple_seq *
3380 gimple_try_eval_ptr (gimple gs)
3382 GIMPLE_CHECK (gs, GIMPLE_TRY);
3383 return &gs->gimple_try.eval;
3387 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3389 static inline gimple_seq
3390 gimple_try_eval (gimple gs)
3392 return *gimple_try_eval_ptr (gs);
3396 /* Return a pointer to the sequence of statements used as the cleanup body for
3397 GIMPLE_TRY GS. */
3399 static inline gimple_seq *
3400 gimple_try_cleanup_ptr (gimple gs)
3402 GIMPLE_CHECK (gs, GIMPLE_TRY);
3403 return &gs->gimple_try.cleanup;
3407 /* Return the sequence of statements used as the cleanup body for
3408 GIMPLE_TRY GS. */
3410 static inline gimple_seq
3411 gimple_try_cleanup (gimple gs)
3413 return *gimple_try_cleanup_ptr (gs);
3417 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3419 static inline void
3420 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3422 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3423 if (catch_is_cleanup)
3424 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3425 else
3426 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3430 /* Set EVAL to be the sequence of statements to use as the body for
3431 GIMPLE_TRY GS. */
3433 static inline void
3434 gimple_try_set_eval (gimple gs, gimple_seq eval)
3436 GIMPLE_CHECK (gs, GIMPLE_TRY);
3437 gs->gimple_try.eval = eval;
3441 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3442 body for GIMPLE_TRY GS. */
3444 static inline void
3445 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3447 GIMPLE_CHECK (gs, GIMPLE_TRY);
3448 gs->gimple_try.cleanup = cleanup;
3452 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3454 static inline gimple_seq *
3455 gimple_wce_cleanup_ptr (gimple gs)
3457 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3458 return &gs->gimple_wce.cleanup;
3462 /* Return the cleanup sequence for cleanup statement GS. */
3464 static inline gimple_seq
3465 gimple_wce_cleanup (gimple gs)
3467 return *gimple_wce_cleanup_ptr (gs);
3471 /* Set CLEANUP to be the cleanup sequence for GS. */
3473 static inline void
3474 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3476 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3477 gs->gimple_wce.cleanup = cleanup;
3481 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3483 static inline bool
3484 gimple_wce_cleanup_eh_only (const_gimple gs)
3486 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3487 return gs->gsbase.subcode != 0;
3491 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3493 static inline void
3494 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3496 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3497 gs->gsbase.subcode = (unsigned int) eh_only_p;
3501 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3503 static inline unsigned
3504 gimple_phi_capacity (const_gimple gs)
3506 GIMPLE_CHECK (gs, GIMPLE_PHI);
3507 return gs->gimple_phi.capacity;
3511 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3512 be exactly the number of incoming edges for the basic block holding
3513 GS. */
3515 static inline unsigned
3516 gimple_phi_num_args (const_gimple gs)
3518 GIMPLE_CHECK (gs, GIMPLE_PHI);
3519 return gs->gimple_phi.nargs;
3523 /* Return the SSA name created by GIMPLE_PHI GS. */
3525 static inline tree
3526 gimple_phi_result (const_gimple gs)
3528 GIMPLE_CHECK (gs, GIMPLE_PHI);
3529 return gs->gimple_phi.result;
3532 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3534 static inline tree *
3535 gimple_phi_result_ptr (gimple gs)
3537 GIMPLE_CHECK (gs, GIMPLE_PHI);
3538 return &gs->gimple_phi.result;
3541 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3543 static inline void
3544 gimple_phi_set_result (gimple gs, tree result)
3546 GIMPLE_CHECK (gs, GIMPLE_PHI);
3547 gs->gimple_phi.result = result;
3548 if (result && TREE_CODE (result) == SSA_NAME)
3549 SSA_NAME_DEF_STMT (result) = gs;
3553 /* Return the PHI argument corresponding to incoming edge INDEX for
3554 GIMPLE_PHI GS. */
3556 static inline struct phi_arg_d *
3557 gimple_phi_arg (gimple gs, unsigned index)
3559 GIMPLE_CHECK (gs, GIMPLE_PHI);
3560 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3561 return &(gs->gimple_phi.args[index]);
3564 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3565 for GIMPLE_PHI GS. */
3567 static inline void
3568 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3570 GIMPLE_CHECK (gs, GIMPLE_PHI);
3571 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3572 gs->gimple_phi.args[index] = *phiarg;
3575 /* Return the region number for GIMPLE_RESX GS. */
3577 static inline int
3578 gimple_resx_region (const_gimple gs)
3580 GIMPLE_CHECK (gs, GIMPLE_RESX);
3581 return gs->gimple_eh_ctrl.region;
3584 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3586 static inline void
3587 gimple_resx_set_region (gimple gs, int region)
3589 GIMPLE_CHECK (gs, GIMPLE_RESX);
3590 gs->gimple_eh_ctrl.region = region;
3593 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3595 static inline int
3596 gimple_eh_dispatch_region (const_gimple gs)
3598 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3599 return gs->gimple_eh_ctrl.region;
3602 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3604 static inline void
3605 gimple_eh_dispatch_set_region (gimple gs, int region)
3607 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3608 gs->gimple_eh_ctrl.region = region;
3611 /* Return the number of labels associated with the switch statement GS. */
3613 static inline unsigned
3614 gimple_switch_num_labels (const_gimple gs)
3616 unsigned num_ops;
3617 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3618 num_ops = gimple_num_ops (gs);
3619 gcc_gimple_checking_assert (num_ops > 1);
3620 return num_ops - 1;
3624 /* Set NLABELS to be the number of labels for the switch statement GS. */
3626 static inline void
3627 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3629 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3630 gimple_set_num_ops (g, nlabels + 1);
3634 /* Return the index variable used by the switch statement GS. */
3636 static inline tree
3637 gimple_switch_index (const_gimple gs)
3639 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3640 return gimple_op (gs, 0);
3644 /* Return a pointer to the index variable for the switch statement GS. */
3646 static inline tree *
3647 gimple_switch_index_ptr (const_gimple gs)
3649 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3650 return gimple_op_ptr (gs, 0);
3654 /* Set INDEX to be the index variable for switch statement GS. */
3656 static inline void
3657 gimple_switch_set_index (gimple gs, tree index)
3659 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3660 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3661 gimple_set_op (gs, 0, index);
3665 /* Return the label numbered INDEX. The default label is 0, followed by any
3666 labels in a switch statement. */
3668 static inline tree
3669 gimple_switch_label (const_gimple gs, unsigned index)
3671 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3672 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3673 return gimple_op (gs, index + 1);
3676 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3678 static inline void
3679 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3681 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3682 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3683 && (label == NULL_TREE
3684 || TREE_CODE (label) == CASE_LABEL_EXPR));
3685 gimple_set_op (gs, index + 1, label);
3688 /* Return the default label for a switch statement. */
3690 static inline tree
3691 gimple_switch_default_label (const_gimple gs)
3693 tree label = gimple_switch_label (gs, 0);
3694 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3695 return label;
3698 /* Set the default label for a switch statement. */
3700 static inline void
3701 gimple_switch_set_default_label (gimple gs, tree label)
3703 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3704 gimple_switch_set_label (gs, 0, label);
3707 /* Return true if GS is a GIMPLE_DEBUG statement. */
3709 static inline bool
3710 is_gimple_debug (const_gimple gs)
3712 return gimple_code (gs) == GIMPLE_DEBUG;
3715 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3717 static inline bool
3718 gimple_debug_bind_p (const_gimple s)
3720 if (is_gimple_debug (s))
3721 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3723 return false;
3726 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3728 static inline tree
3729 gimple_debug_bind_get_var (gimple dbg)
3731 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3732 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3733 return gimple_op (dbg, 0);
3736 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3737 statement. */
3739 static inline tree
3740 gimple_debug_bind_get_value (gimple dbg)
3742 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3743 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3744 return gimple_op (dbg, 1);
3747 /* Return a pointer to the value bound to the variable in a
3748 GIMPLE_DEBUG bind statement. */
3750 static inline tree *
3751 gimple_debug_bind_get_value_ptr (gimple dbg)
3753 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3754 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3755 return gimple_op_ptr (dbg, 1);
3758 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3760 static inline void
3761 gimple_debug_bind_set_var (gimple dbg, tree var)
3763 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3764 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3765 gimple_set_op (dbg, 0, var);
3768 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3769 statement. */
3771 static inline void
3772 gimple_debug_bind_set_value (gimple dbg, tree value)
3774 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3775 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3776 gimple_set_op (dbg, 1, value);
3779 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3780 optimized away. */
3781 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3783 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3784 statement. */
3786 static inline void
3787 gimple_debug_bind_reset_value (gimple dbg)
3789 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3790 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3791 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3794 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3795 value. */
3797 static inline bool
3798 gimple_debug_bind_has_value_p (gimple dbg)
3800 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3801 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3802 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3805 #undef GIMPLE_DEBUG_BIND_NOVALUE
3807 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3809 static inline bool
3810 gimple_debug_source_bind_p (const_gimple s)
3812 if (is_gimple_debug (s))
3813 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3815 return false;
3818 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3820 static inline tree
3821 gimple_debug_source_bind_get_var (gimple dbg)
3823 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3824 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3825 return gimple_op (dbg, 0);
3828 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3829 statement. */
3831 static inline tree
3832 gimple_debug_source_bind_get_value (gimple dbg)
3834 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3835 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3836 return gimple_op (dbg, 1);
3839 /* Return a pointer to the value bound to the variable in a
3840 GIMPLE_DEBUG source bind statement. */
3842 static inline tree *
3843 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3845 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3846 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3847 return gimple_op_ptr (dbg, 1);
3850 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3852 static inline void
3853 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3855 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3856 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3857 gimple_set_op (dbg, 0, var);
3860 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3861 statement. */
3863 static inline void
3864 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3866 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3867 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3868 gimple_set_op (dbg, 1, value);
3871 /* Return a pointer to the body for the OMP statement GS. */
3873 static inline gimple_seq *
3874 gimple_omp_body_ptr (gimple gs)
3876 return &gs->omp.body;
3879 /* Return the body for the OMP statement GS. */
3881 static inline gimple_seq
3882 gimple_omp_body (gimple gs)
3884 return *gimple_omp_body_ptr (gs);
3887 /* Set BODY to be the body for the OMP statement GS. */
3889 static inline void
3890 gimple_omp_set_body (gimple gs, gimple_seq body)
3892 gs->omp.body = body;
3896 /* Return the name associated with OMP_CRITICAL statement GS. */
3898 static inline tree
3899 gimple_omp_critical_name (const_gimple gs)
3901 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3902 return gs->gimple_omp_critical.name;
3906 /* Return a pointer to the name associated with OMP critical statement GS. */
3908 static inline tree *
3909 gimple_omp_critical_name_ptr (gimple gs)
3911 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3912 return &gs->gimple_omp_critical.name;
3916 /* Set NAME to be the name associated with OMP critical statement GS. */
3918 static inline void
3919 gimple_omp_critical_set_name (gimple gs, tree name)
3921 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3922 gs->gimple_omp_critical.name = name;
3926 /* Return the kind of OMP for statemement. */
3928 static inline int
3929 gimple_omp_for_kind (const_gimple g)
3931 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3932 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
3936 /* Set the OMP for kind. */
3938 static inline void
3939 gimple_omp_for_set_kind (gimple g, int kind)
3941 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3942 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_FOR_KIND_MASK)
3943 | (kind & GF_OMP_FOR_KIND_MASK);
3947 /* Return the clauses associated with OMP_FOR GS. */
3949 static inline tree
3950 gimple_omp_for_clauses (const_gimple gs)
3952 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3953 return gs->gimple_omp_for.clauses;
3957 /* Return a pointer to the OMP_FOR GS. */
3959 static inline tree *
3960 gimple_omp_for_clauses_ptr (gimple gs)
3962 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3963 return &gs->gimple_omp_for.clauses;
3967 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3969 static inline void
3970 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3972 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3973 gs->gimple_omp_for.clauses = clauses;
3977 /* Get the collapse count of OMP_FOR GS. */
3979 static inline size_t
3980 gimple_omp_for_collapse (gimple gs)
3982 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3983 return gs->gimple_omp_for.collapse;
3987 /* Return the index variable for OMP_FOR GS. */
3989 static inline tree
3990 gimple_omp_for_index (const_gimple gs, size_t i)
3992 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3993 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3994 return gs->gimple_omp_for.iter[i].index;
3998 /* Return a pointer to the index variable for OMP_FOR GS. */
4000 static inline tree *
4001 gimple_omp_for_index_ptr (gimple gs, size_t i)
4003 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4004 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4005 return &gs->gimple_omp_for.iter[i].index;
4009 /* Set INDEX to be the index variable for OMP_FOR GS. */
4011 static inline void
4012 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4014 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4015 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4016 gs->gimple_omp_for.iter[i].index = index;
4020 /* Return the initial value for OMP_FOR GS. */
4022 static inline tree
4023 gimple_omp_for_initial (const_gimple gs, size_t i)
4025 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4026 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4027 return gs->gimple_omp_for.iter[i].initial;
4031 /* Return a pointer to the initial value for OMP_FOR GS. */
4033 static inline tree *
4034 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4036 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4037 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4038 return &gs->gimple_omp_for.iter[i].initial;
4042 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4044 static inline void
4045 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4047 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4048 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4049 gs->gimple_omp_for.iter[i].initial = initial;
4053 /* Return the final value for OMP_FOR GS. */
4055 static inline tree
4056 gimple_omp_for_final (const_gimple gs, size_t i)
4058 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4059 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4060 return gs->gimple_omp_for.iter[i].final;
4064 /* Return a pointer to the final value for OMP_FOR GS. */
4066 static inline tree *
4067 gimple_omp_for_final_ptr (gimple gs, size_t i)
4069 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4070 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4071 return &gs->gimple_omp_for.iter[i].final;
4075 /* Set FINAL to be the final value for OMP_FOR GS. */
4077 static inline void
4078 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4080 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4081 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4082 gs->gimple_omp_for.iter[i].final = final;
4086 /* Return the increment value for OMP_FOR GS. */
4088 static inline tree
4089 gimple_omp_for_incr (const_gimple gs, size_t i)
4091 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4092 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4093 return gs->gimple_omp_for.iter[i].incr;
4097 /* Return a pointer to the increment value for OMP_FOR GS. */
4099 static inline tree *
4100 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4102 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4103 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4104 return &gs->gimple_omp_for.iter[i].incr;
4108 /* Set INCR to be the increment value for OMP_FOR GS. */
4110 static inline void
4111 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4113 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4114 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4115 gs->gimple_omp_for.iter[i].incr = incr;
4119 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4120 statement GS starts. */
4122 static inline gimple_seq *
4123 gimple_omp_for_pre_body_ptr (gimple gs)
4125 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4126 return &gs->gimple_omp_for.pre_body;
4130 /* Return the sequence of statements to execute before the OMP_FOR
4131 statement GS starts. */
4133 static inline gimple_seq
4134 gimple_omp_for_pre_body (gimple gs)
4136 return *gimple_omp_for_pre_body_ptr (gs);
4140 /* Set PRE_BODY to be the sequence of statements to execute before the
4141 OMP_FOR statement GS starts. */
4143 static inline void
4144 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4146 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4147 gs->gimple_omp_for.pre_body = pre_body;
4151 /* Return the clauses associated with OMP_PARALLEL GS. */
4153 static inline tree
4154 gimple_omp_parallel_clauses (const_gimple gs)
4156 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4157 return gs->gimple_omp_parallel.clauses;
4161 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4163 static inline tree *
4164 gimple_omp_parallel_clauses_ptr (gimple gs)
4166 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4167 return &gs->gimple_omp_parallel.clauses;
4171 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4172 GS. */
4174 static inline void
4175 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4177 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4178 gs->gimple_omp_parallel.clauses = clauses;
4182 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4184 static inline tree
4185 gimple_omp_parallel_child_fn (const_gimple gs)
4187 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4188 return gs->gimple_omp_parallel.child_fn;
4191 /* Return a pointer to the child function used to hold the body of
4192 OMP_PARALLEL GS. */
4194 static inline tree *
4195 gimple_omp_parallel_child_fn_ptr (gimple gs)
4197 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4198 return &gs->gimple_omp_parallel.child_fn;
4202 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4204 static inline void
4205 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4207 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4208 gs->gimple_omp_parallel.child_fn = child_fn;
4212 /* Return the artificial argument used to send variables and values
4213 from the parent to the children threads in OMP_PARALLEL GS. */
4215 static inline tree
4216 gimple_omp_parallel_data_arg (const_gimple gs)
4218 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4219 return gs->gimple_omp_parallel.data_arg;
4223 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4225 static inline tree *
4226 gimple_omp_parallel_data_arg_ptr (gimple gs)
4228 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4229 return &gs->gimple_omp_parallel.data_arg;
4233 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4235 static inline void
4236 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4238 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4239 gs->gimple_omp_parallel.data_arg = data_arg;
4243 /* Return the clauses associated with OMP_TASK GS. */
4245 static inline tree
4246 gimple_omp_task_clauses (const_gimple gs)
4248 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4249 return gs->gimple_omp_parallel.clauses;
4253 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4255 static inline tree *
4256 gimple_omp_task_clauses_ptr (gimple gs)
4258 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4259 return &gs->gimple_omp_parallel.clauses;
4263 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4264 GS. */
4266 static inline void
4267 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4269 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4270 gs->gimple_omp_parallel.clauses = clauses;
4274 /* Return the child function used to hold the body of OMP_TASK GS. */
4276 static inline tree
4277 gimple_omp_task_child_fn (const_gimple gs)
4279 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4280 return gs->gimple_omp_parallel.child_fn;
4283 /* Return a pointer to the child function used to hold the body of
4284 OMP_TASK GS. */
4286 static inline tree *
4287 gimple_omp_task_child_fn_ptr (gimple gs)
4289 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4290 return &gs->gimple_omp_parallel.child_fn;
4294 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4296 static inline void
4297 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4299 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4300 gs->gimple_omp_parallel.child_fn = child_fn;
4304 /* Return the artificial argument used to send variables and values
4305 from the parent to the children threads in OMP_TASK GS. */
4307 static inline tree
4308 gimple_omp_task_data_arg (const_gimple gs)
4310 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4311 return gs->gimple_omp_parallel.data_arg;
4315 /* Return a pointer to the data argument for OMP_TASK GS. */
4317 static inline tree *
4318 gimple_omp_task_data_arg_ptr (gimple gs)
4320 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4321 return &gs->gimple_omp_parallel.data_arg;
4325 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4327 static inline void
4328 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4330 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4331 gs->gimple_omp_parallel.data_arg = data_arg;
4335 /* Return the clauses associated with OMP_TASK GS. */
4337 static inline tree
4338 gimple_omp_taskreg_clauses (const_gimple gs)
4340 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4341 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4342 return gs->gimple_omp_parallel.clauses;
4346 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4348 static inline tree *
4349 gimple_omp_taskreg_clauses_ptr (gimple gs)
4351 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4352 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4353 return &gs->gimple_omp_parallel.clauses;
4357 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4358 GS. */
4360 static inline void
4361 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4363 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4364 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4365 gs->gimple_omp_parallel.clauses = clauses;
4369 /* Return the child function used to hold the body of OMP_TASK GS. */
4371 static inline tree
4372 gimple_omp_taskreg_child_fn (const_gimple gs)
4374 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4375 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4376 return gs->gimple_omp_parallel.child_fn;
4379 /* Return a pointer to the child function used to hold the body of
4380 OMP_TASK GS. */
4382 static inline tree *
4383 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4385 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4386 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4387 return &gs->gimple_omp_parallel.child_fn;
4391 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4393 static inline void
4394 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4396 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4397 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4398 gs->gimple_omp_parallel.child_fn = child_fn;
4402 /* Return the artificial argument used to send variables and values
4403 from the parent to the children threads in OMP_TASK GS. */
4405 static inline tree
4406 gimple_omp_taskreg_data_arg (const_gimple gs)
4408 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4409 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4410 return gs->gimple_omp_parallel.data_arg;
4414 /* Return a pointer to the data argument for OMP_TASK GS. */
4416 static inline tree *
4417 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4419 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4420 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4421 return &gs->gimple_omp_parallel.data_arg;
4425 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4427 static inline void
4428 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4430 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4431 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4432 gs->gimple_omp_parallel.data_arg = data_arg;
4436 /* Return the copy function used to hold the body of OMP_TASK GS. */
4438 static inline tree
4439 gimple_omp_task_copy_fn (const_gimple gs)
4441 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4442 return gs->gimple_omp_task.copy_fn;
4445 /* Return a pointer to the copy function used to hold the body of
4446 OMP_TASK GS. */
4448 static inline tree *
4449 gimple_omp_task_copy_fn_ptr (gimple gs)
4451 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4452 return &gs->gimple_omp_task.copy_fn;
4456 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4458 static inline void
4459 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4461 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4462 gs->gimple_omp_task.copy_fn = copy_fn;
4466 /* Return size of the data block in bytes in OMP_TASK GS. */
4468 static inline tree
4469 gimple_omp_task_arg_size (const_gimple gs)
4471 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4472 return gs->gimple_omp_task.arg_size;
4476 /* Return a pointer to the data block size for OMP_TASK GS. */
4478 static inline tree *
4479 gimple_omp_task_arg_size_ptr (gimple gs)
4481 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4482 return &gs->gimple_omp_task.arg_size;
4486 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4488 static inline void
4489 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4491 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4492 gs->gimple_omp_task.arg_size = arg_size;
4496 /* Return align of the data block in bytes in OMP_TASK GS. */
4498 static inline tree
4499 gimple_omp_task_arg_align (const_gimple gs)
4501 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4502 return gs->gimple_omp_task.arg_align;
4506 /* Return a pointer to the data block align for OMP_TASK GS. */
4508 static inline tree *
4509 gimple_omp_task_arg_align_ptr (gimple gs)
4511 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4512 return &gs->gimple_omp_task.arg_align;
4516 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4518 static inline void
4519 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4521 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4522 gs->gimple_omp_task.arg_align = arg_align;
4526 /* Return the clauses associated with OMP_SINGLE GS. */
4528 static inline tree
4529 gimple_omp_single_clauses (const_gimple gs)
4531 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4532 return gs->gimple_omp_single.clauses;
4536 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4538 static inline tree *
4539 gimple_omp_single_clauses_ptr (gimple gs)
4541 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4542 return &gs->gimple_omp_single.clauses;
4546 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4548 static inline void
4549 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4551 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4552 gs->gimple_omp_single.clauses = clauses;
4556 /* Return the clauses associated with OMP_SECTIONS GS. */
4558 static inline tree
4559 gimple_omp_sections_clauses (const_gimple gs)
4561 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4562 return gs->gimple_omp_sections.clauses;
4566 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4568 static inline tree *
4569 gimple_omp_sections_clauses_ptr (gimple gs)
4571 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4572 return &gs->gimple_omp_sections.clauses;
4576 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4577 GS. */
4579 static inline void
4580 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4582 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4583 gs->gimple_omp_sections.clauses = clauses;
4587 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4588 in GS. */
4590 static inline tree
4591 gimple_omp_sections_control (const_gimple gs)
4593 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4594 return gs->gimple_omp_sections.control;
4598 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4599 GS. */
4601 static inline tree *
4602 gimple_omp_sections_control_ptr (gimple gs)
4604 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4605 return &gs->gimple_omp_sections.control;
4609 /* Set CONTROL to be the set of clauses associated with the
4610 GIMPLE_OMP_SECTIONS in GS. */
4612 static inline void
4613 gimple_omp_sections_set_control (gimple gs, tree control)
4615 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4616 gs->gimple_omp_sections.control = control;
4620 /* Set COND to be the condition code for OMP_FOR GS. */
4622 static inline void
4623 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4625 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4626 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4627 && i < gs->gimple_omp_for.collapse);
4628 gs->gimple_omp_for.iter[i].cond = cond;
4632 /* Return the condition code associated with OMP_FOR GS. */
4634 static inline enum tree_code
4635 gimple_omp_for_cond (const_gimple gs, size_t i)
4637 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4638 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4639 return gs->gimple_omp_for.iter[i].cond;
4643 /* Set the value being stored in an atomic store. */
4645 static inline void
4646 gimple_omp_atomic_store_set_val (gimple g, tree val)
4648 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4649 g->gimple_omp_atomic_store.val = val;
4653 /* Return the value being stored in an atomic store. */
4655 static inline tree
4656 gimple_omp_atomic_store_val (const_gimple g)
4658 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4659 return g->gimple_omp_atomic_store.val;
4663 /* Return a pointer to the value being stored in an atomic store. */
4665 static inline tree *
4666 gimple_omp_atomic_store_val_ptr (gimple g)
4668 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4669 return &g->gimple_omp_atomic_store.val;
4673 /* Set the LHS of an atomic load. */
4675 static inline void
4676 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4678 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4679 g->gimple_omp_atomic_load.lhs = lhs;
4683 /* Get the LHS of an atomic load. */
4685 static inline tree
4686 gimple_omp_atomic_load_lhs (const_gimple g)
4688 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4689 return g->gimple_omp_atomic_load.lhs;
4693 /* Return a pointer to the LHS of an atomic load. */
4695 static inline tree *
4696 gimple_omp_atomic_load_lhs_ptr (gimple g)
4698 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4699 return &g->gimple_omp_atomic_load.lhs;
4703 /* Set the RHS of an atomic load. */
4705 static inline void
4706 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4708 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4709 g->gimple_omp_atomic_load.rhs = rhs;
4713 /* Get the RHS of an atomic load. */
4715 static inline tree
4716 gimple_omp_atomic_load_rhs (const_gimple g)
4718 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4719 return g->gimple_omp_atomic_load.rhs;
4723 /* Return a pointer to the RHS of an atomic load. */
4725 static inline tree *
4726 gimple_omp_atomic_load_rhs_ptr (gimple g)
4728 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4729 return &g->gimple_omp_atomic_load.rhs;
4733 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4735 static inline tree
4736 gimple_omp_continue_control_def (const_gimple g)
4738 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4739 return g->gimple_omp_continue.control_def;
4742 /* The same as above, but return the address. */
4744 static inline tree *
4745 gimple_omp_continue_control_def_ptr (gimple g)
4747 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4748 return &g->gimple_omp_continue.control_def;
4751 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4753 static inline void
4754 gimple_omp_continue_set_control_def (gimple g, tree def)
4756 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4757 g->gimple_omp_continue.control_def = def;
4761 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4763 static inline tree
4764 gimple_omp_continue_control_use (const_gimple g)
4766 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4767 return g->gimple_omp_continue.control_use;
4771 /* The same as above, but return the address. */
4773 static inline tree *
4774 gimple_omp_continue_control_use_ptr (gimple g)
4776 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4777 return &g->gimple_omp_continue.control_use;
4781 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4783 static inline void
4784 gimple_omp_continue_set_control_use (gimple g, tree use)
4786 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4787 g->gimple_omp_continue.control_use = use;
4790 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4792 static inline gimple_seq *
4793 gimple_transaction_body_ptr (gimple gs)
4795 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4796 return &gs->gimple_transaction.body;
4799 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4801 static inline gimple_seq
4802 gimple_transaction_body (gimple gs)
4804 return *gimple_transaction_body_ptr (gs);
4807 /* Return the label associated with a GIMPLE_TRANSACTION. */
4809 static inline tree
4810 gimple_transaction_label (const_gimple gs)
4812 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4813 return gs->gimple_transaction.label;
4816 static inline tree *
4817 gimple_transaction_label_ptr (gimple gs)
4819 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4820 return &gs->gimple_transaction.label;
4823 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4825 static inline unsigned int
4826 gimple_transaction_subcode (const_gimple gs)
4828 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4829 return gs->gsbase.subcode;
4832 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4834 static inline void
4835 gimple_transaction_set_body (gimple gs, gimple_seq body)
4837 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4838 gs->gimple_transaction.body = body;
4841 /* Set the label associated with a GIMPLE_TRANSACTION. */
4843 static inline void
4844 gimple_transaction_set_label (gimple gs, tree label)
4846 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4847 gs->gimple_transaction.label = label;
4850 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4852 static inline void
4853 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4855 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4856 gs->gsbase.subcode = subcode;
4860 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4862 static inline tree *
4863 gimple_return_retval_ptr (const_gimple gs)
4865 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4866 return gimple_op_ptr (gs, 0);
4869 /* Return the return value for GIMPLE_RETURN GS. */
4871 static inline tree
4872 gimple_return_retval (const_gimple gs)
4874 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4875 return gimple_op (gs, 0);
4879 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4881 static inline void
4882 gimple_return_set_retval (gimple gs, tree retval)
4884 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4885 gimple_set_op (gs, 0, retval);
4889 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4891 #define CASE_GIMPLE_OMP \
4892 case GIMPLE_OMP_PARALLEL: \
4893 case GIMPLE_OMP_TASK: \
4894 case GIMPLE_OMP_FOR: \
4895 case GIMPLE_OMP_SECTIONS: \
4896 case GIMPLE_OMP_SECTIONS_SWITCH: \
4897 case GIMPLE_OMP_SINGLE: \
4898 case GIMPLE_OMP_SECTION: \
4899 case GIMPLE_OMP_MASTER: \
4900 case GIMPLE_OMP_ORDERED: \
4901 case GIMPLE_OMP_CRITICAL: \
4902 case GIMPLE_OMP_RETURN: \
4903 case GIMPLE_OMP_ATOMIC_LOAD: \
4904 case GIMPLE_OMP_ATOMIC_STORE: \
4905 case GIMPLE_OMP_CONTINUE
4907 static inline bool
4908 is_gimple_omp (const_gimple stmt)
4910 switch (gimple_code (stmt))
4912 CASE_GIMPLE_OMP:
4913 return true;
4914 default:
4915 return false;
4920 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4922 static inline bool
4923 gimple_nop_p (const_gimple g)
4925 return gimple_code (g) == GIMPLE_NOP;
4929 /* Return true if GS is a GIMPLE_RESX. */
4931 static inline bool
4932 is_gimple_resx (const_gimple gs)
4934 return gimple_code (gs) == GIMPLE_RESX;
4937 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4939 static inline enum br_predictor
4940 gimple_predict_predictor (gimple gs)
4942 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4943 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4947 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4949 static inline void
4950 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4952 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4953 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4954 | (unsigned) predictor;
4958 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4960 static inline enum prediction
4961 gimple_predict_outcome (gimple gs)
4963 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4964 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4968 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4970 static inline void
4971 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4973 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4974 if (outcome == TAKEN)
4975 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4976 else
4977 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4981 /* Return the type of the main expression computed by STMT. Return
4982 void_type_node if the statement computes nothing. */
4984 static inline tree
4985 gimple_expr_type (const_gimple stmt)
4987 enum gimple_code code = gimple_code (stmt);
4989 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4991 tree type;
4992 /* In general we want to pass out a type that can be substituted
4993 for both the RHS and the LHS types if there is a possibly
4994 useless conversion involved. That means returning the
4995 original RHS type as far as we can reconstruct it. */
4996 if (code == GIMPLE_CALL)
4997 type = gimple_call_return_type (stmt);
4998 else
4999 switch (gimple_assign_rhs_code (stmt))
5001 case POINTER_PLUS_EXPR:
5002 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5003 break;
5005 default:
5006 /* As fallback use the type of the LHS. */
5007 type = TREE_TYPE (gimple_get_lhs (stmt));
5008 break;
5010 return type;
5012 else if (code == GIMPLE_COND)
5013 return boolean_type_node;
5014 else
5015 return void_type_node;
5018 /* Return true if TYPE is a suitable type for a scalar register variable. */
5020 static inline bool
5021 is_gimple_reg_type (tree type)
5023 return !AGGREGATE_TYPE_P (type);
5026 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5028 static inline gimple_stmt_iterator
5029 gsi_start_1 (gimple_seq *seq)
5031 gimple_stmt_iterator i;
5033 i.ptr = gimple_seq_first (*seq);
5034 i.seq = seq;
5035 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5037 return i;
5040 #define gsi_start(x) gsi_start_1(&(x))
5042 static inline gimple_stmt_iterator
5043 gsi_none (void)
5045 gimple_stmt_iterator i;
5046 i.ptr = NULL;
5047 i.seq = NULL;
5048 i.bb = NULL;
5049 return i;
5052 /* Return a new iterator pointing to the first statement in basic block BB. */
5054 static inline gimple_stmt_iterator
5055 gsi_start_bb (basic_block bb)
5057 gimple_stmt_iterator i;
5058 gimple_seq *seq;
5060 seq = bb_seq_addr (bb);
5061 i.ptr = gimple_seq_first (*seq);
5062 i.seq = seq;
5063 i.bb = bb;
5065 return i;
5069 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5071 static inline gimple_stmt_iterator
5072 gsi_last_1 (gimple_seq *seq)
5074 gimple_stmt_iterator i;
5076 i.ptr = gimple_seq_last (*seq);
5077 i.seq = seq;
5078 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5080 return i;
5083 #define gsi_last(x) gsi_last_1(&(x))
5085 /* Return a new iterator pointing to the last statement in basic block BB. */
5087 static inline gimple_stmt_iterator
5088 gsi_last_bb (basic_block bb)
5090 gimple_stmt_iterator i;
5091 gimple_seq *seq;
5093 seq = bb_seq_addr (bb);
5094 i.ptr = gimple_seq_last (*seq);
5095 i.seq = seq;
5096 i.bb = bb;
5098 return i;
5102 /* Return true if I is at the end of its sequence. */
5104 static inline bool
5105 gsi_end_p (gimple_stmt_iterator i)
5107 return i.ptr == NULL;
5111 /* Return true if I is one statement before the end of its sequence. */
5113 static inline bool
5114 gsi_one_before_end_p (gimple_stmt_iterator i)
5116 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5120 /* Advance the iterator to the next gimple statement. */
5122 static inline void
5123 gsi_next (gimple_stmt_iterator *i)
5125 i->ptr = i->ptr->gsbase.next;
5128 /* Advance the iterator to the previous gimple statement. */
5130 static inline void
5131 gsi_prev (gimple_stmt_iterator *i)
5133 gimple prev = i->ptr->gsbase.prev;
5134 if (prev->gsbase.next)
5135 i->ptr = prev;
5136 else
5137 i->ptr = NULL;
5140 /* Return the current stmt. */
5142 static inline gimple
5143 gsi_stmt (gimple_stmt_iterator i)
5145 return i.ptr;
5148 /* Return a block statement iterator that points to the first non-label
5149 statement in block BB. */
5151 static inline gimple_stmt_iterator
5152 gsi_after_labels (basic_block bb)
5154 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5156 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5157 gsi_next (&gsi);
5159 return gsi;
5162 /* Advance the iterator to the next non-debug gimple statement. */
5164 static inline void
5165 gsi_next_nondebug (gimple_stmt_iterator *i)
5169 gsi_next (i);
5171 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5174 /* Advance the iterator to the next non-debug gimple statement. */
5176 static inline void
5177 gsi_prev_nondebug (gimple_stmt_iterator *i)
5181 gsi_prev (i);
5183 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5186 /* Return a new iterator pointing to the first non-debug statement in
5187 basic block BB. */
5189 static inline gimple_stmt_iterator
5190 gsi_start_nondebug_bb (basic_block bb)
5192 gimple_stmt_iterator i = gsi_start_bb (bb);
5194 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5195 gsi_next_nondebug (&i);
5197 return i;
5200 /* Return a new iterator pointing to the last non-debug statement in
5201 basic block BB. */
5203 static inline gimple_stmt_iterator
5204 gsi_last_nondebug_bb (basic_block bb)
5206 gimple_stmt_iterator i = gsi_last_bb (bb);
5208 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5209 gsi_prev_nondebug (&i);
5211 return i;
5215 /* Return the basic block associated with this iterator. */
5217 static inline basic_block
5218 gsi_bb (gimple_stmt_iterator i)
5220 return i.bb;
5224 /* Return the sequence associated with this iterator. */
5226 static inline gimple_seq
5227 gsi_seq (gimple_stmt_iterator i)
5229 return *i.seq;
5233 enum gsi_iterator_update
5235 GSI_NEW_STMT, /* Only valid when single statement is added, move
5236 iterator to it. */
5237 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5238 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5239 for linking other statements in the same
5240 direction. */
5243 /* In gimple-iterator.c */
5244 gimple_stmt_iterator gsi_start_phis (basic_block);
5245 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5246 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5247 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5248 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5249 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5250 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5251 enum gsi_iterator_update);
5252 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5253 enum gsi_iterator_update);
5254 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5255 enum gsi_iterator_update);
5256 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5257 enum gsi_iterator_update);
5258 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5259 enum gsi_iterator_update);
5260 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5261 enum gsi_iterator_update);
5262 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5263 enum gsi_iterator_update);
5264 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5265 enum gsi_iterator_update);
5266 bool gsi_remove (gimple_stmt_iterator *, bool);
5267 gimple_stmt_iterator gsi_for_stmt (gimple);
5268 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5269 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5270 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5271 void gsi_insert_on_edge (edge, gimple);
5272 void gsi_insert_seq_on_edge (edge, gimple_seq);
5273 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5274 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5275 void gsi_commit_one_edge_insert (edge, basic_block *);
5276 void gsi_commit_edge_inserts (void);
5277 gimple gimple_call_copy_skip_args (gimple, bitmap);
5280 /* Convenience routines to walk all statements of a gimple function.
5281 Note that this is useful exclusively before the code is converted
5282 into SSA form. Once the program is in SSA form, the standard
5283 operand interface should be used to analyze/modify statements. */
5284 struct walk_stmt_info
5286 /* Points to the current statement being walked. */
5287 gimple_stmt_iterator gsi;
5289 /* Additional data that the callback functions may want to carry
5290 through the recursion. */
5291 void *info;
5293 /* Pointer map used to mark visited tree nodes when calling
5294 walk_tree on each operand. If set to NULL, duplicate tree nodes
5295 will be visited more than once. */
5296 struct pointer_set_t *pset;
5298 /* Operand returned by the callbacks. This is set when calling
5299 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5300 returns non-NULL, this field will contain the tree returned by
5301 the last callback. */
5302 tree callback_result;
5304 /* Indicates whether the operand being examined may be replaced
5305 with something that matches is_gimple_val (if true) or something
5306 slightly more complicated (if false). "Something" technically
5307 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5308 but we never try to form anything more complicated than that, so
5309 we don't bother checking.
5311 Also note that CALLBACK should update this flag while walking the
5312 sub-expressions of a statement. For instance, when walking the
5313 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5314 to true, however, when walking &var, the operand of that
5315 ADDR_EXPR does not need to be a GIMPLE value. */
5316 BOOL_BITFIELD val_only : 1;
5318 /* True if we are currently walking the LHS of an assignment. */
5319 BOOL_BITFIELD is_lhs : 1;
5321 /* Optional. Set to true by the callback functions if they made any
5322 changes. */
5323 BOOL_BITFIELD changed : 1;
5325 /* True if we're interested in location information. */
5326 BOOL_BITFIELD want_locations : 1;
5328 /* True if we've removed the statement that was processed. */
5329 BOOL_BITFIELD removed_stmt : 1;
5332 /* Callback for walk_gimple_stmt. Called for every statement found
5333 during traversal. The first argument points to the statement to
5334 walk. The second argument is a flag that the callback sets to
5335 'true' if it the callback handled all the operands and
5336 sub-statements of the statement (the default value of this flag is
5337 'false'). The third argument is an anonymous pointer to data
5338 to be used by the callback. */
5339 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5340 struct walk_stmt_info *);
5342 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5343 struct walk_stmt_info *);
5344 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5345 struct walk_stmt_info *);
5346 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5347 struct walk_stmt_info *);
5348 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5350 /* Enum and arrays used for allocation stats. Keep in sync with
5351 gimple.c:gimple_alloc_kind_names. */
5352 enum gimple_alloc_kind
5354 gimple_alloc_kind_assign, /* Assignments. */
5355 gimple_alloc_kind_phi, /* PHI nodes. */
5356 gimple_alloc_kind_cond, /* Conditionals. */
5357 gimple_alloc_kind_rest, /* Everything else. */
5358 gimple_alloc_kind_all
5361 extern int gimple_alloc_counts[];
5362 extern int gimple_alloc_sizes[];
5364 /* Return the allocation kind for a given stmt CODE. */
5365 static inline enum gimple_alloc_kind
5366 gimple_alloc_kind (enum gimple_code code)
5368 switch (code)
5370 case GIMPLE_ASSIGN:
5371 return gimple_alloc_kind_assign;
5372 case GIMPLE_PHI:
5373 return gimple_alloc_kind_phi;
5374 case GIMPLE_COND:
5375 return gimple_alloc_kind_cond;
5376 default:
5377 return gimple_alloc_kind_rest;
5381 extern void dump_gimple_statistics (void);
5383 /* In gimple-fold.c. */
5384 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5385 tree gimple_fold_builtin (gimple);
5386 bool fold_stmt (gimple_stmt_iterator *);
5387 bool fold_stmt_inplace (gimple_stmt_iterator *);
5388 tree get_symbol_constant_value (tree);
5389 tree canonicalize_constructor_val (tree, tree);
5390 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5391 enum tree_code, tree, tree);
5392 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5393 enum tree_code, tree, tree);
5395 bool gimple_val_nonnegative_real_p (tree);
5398 /* Set the location of all statements in SEQ to LOC. */
5400 static inline void
5401 gimple_seq_set_location (gimple_seq seq, location_t loc)
5403 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5404 gimple_set_location (gsi_stmt (i), loc);
5407 #endif /* GCC_GIMPLE_H */