Support slim switch for cfg graph dump
[official-gcc.git] / gcc / gimple.h
blob76da6d2bcd7dd3963430d162a4d637df3c7729a2
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 "vec.h"
27 #include "ggc.h"
28 #include "basic-block.h"
29 #include "tree.h"
30 #include "tree-ssa-operands.h"
31 #include "tree-ssa-alias.h"
32 #include "internal-fn.h"
34 typedef gimple gimple_seq_node;
36 /* Types of supported temporaries. GIMPLE temporaries may be symbols
37 in normal form (i.e., regular decls) or SSA names. This enum is
38 used by create_gimple_tmp to tell it what kind of temporary the
39 caller wants. */
40 enum ssa_mode {
41 M_SSA = 0,
42 M_NORMAL
45 /* For each block, the PHI nodes that need to be rewritten are stored into
46 these vectors. */
47 typedef vec<gimple> gimple_vec;
49 enum gimple_code {
50 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
51 #include "gimple.def"
52 #undef DEFGSCODE
53 LAST_AND_UNUSED_GIMPLE_CODE
56 extern const char *const gimple_code_name[];
57 extern const unsigned char gimple_rhs_class_table[];
59 /* Error out if a gimple tuple is addressed incorrectly. */
60 #if defined ENABLE_GIMPLE_CHECKING
61 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
62 extern void gimple_check_failed (const_gimple, const char *, int, \
63 const char *, enum gimple_code, \
64 enum tree_code) ATTRIBUTE_NORETURN;
66 #define GIMPLE_CHECK(GS, CODE) \
67 do { \
68 const_gimple __gs = (GS); \
69 if (gimple_code (__gs) != (CODE)) \
70 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
71 (CODE), ERROR_MARK); \
72 } while (0)
73 #else /* not ENABLE_GIMPLE_CHECKING */
74 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
75 #define GIMPLE_CHECK(GS, CODE) (void)0
76 #endif
78 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
79 get_gimple_rhs_class. */
80 enum gimple_rhs_class
82 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
83 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
84 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
85 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
86 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
87 name, a _DECL, a _REF, etc. */
90 /* Specific flags for individual GIMPLE statements. These flags are
91 always stored in gimple_statement_base.subcode and they may only be
92 defined for statement codes that do not use sub-codes.
94 Values for the masks can overlap as long as the overlapping values
95 are never used in the same statement class.
97 The maximum mask value that can be defined is 1 << 15 (i.e., each
98 statement code can hold up to 16 bitflags).
100 Keep this list sorted. */
101 enum gf_mask {
102 GF_ASM_INPUT = 1 << 0,
103 GF_ASM_VOLATILE = 1 << 1,
104 GF_CALL_FROM_THUNK = 1 << 0,
105 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
106 GF_CALL_TAILCALL = 1 << 2,
107 GF_CALL_VA_ARG_PACK = 1 << 3,
108 GF_CALL_NOTHROW = 1 << 4,
109 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
110 GF_CALL_INTERNAL = 1 << 6,
111 GF_OMP_PARALLEL_COMBINED = 1 << 0,
113 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
114 a thread synchronization via some sort of barrier. The exact barrier
115 that would otherwise be emitted is dependent on the OMP statement with
116 which this return is associated. */
117 GF_OMP_RETURN_NOWAIT = 1 << 0,
119 GF_OMP_SECTION_LAST = 1 << 0,
120 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
121 GF_PREDICT_TAKEN = 1 << 15
124 /* Currently, there are only two types of gimple debug stmt. Others are
125 envisioned, for example, to enable the generation of is_stmt notes
126 in line number information, to mark sequence points, etc. This
127 subcode is to be used to tell them apart. */
128 enum gimple_debug_subcode {
129 GIMPLE_DEBUG_BIND = 0,
130 GIMPLE_DEBUG_SOURCE_BIND = 1
133 /* Masks for selecting a pass local flag (PLF) to work on. These
134 masks are used by gimple_set_plf and gimple_plf. */
135 enum plf_mask {
136 GF_PLF_1 = 1 << 0,
137 GF_PLF_2 = 1 << 1
140 /* Iterator object for GIMPLE statement sequences. */
142 struct gimple_stmt_iterator_d
144 /* Sequence node holding the current statement. */
145 gimple_seq_node ptr;
147 /* Sequence and basic block holding the statement. These fields
148 are necessary to handle edge cases such as when statement is
149 added to an empty basic block or when the last statement of a
150 block/sequence is removed. */
151 gimple_seq *seq;
152 basic_block bb;
155 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
156 are for 64 bit hosts. */
158 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
159 /* [ WORD 1 ]
160 Main identifying code for a tuple. */
161 ENUM_BITFIELD(gimple_code) code : 8;
163 /* Nonzero if a warning should not be emitted on this tuple. */
164 unsigned int no_warning : 1;
166 /* Nonzero if this tuple has been visited. Passes are responsible
167 for clearing this bit before using it. */
168 unsigned int visited : 1;
170 /* Nonzero if this tuple represents a non-temporal move. */
171 unsigned int nontemporal_move : 1;
173 /* Pass local flags. These flags are free for any pass to use as
174 they see fit. Passes should not assume that these flags contain
175 any useful value when the pass starts. Any initial state that
176 the pass requires should be set on entry to the pass. See
177 gimple_set_plf and gimple_plf for usage. */
178 unsigned int plf : 2;
180 /* Nonzero if this statement has been modified and needs to have its
181 operands rescanned. */
182 unsigned modified : 1;
184 /* Nonzero if this statement contains volatile operands. */
185 unsigned has_volatile_ops : 1;
187 /* The SUBCODE field can be used for tuple-specific flags for tuples
188 that do not require subcodes. Note that SUBCODE should be at
189 least as wide as tree codes, as several tuples store tree codes
190 in there. */
191 unsigned int subcode : 16;
193 /* UID of this statement. This is used by passes that want to
194 assign IDs to statements. It must be assigned and used by each
195 pass. By default it should be assumed to contain garbage. */
196 unsigned uid;
198 /* [ WORD 2 ]
199 Locus information for debug info. */
200 location_t location;
202 /* Number of operands in this tuple. */
203 unsigned num_ops;
205 /* [ WORD 3 ]
206 Basic block holding this statement. */
207 basic_block bb;
209 /* [ WORD 4-5 ]
210 Linked lists of gimple statements. The next pointers form
211 a NULL terminated list, the prev pointers are a cyclic list.
212 A gimple statement is hence also a double-ended list of
213 statements, with the pointer itself being the first element,
214 and the prev pointer being the last. */
215 gimple next;
216 gimple GTY((skip)) prev;
220 /* Base structure for tuples with operands. */
222 struct GTY(()) gimple_statement_with_ops_base
224 /* [ WORD 1-6 ] */
225 struct gimple_statement_base gsbase;
227 /* [ WORD 7 ]
228 SSA operand vectors. NOTE: It should be possible to
229 amalgamate these vectors with the operand vector OP. However,
230 the SSA operand vectors are organized differently and contain
231 more information (like immediate use chaining). */
232 struct use_optype_d GTY((skip (""))) *use_ops;
236 /* Statements that take register operands. */
238 struct GTY(()) gimple_statement_with_ops
240 /* [ WORD 1-7 ] */
241 struct gimple_statement_with_ops_base opbase;
243 /* [ WORD 8 ]
244 Operand vector. NOTE! This must always be the last field
245 of this structure. In particular, this means that this
246 structure cannot be embedded inside another one. */
247 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
251 /* Base for statements that take both memory and register operands. */
253 struct GTY(()) gimple_statement_with_memory_ops_base
255 /* [ WORD 1-7 ] */
256 struct gimple_statement_with_ops_base opbase;
258 /* [ WORD 8-9 ]
259 Virtual operands for this statement. The GC will pick them
260 up via the ssa_names array. */
261 tree GTY((skip (""))) vdef;
262 tree GTY((skip (""))) vuse;
266 /* Statements that take both memory and register operands. */
268 struct GTY(()) gimple_statement_with_memory_ops
270 /* [ WORD 1-9 ] */
271 struct gimple_statement_with_memory_ops_base membase;
273 /* [ WORD 10 ]
274 Operand vector. NOTE! This must always be the last field
275 of this structure. In particular, this means that this
276 structure cannot be embedded inside another one. */
277 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
281 /* Call statements that take both memory and register operands. */
283 struct GTY(()) gimple_statement_call
285 /* [ WORD 1-9 ] */
286 struct gimple_statement_with_memory_ops_base membase;
288 /* [ WORD 10-13 ] */
289 struct pt_solution call_used;
290 struct pt_solution call_clobbered;
292 /* [ WORD 14 ] */
293 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
294 tree GTY ((tag ("0"))) fntype;
295 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
296 } u;
298 /* [ WORD 15 ]
299 Operand vector. NOTE! This must always be the last field
300 of this structure. In particular, this means that this
301 structure cannot be embedded inside another one. */
302 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
306 /* OpenMP statements (#pragma omp). */
308 struct GTY(()) gimple_statement_omp {
309 /* [ WORD 1-6 ] */
310 struct gimple_statement_base gsbase;
312 /* [ WORD 7 ] */
313 gimple_seq body;
317 /* GIMPLE_BIND */
319 struct GTY(()) gimple_statement_bind {
320 /* [ WORD 1-6 ] */
321 struct gimple_statement_base gsbase;
323 /* [ WORD 7 ]
324 Variables declared in this scope. */
325 tree vars;
327 /* [ WORD 8 ]
328 This is different than the BLOCK field in gimple_statement_base,
329 which is analogous to TREE_BLOCK (i.e., the lexical block holding
330 this statement). This field is the equivalent of BIND_EXPR_BLOCK
331 in tree land (i.e., the lexical scope defined by this bind). See
332 gimple-low.c. */
333 tree block;
335 /* [ WORD 9 ] */
336 gimple_seq body;
340 /* GIMPLE_CATCH */
342 struct GTY(()) gimple_statement_catch {
343 /* [ WORD 1-6 ] */
344 struct gimple_statement_base gsbase;
346 /* [ WORD 7 ] */
347 tree types;
349 /* [ WORD 8 ] */
350 gimple_seq handler;
354 /* GIMPLE_EH_FILTER */
356 struct GTY(()) gimple_statement_eh_filter {
357 /* [ WORD 1-6 ] */
358 struct gimple_statement_base gsbase;
360 /* [ WORD 7 ]
361 Filter types. */
362 tree types;
364 /* [ WORD 8 ]
365 Failure actions. */
366 gimple_seq failure;
369 /* GIMPLE_EH_ELSE */
371 struct GTY(()) gimple_statement_eh_else {
372 /* [ WORD 1-6 ] */
373 struct gimple_statement_base gsbase;
375 /* [ WORD 7,8 ] */
376 gimple_seq n_body, e_body;
379 /* GIMPLE_EH_MUST_NOT_THROW */
381 struct GTY(()) gimple_statement_eh_mnt {
382 /* [ WORD 1-6 ] */
383 struct gimple_statement_base gsbase;
385 /* [ WORD 7 ] Abort function decl. */
386 tree fndecl;
389 /* GIMPLE_PHI */
391 struct GTY(()) gimple_statement_phi {
392 /* [ WORD 1-6 ] */
393 struct gimple_statement_base gsbase;
395 /* [ WORD 7 ] */
396 unsigned capacity;
397 unsigned nargs;
399 /* [ WORD 8 ] */
400 tree result;
402 /* [ WORD 9 ] */
403 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
407 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
409 struct GTY(()) gimple_statement_eh_ctrl
411 /* [ WORD 1-6 ] */
412 struct gimple_statement_base gsbase;
414 /* [ WORD 7 ]
415 Exception region number. */
416 int region;
420 /* GIMPLE_TRY */
422 struct GTY(()) gimple_statement_try {
423 /* [ WORD 1-6 ] */
424 struct gimple_statement_base gsbase;
426 /* [ WORD 7 ]
427 Expression to evaluate. */
428 gimple_seq eval;
430 /* [ WORD 8 ]
431 Cleanup expression. */
432 gimple_seq cleanup;
435 /* Kind of GIMPLE_TRY statements. */
436 enum gimple_try_flags
438 /* A try/catch. */
439 GIMPLE_TRY_CATCH = 1 << 0,
441 /* A try/finally. */
442 GIMPLE_TRY_FINALLY = 1 << 1,
443 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
445 /* Analogous to TRY_CATCH_IS_CLEANUP. */
446 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
449 /* GIMPLE_WITH_CLEANUP_EXPR */
451 struct GTY(()) gimple_statement_wce {
452 /* [ WORD 1-6 ] */
453 struct gimple_statement_base gsbase;
455 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
456 executed if an exception is thrown, not on normal exit of its
457 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
458 in TARGET_EXPRs. */
460 /* [ WORD 7 ]
461 Cleanup expression. */
462 gimple_seq cleanup;
466 /* GIMPLE_ASM */
468 struct GTY(()) gimple_statement_asm
470 /* [ WORD 1-9 ] */
471 struct gimple_statement_with_memory_ops_base membase;
473 /* [ WORD 10 ]
474 __asm__ statement. */
475 const char *string;
477 /* [ WORD 11 ]
478 Number of inputs, outputs, clobbers, labels. */
479 unsigned char ni;
480 unsigned char no;
481 unsigned char nc;
482 unsigned char nl;
484 /* [ WORD 12 ]
485 Operand vector. NOTE! This must always be the last field
486 of this structure. In particular, this means that this
487 structure cannot be embedded inside another one. */
488 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
491 /* GIMPLE_OMP_CRITICAL */
493 struct GTY(()) gimple_statement_omp_critical {
494 /* [ WORD 1-7 ] */
495 struct gimple_statement_omp omp;
497 /* [ WORD 8 ]
498 Critical section name. */
499 tree name;
503 struct GTY(()) gimple_omp_for_iter {
504 /* Condition code. */
505 enum tree_code cond;
507 /* Index variable. */
508 tree index;
510 /* Initial value. */
511 tree initial;
513 /* Final value. */
514 tree final;
516 /* Increment. */
517 tree incr;
520 /* GIMPLE_OMP_FOR */
522 struct GTY(()) gimple_statement_omp_for {
523 /* [ WORD 1-7 ] */
524 struct gimple_statement_omp omp;
526 /* [ WORD 8 ] */
527 tree clauses;
529 /* [ WORD 9 ]
530 Number of elements in iter array. */
531 size_t collapse;
533 /* [ WORD 10 ] */
534 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
536 /* [ WORD 11 ]
537 Pre-body evaluated before the loop body begins. */
538 gimple_seq pre_body;
542 /* GIMPLE_OMP_PARALLEL */
544 struct GTY(()) gimple_statement_omp_parallel {
545 /* [ WORD 1-7 ] */
546 struct gimple_statement_omp omp;
548 /* [ WORD 8 ]
549 Clauses. */
550 tree clauses;
552 /* [ WORD 9 ]
553 Child function holding the body of the parallel region. */
554 tree child_fn;
556 /* [ WORD 10 ]
557 Shared data argument. */
558 tree data_arg;
562 /* GIMPLE_OMP_TASK */
564 struct GTY(()) gimple_statement_omp_task {
565 /* [ WORD 1-10 ] */
566 struct gimple_statement_omp_parallel par;
568 /* [ WORD 11 ]
569 Child function holding firstprivate initialization if needed. */
570 tree copy_fn;
572 /* [ WORD 12-13 ]
573 Size and alignment in bytes of the argument data block. */
574 tree arg_size;
575 tree arg_align;
579 /* GIMPLE_OMP_SECTION */
580 /* Uses struct gimple_statement_omp. */
583 /* GIMPLE_OMP_SECTIONS */
585 struct GTY(()) gimple_statement_omp_sections {
586 /* [ WORD 1-7 ] */
587 struct gimple_statement_omp omp;
589 /* [ WORD 8 ] */
590 tree clauses;
592 /* [ WORD 9 ]
593 The control variable used for deciding which of the sections to
594 execute. */
595 tree control;
598 /* GIMPLE_OMP_CONTINUE.
600 Note: This does not inherit from gimple_statement_omp, because we
601 do not need the body field. */
603 struct GTY(()) gimple_statement_omp_continue {
604 /* [ WORD 1-6 ] */
605 struct gimple_statement_base gsbase;
607 /* [ WORD 7 ] */
608 tree control_def;
610 /* [ WORD 8 ] */
611 tree control_use;
614 /* GIMPLE_OMP_SINGLE */
616 struct GTY(()) gimple_statement_omp_single {
617 /* [ WORD 1-7 ] */
618 struct gimple_statement_omp omp;
620 /* [ WORD 7 ] */
621 tree clauses;
625 /* GIMPLE_OMP_ATOMIC_LOAD.
626 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
627 contains a sequence, which we don't need here. */
629 struct GTY(()) gimple_statement_omp_atomic_load {
630 /* [ WORD 1-6 ] */
631 struct gimple_statement_base gsbase;
633 /* [ WORD 7-8 ] */
634 tree rhs, lhs;
637 /* GIMPLE_OMP_ATOMIC_STORE.
638 See note on GIMPLE_OMP_ATOMIC_LOAD. */
640 struct GTY(()) gimple_statement_omp_atomic_store {
641 /* [ WORD 1-6 ] */
642 struct gimple_statement_base gsbase;
644 /* [ WORD 7 ] */
645 tree val;
648 /* GIMPLE_TRANSACTION. */
650 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
652 /* The __transaction_atomic was declared [[outer]] or it is
653 __transaction_relaxed. */
654 #define GTMA_IS_OUTER (1u << 0)
655 #define GTMA_IS_RELAXED (1u << 1)
656 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
658 /* The transaction is seen to not have an abort. */
659 #define GTMA_HAVE_ABORT (1u << 2)
660 /* The transaction is seen to have loads or stores. */
661 #define GTMA_HAVE_LOAD (1u << 3)
662 #define GTMA_HAVE_STORE (1u << 4)
663 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
664 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
665 /* The transaction WILL enter serial irrevocable mode.
666 An irrevocable block post-dominates the entire transaction, such
667 that all invocations of the transaction will go serial-irrevocable.
668 In such case, we don't bother instrumenting the transaction, and
669 tell the runtime that it should begin the transaction in
670 serial-irrevocable mode. */
671 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
672 /* The transaction contains no instrumentation code whatsover, most
673 likely because it is guaranteed to go irrevocable upon entry. */
674 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
676 struct GTY(()) gimple_statement_transaction
678 /* [ WORD 1-9 ] */
679 struct gimple_statement_with_memory_ops_base gsbase;
681 /* [ WORD 10 ] */
682 gimple_seq body;
684 /* [ WORD 11 ] */
685 tree label;
688 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
689 enum gimple_statement_structure_enum {
690 #include "gsstruct.def"
691 LAST_GSS_ENUM
693 #undef DEFGSSTRUCT
696 /* Define the overall contents of a gimple tuple. It may be any of the
697 structures declared above for various types of tuples. */
699 union GTY ((desc ("gimple_statement_structure (&%h)"),
700 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
701 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
702 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
703 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
704 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
705 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
706 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
707 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
708 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
709 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
710 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
711 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
712 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
713 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
714 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
715 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
716 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
717 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
718 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
719 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
720 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
721 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
722 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
723 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
724 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
725 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
726 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
729 /* In gimple.c. */
731 /* Helper functions to build GIMPLE statements. */
732 tree create_gimple_tmp (tree, enum ssa_mode = M_SSA);
733 gimple build_assign (enum tree_code, tree, int, enum ssa_mode = M_SSA);
734 gimple build_assign (enum tree_code, gimple, int, enum ssa_mode = M_SSA);
735 gimple build_assign (enum tree_code, tree, tree, enum ssa_mode = M_SSA);
736 gimple build_assign (enum tree_code, gimple, tree, enum ssa_mode = M_SSA);
737 gimple build_assign (enum tree_code, tree, gimple, enum ssa_mode = M_SSA);
738 gimple build_assign (enum tree_code, gimple, gimple, enum ssa_mode = M_SSA);
739 gimple build_type_cast (tree, tree, enum ssa_mode = M_SSA);
740 gimple build_type_cast (tree, gimple, enum ssa_mode = M_SSA);
742 /* Offset in bytes to the location of the operand vector.
743 Zero if there is no operand vector for this tuple structure. */
744 extern size_t const gimple_ops_offset_[];
746 /* Map GIMPLE codes to GSS codes. */
747 extern enum gimple_statement_structure_enum const gss_for_code_[];
749 /* This variable holds the currently expanded gimple statement for purposes
750 of comminucating the profile info to the builtin expanders. */
751 extern gimple currently_expanding_gimple_stmt;
753 gimple gimple_build_return (tree);
755 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
756 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
758 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
760 gimple
761 gimple_build_assign_with_ops (enum tree_code, tree,
762 tree, tree CXX_MEM_STAT_INFO);
763 gimple
764 gimple_build_assign_with_ops (enum tree_code, tree,
765 tree, tree, tree CXX_MEM_STAT_INFO);
767 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
768 #define gimple_build_debug_bind(var,val,stmt) \
769 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
770 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
771 #define gimple_build_debug_source_bind(var,val,stmt) \
772 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
774 gimple gimple_build_call_vec (tree, vec<tree> );
775 gimple gimple_build_call (tree, unsigned, ...);
776 gimple gimple_build_call_valist (tree, unsigned, va_list);
777 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
778 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
779 gimple gimple_build_call_from_tree (tree);
780 gimple gimplify_assign (tree, tree, gimple_seq *);
781 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
782 gimple gimple_build_label (tree label);
783 gimple gimple_build_goto (tree dest);
784 gimple gimple_build_nop (void);
785 gimple gimple_build_bind (tree, gimple_seq, tree);
786 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
787 vec<tree, va_gc> *, vec<tree, va_gc> *,
788 vec<tree, va_gc> *);
789 gimple gimple_build_catch (tree, gimple_seq);
790 gimple gimple_build_eh_filter (tree, gimple_seq);
791 gimple gimple_build_eh_must_not_throw (tree);
792 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
793 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
794 gimple gimple_build_wce (gimple_seq);
795 gimple gimple_build_resx (int);
796 gimple gimple_build_eh_dispatch (int);
797 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
798 gimple gimple_build_switch (tree, tree, vec<tree> );
799 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
800 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
801 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
802 gimple gimple_build_omp_critical (gimple_seq, tree);
803 gimple gimple_build_omp_section (gimple_seq);
804 gimple gimple_build_omp_continue (tree, tree);
805 gimple gimple_build_omp_master (gimple_seq);
806 gimple gimple_build_omp_return (bool);
807 gimple gimple_build_omp_ordered (gimple_seq);
808 gimple gimple_build_omp_sections (gimple_seq, tree);
809 gimple gimple_build_omp_sections_switch (void);
810 gimple gimple_build_omp_single (gimple_seq, tree);
811 gimple gimple_build_cdt (tree, tree);
812 gimple gimple_build_omp_atomic_load (tree, tree);
813 gimple gimple_build_omp_atomic_store (tree);
814 gimple gimple_build_transaction (gimple_seq, tree);
815 gimple gimple_build_predict (enum br_predictor, enum prediction);
816 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
817 void sort_case_labels (vec<tree> );
818 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
819 void gimple_set_body (tree, gimple_seq);
820 gimple_seq gimple_body (tree);
821 bool gimple_has_body_p (tree);
822 gimple_seq gimple_seq_alloc (void);
823 void gimple_seq_free (gimple_seq);
824 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
825 gimple_seq gimple_seq_copy (gimple_seq);
826 bool gimple_call_same_target_p (const_gimple, const_gimple);
827 int gimple_call_flags (const_gimple);
828 int gimple_call_return_flags (const_gimple);
829 int gimple_call_arg_flags (const_gimple, unsigned);
830 void gimple_call_reset_alias_info (gimple);
831 bool gimple_assign_copy_p (gimple);
832 bool gimple_assign_ssa_name_copy_p (gimple);
833 bool gimple_assign_unary_nop_p (gimple);
834 void gimple_set_bb (gimple, basic_block);
835 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
836 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
837 tree, tree, tree);
838 tree gimple_get_lhs (const_gimple);
839 void gimple_set_lhs (gimple, tree);
840 void gimple_replace_lhs (gimple, tree);
841 gimple gimple_copy (gimple);
842 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
843 gimple gimple_build_cond_from_tree (tree, tree, tree);
844 void gimple_cond_set_condition_from_tree (gimple, tree);
845 bool gimple_has_side_effects (const_gimple);
846 bool gimple_could_trap_p (gimple);
847 bool gimple_could_trap_p_1 (gimple, bool, bool);
848 bool gimple_assign_rhs_could_trap_p (gimple);
849 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
850 bool empty_body_p (gimple_seq);
851 unsigned get_gimple_rhs_num_ops (enum tree_code);
852 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
853 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
854 const char *gimple_decl_printable_name (tree, int);
855 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
856 tree gimple_extract_devirt_binfo_from_cst (tree);
858 /* Returns true iff T is a scalar register variable. */
859 extern bool is_gimple_reg (tree);
860 /* Returns true iff T is any sort of variable. */
861 extern bool is_gimple_variable (tree);
862 /* Returns true iff T is any sort of symbol. */
863 extern bool is_gimple_id (tree);
864 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
865 extern bool is_gimple_min_lval (tree);
866 /* Returns true iff T is something whose address can be taken. */
867 extern bool is_gimple_addressable (tree);
868 /* Returns true iff T is any valid GIMPLE lvalue. */
869 extern bool is_gimple_lvalue (tree);
871 /* Returns true iff T is a GIMPLE address. */
872 bool is_gimple_address (const_tree);
873 /* Returns true iff T is a GIMPLE invariant address. */
874 bool is_gimple_invariant_address (const_tree);
875 /* Returns true iff T is a GIMPLE invariant address at interprocedural
876 level. */
877 bool is_gimple_ip_invariant_address (const_tree);
878 /* Returns true iff T is a valid GIMPLE constant. */
879 bool is_gimple_constant (const_tree);
880 /* Returns true iff T is a GIMPLE restricted function invariant. */
881 extern bool is_gimple_min_invariant (const_tree);
882 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
883 extern bool is_gimple_ip_invariant (const_tree);
884 /* Returns true iff T is a GIMPLE rvalue. */
885 extern bool is_gimple_val (tree);
886 /* Returns true iff T is a GIMPLE asm statement input. */
887 extern bool is_gimple_asm_val (tree);
888 /* Returns true iff T is a valid address operand of a MEM_REF. */
889 bool is_gimple_mem_ref_addr (tree);
891 /* Returns true iff T is a valid if-statement condition. */
892 extern bool is_gimple_condexpr (tree);
894 /* Returns true iff T is a valid call address expression. */
895 extern bool is_gimple_call_addr (tree);
897 /* Return TRUE iff stmt is a call to a built-in function. */
898 extern bool is_gimple_builtin_call (gimple stmt);
900 extern void recalculate_side_effects (tree);
901 extern bool gimple_compare_field_offset (tree, tree);
902 extern tree gimple_register_canonical_type (tree);
903 extern void print_gimple_types_stats (const char *);
904 extern void free_gimple_type_tables (void);
905 extern tree gimple_unsigned_type (tree);
906 extern tree gimple_signed_type (tree);
907 extern alias_set_type gimple_get_alias_set (tree);
908 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
909 unsigned *);
910 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
911 bool (*)(gimple, tree, void *),
912 bool (*)(gimple, tree, void *),
913 bool (*)(gimple, tree, void *));
914 extern bool walk_stmt_load_store_ops (gimple, void *,
915 bool (*)(gimple, tree, void *),
916 bool (*)(gimple, tree, void *));
917 extern bool gimple_ior_addresses_taken (bitmap, gimple);
918 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
919 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
920 extern bool gimple_asm_clobbers_memory_p (const_gimple);
922 /* In gimplify.c */
923 extern tree create_tmp_var_raw (tree, const char *);
924 extern tree create_tmp_var_name (const char *);
925 extern tree create_tmp_var (tree, const char *);
926 extern tree create_tmp_reg (tree, const char *);
927 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
928 extern tree get_formal_tmp_var (tree, gimple_seq *);
929 extern void declare_vars (tree, gimple, bool);
930 extern void annotate_all_with_location (gimple_seq, location_t);
932 /* Validation of GIMPLE expressions. Note that these predicates only check
933 the basic form of the expression, they don't recurse to make sure that
934 underlying nodes are also of the right form. */
935 typedef bool (*gimple_predicate)(tree);
938 /* FIXME we should deduce this from the predicate. */
939 enum fallback {
940 fb_none = 0, /* Do not generate a temporary. */
942 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
943 gimplified expression. */
945 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
946 gimplified expression. */
948 fb_mayfail = 4, /* Gimplification may fail. Error issued
949 afterwards. */
950 fb_either= fb_rvalue | fb_lvalue
953 typedef int fallback_t;
955 enum gimplify_status {
956 GS_ERROR = -2, /* Something Bad Seen. */
957 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
958 GS_OK = 0, /* We did something, maybe more to do. */
959 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
962 struct gimplify_ctx
964 struct gimplify_ctx *prev_context;
966 vec<gimple> bind_expr_stack;
967 tree temps;
968 gimple_seq conditional_cleanups;
969 tree exit_label;
970 tree return_temp;
972 vec<tree> case_labels;
973 /* The formal temporary table. Should this be persistent? */
974 htab_t temp_htab;
976 int conditions;
977 bool save_stack;
978 bool into_ssa;
979 bool allow_rhs_cond_expr;
980 bool in_cleanup_point_expr;
983 /* Return true if gimplify_one_sizepos doesn't need to gimplify
984 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
985 fields). */
986 static inline bool
987 is_gimple_sizepos (tree expr)
989 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
990 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
991 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
992 function, the gimplifier will want to replace it with a new variable,
993 but that will cause problems if this type is from outside the function.
994 It's OK to have that here. */
995 return (expr == NULL_TREE
996 || TREE_CONSTANT (expr)
997 || TREE_CODE (expr) == VAR_DECL
998 || CONTAINS_PLACEHOLDER_P (expr));
1001 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1002 bool (*) (tree), fallback_t);
1003 extern void gimplify_type_sizes (tree, gimple_seq *);
1004 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1005 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1006 bool, tree);
1007 extern bool gimplify_stmt (tree *, gimple_seq *);
1008 extern gimple gimplify_body (tree, bool);
1009 extern void push_gimplify_context (struct gimplify_ctx *);
1010 extern void pop_gimplify_context (gimple);
1011 extern void gimplify_and_add (tree, gimple_seq *);
1013 /* Miscellaneous helpers. */
1014 extern void gimple_add_tmp_var (tree);
1015 extern gimple gimple_current_bind_expr (void);
1016 extern vec<gimple> gimple_bind_expr_stack (void);
1017 extern tree voidify_wrapper_expr (tree, tree);
1018 extern tree build_and_jump (tree *);
1019 extern tree force_labels_r (tree *, int *, void *);
1020 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1021 gimple_seq *);
1022 struct gimplify_omp_ctx;
1023 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1024 extern tree gimple_boolify (tree);
1025 extern gimple_predicate rhs_predicate_for (tree);
1026 extern tree canonicalize_cond_expr_cond (tree);
1028 /* In omp-low.c. */
1029 extern tree omp_reduction_init (tree, tree);
1031 /* In trans-mem.c. */
1032 extern void diagnose_tm_safe_errors (tree);
1033 extern void compute_transaction_bits (void);
1035 /* In tree-nested.c. */
1036 extern void lower_nested_functions (tree);
1037 extern void insert_field_into_struct (tree, tree);
1039 /* In gimplify.c. */
1040 extern void gimplify_function_tree (tree);
1042 /* In cfgexpand.c. */
1043 extern tree gimple_assign_rhs_to_tree (gimple);
1045 /* In builtins.c */
1046 extern bool validate_gimple_arglist (const_gimple, ...);
1048 /* In tree-ssa.c */
1049 extern bool tree_ssa_useless_type_conversion (tree);
1050 extern tree tree_ssa_strip_useless_type_conversions (tree);
1051 extern bool useless_type_conversion_p (tree, tree);
1052 extern bool types_compatible_p (tree, tree);
1054 /* Return the first node in GIMPLE sequence S. */
1056 static inline gimple_seq_node
1057 gimple_seq_first (gimple_seq s)
1059 return s;
1063 /* Return the first statement in GIMPLE sequence S. */
1065 static inline gimple
1066 gimple_seq_first_stmt (gimple_seq s)
1068 gimple_seq_node n = gimple_seq_first (s);
1069 return n;
1073 /* Return the last node in GIMPLE sequence S. */
1075 static inline gimple_seq_node
1076 gimple_seq_last (gimple_seq s)
1078 return s ? s->gsbase.prev : NULL;
1082 /* Return the last statement in GIMPLE sequence S. */
1084 static inline gimple
1085 gimple_seq_last_stmt (gimple_seq s)
1087 gimple_seq_node n = gimple_seq_last (s);
1088 return n;
1092 /* Set the last node in GIMPLE sequence *PS to LAST. */
1094 static inline void
1095 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1097 (*ps)->gsbase.prev = last;
1101 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1103 static inline void
1104 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1106 *ps = first;
1110 /* Return true if GIMPLE sequence S is empty. */
1112 static inline bool
1113 gimple_seq_empty_p (gimple_seq s)
1115 return s == NULL;
1118 void gimple_seq_add_stmt (gimple_seq *, gimple);
1120 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1121 *SEQ_P is NULL, a new sequence is allocated. This function is
1122 similar to gimple_seq_add_stmt, but does not scan the operands.
1123 During gimplification, we need to manipulate statement sequences
1124 before the def/use vectors have been constructed. */
1125 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1127 /* Allocate a new sequence and initialize its first element with STMT. */
1129 static inline gimple_seq
1130 gimple_seq_alloc_with_stmt (gimple stmt)
1132 gimple_seq seq = NULL;
1133 gimple_seq_add_stmt (&seq, stmt);
1134 return seq;
1138 /* Returns the sequence of statements in BB. */
1140 static inline gimple_seq
1141 bb_seq (const_basic_block bb)
1143 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1146 static inline gimple_seq *
1147 bb_seq_addr (basic_block bb)
1149 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1152 /* Sets the sequence of statements in BB to SEQ. */
1154 static inline void
1155 set_bb_seq (basic_block bb, gimple_seq seq)
1157 gcc_checking_assert (!(bb->flags & BB_RTL));
1158 bb->il.gimple.seq = seq;
1162 /* Return the code for GIMPLE statement G. */
1164 static inline enum gimple_code
1165 gimple_code (const_gimple g)
1167 return g->gsbase.code;
1171 /* Return the GSS code used by a GIMPLE code. */
1173 static inline enum gimple_statement_structure_enum
1174 gss_for_code (enum gimple_code code)
1176 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1177 return gss_for_code_[code];
1181 /* Return which GSS code is used by GS. */
1183 static inline enum gimple_statement_structure_enum
1184 gimple_statement_structure (gimple gs)
1186 return gss_for_code (gimple_code (gs));
1190 /* Return true if statement G has sub-statements. This is only true for
1191 High GIMPLE statements. */
1193 static inline bool
1194 gimple_has_substatements (gimple g)
1196 switch (gimple_code (g))
1198 case GIMPLE_BIND:
1199 case GIMPLE_CATCH:
1200 case GIMPLE_EH_FILTER:
1201 case GIMPLE_EH_ELSE:
1202 case GIMPLE_TRY:
1203 case GIMPLE_OMP_FOR:
1204 case GIMPLE_OMP_MASTER:
1205 case GIMPLE_OMP_ORDERED:
1206 case GIMPLE_OMP_SECTION:
1207 case GIMPLE_OMP_PARALLEL:
1208 case GIMPLE_OMP_TASK:
1209 case GIMPLE_OMP_SECTIONS:
1210 case GIMPLE_OMP_SINGLE:
1211 case GIMPLE_OMP_CRITICAL:
1212 case GIMPLE_WITH_CLEANUP_EXPR:
1213 case GIMPLE_TRANSACTION:
1214 return true;
1216 default:
1217 return false;
1222 /* Return the basic block holding statement G. */
1224 static inline basic_block
1225 gimple_bb (const_gimple g)
1227 return g->gsbase.bb;
1231 /* Return the lexical scope block holding statement G. */
1233 static inline tree
1234 gimple_block (const_gimple g)
1236 return LOCATION_BLOCK (g->gsbase.location);
1240 /* Set BLOCK to be the lexical scope block holding statement G. */
1242 static inline void
1243 gimple_set_block (gimple g, tree block)
1245 if (block)
1246 g->gsbase.location =
1247 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1248 else
1249 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1253 /* Return location information for statement G. */
1255 static inline location_t
1256 gimple_location (const_gimple g)
1258 return g->gsbase.location;
1261 /* Return pointer to location information for statement G. */
1263 static inline const location_t *
1264 gimple_location_ptr (const_gimple g)
1266 return &g->gsbase.location;
1270 /* Set location information for statement G. */
1272 static inline void
1273 gimple_set_location (gimple g, location_t location)
1275 g->gsbase.location = location;
1279 /* Return true if G contains location information. */
1281 static inline bool
1282 gimple_has_location (const_gimple g)
1284 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1288 /* Return the file name of the location of STMT. */
1290 static inline const char *
1291 gimple_filename (const_gimple stmt)
1293 return LOCATION_FILE (gimple_location (stmt));
1297 /* Return the line number of the location of STMT. */
1299 static inline int
1300 gimple_lineno (const_gimple stmt)
1302 return LOCATION_LINE (gimple_location (stmt));
1306 /* Determine whether SEQ is a singleton. */
1308 static inline bool
1309 gimple_seq_singleton_p (gimple_seq seq)
1311 return ((gimple_seq_first (seq) != NULL)
1312 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1315 /* Return true if no warnings should be emitted for statement STMT. */
1317 static inline bool
1318 gimple_no_warning_p (const_gimple stmt)
1320 return stmt->gsbase.no_warning;
1323 /* Set the no_warning flag of STMT to NO_WARNING. */
1325 static inline void
1326 gimple_set_no_warning (gimple stmt, bool no_warning)
1328 stmt->gsbase.no_warning = (unsigned) no_warning;
1331 /* Set the visited status on statement STMT to VISITED_P. */
1333 static inline void
1334 gimple_set_visited (gimple stmt, bool visited_p)
1336 stmt->gsbase.visited = (unsigned) visited_p;
1340 /* Return the visited status for statement STMT. */
1342 static inline bool
1343 gimple_visited_p (gimple stmt)
1345 return stmt->gsbase.visited;
1349 /* Set pass local flag PLF on statement STMT to VAL_P. */
1351 static inline void
1352 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1354 if (val_p)
1355 stmt->gsbase.plf |= (unsigned int) plf;
1356 else
1357 stmt->gsbase.plf &= ~((unsigned int) plf);
1361 /* Return the value of pass local flag PLF on statement STMT. */
1363 static inline unsigned int
1364 gimple_plf (gimple stmt, enum plf_mask plf)
1366 return stmt->gsbase.plf & ((unsigned int) plf);
1370 /* Set the UID of statement. */
1372 static inline void
1373 gimple_set_uid (gimple g, unsigned uid)
1375 g->gsbase.uid = uid;
1379 /* Return the UID of statement. */
1381 static inline unsigned
1382 gimple_uid (const_gimple g)
1384 return g->gsbase.uid;
1388 /* Make statement G a singleton sequence. */
1390 static inline void
1391 gimple_init_singleton (gimple g)
1393 g->gsbase.next = NULL;
1394 g->gsbase.prev = g;
1398 /* Return true if GIMPLE statement G has register or memory operands. */
1400 static inline bool
1401 gimple_has_ops (const_gimple g)
1403 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1407 /* Return true if GIMPLE statement G has memory operands. */
1409 static inline bool
1410 gimple_has_mem_ops (const_gimple g)
1412 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1416 /* Return the set of USE operands for statement G. */
1418 static inline struct use_optype_d *
1419 gimple_use_ops (const_gimple g)
1421 if (!gimple_has_ops (g))
1422 return NULL;
1423 return g->gsops.opbase.use_ops;
1427 /* Set USE to be the set of USE operands for statement G. */
1429 static inline void
1430 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1432 gcc_gimple_checking_assert (gimple_has_ops (g));
1433 g->gsops.opbase.use_ops = use;
1437 /* Return the set of VUSE operand for statement G. */
1439 static inline use_operand_p
1440 gimple_vuse_op (const_gimple g)
1442 struct use_optype_d *ops;
1443 if (!gimple_has_mem_ops (g))
1444 return NULL_USE_OPERAND_P;
1445 ops = g->gsops.opbase.use_ops;
1446 if (ops
1447 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1448 return USE_OP_PTR (ops);
1449 return NULL_USE_OPERAND_P;
1452 /* Return the set of VDEF operand for statement G. */
1454 static inline def_operand_p
1455 gimple_vdef_op (gimple g)
1457 if (!gimple_has_mem_ops (g))
1458 return NULL_DEF_OPERAND_P;
1459 if (g->gsmembase.vdef)
1460 return &g->gsmembase.vdef;
1461 return NULL_DEF_OPERAND_P;
1465 /* Return the single VUSE operand of the statement G. */
1467 static inline tree
1468 gimple_vuse (const_gimple g)
1470 if (!gimple_has_mem_ops (g))
1471 return NULL_TREE;
1472 return g->gsmembase.vuse;
1475 /* Return the single VDEF operand of the statement G. */
1477 static inline tree
1478 gimple_vdef (const_gimple g)
1480 if (!gimple_has_mem_ops (g))
1481 return NULL_TREE;
1482 return g->gsmembase.vdef;
1485 /* Return the single VUSE operand of the statement G. */
1487 static inline tree *
1488 gimple_vuse_ptr (gimple g)
1490 if (!gimple_has_mem_ops (g))
1491 return NULL;
1492 return &g->gsmembase.vuse;
1495 /* Return the single VDEF operand of the statement G. */
1497 static inline tree *
1498 gimple_vdef_ptr (gimple g)
1500 if (!gimple_has_mem_ops (g))
1501 return NULL;
1502 return &g->gsmembase.vdef;
1505 /* Set the single VUSE operand of the statement G. */
1507 static inline void
1508 gimple_set_vuse (gimple g, tree vuse)
1510 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1511 g->gsmembase.vuse = vuse;
1514 /* Set the single VDEF operand of the statement G. */
1516 static inline void
1517 gimple_set_vdef (gimple g, tree vdef)
1519 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1520 g->gsmembase.vdef = vdef;
1524 /* Return true if statement G has operands and the modified field has
1525 been set. */
1527 static inline bool
1528 gimple_modified_p (const_gimple g)
1530 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1534 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1535 a MODIFIED field. */
1537 static inline void
1538 gimple_set_modified (gimple s, bool modifiedp)
1540 if (gimple_has_ops (s))
1541 s->gsbase.modified = (unsigned) modifiedp;
1545 /* Return the tree code for the expression computed by STMT. This is
1546 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1547 GIMPLE_CALL, return CALL_EXPR as the expression code for
1548 consistency. This is useful when the caller needs to deal with the
1549 three kinds of computation that GIMPLE supports. */
1551 static inline enum tree_code
1552 gimple_expr_code (const_gimple stmt)
1554 enum gimple_code code = gimple_code (stmt);
1555 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1556 return (enum tree_code) stmt->gsbase.subcode;
1557 else
1559 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1560 return CALL_EXPR;
1565 /* Mark statement S as modified, and update it. */
1567 static inline void
1568 update_stmt (gimple s)
1570 if (gimple_has_ops (s))
1572 gimple_set_modified (s, true);
1573 update_stmt_operands (s);
1577 /* Update statement S if it has been optimized. */
1579 static inline void
1580 update_stmt_if_modified (gimple s)
1582 if (gimple_modified_p (s))
1583 update_stmt_operands (s);
1586 /* Return true if statement STMT contains volatile operands. */
1588 static inline bool
1589 gimple_has_volatile_ops (const_gimple stmt)
1591 if (gimple_has_mem_ops (stmt))
1592 return stmt->gsbase.has_volatile_ops;
1593 else
1594 return false;
1598 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1600 static inline void
1601 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1603 if (gimple_has_mem_ops (stmt))
1604 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1607 /* Return true if BB is in a transaction. */
1609 static inline bool
1610 block_in_transaction (basic_block bb)
1612 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1615 /* Return true if STMT is in a transaction. */
1617 static inline bool
1618 gimple_in_transaction (gimple stmt)
1620 return block_in_transaction (gimple_bb (stmt));
1623 /* Return true if statement STMT may access memory. */
1625 static inline bool
1626 gimple_references_memory_p (gimple stmt)
1628 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1632 /* Return the subcode for OMP statement S. */
1634 static inline unsigned
1635 gimple_omp_subcode (const_gimple s)
1637 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1638 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1639 return s->gsbase.subcode;
1642 /* Set the subcode for OMP statement S to SUBCODE. */
1644 static inline void
1645 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1647 /* We only have 16 bits for the subcode. Assert that we are not
1648 overflowing it. */
1649 gcc_gimple_checking_assert (subcode < (1 << 16));
1650 s->gsbase.subcode = subcode;
1653 /* Set the nowait flag on OMP_RETURN statement S. */
1655 static inline void
1656 gimple_omp_return_set_nowait (gimple s)
1658 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1659 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1663 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1664 flag set. */
1666 static inline bool
1667 gimple_omp_return_nowait_p (const_gimple g)
1669 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1670 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1674 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1675 flag set. */
1677 static inline bool
1678 gimple_omp_section_last_p (const_gimple g)
1680 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1681 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1685 /* Set the GF_OMP_SECTION_LAST flag on G. */
1687 static inline void
1688 gimple_omp_section_set_last (gimple g)
1690 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1691 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1695 /* Return true if OMP parallel statement G has the
1696 GF_OMP_PARALLEL_COMBINED flag set. */
1698 static inline bool
1699 gimple_omp_parallel_combined_p (const_gimple g)
1701 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1702 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1706 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1707 value of COMBINED_P. */
1709 static inline void
1710 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1712 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1713 if (combined_p)
1714 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1715 else
1716 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1720 /* Return true if OMP atomic load/store statement G has the
1721 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1723 static inline bool
1724 gimple_omp_atomic_need_value_p (const_gimple g)
1726 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1727 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1728 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1732 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1734 static inline void
1735 gimple_omp_atomic_set_need_value (gimple g)
1737 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1738 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1739 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1743 /* Return the number of operands for statement GS. */
1745 static inline unsigned
1746 gimple_num_ops (const_gimple gs)
1748 return gs->gsbase.num_ops;
1752 /* Set the number of operands for statement GS. */
1754 static inline void
1755 gimple_set_num_ops (gimple gs, unsigned num_ops)
1757 gs->gsbase.num_ops = num_ops;
1761 /* Return the array of operands for statement GS. */
1763 static inline tree *
1764 gimple_ops (gimple gs)
1766 size_t off;
1768 /* All the tuples have their operand vector at the very bottom
1769 of the structure. Note that those structures that do not
1770 have an operand vector have a zero offset. */
1771 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1772 gcc_gimple_checking_assert (off != 0);
1774 return (tree *) ((char *) gs + off);
1778 /* Return operand I for statement GS. */
1780 static inline tree
1781 gimple_op (const_gimple gs, unsigned i)
1783 if (gimple_has_ops (gs))
1785 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1786 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1788 else
1789 return NULL_TREE;
1792 /* Return a pointer to operand I for statement GS. */
1794 static inline tree *
1795 gimple_op_ptr (const_gimple gs, unsigned i)
1797 if (gimple_has_ops (gs))
1799 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1800 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1802 else
1803 return NULL;
1806 /* Set operand I of statement GS to OP. */
1808 static inline void
1809 gimple_set_op (gimple gs, unsigned i, tree op)
1811 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1813 /* Note. It may be tempting to assert that OP matches
1814 is_gimple_operand, but that would be wrong. Different tuples
1815 accept slightly different sets of tree operands. Each caller
1816 should perform its own validation. */
1817 gimple_ops (gs)[i] = op;
1820 /* Return true if GS is a GIMPLE_ASSIGN. */
1822 static inline bool
1823 is_gimple_assign (const_gimple gs)
1825 return gimple_code (gs) == GIMPLE_ASSIGN;
1828 /* Determine if expression CODE is one of the valid expressions that can
1829 be used on the RHS of GIMPLE assignments. */
1831 static inline enum gimple_rhs_class
1832 get_gimple_rhs_class (enum tree_code code)
1834 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1837 /* Return the LHS of assignment statement GS. */
1839 static inline tree
1840 gimple_assign_lhs (const_gimple gs)
1842 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1843 return gimple_op (gs, 0);
1847 /* Return a pointer to the LHS of assignment statement GS. */
1849 static inline tree *
1850 gimple_assign_lhs_ptr (const_gimple gs)
1852 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1853 return gimple_op_ptr (gs, 0);
1857 /* Set LHS to be the LHS operand of assignment statement GS. */
1859 static inline void
1860 gimple_assign_set_lhs (gimple gs, tree lhs)
1862 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1863 gimple_set_op (gs, 0, lhs);
1865 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1866 SSA_NAME_DEF_STMT (lhs) = gs;
1870 /* Return the first operand on the RHS of assignment statement GS. */
1872 static inline tree
1873 gimple_assign_rhs1 (const_gimple gs)
1875 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1876 return gimple_op (gs, 1);
1880 /* Return a pointer to the first operand on the RHS of assignment
1881 statement GS. */
1883 static inline tree *
1884 gimple_assign_rhs1_ptr (const_gimple gs)
1886 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1887 return gimple_op_ptr (gs, 1);
1890 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1892 static inline void
1893 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1895 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1897 gimple_set_op (gs, 1, rhs);
1901 /* Return the second operand on the RHS of assignment statement GS.
1902 If GS does not have two operands, NULL is returned instead. */
1904 static inline tree
1905 gimple_assign_rhs2 (const_gimple gs)
1907 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1909 if (gimple_num_ops (gs) >= 3)
1910 return gimple_op (gs, 2);
1911 else
1912 return NULL_TREE;
1916 /* Return a pointer to the second operand on the RHS of assignment
1917 statement GS. */
1919 static inline tree *
1920 gimple_assign_rhs2_ptr (const_gimple gs)
1922 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1923 return gimple_op_ptr (gs, 2);
1927 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1929 static inline void
1930 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1932 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1934 gimple_set_op (gs, 2, rhs);
1937 /* Return the third operand on the RHS of assignment statement GS.
1938 If GS does not have two operands, NULL is returned instead. */
1940 static inline tree
1941 gimple_assign_rhs3 (const_gimple gs)
1943 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1945 if (gimple_num_ops (gs) >= 4)
1946 return gimple_op (gs, 3);
1947 else
1948 return NULL_TREE;
1951 /* Return a pointer to the third operand on the RHS of assignment
1952 statement GS. */
1954 static inline tree *
1955 gimple_assign_rhs3_ptr (const_gimple gs)
1957 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1958 return gimple_op_ptr (gs, 3);
1962 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1964 static inline void
1965 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1967 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1969 gimple_set_op (gs, 3, rhs);
1972 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1973 to see only a maximum of two operands. */
1975 static inline void
1976 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1977 tree op1, tree op2)
1979 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1982 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1983 to see only a maximum of two operands. */
1985 static inline void
1986 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1987 tree *op1)
1989 tree op2;
1990 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1991 gcc_assert (op2 == NULL_TREE);
1994 /* Returns true if GS is a nontemporal move. */
1996 static inline bool
1997 gimple_assign_nontemporal_move_p (const_gimple gs)
1999 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2000 return gs->gsbase.nontemporal_move;
2003 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2005 static inline void
2006 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2008 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2009 gs->gsbase.nontemporal_move = nontemporal;
2013 /* Return the code of the expression computed on the rhs of assignment
2014 statement GS. In case that the RHS is a single object, returns the
2015 tree code of the object. */
2017 static inline enum tree_code
2018 gimple_assign_rhs_code (const_gimple gs)
2020 enum tree_code code;
2021 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2023 code = (enum tree_code) gs->gsbase.subcode;
2024 /* While we initially set subcode to the TREE_CODE of the rhs for
2025 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2026 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2027 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2028 code = TREE_CODE (gimple_assign_rhs1 (gs));
2030 return code;
2034 /* Set CODE to be the code for the expression computed on the RHS of
2035 assignment S. */
2037 static inline void
2038 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2040 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2041 s->gsbase.subcode = code;
2045 /* Return the gimple rhs class of the code of the expression computed on
2046 the rhs of assignment statement GS.
2047 This will never return GIMPLE_INVALID_RHS. */
2049 static inline enum gimple_rhs_class
2050 gimple_assign_rhs_class (const_gimple gs)
2052 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2055 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2056 there is no operator associated with the assignment itself.
2057 Unlike gimple_assign_copy_p, this predicate returns true for
2058 any RHS operand, including those that perform an operation
2059 and do not have the semantics of a copy, such as COND_EXPR. */
2061 static inline bool
2062 gimple_assign_single_p (gimple gs)
2064 return (is_gimple_assign (gs)
2065 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2068 /* Return true if GS performs a store to its lhs. */
2070 static inline bool
2071 gimple_store_p (gimple gs)
2073 tree lhs = gimple_get_lhs (gs);
2074 return lhs && !is_gimple_reg (lhs);
2077 /* Return true if GS is an assignment that loads from its rhs1. */
2079 static inline bool
2080 gimple_assign_load_p (gimple gs)
2082 tree rhs;
2083 if (!gimple_assign_single_p (gs))
2084 return false;
2085 rhs = gimple_assign_rhs1 (gs);
2086 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2087 return true;
2088 rhs = get_base_address (rhs);
2089 return (DECL_P (rhs)
2090 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2094 /* Return true if S is a type-cast assignment. */
2096 static inline bool
2097 gimple_assign_cast_p (gimple s)
2099 if (is_gimple_assign (s))
2101 enum tree_code sc = gimple_assign_rhs_code (s);
2102 return CONVERT_EXPR_CODE_P (sc)
2103 || sc == VIEW_CONVERT_EXPR
2104 || sc == FIX_TRUNC_EXPR;
2107 return false;
2110 /* Return true if S is a clobber statement. */
2112 static inline bool
2113 gimple_clobber_p (gimple s)
2115 return gimple_assign_single_p (s)
2116 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2119 /* Return true if GS is a GIMPLE_CALL. */
2121 static inline bool
2122 is_gimple_call (const_gimple gs)
2124 return gimple_code (gs) == GIMPLE_CALL;
2127 /* Return the LHS of call statement GS. */
2129 static inline tree
2130 gimple_call_lhs (const_gimple gs)
2132 GIMPLE_CHECK (gs, GIMPLE_CALL);
2133 return gimple_op (gs, 0);
2137 /* Return a pointer to the LHS of call statement GS. */
2139 static inline tree *
2140 gimple_call_lhs_ptr (const_gimple gs)
2142 GIMPLE_CHECK (gs, GIMPLE_CALL);
2143 return gimple_op_ptr (gs, 0);
2147 /* Set LHS to be the LHS operand of call statement GS. */
2149 static inline void
2150 gimple_call_set_lhs (gimple gs, tree lhs)
2152 GIMPLE_CHECK (gs, GIMPLE_CALL);
2153 gimple_set_op (gs, 0, lhs);
2154 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2155 SSA_NAME_DEF_STMT (lhs) = gs;
2159 /* Return true if call GS calls an internal-only function, as enumerated
2160 by internal_fn. */
2162 static inline bool
2163 gimple_call_internal_p (const_gimple gs)
2165 GIMPLE_CHECK (gs, GIMPLE_CALL);
2166 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2170 /* Return the target of internal call GS. */
2172 static inline enum internal_fn
2173 gimple_call_internal_fn (const_gimple gs)
2175 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2176 return gs->gimple_call.u.internal_fn;
2180 /* Return the function type of the function called by GS. */
2182 static inline tree
2183 gimple_call_fntype (const_gimple gs)
2185 GIMPLE_CHECK (gs, GIMPLE_CALL);
2186 if (gimple_call_internal_p (gs))
2187 return NULL_TREE;
2188 return gs->gimple_call.u.fntype;
2191 /* Set the type of the function called by GS to FNTYPE. */
2193 static inline void
2194 gimple_call_set_fntype (gimple gs, tree fntype)
2196 GIMPLE_CHECK (gs, GIMPLE_CALL);
2197 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2198 gs->gimple_call.u.fntype = fntype;
2202 /* Return the tree node representing the function called by call
2203 statement GS. */
2205 static inline tree
2206 gimple_call_fn (const_gimple gs)
2208 GIMPLE_CHECK (gs, GIMPLE_CALL);
2209 return gimple_op (gs, 1);
2212 /* Return a pointer to the tree node representing the function called by call
2213 statement GS. */
2215 static inline tree *
2216 gimple_call_fn_ptr (const_gimple gs)
2218 GIMPLE_CHECK (gs, GIMPLE_CALL);
2219 return gimple_op_ptr (gs, 1);
2223 /* Set FN to be the function called by call statement GS. */
2225 static inline void
2226 gimple_call_set_fn (gimple gs, tree fn)
2228 GIMPLE_CHECK (gs, GIMPLE_CALL);
2229 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2230 gimple_set_op (gs, 1, fn);
2234 /* Set FNDECL to be the function called by call statement GS. */
2236 static inline void
2237 gimple_call_set_fndecl (gimple gs, tree decl)
2239 GIMPLE_CHECK (gs, GIMPLE_CALL);
2240 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2241 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2245 /* Set internal function FN to be the function called by call statement GS. */
2247 static inline void
2248 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2250 GIMPLE_CHECK (gs, GIMPLE_CALL);
2251 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2252 gs->gimple_call.u.internal_fn = fn;
2256 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2257 associated with the callee if known. Otherwise return NULL_TREE. */
2259 static inline tree
2260 gimple_call_addr_fndecl (const_tree fn)
2262 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2264 tree fndecl = TREE_OPERAND (fn, 0);
2265 if (TREE_CODE (fndecl) == MEM_REF
2266 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2267 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2268 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2269 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2270 return fndecl;
2272 return NULL_TREE;
2275 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2276 Otherwise return NULL. This function is analogous to
2277 get_callee_fndecl in tree land. */
2279 static inline tree
2280 gimple_call_fndecl (const_gimple gs)
2282 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2286 /* Return the type returned by call statement GS. */
2288 static inline tree
2289 gimple_call_return_type (const_gimple gs)
2291 tree type = gimple_call_fntype (gs);
2293 if (type == NULL_TREE)
2294 return TREE_TYPE (gimple_call_lhs (gs));
2296 /* The type returned by a function is the type of its
2297 function type. */
2298 return TREE_TYPE (type);
2302 /* Return the static chain for call statement GS. */
2304 static inline tree
2305 gimple_call_chain (const_gimple gs)
2307 GIMPLE_CHECK (gs, GIMPLE_CALL);
2308 return gimple_op (gs, 2);
2312 /* Return a pointer to the static chain for call statement GS. */
2314 static inline tree *
2315 gimple_call_chain_ptr (const_gimple gs)
2317 GIMPLE_CHECK (gs, GIMPLE_CALL);
2318 return gimple_op_ptr (gs, 2);
2321 /* Set CHAIN to be the static chain for call statement GS. */
2323 static inline void
2324 gimple_call_set_chain (gimple gs, tree chain)
2326 GIMPLE_CHECK (gs, GIMPLE_CALL);
2328 gimple_set_op (gs, 2, chain);
2332 /* Return the number of arguments used by call statement GS. */
2334 static inline unsigned
2335 gimple_call_num_args (const_gimple gs)
2337 unsigned num_ops;
2338 GIMPLE_CHECK (gs, GIMPLE_CALL);
2339 num_ops = gimple_num_ops (gs);
2340 return num_ops - 3;
2344 /* Return the argument at position INDEX for call statement GS. */
2346 static inline tree
2347 gimple_call_arg (const_gimple gs, unsigned index)
2349 GIMPLE_CHECK (gs, GIMPLE_CALL);
2350 return gimple_op (gs, index + 3);
2354 /* Return a pointer to the argument at position INDEX for call
2355 statement GS. */
2357 static inline tree *
2358 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2360 GIMPLE_CHECK (gs, GIMPLE_CALL);
2361 return gimple_op_ptr (gs, index + 3);
2365 /* Set ARG to be the argument at position INDEX for call statement GS. */
2367 static inline void
2368 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2370 GIMPLE_CHECK (gs, GIMPLE_CALL);
2371 gimple_set_op (gs, index + 3, arg);
2375 /* If TAIL_P is true, mark call statement S as being a tail call
2376 (i.e., a call just before the exit of a function). These calls are
2377 candidate for tail call optimization. */
2379 static inline void
2380 gimple_call_set_tail (gimple s, bool tail_p)
2382 GIMPLE_CHECK (s, GIMPLE_CALL);
2383 if (tail_p)
2384 s->gsbase.subcode |= GF_CALL_TAILCALL;
2385 else
2386 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2390 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2392 static inline bool
2393 gimple_call_tail_p (gimple s)
2395 GIMPLE_CHECK (s, GIMPLE_CALL);
2396 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2400 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2401 slot optimization. This transformation uses the target of the call
2402 expansion as the return slot for calls that return in memory. */
2404 static inline void
2405 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2407 GIMPLE_CHECK (s, GIMPLE_CALL);
2408 if (return_slot_opt_p)
2409 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2410 else
2411 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2415 /* Return true if S is marked for return slot optimization. */
2417 static inline bool
2418 gimple_call_return_slot_opt_p (gimple s)
2420 GIMPLE_CHECK (s, GIMPLE_CALL);
2421 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2425 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2426 thunk to the thunked-to function. */
2428 static inline void
2429 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2431 GIMPLE_CHECK (s, GIMPLE_CALL);
2432 if (from_thunk_p)
2433 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2434 else
2435 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2439 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2441 static inline bool
2442 gimple_call_from_thunk_p (gimple s)
2444 GIMPLE_CHECK (s, GIMPLE_CALL);
2445 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2449 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2450 argument pack in its argument list. */
2452 static inline void
2453 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2455 GIMPLE_CHECK (s, GIMPLE_CALL);
2456 if (pass_arg_pack_p)
2457 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2458 else
2459 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2463 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2464 argument pack in its argument list. */
2466 static inline bool
2467 gimple_call_va_arg_pack_p (gimple s)
2469 GIMPLE_CHECK (s, GIMPLE_CALL);
2470 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2474 /* Return true if S is a noreturn call. */
2476 static inline bool
2477 gimple_call_noreturn_p (gimple s)
2479 GIMPLE_CHECK (s, GIMPLE_CALL);
2480 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2484 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2485 even if the called function can throw in other cases. */
2487 static inline void
2488 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2490 GIMPLE_CHECK (s, GIMPLE_CALL);
2491 if (nothrow_p)
2492 s->gsbase.subcode |= GF_CALL_NOTHROW;
2493 else
2494 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2497 /* Return true if S is a nothrow call. */
2499 static inline bool
2500 gimple_call_nothrow_p (gimple s)
2502 GIMPLE_CHECK (s, GIMPLE_CALL);
2503 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2506 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2507 is known to be emitted for VLA objects. Those are wrapped by
2508 stack_save/stack_restore calls and hence can't lead to unbounded
2509 stack growth even when they occur in loops. */
2511 static inline void
2512 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2514 GIMPLE_CHECK (s, GIMPLE_CALL);
2515 if (for_var)
2516 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2517 else
2518 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2521 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2523 static inline bool
2524 gimple_call_alloca_for_var_p (gimple s)
2526 GIMPLE_CHECK (s, GIMPLE_CALL);
2527 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2530 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2532 static inline void
2533 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2535 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2536 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2537 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2541 /* Return a pointer to the points-to solution for the set of call-used
2542 variables of the call CALL. */
2544 static inline struct pt_solution *
2545 gimple_call_use_set (gimple call)
2547 GIMPLE_CHECK (call, GIMPLE_CALL);
2548 return &call->gimple_call.call_used;
2552 /* Return a pointer to the points-to solution for the set of call-used
2553 variables of the call CALL. */
2555 static inline struct pt_solution *
2556 gimple_call_clobber_set (gimple call)
2558 GIMPLE_CHECK (call, GIMPLE_CALL);
2559 return &call->gimple_call.call_clobbered;
2563 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2564 non-NULL lhs. */
2566 static inline bool
2567 gimple_has_lhs (gimple stmt)
2569 return (is_gimple_assign (stmt)
2570 || (is_gimple_call (stmt)
2571 && gimple_call_lhs (stmt) != NULL_TREE));
2575 /* Return the code of the predicate computed by conditional statement GS. */
2577 static inline enum tree_code
2578 gimple_cond_code (const_gimple gs)
2580 GIMPLE_CHECK (gs, GIMPLE_COND);
2581 return (enum tree_code) gs->gsbase.subcode;
2585 /* Set CODE to be the predicate code for the conditional statement GS. */
2587 static inline void
2588 gimple_cond_set_code (gimple gs, enum tree_code code)
2590 GIMPLE_CHECK (gs, GIMPLE_COND);
2591 gs->gsbase.subcode = code;
2595 /* Return the LHS of the predicate computed by conditional statement GS. */
2597 static inline tree
2598 gimple_cond_lhs (const_gimple gs)
2600 GIMPLE_CHECK (gs, GIMPLE_COND);
2601 return gimple_op (gs, 0);
2604 /* Return the pointer to the LHS of the predicate computed by conditional
2605 statement GS. */
2607 static inline tree *
2608 gimple_cond_lhs_ptr (const_gimple gs)
2610 GIMPLE_CHECK (gs, GIMPLE_COND);
2611 return gimple_op_ptr (gs, 0);
2614 /* Set LHS to be the LHS operand of the predicate computed by
2615 conditional statement GS. */
2617 static inline void
2618 gimple_cond_set_lhs (gimple gs, tree lhs)
2620 GIMPLE_CHECK (gs, GIMPLE_COND);
2621 gimple_set_op (gs, 0, lhs);
2625 /* Return the RHS operand of the predicate computed by conditional GS. */
2627 static inline tree
2628 gimple_cond_rhs (const_gimple gs)
2630 GIMPLE_CHECK (gs, GIMPLE_COND);
2631 return gimple_op (gs, 1);
2634 /* Return the pointer to the RHS operand of the predicate computed by
2635 conditional GS. */
2637 static inline tree *
2638 gimple_cond_rhs_ptr (const_gimple gs)
2640 GIMPLE_CHECK (gs, GIMPLE_COND);
2641 return gimple_op_ptr (gs, 1);
2645 /* Set RHS to be the RHS operand of the predicate computed by
2646 conditional statement GS. */
2648 static inline void
2649 gimple_cond_set_rhs (gimple gs, tree rhs)
2651 GIMPLE_CHECK (gs, GIMPLE_COND);
2652 gimple_set_op (gs, 1, rhs);
2656 /* Return the label used by conditional statement GS when its
2657 predicate evaluates to true. */
2659 static inline tree
2660 gimple_cond_true_label (const_gimple gs)
2662 GIMPLE_CHECK (gs, GIMPLE_COND);
2663 return gimple_op (gs, 2);
2667 /* Set LABEL to be the label used by conditional statement GS when its
2668 predicate evaluates to true. */
2670 static inline void
2671 gimple_cond_set_true_label (gimple gs, tree label)
2673 GIMPLE_CHECK (gs, GIMPLE_COND);
2674 gimple_set_op (gs, 2, label);
2678 /* Set LABEL to be the label used by conditional statement GS when its
2679 predicate evaluates to false. */
2681 static inline void
2682 gimple_cond_set_false_label (gimple gs, tree label)
2684 GIMPLE_CHECK (gs, GIMPLE_COND);
2685 gimple_set_op (gs, 3, label);
2689 /* Return the label used by conditional statement GS when its
2690 predicate evaluates to false. */
2692 static inline tree
2693 gimple_cond_false_label (const_gimple gs)
2695 GIMPLE_CHECK (gs, GIMPLE_COND);
2696 return gimple_op (gs, 3);
2700 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2702 static inline void
2703 gimple_cond_make_false (gimple gs)
2705 gimple_cond_set_lhs (gs, boolean_true_node);
2706 gimple_cond_set_rhs (gs, boolean_false_node);
2707 gs->gsbase.subcode = EQ_EXPR;
2711 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2713 static inline void
2714 gimple_cond_make_true (gimple gs)
2716 gimple_cond_set_lhs (gs, boolean_true_node);
2717 gimple_cond_set_rhs (gs, boolean_true_node);
2718 gs->gsbase.subcode = EQ_EXPR;
2721 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2722 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2724 static inline bool
2725 gimple_cond_true_p (const_gimple gs)
2727 tree lhs = gimple_cond_lhs (gs);
2728 tree rhs = gimple_cond_rhs (gs);
2729 enum tree_code code = gimple_cond_code (gs);
2731 if (lhs != boolean_true_node && lhs != boolean_false_node)
2732 return false;
2734 if (rhs != boolean_true_node && rhs != boolean_false_node)
2735 return false;
2737 if (code == NE_EXPR && lhs != rhs)
2738 return true;
2740 if (code == EQ_EXPR && lhs == rhs)
2741 return true;
2743 return false;
2746 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2747 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2749 static inline bool
2750 gimple_cond_false_p (const_gimple gs)
2752 tree lhs = gimple_cond_lhs (gs);
2753 tree rhs = gimple_cond_rhs (gs);
2754 enum tree_code code = gimple_cond_code (gs);
2756 if (lhs != boolean_true_node && lhs != boolean_false_node)
2757 return false;
2759 if (rhs != boolean_true_node && rhs != boolean_false_node)
2760 return false;
2762 if (code == NE_EXPR && lhs == rhs)
2763 return true;
2765 if (code == EQ_EXPR && lhs != rhs)
2766 return true;
2768 return false;
2771 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2773 static inline void
2774 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2776 gimple_cond_set_code (stmt, code);
2777 gimple_cond_set_lhs (stmt, lhs);
2778 gimple_cond_set_rhs (stmt, rhs);
2781 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2783 static inline tree
2784 gimple_label_label (const_gimple gs)
2786 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2787 return gimple_op (gs, 0);
2791 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2792 GS. */
2794 static inline void
2795 gimple_label_set_label (gimple gs, tree label)
2797 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2798 gimple_set_op (gs, 0, label);
2802 /* Return the destination of the unconditional jump GS. */
2804 static inline tree
2805 gimple_goto_dest (const_gimple gs)
2807 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2808 return gimple_op (gs, 0);
2812 /* Set DEST to be the destination of the unconditonal jump GS. */
2814 static inline void
2815 gimple_goto_set_dest (gimple gs, tree dest)
2817 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2818 gimple_set_op (gs, 0, dest);
2822 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2824 static inline tree
2825 gimple_bind_vars (const_gimple gs)
2827 GIMPLE_CHECK (gs, GIMPLE_BIND);
2828 return gs->gimple_bind.vars;
2832 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2833 statement GS. */
2835 static inline void
2836 gimple_bind_set_vars (gimple gs, tree vars)
2838 GIMPLE_CHECK (gs, GIMPLE_BIND);
2839 gs->gimple_bind.vars = vars;
2843 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2844 statement GS. */
2846 static inline void
2847 gimple_bind_append_vars (gimple gs, tree vars)
2849 GIMPLE_CHECK (gs, GIMPLE_BIND);
2850 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2854 static inline gimple_seq *
2855 gimple_bind_body_ptr (gimple gs)
2857 GIMPLE_CHECK (gs, GIMPLE_BIND);
2858 return &gs->gimple_bind.body;
2861 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2863 static inline gimple_seq
2864 gimple_bind_body (gimple gs)
2866 return *gimple_bind_body_ptr (gs);
2870 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2871 statement GS. */
2873 static inline void
2874 gimple_bind_set_body (gimple gs, gimple_seq seq)
2876 GIMPLE_CHECK (gs, GIMPLE_BIND);
2877 gs->gimple_bind.body = seq;
2881 /* Append a statement to the end of a GIMPLE_BIND's body. */
2883 static inline void
2884 gimple_bind_add_stmt (gimple gs, gimple stmt)
2886 GIMPLE_CHECK (gs, GIMPLE_BIND);
2887 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2891 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2893 static inline void
2894 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2896 GIMPLE_CHECK (gs, GIMPLE_BIND);
2897 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2901 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2902 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2904 static inline tree
2905 gimple_bind_block (const_gimple gs)
2907 GIMPLE_CHECK (gs, GIMPLE_BIND);
2908 return gs->gimple_bind.block;
2912 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2913 statement GS. */
2915 static inline void
2916 gimple_bind_set_block (gimple gs, tree block)
2918 GIMPLE_CHECK (gs, GIMPLE_BIND);
2919 gcc_gimple_checking_assert (block == NULL_TREE
2920 || TREE_CODE (block) == BLOCK);
2921 gs->gimple_bind.block = block;
2925 /* Return the number of input operands for GIMPLE_ASM GS. */
2927 static inline unsigned
2928 gimple_asm_ninputs (const_gimple gs)
2930 GIMPLE_CHECK (gs, GIMPLE_ASM);
2931 return gs->gimple_asm.ni;
2935 /* Return the number of output operands for GIMPLE_ASM GS. */
2937 static inline unsigned
2938 gimple_asm_noutputs (const_gimple gs)
2940 GIMPLE_CHECK (gs, GIMPLE_ASM);
2941 return gs->gimple_asm.no;
2945 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2947 static inline unsigned
2948 gimple_asm_nclobbers (const_gimple gs)
2950 GIMPLE_CHECK (gs, GIMPLE_ASM);
2951 return gs->gimple_asm.nc;
2954 /* Return the number of label operands for GIMPLE_ASM GS. */
2956 static inline unsigned
2957 gimple_asm_nlabels (const_gimple gs)
2959 GIMPLE_CHECK (gs, GIMPLE_ASM);
2960 return gs->gimple_asm.nl;
2963 /* Return input operand INDEX of GIMPLE_ASM GS. */
2965 static inline tree
2966 gimple_asm_input_op (const_gimple gs, unsigned index)
2968 GIMPLE_CHECK (gs, GIMPLE_ASM);
2969 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2970 return gimple_op (gs, index + gs->gimple_asm.no);
2973 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2975 static inline tree *
2976 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2978 GIMPLE_CHECK (gs, GIMPLE_ASM);
2979 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2980 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2984 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2986 static inline void
2987 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2989 GIMPLE_CHECK (gs, GIMPLE_ASM);
2990 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2991 && TREE_CODE (in_op) == TREE_LIST);
2992 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2996 /* Return output operand INDEX of GIMPLE_ASM GS. */
2998 static inline tree
2999 gimple_asm_output_op (const_gimple gs, unsigned index)
3001 GIMPLE_CHECK (gs, GIMPLE_ASM);
3002 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3003 return gimple_op (gs, index);
3006 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3008 static inline tree *
3009 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3011 GIMPLE_CHECK (gs, GIMPLE_ASM);
3012 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3013 return gimple_op_ptr (gs, index);
3017 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3019 static inline void
3020 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3022 GIMPLE_CHECK (gs, GIMPLE_ASM);
3023 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3024 && TREE_CODE (out_op) == TREE_LIST);
3025 gimple_set_op (gs, index, out_op);
3029 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3031 static inline tree
3032 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3034 GIMPLE_CHECK (gs, GIMPLE_ASM);
3035 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3036 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3040 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3042 static inline void
3043 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3045 GIMPLE_CHECK (gs, GIMPLE_ASM);
3046 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3047 && TREE_CODE (clobber_op) == TREE_LIST);
3048 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3051 /* Return label operand INDEX of GIMPLE_ASM GS. */
3053 static inline tree
3054 gimple_asm_label_op (const_gimple gs, unsigned index)
3056 GIMPLE_CHECK (gs, GIMPLE_ASM);
3057 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3058 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3061 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3063 static inline void
3064 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3066 GIMPLE_CHECK (gs, GIMPLE_ASM);
3067 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3068 && TREE_CODE (label_op) == TREE_LIST);
3069 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3072 /* Return the string representing the assembly instruction in
3073 GIMPLE_ASM GS. */
3075 static inline const char *
3076 gimple_asm_string (const_gimple gs)
3078 GIMPLE_CHECK (gs, GIMPLE_ASM);
3079 return gs->gimple_asm.string;
3083 /* Return true if GS is an asm statement marked volatile. */
3085 static inline bool
3086 gimple_asm_volatile_p (const_gimple gs)
3088 GIMPLE_CHECK (gs, GIMPLE_ASM);
3089 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3093 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3095 static inline void
3096 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3098 GIMPLE_CHECK (gs, GIMPLE_ASM);
3099 if (volatile_p)
3100 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3101 else
3102 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3106 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3108 static inline void
3109 gimple_asm_set_input (gimple gs, bool input_p)
3111 GIMPLE_CHECK (gs, GIMPLE_ASM);
3112 if (input_p)
3113 gs->gsbase.subcode |= GF_ASM_INPUT;
3114 else
3115 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3119 /* Return true if asm GS is an ASM_INPUT. */
3121 static inline bool
3122 gimple_asm_input_p (const_gimple gs)
3124 GIMPLE_CHECK (gs, GIMPLE_ASM);
3125 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3129 /* Return the types handled by GIMPLE_CATCH statement GS. */
3131 static inline tree
3132 gimple_catch_types (const_gimple gs)
3134 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3135 return gs->gimple_catch.types;
3139 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3141 static inline tree *
3142 gimple_catch_types_ptr (gimple gs)
3144 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3145 return &gs->gimple_catch.types;
3149 /* Return a pointer to the GIMPLE sequence representing the body of
3150 the handler of GIMPLE_CATCH statement GS. */
3152 static inline gimple_seq *
3153 gimple_catch_handler_ptr (gimple gs)
3155 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3156 return &gs->gimple_catch.handler;
3160 /* Return the GIMPLE sequence representing the body of the handler of
3161 GIMPLE_CATCH statement GS. */
3163 static inline gimple_seq
3164 gimple_catch_handler (gimple gs)
3166 return *gimple_catch_handler_ptr (gs);
3170 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3172 static inline void
3173 gimple_catch_set_types (gimple gs, tree t)
3175 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3176 gs->gimple_catch.types = t;
3180 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3182 static inline void
3183 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3185 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3186 gs->gimple_catch.handler = handler;
3190 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3192 static inline tree
3193 gimple_eh_filter_types (const_gimple gs)
3195 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3196 return gs->gimple_eh_filter.types;
3200 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3201 GS. */
3203 static inline tree *
3204 gimple_eh_filter_types_ptr (gimple gs)
3206 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3207 return &gs->gimple_eh_filter.types;
3211 /* Return a pointer to the sequence of statement to execute when
3212 GIMPLE_EH_FILTER statement fails. */
3214 static inline gimple_seq *
3215 gimple_eh_filter_failure_ptr (gimple gs)
3217 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3218 return &gs->gimple_eh_filter.failure;
3222 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3223 statement fails. */
3225 static inline gimple_seq
3226 gimple_eh_filter_failure (gimple gs)
3228 return *gimple_eh_filter_failure_ptr (gs);
3232 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3234 static inline void
3235 gimple_eh_filter_set_types (gimple gs, tree types)
3237 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3238 gs->gimple_eh_filter.types = types;
3242 /* Set FAILURE to be the sequence of statements to execute on failure
3243 for GIMPLE_EH_FILTER GS. */
3245 static inline void
3246 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3248 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3249 gs->gimple_eh_filter.failure = failure;
3252 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3254 static inline tree
3255 gimple_eh_must_not_throw_fndecl (gimple gs)
3257 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3258 return gs->gimple_eh_mnt.fndecl;
3261 /* Set the function decl to be called by GS to DECL. */
3263 static inline void
3264 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3266 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3267 gs->gimple_eh_mnt.fndecl = decl;
3270 /* GIMPLE_EH_ELSE accessors. */
3272 static inline gimple_seq *
3273 gimple_eh_else_n_body_ptr (gimple gs)
3275 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3276 return &gs->gimple_eh_else.n_body;
3279 static inline gimple_seq
3280 gimple_eh_else_n_body (gimple gs)
3282 return *gimple_eh_else_n_body_ptr (gs);
3285 static inline gimple_seq *
3286 gimple_eh_else_e_body_ptr (gimple gs)
3288 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3289 return &gs->gimple_eh_else.e_body;
3292 static inline gimple_seq
3293 gimple_eh_else_e_body (gimple gs)
3295 return *gimple_eh_else_e_body_ptr (gs);
3298 static inline void
3299 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3301 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3302 gs->gimple_eh_else.n_body = seq;
3305 static inline void
3306 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3308 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3309 gs->gimple_eh_else.e_body = seq;
3312 /* GIMPLE_TRY accessors. */
3314 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3315 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3317 static inline enum gimple_try_flags
3318 gimple_try_kind (const_gimple gs)
3320 GIMPLE_CHECK (gs, GIMPLE_TRY);
3321 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3325 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3327 static inline void
3328 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3330 GIMPLE_CHECK (gs, GIMPLE_TRY);
3331 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3332 || kind == GIMPLE_TRY_FINALLY);
3333 if (gimple_try_kind (gs) != kind)
3334 gs->gsbase.subcode = (unsigned int) kind;
3338 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3340 static inline bool
3341 gimple_try_catch_is_cleanup (const_gimple gs)
3343 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3344 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3348 /* Return a pointer to the sequence of statements used as the
3349 body for GIMPLE_TRY GS. */
3351 static inline gimple_seq *
3352 gimple_try_eval_ptr (gimple gs)
3354 GIMPLE_CHECK (gs, GIMPLE_TRY);
3355 return &gs->gimple_try.eval;
3359 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3361 static inline gimple_seq
3362 gimple_try_eval (gimple gs)
3364 return *gimple_try_eval_ptr (gs);
3368 /* Return a pointer to the sequence of statements used as the cleanup body for
3369 GIMPLE_TRY GS. */
3371 static inline gimple_seq *
3372 gimple_try_cleanup_ptr (gimple gs)
3374 GIMPLE_CHECK (gs, GIMPLE_TRY);
3375 return &gs->gimple_try.cleanup;
3379 /* Return the sequence of statements used as the cleanup body for
3380 GIMPLE_TRY GS. */
3382 static inline gimple_seq
3383 gimple_try_cleanup (gimple gs)
3385 return *gimple_try_cleanup_ptr (gs);
3389 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3391 static inline void
3392 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3394 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3395 if (catch_is_cleanup)
3396 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3397 else
3398 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3402 /* Set EVAL to be the sequence of statements to use as the body for
3403 GIMPLE_TRY GS. */
3405 static inline void
3406 gimple_try_set_eval (gimple gs, gimple_seq eval)
3408 GIMPLE_CHECK (gs, GIMPLE_TRY);
3409 gs->gimple_try.eval = eval;
3413 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3414 body for GIMPLE_TRY GS. */
3416 static inline void
3417 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3419 GIMPLE_CHECK (gs, GIMPLE_TRY);
3420 gs->gimple_try.cleanup = cleanup;
3424 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3426 static inline gimple_seq *
3427 gimple_wce_cleanup_ptr (gimple gs)
3429 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3430 return &gs->gimple_wce.cleanup;
3434 /* Return the cleanup sequence for cleanup statement GS. */
3436 static inline gimple_seq
3437 gimple_wce_cleanup (gimple gs)
3439 return *gimple_wce_cleanup_ptr (gs);
3443 /* Set CLEANUP to be the cleanup sequence for GS. */
3445 static inline void
3446 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3448 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3449 gs->gimple_wce.cleanup = cleanup;
3453 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3455 static inline bool
3456 gimple_wce_cleanup_eh_only (const_gimple gs)
3458 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3459 return gs->gsbase.subcode != 0;
3463 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3465 static inline void
3466 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3468 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3469 gs->gsbase.subcode = (unsigned int) eh_only_p;
3473 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3475 static inline unsigned
3476 gimple_phi_capacity (const_gimple gs)
3478 GIMPLE_CHECK (gs, GIMPLE_PHI);
3479 return gs->gimple_phi.capacity;
3483 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3484 be exactly the number of incoming edges for the basic block holding
3485 GS. */
3487 static inline unsigned
3488 gimple_phi_num_args (const_gimple gs)
3490 GIMPLE_CHECK (gs, GIMPLE_PHI);
3491 return gs->gimple_phi.nargs;
3495 /* Return the SSA name created by GIMPLE_PHI GS. */
3497 static inline tree
3498 gimple_phi_result (const_gimple gs)
3500 GIMPLE_CHECK (gs, GIMPLE_PHI);
3501 return gs->gimple_phi.result;
3504 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3506 static inline tree *
3507 gimple_phi_result_ptr (gimple gs)
3509 GIMPLE_CHECK (gs, GIMPLE_PHI);
3510 return &gs->gimple_phi.result;
3513 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3515 static inline void
3516 gimple_phi_set_result (gimple gs, tree result)
3518 GIMPLE_CHECK (gs, GIMPLE_PHI);
3519 gs->gimple_phi.result = result;
3520 if (result && TREE_CODE (result) == SSA_NAME)
3521 SSA_NAME_DEF_STMT (result) = gs;
3525 /* Return the PHI argument corresponding to incoming edge INDEX for
3526 GIMPLE_PHI GS. */
3528 static inline struct phi_arg_d *
3529 gimple_phi_arg (gimple gs, unsigned index)
3531 GIMPLE_CHECK (gs, GIMPLE_PHI);
3532 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3533 return &(gs->gimple_phi.args[index]);
3536 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3537 for GIMPLE_PHI GS. */
3539 static inline void
3540 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3542 GIMPLE_CHECK (gs, GIMPLE_PHI);
3543 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3544 gs->gimple_phi.args[index] = *phiarg;
3547 /* Return the region number for GIMPLE_RESX GS. */
3549 static inline int
3550 gimple_resx_region (const_gimple gs)
3552 GIMPLE_CHECK (gs, GIMPLE_RESX);
3553 return gs->gimple_eh_ctrl.region;
3556 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3558 static inline void
3559 gimple_resx_set_region (gimple gs, int region)
3561 GIMPLE_CHECK (gs, GIMPLE_RESX);
3562 gs->gimple_eh_ctrl.region = region;
3565 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3567 static inline int
3568 gimple_eh_dispatch_region (const_gimple gs)
3570 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3571 return gs->gimple_eh_ctrl.region;
3574 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3576 static inline void
3577 gimple_eh_dispatch_set_region (gimple gs, int region)
3579 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3580 gs->gimple_eh_ctrl.region = region;
3583 /* Return the number of labels associated with the switch statement GS. */
3585 static inline unsigned
3586 gimple_switch_num_labels (const_gimple gs)
3588 unsigned num_ops;
3589 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3590 num_ops = gimple_num_ops (gs);
3591 gcc_gimple_checking_assert (num_ops > 1);
3592 return num_ops - 1;
3596 /* Set NLABELS to be the number of labels for the switch statement GS. */
3598 static inline void
3599 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3601 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3602 gimple_set_num_ops (g, nlabels + 1);
3606 /* Return the index variable used by the switch statement GS. */
3608 static inline tree
3609 gimple_switch_index (const_gimple gs)
3611 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3612 return gimple_op (gs, 0);
3616 /* Return a pointer to the index variable for the switch statement GS. */
3618 static inline tree *
3619 gimple_switch_index_ptr (const_gimple gs)
3621 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3622 return gimple_op_ptr (gs, 0);
3626 /* Set INDEX to be the index variable for switch statement GS. */
3628 static inline void
3629 gimple_switch_set_index (gimple gs, tree index)
3631 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3632 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3633 gimple_set_op (gs, 0, index);
3637 /* Return the label numbered INDEX. The default label is 0, followed by any
3638 labels in a switch statement. */
3640 static inline tree
3641 gimple_switch_label (const_gimple gs, unsigned index)
3643 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3644 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3645 return gimple_op (gs, index + 1);
3648 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3650 static inline void
3651 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3653 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3654 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3655 && (label == NULL_TREE
3656 || TREE_CODE (label) == CASE_LABEL_EXPR));
3657 gimple_set_op (gs, index + 1, label);
3660 /* Return the default label for a switch statement. */
3662 static inline tree
3663 gimple_switch_default_label (const_gimple gs)
3665 tree label = gimple_switch_label (gs, 0);
3666 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3667 return label;
3670 /* Set the default label for a switch statement. */
3672 static inline void
3673 gimple_switch_set_default_label (gimple gs, tree label)
3675 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3676 gimple_switch_set_label (gs, 0, label);
3679 /* Return true if GS is a GIMPLE_DEBUG statement. */
3681 static inline bool
3682 is_gimple_debug (const_gimple gs)
3684 return gimple_code (gs) == GIMPLE_DEBUG;
3687 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3689 static inline bool
3690 gimple_debug_bind_p (const_gimple s)
3692 if (is_gimple_debug (s))
3693 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3695 return false;
3698 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3700 static inline tree
3701 gimple_debug_bind_get_var (gimple dbg)
3703 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3704 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3705 return gimple_op (dbg, 0);
3708 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3709 statement. */
3711 static inline tree
3712 gimple_debug_bind_get_value (gimple dbg)
3714 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3715 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3716 return gimple_op (dbg, 1);
3719 /* Return a pointer to the value bound to the variable in a
3720 GIMPLE_DEBUG bind statement. */
3722 static inline tree *
3723 gimple_debug_bind_get_value_ptr (gimple dbg)
3725 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3726 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3727 return gimple_op_ptr (dbg, 1);
3730 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3732 static inline void
3733 gimple_debug_bind_set_var (gimple dbg, tree var)
3735 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3736 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3737 gimple_set_op (dbg, 0, var);
3740 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3741 statement. */
3743 static inline void
3744 gimple_debug_bind_set_value (gimple dbg, tree value)
3746 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3747 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3748 gimple_set_op (dbg, 1, value);
3751 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3752 optimized away. */
3753 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3755 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3756 statement. */
3758 static inline void
3759 gimple_debug_bind_reset_value (gimple dbg)
3761 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3762 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3763 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3766 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3767 value. */
3769 static inline bool
3770 gimple_debug_bind_has_value_p (gimple dbg)
3772 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3773 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3774 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3777 #undef GIMPLE_DEBUG_BIND_NOVALUE
3779 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3781 static inline bool
3782 gimple_debug_source_bind_p (const_gimple s)
3784 if (is_gimple_debug (s))
3785 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3787 return false;
3790 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3792 static inline tree
3793 gimple_debug_source_bind_get_var (gimple dbg)
3795 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3796 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3797 return gimple_op (dbg, 0);
3800 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3801 statement. */
3803 static inline tree
3804 gimple_debug_source_bind_get_value (gimple dbg)
3806 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3807 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3808 return gimple_op (dbg, 1);
3811 /* Return a pointer to the value bound to the variable in a
3812 GIMPLE_DEBUG source bind statement. */
3814 static inline tree *
3815 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3817 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3818 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3819 return gimple_op_ptr (dbg, 1);
3822 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3824 static inline void
3825 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3827 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3828 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3829 gimple_set_op (dbg, 0, var);
3832 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3833 statement. */
3835 static inline void
3836 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3838 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3839 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3840 gimple_set_op (dbg, 1, value);
3843 /* Return a pointer to the body for the OMP statement GS. */
3845 static inline gimple_seq *
3846 gimple_omp_body_ptr (gimple gs)
3848 return &gs->omp.body;
3851 /* Return the body for the OMP statement GS. */
3853 static inline gimple_seq
3854 gimple_omp_body (gimple gs)
3856 return *gimple_omp_body_ptr (gs);
3859 /* Set BODY to be the body for the OMP statement GS. */
3861 static inline void
3862 gimple_omp_set_body (gimple gs, gimple_seq body)
3864 gs->omp.body = body;
3868 /* Return the name associated with OMP_CRITICAL statement GS. */
3870 static inline tree
3871 gimple_omp_critical_name (const_gimple gs)
3873 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3874 return gs->gimple_omp_critical.name;
3878 /* Return a pointer to the name associated with OMP critical statement GS. */
3880 static inline tree *
3881 gimple_omp_critical_name_ptr (gimple gs)
3883 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3884 return &gs->gimple_omp_critical.name;
3888 /* Set NAME to be the name associated with OMP critical statement GS. */
3890 static inline void
3891 gimple_omp_critical_set_name (gimple gs, tree name)
3893 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3894 gs->gimple_omp_critical.name = name;
3898 /* Return the clauses associated with OMP_FOR GS. */
3900 static inline tree
3901 gimple_omp_for_clauses (const_gimple gs)
3903 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3904 return gs->gimple_omp_for.clauses;
3908 /* Return a pointer to the OMP_FOR GS. */
3910 static inline tree *
3911 gimple_omp_for_clauses_ptr (gimple gs)
3913 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3914 return &gs->gimple_omp_for.clauses;
3918 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3920 static inline void
3921 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3923 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3924 gs->gimple_omp_for.clauses = clauses;
3928 /* Get the collapse count of OMP_FOR GS. */
3930 static inline size_t
3931 gimple_omp_for_collapse (gimple gs)
3933 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3934 return gs->gimple_omp_for.collapse;
3938 /* Return the index variable for OMP_FOR GS. */
3940 static inline tree
3941 gimple_omp_for_index (const_gimple gs, size_t i)
3943 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3944 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3945 return gs->gimple_omp_for.iter[i].index;
3949 /* Return a pointer to the index variable for OMP_FOR GS. */
3951 static inline tree *
3952 gimple_omp_for_index_ptr (gimple gs, size_t i)
3954 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3955 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3956 return &gs->gimple_omp_for.iter[i].index;
3960 /* Set INDEX to be the index variable for OMP_FOR GS. */
3962 static inline void
3963 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3965 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3966 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3967 gs->gimple_omp_for.iter[i].index = index;
3971 /* Return the initial value for OMP_FOR GS. */
3973 static inline tree
3974 gimple_omp_for_initial (const_gimple gs, size_t i)
3976 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3977 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3978 return gs->gimple_omp_for.iter[i].initial;
3982 /* Return a pointer to the initial value for OMP_FOR GS. */
3984 static inline tree *
3985 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3987 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3988 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3989 return &gs->gimple_omp_for.iter[i].initial;
3993 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3995 static inline void
3996 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3998 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3999 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4000 gs->gimple_omp_for.iter[i].initial = initial;
4004 /* Return the final value for OMP_FOR GS. */
4006 static inline tree
4007 gimple_omp_for_final (const_gimple gs, size_t i)
4009 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4010 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4011 return gs->gimple_omp_for.iter[i].final;
4015 /* Return a pointer to the final value for OMP_FOR GS. */
4017 static inline tree *
4018 gimple_omp_for_final_ptr (gimple gs, size_t i)
4020 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4021 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4022 return &gs->gimple_omp_for.iter[i].final;
4026 /* Set FINAL to be the final value for OMP_FOR GS. */
4028 static inline void
4029 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4031 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4032 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4033 gs->gimple_omp_for.iter[i].final = final;
4037 /* Return the increment value for OMP_FOR GS. */
4039 static inline tree
4040 gimple_omp_for_incr (const_gimple gs, size_t i)
4042 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4043 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4044 return gs->gimple_omp_for.iter[i].incr;
4048 /* Return a pointer to the increment value for OMP_FOR GS. */
4050 static inline tree *
4051 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4053 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4054 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4055 return &gs->gimple_omp_for.iter[i].incr;
4059 /* Set INCR to be the increment value for OMP_FOR GS. */
4061 static inline void
4062 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4064 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4065 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4066 gs->gimple_omp_for.iter[i].incr = incr;
4070 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4071 statement GS starts. */
4073 static inline gimple_seq *
4074 gimple_omp_for_pre_body_ptr (gimple gs)
4076 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4077 return &gs->gimple_omp_for.pre_body;
4081 /* Return the sequence of statements to execute before the OMP_FOR
4082 statement GS starts. */
4084 static inline gimple_seq
4085 gimple_omp_for_pre_body (gimple gs)
4087 return *gimple_omp_for_pre_body_ptr (gs);
4091 /* Set PRE_BODY to be the sequence of statements to execute before the
4092 OMP_FOR statement GS starts. */
4094 static inline void
4095 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4097 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4098 gs->gimple_omp_for.pre_body = pre_body;
4102 /* Return the clauses associated with OMP_PARALLEL GS. */
4104 static inline tree
4105 gimple_omp_parallel_clauses (const_gimple gs)
4107 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4108 return gs->gimple_omp_parallel.clauses;
4112 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4114 static inline tree *
4115 gimple_omp_parallel_clauses_ptr (gimple gs)
4117 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4118 return &gs->gimple_omp_parallel.clauses;
4122 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4123 GS. */
4125 static inline void
4126 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4128 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4129 gs->gimple_omp_parallel.clauses = clauses;
4133 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4135 static inline tree
4136 gimple_omp_parallel_child_fn (const_gimple gs)
4138 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4139 return gs->gimple_omp_parallel.child_fn;
4142 /* Return a pointer to the child function used to hold the body of
4143 OMP_PARALLEL GS. */
4145 static inline tree *
4146 gimple_omp_parallel_child_fn_ptr (gimple gs)
4148 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4149 return &gs->gimple_omp_parallel.child_fn;
4153 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4155 static inline void
4156 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4158 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4159 gs->gimple_omp_parallel.child_fn = child_fn;
4163 /* Return the artificial argument used to send variables and values
4164 from the parent to the children threads in OMP_PARALLEL GS. */
4166 static inline tree
4167 gimple_omp_parallel_data_arg (const_gimple gs)
4169 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4170 return gs->gimple_omp_parallel.data_arg;
4174 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4176 static inline tree *
4177 gimple_omp_parallel_data_arg_ptr (gimple gs)
4179 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4180 return &gs->gimple_omp_parallel.data_arg;
4184 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4186 static inline void
4187 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4189 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4190 gs->gimple_omp_parallel.data_arg = data_arg;
4194 /* Return the clauses associated with OMP_TASK GS. */
4196 static inline tree
4197 gimple_omp_task_clauses (const_gimple gs)
4199 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4200 return gs->gimple_omp_parallel.clauses;
4204 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4206 static inline tree *
4207 gimple_omp_task_clauses_ptr (gimple gs)
4209 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4210 return &gs->gimple_omp_parallel.clauses;
4214 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4215 GS. */
4217 static inline void
4218 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4220 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4221 gs->gimple_omp_parallel.clauses = clauses;
4225 /* Return the child function used to hold the body of OMP_TASK GS. */
4227 static inline tree
4228 gimple_omp_task_child_fn (const_gimple gs)
4230 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4231 return gs->gimple_omp_parallel.child_fn;
4234 /* Return a pointer to the child function used to hold the body of
4235 OMP_TASK GS. */
4237 static inline tree *
4238 gimple_omp_task_child_fn_ptr (gimple gs)
4240 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4241 return &gs->gimple_omp_parallel.child_fn;
4245 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4247 static inline void
4248 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4250 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4251 gs->gimple_omp_parallel.child_fn = child_fn;
4255 /* Return the artificial argument used to send variables and values
4256 from the parent to the children threads in OMP_TASK GS. */
4258 static inline tree
4259 gimple_omp_task_data_arg (const_gimple gs)
4261 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4262 return gs->gimple_omp_parallel.data_arg;
4266 /* Return a pointer to the data argument for OMP_TASK GS. */
4268 static inline tree *
4269 gimple_omp_task_data_arg_ptr (gimple gs)
4271 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4272 return &gs->gimple_omp_parallel.data_arg;
4276 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4278 static inline void
4279 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4281 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4282 gs->gimple_omp_parallel.data_arg = data_arg;
4286 /* Return the clauses associated with OMP_TASK GS. */
4288 static inline tree
4289 gimple_omp_taskreg_clauses (const_gimple gs)
4291 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4292 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4293 return gs->gimple_omp_parallel.clauses;
4297 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4299 static inline tree *
4300 gimple_omp_taskreg_clauses_ptr (gimple gs)
4302 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4303 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4304 return &gs->gimple_omp_parallel.clauses;
4308 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4309 GS. */
4311 static inline void
4312 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4314 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4315 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4316 gs->gimple_omp_parallel.clauses = clauses;
4320 /* Return the child function used to hold the body of OMP_TASK GS. */
4322 static inline tree
4323 gimple_omp_taskreg_child_fn (const_gimple gs)
4325 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4326 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4327 return gs->gimple_omp_parallel.child_fn;
4330 /* Return a pointer to the child function used to hold the body of
4331 OMP_TASK GS. */
4333 static inline tree *
4334 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4336 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4337 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4338 return &gs->gimple_omp_parallel.child_fn;
4342 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4344 static inline void
4345 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4347 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4348 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4349 gs->gimple_omp_parallel.child_fn = child_fn;
4353 /* Return the artificial argument used to send variables and values
4354 from the parent to the children threads in OMP_TASK GS. */
4356 static inline tree
4357 gimple_omp_taskreg_data_arg (const_gimple gs)
4359 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4360 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4361 return gs->gimple_omp_parallel.data_arg;
4365 /* Return a pointer to the data argument for OMP_TASK GS. */
4367 static inline tree *
4368 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4370 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4371 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4372 return &gs->gimple_omp_parallel.data_arg;
4376 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4378 static inline void
4379 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4381 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4382 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4383 gs->gimple_omp_parallel.data_arg = data_arg;
4387 /* Return the copy function used to hold the body of OMP_TASK GS. */
4389 static inline tree
4390 gimple_omp_task_copy_fn (const_gimple gs)
4392 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4393 return gs->gimple_omp_task.copy_fn;
4396 /* Return a pointer to the copy function used to hold the body of
4397 OMP_TASK GS. */
4399 static inline tree *
4400 gimple_omp_task_copy_fn_ptr (gimple gs)
4402 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4403 return &gs->gimple_omp_task.copy_fn;
4407 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4409 static inline void
4410 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4412 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4413 gs->gimple_omp_task.copy_fn = copy_fn;
4417 /* Return size of the data block in bytes in OMP_TASK GS. */
4419 static inline tree
4420 gimple_omp_task_arg_size (const_gimple gs)
4422 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4423 return gs->gimple_omp_task.arg_size;
4427 /* Return a pointer to the data block size for OMP_TASK GS. */
4429 static inline tree *
4430 gimple_omp_task_arg_size_ptr (gimple gs)
4432 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4433 return &gs->gimple_omp_task.arg_size;
4437 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4439 static inline void
4440 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4442 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4443 gs->gimple_omp_task.arg_size = arg_size;
4447 /* Return align of the data block in bytes in OMP_TASK GS. */
4449 static inline tree
4450 gimple_omp_task_arg_align (const_gimple gs)
4452 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4453 return gs->gimple_omp_task.arg_align;
4457 /* Return a pointer to the data block align for OMP_TASK GS. */
4459 static inline tree *
4460 gimple_omp_task_arg_align_ptr (gimple gs)
4462 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4463 return &gs->gimple_omp_task.arg_align;
4467 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4469 static inline void
4470 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4472 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4473 gs->gimple_omp_task.arg_align = arg_align;
4477 /* Return the clauses associated with OMP_SINGLE GS. */
4479 static inline tree
4480 gimple_omp_single_clauses (const_gimple gs)
4482 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4483 return gs->gimple_omp_single.clauses;
4487 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4489 static inline tree *
4490 gimple_omp_single_clauses_ptr (gimple gs)
4492 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4493 return &gs->gimple_omp_single.clauses;
4497 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4499 static inline void
4500 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4502 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4503 gs->gimple_omp_single.clauses = clauses;
4507 /* Return the clauses associated with OMP_SECTIONS GS. */
4509 static inline tree
4510 gimple_omp_sections_clauses (const_gimple gs)
4512 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4513 return gs->gimple_omp_sections.clauses;
4517 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4519 static inline tree *
4520 gimple_omp_sections_clauses_ptr (gimple gs)
4522 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4523 return &gs->gimple_omp_sections.clauses;
4527 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4528 GS. */
4530 static inline void
4531 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4533 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4534 gs->gimple_omp_sections.clauses = clauses;
4538 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4539 in GS. */
4541 static inline tree
4542 gimple_omp_sections_control (const_gimple gs)
4544 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4545 return gs->gimple_omp_sections.control;
4549 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4550 GS. */
4552 static inline tree *
4553 gimple_omp_sections_control_ptr (gimple gs)
4555 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4556 return &gs->gimple_omp_sections.control;
4560 /* Set CONTROL to be the set of clauses associated with the
4561 GIMPLE_OMP_SECTIONS in GS. */
4563 static inline void
4564 gimple_omp_sections_set_control (gimple gs, tree control)
4566 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4567 gs->gimple_omp_sections.control = control;
4571 /* Set COND to be the condition code for OMP_FOR GS. */
4573 static inline void
4574 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4576 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4577 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4578 && i < gs->gimple_omp_for.collapse);
4579 gs->gimple_omp_for.iter[i].cond = cond;
4583 /* Return the condition code associated with OMP_FOR GS. */
4585 static inline enum tree_code
4586 gimple_omp_for_cond (const_gimple gs, size_t i)
4588 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4589 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4590 return gs->gimple_omp_for.iter[i].cond;
4594 /* Set the value being stored in an atomic store. */
4596 static inline void
4597 gimple_omp_atomic_store_set_val (gimple g, tree val)
4599 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4600 g->gimple_omp_atomic_store.val = val;
4604 /* Return the value being stored in an atomic store. */
4606 static inline tree
4607 gimple_omp_atomic_store_val (const_gimple g)
4609 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4610 return g->gimple_omp_atomic_store.val;
4614 /* Return a pointer to the value being stored in an atomic store. */
4616 static inline tree *
4617 gimple_omp_atomic_store_val_ptr (gimple g)
4619 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4620 return &g->gimple_omp_atomic_store.val;
4624 /* Set the LHS of an atomic load. */
4626 static inline void
4627 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4629 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4630 g->gimple_omp_atomic_load.lhs = lhs;
4634 /* Get the LHS of an atomic load. */
4636 static inline tree
4637 gimple_omp_atomic_load_lhs (const_gimple g)
4639 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4640 return g->gimple_omp_atomic_load.lhs;
4644 /* Return a pointer to the LHS of an atomic load. */
4646 static inline tree *
4647 gimple_omp_atomic_load_lhs_ptr (gimple g)
4649 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4650 return &g->gimple_omp_atomic_load.lhs;
4654 /* Set the RHS of an atomic load. */
4656 static inline void
4657 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4659 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4660 g->gimple_omp_atomic_load.rhs = rhs;
4664 /* Get the RHS of an atomic load. */
4666 static inline tree
4667 gimple_omp_atomic_load_rhs (const_gimple g)
4669 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4670 return g->gimple_omp_atomic_load.rhs;
4674 /* Return a pointer to the RHS of an atomic load. */
4676 static inline tree *
4677 gimple_omp_atomic_load_rhs_ptr (gimple g)
4679 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4680 return &g->gimple_omp_atomic_load.rhs;
4684 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4686 static inline tree
4687 gimple_omp_continue_control_def (const_gimple g)
4689 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4690 return g->gimple_omp_continue.control_def;
4693 /* The same as above, but return the address. */
4695 static inline tree *
4696 gimple_omp_continue_control_def_ptr (gimple g)
4698 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4699 return &g->gimple_omp_continue.control_def;
4702 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4704 static inline void
4705 gimple_omp_continue_set_control_def (gimple g, tree def)
4707 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4708 g->gimple_omp_continue.control_def = def;
4712 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4714 static inline tree
4715 gimple_omp_continue_control_use (const_gimple g)
4717 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4718 return g->gimple_omp_continue.control_use;
4722 /* The same as above, but return the address. */
4724 static inline tree *
4725 gimple_omp_continue_control_use_ptr (gimple g)
4727 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4728 return &g->gimple_omp_continue.control_use;
4732 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4734 static inline void
4735 gimple_omp_continue_set_control_use (gimple g, tree use)
4737 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4738 g->gimple_omp_continue.control_use = use;
4741 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4743 static inline gimple_seq *
4744 gimple_transaction_body_ptr (gimple gs)
4746 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4747 return &gs->gimple_transaction.body;
4750 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4752 static inline gimple_seq
4753 gimple_transaction_body (gimple gs)
4755 return *gimple_transaction_body_ptr (gs);
4758 /* Return the label associated with a GIMPLE_TRANSACTION. */
4760 static inline tree
4761 gimple_transaction_label (const_gimple gs)
4763 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4764 return gs->gimple_transaction.label;
4767 static inline tree *
4768 gimple_transaction_label_ptr (gimple gs)
4770 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4771 return &gs->gimple_transaction.label;
4774 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4776 static inline unsigned int
4777 gimple_transaction_subcode (const_gimple gs)
4779 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4780 return gs->gsbase.subcode;
4783 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4785 static inline void
4786 gimple_transaction_set_body (gimple gs, gimple_seq body)
4788 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4789 gs->gimple_transaction.body = body;
4792 /* Set the label associated with a GIMPLE_TRANSACTION. */
4794 static inline void
4795 gimple_transaction_set_label (gimple gs, tree label)
4797 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4798 gs->gimple_transaction.label = label;
4801 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4803 static inline void
4804 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4806 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4807 gs->gsbase.subcode = subcode;
4811 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4813 static inline tree *
4814 gimple_return_retval_ptr (const_gimple gs)
4816 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4817 return gimple_op_ptr (gs, 0);
4820 /* Return the return value for GIMPLE_RETURN GS. */
4822 static inline tree
4823 gimple_return_retval (const_gimple gs)
4825 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4826 return gimple_op (gs, 0);
4830 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4832 static inline void
4833 gimple_return_set_retval (gimple gs, tree retval)
4835 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4836 gimple_set_op (gs, 0, retval);
4840 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4842 #define CASE_GIMPLE_OMP \
4843 case GIMPLE_OMP_PARALLEL: \
4844 case GIMPLE_OMP_TASK: \
4845 case GIMPLE_OMP_FOR: \
4846 case GIMPLE_OMP_SECTIONS: \
4847 case GIMPLE_OMP_SECTIONS_SWITCH: \
4848 case GIMPLE_OMP_SINGLE: \
4849 case GIMPLE_OMP_SECTION: \
4850 case GIMPLE_OMP_MASTER: \
4851 case GIMPLE_OMP_ORDERED: \
4852 case GIMPLE_OMP_CRITICAL: \
4853 case GIMPLE_OMP_RETURN: \
4854 case GIMPLE_OMP_ATOMIC_LOAD: \
4855 case GIMPLE_OMP_ATOMIC_STORE: \
4856 case GIMPLE_OMP_CONTINUE
4858 static inline bool
4859 is_gimple_omp (const_gimple stmt)
4861 switch (gimple_code (stmt))
4863 CASE_GIMPLE_OMP:
4864 return true;
4865 default:
4866 return false;
4871 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4873 static inline bool
4874 gimple_nop_p (const_gimple g)
4876 return gimple_code (g) == GIMPLE_NOP;
4880 /* Return true if GS is a GIMPLE_RESX. */
4882 static inline bool
4883 is_gimple_resx (const_gimple gs)
4885 return gimple_code (gs) == GIMPLE_RESX;
4888 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4890 static inline enum br_predictor
4891 gimple_predict_predictor (gimple gs)
4893 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4894 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4898 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4900 static inline void
4901 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4903 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4904 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4905 | (unsigned) predictor;
4909 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4911 static inline enum prediction
4912 gimple_predict_outcome (gimple gs)
4914 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4915 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4919 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4921 static inline void
4922 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4924 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4925 if (outcome == TAKEN)
4926 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4927 else
4928 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4932 /* Return the type of the main expression computed by STMT. Return
4933 void_type_node if the statement computes nothing. */
4935 static inline tree
4936 gimple_expr_type (const_gimple stmt)
4938 enum gimple_code code = gimple_code (stmt);
4940 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4942 tree type;
4943 /* In general we want to pass out a type that can be substituted
4944 for both the RHS and the LHS types if there is a possibly
4945 useless conversion involved. That means returning the
4946 original RHS type as far as we can reconstruct it. */
4947 if (code == GIMPLE_CALL)
4948 type = gimple_call_return_type (stmt);
4949 else
4950 switch (gimple_assign_rhs_code (stmt))
4952 case POINTER_PLUS_EXPR:
4953 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4954 break;
4956 default:
4957 /* As fallback use the type of the LHS. */
4958 type = TREE_TYPE (gimple_get_lhs (stmt));
4959 break;
4961 return type;
4963 else if (code == GIMPLE_COND)
4964 return boolean_type_node;
4965 else
4966 return void_type_node;
4969 /* Return true if TYPE is a suitable type for a scalar register variable. */
4971 static inline bool
4972 is_gimple_reg_type (tree type)
4974 return !AGGREGATE_TYPE_P (type);
4977 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4979 static inline gimple_stmt_iterator
4980 gsi_start_1 (gimple_seq *seq)
4982 gimple_stmt_iterator i;
4984 i.ptr = gimple_seq_first (*seq);
4985 i.seq = seq;
4986 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4988 return i;
4991 #define gsi_start(x) gsi_start_1(&(x))
4993 static inline gimple_stmt_iterator
4994 gsi_none (void)
4996 gimple_stmt_iterator i;
4997 i.ptr = NULL;
4998 i.seq = NULL;
4999 i.bb = NULL;
5000 return i;
5003 /* Return a new iterator pointing to the first statement in basic block BB. */
5005 static inline gimple_stmt_iterator
5006 gsi_start_bb (basic_block bb)
5008 gimple_stmt_iterator i;
5009 gimple_seq *seq;
5011 seq = bb_seq_addr (bb);
5012 i.ptr = gimple_seq_first (*seq);
5013 i.seq = seq;
5014 i.bb = bb;
5016 return i;
5020 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5022 static inline gimple_stmt_iterator
5023 gsi_last_1 (gimple_seq *seq)
5025 gimple_stmt_iterator i;
5027 i.ptr = gimple_seq_last (*seq);
5028 i.seq = seq;
5029 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5031 return i;
5034 #define gsi_last(x) gsi_last_1(&(x))
5036 /* Return a new iterator pointing to the last statement in basic block BB. */
5038 static inline gimple_stmt_iterator
5039 gsi_last_bb (basic_block bb)
5041 gimple_stmt_iterator i;
5042 gimple_seq *seq;
5044 seq = bb_seq_addr (bb);
5045 i.ptr = gimple_seq_last (*seq);
5046 i.seq = seq;
5047 i.bb = bb;
5049 return i;
5053 /* Return true if I is at the end of its sequence. */
5055 static inline bool
5056 gsi_end_p (gimple_stmt_iterator i)
5058 return i.ptr == NULL;
5062 /* Return true if I is one statement before the end of its sequence. */
5064 static inline bool
5065 gsi_one_before_end_p (gimple_stmt_iterator i)
5067 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5071 /* Advance the iterator to the next gimple statement. */
5073 static inline void
5074 gsi_next (gimple_stmt_iterator *i)
5076 i->ptr = i->ptr->gsbase.next;
5079 /* Advance the iterator to the previous gimple statement. */
5081 static inline void
5082 gsi_prev (gimple_stmt_iterator *i)
5084 gimple prev = i->ptr->gsbase.prev;
5085 if (prev->gsbase.next)
5086 i->ptr = prev;
5087 else
5088 i->ptr = NULL;
5091 /* Return the current stmt. */
5093 static inline gimple
5094 gsi_stmt (gimple_stmt_iterator i)
5096 return i.ptr;
5099 /* Return a block statement iterator that points to the first non-label
5100 statement in block BB. */
5102 static inline gimple_stmt_iterator
5103 gsi_after_labels (basic_block bb)
5105 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5107 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5108 gsi_next (&gsi);
5110 return gsi;
5113 /* Advance the iterator to the next non-debug gimple statement. */
5115 static inline void
5116 gsi_next_nondebug (gimple_stmt_iterator *i)
5120 gsi_next (i);
5122 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5125 /* Advance the iterator to the next non-debug gimple statement. */
5127 static inline void
5128 gsi_prev_nondebug (gimple_stmt_iterator *i)
5132 gsi_prev (i);
5134 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5137 /* Return a new iterator pointing to the first non-debug statement in
5138 basic block BB. */
5140 static inline gimple_stmt_iterator
5141 gsi_start_nondebug_bb (basic_block bb)
5143 gimple_stmt_iterator i = gsi_start_bb (bb);
5145 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5146 gsi_next_nondebug (&i);
5148 return i;
5151 /* Return a new iterator pointing to the last non-debug statement in
5152 basic block BB. */
5154 static inline gimple_stmt_iterator
5155 gsi_last_nondebug_bb (basic_block bb)
5157 gimple_stmt_iterator i = gsi_last_bb (bb);
5159 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5160 gsi_prev_nondebug (&i);
5162 return i;
5166 /* Return the basic block associated with this iterator. */
5168 static inline basic_block
5169 gsi_bb (gimple_stmt_iterator i)
5171 return i.bb;
5175 /* Return the sequence associated with this iterator. */
5177 static inline gimple_seq
5178 gsi_seq (gimple_stmt_iterator i)
5180 return *i.seq;
5184 enum gsi_iterator_update
5186 GSI_NEW_STMT, /* Only valid when single statement is added, move
5187 iterator to it. */
5188 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5189 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5190 for linking other statements in the same
5191 direction. */
5194 /* In gimple-iterator.c */
5195 gimple_stmt_iterator gsi_start_phis (basic_block);
5196 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5197 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5198 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5199 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5200 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5201 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5202 enum gsi_iterator_update);
5203 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5204 enum gsi_iterator_update);
5205 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5206 enum gsi_iterator_update);
5207 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5208 enum gsi_iterator_update);
5209 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5210 enum gsi_iterator_update);
5211 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5212 enum gsi_iterator_update);
5213 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5214 enum gsi_iterator_update);
5215 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5216 enum gsi_iterator_update);
5217 bool gsi_remove (gimple_stmt_iterator *, bool);
5218 gimple_stmt_iterator gsi_for_stmt (gimple);
5219 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5220 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5221 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5222 void gsi_insert_on_edge (edge, gimple);
5223 void gsi_insert_seq_on_edge (edge, gimple_seq);
5224 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5225 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5226 void gsi_commit_one_edge_insert (edge, basic_block *);
5227 void gsi_commit_edge_inserts (void);
5228 gimple gimple_call_copy_skip_args (gimple, bitmap);
5231 /* Convenience routines to walk all statements of a gimple function.
5232 Note that this is useful exclusively before the code is converted
5233 into SSA form. Once the program is in SSA form, the standard
5234 operand interface should be used to analyze/modify statements. */
5235 struct walk_stmt_info
5237 /* Points to the current statement being walked. */
5238 gimple_stmt_iterator gsi;
5240 /* Additional data that the callback functions may want to carry
5241 through the recursion. */
5242 void *info;
5244 /* Pointer map used to mark visited tree nodes when calling
5245 walk_tree on each operand. If set to NULL, duplicate tree nodes
5246 will be visited more than once. */
5247 struct pointer_set_t *pset;
5249 /* Operand returned by the callbacks. This is set when calling
5250 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5251 returns non-NULL, this field will contain the tree returned by
5252 the last callback. */
5253 tree callback_result;
5255 /* Indicates whether the operand being examined may be replaced
5256 with something that matches is_gimple_val (if true) or something
5257 slightly more complicated (if false). "Something" technically
5258 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5259 but we never try to form anything more complicated than that, so
5260 we don't bother checking.
5262 Also note that CALLBACK should update this flag while walking the
5263 sub-expressions of a statement. For instance, when walking the
5264 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5265 to true, however, when walking &var, the operand of that
5266 ADDR_EXPR does not need to be a GIMPLE value. */
5267 BOOL_BITFIELD val_only : 1;
5269 /* True if we are currently walking the LHS of an assignment. */
5270 BOOL_BITFIELD is_lhs : 1;
5272 /* Optional. Set to true by the callback functions if they made any
5273 changes. */
5274 BOOL_BITFIELD changed : 1;
5276 /* True if we're interested in location information. */
5277 BOOL_BITFIELD want_locations : 1;
5279 /* True if we've removed the statement that was processed. */
5280 BOOL_BITFIELD removed_stmt : 1;
5283 /* Callback for walk_gimple_stmt. Called for every statement found
5284 during traversal. The first argument points to the statement to
5285 walk. The second argument is a flag that the callback sets to
5286 'true' if it the callback handled all the operands and
5287 sub-statements of the statement (the default value of this flag is
5288 'false'). The third argument is an anonymous pointer to data
5289 to be used by the callback. */
5290 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5291 struct walk_stmt_info *);
5293 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5294 struct walk_stmt_info *);
5295 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5296 struct walk_stmt_info *);
5297 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5298 struct walk_stmt_info *);
5299 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5301 /* Enum and arrays used for allocation stats. Keep in sync with
5302 gimple.c:gimple_alloc_kind_names. */
5303 enum gimple_alloc_kind
5305 gimple_alloc_kind_assign, /* Assignments. */
5306 gimple_alloc_kind_phi, /* PHI nodes. */
5307 gimple_alloc_kind_cond, /* Conditionals. */
5308 gimple_alloc_kind_rest, /* Everything else. */
5309 gimple_alloc_kind_all
5312 extern int gimple_alloc_counts[];
5313 extern int gimple_alloc_sizes[];
5315 /* Return the allocation kind for a given stmt CODE. */
5316 static inline enum gimple_alloc_kind
5317 gimple_alloc_kind (enum gimple_code code)
5319 switch (code)
5321 case GIMPLE_ASSIGN:
5322 return gimple_alloc_kind_assign;
5323 case GIMPLE_PHI:
5324 return gimple_alloc_kind_phi;
5325 case GIMPLE_COND:
5326 return gimple_alloc_kind_cond;
5327 default:
5328 return gimple_alloc_kind_rest;
5332 extern void dump_gimple_statistics (void);
5334 /* In gimple-fold.c. */
5335 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5336 tree gimple_fold_builtin (gimple);
5337 bool fold_stmt (gimple_stmt_iterator *);
5338 bool fold_stmt_inplace (gimple_stmt_iterator *);
5339 tree get_symbol_constant_value (tree);
5340 tree canonicalize_constructor_val (tree, tree);
5341 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5342 enum tree_code, tree, tree);
5343 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5344 enum tree_code, tree, tree);
5346 bool gimple_val_nonnegative_real_p (tree);
5349 /* Set the location of all statements in SEQ to LOC. */
5351 static inline void
5352 gimple_seq_set_location (gimple_seq seq, location_t loc)
5354 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5355 gimple_set_location (gsi_stmt (i), loc);
5358 #endif /* GCC_GIMPLE_H */