PR c++/54955 - Fail to parse alignas expr at the beginning of a declaration
[official-gcc.git] / gcc / gimple.h
blob19d45d00e3e2d87ceecb19ed43c1240f408a4d50
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010, 2011, 2012 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 "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "basic-block.h"
31 #include "tree.h"
32 #include "tree-ssa-operands.h"
33 #include "tree-ssa-alias.h"
34 #include "internal-fn.h"
36 typedef gimple gimple_seq_node;
38 /* For each block, the PHI nodes that need to be rewritten are stored into
39 these vectors. */
40 typedef VEC(gimple, heap) *gimple_vec;
41 DEF_VEC_P (gimple_vec);
42 DEF_VEC_ALLOC_P (gimple_vec, heap);
44 enum gimple_code {
45 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
46 #include "gimple.def"
47 #undef DEFGSCODE
48 LAST_AND_UNUSED_GIMPLE_CODE
51 extern const char *const gimple_code_name[];
52 extern const unsigned char gimple_rhs_class_table[];
54 /* Error out if a gimple tuple is addressed incorrectly. */
55 #if defined ENABLE_GIMPLE_CHECKING
56 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
57 extern void gimple_check_failed (const_gimple, const char *, int, \
58 const char *, enum gimple_code, \
59 enum tree_code) ATTRIBUTE_NORETURN;
61 #define GIMPLE_CHECK(GS, CODE) \
62 do { \
63 const_gimple __gs = (GS); \
64 if (gimple_code (__gs) != (CODE)) \
65 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
66 (CODE), ERROR_MARK); \
67 } while (0)
68 #else /* not ENABLE_GIMPLE_CHECKING */
69 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
70 #define GIMPLE_CHECK(GS, CODE) (void)0
71 #endif
73 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
74 get_gimple_rhs_class. */
75 enum gimple_rhs_class
77 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
78 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
79 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
80 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
81 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
82 name, a _DECL, a _REF, etc. */
85 /* Specific flags for individual GIMPLE statements. These flags are
86 always stored in gimple_statement_base.subcode and they may only be
87 defined for statement codes that do not use sub-codes.
89 Values for the masks can overlap as long as the overlapping values
90 are never used in the same statement class.
92 The maximum mask value that can be defined is 1 << 15 (i.e., each
93 statement code can hold up to 16 bitflags).
95 Keep this list sorted. */
96 enum gf_mask {
97 GF_ASM_INPUT = 1 << 0,
98 GF_ASM_VOLATILE = 1 << 1,
99 GF_CALL_FROM_THUNK = 1 << 0,
100 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
101 GF_CALL_TAILCALL = 1 << 2,
102 GF_CALL_VA_ARG_PACK = 1 << 3,
103 GF_CALL_NOTHROW = 1 << 4,
104 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
105 GF_CALL_INTERNAL = 1 << 6,
106 GF_OMP_PARALLEL_COMBINED = 1 << 0,
108 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
109 a thread synchronization via some sort of barrier. The exact barrier
110 that would otherwise be emitted is dependent on the OMP statement with
111 which this return is associated. */
112 GF_OMP_RETURN_NOWAIT = 1 << 0,
114 GF_OMP_SECTION_LAST = 1 << 0,
115 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
116 GF_PREDICT_TAKEN = 1 << 15
119 /* Currently, there are only two types of gimple debug stmt. Others are
120 envisioned, for example, to enable the generation of is_stmt notes
121 in line number information, to mark sequence points, etc. This
122 subcode is to be used to tell them apart. */
123 enum gimple_debug_subcode {
124 GIMPLE_DEBUG_BIND = 0,
125 GIMPLE_DEBUG_SOURCE_BIND = 1
128 /* Masks for selecting a pass local flag (PLF) to work on. These
129 masks are used by gimple_set_plf and gimple_plf. */
130 enum plf_mask {
131 GF_PLF_1 = 1 << 0,
132 GF_PLF_2 = 1 << 1
135 /* Iterator object for GIMPLE statement sequences. */
137 typedef struct
139 /* Sequence node holding the current statement. */
140 gimple_seq_node ptr;
142 /* Sequence and basic block holding the statement. These fields
143 are necessary to handle edge cases such as when statement is
144 added to an empty basic block or when the last statement of a
145 block/sequence is removed. */
146 gimple_seq *seq;
147 basic_block bb;
148 } gimple_stmt_iterator;
151 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
152 are for 64 bit hosts. */
154 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
155 /* [ WORD 1 ]
156 Main identifying code for a tuple. */
157 ENUM_BITFIELD(gimple_code) code : 8;
159 /* Nonzero if a warning should not be emitted on this tuple. */
160 unsigned int no_warning : 1;
162 /* Nonzero if this tuple has been visited. Passes are responsible
163 for clearing this bit before using it. */
164 unsigned int visited : 1;
166 /* Nonzero if this tuple represents a non-temporal move. */
167 unsigned int nontemporal_move : 1;
169 /* Pass local flags. These flags are free for any pass to use as
170 they see fit. Passes should not assume that these flags contain
171 any useful value when the pass starts. Any initial state that
172 the pass requires should be set on entry to the pass. See
173 gimple_set_plf and gimple_plf for usage. */
174 unsigned int plf : 2;
176 /* Nonzero if this statement has been modified and needs to have its
177 operands rescanned. */
178 unsigned modified : 1;
180 /* Nonzero if this statement contains volatile operands. */
181 unsigned has_volatile_ops : 1;
183 /* The SUBCODE field can be used for tuple-specific flags for tuples
184 that do not require subcodes. Note that SUBCODE should be at
185 least as wide as tree codes, as several tuples store tree codes
186 in there. */
187 unsigned int subcode : 16;
189 /* UID of this statement. This is used by passes that want to
190 assign IDs to statements. It must be assigned and used by each
191 pass. By default it should be assumed to contain garbage. */
192 unsigned uid;
194 /* [ WORD 2 ]
195 Locus information for debug info. */
196 location_t location;
198 /* Number of operands in this tuple. */
199 unsigned num_ops;
201 /* [ WORD 3 ]
202 Basic block holding this statement. */
203 basic_block bb;
205 /* [ WORD 4-5 ]
206 Linked lists of gimple statements. The next pointers form
207 a NULL terminated list, the prev pointers are a cyclic list.
208 A gimple statement is hence also a double-ended list of
209 statements, with the pointer itself being the first element,
210 and the prev pointer being the last. */
211 gimple next;
212 gimple GTY((skip)) prev;
216 /* Base structure for tuples with operands. */
218 struct GTY(()) gimple_statement_with_ops_base
220 /* [ WORD 1-6 ] */
221 struct gimple_statement_base gsbase;
223 /* [ WORD 7 ]
224 SSA operand vectors. NOTE: It should be possible to
225 amalgamate these vectors with the operand vector OP. However,
226 the SSA operand vectors are organized differently and contain
227 more information (like immediate use chaining). */
228 struct use_optype_d GTY((skip (""))) *use_ops;
232 /* Statements that take register operands. */
234 struct GTY(()) gimple_statement_with_ops
236 /* [ WORD 1-7 ] */
237 struct gimple_statement_with_ops_base opbase;
239 /* [ WORD 8 ]
240 Operand vector. NOTE! This must always be the last field
241 of this structure. In particular, this means that this
242 structure cannot be embedded inside another one. */
243 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
247 /* Base for statements that take both memory and register operands. */
249 struct GTY(()) gimple_statement_with_memory_ops_base
251 /* [ WORD 1-7 ] */
252 struct gimple_statement_with_ops_base opbase;
254 /* [ WORD 8-9 ]
255 Virtual operands for this statement. The GC will pick them
256 up via the ssa_names array. */
257 tree GTY((skip (""))) vdef;
258 tree GTY((skip (""))) vuse;
262 /* Statements that take both memory and register operands. */
264 struct GTY(()) gimple_statement_with_memory_ops
266 /* [ WORD 1-9 ] */
267 struct gimple_statement_with_memory_ops_base membase;
269 /* [ WORD 10 ]
270 Operand vector. NOTE! This must always be the last field
271 of this structure. In particular, this means that this
272 structure cannot be embedded inside another one. */
273 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
277 /* Call statements that take both memory and register operands. */
279 struct GTY(()) gimple_statement_call
281 /* [ WORD 1-9 ] */
282 struct gimple_statement_with_memory_ops_base membase;
284 /* [ WORD 10-13 ] */
285 struct pt_solution call_used;
286 struct pt_solution call_clobbered;
288 /* [ WORD 14 ] */
289 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
290 tree GTY ((tag ("0"))) fntype;
291 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
292 } u;
294 /* [ WORD 15 ]
295 Operand vector. NOTE! This must always be the last field
296 of this structure. In particular, this means that this
297 structure cannot be embedded inside another one. */
298 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
302 /* OpenMP statements (#pragma omp). */
304 struct GTY(()) gimple_statement_omp {
305 /* [ WORD 1-6 ] */
306 struct gimple_statement_base gsbase;
308 /* [ WORD 7 ] */
309 gimple_seq body;
313 /* GIMPLE_BIND */
315 struct GTY(()) gimple_statement_bind {
316 /* [ WORD 1-6 ] */
317 struct gimple_statement_base gsbase;
319 /* [ WORD 7 ]
320 Variables declared in this scope. */
321 tree vars;
323 /* [ WORD 8 ]
324 This is different than the BLOCK field in gimple_statement_base,
325 which is analogous to TREE_BLOCK (i.e., the lexical block holding
326 this statement). This field is the equivalent of BIND_EXPR_BLOCK
327 in tree land (i.e., the lexical scope defined by this bind). See
328 gimple-low.c. */
329 tree block;
331 /* [ WORD 9 ] */
332 gimple_seq body;
336 /* GIMPLE_CATCH */
338 struct GTY(()) gimple_statement_catch {
339 /* [ WORD 1-6 ] */
340 struct gimple_statement_base gsbase;
342 /* [ WORD 7 ] */
343 tree types;
345 /* [ WORD 8 ] */
346 gimple_seq handler;
350 /* GIMPLE_EH_FILTER */
352 struct GTY(()) gimple_statement_eh_filter {
353 /* [ WORD 1-6 ] */
354 struct gimple_statement_base gsbase;
356 /* [ WORD 7 ]
357 Filter types. */
358 tree types;
360 /* [ WORD 8 ]
361 Failure actions. */
362 gimple_seq failure;
365 /* GIMPLE_EH_ELSE */
367 struct GTY(()) gimple_statement_eh_else {
368 /* [ WORD 1-6 ] */
369 struct gimple_statement_base gsbase;
371 /* [ WORD 7,8 ] */
372 gimple_seq n_body, e_body;
375 /* GIMPLE_EH_MUST_NOT_THROW */
377 struct GTY(()) gimple_statement_eh_mnt {
378 /* [ WORD 1-6 ] */
379 struct gimple_statement_base gsbase;
381 /* [ WORD 7 ] Abort function decl. */
382 tree fndecl;
385 /* GIMPLE_PHI */
387 struct GTY(()) gimple_statement_phi {
388 /* [ WORD 1-6 ] */
389 struct gimple_statement_base gsbase;
391 /* [ WORD 7 ] */
392 unsigned capacity;
393 unsigned nargs;
395 /* [ WORD 8 ] */
396 tree result;
398 /* [ WORD 9 ] */
399 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
403 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
405 struct GTY(()) gimple_statement_eh_ctrl
407 /* [ WORD 1-6 ] */
408 struct gimple_statement_base gsbase;
410 /* [ WORD 7 ]
411 Exception region number. */
412 int region;
416 /* GIMPLE_TRY */
418 struct GTY(()) gimple_statement_try {
419 /* [ WORD 1-6 ] */
420 struct gimple_statement_base gsbase;
422 /* [ WORD 7 ]
423 Expression to evaluate. */
424 gimple_seq eval;
426 /* [ WORD 8 ]
427 Cleanup expression. */
428 gimple_seq cleanup;
431 /* Kind of GIMPLE_TRY statements. */
432 enum gimple_try_flags
434 /* A try/catch. */
435 GIMPLE_TRY_CATCH = 1 << 0,
437 /* A try/finally. */
438 GIMPLE_TRY_FINALLY = 1 << 1,
439 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
441 /* Analogous to TRY_CATCH_IS_CLEANUP. */
442 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
445 /* GIMPLE_WITH_CLEANUP_EXPR */
447 struct GTY(()) gimple_statement_wce {
448 /* [ WORD 1-6 ] */
449 struct gimple_statement_base gsbase;
451 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
452 executed if an exception is thrown, not on normal exit of its
453 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
454 in TARGET_EXPRs. */
456 /* [ WORD 7 ]
457 Cleanup expression. */
458 gimple_seq cleanup;
462 /* GIMPLE_ASM */
464 struct GTY(()) gimple_statement_asm
466 /* [ WORD 1-9 ] */
467 struct gimple_statement_with_memory_ops_base membase;
469 /* [ WORD 10 ]
470 __asm__ statement. */
471 const char *string;
473 /* [ WORD 11 ]
474 Number of inputs, outputs, clobbers, labels. */
475 unsigned char ni;
476 unsigned char no;
477 unsigned char nc;
478 unsigned char nl;
480 /* [ WORD 12 ]
481 Operand vector. NOTE! This must always be the last field
482 of this structure. In particular, this means that this
483 structure cannot be embedded inside another one. */
484 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
487 /* GIMPLE_OMP_CRITICAL */
489 struct GTY(()) gimple_statement_omp_critical {
490 /* [ WORD 1-7 ] */
491 struct gimple_statement_omp omp;
493 /* [ WORD 8 ]
494 Critical section name. */
495 tree name;
499 struct GTY(()) gimple_omp_for_iter {
500 /* Condition code. */
501 enum tree_code cond;
503 /* Index variable. */
504 tree index;
506 /* Initial value. */
507 tree initial;
509 /* Final value. */
510 tree final;
512 /* Increment. */
513 tree incr;
516 /* GIMPLE_OMP_FOR */
518 struct GTY(()) gimple_statement_omp_for {
519 /* [ WORD 1-7 ] */
520 struct gimple_statement_omp omp;
522 /* [ WORD 8 ] */
523 tree clauses;
525 /* [ WORD 9 ]
526 Number of elements in iter array. */
527 size_t collapse;
529 /* [ WORD 10 ] */
530 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
532 /* [ WORD 11 ]
533 Pre-body evaluated before the loop body begins. */
534 gimple_seq pre_body;
538 /* GIMPLE_OMP_PARALLEL */
540 struct GTY(()) gimple_statement_omp_parallel {
541 /* [ WORD 1-7 ] */
542 struct gimple_statement_omp omp;
544 /* [ WORD 8 ]
545 Clauses. */
546 tree clauses;
548 /* [ WORD 9 ]
549 Child function holding the body of the parallel region. */
550 tree child_fn;
552 /* [ WORD 10 ]
553 Shared data argument. */
554 tree data_arg;
558 /* GIMPLE_OMP_TASK */
560 struct GTY(()) gimple_statement_omp_task {
561 /* [ WORD 1-10 ] */
562 struct gimple_statement_omp_parallel par;
564 /* [ WORD 11 ]
565 Child function holding firstprivate initialization if needed. */
566 tree copy_fn;
568 /* [ WORD 12-13 ]
569 Size and alignment in bytes of the argument data block. */
570 tree arg_size;
571 tree arg_align;
575 /* GIMPLE_OMP_SECTION */
576 /* Uses struct gimple_statement_omp. */
579 /* GIMPLE_OMP_SECTIONS */
581 struct GTY(()) gimple_statement_omp_sections {
582 /* [ WORD 1-7 ] */
583 struct gimple_statement_omp omp;
585 /* [ WORD 8 ] */
586 tree clauses;
588 /* [ WORD 9 ]
589 The control variable used for deciding which of the sections to
590 execute. */
591 tree control;
594 /* GIMPLE_OMP_CONTINUE.
596 Note: This does not inherit from gimple_statement_omp, because we
597 do not need the body field. */
599 struct GTY(()) gimple_statement_omp_continue {
600 /* [ WORD 1-6 ] */
601 struct gimple_statement_base gsbase;
603 /* [ WORD 7 ] */
604 tree control_def;
606 /* [ WORD 8 ] */
607 tree control_use;
610 /* GIMPLE_OMP_SINGLE */
612 struct GTY(()) gimple_statement_omp_single {
613 /* [ WORD 1-7 ] */
614 struct gimple_statement_omp omp;
616 /* [ WORD 7 ] */
617 tree clauses;
621 /* GIMPLE_OMP_ATOMIC_LOAD.
622 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
623 contains a sequence, which we don't need here. */
625 struct GTY(()) gimple_statement_omp_atomic_load {
626 /* [ WORD 1-6 ] */
627 struct gimple_statement_base gsbase;
629 /* [ WORD 7-8 ] */
630 tree rhs, lhs;
633 /* GIMPLE_OMP_ATOMIC_STORE.
634 See note on GIMPLE_OMP_ATOMIC_LOAD. */
636 struct GTY(()) gimple_statement_omp_atomic_store {
637 /* [ WORD 1-6 ] */
638 struct gimple_statement_base gsbase;
640 /* [ WORD 7 ] */
641 tree val;
644 /* GIMPLE_TRANSACTION. */
646 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
648 /* The __transaction_atomic was declared [[outer]] or it is
649 __transaction_relaxed. */
650 #define GTMA_IS_OUTER (1u << 0)
651 #define GTMA_IS_RELAXED (1u << 1)
652 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
654 /* The transaction is seen to not have an abort. */
655 #define GTMA_HAVE_ABORT (1u << 2)
656 /* The transaction is seen to have loads or stores. */
657 #define GTMA_HAVE_LOAD (1u << 3)
658 #define GTMA_HAVE_STORE (1u << 4)
659 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
660 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
661 /* The transaction WILL enter serial irrevocable mode.
662 An irrevocable block post-dominates the entire transaction, such
663 that all invocations of the transaction will go serial-irrevocable.
664 In such case, we don't bother instrumenting the transaction, and
665 tell the runtime that it should begin the transaction in
666 serial-irrevocable mode. */
667 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
669 struct GTY(()) gimple_statement_transaction
671 /* [ WORD 1-9 ] */
672 struct gimple_statement_with_memory_ops_base gsbase;
674 /* [ WORD 10 ] */
675 gimple_seq body;
677 /* [ WORD 11 ] */
678 tree label;
681 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
682 enum gimple_statement_structure_enum {
683 #include "gsstruct.def"
684 LAST_GSS_ENUM
686 #undef DEFGSSTRUCT
689 /* Define the overall contents of a gimple tuple. It may be any of the
690 structures declared above for various types of tuples. */
692 union GTY ((desc ("gimple_statement_structure (&%h)"),
693 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
694 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
695 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
696 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
697 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
698 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
699 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
700 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
701 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
702 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
703 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
704 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
705 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
706 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
707 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
708 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
709 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
710 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
711 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
712 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
713 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
714 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
715 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
716 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
717 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
718 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
719 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
722 /* In gimple.c. */
724 /* Offset in bytes to the location of the operand vector.
725 Zero if there is no operand vector for this tuple structure. */
726 extern size_t const gimple_ops_offset_[];
728 /* Map GIMPLE codes to GSS codes. */
729 extern enum gimple_statement_structure_enum const gss_for_code_[];
731 /* This variable holds the currently expanded gimple statement for purposes
732 of comminucating the profile info to the builtin expanders. */
733 extern gimple currently_expanding_gimple_stmt;
735 gimple gimple_build_return (tree);
737 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
738 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
740 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
742 gimple
743 gimple_build_assign_with_ops (enum tree_code, tree,
744 tree, tree CXX_MEM_STAT_INFO);
745 gimple
746 gimple_build_assign_with_ops (enum tree_code, tree,
747 tree, tree, tree CXX_MEM_STAT_INFO);
749 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
750 #define gimple_build_debug_bind(var,val,stmt) \
751 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
752 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
753 #define gimple_build_debug_source_bind(var,val,stmt) \
754 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
756 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
757 gimple gimple_build_call (tree, unsigned, ...);
758 gimple gimple_build_call_valist (tree, unsigned, va_list);
759 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
760 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
761 gimple gimple_build_call_from_tree (tree);
762 gimple gimplify_assign (tree, tree, gimple_seq *);
763 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
764 gimple gimple_build_label (tree label);
765 gimple gimple_build_goto (tree dest);
766 gimple gimple_build_nop (void);
767 gimple gimple_build_bind (tree, gimple_seq, tree);
768 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
769 VEC(tree,gc) *, VEC(tree,gc) *);
770 gimple gimple_build_catch (tree, gimple_seq);
771 gimple gimple_build_eh_filter (tree, gimple_seq);
772 gimple gimple_build_eh_must_not_throw (tree);
773 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
774 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
775 gimple gimple_build_wce (gimple_seq);
776 gimple gimple_build_resx (int);
777 gimple gimple_build_eh_dispatch (int);
778 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
779 gimple gimple_build_switch (tree, tree, VEC(tree,heap) *);
780 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
781 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
782 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
783 gimple gimple_build_omp_critical (gimple_seq, tree);
784 gimple gimple_build_omp_section (gimple_seq);
785 gimple gimple_build_omp_continue (tree, tree);
786 gimple gimple_build_omp_master (gimple_seq);
787 gimple gimple_build_omp_return (bool);
788 gimple gimple_build_omp_ordered (gimple_seq);
789 gimple gimple_build_omp_sections (gimple_seq, tree);
790 gimple gimple_build_omp_sections_switch (void);
791 gimple gimple_build_omp_single (gimple_seq, tree);
792 gimple gimple_build_cdt (tree, tree);
793 gimple gimple_build_omp_atomic_load (tree, tree);
794 gimple gimple_build_omp_atomic_store (tree);
795 gimple gimple_build_transaction (gimple_seq, tree);
796 gimple gimple_build_predict (enum br_predictor, enum prediction);
797 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
798 void sort_case_labels (VEC(tree,heap) *);
799 void preprocess_case_label_vec_for_gimple (VEC(tree,heap) *, tree, tree *);
800 void gimple_set_body (tree, gimple_seq);
801 gimple_seq gimple_body (tree);
802 bool gimple_has_body_p (tree);
803 gimple_seq gimple_seq_alloc (void);
804 void gimple_seq_free (gimple_seq);
805 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
806 gimple_seq gimple_seq_copy (gimple_seq);
807 bool gimple_call_same_target_p (const_gimple, const_gimple);
808 int gimple_call_flags (const_gimple);
809 int gimple_call_return_flags (const_gimple);
810 int gimple_call_arg_flags (const_gimple, unsigned);
811 void gimple_call_reset_alias_info (gimple);
812 bool gimple_assign_copy_p (gimple);
813 bool gimple_assign_ssa_name_copy_p (gimple);
814 bool gimple_assign_unary_nop_p (gimple);
815 void gimple_set_bb (gimple, basic_block);
816 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
817 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
818 tree, tree, tree);
819 tree gimple_get_lhs (const_gimple);
820 void gimple_set_lhs (gimple, tree);
821 void gimple_replace_lhs (gimple, tree);
822 gimple gimple_copy (gimple);
823 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
824 gimple gimple_build_cond_from_tree (tree, tree, tree);
825 void gimple_cond_set_condition_from_tree (gimple, tree);
826 bool gimple_has_side_effects (const_gimple);
827 bool gimple_could_trap_p (gimple);
828 bool gimple_could_trap_p_1 (gimple, bool, bool);
829 bool gimple_assign_rhs_could_trap_p (gimple);
830 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
831 bool empty_body_p (gimple_seq);
832 unsigned get_gimple_rhs_num_ops (enum tree_code);
833 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
834 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
835 const char *gimple_decl_printable_name (tree, int);
836 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
837 tree gimple_extract_devirt_binfo_from_cst (tree);
839 /* Returns true iff T is a scalar register variable. */
840 extern bool is_gimple_reg (tree);
841 /* Returns true iff T is any sort of variable. */
842 extern bool is_gimple_variable (tree);
843 /* Returns true iff T is any sort of symbol. */
844 extern bool is_gimple_id (tree);
845 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
846 extern bool is_gimple_min_lval (tree);
847 /* Returns true iff T is something whose address can be taken. */
848 extern bool is_gimple_addressable (tree);
849 /* Returns true iff T is any valid GIMPLE lvalue. */
850 extern bool is_gimple_lvalue (tree);
852 /* Returns true iff T is a GIMPLE address. */
853 bool is_gimple_address (const_tree);
854 /* Returns true iff T is a GIMPLE invariant address. */
855 bool is_gimple_invariant_address (const_tree);
856 /* Returns true iff T is a GIMPLE invariant address at interprocedural
857 level. */
858 bool is_gimple_ip_invariant_address (const_tree);
859 /* Returns true iff T is a valid GIMPLE constant. */
860 bool is_gimple_constant (const_tree);
861 /* Returns true iff T is a GIMPLE restricted function invariant. */
862 extern bool is_gimple_min_invariant (const_tree);
863 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
864 extern bool is_gimple_ip_invariant (const_tree);
865 /* Returns true iff T is a GIMPLE rvalue. */
866 extern bool is_gimple_val (tree);
867 /* Returns true iff T is a GIMPLE asm statement input. */
868 extern bool is_gimple_asm_val (tree);
869 /* Returns true iff T is a valid address operand of a MEM_REF. */
870 bool is_gimple_mem_ref_addr (tree);
872 /* Returns true iff T is a valid if-statement condition. */
873 extern bool is_gimple_condexpr (tree);
875 /* Returns true iff T is a valid call address expression. */
876 extern bool is_gimple_call_addr (tree);
878 extern void recalculate_side_effects (tree);
879 extern bool gimple_compare_field_offset (tree, tree);
880 extern tree gimple_register_canonical_type (tree);
881 extern void print_gimple_types_stats (const char *);
882 extern void free_gimple_type_tables (void);
883 extern tree gimple_unsigned_type (tree);
884 extern tree gimple_signed_type (tree);
885 extern alias_set_type gimple_get_alias_set (tree);
886 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
887 unsigned *);
888 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
889 bool (*)(gimple, tree, void *),
890 bool (*)(gimple, tree, void *),
891 bool (*)(gimple, tree, void *));
892 extern bool walk_stmt_load_store_ops (gimple, void *,
893 bool (*)(gimple, tree, void *),
894 bool (*)(gimple, tree, void *));
895 extern bool gimple_ior_addresses_taken (bitmap, gimple);
896 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
897 extern bool gimple_asm_clobbers_memory_p (const_gimple);
899 /* In gimplify.c */
900 extern tree create_tmp_var_raw (tree, const char *);
901 extern tree create_tmp_var_name (const char *);
902 extern tree create_tmp_var (tree, const char *);
903 extern tree create_tmp_reg (tree, const char *);
904 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
905 extern tree get_formal_tmp_var (tree, gimple_seq *);
906 extern void declare_vars (tree, gimple, bool);
907 extern void annotate_all_with_location (gimple_seq, location_t);
909 /* Validation of GIMPLE expressions. Note that these predicates only check
910 the basic form of the expression, they don't recurse to make sure that
911 underlying nodes are also of the right form. */
912 typedef bool (*gimple_predicate)(tree);
915 /* FIXME we should deduce this from the predicate. */
916 enum fallback {
917 fb_none = 0, /* Do not generate a temporary. */
919 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
920 gimplified expression. */
922 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
923 gimplified expression. */
925 fb_mayfail = 4, /* Gimplification may fail. Error issued
926 afterwards. */
927 fb_either= fb_rvalue | fb_lvalue
930 typedef int fallback_t;
932 enum gimplify_status {
933 GS_ERROR = -2, /* Something Bad Seen. */
934 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
935 GS_OK = 0, /* We did something, maybe more to do. */
936 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
939 struct gimplify_ctx
941 struct gimplify_ctx *prev_context;
943 VEC(gimple,heap) *bind_expr_stack;
944 tree temps;
945 gimple_seq conditional_cleanups;
946 tree exit_label;
947 tree return_temp;
949 VEC(tree,heap) *case_labels;
950 /* The formal temporary table. Should this be persistent? */
951 htab_t temp_htab;
953 int conditions;
954 bool save_stack;
955 bool into_ssa;
956 bool allow_rhs_cond_expr;
957 bool in_cleanup_point_expr;
960 /* Return true if gimplify_one_sizepos doesn't need to gimplify
961 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
962 fields). */
963 static inline bool
964 is_gimple_sizepos (tree expr)
966 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
967 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
968 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
969 function, the gimplifier will want to replace it with a new variable,
970 but that will cause problems if this type is from outside the function.
971 It's OK to have that here. */
972 return (expr == NULL_TREE
973 || TREE_CONSTANT (expr)
974 || TREE_CODE (expr) == VAR_DECL
975 || CONTAINS_PLACEHOLDER_P (expr));
978 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
979 bool (*) (tree), fallback_t);
980 extern void gimplify_type_sizes (tree, gimple_seq *);
981 extern void gimplify_one_sizepos (tree *, gimple_seq *);
982 extern bool gimplify_stmt (tree *, gimple_seq *);
983 extern gimple gimplify_body (tree, bool);
984 extern void push_gimplify_context (struct gimplify_ctx *);
985 extern void pop_gimplify_context (gimple);
986 extern void gimplify_and_add (tree, gimple_seq *);
988 /* Miscellaneous helpers. */
989 extern void gimple_add_tmp_var (tree);
990 extern gimple gimple_current_bind_expr (void);
991 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
992 extern tree voidify_wrapper_expr (tree, tree);
993 extern tree build_and_jump (tree *);
994 extern tree force_labels_r (tree *, int *, void *);
995 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
996 gimple_seq *);
997 struct gimplify_omp_ctx;
998 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
999 extern tree gimple_boolify (tree);
1000 extern gimple_predicate rhs_predicate_for (tree);
1001 extern tree canonicalize_cond_expr_cond (tree);
1003 /* In omp-low.c. */
1004 extern tree omp_reduction_init (tree, tree);
1006 /* In trans-mem.c. */
1007 extern void diagnose_tm_safe_errors (tree);
1008 extern void compute_transaction_bits (void);
1010 /* In tree-nested.c. */
1011 extern void lower_nested_functions (tree);
1012 extern void insert_field_into_struct (tree, tree);
1014 /* In gimplify.c. */
1015 extern void gimplify_function_tree (tree);
1017 /* In cfgexpand.c. */
1018 extern tree gimple_assign_rhs_to_tree (gimple);
1020 /* In builtins.c */
1021 extern bool validate_gimple_arglist (const_gimple, ...);
1023 /* In tree-ssa.c */
1024 extern bool tree_ssa_useless_type_conversion (tree);
1025 extern tree tree_ssa_strip_useless_type_conversions (tree);
1026 extern bool useless_type_conversion_p (tree, tree);
1027 extern bool types_compatible_p (tree, tree);
1029 /* Return the first node in GIMPLE sequence S. */
1031 static inline gimple_seq_node
1032 gimple_seq_first (gimple_seq s)
1034 return s;
1038 /* Return the first statement in GIMPLE sequence S. */
1040 static inline gimple
1041 gimple_seq_first_stmt (gimple_seq s)
1043 gimple_seq_node n = gimple_seq_first (s);
1044 return n;
1048 /* Return the last node in GIMPLE sequence S. */
1050 static inline gimple_seq_node
1051 gimple_seq_last (gimple_seq s)
1053 return s ? s->gsbase.prev : NULL;
1057 /* Return the last statement in GIMPLE sequence S. */
1059 static inline gimple
1060 gimple_seq_last_stmt (gimple_seq s)
1062 gimple_seq_node n = gimple_seq_last (s);
1063 return n;
1067 /* Set the last node in GIMPLE sequence *PS to LAST. */
1069 static inline void
1070 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1072 (*ps)->gsbase.prev = last;
1076 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1078 static inline void
1079 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1081 *ps = first;
1085 /* Return true if GIMPLE sequence S is empty. */
1087 static inline bool
1088 gimple_seq_empty_p (gimple_seq s)
1090 return s == NULL;
1094 void gimple_seq_add_stmt (gimple_seq *, gimple);
1096 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1097 *SEQ_P is NULL, a new sequence is allocated. This function is
1098 similar to gimple_seq_add_stmt, but does not scan the operands.
1099 During gimplification, we need to manipulate statement sequences
1100 before the def/use vectors have been constructed. */
1101 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1103 /* Allocate a new sequence and initialize its first element with STMT. */
1105 static inline gimple_seq
1106 gimple_seq_alloc_with_stmt (gimple stmt)
1108 gimple_seq seq = NULL;
1109 gimple_seq_add_stmt (&seq, stmt);
1110 return seq;
1114 /* Returns the sequence of statements in BB. */
1116 static inline gimple_seq
1117 bb_seq (const_basic_block bb)
1119 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1122 static inline gimple_seq *
1123 bb_seq_addr (basic_block bb)
1125 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1128 /* Sets the sequence of statements in BB to SEQ. */
1130 static inline void
1131 set_bb_seq (basic_block bb, gimple_seq seq)
1133 gcc_checking_assert (!(bb->flags & BB_RTL));
1134 bb->il.gimple.seq = seq;
1138 /* Return the code for GIMPLE statement G. */
1140 static inline enum gimple_code
1141 gimple_code (const_gimple g)
1143 return g->gsbase.code;
1147 /* Return the GSS code used by a GIMPLE code. */
1149 static inline enum gimple_statement_structure_enum
1150 gss_for_code (enum gimple_code code)
1152 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1153 return gss_for_code_[code];
1157 /* Return which GSS code is used by GS. */
1159 static inline enum gimple_statement_structure_enum
1160 gimple_statement_structure (gimple gs)
1162 return gss_for_code (gimple_code (gs));
1166 /* Return true if statement G has sub-statements. This is only true for
1167 High GIMPLE statements. */
1169 static inline bool
1170 gimple_has_substatements (gimple g)
1172 switch (gimple_code (g))
1174 case GIMPLE_BIND:
1175 case GIMPLE_CATCH:
1176 case GIMPLE_EH_FILTER:
1177 case GIMPLE_EH_ELSE:
1178 case GIMPLE_TRY:
1179 case GIMPLE_OMP_FOR:
1180 case GIMPLE_OMP_MASTER:
1181 case GIMPLE_OMP_ORDERED:
1182 case GIMPLE_OMP_SECTION:
1183 case GIMPLE_OMP_PARALLEL:
1184 case GIMPLE_OMP_TASK:
1185 case GIMPLE_OMP_SECTIONS:
1186 case GIMPLE_OMP_SINGLE:
1187 case GIMPLE_OMP_CRITICAL:
1188 case GIMPLE_WITH_CLEANUP_EXPR:
1189 case GIMPLE_TRANSACTION:
1190 return true;
1192 default:
1193 return false;
1198 /* Return the basic block holding statement G. */
1200 static inline basic_block
1201 gimple_bb (const_gimple g)
1203 return g->gsbase.bb;
1207 /* Return the lexical scope block holding statement G. */
1209 static inline tree
1210 gimple_block (const_gimple g)
1212 return LOCATION_BLOCK (g->gsbase.location);
1216 /* Set BLOCK to be the lexical scope block holding statement G. */
1218 static inline void
1219 gimple_set_block (gimple g, tree block)
1221 if (block)
1222 g->gsbase.location =
1223 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1224 else
1225 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1229 /* Return location information for statement G. */
1231 static inline location_t
1232 gimple_location (const_gimple g)
1234 return g->gsbase.location;
1237 /* Return pointer to location information for statement G. */
1239 static inline const location_t *
1240 gimple_location_ptr (const_gimple g)
1242 return &g->gsbase.location;
1246 /* Set location information for statement G. */
1248 static inline void
1249 gimple_set_location (gimple g, location_t location)
1251 g->gsbase.location = location;
1255 /* Return true if G contains location information. */
1257 static inline bool
1258 gimple_has_location (const_gimple g)
1260 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1264 /* Return the file name of the location of STMT. */
1266 static inline const char *
1267 gimple_filename (const_gimple stmt)
1269 return LOCATION_FILE (gimple_location (stmt));
1273 /* Return the line number of the location of STMT. */
1275 static inline int
1276 gimple_lineno (const_gimple stmt)
1278 return LOCATION_LINE (gimple_location (stmt));
1282 /* Determine whether SEQ is a singleton. */
1284 static inline bool
1285 gimple_seq_singleton_p (gimple_seq seq)
1287 return ((gimple_seq_first (seq) != NULL)
1288 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1291 /* Return true if no warnings should be emitted for statement STMT. */
1293 static inline bool
1294 gimple_no_warning_p (const_gimple stmt)
1296 return stmt->gsbase.no_warning;
1299 /* Set the no_warning flag of STMT to NO_WARNING. */
1301 static inline void
1302 gimple_set_no_warning (gimple stmt, bool no_warning)
1304 stmt->gsbase.no_warning = (unsigned) no_warning;
1307 /* Set the visited status on statement STMT to VISITED_P. */
1309 static inline void
1310 gimple_set_visited (gimple stmt, bool visited_p)
1312 stmt->gsbase.visited = (unsigned) visited_p;
1316 /* Return the visited status for statement STMT. */
1318 static inline bool
1319 gimple_visited_p (gimple stmt)
1321 return stmt->gsbase.visited;
1325 /* Set pass local flag PLF on statement STMT to VAL_P. */
1327 static inline void
1328 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1330 if (val_p)
1331 stmt->gsbase.plf |= (unsigned int) plf;
1332 else
1333 stmt->gsbase.plf &= ~((unsigned int) plf);
1337 /* Return the value of pass local flag PLF on statement STMT. */
1339 static inline unsigned int
1340 gimple_plf (gimple stmt, enum plf_mask plf)
1342 return stmt->gsbase.plf & ((unsigned int) plf);
1346 /* Set the UID of statement. */
1348 static inline void
1349 gimple_set_uid (gimple g, unsigned uid)
1351 g->gsbase.uid = uid;
1355 /* Return the UID of statement. */
1357 static inline unsigned
1358 gimple_uid (const_gimple g)
1360 return g->gsbase.uid;
1364 /* Make statement G a singleton sequence. */
1366 static inline void
1367 gimple_init_singleton (gimple g)
1369 g->gsbase.next = NULL;
1370 g->gsbase.prev = g;
1374 /* Return true if GIMPLE statement G has register or memory operands. */
1376 static inline bool
1377 gimple_has_ops (const_gimple g)
1379 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1383 /* Return true if GIMPLE statement G has memory operands. */
1385 static inline bool
1386 gimple_has_mem_ops (const_gimple g)
1388 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1392 /* Return the set of USE operands for statement G. */
1394 static inline struct use_optype_d *
1395 gimple_use_ops (const_gimple g)
1397 if (!gimple_has_ops (g))
1398 return NULL;
1399 return g->gsops.opbase.use_ops;
1403 /* Set USE to be the set of USE operands for statement G. */
1405 static inline void
1406 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1408 gcc_gimple_checking_assert (gimple_has_ops (g));
1409 g->gsops.opbase.use_ops = use;
1413 /* Return the set of VUSE operand for statement G. */
1415 static inline use_operand_p
1416 gimple_vuse_op (const_gimple g)
1418 struct use_optype_d *ops;
1419 if (!gimple_has_mem_ops (g))
1420 return NULL_USE_OPERAND_P;
1421 ops = g->gsops.opbase.use_ops;
1422 if (ops
1423 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1424 return USE_OP_PTR (ops);
1425 return NULL_USE_OPERAND_P;
1428 /* Return the set of VDEF operand for statement G. */
1430 static inline def_operand_p
1431 gimple_vdef_op (gimple g)
1433 if (!gimple_has_mem_ops (g))
1434 return NULL_DEF_OPERAND_P;
1435 if (g->gsmembase.vdef)
1436 return &g->gsmembase.vdef;
1437 return NULL_DEF_OPERAND_P;
1441 /* Return the single VUSE operand of the statement G. */
1443 static inline tree
1444 gimple_vuse (const_gimple g)
1446 if (!gimple_has_mem_ops (g))
1447 return NULL_TREE;
1448 return g->gsmembase.vuse;
1451 /* Return the single VDEF operand of the statement G. */
1453 static inline tree
1454 gimple_vdef (const_gimple g)
1456 if (!gimple_has_mem_ops (g))
1457 return NULL_TREE;
1458 return g->gsmembase.vdef;
1461 /* Return the single VUSE operand of the statement G. */
1463 static inline tree *
1464 gimple_vuse_ptr (gimple g)
1466 if (!gimple_has_mem_ops (g))
1467 return NULL;
1468 return &g->gsmembase.vuse;
1471 /* Return the single VDEF operand of the statement G. */
1473 static inline tree *
1474 gimple_vdef_ptr (gimple g)
1476 if (!gimple_has_mem_ops (g))
1477 return NULL;
1478 return &g->gsmembase.vdef;
1481 /* Set the single VUSE operand of the statement G. */
1483 static inline void
1484 gimple_set_vuse (gimple g, tree vuse)
1486 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1487 g->gsmembase.vuse = vuse;
1490 /* Set the single VDEF operand of the statement G. */
1492 static inline void
1493 gimple_set_vdef (gimple g, tree vdef)
1495 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1496 g->gsmembase.vdef = vdef;
1500 /* Return true if statement G has operands and the modified field has
1501 been set. */
1503 static inline bool
1504 gimple_modified_p (const_gimple g)
1506 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1510 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1511 a MODIFIED field. */
1513 static inline void
1514 gimple_set_modified (gimple s, bool modifiedp)
1516 if (gimple_has_ops (s))
1517 s->gsbase.modified = (unsigned) modifiedp;
1521 /* Return the tree code for the expression computed by STMT. This is
1522 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1523 GIMPLE_CALL, return CALL_EXPR as the expression code for
1524 consistency. This is useful when the caller needs to deal with the
1525 three kinds of computation that GIMPLE supports. */
1527 static inline enum tree_code
1528 gimple_expr_code (const_gimple stmt)
1530 enum gimple_code code = gimple_code (stmt);
1531 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1532 return (enum tree_code) stmt->gsbase.subcode;
1533 else
1535 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1536 return CALL_EXPR;
1541 /* Mark statement S as modified, and update it. */
1543 static inline void
1544 update_stmt (gimple s)
1546 if (gimple_has_ops (s))
1548 gimple_set_modified (s, true);
1549 update_stmt_operands (s);
1553 /* Update statement S if it has been optimized. */
1555 static inline void
1556 update_stmt_if_modified (gimple s)
1558 if (gimple_modified_p (s))
1559 update_stmt_operands (s);
1562 /* Return true if statement STMT contains volatile operands. */
1564 static inline bool
1565 gimple_has_volatile_ops (const_gimple stmt)
1567 if (gimple_has_mem_ops (stmt))
1568 return stmt->gsbase.has_volatile_ops;
1569 else
1570 return false;
1574 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1576 static inline void
1577 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1579 if (gimple_has_mem_ops (stmt))
1580 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1583 /* Return true if BB is in a transaction. */
1585 static inline bool
1586 block_in_transaction (basic_block bb)
1588 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1591 /* Return true if STMT is in a transaction. */
1593 static inline bool
1594 gimple_in_transaction (gimple stmt)
1596 return block_in_transaction (gimple_bb (stmt));
1599 /* Return true if statement STMT may access memory. */
1601 static inline bool
1602 gimple_references_memory_p (gimple stmt)
1604 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1608 /* Return the subcode for OMP statement S. */
1610 static inline unsigned
1611 gimple_omp_subcode (const_gimple s)
1613 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1614 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1615 return s->gsbase.subcode;
1618 /* Set the subcode for OMP statement S to SUBCODE. */
1620 static inline void
1621 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1623 /* We only have 16 bits for the subcode. Assert that we are not
1624 overflowing it. */
1625 gcc_gimple_checking_assert (subcode < (1 << 16));
1626 s->gsbase.subcode = subcode;
1629 /* Set the nowait flag on OMP_RETURN statement S. */
1631 static inline void
1632 gimple_omp_return_set_nowait (gimple s)
1634 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1635 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1639 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1640 flag set. */
1642 static inline bool
1643 gimple_omp_return_nowait_p (const_gimple g)
1645 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1646 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1650 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1651 flag set. */
1653 static inline bool
1654 gimple_omp_section_last_p (const_gimple g)
1656 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1657 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1661 /* Set the GF_OMP_SECTION_LAST flag on G. */
1663 static inline void
1664 gimple_omp_section_set_last (gimple g)
1666 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1667 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1671 /* Return true if OMP parallel statement G has the
1672 GF_OMP_PARALLEL_COMBINED flag set. */
1674 static inline bool
1675 gimple_omp_parallel_combined_p (const_gimple g)
1677 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1678 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1682 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1683 value of COMBINED_P. */
1685 static inline void
1686 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1688 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1689 if (combined_p)
1690 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1691 else
1692 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1696 /* Return true if OMP atomic load/store statement G has the
1697 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1699 static inline bool
1700 gimple_omp_atomic_need_value_p (const_gimple g)
1702 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1703 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1704 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1708 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1710 static inline void
1711 gimple_omp_atomic_set_need_value (gimple g)
1713 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1714 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1715 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1719 /* Return the number of operands for statement GS. */
1721 static inline unsigned
1722 gimple_num_ops (const_gimple gs)
1724 return gs->gsbase.num_ops;
1728 /* Set the number of operands for statement GS. */
1730 static inline void
1731 gimple_set_num_ops (gimple gs, unsigned num_ops)
1733 gs->gsbase.num_ops = num_ops;
1737 /* Return the array of operands for statement GS. */
1739 static inline tree *
1740 gimple_ops (gimple gs)
1742 size_t off;
1744 /* All the tuples have their operand vector at the very bottom
1745 of the structure. Note that those structures that do not
1746 have an operand vector have a zero offset. */
1747 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1748 gcc_gimple_checking_assert (off != 0);
1750 return (tree *) ((char *) gs + off);
1754 /* Return operand I for statement GS. */
1756 static inline tree
1757 gimple_op (const_gimple gs, unsigned i)
1759 if (gimple_has_ops (gs))
1761 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1762 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1764 else
1765 return NULL_TREE;
1768 /* Return a pointer to operand I for statement GS. */
1770 static inline tree *
1771 gimple_op_ptr (const_gimple gs, unsigned i)
1773 if (gimple_has_ops (gs))
1775 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1776 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1778 else
1779 return NULL;
1782 /* Set operand I of statement GS to OP. */
1784 static inline void
1785 gimple_set_op (gimple gs, unsigned i, tree op)
1787 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1789 /* Note. It may be tempting to assert that OP matches
1790 is_gimple_operand, but that would be wrong. Different tuples
1791 accept slightly different sets of tree operands. Each caller
1792 should perform its own validation. */
1793 gimple_ops (gs)[i] = op;
1796 /* Return true if GS is a GIMPLE_ASSIGN. */
1798 static inline bool
1799 is_gimple_assign (const_gimple gs)
1801 return gimple_code (gs) == GIMPLE_ASSIGN;
1804 /* Determine if expression CODE is one of the valid expressions that can
1805 be used on the RHS of GIMPLE assignments. */
1807 static inline enum gimple_rhs_class
1808 get_gimple_rhs_class (enum tree_code code)
1810 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1813 /* Return the LHS of assignment statement GS. */
1815 static inline tree
1816 gimple_assign_lhs (const_gimple gs)
1818 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1819 return gimple_op (gs, 0);
1823 /* Return a pointer to the LHS of assignment statement GS. */
1825 static inline tree *
1826 gimple_assign_lhs_ptr (const_gimple gs)
1828 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1829 return gimple_op_ptr (gs, 0);
1833 /* Set LHS to be the LHS operand of assignment statement GS. */
1835 static inline void
1836 gimple_assign_set_lhs (gimple gs, tree lhs)
1838 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1839 gimple_set_op (gs, 0, lhs);
1841 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1842 SSA_NAME_DEF_STMT (lhs) = gs;
1846 /* Return the first operand on the RHS of assignment statement GS. */
1848 static inline tree
1849 gimple_assign_rhs1 (const_gimple gs)
1851 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1852 return gimple_op (gs, 1);
1856 /* Return a pointer to the first operand on the RHS of assignment
1857 statement GS. */
1859 static inline tree *
1860 gimple_assign_rhs1_ptr (const_gimple gs)
1862 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1863 return gimple_op_ptr (gs, 1);
1866 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1868 static inline void
1869 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1871 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1873 gimple_set_op (gs, 1, rhs);
1877 /* Return the second operand on the RHS of assignment statement GS.
1878 If GS does not have two operands, NULL is returned instead. */
1880 static inline tree
1881 gimple_assign_rhs2 (const_gimple gs)
1883 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1885 if (gimple_num_ops (gs) >= 3)
1886 return gimple_op (gs, 2);
1887 else
1888 return NULL_TREE;
1892 /* Return a pointer to the second operand on the RHS of assignment
1893 statement GS. */
1895 static inline tree *
1896 gimple_assign_rhs2_ptr (const_gimple gs)
1898 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1899 return gimple_op_ptr (gs, 2);
1903 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1905 static inline void
1906 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1908 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1910 gimple_set_op (gs, 2, rhs);
1913 /* Return the third operand on the RHS of assignment statement GS.
1914 If GS does not have two operands, NULL is returned instead. */
1916 static inline tree
1917 gimple_assign_rhs3 (const_gimple gs)
1919 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1921 if (gimple_num_ops (gs) >= 4)
1922 return gimple_op (gs, 3);
1923 else
1924 return NULL_TREE;
1927 /* Return a pointer to the third operand on the RHS of assignment
1928 statement GS. */
1930 static inline tree *
1931 gimple_assign_rhs3_ptr (const_gimple gs)
1933 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1934 return gimple_op_ptr (gs, 3);
1938 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1940 static inline void
1941 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1943 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1945 gimple_set_op (gs, 3, rhs);
1948 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1949 to see only a maximum of two operands. */
1951 static inline void
1952 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1953 tree op1, tree op2)
1955 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1958 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1959 to see only a maximum of two operands. */
1961 static inline void
1962 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1963 tree *op1)
1965 tree op2;
1966 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1967 gcc_assert (op2 == NULL_TREE);
1970 /* Returns true if GS is a nontemporal move. */
1972 static inline bool
1973 gimple_assign_nontemporal_move_p (const_gimple gs)
1975 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1976 return gs->gsbase.nontemporal_move;
1979 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1981 static inline void
1982 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1984 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1985 gs->gsbase.nontemporal_move = nontemporal;
1989 /* Return the code of the expression computed on the rhs of assignment
1990 statement GS. In case that the RHS is a single object, returns the
1991 tree code of the object. */
1993 static inline enum tree_code
1994 gimple_assign_rhs_code (const_gimple gs)
1996 enum tree_code code;
1997 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1999 code = (enum tree_code) gs->gsbase.subcode;
2000 /* While we initially set subcode to the TREE_CODE of the rhs for
2001 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2002 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2003 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2004 code = TREE_CODE (gimple_assign_rhs1 (gs));
2006 return code;
2010 /* Set CODE to be the code for the expression computed on the RHS of
2011 assignment S. */
2013 static inline void
2014 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2016 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2017 s->gsbase.subcode = code;
2021 /* Return the gimple rhs class of the code of the expression computed on
2022 the rhs of assignment statement GS.
2023 This will never return GIMPLE_INVALID_RHS. */
2025 static inline enum gimple_rhs_class
2026 gimple_assign_rhs_class (const_gimple gs)
2028 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2031 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2032 there is no operator associated with the assignment itself.
2033 Unlike gimple_assign_copy_p, this predicate returns true for
2034 any RHS operand, including those that perform an operation
2035 and do not have the semantics of a copy, such as COND_EXPR. */
2037 static inline bool
2038 gimple_assign_single_p (gimple gs)
2040 return (is_gimple_assign (gs)
2041 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2044 /* Return true if GS performs a store to its lhs. */
2046 static inline bool
2047 gimple_store_p (gimple gs)
2049 tree lhs = gimple_get_lhs (gs);
2050 return lhs && !is_gimple_reg (lhs);
2053 /* Return true if GS is an assignment that loads from its rhs1. */
2055 static inline bool
2056 gimple_assign_load_p (gimple gs)
2058 tree rhs;
2059 if (!gimple_assign_single_p (gs))
2060 return false;
2061 rhs = gimple_assign_rhs1 (gs);
2062 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2063 return true;
2064 rhs = get_base_address (rhs);
2065 return (DECL_P (rhs)
2066 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2070 /* Return true if S is a type-cast assignment. */
2072 static inline bool
2073 gimple_assign_cast_p (gimple s)
2075 if (is_gimple_assign (s))
2077 enum tree_code sc = gimple_assign_rhs_code (s);
2078 return CONVERT_EXPR_CODE_P (sc)
2079 || sc == VIEW_CONVERT_EXPR
2080 || sc == FIX_TRUNC_EXPR;
2083 return false;
2086 /* Return true if S is a clobber statement. */
2088 static inline bool
2089 gimple_clobber_p (gimple s)
2091 return gimple_assign_single_p (s)
2092 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2095 /* Return true if GS is a GIMPLE_CALL. */
2097 static inline bool
2098 is_gimple_call (const_gimple gs)
2100 return gimple_code (gs) == GIMPLE_CALL;
2103 /* Return the LHS of call statement GS. */
2105 static inline tree
2106 gimple_call_lhs (const_gimple gs)
2108 GIMPLE_CHECK (gs, GIMPLE_CALL);
2109 return gimple_op (gs, 0);
2113 /* Return a pointer to the LHS of call statement GS. */
2115 static inline tree *
2116 gimple_call_lhs_ptr (const_gimple gs)
2118 GIMPLE_CHECK (gs, GIMPLE_CALL);
2119 return gimple_op_ptr (gs, 0);
2123 /* Set LHS to be the LHS operand of call statement GS. */
2125 static inline void
2126 gimple_call_set_lhs (gimple gs, tree lhs)
2128 GIMPLE_CHECK (gs, GIMPLE_CALL);
2129 gimple_set_op (gs, 0, lhs);
2130 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2131 SSA_NAME_DEF_STMT (lhs) = gs;
2135 /* Return true if call GS calls an internal-only function, as enumerated
2136 by internal_fn. */
2138 static inline bool
2139 gimple_call_internal_p (const_gimple gs)
2141 GIMPLE_CHECK (gs, GIMPLE_CALL);
2142 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2146 /* Return the target of internal call GS. */
2148 static inline enum internal_fn
2149 gimple_call_internal_fn (const_gimple gs)
2151 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2152 return gs->gimple_call.u.internal_fn;
2156 /* Return the function type of the function called by GS. */
2158 static inline tree
2159 gimple_call_fntype (const_gimple gs)
2161 GIMPLE_CHECK (gs, GIMPLE_CALL);
2162 if (gimple_call_internal_p (gs))
2163 return NULL_TREE;
2164 return gs->gimple_call.u.fntype;
2167 /* Set the type of the function called by GS to FNTYPE. */
2169 static inline void
2170 gimple_call_set_fntype (gimple gs, tree fntype)
2172 GIMPLE_CHECK (gs, GIMPLE_CALL);
2173 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2174 gs->gimple_call.u.fntype = fntype;
2178 /* Return the tree node representing the function called by call
2179 statement GS. */
2181 static inline tree
2182 gimple_call_fn (const_gimple gs)
2184 GIMPLE_CHECK (gs, GIMPLE_CALL);
2185 return gimple_op (gs, 1);
2188 /* Return a pointer to the tree node representing the function called by call
2189 statement GS. */
2191 static inline tree *
2192 gimple_call_fn_ptr (const_gimple gs)
2194 GIMPLE_CHECK (gs, GIMPLE_CALL);
2195 return gimple_op_ptr (gs, 1);
2199 /* Set FN to be the function called by call statement GS. */
2201 static inline void
2202 gimple_call_set_fn (gimple gs, tree fn)
2204 GIMPLE_CHECK (gs, GIMPLE_CALL);
2205 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2206 gimple_set_op (gs, 1, fn);
2210 /* Set FNDECL to be the function called by call statement GS. */
2212 static inline void
2213 gimple_call_set_fndecl (gimple gs, tree decl)
2215 GIMPLE_CHECK (gs, GIMPLE_CALL);
2216 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2217 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2221 /* Set internal function FN to be the function called by call statement GS. */
2223 static inline void
2224 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2226 GIMPLE_CHECK (gs, GIMPLE_CALL);
2227 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2228 gs->gimple_call.u.internal_fn = fn;
2232 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2233 associated with the callee if known. Otherwise return NULL_TREE. */
2235 static inline tree
2236 gimple_call_addr_fndecl (const_tree fn)
2238 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2240 tree fndecl = TREE_OPERAND (fn, 0);
2241 if (TREE_CODE (fndecl) == MEM_REF
2242 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2243 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2244 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2245 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2246 return fndecl;
2248 return NULL_TREE;
2251 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2252 Otherwise return NULL. This function is analogous to
2253 get_callee_fndecl in tree land. */
2255 static inline tree
2256 gimple_call_fndecl (const_gimple gs)
2258 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2262 /* Return the type returned by call statement GS. */
2264 static inline tree
2265 gimple_call_return_type (const_gimple gs)
2267 tree type = gimple_call_fntype (gs);
2269 if (type == NULL_TREE)
2270 return TREE_TYPE (gimple_call_lhs (gs));
2272 /* The type returned by a function is the type of its
2273 function type. */
2274 return TREE_TYPE (type);
2278 /* Return the static chain for call statement GS. */
2280 static inline tree
2281 gimple_call_chain (const_gimple gs)
2283 GIMPLE_CHECK (gs, GIMPLE_CALL);
2284 return gimple_op (gs, 2);
2288 /* Return a pointer to the static chain for call statement GS. */
2290 static inline tree *
2291 gimple_call_chain_ptr (const_gimple gs)
2293 GIMPLE_CHECK (gs, GIMPLE_CALL);
2294 return gimple_op_ptr (gs, 2);
2297 /* Set CHAIN to be the static chain for call statement GS. */
2299 static inline void
2300 gimple_call_set_chain (gimple gs, tree chain)
2302 GIMPLE_CHECK (gs, GIMPLE_CALL);
2304 gimple_set_op (gs, 2, chain);
2308 /* Return the number of arguments used by call statement GS. */
2310 static inline unsigned
2311 gimple_call_num_args (const_gimple gs)
2313 unsigned num_ops;
2314 GIMPLE_CHECK (gs, GIMPLE_CALL);
2315 num_ops = gimple_num_ops (gs);
2316 return num_ops - 3;
2320 /* Return the argument at position INDEX for call statement GS. */
2322 static inline tree
2323 gimple_call_arg (const_gimple gs, unsigned index)
2325 GIMPLE_CHECK (gs, GIMPLE_CALL);
2326 return gimple_op (gs, index + 3);
2330 /* Return a pointer to the argument at position INDEX for call
2331 statement GS. */
2333 static inline tree *
2334 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2336 GIMPLE_CHECK (gs, GIMPLE_CALL);
2337 return gimple_op_ptr (gs, index + 3);
2341 /* Set ARG to be the argument at position INDEX for call statement GS. */
2343 static inline void
2344 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2346 GIMPLE_CHECK (gs, GIMPLE_CALL);
2347 gimple_set_op (gs, index + 3, arg);
2351 /* If TAIL_P is true, mark call statement S as being a tail call
2352 (i.e., a call just before the exit of a function). These calls are
2353 candidate for tail call optimization. */
2355 static inline void
2356 gimple_call_set_tail (gimple s, bool tail_p)
2358 GIMPLE_CHECK (s, GIMPLE_CALL);
2359 if (tail_p)
2360 s->gsbase.subcode |= GF_CALL_TAILCALL;
2361 else
2362 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2366 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2368 static inline bool
2369 gimple_call_tail_p (gimple s)
2371 GIMPLE_CHECK (s, GIMPLE_CALL);
2372 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2376 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2377 slot optimization. This transformation uses the target of the call
2378 expansion as the return slot for calls that return in memory. */
2380 static inline void
2381 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2383 GIMPLE_CHECK (s, GIMPLE_CALL);
2384 if (return_slot_opt_p)
2385 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2386 else
2387 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2391 /* Return true if S is marked for return slot optimization. */
2393 static inline bool
2394 gimple_call_return_slot_opt_p (gimple s)
2396 GIMPLE_CHECK (s, GIMPLE_CALL);
2397 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2401 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2402 thunk to the thunked-to function. */
2404 static inline void
2405 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2407 GIMPLE_CHECK (s, GIMPLE_CALL);
2408 if (from_thunk_p)
2409 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2410 else
2411 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2415 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2417 static inline bool
2418 gimple_call_from_thunk_p (gimple s)
2420 GIMPLE_CHECK (s, GIMPLE_CALL);
2421 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2425 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2426 argument pack in its argument list. */
2428 static inline void
2429 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2431 GIMPLE_CHECK (s, GIMPLE_CALL);
2432 if (pass_arg_pack_p)
2433 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2434 else
2435 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2439 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2440 argument pack in its argument list. */
2442 static inline bool
2443 gimple_call_va_arg_pack_p (gimple s)
2445 GIMPLE_CHECK (s, GIMPLE_CALL);
2446 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2450 /* Return true if S is a noreturn call. */
2452 static inline bool
2453 gimple_call_noreturn_p (gimple s)
2455 GIMPLE_CHECK (s, GIMPLE_CALL);
2456 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2460 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2461 even if the called function can throw in other cases. */
2463 static inline void
2464 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2466 GIMPLE_CHECK (s, GIMPLE_CALL);
2467 if (nothrow_p)
2468 s->gsbase.subcode |= GF_CALL_NOTHROW;
2469 else
2470 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2473 /* Return true if S is a nothrow call. */
2475 static inline bool
2476 gimple_call_nothrow_p (gimple s)
2478 GIMPLE_CHECK (s, GIMPLE_CALL);
2479 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2482 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2483 is known to be emitted for VLA objects. Those are wrapped by
2484 stack_save/stack_restore calls and hence can't lead to unbounded
2485 stack growth even when they occur in loops. */
2487 static inline void
2488 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2490 GIMPLE_CHECK (s, GIMPLE_CALL);
2491 if (for_var)
2492 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2493 else
2494 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2497 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2499 static inline bool
2500 gimple_call_alloca_for_var_p (gimple s)
2502 GIMPLE_CHECK (s, GIMPLE_CALL);
2503 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2506 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2508 static inline void
2509 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2511 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2512 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2513 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2517 /* Return a pointer to the points-to solution for the set of call-used
2518 variables of the call CALL. */
2520 static inline struct pt_solution *
2521 gimple_call_use_set (gimple call)
2523 GIMPLE_CHECK (call, GIMPLE_CALL);
2524 return &call->gimple_call.call_used;
2528 /* Return a pointer to the points-to solution for the set of call-used
2529 variables of the call CALL. */
2531 static inline struct pt_solution *
2532 gimple_call_clobber_set (gimple call)
2534 GIMPLE_CHECK (call, GIMPLE_CALL);
2535 return &call->gimple_call.call_clobbered;
2539 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2540 non-NULL lhs. */
2542 static inline bool
2543 gimple_has_lhs (gimple stmt)
2545 return (is_gimple_assign (stmt)
2546 || (is_gimple_call (stmt)
2547 && gimple_call_lhs (stmt) != NULL_TREE));
2551 /* Return the code of the predicate computed by conditional statement GS. */
2553 static inline enum tree_code
2554 gimple_cond_code (const_gimple gs)
2556 GIMPLE_CHECK (gs, GIMPLE_COND);
2557 return (enum tree_code) gs->gsbase.subcode;
2561 /* Set CODE to be the predicate code for the conditional statement GS. */
2563 static inline void
2564 gimple_cond_set_code (gimple gs, enum tree_code code)
2566 GIMPLE_CHECK (gs, GIMPLE_COND);
2567 gs->gsbase.subcode = code;
2571 /* Return the LHS of the predicate computed by conditional statement GS. */
2573 static inline tree
2574 gimple_cond_lhs (const_gimple gs)
2576 GIMPLE_CHECK (gs, GIMPLE_COND);
2577 return gimple_op (gs, 0);
2580 /* Return the pointer to the LHS of the predicate computed by conditional
2581 statement GS. */
2583 static inline tree *
2584 gimple_cond_lhs_ptr (const_gimple gs)
2586 GIMPLE_CHECK (gs, GIMPLE_COND);
2587 return gimple_op_ptr (gs, 0);
2590 /* Set LHS to be the LHS operand of the predicate computed by
2591 conditional statement GS. */
2593 static inline void
2594 gimple_cond_set_lhs (gimple gs, tree lhs)
2596 GIMPLE_CHECK (gs, GIMPLE_COND);
2597 gimple_set_op (gs, 0, lhs);
2601 /* Return the RHS operand of the predicate computed by conditional GS. */
2603 static inline tree
2604 gimple_cond_rhs (const_gimple gs)
2606 GIMPLE_CHECK (gs, GIMPLE_COND);
2607 return gimple_op (gs, 1);
2610 /* Return the pointer to the RHS operand of the predicate computed by
2611 conditional GS. */
2613 static inline tree *
2614 gimple_cond_rhs_ptr (const_gimple gs)
2616 GIMPLE_CHECK (gs, GIMPLE_COND);
2617 return gimple_op_ptr (gs, 1);
2621 /* Set RHS to be the RHS operand of the predicate computed by
2622 conditional statement GS. */
2624 static inline void
2625 gimple_cond_set_rhs (gimple gs, tree rhs)
2627 GIMPLE_CHECK (gs, GIMPLE_COND);
2628 gimple_set_op (gs, 1, rhs);
2632 /* Return the label used by conditional statement GS when its
2633 predicate evaluates to true. */
2635 static inline tree
2636 gimple_cond_true_label (const_gimple gs)
2638 GIMPLE_CHECK (gs, GIMPLE_COND);
2639 return gimple_op (gs, 2);
2643 /* Set LABEL to be the label used by conditional statement GS when its
2644 predicate evaluates to true. */
2646 static inline void
2647 gimple_cond_set_true_label (gimple gs, tree label)
2649 GIMPLE_CHECK (gs, GIMPLE_COND);
2650 gimple_set_op (gs, 2, label);
2654 /* Set LABEL to be the label used by conditional statement GS when its
2655 predicate evaluates to false. */
2657 static inline void
2658 gimple_cond_set_false_label (gimple gs, tree label)
2660 GIMPLE_CHECK (gs, GIMPLE_COND);
2661 gimple_set_op (gs, 3, label);
2665 /* Return the label used by conditional statement GS when its
2666 predicate evaluates to false. */
2668 static inline tree
2669 gimple_cond_false_label (const_gimple gs)
2671 GIMPLE_CHECK (gs, GIMPLE_COND);
2672 return gimple_op (gs, 3);
2676 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2678 static inline void
2679 gimple_cond_make_false (gimple gs)
2681 gimple_cond_set_lhs (gs, boolean_true_node);
2682 gimple_cond_set_rhs (gs, boolean_false_node);
2683 gs->gsbase.subcode = EQ_EXPR;
2687 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2689 static inline void
2690 gimple_cond_make_true (gimple gs)
2692 gimple_cond_set_lhs (gs, boolean_true_node);
2693 gimple_cond_set_rhs (gs, boolean_true_node);
2694 gs->gsbase.subcode = EQ_EXPR;
2697 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2698 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2700 static inline bool
2701 gimple_cond_true_p (const_gimple gs)
2703 tree lhs = gimple_cond_lhs (gs);
2704 tree rhs = gimple_cond_rhs (gs);
2705 enum tree_code code = gimple_cond_code (gs);
2707 if (lhs != boolean_true_node && lhs != boolean_false_node)
2708 return false;
2710 if (rhs != boolean_true_node && rhs != boolean_false_node)
2711 return false;
2713 if (code == NE_EXPR && lhs != rhs)
2714 return true;
2716 if (code == EQ_EXPR && lhs == rhs)
2717 return true;
2719 return false;
2722 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2723 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2725 static inline bool
2726 gimple_cond_false_p (const_gimple gs)
2728 tree lhs = gimple_cond_lhs (gs);
2729 tree rhs = gimple_cond_rhs (gs);
2730 enum tree_code code = gimple_cond_code (gs);
2732 if (lhs != boolean_true_node && lhs != boolean_false_node)
2733 return false;
2735 if (rhs != boolean_true_node && rhs != boolean_false_node)
2736 return false;
2738 if (code == NE_EXPR && lhs == rhs)
2739 return true;
2741 if (code == EQ_EXPR && lhs != rhs)
2742 return true;
2744 return false;
2747 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2748 'if (var == 1)' */
2750 static inline bool
2751 gimple_cond_single_var_p (gimple gs)
2753 if (gimple_cond_code (gs) == NE_EXPR
2754 && gimple_cond_rhs (gs) == boolean_false_node)
2755 return true;
2757 if (gimple_cond_code (gs) == EQ_EXPR
2758 && gimple_cond_rhs (gs) == boolean_true_node)
2759 return true;
2761 return false;
2764 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2766 static inline void
2767 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2769 gimple_cond_set_code (stmt, code);
2770 gimple_cond_set_lhs (stmt, lhs);
2771 gimple_cond_set_rhs (stmt, rhs);
2774 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2776 static inline tree
2777 gimple_label_label (const_gimple gs)
2779 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2780 return gimple_op (gs, 0);
2784 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2785 GS. */
2787 static inline void
2788 gimple_label_set_label (gimple gs, tree label)
2790 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2791 gimple_set_op (gs, 0, label);
2795 /* Return the destination of the unconditional jump GS. */
2797 static inline tree
2798 gimple_goto_dest (const_gimple gs)
2800 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2801 return gimple_op (gs, 0);
2805 /* Set DEST to be the destination of the unconditonal jump GS. */
2807 static inline void
2808 gimple_goto_set_dest (gimple gs, tree dest)
2810 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2811 gimple_set_op (gs, 0, dest);
2815 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2817 static inline tree
2818 gimple_bind_vars (const_gimple gs)
2820 GIMPLE_CHECK (gs, GIMPLE_BIND);
2821 return gs->gimple_bind.vars;
2825 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2826 statement GS. */
2828 static inline void
2829 gimple_bind_set_vars (gimple gs, tree vars)
2831 GIMPLE_CHECK (gs, GIMPLE_BIND);
2832 gs->gimple_bind.vars = vars;
2836 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2837 statement GS. */
2839 static inline void
2840 gimple_bind_append_vars (gimple gs, tree vars)
2842 GIMPLE_CHECK (gs, GIMPLE_BIND);
2843 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2847 static inline gimple_seq *
2848 gimple_bind_body_ptr (gimple gs)
2850 GIMPLE_CHECK (gs, GIMPLE_BIND);
2851 return &gs->gimple_bind.body;
2854 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2856 static inline gimple_seq
2857 gimple_bind_body (gimple gs)
2859 return *gimple_bind_body_ptr (gs);
2863 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2864 statement GS. */
2866 static inline void
2867 gimple_bind_set_body (gimple gs, gimple_seq seq)
2869 GIMPLE_CHECK (gs, GIMPLE_BIND);
2870 gs->gimple_bind.body = seq;
2874 /* Append a statement to the end of a GIMPLE_BIND's body. */
2876 static inline void
2877 gimple_bind_add_stmt (gimple gs, gimple stmt)
2879 GIMPLE_CHECK (gs, GIMPLE_BIND);
2880 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2884 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2886 static inline void
2887 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2889 GIMPLE_CHECK (gs, GIMPLE_BIND);
2890 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2894 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2895 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2897 static inline tree
2898 gimple_bind_block (const_gimple gs)
2900 GIMPLE_CHECK (gs, GIMPLE_BIND);
2901 return gs->gimple_bind.block;
2905 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2906 statement GS. */
2908 static inline void
2909 gimple_bind_set_block (gimple gs, tree block)
2911 GIMPLE_CHECK (gs, GIMPLE_BIND);
2912 gcc_gimple_checking_assert (block == NULL_TREE
2913 || TREE_CODE (block) == BLOCK);
2914 gs->gimple_bind.block = block;
2918 /* Return the number of input operands for GIMPLE_ASM GS. */
2920 static inline unsigned
2921 gimple_asm_ninputs (const_gimple gs)
2923 GIMPLE_CHECK (gs, GIMPLE_ASM);
2924 return gs->gimple_asm.ni;
2928 /* Return the number of output operands for GIMPLE_ASM GS. */
2930 static inline unsigned
2931 gimple_asm_noutputs (const_gimple gs)
2933 GIMPLE_CHECK (gs, GIMPLE_ASM);
2934 return gs->gimple_asm.no;
2938 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2940 static inline unsigned
2941 gimple_asm_nclobbers (const_gimple gs)
2943 GIMPLE_CHECK (gs, GIMPLE_ASM);
2944 return gs->gimple_asm.nc;
2947 /* Return the number of label operands for GIMPLE_ASM GS. */
2949 static inline unsigned
2950 gimple_asm_nlabels (const_gimple gs)
2952 GIMPLE_CHECK (gs, GIMPLE_ASM);
2953 return gs->gimple_asm.nl;
2956 /* Return input operand INDEX of GIMPLE_ASM GS. */
2958 static inline tree
2959 gimple_asm_input_op (const_gimple gs, unsigned index)
2961 GIMPLE_CHECK (gs, GIMPLE_ASM);
2962 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2963 return gimple_op (gs, index + gs->gimple_asm.no);
2966 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2968 static inline tree *
2969 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2971 GIMPLE_CHECK (gs, GIMPLE_ASM);
2972 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2973 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2977 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2979 static inline void
2980 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2982 GIMPLE_CHECK (gs, GIMPLE_ASM);
2983 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2984 && TREE_CODE (in_op) == TREE_LIST);
2985 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2989 /* Return output operand INDEX of GIMPLE_ASM GS. */
2991 static inline tree
2992 gimple_asm_output_op (const_gimple gs, unsigned index)
2994 GIMPLE_CHECK (gs, GIMPLE_ASM);
2995 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
2996 return gimple_op (gs, index);
2999 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3001 static inline tree *
3002 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3004 GIMPLE_CHECK (gs, GIMPLE_ASM);
3005 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3006 return gimple_op_ptr (gs, index);
3010 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3012 static inline void
3013 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3015 GIMPLE_CHECK (gs, GIMPLE_ASM);
3016 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3017 && TREE_CODE (out_op) == TREE_LIST);
3018 gimple_set_op (gs, index, out_op);
3022 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3024 static inline tree
3025 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3027 GIMPLE_CHECK (gs, GIMPLE_ASM);
3028 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3029 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3033 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3035 static inline void
3036 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3038 GIMPLE_CHECK (gs, GIMPLE_ASM);
3039 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3040 && TREE_CODE (clobber_op) == TREE_LIST);
3041 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3044 /* Return label operand INDEX of GIMPLE_ASM GS. */
3046 static inline tree
3047 gimple_asm_label_op (const_gimple gs, unsigned index)
3049 GIMPLE_CHECK (gs, GIMPLE_ASM);
3050 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3051 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3054 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3056 static inline void
3057 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3059 GIMPLE_CHECK (gs, GIMPLE_ASM);
3060 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3061 && TREE_CODE (label_op) == TREE_LIST);
3062 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3065 /* Return the string representing the assembly instruction in
3066 GIMPLE_ASM GS. */
3068 static inline const char *
3069 gimple_asm_string (const_gimple gs)
3071 GIMPLE_CHECK (gs, GIMPLE_ASM);
3072 return gs->gimple_asm.string;
3076 /* Return true if GS is an asm statement marked volatile. */
3078 static inline bool
3079 gimple_asm_volatile_p (const_gimple gs)
3081 GIMPLE_CHECK (gs, GIMPLE_ASM);
3082 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3086 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3088 static inline void
3089 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3091 GIMPLE_CHECK (gs, GIMPLE_ASM);
3092 if (volatile_p)
3093 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3094 else
3095 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3099 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3101 static inline void
3102 gimple_asm_set_input (gimple gs, bool input_p)
3104 GIMPLE_CHECK (gs, GIMPLE_ASM);
3105 if (input_p)
3106 gs->gsbase.subcode |= GF_ASM_INPUT;
3107 else
3108 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3112 /* Return true if asm GS is an ASM_INPUT. */
3114 static inline bool
3115 gimple_asm_input_p (const_gimple gs)
3117 GIMPLE_CHECK (gs, GIMPLE_ASM);
3118 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3122 /* Return the types handled by GIMPLE_CATCH statement GS. */
3124 static inline tree
3125 gimple_catch_types (const_gimple gs)
3127 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3128 return gs->gimple_catch.types;
3132 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3134 static inline tree *
3135 gimple_catch_types_ptr (gimple gs)
3137 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3138 return &gs->gimple_catch.types;
3142 /* Return a pointer to the GIMPLE sequence representing the body of
3143 the handler of GIMPLE_CATCH statement GS. */
3145 static inline gimple_seq *
3146 gimple_catch_handler_ptr (gimple gs)
3148 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3149 return &gs->gimple_catch.handler;
3153 /* Return the GIMPLE sequence representing the body of the handler of
3154 GIMPLE_CATCH statement GS. */
3156 static inline gimple_seq
3157 gimple_catch_handler (gimple gs)
3159 return *gimple_catch_handler_ptr (gs);
3163 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3165 static inline void
3166 gimple_catch_set_types (gimple gs, tree t)
3168 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3169 gs->gimple_catch.types = t;
3173 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3175 static inline void
3176 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3178 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3179 gs->gimple_catch.handler = handler;
3183 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3185 static inline tree
3186 gimple_eh_filter_types (const_gimple gs)
3188 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3189 return gs->gimple_eh_filter.types;
3193 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3194 GS. */
3196 static inline tree *
3197 gimple_eh_filter_types_ptr (gimple gs)
3199 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3200 return &gs->gimple_eh_filter.types;
3204 /* Return a pointer to the sequence of statement to execute when
3205 GIMPLE_EH_FILTER statement fails. */
3207 static inline gimple_seq *
3208 gimple_eh_filter_failure_ptr (gimple gs)
3210 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3211 return &gs->gimple_eh_filter.failure;
3215 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3216 statement fails. */
3218 static inline gimple_seq
3219 gimple_eh_filter_failure (gimple gs)
3221 return *gimple_eh_filter_failure_ptr (gs);
3225 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3227 static inline void
3228 gimple_eh_filter_set_types (gimple gs, tree types)
3230 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3231 gs->gimple_eh_filter.types = types;
3235 /* Set FAILURE to be the sequence of statements to execute on failure
3236 for GIMPLE_EH_FILTER GS. */
3238 static inline void
3239 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3241 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3242 gs->gimple_eh_filter.failure = failure;
3245 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3247 static inline tree
3248 gimple_eh_must_not_throw_fndecl (gimple gs)
3250 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3251 return gs->gimple_eh_mnt.fndecl;
3254 /* Set the function decl to be called by GS to DECL. */
3256 static inline void
3257 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3259 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3260 gs->gimple_eh_mnt.fndecl = decl;
3263 /* GIMPLE_EH_ELSE accessors. */
3265 static inline gimple_seq *
3266 gimple_eh_else_n_body_ptr (gimple gs)
3268 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3269 return &gs->gimple_eh_else.n_body;
3272 static inline gimple_seq
3273 gimple_eh_else_n_body (gimple gs)
3275 return *gimple_eh_else_n_body_ptr (gs);
3278 static inline gimple_seq *
3279 gimple_eh_else_e_body_ptr (gimple gs)
3281 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3282 return &gs->gimple_eh_else.e_body;
3285 static inline gimple_seq
3286 gimple_eh_else_e_body (gimple gs)
3288 return *gimple_eh_else_e_body_ptr (gs);
3291 static inline void
3292 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3294 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3295 gs->gimple_eh_else.n_body = seq;
3298 static inline void
3299 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3301 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3302 gs->gimple_eh_else.e_body = seq;
3305 /* GIMPLE_TRY accessors. */
3307 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3308 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3310 static inline enum gimple_try_flags
3311 gimple_try_kind (const_gimple gs)
3313 GIMPLE_CHECK (gs, GIMPLE_TRY);
3314 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3318 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3320 static inline void
3321 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3323 GIMPLE_CHECK (gs, GIMPLE_TRY);
3324 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3325 || kind == GIMPLE_TRY_FINALLY);
3326 if (gimple_try_kind (gs) != kind)
3327 gs->gsbase.subcode = (unsigned int) kind;
3331 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3333 static inline bool
3334 gimple_try_catch_is_cleanup (const_gimple gs)
3336 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3337 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3341 /* Return a pointer to the sequence of statements used as the
3342 body for GIMPLE_TRY GS. */
3344 static inline gimple_seq *
3345 gimple_try_eval_ptr (gimple gs)
3347 GIMPLE_CHECK (gs, GIMPLE_TRY);
3348 return &gs->gimple_try.eval;
3352 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3354 static inline gimple_seq
3355 gimple_try_eval (gimple gs)
3357 return *gimple_try_eval_ptr (gs);
3361 /* Return a pointer to the sequence of statements used as the cleanup body for
3362 GIMPLE_TRY GS. */
3364 static inline gimple_seq *
3365 gimple_try_cleanup_ptr (gimple gs)
3367 GIMPLE_CHECK (gs, GIMPLE_TRY);
3368 return &gs->gimple_try.cleanup;
3372 /* Return the sequence of statements used as the cleanup body for
3373 GIMPLE_TRY GS. */
3375 static inline gimple_seq
3376 gimple_try_cleanup (gimple gs)
3378 return *gimple_try_cleanup_ptr (gs);
3382 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3384 static inline void
3385 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3387 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3388 if (catch_is_cleanup)
3389 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3390 else
3391 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3395 /* Set EVAL to be the sequence of statements to use as the body for
3396 GIMPLE_TRY GS. */
3398 static inline void
3399 gimple_try_set_eval (gimple gs, gimple_seq eval)
3401 GIMPLE_CHECK (gs, GIMPLE_TRY);
3402 gs->gimple_try.eval = eval;
3406 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3407 body for GIMPLE_TRY GS. */
3409 static inline void
3410 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3412 GIMPLE_CHECK (gs, GIMPLE_TRY);
3413 gs->gimple_try.cleanup = cleanup;
3417 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3419 static inline gimple_seq *
3420 gimple_wce_cleanup_ptr (gimple gs)
3422 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3423 return &gs->gimple_wce.cleanup;
3427 /* Return the cleanup sequence for cleanup statement GS. */
3429 static inline gimple_seq
3430 gimple_wce_cleanup (gimple gs)
3432 return *gimple_wce_cleanup_ptr (gs);
3436 /* Set CLEANUP to be the cleanup sequence for GS. */
3438 static inline void
3439 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3441 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3442 gs->gimple_wce.cleanup = cleanup;
3446 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3448 static inline bool
3449 gimple_wce_cleanup_eh_only (const_gimple gs)
3451 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3452 return gs->gsbase.subcode != 0;
3456 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3458 static inline void
3459 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3461 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3462 gs->gsbase.subcode = (unsigned int) eh_only_p;
3466 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3468 static inline unsigned
3469 gimple_phi_capacity (const_gimple gs)
3471 GIMPLE_CHECK (gs, GIMPLE_PHI);
3472 return gs->gimple_phi.capacity;
3476 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3477 be exactly the number of incoming edges for the basic block holding
3478 GS. */
3480 static inline unsigned
3481 gimple_phi_num_args (const_gimple gs)
3483 GIMPLE_CHECK (gs, GIMPLE_PHI);
3484 return gs->gimple_phi.nargs;
3488 /* Return the SSA name created by GIMPLE_PHI GS. */
3490 static inline tree
3491 gimple_phi_result (const_gimple gs)
3493 GIMPLE_CHECK (gs, GIMPLE_PHI);
3494 return gs->gimple_phi.result;
3497 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3499 static inline tree *
3500 gimple_phi_result_ptr (gimple gs)
3502 GIMPLE_CHECK (gs, GIMPLE_PHI);
3503 return &gs->gimple_phi.result;
3506 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3508 static inline void
3509 gimple_phi_set_result (gimple gs, tree result)
3511 GIMPLE_CHECK (gs, GIMPLE_PHI);
3512 gs->gimple_phi.result = result;
3513 if (result && TREE_CODE (result) == SSA_NAME)
3514 SSA_NAME_DEF_STMT (result) = gs;
3518 /* Return the PHI argument corresponding to incoming edge INDEX for
3519 GIMPLE_PHI GS. */
3521 static inline struct phi_arg_d *
3522 gimple_phi_arg (gimple gs, unsigned index)
3524 GIMPLE_CHECK (gs, GIMPLE_PHI);
3525 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3526 return &(gs->gimple_phi.args[index]);
3529 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3530 for GIMPLE_PHI GS. */
3532 static inline void
3533 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3535 GIMPLE_CHECK (gs, GIMPLE_PHI);
3536 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3537 gs->gimple_phi.args[index] = *phiarg;
3540 /* Return the region number for GIMPLE_RESX GS. */
3542 static inline int
3543 gimple_resx_region (const_gimple gs)
3545 GIMPLE_CHECK (gs, GIMPLE_RESX);
3546 return gs->gimple_eh_ctrl.region;
3549 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3551 static inline void
3552 gimple_resx_set_region (gimple gs, int region)
3554 GIMPLE_CHECK (gs, GIMPLE_RESX);
3555 gs->gimple_eh_ctrl.region = region;
3558 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3560 static inline int
3561 gimple_eh_dispatch_region (const_gimple gs)
3563 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3564 return gs->gimple_eh_ctrl.region;
3567 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3569 static inline void
3570 gimple_eh_dispatch_set_region (gimple gs, int region)
3572 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3573 gs->gimple_eh_ctrl.region = region;
3576 /* Return the number of labels associated with the switch statement GS. */
3578 static inline unsigned
3579 gimple_switch_num_labels (const_gimple gs)
3581 unsigned num_ops;
3582 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3583 num_ops = gimple_num_ops (gs);
3584 gcc_gimple_checking_assert (num_ops > 1);
3585 return num_ops - 1;
3589 /* Set NLABELS to be the number of labels for the switch statement GS. */
3591 static inline void
3592 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3594 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3595 gimple_set_num_ops (g, nlabels + 1);
3599 /* Return the index variable used by the switch statement GS. */
3601 static inline tree
3602 gimple_switch_index (const_gimple gs)
3604 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3605 return gimple_op (gs, 0);
3609 /* Return a pointer to the index variable for the switch statement GS. */
3611 static inline tree *
3612 gimple_switch_index_ptr (const_gimple gs)
3614 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3615 return gimple_op_ptr (gs, 0);
3619 /* Set INDEX to be the index variable for switch statement GS. */
3621 static inline void
3622 gimple_switch_set_index (gimple gs, tree index)
3624 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3625 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3626 gimple_set_op (gs, 0, index);
3630 /* Return the label numbered INDEX. The default label is 0, followed by any
3631 labels in a switch statement. */
3633 static inline tree
3634 gimple_switch_label (const_gimple gs, unsigned index)
3636 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3637 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3638 return gimple_op (gs, index + 1);
3641 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3643 static inline void
3644 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3646 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3647 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3648 && (label == NULL_TREE
3649 || TREE_CODE (label) == CASE_LABEL_EXPR));
3650 gimple_set_op (gs, index + 1, label);
3653 /* Return the default label for a switch statement. */
3655 static inline tree
3656 gimple_switch_default_label (const_gimple gs)
3658 tree label = gimple_switch_label (gs, 0);
3659 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3660 return label;
3663 /* Set the default label for a switch statement. */
3665 static inline void
3666 gimple_switch_set_default_label (gimple gs, tree label)
3668 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3669 gimple_switch_set_label (gs, 0, label);
3672 /* Return true if GS is a GIMPLE_DEBUG statement. */
3674 static inline bool
3675 is_gimple_debug (const_gimple gs)
3677 return gimple_code (gs) == GIMPLE_DEBUG;
3680 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3682 static inline bool
3683 gimple_debug_bind_p (const_gimple s)
3685 if (is_gimple_debug (s))
3686 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3688 return false;
3691 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3693 static inline tree
3694 gimple_debug_bind_get_var (gimple dbg)
3696 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3697 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3698 return gimple_op (dbg, 0);
3701 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3702 statement. */
3704 static inline tree
3705 gimple_debug_bind_get_value (gimple dbg)
3707 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3708 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3709 return gimple_op (dbg, 1);
3712 /* Return a pointer to the value bound to the variable in a
3713 GIMPLE_DEBUG bind statement. */
3715 static inline tree *
3716 gimple_debug_bind_get_value_ptr (gimple dbg)
3718 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3719 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3720 return gimple_op_ptr (dbg, 1);
3723 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3725 static inline void
3726 gimple_debug_bind_set_var (gimple dbg, tree var)
3728 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3729 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3730 gimple_set_op (dbg, 0, var);
3733 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3734 statement. */
3736 static inline void
3737 gimple_debug_bind_set_value (gimple dbg, tree value)
3739 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3740 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3741 gimple_set_op (dbg, 1, value);
3744 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3745 optimized away. */
3746 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3748 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3749 statement. */
3751 static inline void
3752 gimple_debug_bind_reset_value (gimple dbg)
3754 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3755 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3756 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3759 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3760 value. */
3762 static inline bool
3763 gimple_debug_bind_has_value_p (gimple dbg)
3765 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3766 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3767 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3770 #undef GIMPLE_DEBUG_BIND_NOVALUE
3772 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3774 static inline bool
3775 gimple_debug_source_bind_p (const_gimple s)
3777 if (is_gimple_debug (s))
3778 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3780 return false;
3783 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3785 static inline tree
3786 gimple_debug_source_bind_get_var (gimple dbg)
3788 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3789 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3790 return gimple_op (dbg, 0);
3793 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3794 statement. */
3796 static inline tree
3797 gimple_debug_source_bind_get_value (gimple dbg)
3799 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3800 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3801 return gimple_op (dbg, 1);
3804 /* Return a pointer to the value bound to the variable in a
3805 GIMPLE_DEBUG source bind statement. */
3807 static inline tree *
3808 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3810 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3811 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3812 return gimple_op_ptr (dbg, 1);
3815 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3817 static inline void
3818 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3820 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3821 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3822 gimple_set_op (dbg, 0, var);
3825 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3826 statement. */
3828 static inline void
3829 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3831 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3832 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3833 gimple_set_op (dbg, 1, value);
3836 /* Return a pointer to the body for the OMP statement GS. */
3838 static inline gimple_seq *
3839 gimple_omp_body_ptr (gimple gs)
3841 return &gs->omp.body;
3844 /* Return the body for the OMP statement GS. */
3846 static inline gimple_seq
3847 gimple_omp_body (gimple gs)
3849 return *gimple_omp_body_ptr (gs);
3852 /* Set BODY to be the body for the OMP statement GS. */
3854 static inline void
3855 gimple_omp_set_body (gimple gs, gimple_seq body)
3857 gs->omp.body = body;
3861 /* Return the name associated with OMP_CRITICAL statement GS. */
3863 static inline tree
3864 gimple_omp_critical_name (const_gimple gs)
3866 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3867 return gs->gimple_omp_critical.name;
3871 /* Return a pointer to the name associated with OMP critical statement GS. */
3873 static inline tree *
3874 gimple_omp_critical_name_ptr (gimple gs)
3876 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3877 return &gs->gimple_omp_critical.name;
3881 /* Set NAME to be the name associated with OMP critical statement GS. */
3883 static inline void
3884 gimple_omp_critical_set_name (gimple gs, tree name)
3886 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3887 gs->gimple_omp_critical.name = name;
3891 /* Return the clauses associated with OMP_FOR GS. */
3893 static inline tree
3894 gimple_omp_for_clauses (const_gimple gs)
3896 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3897 return gs->gimple_omp_for.clauses;
3901 /* Return a pointer to the OMP_FOR GS. */
3903 static inline tree *
3904 gimple_omp_for_clauses_ptr (gimple gs)
3906 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3907 return &gs->gimple_omp_for.clauses;
3911 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3913 static inline void
3914 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3916 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3917 gs->gimple_omp_for.clauses = clauses;
3921 /* Get the collapse count of OMP_FOR GS. */
3923 static inline size_t
3924 gimple_omp_for_collapse (gimple gs)
3926 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3927 return gs->gimple_omp_for.collapse;
3931 /* Return the index variable for OMP_FOR GS. */
3933 static inline tree
3934 gimple_omp_for_index (const_gimple gs, size_t i)
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3937 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3938 return gs->gimple_omp_for.iter[i].index;
3942 /* Return a pointer to the index variable for OMP_FOR GS. */
3944 static inline tree *
3945 gimple_omp_for_index_ptr (gimple gs, size_t i)
3947 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3948 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3949 return &gs->gimple_omp_for.iter[i].index;
3953 /* Set INDEX to be the index variable for OMP_FOR GS. */
3955 static inline void
3956 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3958 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3959 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3960 gs->gimple_omp_for.iter[i].index = index;
3964 /* Return the initial value for OMP_FOR GS. */
3966 static inline tree
3967 gimple_omp_for_initial (const_gimple gs, size_t i)
3969 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3970 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3971 return gs->gimple_omp_for.iter[i].initial;
3975 /* Return a pointer to the initial value for OMP_FOR GS. */
3977 static inline tree *
3978 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3980 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3981 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3982 return &gs->gimple_omp_for.iter[i].initial;
3986 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3988 static inline void
3989 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3991 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3992 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3993 gs->gimple_omp_for.iter[i].initial = initial;
3997 /* Return the final value for OMP_FOR GS. */
3999 static inline tree
4000 gimple_omp_for_final (const_gimple gs, size_t i)
4002 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4003 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4004 return gs->gimple_omp_for.iter[i].final;
4008 /* Return a pointer to the final value for OMP_FOR GS. */
4010 static inline tree *
4011 gimple_omp_for_final_ptr (gimple gs, size_t i)
4013 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4014 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4015 return &gs->gimple_omp_for.iter[i].final;
4019 /* Set FINAL to be the final value for OMP_FOR GS. */
4021 static inline void
4022 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4024 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4025 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4026 gs->gimple_omp_for.iter[i].final = final;
4030 /* Return the increment value for OMP_FOR GS. */
4032 static inline tree
4033 gimple_omp_for_incr (const_gimple gs, size_t i)
4035 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4036 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4037 return gs->gimple_omp_for.iter[i].incr;
4041 /* Return a pointer to the increment value for OMP_FOR GS. */
4043 static inline tree *
4044 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4046 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4047 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4048 return &gs->gimple_omp_for.iter[i].incr;
4052 /* Set INCR to be the increment value for OMP_FOR GS. */
4054 static inline void
4055 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4057 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4058 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4059 gs->gimple_omp_for.iter[i].incr = incr;
4063 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4064 statement GS starts. */
4066 static inline gimple_seq *
4067 gimple_omp_for_pre_body_ptr (gimple gs)
4069 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4070 return &gs->gimple_omp_for.pre_body;
4074 /* Return the sequence of statements to execute before the OMP_FOR
4075 statement GS starts. */
4077 static inline gimple_seq
4078 gimple_omp_for_pre_body (gimple gs)
4080 return *gimple_omp_for_pre_body_ptr (gs);
4084 /* Set PRE_BODY to be the sequence of statements to execute before the
4085 OMP_FOR statement GS starts. */
4087 static inline void
4088 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4090 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4091 gs->gimple_omp_for.pre_body = pre_body;
4095 /* Return the clauses associated with OMP_PARALLEL GS. */
4097 static inline tree
4098 gimple_omp_parallel_clauses (const_gimple gs)
4100 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4101 return gs->gimple_omp_parallel.clauses;
4105 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4107 static inline tree *
4108 gimple_omp_parallel_clauses_ptr (gimple gs)
4110 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4111 return &gs->gimple_omp_parallel.clauses;
4115 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4116 GS. */
4118 static inline void
4119 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4121 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4122 gs->gimple_omp_parallel.clauses = clauses;
4126 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4128 static inline tree
4129 gimple_omp_parallel_child_fn (const_gimple gs)
4131 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4132 return gs->gimple_omp_parallel.child_fn;
4135 /* Return a pointer to the child function used to hold the body of
4136 OMP_PARALLEL GS. */
4138 static inline tree *
4139 gimple_omp_parallel_child_fn_ptr (gimple gs)
4141 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4142 return &gs->gimple_omp_parallel.child_fn;
4146 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4148 static inline void
4149 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4151 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4152 gs->gimple_omp_parallel.child_fn = child_fn;
4156 /* Return the artificial argument used to send variables and values
4157 from the parent to the children threads in OMP_PARALLEL GS. */
4159 static inline tree
4160 gimple_omp_parallel_data_arg (const_gimple gs)
4162 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4163 return gs->gimple_omp_parallel.data_arg;
4167 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4169 static inline tree *
4170 gimple_omp_parallel_data_arg_ptr (gimple gs)
4172 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4173 return &gs->gimple_omp_parallel.data_arg;
4177 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4179 static inline void
4180 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4182 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4183 gs->gimple_omp_parallel.data_arg = data_arg;
4187 /* Return the clauses associated with OMP_TASK GS. */
4189 static inline tree
4190 gimple_omp_task_clauses (const_gimple gs)
4192 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4193 return gs->gimple_omp_parallel.clauses;
4197 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4199 static inline tree *
4200 gimple_omp_task_clauses_ptr (gimple gs)
4202 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4203 return &gs->gimple_omp_parallel.clauses;
4207 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4208 GS. */
4210 static inline void
4211 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4213 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4214 gs->gimple_omp_parallel.clauses = clauses;
4218 /* Return the child function used to hold the body of OMP_TASK GS. */
4220 static inline tree
4221 gimple_omp_task_child_fn (const_gimple gs)
4223 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4224 return gs->gimple_omp_parallel.child_fn;
4227 /* Return a pointer to the child function used to hold the body of
4228 OMP_TASK GS. */
4230 static inline tree *
4231 gimple_omp_task_child_fn_ptr (gimple gs)
4233 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4234 return &gs->gimple_omp_parallel.child_fn;
4238 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4240 static inline void
4241 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4243 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4244 gs->gimple_omp_parallel.child_fn = child_fn;
4248 /* Return the artificial argument used to send variables and values
4249 from the parent to the children threads in OMP_TASK GS. */
4251 static inline tree
4252 gimple_omp_task_data_arg (const_gimple gs)
4254 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4255 return gs->gimple_omp_parallel.data_arg;
4259 /* Return a pointer to the data argument for OMP_TASK GS. */
4261 static inline tree *
4262 gimple_omp_task_data_arg_ptr (gimple gs)
4264 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4265 return &gs->gimple_omp_parallel.data_arg;
4269 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4271 static inline void
4272 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4274 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4275 gs->gimple_omp_parallel.data_arg = data_arg;
4279 /* Return the clauses associated with OMP_TASK GS. */
4281 static inline tree
4282 gimple_omp_taskreg_clauses (const_gimple gs)
4284 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4285 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4286 return gs->gimple_omp_parallel.clauses;
4290 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4292 static inline tree *
4293 gimple_omp_taskreg_clauses_ptr (gimple gs)
4295 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4296 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4297 return &gs->gimple_omp_parallel.clauses;
4301 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4302 GS. */
4304 static inline void
4305 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4307 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4308 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4309 gs->gimple_omp_parallel.clauses = clauses;
4313 /* Return the child function used to hold the body of OMP_TASK GS. */
4315 static inline tree
4316 gimple_omp_taskreg_child_fn (const_gimple gs)
4318 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4319 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4320 return gs->gimple_omp_parallel.child_fn;
4323 /* Return a pointer to the child function used to hold the body of
4324 OMP_TASK GS. */
4326 static inline tree *
4327 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4329 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4330 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4331 return &gs->gimple_omp_parallel.child_fn;
4335 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4337 static inline void
4338 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4340 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4341 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4342 gs->gimple_omp_parallel.child_fn = child_fn;
4346 /* Return the artificial argument used to send variables and values
4347 from the parent to the children threads in OMP_TASK GS. */
4349 static inline tree
4350 gimple_omp_taskreg_data_arg (const_gimple gs)
4352 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4353 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4354 return gs->gimple_omp_parallel.data_arg;
4358 /* Return a pointer to the data argument for OMP_TASK GS. */
4360 static inline tree *
4361 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4363 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4364 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4365 return &gs->gimple_omp_parallel.data_arg;
4369 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4371 static inline void
4372 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4374 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4375 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4376 gs->gimple_omp_parallel.data_arg = data_arg;
4380 /* Return the copy function used to hold the body of OMP_TASK GS. */
4382 static inline tree
4383 gimple_omp_task_copy_fn (const_gimple gs)
4385 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4386 return gs->gimple_omp_task.copy_fn;
4389 /* Return a pointer to the copy function used to hold the body of
4390 OMP_TASK GS. */
4392 static inline tree *
4393 gimple_omp_task_copy_fn_ptr (gimple gs)
4395 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4396 return &gs->gimple_omp_task.copy_fn;
4400 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4402 static inline void
4403 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4405 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4406 gs->gimple_omp_task.copy_fn = copy_fn;
4410 /* Return size of the data block in bytes in OMP_TASK GS. */
4412 static inline tree
4413 gimple_omp_task_arg_size (const_gimple gs)
4415 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4416 return gs->gimple_omp_task.arg_size;
4420 /* Return a pointer to the data block size for OMP_TASK GS. */
4422 static inline tree *
4423 gimple_omp_task_arg_size_ptr (gimple gs)
4425 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4426 return &gs->gimple_omp_task.arg_size;
4430 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4432 static inline void
4433 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4435 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4436 gs->gimple_omp_task.arg_size = arg_size;
4440 /* Return align of the data block in bytes in OMP_TASK GS. */
4442 static inline tree
4443 gimple_omp_task_arg_align (const_gimple gs)
4445 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4446 return gs->gimple_omp_task.arg_align;
4450 /* Return a pointer to the data block align for OMP_TASK GS. */
4452 static inline tree *
4453 gimple_omp_task_arg_align_ptr (gimple gs)
4455 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4456 return &gs->gimple_omp_task.arg_align;
4460 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4462 static inline void
4463 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4465 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4466 gs->gimple_omp_task.arg_align = arg_align;
4470 /* Return the clauses associated with OMP_SINGLE GS. */
4472 static inline tree
4473 gimple_omp_single_clauses (const_gimple gs)
4475 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4476 return gs->gimple_omp_single.clauses;
4480 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4482 static inline tree *
4483 gimple_omp_single_clauses_ptr (gimple gs)
4485 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4486 return &gs->gimple_omp_single.clauses;
4490 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4492 static inline void
4493 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4495 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4496 gs->gimple_omp_single.clauses = clauses;
4500 /* Return the clauses associated with OMP_SECTIONS GS. */
4502 static inline tree
4503 gimple_omp_sections_clauses (const_gimple gs)
4505 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4506 return gs->gimple_omp_sections.clauses;
4510 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4512 static inline tree *
4513 gimple_omp_sections_clauses_ptr (gimple gs)
4515 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4516 return &gs->gimple_omp_sections.clauses;
4520 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4521 GS. */
4523 static inline void
4524 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4526 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4527 gs->gimple_omp_sections.clauses = clauses;
4531 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4532 in GS. */
4534 static inline tree
4535 gimple_omp_sections_control (const_gimple gs)
4537 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4538 return gs->gimple_omp_sections.control;
4542 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4543 GS. */
4545 static inline tree *
4546 gimple_omp_sections_control_ptr (gimple gs)
4548 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4549 return &gs->gimple_omp_sections.control;
4553 /* Set CONTROL to be the set of clauses associated with the
4554 GIMPLE_OMP_SECTIONS in GS. */
4556 static inline void
4557 gimple_omp_sections_set_control (gimple gs, tree control)
4559 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4560 gs->gimple_omp_sections.control = control;
4564 /* Set COND to be the condition code for OMP_FOR GS. */
4566 static inline void
4567 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4569 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4570 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4571 && i < gs->gimple_omp_for.collapse);
4572 gs->gimple_omp_for.iter[i].cond = cond;
4576 /* Return the condition code associated with OMP_FOR GS. */
4578 static inline enum tree_code
4579 gimple_omp_for_cond (const_gimple gs, size_t i)
4581 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4582 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4583 return gs->gimple_omp_for.iter[i].cond;
4587 /* Set the value being stored in an atomic store. */
4589 static inline void
4590 gimple_omp_atomic_store_set_val (gimple g, tree val)
4592 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4593 g->gimple_omp_atomic_store.val = val;
4597 /* Return the value being stored in an atomic store. */
4599 static inline tree
4600 gimple_omp_atomic_store_val (const_gimple g)
4602 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4603 return g->gimple_omp_atomic_store.val;
4607 /* Return a pointer to the value being stored in an atomic store. */
4609 static inline tree *
4610 gimple_omp_atomic_store_val_ptr (gimple g)
4612 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4613 return &g->gimple_omp_atomic_store.val;
4617 /* Set the LHS of an atomic load. */
4619 static inline void
4620 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4622 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4623 g->gimple_omp_atomic_load.lhs = lhs;
4627 /* Get the LHS of an atomic load. */
4629 static inline tree
4630 gimple_omp_atomic_load_lhs (const_gimple g)
4632 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4633 return g->gimple_omp_atomic_load.lhs;
4637 /* Return a pointer to the LHS of an atomic load. */
4639 static inline tree *
4640 gimple_omp_atomic_load_lhs_ptr (gimple g)
4642 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4643 return &g->gimple_omp_atomic_load.lhs;
4647 /* Set the RHS of an atomic load. */
4649 static inline void
4650 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4652 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4653 g->gimple_omp_atomic_load.rhs = rhs;
4657 /* Get the RHS of an atomic load. */
4659 static inline tree
4660 gimple_omp_atomic_load_rhs (const_gimple g)
4662 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4663 return g->gimple_omp_atomic_load.rhs;
4667 /* Return a pointer to the RHS of an atomic load. */
4669 static inline tree *
4670 gimple_omp_atomic_load_rhs_ptr (gimple g)
4672 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4673 return &g->gimple_omp_atomic_load.rhs;
4677 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4679 static inline tree
4680 gimple_omp_continue_control_def (const_gimple g)
4682 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4683 return g->gimple_omp_continue.control_def;
4686 /* The same as above, but return the address. */
4688 static inline tree *
4689 gimple_omp_continue_control_def_ptr (gimple g)
4691 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4692 return &g->gimple_omp_continue.control_def;
4695 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4697 static inline void
4698 gimple_omp_continue_set_control_def (gimple g, tree def)
4700 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4701 g->gimple_omp_continue.control_def = def;
4705 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4707 static inline tree
4708 gimple_omp_continue_control_use (const_gimple g)
4710 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4711 return g->gimple_omp_continue.control_use;
4715 /* The same as above, but return the address. */
4717 static inline tree *
4718 gimple_omp_continue_control_use_ptr (gimple g)
4720 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4721 return &g->gimple_omp_continue.control_use;
4725 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4727 static inline void
4728 gimple_omp_continue_set_control_use (gimple g, tree use)
4730 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4731 g->gimple_omp_continue.control_use = use;
4734 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4736 static inline gimple_seq *
4737 gimple_transaction_body_ptr (gimple gs)
4739 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4740 return &gs->gimple_transaction.body;
4743 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4745 static inline gimple_seq
4746 gimple_transaction_body (gimple gs)
4748 return *gimple_transaction_body_ptr (gs);
4751 /* Return the label associated with a GIMPLE_TRANSACTION. */
4753 static inline tree
4754 gimple_transaction_label (const_gimple gs)
4756 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4757 return gs->gimple_transaction.label;
4760 static inline tree *
4761 gimple_transaction_label_ptr (gimple gs)
4763 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4764 return &gs->gimple_transaction.label;
4767 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4769 static inline unsigned int
4770 gimple_transaction_subcode (const_gimple gs)
4772 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4773 return gs->gsbase.subcode;
4776 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4778 static inline void
4779 gimple_transaction_set_body (gimple gs, gimple_seq body)
4781 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4782 gs->gimple_transaction.body = body;
4785 /* Set the label associated with a GIMPLE_TRANSACTION. */
4787 static inline void
4788 gimple_transaction_set_label (gimple gs, tree label)
4790 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4791 gs->gimple_transaction.label = label;
4794 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4796 static inline void
4797 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4799 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4800 gs->gsbase.subcode = subcode;
4804 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4806 static inline tree *
4807 gimple_return_retval_ptr (const_gimple gs)
4809 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4810 return gimple_op_ptr (gs, 0);
4813 /* Return the return value for GIMPLE_RETURN GS. */
4815 static inline tree
4816 gimple_return_retval (const_gimple gs)
4818 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4819 return gimple_op (gs, 0);
4823 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4825 static inline void
4826 gimple_return_set_retval (gimple gs, tree retval)
4828 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4829 gimple_set_op (gs, 0, retval);
4833 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4835 #define CASE_GIMPLE_OMP \
4836 case GIMPLE_OMP_PARALLEL: \
4837 case GIMPLE_OMP_TASK: \
4838 case GIMPLE_OMP_FOR: \
4839 case GIMPLE_OMP_SECTIONS: \
4840 case GIMPLE_OMP_SECTIONS_SWITCH: \
4841 case GIMPLE_OMP_SINGLE: \
4842 case GIMPLE_OMP_SECTION: \
4843 case GIMPLE_OMP_MASTER: \
4844 case GIMPLE_OMP_ORDERED: \
4845 case GIMPLE_OMP_CRITICAL: \
4846 case GIMPLE_OMP_RETURN: \
4847 case GIMPLE_OMP_ATOMIC_LOAD: \
4848 case GIMPLE_OMP_ATOMIC_STORE: \
4849 case GIMPLE_OMP_CONTINUE
4851 static inline bool
4852 is_gimple_omp (const_gimple stmt)
4854 switch (gimple_code (stmt))
4856 CASE_GIMPLE_OMP:
4857 return true;
4858 default:
4859 return false;
4864 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4866 static inline bool
4867 gimple_nop_p (const_gimple g)
4869 return gimple_code (g) == GIMPLE_NOP;
4873 /* Return true if GS is a GIMPLE_RESX. */
4875 static inline bool
4876 is_gimple_resx (const_gimple gs)
4878 return gimple_code (gs) == GIMPLE_RESX;
4881 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4883 static inline enum br_predictor
4884 gimple_predict_predictor (gimple gs)
4886 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4887 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4891 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4893 static inline void
4894 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4896 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4897 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4898 | (unsigned) predictor;
4902 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4904 static inline enum prediction
4905 gimple_predict_outcome (gimple gs)
4907 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4908 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4912 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4914 static inline void
4915 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4917 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4918 if (outcome == TAKEN)
4919 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4920 else
4921 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4925 /* Return the type of the main expression computed by STMT. Return
4926 void_type_node if the statement computes nothing. */
4928 static inline tree
4929 gimple_expr_type (const_gimple stmt)
4931 enum gimple_code code = gimple_code (stmt);
4933 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4935 tree type;
4936 /* In general we want to pass out a type that can be substituted
4937 for both the RHS and the LHS types if there is a possibly
4938 useless conversion involved. That means returning the
4939 original RHS type as far as we can reconstruct it. */
4940 if (code == GIMPLE_CALL)
4941 type = gimple_call_return_type (stmt);
4942 else
4943 switch (gimple_assign_rhs_code (stmt))
4945 case POINTER_PLUS_EXPR:
4946 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4947 break;
4949 default:
4950 /* As fallback use the type of the LHS. */
4951 type = TREE_TYPE (gimple_get_lhs (stmt));
4952 break;
4954 return type;
4956 else if (code == GIMPLE_COND)
4957 return boolean_type_node;
4958 else
4959 return void_type_node;
4962 /* Return true if TYPE is a suitable type for a scalar register variable. */
4964 static inline bool
4965 is_gimple_reg_type (tree type)
4967 return !AGGREGATE_TYPE_P (type);
4970 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4972 static inline gimple_stmt_iterator
4973 gsi_start_1 (gimple_seq *seq)
4975 gimple_stmt_iterator i;
4977 i.ptr = gimple_seq_first (*seq);
4978 i.seq = seq;
4979 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4981 return i;
4984 #define gsi_start(x) gsi_start_1(&(x))
4986 static inline gimple_stmt_iterator
4987 gsi_none (void)
4989 gimple_stmt_iterator i;
4990 i.ptr = NULL;
4991 i.seq = NULL;
4992 i.bb = NULL;
4993 return i;
4996 /* Return a new iterator pointing to the first statement in basic block BB. */
4998 static inline gimple_stmt_iterator
4999 gsi_start_bb (basic_block bb)
5001 gimple_stmt_iterator i;
5002 gimple_seq *seq;
5004 seq = bb_seq_addr (bb);
5005 i.ptr = gimple_seq_first (*seq);
5006 i.seq = seq;
5007 i.bb = bb;
5009 return i;
5013 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5015 static inline gimple_stmt_iterator
5016 gsi_last_1 (gimple_seq *seq)
5018 gimple_stmt_iterator i;
5020 i.ptr = gimple_seq_last (*seq);
5021 i.seq = seq;
5022 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5024 return i;
5027 #define gsi_last(x) gsi_last_1(&(x))
5029 /* Return a new iterator pointing to the last statement in basic block BB. */
5031 static inline gimple_stmt_iterator
5032 gsi_last_bb (basic_block bb)
5034 gimple_stmt_iterator i;
5035 gimple_seq *seq;
5037 seq = bb_seq_addr (bb);
5038 i.ptr = gimple_seq_last (*seq);
5039 i.seq = seq;
5040 i.bb = bb;
5042 return i;
5046 /* Return true if I is at the end of its sequence. */
5048 static inline bool
5049 gsi_end_p (gimple_stmt_iterator i)
5051 return i.ptr == NULL;
5055 /* Return true if I is one statement before the end of its sequence. */
5057 static inline bool
5058 gsi_one_before_end_p (gimple_stmt_iterator i)
5060 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5064 /* Advance the iterator to the next gimple statement. */
5066 static inline void
5067 gsi_next (gimple_stmt_iterator *i)
5069 i->ptr = i->ptr->gsbase.next;
5072 /* Advance the iterator to the previous gimple statement. */
5074 static inline void
5075 gsi_prev (gimple_stmt_iterator *i)
5077 gimple prev = i->ptr->gsbase.prev;
5078 if (prev->gsbase.next)
5079 i->ptr = prev;
5080 else
5081 i->ptr = NULL;
5084 /* Return the current stmt. */
5086 static inline gimple
5087 gsi_stmt (gimple_stmt_iterator i)
5089 return i.ptr;
5092 /* Return a block statement iterator that points to the first non-label
5093 statement in block BB. */
5095 static inline gimple_stmt_iterator
5096 gsi_after_labels (basic_block bb)
5098 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5100 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5101 gsi_next (&gsi);
5103 return gsi;
5106 /* Advance the iterator to the next non-debug gimple statement. */
5108 static inline void
5109 gsi_next_nondebug (gimple_stmt_iterator *i)
5113 gsi_next (i);
5115 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5118 /* Advance the iterator to the next non-debug gimple statement. */
5120 static inline void
5121 gsi_prev_nondebug (gimple_stmt_iterator *i)
5125 gsi_prev (i);
5127 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5130 /* Return a new iterator pointing to the first non-debug statement in
5131 basic block BB. */
5133 static inline gimple_stmt_iterator
5134 gsi_start_nondebug_bb (basic_block bb)
5136 gimple_stmt_iterator i = gsi_start_bb (bb);
5138 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5139 gsi_next_nondebug (&i);
5141 return i;
5144 /* Return a new iterator pointing to the last non-debug statement in
5145 basic block BB. */
5147 static inline gimple_stmt_iterator
5148 gsi_last_nondebug_bb (basic_block bb)
5150 gimple_stmt_iterator i = gsi_last_bb (bb);
5152 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5153 gsi_prev_nondebug (&i);
5155 return i;
5159 /* Return the basic block associated with this iterator. */
5161 static inline basic_block
5162 gsi_bb (gimple_stmt_iterator i)
5164 return i.bb;
5168 /* Return the sequence associated with this iterator. */
5170 static inline gimple_seq
5171 gsi_seq (gimple_stmt_iterator i)
5173 return *i.seq;
5177 enum gsi_iterator_update
5179 GSI_NEW_STMT, /* Only valid when single statement is added, move
5180 iterator to it. */
5181 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5182 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5183 for linking other statements in the same
5184 direction. */
5187 /* In gimple-iterator.c */
5188 gimple_stmt_iterator gsi_start_phis (basic_block);
5189 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5190 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5191 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5192 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5193 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5194 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5195 enum gsi_iterator_update);
5196 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5197 enum gsi_iterator_update);
5198 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5199 enum gsi_iterator_update);
5200 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5201 enum gsi_iterator_update);
5202 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5203 enum gsi_iterator_update);
5204 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5205 enum gsi_iterator_update);
5206 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5207 enum gsi_iterator_update);
5208 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5209 enum gsi_iterator_update);
5210 bool gsi_remove (gimple_stmt_iterator *, bool);
5211 gimple_stmt_iterator gsi_for_stmt (gimple);
5212 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5213 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5214 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5215 void gsi_insert_on_edge (edge, gimple);
5216 void gsi_insert_seq_on_edge (edge, gimple_seq);
5217 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5218 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5219 void gsi_commit_one_edge_insert (edge, basic_block *);
5220 void gsi_commit_edge_inserts (void);
5221 gimple gimple_call_copy_skip_args (gimple, bitmap);
5224 /* Convenience routines to walk all statements of a gimple function.
5225 Note that this is useful exclusively before the code is converted
5226 into SSA form. Once the program is in SSA form, the standard
5227 operand interface should be used to analyze/modify statements. */
5228 struct walk_stmt_info
5230 /* Points to the current statement being walked. */
5231 gimple_stmt_iterator gsi;
5233 /* Additional data that the callback functions may want to carry
5234 through the recursion. */
5235 void *info;
5237 /* Pointer map used to mark visited tree nodes when calling
5238 walk_tree on each operand. If set to NULL, duplicate tree nodes
5239 will be visited more than once. */
5240 struct pointer_set_t *pset;
5242 /* Operand returned by the callbacks. This is set when calling
5243 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5244 returns non-NULL, this field will contain the tree returned by
5245 the last callback. */
5246 tree callback_result;
5248 /* Indicates whether the operand being examined may be replaced
5249 with something that matches is_gimple_val (if true) or something
5250 slightly more complicated (if false). "Something" technically
5251 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5252 but we never try to form anything more complicated than that, so
5253 we don't bother checking.
5255 Also note that CALLBACK should update this flag while walking the
5256 sub-expressions of a statement. For instance, when walking the
5257 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5258 to true, however, when walking &var, the operand of that
5259 ADDR_EXPR does not need to be a GIMPLE value. */
5260 BOOL_BITFIELD val_only : 1;
5262 /* True if we are currently walking the LHS of an assignment. */
5263 BOOL_BITFIELD is_lhs : 1;
5265 /* Optional. Set to true by the callback functions if they made any
5266 changes. */
5267 BOOL_BITFIELD changed : 1;
5269 /* True if we're interested in location information. */
5270 BOOL_BITFIELD want_locations : 1;
5272 /* True if we've removed the statement that was processed. */
5273 BOOL_BITFIELD removed_stmt : 1;
5276 /* Callback for walk_gimple_stmt. Called for every statement found
5277 during traversal. The first argument points to the statement to
5278 walk. The second argument is a flag that the callback sets to
5279 'true' if it the callback handled all the operands and
5280 sub-statements of the statement (the default value of this flag is
5281 'false'). The third argument is an anonymous pointer to data
5282 to be used by the callback. */
5283 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5284 struct walk_stmt_info *);
5286 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5287 struct walk_stmt_info *);
5288 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5289 struct walk_stmt_info *);
5290 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5291 struct walk_stmt_info *);
5292 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5294 /* Enum and arrays used for allocation stats. Keep in sync with
5295 gimple.c:gimple_alloc_kind_names. */
5296 enum gimple_alloc_kind
5298 gimple_alloc_kind_assign, /* Assignments. */
5299 gimple_alloc_kind_phi, /* PHI nodes. */
5300 gimple_alloc_kind_cond, /* Conditionals. */
5301 gimple_alloc_kind_rest, /* Everything else. */
5302 gimple_alloc_kind_all
5305 extern int gimple_alloc_counts[];
5306 extern int gimple_alloc_sizes[];
5308 /* Return the allocation kind for a given stmt CODE. */
5309 static inline enum gimple_alloc_kind
5310 gimple_alloc_kind (enum gimple_code code)
5312 switch (code)
5314 case GIMPLE_ASSIGN:
5315 return gimple_alloc_kind_assign;
5316 case GIMPLE_PHI:
5317 return gimple_alloc_kind_phi;
5318 case GIMPLE_COND:
5319 return gimple_alloc_kind_cond;
5320 default:
5321 return gimple_alloc_kind_rest;
5325 extern void dump_gimple_statistics (void);
5327 /* In gimple-fold.c. */
5328 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5329 tree gimple_fold_builtin (gimple);
5330 bool fold_stmt (gimple_stmt_iterator *);
5331 bool fold_stmt_inplace (gimple_stmt_iterator *);
5332 tree get_symbol_constant_value (tree);
5333 tree canonicalize_constructor_val (tree, tree);
5334 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5335 enum tree_code, tree, tree);
5336 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5337 enum tree_code, tree, tree);
5339 bool gimple_val_nonnegative_real_p (tree);
5340 #endif /* GCC_GIMPLE_H */