Merge trunk version 195164 into gupc branch.
[official-gcc.git] / gcc / gimple.h
blob1ecd4c11c4d4897e688bda7e98eeeab78618e37e
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2013 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "ggc.h"
28 #include "basic-block.h"
29 #include "tree.h"
30 #include "tree-ssa-operands.h"
31 #include "tree-ssa-alias.h"
32 #include "internal-fn.h"
34 typedef gimple gimple_seq_node;
36 /* For each block, the PHI nodes that need to be rewritten are stored into
37 these vectors. */
38 typedef vec<gimple> gimple_vec;
40 enum gimple_code {
41 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
42 #include "gimple.def"
43 #undef DEFGSCODE
44 LAST_AND_UNUSED_GIMPLE_CODE
47 extern const char *const gimple_code_name[];
48 extern const unsigned char gimple_rhs_class_table[];
50 /* Error out if a gimple tuple is addressed incorrectly. */
51 #if defined ENABLE_GIMPLE_CHECKING
52 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
53 extern void gimple_check_failed (const_gimple, const char *, int, \
54 const char *, enum gimple_code, \
55 enum tree_code) ATTRIBUTE_NORETURN;
57 #define GIMPLE_CHECK(GS, CODE) \
58 do { \
59 const_gimple __gs = (GS); \
60 if (gimple_code (__gs) != (CODE)) \
61 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
62 (CODE), ERROR_MARK); \
63 } while (0)
64 #else /* not ENABLE_GIMPLE_CHECKING */
65 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
66 #define GIMPLE_CHECK(GS, CODE) (void)0
67 #endif
69 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
70 get_gimple_rhs_class. */
71 enum gimple_rhs_class
73 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
74 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
75 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
76 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
77 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
78 name, a _DECL, a _REF, etc. */
81 /* Specific flags for individual GIMPLE statements. These flags are
82 always stored in gimple_statement_base.subcode and they may only be
83 defined for statement codes that do not use sub-codes.
85 Values for the masks can overlap as long as the overlapping values
86 are never used in the same statement class.
88 The maximum mask value that can be defined is 1 << 15 (i.e., each
89 statement code can hold up to 16 bitflags).
91 Keep this list sorted. */
92 enum gf_mask {
93 GF_ASM_INPUT = 1 << 0,
94 GF_ASM_VOLATILE = 1 << 1,
95 GF_CALL_FROM_THUNK = 1 << 0,
96 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
97 GF_CALL_TAILCALL = 1 << 2,
98 GF_CALL_VA_ARG_PACK = 1 << 3,
99 GF_CALL_NOTHROW = 1 << 4,
100 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
101 GF_CALL_INTERNAL = 1 << 6,
102 GF_OMP_PARALLEL_COMBINED = 1 << 0,
104 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
105 a thread synchronization via some sort of barrier. The exact barrier
106 that would otherwise be emitted is dependent on the OMP statement with
107 which this return is associated. */
108 GF_OMP_RETURN_NOWAIT = 1 << 0,
110 GF_OMP_SECTION_LAST = 1 << 0,
111 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
112 GF_PREDICT_TAKEN = 1 << 15
115 /* Currently, there are only two types of gimple debug stmt. Others are
116 envisioned, for example, to enable the generation of is_stmt notes
117 in line number information, to mark sequence points, etc. This
118 subcode is to be used to tell them apart. */
119 enum gimple_debug_subcode {
120 GIMPLE_DEBUG_BIND = 0,
121 GIMPLE_DEBUG_SOURCE_BIND = 1
124 /* Masks for selecting a pass local flag (PLF) to work on. These
125 masks are used by gimple_set_plf and gimple_plf. */
126 enum plf_mask {
127 GF_PLF_1 = 1 << 0,
128 GF_PLF_2 = 1 << 1
131 /* Iterator object for GIMPLE statement sequences. */
133 typedef struct
135 /* Sequence node holding the current statement. */
136 gimple_seq_node ptr;
138 /* Sequence and basic block holding the statement. These fields
139 are necessary to handle edge cases such as when statement is
140 added to an empty basic block or when the last statement of a
141 block/sequence is removed. */
142 gimple_seq *seq;
143 basic_block bb;
144 } gimple_stmt_iterator;
147 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
148 are for 64 bit hosts. */
150 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
151 /* [ WORD 1 ]
152 Main identifying code for a tuple. */
153 ENUM_BITFIELD(gimple_code) code : 8;
155 /* Nonzero if a warning should not be emitted on this tuple. */
156 unsigned int no_warning : 1;
158 /* Nonzero if this tuple has been visited. Passes are responsible
159 for clearing this bit before using it. */
160 unsigned int visited : 1;
162 /* Nonzero if this tuple represents a non-temporal move. */
163 unsigned int nontemporal_move : 1;
165 /* Pass local flags. These flags are free for any pass to use as
166 they see fit. Passes should not assume that these flags contain
167 any useful value when the pass starts. Any initial state that
168 the pass requires should be set on entry to the pass. See
169 gimple_set_plf and gimple_plf for usage. */
170 unsigned int plf : 2;
172 /* Nonzero if this statement has been modified and needs to have its
173 operands rescanned. */
174 unsigned modified : 1;
176 /* Nonzero if this statement contains volatile operands. */
177 unsigned has_volatile_ops : 1;
179 /* The SUBCODE field can be used for tuple-specific flags for tuples
180 that do not require subcodes. Note that SUBCODE should be at
181 least as wide as tree codes, as several tuples store tree codes
182 in there. */
183 unsigned int subcode : 16;
185 /* UID of this statement. This is used by passes that want to
186 assign IDs to statements. It must be assigned and used by each
187 pass. By default it should be assumed to contain garbage. */
188 unsigned uid;
190 /* [ WORD 2 ]
191 Locus information for debug info. */
192 location_t location;
194 /* Number of operands in this tuple. */
195 unsigned num_ops;
197 /* [ WORD 3 ]
198 Basic block holding this statement. */
199 basic_block bb;
201 /* [ WORD 4-5 ]
202 Linked lists of gimple statements. The next pointers form
203 a NULL terminated list, the prev pointers are a cyclic list.
204 A gimple statement is hence also a double-ended list of
205 statements, with the pointer itself being the first element,
206 and the prev pointer being the last. */
207 gimple next;
208 gimple GTY((skip)) prev;
212 /* Base structure for tuples with operands. */
214 struct GTY(()) gimple_statement_with_ops_base
216 /* [ WORD 1-6 ] */
217 struct gimple_statement_base gsbase;
219 /* [ WORD 7 ]
220 SSA operand vectors. NOTE: It should be possible to
221 amalgamate these vectors with the operand vector OP. However,
222 the SSA operand vectors are organized differently and contain
223 more information (like immediate use chaining). */
224 struct use_optype_d GTY((skip (""))) *use_ops;
228 /* Statements that take register operands. */
230 struct GTY(()) gimple_statement_with_ops
232 /* [ WORD 1-7 ] */
233 struct gimple_statement_with_ops_base opbase;
235 /* [ WORD 8 ]
236 Operand vector. NOTE! This must always be the last field
237 of this structure. In particular, this means that this
238 structure cannot be embedded inside another one. */
239 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
243 /* Base for statements that take both memory and register operands. */
245 struct GTY(()) gimple_statement_with_memory_ops_base
247 /* [ WORD 1-7 ] */
248 struct gimple_statement_with_ops_base opbase;
250 /* [ WORD 8-9 ]
251 Virtual operands for this statement. The GC will pick them
252 up via the ssa_names array. */
253 tree GTY((skip (""))) vdef;
254 tree GTY((skip (""))) vuse;
258 /* Statements that take both memory and register operands. */
260 struct GTY(()) gimple_statement_with_memory_ops
262 /* [ WORD 1-9 ] */
263 struct gimple_statement_with_memory_ops_base membase;
265 /* [ WORD 10 ]
266 Operand vector. NOTE! This must always be the last field
267 of this structure. In particular, this means that this
268 structure cannot be embedded inside another one. */
269 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
273 /* Call statements that take both memory and register operands. */
275 struct GTY(()) gimple_statement_call
277 /* [ WORD 1-9 ] */
278 struct gimple_statement_with_memory_ops_base membase;
280 /* [ WORD 10-13 ] */
281 struct pt_solution call_used;
282 struct pt_solution call_clobbered;
284 /* [ WORD 14 ] */
285 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
286 tree GTY ((tag ("0"))) fntype;
287 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
288 } u;
290 /* [ WORD 15 ]
291 Operand vector. NOTE! This must always be the last field
292 of this structure. In particular, this means that this
293 structure cannot be embedded inside another one. */
294 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
298 /* OpenMP statements (#pragma omp). */
300 struct GTY(()) gimple_statement_omp {
301 /* [ WORD 1-6 ] */
302 struct gimple_statement_base gsbase;
304 /* [ WORD 7 ] */
305 gimple_seq body;
309 /* GIMPLE_BIND */
311 struct GTY(()) gimple_statement_bind {
312 /* [ WORD 1-6 ] */
313 struct gimple_statement_base gsbase;
315 /* [ WORD 7 ]
316 Variables declared in this scope. */
317 tree vars;
319 /* [ WORD 8 ]
320 This is different than the BLOCK field in gimple_statement_base,
321 which is analogous to TREE_BLOCK (i.e., the lexical block holding
322 this statement). This field is the equivalent of BIND_EXPR_BLOCK
323 in tree land (i.e., the lexical scope defined by this bind). See
324 gimple-low.c. */
325 tree block;
327 /* [ WORD 9 ] */
328 gimple_seq body;
332 /* GIMPLE_CATCH */
334 struct GTY(()) gimple_statement_catch {
335 /* [ WORD 1-6 ] */
336 struct gimple_statement_base gsbase;
338 /* [ WORD 7 ] */
339 tree types;
341 /* [ WORD 8 ] */
342 gimple_seq handler;
346 /* GIMPLE_EH_FILTER */
348 struct GTY(()) gimple_statement_eh_filter {
349 /* [ WORD 1-6 ] */
350 struct gimple_statement_base gsbase;
352 /* [ WORD 7 ]
353 Filter types. */
354 tree types;
356 /* [ WORD 8 ]
357 Failure actions. */
358 gimple_seq failure;
361 /* GIMPLE_EH_ELSE */
363 struct GTY(()) gimple_statement_eh_else {
364 /* [ WORD 1-6 ] */
365 struct gimple_statement_base gsbase;
367 /* [ WORD 7,8 ] */
368 gimple_seq n_body, e_body;
371 /* GIMPLE_EH_MUST_NOT_THROW */
373 struct GTY(()) gimple_statement_eh_mnt {
374 /* [ WORD 1-6 ] */
375 struct gimple_statement_base gsbase;
377 /* [ WORD 7 ] Abort function decl. */
378 tree fndecl;
381 /* GIMPLE_PHI */
383 struct GTY(()) gimple_statement_phi {
384 /* [ WORD 1-6 ] */
385 struct gimple_statement_base gsbase;
387 /* [ WORD 7 ] */
388 unsigned capacity;
389 unsigned nargs;
391 /* [ WORD 8 ] */
392 tree result;
394 /* [ WORD 9 ] */
395 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
399 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
401 struct GTY(()) gimple_statement_eh_ctrl
403 /* [ WORD 1-6 ] */
404 struct gimple_statement_base gsbase;
406 /* [ WORD 7 ]
407 Exception region number. */
408 int region;
412 /* GIMPLE_TRY */
414 struct GTY(()) gimple_statement_try {
415 /* [ WORD 1-6 ] */
416 struct gimple_statement_base gsbase;
418 /* [ WORD 7 ]
419 Expression to evaluate. */
420 gimple_seq eval;
422 /* [ WORD 8 ]
423 Cleanup expression. */
424 gimple_seq cleanup;
427 /* Kind of GIMPLE_TRY statements. */
428 enum gimple_try_flags
430 /* A try/catch. */
431 GIMPLE_TRY_CATCH = 1 << 0,
433 /* A try/finally. */
434 GIMPLE_TRY_FINALLY = 1 << 1,
435 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
437 /* Analogous to TRY_CATCH_IS_CLEANUP. */
438 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
441 /* GIMPLE_WITH_CLEANUP_EXPR */
443 struct GTY(()) gimple_statement_wce {
444 /* [ WORD 1-6 ] */
445 struct gimple_statement_base gsbase;
447 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
448 executed if an exception is thrown, not on normal exit of its
449 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
450 in TARGET_EXPRs. */
452 /* [ WORD 7 ]
453 Cleanup expression. */
454 gimple_seq cleanup;
458 /* GIMPLE_ASM */
460 struct GTY(()) gimple_statement_asm
462 /* [ WORD 1-9 ] */
463 struct gimple_statement_with_memory_ops_base membase;
465 /* [ WORD 10 ]
466 __asm__ statement. */
467 const char *string;
469 /* [ WORD 11 ]
470 Number of inputs, outputs, clobbers, labels. */
471 unsigned char ni;
472 unsigned char no;
473 unsigned char nc;
474 unsigned char nl;
476 /* [ WORD 12 ]
477 Operand vector. NOTE! This must always be the last field
478 of this structure. In particular, this means that this
479 structure cannot be embedded inside another one. */
480 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
483 /* GIMPLE_OMP_CRITICAL */
485 struct GTY(()) gimple_statement_omp_critical {
486 /* [ WORD 1-7 ] */
487 struct gimple_statement_omp omp;
489 /* [ WORD 8 ]
490 Critical section name. */
491 tree name;
495 struct GTY(()) gimple_omp_for_iter {
496 /* Condition code. */
497 enum tree_code cond;
499 /* Index variable. */
500 tree index;
502 /* Initial value. */
503 tree initial;
505 /* Final value. */
506 tree final;
508 /* Increment. */
509 tree incr;
512 /* GIMPLE_OMP_FOR */
514 struct GTY(()) gimple_statement_omp_for {
515 /* [ WORD 1-7 ] */
516 struct gimple_statement_omp omp;
518 /* [ WORD 8 ] */
519 tree clauses;
521 /* [ WORD 9 ]
522 Number of elements in iter array. */
523 size_t collapse;
525 /* [ WORD 10 ] */
526 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
528 /* [ WORD 11 ]
529 Pre-body evaluated before the loop body begins. */
530 gimple_seq pre_body;
534 /* GIMPLE_OMP_PARALLEL */
536 struct GTY(()) gimple_statement_omp_parallel {
537 /* [ WORD 1-7 ] */
538 struct gimple_statement_omp omp;
540 /* [ WORD 8 ]
541 Clauses. */
542 tree clauses;
544 /* [ WORD 9 ]
545 Child function holding the body of the parallel region. */
546 tree child_fn;
548 /* [ WORD 10 ]
549 Shared data argument. */
550 tree data_arg;
554 /* GIMPLE_OMP_TASK */
556 struct GTY(()) gimple_statement_omp_task {
557 /* [ WORD 1-10 ] */
558 struct gimple_statement_omp_parallel par;
560 /* [ WORD 11 ]
561 Child function holding firstprivate initialization if needed. */
562 tree copy_fn;
564 /* [ WORD 12-13 ]
565 Size and alignment in bytes of the argument data block. */
566 tree arg_size;
567 tree arg_align;
571 /* GIMPLE_OMP_SECTION */
572 /* Uses struct gimple_statement_omp. */
575 /* GIMPLE_OMP_SECTIONS */
577 struct GTY(()) gimple_statement_omp_sections {
578 /* [ WORD 1-7 ] */
579 struct gimple_statement_omp omp;
581 /* [ WORD 8 ] */
582 tree clauses;
584 /* [ WORD 9 ]
585 The control variable used for deciding which of the sections to
586 execute. */
587 tree control;
590 /* GIMPLE_OMP_CONTINUE.
592 Note: This does not inherit from gimple_statement_omp, because we
593 do not need the body field. */
595 struct GTY(()) gimple_statement_omp_continue {
596 /* [ WORD 1-6 ] */
597 struct gimple_statement_base gsbase;
599 /* [ WORD 7 ] */
600 tree control_def;
602 /* [ WORD 8 ] */
603 tree control_use;
606 /* GIMPLE_OMP_SINGLE */
608 struct GTY(()) gimple_statement_omp_single {
609 /* [ WORD 1-7 ] */
610 struct gimple_statement_omp omp;
612 /* [ WORD 7 ] */
613 tree clauses;
617 /* GIMPLE_OMP_ATOMIC_LOAD.
618 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
619 contains a sequence, which we don't need here. */
621 struct GTY(()) gimple_statement_omp_atomic_load {
622 /* [ WORD 1-6 ] */
623 struct gimple_statement_base gsbase;
625 /* [ WORD 7-8 ] */
626 tree rhs, lhs;
629 /* GIMPLE_OMP_ATOMIC_STORE.
630 See note on GIMPLE_OMP_ATOMIC_LOAD. */
632 struct GTY(()) gimple_statement_omp_atomic_store {
633 /* [ WORD 1-6 ] */
634 struct gimple_statement_base gsbase;
636 /* [ WORD 7 ] */
637 tree val;
640 /* GIMPLE_TRANSACTION. */
642 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
644 /* The __transaction_atomic was declared [[outer]] or it is
645 __transaction_relaxed. */
646 #define GTMA_IS_OUTER (1u << 0)
647 #define GTMA_IS_RELAXED (1u << 1)
648 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
650 /* The transaction is seen to not have an abort. */
651 #define GTMA_HAVE_ABORT (1u << 2)
652 /* The transaction is seen to have loads or stores. */
653 #define GTMA_HAVE_LOAD (1u << 3)
654 #define GTMA_HAVE_STORE (1u << 4)
655 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
656 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
657 /* The transaction WILL enter serial irrevocable mode.
658 An irrevocable block post-dominates the entire transaction, such
659 that all invocations of the transaction will go serial-irrevocable.
660 In such case, we don't bother instrumenting the transaction, and
661 tell the runtime that it should begin the transaction in
662 serial-irrevocable mode. */
663 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
665 struct GTY(()) gimple_statement_transaction
667 /* [ WORD 1-9 ] */
668 struct gimple_statement_with_memory_ops_base gsbase;
670 /* [ WORD 10 ] */
671 gimple_seq body;
673 /* [ WORD 11 ] */
674 tree label;
677 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
678 enum gimple_statement_structure_enum {
679 #include "gsstruct.def"
680 LAST_GSS_ENUM
682 #undef DEFGSSTRUCT
685 /* Define the overall contents of a gimple tuple. It may be any of the
686 structures declared above for various types of tuples. */
688 union GTY ((desc ("gimple_statement_structure (&%h)"),
689 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
690 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
691 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
692 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
693 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
694 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
695 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
696 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
697 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
698 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
699 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
700 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
701 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
702 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
703 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
704 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
705 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
706 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
707 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
708 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
709 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
710 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
711 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
712 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
713 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
714 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
715 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
718 /* In gimple.c. */
720 /* Offset in bytes to the location of the operand vector.
721 Zero if there is no operand vector for this tuple structure. */
722 extern size_t const gimple_ops_offset_[];
724 /* Map GIMPLE codes to GSS codes. */
725 extern enum gimple_statement_structure_enum const gss_for_code_[];
727 /* This variable holds the currently expanded gimple statement for purposes
728 of comminucating the profile info to the builtin expanders. */
729 extern gimple currently_expanding_gimple_stmt;
731 gimple gimple_build_return (tree);
733 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
734 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
736 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
738 gimple
739 gimple_build_assign_with_ops (enum tree_code, tree,
740 tree, tree CXX_MEM_STAT_INFO);
741 gimple
742 gimple_build_assign_with_ops (enum tree_code, tree,
743 tree, tree, tree CXX_MEM_STAT_INFO);
745 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
746 #define gimple_build_debug_bind(var,val,stmt) \
747 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
748 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
749 #define gimple_build_debug_source_bind(var,val,stmt) \
750 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
752 gimple gimple_build_call_vec (tree, vec<tree> );
753 gimple gimple_build_call (tree, unsigned, ...);
754 gimple gimple_build_call_valist (tree, unsigned, va_list);
755 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
756 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
757 gimple gimple_build_call_from_tree (tree);
758 gimple gimplify_assign (tree, tree, gimple_seq *);
759 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
760 gimple gimple_build_label (tree label);
761 gimple gimple_build_goto (tree dest);
762 gimple gimple_build_nop (void);
763 gimple gimple_build_bind (tree, gimple_seq, tree);
764 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
765 vec<tree, va_gc> *, vec<tree, va_gc> *,
766 vec<tree, va_gc> *);
767 gimple gimple_build_catch (tree, gimple_seq);
768 gimple gimple_build_eh_filter (tree, gimple_seq);
769 gimple gimple_build_eh_must_not_throw (tree);
770 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
771 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
772 gimple gimple_build_wce (gimple_seq);
773 gimple gimple_build_resx (int);
774 gimple gimple_build_eh_dispatch (int);
775 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
776 gimple gimple_build_switch (tree, tree, vec<tree> );
777 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
778 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
779 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
780 gimple gimple_build_omp_critical (gimple_seq, tree);
781 gimple gimple_build_omp_section (gimple_seq);
782 gimple gimple_build_omp_continue (tree, tree);
783 gimple gimple_build_omp_master (gimple_seq);
784 gimple gimple_build_omp_return (bool);
785 gimple gimple_build_omp_ordered (gimple_seq);
786 gimple gimple_build_omp_sections (gimple_seq, tree);
787 gimple gimple_build_omp_sections_switch (void);
788 gimple gimple_build_omp_single (gimple_seq, tree);
789 gimple gimple_build_cdt (tree, tree);
790 gimple gimple_build_omp_atomic_load (tree, tree);
791 gimple gimple_build_omp_atomic_store (tree);
792 gimple gimple_build_transaction (gimple_seq, tree);
793 gimple gimple_build_predict (enum br_predictor, enum prediction);
794 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
795 void sort_case_labels (vec<tree> );
796 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
797 void gimple_set_body (tree, gimple_seq);
798 gimple_seq gimple_body (tree);
799 bool gimple_has_body_p (tree);
800 gimple_seq gimple_seq_alloc (void);
801 void gimple_seq_free (gimple_seq);
802 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
803 gimple_seq gimple_seq_copy (gimple_seq);
804 bool gimple_call_same_target_p (const_gimple, const_gimple);
805 int gimple_call_flags (const_gimple);
806 int gimple_call_return_flags (const_gimple);
807 int gimple_call_arg_flags (const_gimple, unsigned);
808 void gimple_call_reset_alias_info (gimple);
809 bool gimple_assign_copy_p (gimple);
810 bool gimple_assign_ssa_name_copy_p (gimple);
811 bool gimple_assign_unary_nop_p (gimple);
812 void gimple_set_bb (gimple, basic_block);
813 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
814 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
815 tree, tree, tree);
816 tree gimple_get_lhs (const_gimple);
817 void gimple_set_lhs (gimple, tree);
818 void gimple_replace_lhs (gimple, tree);
819 gimple gimple_copy (gimple);
820 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
821 gimple gimple_build_cond_from_tree (tree, tree, tree);
822 void gimple_cond_set_condition_from_tree (gimple, tree);
823 bool gimple_has_side_effects (const_gimple);
824 bool gimple_could_trap_p (gimple);
825 bool gimple_could_trap_p_1 (gimple, bool, bool);
826 bool gimple_assign_rhs_could_trap_p (gimple);
827 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
828 bool empty_body_p (gimple_seq);
829 unsigned get_gimple_rhs_num_ops (enum tree_code);
830 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
831 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
832 const char *gimple_decl_printable_name (tree, int);
833 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
834 tree gimple_extract_devirt_binfo_from_cst (tree);
836 /* Returns true iff T is a scalar register variable. */
837 extern bool is_gimple_reg (tree);
838 /* Returns true iff T is any sort of variable. */
839 extern bool is_gimple_variable (tree);
840 /* Returns true iff T is any sort of symbol. */
841 extern bool is_gimple_id (tree);
842 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
843 extern bool is_gimple_min_lval (tree);
844 /* Returns true iff T is something whose address can be taken. */
845 extern bool is_gimple_addressable (tree);
846 /* Returns true iff T is any valid GIMPLE lvalue. */
847 extern bool is_gimple_lvalue (tree);
849 /* Returns true iff T is a GIMPLE address. */
850 bool is_gimple_address (const_tree);
851 /* Returns true iff T is a GIMPLE invariant address. */
852 bool is_gimple_invariant_address (const_tree);
853 /* Returns true iff T is a GIMPLE invariant address at interprocedural
854 level. */
855 bool is_gimple_ip_invariant_address (const_tree);
856 /* Returns true iff T is a valid GIMPLE constant. */
857 bool is_gimple_constant (const_tree);
858 /* Returns true iff T is a GIMPLE restricted function invariant. */
859 extern bool is_gimple_min_invariant (const_tree);
860 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
861 extern bool is_gimple_ip_invariant (const_tree);
862 /* Returns true iff T is a GIMPLE rvalue. */
863 extern bool is_gimple_val (tree);
864 /* Returns true iff T is a GIMPLE asm statement input. */
865 extern bool is_gimple_asm_val (tree);
866 /* Returns true iff T is a valid address operand of a MEM_REF. */
867 bool is_gimple_mem_ref_addr (tree);
869 /* Returns true iff T is a valid if-statement condition. */
870 extern bool is_gimple_condexpr (tree);
872 /* Returns true iff T is a valid call address expression. */
873 extern bool is_gimple_call_addr (tree);
875 /* Return TRUE iff stmt is a call to a built-in function. */
876 extern bool is_gimple_builtin_call (gimple stmt);
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_class);
897 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
898 extern bool gimple_asm_clobbers_memory_p (const_gimple);
900 /* In gimplify.c */
901 extern tree create_tmp_var_raw (tree, const char *);
902 extern tree create_tmp_var_name (const char *);
903 extern tree create_tmp_var (tree, const char *);
904 extern tree create_tmp_reg (tree, const char *);
905 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
906 extern tree get_formal_tmp_var (tree, gimple_seq *);
907 extern void declare_vars (tree, gimple, bool);
908 extern void annotate_all_with_location (gimple_seq, location_t);
910 /* Validation of GIMPLE expressions. Note that these predicates only check
911 the basic form of the expression, they don't recurse to make sure that
912 underlying nodes are also of the right form. */
913 typedef bool (*gimple_predicate)(tree);
916 /* FIXME we should deduce this from the predicate. */
917 enum fallback {
918 fb_none = 0, /* Do not generate a temporary. */
920 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
921 gimplified expression. */
923 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
924 gimplified expression. */
926 fb_mayfail = 4, /* Gimplification may fail. Error issued
927 afterwards. */
928 fb_either= fb_rvalue | fb_lvalue
931 typedef int fallback_t;
933 enum gimplify_status {
934 GS_ERROR = -2, /* Something Bad Seen. */
935 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
936 GS_OK = 0, /* We did something, maybe more to do. */
937 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
940 struct gimplify_ctx
942 struct gimplify_ctx *prev_context;
944 vec<gimple> bind_expr_stack;
945 tree temps;
946 gimple_seq conditional_cleanups;
947 tree exit_label;
948 tree return_temp;
950 vec<tree> case_labels;
951 /* The formal temporary table. Should this be persistent? */
952 htab_t temp_htab;
954 int conditions;
955 bool save_stack;
956 bool into_ssa;
957 bool allow_rhs_cond_expr;
958 bool in_cleanup_point_expr;
961 /* Return true if gimplify_one_sizepos doesn't need to gimplify
962 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
963 fields). */
964 static inline bool
965 is_gimple_sizepos (tree expr)
967 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
968 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
969 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
970 function, the gimplifier will want to replace it with a new variable,
971 but that will cause problems if this type is from outside the function.
972 It's OK to have that here. */
973 return (expr == NULL_TREE
974 || TREE_CONSTANT (expr)
975 || TREE_CODE (expr) == VAR_DECL
976 || CONTAINS_PLACEHOLDER_P (expr));
979 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
980 bool (*) (tree), fallback_t);
981 extern void gimplify_type_sizes (tree, gimple_seq *);
982 extern void gimplify_one_sizepos (tree *, gimple_seq *);
983 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
984 bool, tree);
985 extern bool gimplify_stmt (tree *, gimple_seq *);
986 extern gimple gimplify_body (tree, bool);
987 extern void push_gimplify_context (struct gimplify_ctx *);
988 extern void pop_gimplify_context (gimple);
989 extern void gimplify_and_add (tree, gimple_seq *);
991 /* Miscellaneous helpers. */
992 extern void gimple_add_tmp_var (tree);
993 extern bool flag_instrument_functions_exclude_p (tree);
994 extern gimple gimple_current_bind_expr (void);
995 extern vec<gimple> gimple_bind_expr_stack (void);
996 extern tree voidify_wrapper_expr (tree, tree);
997 extern tree build_and_jump (tree *);
998 extern tree force_labels_r (tree *, int *, void *);
999 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1000 gimple_seq *);
1001 struct gimplify_omp_ctx;
1002 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1003 extern tree gimple_boolify (tree);
1004 extern gimple_predicate rhs_predicate_for (tree);
1005 extern tree canonicalize_cond_expr_cond (tree);
1007 /* In omp-low.c. */
1008 extern tree omp_reduction_init (tree, tree);
1010 /* In trans-mem.c. */
1011 extern void diagnose_tm_safe_errors (tree);
1012 extern void compute_transaction_bits (void);
1014 /* In tree-nested.c. */
1015 extern void lower_nested_functions (tree);
1016 extern void insert_field_into_struct (tree, tree);
1018 /* In gimplify.c. */
1019 extern void gimplify_function_tree (tree);
1021 /* In cfgexpand.c. */
1022 extern tree gimple_assign_rhs_to_tree (gimple);
1024 /* In builtins.c */
1025 extern bool validate_gimple_arglist (const_gimple, ...);
1027 /* In tree-ssa.c */
1028 extern bool tree_ssa_useless_type_conversion (tree);
1029 extern tree tree_ssa_strip_useless_type_conversions (tree);
1030 extern bool useless_type_conversion_p (tree, tree);
1031 extern bool types_compatible_p (tree, tree);
1033 /* Return the first node in GIMPLE sequence S. */
1035 static inline gimple_seq_node
1036 gimple_seq_first (gimple_seq s)
1038 return s;
1042 /* Return the first statement in GIMPLE sequence S. */
1044 static inline gimple
1045 gimple_seq_first_stmt (gimple_seq s)
1047 gimple_seq_node n = gimple_seq_first (s);
1048 return n;
1052 /* Return the last node in GIMPLE sequence S. */
1054 static inline gimple_seq_node
1055 gimple_seq_last (gimple_seq s)
1057 return s ? s->gsbase.prev : NULL;
1061 /* Return the last statement in GIMPLE sequence S. */
1063 static inline gimple
1064 gimple_seq_last_stmt (gimple_seq s)
1066 gimple_seq_node n = gimple_seq_last (s);
1067 return n;
1071 /* Set the last node in GIMPLE sequence *PS to LAST. */
1073 static inline void
1074 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1076 (*ps)->gsbase.prev = last;
1080 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1082 static inline void
1083 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1085 *ps = first;
1089 /* Return true if GIMPLE sequence S is empty. */
1091 static inline bool
1092 gimple_seq_empty_p (gimple_seq s)
1094 return s == NULL;
1098 void gimple_seq_add_stmt (gimple_seq *, gimple);
1100 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1101 *SEQ_P is NULL, a new sequence is allocated. This function is
1102 similar to gimple_seq_add_stmt, but does not scan the operands.
1103 During gimplification, we need to manipulate statement sequences
1104 before the def/use vectors have been constructed. */
1105 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1107 /* Allocate a new sequence and initialize its first element with STMT. */
1109 static inline gimple_seq
1110 gimple_seq_alloc_with_stmt (gimple stmt)
1112 gimple_seq seq = NULL;
1113 gimple_seq_add_stmt (&seq, stmt);
1114 return seq;
1118 /* Returns the sequence of statements in BB. */
1120 static inline gimple_seq
1121 bb_seq (const_basic_block bb)
1123 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1126 static inline gimple_seq *
1127 bb_seq_addr (basic_block bb)
1129 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1132 /* Sets the sequence of statements in BB to SEQ. */
1134 static inline void
1135 set_bb_seq (basic_block bb, gimple_seq seq)
1137 gcc_checking_assert (!(bb->flags & BB_RTL));
1138 bb->il.gimple.seq = seq;
1142 /* Return the code for GIMPLE statement G. */
1144 static inline enum gimple_code
1145 gimple_code (const_gimple g)
1147 return g->gsbase.code;
1151 /* Return the GSS code used by a GIMPLE code. */
1153 static inline enum gimple_statement_structure_enum
1154 gss_for_code (enum gimple_code code)
1156 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1157 return gss_for_code_[code];
1161 /* Return which GSS code is used by GS. */
1163 static inline enum gimple_statement_structure_enum
1164 gimple_statement_structure (gimple gs)
1166 return gss_for_code (gimple_code (gs));
1170 /* Return true if statement G has sub-statements. This is only true for
1171 High GIMPLE statements. */
1173 static inline bool
1174 gimple_has_substatements (gimple g)
1176 switch (gimple_code (g))
1178 case GIMPLE_BIND:
1179 case GIMPLE_CATCH:
1180 case GIMPLE_EH_FILTER:
1181 case GIMPLE_EH_ELSE:
1182 case GIMPLE_TRY:
1183 case GIMPLE_OMP_FOR:
1184 case GIMPLE_OMP_MASTER:
1185 case GIMPLE_OMP_ORDERED:
1186 case GIMPLE_OMP_SECTION:
1187 case GIMPLE_OMP_PARALLEL:
1188 case GIMPLE_OMP_TASK:
1189 case GIMPLE_OMP_SECTIONS:
1190 case GIMPLE_OMP_SINGLE:
1191 case GIMPLE_OMP_CRITICAL:
1192 case GIMPLE_WITH_CLEANUP_EXPR:
1193 case GIMPLE_TRANSACTION:
1194 return true;
1196 default:
1197 return false;
1202 /* Return the basic block holding statement G. */
1204 static inline basic_block
1205 gimple_bb (const_gimple g)
1207 return g->gsbase.bb;
1211 /* Return the lexical scope block holding statement G. */
1213 static inline tree
1214 gimple_block (const_gimple g)
1216 return LOCATION_BLOCK (g->gsbase.location);
1220 /* Set BLOCK to be the lexical scope block holding statement G. */
1222 static inline void
1223 gimple_set_block (gimple g, tree block)
1225 if (block)
1226 g->gsbase.location =
1227 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1228 else
1229 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1233 /* Return location information for statement G. */
1235 static inline location_t
1236 gimple_location (const_gimple g)
1238 return g->gsbase.location;
1241 /* Return pointer to location information for statement G. */
1243 static inline const location_t *
1244 gimple_location_ptr (const_gimple g)
1246 return &g->gsbase.location;
1250 /* Set location information for statement G. */
1252 static inline void
1253 gimple_set_location (gimple g, location_t location)
1255 g->gsbase.location = location;
1259 /* Return true if G contains location information. */
1261 static inline bool
1262 gimple_has_location (const_gimple g)
1264 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1268 /* Return the file name of the location of STMT. */
1270 static inline const char *
1271 gimple_filename (const_gimple stmt)
1273 return LOCATION_FILE (gimple_location (stmt));
1277 /* Return the line number of the location of STMT. */
1279 static inline int
1280 gimple_lineno (const_gimple stmt)
1282 return LOCATION_LINE (gimple_location (stmt));
1286 /* Determine whether SEQ is a singleton. */
1288 static inline bool
1289 gimple_seq_singleton_p (gimple_seq seq)
1291 return ((gimple_seq_first (seq) != NULL)
1292 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1295 /* Return true if no warnings should be emitted for statement STMT. */
1297 static inline bool
1298 gimple_no_warning_p (const_gimple stmt)
1300 return stmt->gsbase.no_warning;
1303 /* Set the no_warning flag of STMT to NO_WARNING. */
1305 static inline void
1306 gimple_set_no_warning (gimple stmt, bool no_warning)
1308 stmt->gsbase.no_warning = (unsigned) no_warning;
1311 /* Set the visited status on statement STMT to VISITED_P. */
1313 static inline void
1314 gimple_set_visited (gimple stmt, bool visited_p)
1316 stmt->gsbase.visited = (unsigned) visited_p;
1320 /* Return the visited status for statement STMT. */
1322 static inline bool
1323 gimple_visited_p (gimple stmt)
1325 return stmt->gsbase.visited;
1329 /* Set pass local flag PLF on statement STMT to VAL_P. */
1331 static inline void
1332 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1334 if (val_p)
1335 stmt->gsbase.plf |= (unsigned int) plf;
1336 else
1337 stmt->gsbase.plf &= ~((unsigned int) plf);
1341 /* Return the value of pass local flag PLF on statement STMT. */
1343 static inline unsigned int
1344 gimple_plf (gimple stmt, enum plf_mask plf)
1346 return stmt->gsbase.plf & ((unsigned int) plf);
1350 /* Set the UID of statement. */
1352 static inline void
1353 gimple_set_uid (gimple g, unsigned uid)
1355 g->gsbase.uid = uid;
1359 /* Return the UID of statement. */
1361 static inline unsigned
1362 gimple_uid (const_gimple g)
1364 return g->gsbase.uid;
1368 /* Make statement G a singleton sequence. */
1370 static inline void
1371 gimple_init_singleton (gimple g)
1373 g->gsbase.next = NULL;
1374 g->gsbase.prev = g;
1378 /* Return true if GIMPLE statement G has register or memory operands. */
1380 static inline bool
1381 gimple_has_ops (const_gimple g)
1383 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1387 /* Return true if GIMPLE statement G has memory operands. */
1389 static inline bool
1390 gimple_has_mem_ops (const_gimple g)
1392 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1396 /* Return the set of USE operands for statement G. */
1398 static inline struct use_optype_d *
1399 gimple_use_ops (const_gimple g)
1401 if (!gimple_has_ops (g))
1402 return NULL;
1403 return g->gsops.opbase.use_ops;
1407 /* Set USE to be the set of USE operands for statement G. */
1409 static inline void
1410 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1412 gcc_gimple_checking_assert (gimple_has_ops (g));
1413 g->gsops.opbase.use_ops = use;
1417 /* Return the set of VUSE operand for statement G. */
1419 static inline use_operand_p
1420 gimple_vuse_op (const_gimple g)
1422 struct use_optype_d *ops;
1423 if (!gimple_has_mem_ops (g))
1424 return NULL_USE_OPERAND_P;
1425 ops = g->gsops.opbase.use_ops;
1426 if (ops
1427 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1428 return USE_OP_PTR (ops);
1429 return NULL_USE_OPERAND_P;
1432 /* Return the set of VDEF operand for statement G. */
1434 static inline def_operand_p
1435 gimple_vdef_op (gimple g)
1437 if (!gimple_has_mem_ops (g))
1438 return NULL_DEF_OPERAND_P;
1439 if (g->gsmembase.vdef)
1440 return &g->gsmembase.vdef;
1441 return NULL_DEF_OPERAND_P;
1445 /* Return the single VUSE operand of the statement G. */
1447 static inline tree
1448 gimple_vuse (const_gimple g)
1450 if (!gimple_has_mem_ops (g))
1451 return NULL_TREE;
1452 return g->gsmembase.vuse;
1455 /* Return the single VDEF operand of the statement G. */
1457 static inline tree
1458 gimple_vdef (const_gimple g)
1460 if (!gimple_has_mem_ops (g))
1461 return NULL_TREE;
1462 return g->gsmembase.vdef;
1465 /* Return the single VUSE operand of the statement G. */
1467 static inline tree *
1468 gimple_vuse_ptr (gimple g)
1470 if (!gimple_has_mem_ops (g))
1471 return NULL;
1472 return &g->gsmembase.vuse;
1475 /* Return the single VDEF operand of the statement G. */
1477 static inline tree *
1478 gimple_vdef_ptr (gimple g)
1480 if (!gimple_has_mem_ops (g))
1481 return NULL;
1482 return &g->gsmembase.vdef;
1485 /* Set the single VUSE operand of the statement G. */
1487 static inline void
1488 gimple_set_vuse (gimple g, tree vuse)
1490 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1491 g->gsmembase.vuse = vuse;
1494 /* Set the single VDEF operand of the statement G. */
1496 static inline void
1497 gimple_set_vdef (gimple g, tree vdef)
1499 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1500 g->gsmembase.vdef = vdef;
1504 /* Return true if statement G has operands and the modified field has
1505 been set. */
1507 static inline bool
1508 gimple_modified_p (const_gimple g)
1510 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1514 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1515 a MODIFIED field. */
1517 static inline void
1518 gimple_set_modified (gimple s, bool modifiedp)
1520 if (gimple_has_ops (s))
1521 s->gsbase.modified = (unsigned) modifiedp;
1525 /* Return the tree code for the expression computed by STMT. This is
1526 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1527 GIMPLE_CALL, return CALL_EXPR as the expression code for
1528 consistency. This is useful when the caller needs to deal with the
1529 three kinds of computation that GIMPLE supports. */
1531 static inline enum tree_code
1532 gimple_expr_code (const_gimple stmt)
1534 enum gimple_code code = gimple_code (stmt);
1535 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1536 return (enum tree_code) stmt->gsbase.subcode;
1537 else
1539 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1540 return CALL_EXPR;
1545 /* Mark statement S as modified, and update it. */
1547 static inline void
1548 update_stmt (gimple s)
1550 if (gimple_has_ops (s))
1552 gimple_set_modified (s, true);
1553 update_stmt_operands (s);
1557 /* Update statement S if it has been optimized. */
1559 static inline void
1560 update_stmt_if_modified (gimple s)
1562 if (gimple_modified_p (s))
1563 update_stmt_operands (s);
1566 /* Return true if statement STMT contains volatile operands. */
1568 static inline bool
1569 gimple_has_volatile_ops (const_gimple stmt)
1571 if (gimple_has_mem_ops (stmt))
1572 return stmt->gsbase.has_volatile_ops;
1573 else
1574 return false;
1578 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1580 static inline void
1581 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1583 if (gimple_has_mem_ops (stmt))
1584 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1587 /* Return true if BB is in a transaction. */
1589 static inline bool
1590 block_in_transaction (basic_block bb)
1592 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1595 /* Return true if STMT is in a transaction. */
1597 static inline bool
1598 gimple_in_transaction (gimple stmt)
1600 return block_in_transaction (gimple_bb (stmt));
1603 /* Return true if statement STMT may access memory. */
1605 static inline bool
1606 gimple_references_memory_p (gimple stmt)
1608 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1612 /* Return the subcode for OMP statement S. */
1614 static inline unsigned
1615 gimple_omp_subcode (const_gimple s)
1617 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1618 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1619 return s->gsbase.subcode;
1622 /* Set the subcode for OMP statement S to SUBCODE. */
1624 static inline void
1625 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1627 /* We only have 16 bits for the subcode. Assert that we are not
1628 overflowing it. */
1629 gcc_gimple_checking_assert (subcode < (1 << 16));
1630 s->gsbase.subcode = subcode;
1633 /* Set the nowait flag on OMP_RETURN statement S. */
1635 static inline void
1636 gimple_omp_return_set_nowait (gimple s)
1638 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1639 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1643 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1644 flag set. */
1646 static inline bool
1647 gimple_omp_return_nowait_p (const_gimple g)
1649 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1650 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1654 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1655 flag set. */
1657 static inline bool
1658 gimple_omp_section_last_p (const_gimple g)
1660 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1661 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1665 /* Set the GF_OMP_SECTION_LAST flag on G. */
1667 static inline void
1668 gimple_omp_section_set_last (gimple g)
1670 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1671 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1675 /* Return true if OMP parallel statement G has the
1676 GF_OMP_PARALLEL_COMBINED flag set. */
1678 static inline bool
1679 gimple_omp_parallel_combined_p (const_gimple g)
1681 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1682 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1686 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1687 value of COMBINED_P. */
1689 static inline void
1690 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1692 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1693 if (combined_p)
1694 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1695 else
1696 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1700 /* Return true if OMP atomic load/store statement G has the
1701 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1703 static inline bool
1704 gimple_omp_atomic_need_value_p (const_gimple g)
1706 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1707 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1708 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1712 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1714 static inline void
1715 gimple_omp_atomic_set_need_value (gimple g)
1717 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1718 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1719 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1723 /* Return the number of operands for statement GS. */
1725 static inline unsigned
1726 gimple_num_ops (const_gimple gs)
1728 return gs->gsbase.num_ops;
1732 /* Set the number of operands for statement GS. */
1734 static inline void
1735 gimple_set_num_ops (gimple gs, unsigned num_ops)
1737 gs->gsbase.num_ops = num_ops;
1741 /* Return the array of operands for statement GS. */
1743 static inline tree *
1744 gimple_ops (gimple gs)
1746 size_t off;
1748 /* All the tuples have their operand vector at the very bottom
1749 of the structure. Note that those structures that do not
1750 have an operand vector have a zero offset. */
1751 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1752 gcc_gimple_checking_assert (off != 0);
1754 return (tree *) ((char *) gs + off);
1758 /* Return operand I for statement GS. */
1760 static inline tree
1761 gimple_op (const_gimple gs, unsigned i)
1763 if (gimple_has_ops (gs))
1765 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1766 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1768 else
1769 return NULL_TREE;
1772 /* Return a pointer to operand I for statement GS. */
1774 static inline tree *
1775 gimple_op_ptr (const_gimple gs, unsigned i)
1777 if (gimple_has_ops (gs))
1779 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1780 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1782 else
1783 return NULL;
1786 /* Set operand I of statement GS to OP. */
1788 static inline void
1789 gimple_set_op (gimple gs, unsigned i, tree op)
1791 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1793 /* Note. It may be tempting to assert that OP matches
1794 is_gimple_operand, but that would be wrong. Different tuples
1795 accept slightly different sets of tree operands. Each caller
1796 should perform its own validation. */
1797 gimple_ops (gs)[i] = op;
1800 /* Return true if GS is a GIMPLE_ASSIGN. */
1802 static inline bool
1803 is_gimple_assign (const_gimple gs)
1805 return gimple_code (gs) == GIMPLE_ASSIGN;
1808 /* Determine if expression CODE is one of the valid expressions that can
1809 be used on the RHS of GIMPLE assignments. */
1811 static inline enum gimple_rhs_class
1812 get_gimple_rhs_class (enum tree_code code)
1814 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1817 /* Return the LHS of assignment statement GS. */
1819 static inline tree
1820 gimple_assign_lhs (const_gimple gs)
1822 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1823 return gimple_op (gs, 0);
1827 /* Return a pointer to the LHS of assignment statement GS. */
1829 static inline tree *
1830 gimple_assign_lhs_ptr (const_gimple gs)
1832 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1833 return gimple_op_ptr (gs, 0);
1837 /* Set LHS to be the LHS operand of assignment statement GS. */
1839 static inline void
1840 gimple_assign_set_lhs (gimple gs, tree lhs)
1842 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1843 gimple_set_op (gs, 0, lhs);
1845 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1846 SSA_NAME_DEF_STMT (lhs) = gs;
1850 /* Return the first operand on the RHS of assignment statement GS. */
1852 static inline tree
1853 gimple_assign_rhs1 (const_gimple gs)
1855 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1856 return gimple_op (gs, 1);
1860 /* Return a pointer to the first operand on the RHS of assignment
1861 statement GS. */
1863 static inline tree *
1864 gimple_assign_rhs1_ptr (const_gimple gs)
1866 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1867 return gimple_op_ptr (gs, 1);
1870 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1872 static inline void
1873 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1875 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1877 gimple_set_op (gs, 1, rhs);
1881 /* Return the second operand on the RHS of assignment statement GS.
1882 If GS does not have two operands, NULL is returned instead. */
1884 static inline tree
1885 gimple_assign_rhs2 (const_gimple gs)
1887 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1889 if (gimple_num_ops (gs) >= 3)
1890 return gimple_op (gs, 2);
1891 else
1892 return NULL_TREE;
1896 /* Return a pointer to the second operand on the RHS of assignment
1897 statement GS. */
1899 static inline tree *
1900 gimple_assign_rhs2_ptr (const_gimple gs)
1902 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1903 return gimple_op_ptr (gs, 2);
1907 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1909 static inline void
1910 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1912 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1914 gimple_set_op (gs, 2, rhs);
1917 /* Return the third operand on the RHS of assignment statement GS.
1918 If GS does not have two operands, NULL is returned instead. */
1920 static inline tree
1921 gimple_assign_rhs3 (const_gimple gs)
1923 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1925 if (gimple_num_ops (gs) >= 4)
1926 return gimple_op (gs, 3);
1927 else
1928 return NULL_TREE;
1931 /* Return a pointer to the third operand on the RHS of assignment
1932 statement GS. */
1934 static inline tree *
1935 gimple_assign_rhs3_ptr (const_gimple gs)
1937 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1938 return gimple_op_ptr (gs, 3);
1942 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1944 static inline void
1945 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1947 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1949 gimple_set_op (gs, 3, rhs);
1952 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1953 to see only a maximum of two operands. */
1955 static inline void
1956 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1957 tree op1, tree op2)
1959 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1962 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1963 to see only a maximum of two operands. */
1965 static inline void
1966 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1967 tree *op1)
1969 tree op2;
1970 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1971 gcc_assert (op2 == NULL_TREE);
1974 /* Returns true if GS is a nontemporal move. */
1976 static inline bool
1977 gimple_assign_nontemporal_move_p (const_gimple gs)
1979 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1980 return gs->gsbase.nontemporal_move;
1983 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1985 static inline void
1986 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1988 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1989 gs->gsbase.nontemporal_move = nontemporal;
1993 /* Return the code of the expression computed on the rhs of assignment
1994 statement GS. In case that the RHS is a single object, returns the
1995 tree code of the object. */
1997 static inline enum tree_code
1998 gimple_assign_rhs_code (const_gimple gs)
2000 enum tree_code code;
2001 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2003 code = (enum tree_code) gs->gsbase.subcode;
2004 /* While we initially set subcode to the TREE_CODE of the rhs for
2005 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2006 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2007 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2008 code = TREE_CODE (gimple_assign_rhs1 (gs));
2010 return code;
2014 /* Set CODE to be the code for the expression computed on the RHS of
2015 assignment S. */
2017 static inline void
2018 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2020 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2021 s->gsbase.subcode = code;
2025 /* Return the gimple rhs class of the code of the expression computed on
2026 the rhs of assignment statement GS.
2027 This will never return GIMPLE_INVALID_RHS. */
2029 static inline enum gimple_rhs_class
2030 gimple_assign_rhs_class (const_gimple gs)
2032 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2035 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2036 there is no operator associated with the assignment itself.
2037 Unlike gimple_assign_copy_p, this predicate returns true for
2038 any RHS operand, including those that perform an operation
2039 and do not have the semantics of a copy, such as COND_EXPR. */
2041 static inline bool
2042 gimple_assign_single_p (gimple gs)
2044 return (is_gimple_assign (gs)
2045 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2048 /* Return true if GS performs a store to its lhs. */
2050 static inline bool
2051 gimple_store_p (gimple gs)
2053 tree lhs = gimple_get_lhs (gs);
2054 return lhs && !is_gimple_reg (lhs);
2057 /* Return true if GS is an assignment that loads from its rhs1. */
2059 static inline bool
2060 gimple_assign_load_p (gimple gs)
2062 tree rhs;
2063 if (!gimple_assign_single_p (gs))
2064 return false;
2065 rhs = gimple_assign_rhs1 (gs);
2066 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2067 return true;
2068 rhs = get_base_address (rhs);
2069 return (DECL_P (rhs)
2070 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2074 /* Return true if S is a type-cast assignment. */
2076 static inline bool
2077 gimple_assign_cast_p (gimple s)
2079 if (is_gimple_assign (s))
2081 enum tree_code sc = gimple_assign_rhs_code (s);
2082 return CONVERT_EXPR_CODE_P (sc)
2083 || sc == VIEW_CONVERT_EXPR
2084 || sc == FIX_TRUNC_EXPR;
2087 return false;
2090 /* Return true if S is a clobber statement. */
2092 static inline bool
2093 gimple_clobber_p (gimple s)
2095 return gimple_assign_single_p (s)
2096 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2099 /* Return true if GS is a GIMPLE_CALL. */
2101 static inline bool
2102 is_gimple_call (const_gimple gs)
2104 return gimple_code (gs) == GIMPLE_CALL;
2107 /* Return the LHS of call statement GS. */
2109 static inline tree
2110 gimple_call_lhs (const_gimple gs)
2112 GIMPLE_CHECK (gs, GIMPLE_CALL);
2113 return gimple_op (gs, 0);
2117 /* Return a pointer to the LHS of call statement GS. */
2119 static inline tree *
2120 gimple_call_lhs_ptr (const_gimple gs)
2122 GIMPLE_CHECK (gs, GIMPLE_CALL);
2123 return gimple_op_ptr (gs, 0);
2127 /* Set LHS to be the LHS operand of call statement GS. */
2129 static inline void
2130 gimple_call_set_lhs (gimple gs, tree lhs)
2132 GIMPLE_CHECK (gs, GIMPLE_CALL);
2133 gimple_set_op (gs, 0, lhs);
2134 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2135 SSA_NAME_DEF_STMT (lhs) = gs;
2139 /* Return true if call GS calls an internal-only function, as enumerated
2140 by internal_fn. */
2142 static inline bool
2143 gimple_call_internal_p (const_gimple gs)
2145 GIMPLE_CHECK (gs, GIMPLE_CALL);
2146 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2150 /* Return the target of internal call GS. */
2152 static inline enum internal_fn
2153 gimple_call_internal_fn (const_gimple gs)
2155 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2156 return gs->gimple_call.u.internal_fn;
2160 /* Return the function type of the function called by GS. */
2162 static inline tree
2163 gimple_call_fntype (const_gimple gs)
2165 GIMPLE_CHECK (gs, GIMPLE_CALL);
2166 if (gimple_call_internal_p (gs))
2167 return NULL_TREE;
2168 return gs->gimple_call.u.fntype;
2171 /* Set the type of the function called by GS to FNTYPE. */
2173 static inline void
2174 gimple_call_set_fntype (gimple gs, tree fntype)
2176 GIMPLE_CHECK (gs, GIMPLE_CALL);
2177 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2178 gs->gimple_call.u.fntype = fntype;
2182 /* Return the tree node representing the function called by call
2183 statement GS. */
2185 static inline tree
2186 gimple_call_fn (const_gimple gs)
2188 GIMPLE_CHECK (gs, GIMPLE_CALL);
2189 return gimple_op (gs, 1);
2192 /* Return a pointer to the tree node representing the function called by call
2193 statement GS. */
2195 static inline tree *
2196 gimple_call_fn_ptr (const_gimple gs)
2198 GIMPLE_CHECK (gs, GIMPLE_CALL);
2199 return gimple_op_ptr (gs, 1);
2203 /* Set FN to be the function called by call statement GS. */
2205 static inline void
2206 gimple_call_set_fn (gimple gs, tree fn)
2208 GIMPLE_CHECK (gs, GIMPLE_CALL);
2209 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2210 gimple_set_op (gs, 1, fn);
2214 /* Set FNDECL to be the function called by call statement GS. */
2216 static inline void
2217 gimple_call_set_fndecl (gimple gs, tree decl)
2219 GIMPLE_CHECK (gs, GIMPLE_CALL);
2220 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2221 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2225 /* Set internal function FN to be the function called by call statement GS. */
2227 static inline void
2228 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2230 GIMPLE_CHECK (gs, GIMPLE_CALL);
2231 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2232 gs->gimple_call.u.internal_fn = fn;
2236 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2237 associated with the callee if known. Otherwise return NULL_TREE. */
2239 static inline tree
2240 gimple_call_addr_fndecl (const_tree fn)
2242 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2244 tree fndecl = TREE_OPERAND (fn, 0);
2245 if (TREE_CODE (fndecl) == MEM_REF
2246 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2247 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2248 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2249 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2250 return fndecl;
2252 return NULL_TREE;
2255 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2256 Otherwise return NULL. This function is analogous to
2257 get_callee_fndecl in tree land. */
2259 static inline tree
2260 gimple_call_fndecl (const_gimple gs)
2262 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2266 /* Return the type returned by call statement GS. */
2268 static inline tree
2269 gimple_call_return_type (const_gimple gs)
2271 tree type = gimple_call_fntype (gs);
2273 if (type == NULL_TREE)
2274 return TREE_TYPE (gimple_call_lhs (gs));
2276 /* The type returned by a function is the type of its
2277 function type. */
2278 return TREE_TYPE (type);
2282 /* Return the static chain for call statement GS. */
2284 static inline tree
2285 gimple_call_chain (const_gimple gs)
2287 GIMPLE_CHECK (gs, GIMPLE_CALL);
2288 return gimple_op (gs, 2);
2292 /* Return a pointer to the static chain for call statement GS. */
2294 static inline tree *
2295 gimple_call_chain_ptr (const_gimple gs)
2297 GIMPLE_CHECK (gs, GIMPLE_CALL);
2298 return gimple_op_ptr (gs, 2);
2301 /* Set CHAIN to be the static chain for call statement GS. */
2303 static inline void
2304 gimple_call_set_chain (gimple gs, tree chain)
2306 GIMPLE_CHECK (gs, GIMPLE_CALL);
2308 gimple_set_op (gs, 2, chain);
2312 /* Return the number of arguments used by call statement GS. */
2314 static inline unsigned
2315 gimple_call_num_args (const_gimple gs)
2317 unsigned num_ops;
2318 GIMPLE_CHECK (gs, GIMPLE_CALL);
2319 num_ops = gimple_num_ops (gs);
2320 return num_ops - 3;
2324 /* Return the argument at position INDEX for call statement GS. */
2326 static inline tree
2327 gimple_call_arg (const_gimple gs, unsigned index)
2329 GIMPLE_CHECK (gs, GIMPLE_CALL);
2330 return gimple_op (gs, index + 3);
2334 /* Return a pointer to the argument at position INDEX for call
2335 statement GS. */
2337 static inline tree *
2338 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2340 GIMPLE_CHECK (gs, GIMPLE_CALL);
2341 return gimple_op_ptr (gs, index + 3);
2345 /* Set ARG to be the argument at position INDEX for call statement GS. */
2347 static inline void
2348 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2350 GIMPLE_CHECK (gs, GIMPLE_CALL);
2351 gimple_set_op (gs, index + 3, arg);
2355 /* If TAIL_P is true, mark call statement S as being a tail call
2356 (i.e., a call just before the exit of a function). These calls are
2357 candidate for tail call optimization. */
2359 static inline void
2360 gimple_call_set_tail (gimple s, bool tail_p)
2362 GIMPLE_CHECK (s, GIMPLE_CALL);
2363 if (tail_p)
2364 s->gsbase.subcode |= GF_CALL_TAILCALL;
2365 else
2366 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2370 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2372 static inline bool
2373 gimple_call_tail_p (gimple s)
2375 GIMPLE_CHECK (s, GIMPLE_CALL);
2376 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2380 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2381 slot optimization. This transformation uses the target of the call
2382 expansion as the return slot for calls that return in memory. */
2384 static inline void
2385 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2387 GIMPLE_CHECK (s, GIMPLE_CALL);
2388 if (return_slot_opt_p)
2389 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2390 else
2391 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2395 /* Return true if S is marked for return slot optimization. */
2397 static inline bool
2398 gimple_call_return_slot_opt_p (gimple s)
2400 GIMPLE_CHECK (s, GIMPLE_CALL);
2401 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2405 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2406 thunk to the thunked-to function. */
2408 static inline void
2409 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2411 GIMPLE_CHECK (s, GIMPLE_CALL);
2412 if (from_thunk_p)
2413 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2414 else
2415 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2419 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2421 static inline bool
2422 gimple_call_from_thunk_p (gimple s)
2424 GIMPLE_CHECK (s, GIMPLE_CALL);
2425 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2429 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2430 argument pack in its argument list. */
2432 static inline void
2433 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2435 GIMPLE_CHECK (s, GIMPLE_CALL);
2436 if (pass_arg_pack_p)
2437 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2438 else
2439 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2443 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2444 argument pack in its argument list. */
2446 static inline bool
2447 gimple_call_va_arg_pack_p (gimple s)
2449 GIMPLE_CHECK (s, GIMPLE_CALL);
2450 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2454 /* Return true if S is a noreturn call. */
2456 static inline bool
2457 gimple_call_noreturn_p (gimple s)
2459 GIMPLE_CHECK (s, GIMPLE_CALL);
2460 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2464 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2465 even if the called function can throw in other cases. */
2467 static inline void
2468 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2470 GIMPLE_CHECK (s, GIMPLE_CALL);
2471 if (nothrow_p)
2472 s->gsbase.subcode |= GF_CALL_NOTHROW;
2473 else
2474 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2477 /* Return true if S is a nothrow call. */
2479 static inline bool
2480 gimple_call_nothrow_p (gimple s)
2482 GIMPLE_CHECK (s, GIMPLE_CALL);
2483 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2486 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2487 is known to be emitted for VLA objects. Those are wrapped by
2488 stack_save/stack_restore calls and hence can't lead to unbounded
2489 stack growth even when they occur in loops. */
2491 static inline void
2492 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2494 GIMPLE_CHECK (s, GIMPLE_CALL);
2495 if (for_var)
2496 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2497 else
2498 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2501 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2503 static inline bool
2504 gimple_call_alloca_for_var_p (gimple s)
2506 GIMPLE_CHECK (s, GIMPLE_CALL);
2507 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2510 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2512 static inline void
2513 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2515 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2516 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2517 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2521 /* Return a pointer to the points-to solution for the set of call-used
2522 variables of the call CALL. */
2524 static inline struct pt_solution *
2525 gimple_call_use_set (gimple call)
2527 GIMPLE_CHECK (call, GIMPLE_CALL);
2528 return &call->gimple_call.call_used;
2532 /* Return a pointer to the points-to solution for the set of call-used
2533 variables of the call CALL. */
2535 static inline struct pt_solution *
2536 gimple_call_clobber_set (gimple call)
2538 GIMPLE_CHECK (call, GIMPLE_CALL);
2539 return &call->gimple_call.call_clobbered;
2543 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2544 non-NULL lhs. */
2546 static inline bool
2547 gimple_has_lhs (gimple stmt)
2549 return (is_gimple_assign (stmt)
2550 || (is_gimple_call (stmt)
2551 && gimple_call_lhs (stmt) != NULL_TREE));
2555 /* Return the code of the predicate computed by conditional statement GS. */
2557 static inline enum tree_code
2558 gimple_cond_code (const_gimple gs)
2560 GIMPLE_CHECK (gs, GIMPLE_COND);
2561 return (enum tree_code) gs->gsbase.subcode;
2565 /* Set CODE to be the predicate code for the conditional statement GS. */
2567 static inline void
2568 gimple_cond_set_code (gimple gs, enum tree_code code)
2570 GIMPLE_CHECK (gs, GIMPLE_COND);
2571 gs->gsbase.subcode = code;
2575 /* Return the LHS of the predicate computed by conditional statement GS. */
2577 static inline tree
2578 gimple_cond_lhs (const_gimple gs)
2580 GIMPLE_CHECK (gs, GIMPLE_COND);
2581 return gimple_op (gs, 0);
2584 /* Return the pointer to the LHS of the predicate computed by conditional
2585 statement GS. */
2587 static inline tree *
2588 gimple_cond_lhs_ptr (const_gimple gs)
2590 GIMPLE_CHECK (gs, GIMPLE_COND);
2591 return gimple_op_ptr (gs, 0);
2594 /* Set LHS to be the LHS operand of the predicate computed by
2595 conditional statement GS. */
2597 static inline void
2598 gimple_cond_set_lhs (gimple gs, tree lhs)
2600 GIMPLE_CHECK (gs, GIMPLE_COND);
2601 gimple_set_op (gs, 0, lhs);
2605 /* Return the RHS operand of the predicate computed by conditional GS. */
2607 static inline tree
2608 gimple_cond_rhs (const_gimple gs)
2610 GIMPLE_CHECK (gs, GIMPLE_COND);
2611 return gimple_op (gs, 1);
2614 /* Return the pointer to the RHS operand of the predicate computed by
2615 conditional GS. */
2617 static inline tree *
2618 gimple_cond_rhs_ptr (const_gimple gs)
2620 GIMPLE_CHECK (gs, GIMPLE_COND);
2621 return gimple_op_ptr (gs, 1);
2625 /* Set RHS to be the RHS operand of the predicate computed by
2626 conditional statement GS. */
2628 static inline void
2629 gimple_cond_set_rhs (gimple gs, tree rhs)
2631 GIMPLE_CHECK (gs, GIMPLE_COND);
2632 gimple_set_op (gs, 1, rhs);
2636 /* Return the label used by conditional statement GS when its
2637 predicate evaluates to true. */
2639 static inline tree
2640 gimple_cond_true_label (const_gimple gs)
2642 GIMPLE_CHECK (gs, GIMPLE_COND);
2643 return gimple_op (gs, 2);
2647 /* Set LABEL to be the label used by conditional statement GS when its
2648 predicate evaluates to true. */
2650 static inline void
2651 gimple_cond_set_true_label (gimple gs, tree label)
2653 GIMPLE_CHECK (gs, GIMPLE_COND);
2654 gimple_set_op (gs, 2, label);
2658 /* Set LABEL to be the label used by conditional statement GS when its
2659 predicate evaluates to false. */
2661 static inline void
2662 gimple_cond_set_false_label (gimple gs, tree label)
2664 GIMPLE_CHECK (gs, GIMPLE_COND);
2665 gimple_set_op (gs, 3, label);
2669 /* Return the label used by conditional statement GS when its
2670 predicate evaluates to false. */
2672 static inline tree
2673 gimple_cond_false_label (const_gimple gs)
2675 GIMPLE_CHECK (gs, GIMPLE_COND);
2676 return gimple_op (gs, 3);
2680 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2682 static inline void
2683 gimple_cond_make_false (gimple gs)
2685 gimple_cond_set_lhs (gs, boolean_true_node);
2686 gimple_cond_set_rhs (gs, boolean_false_node);
2687 gs->gsbase.subcode = EQ_EXPR;
2691 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2693 static inline void
2694 gimple_cond_make_true (gimple gs)
2696 gimple_cond_set_lhs (gs, boolean_true_node);
2697 gimple_cond_set_rhs (gs, boolean_true_node);
2698 gs->gsbase.subcode = EQ_EXPR;
2701 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2702 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2704 static inline bool
2705 gimple_cond_true_p (const_gimple gs)
2707 tree lhs = gimple_cond_lhs (gs);
2708 tree rhs = gimple_cond_rhs (gs);
2709 enum tree_code code = gimple_cond_code (gs);
2711 if (lhs != boolean_true_node && lhs != boolean_false_node)
2712 return false;
2714 if (rhs != boolean_true_node && rhs != boolean_false_node)
2715 return false;
2717 if (code == NE_EXPR && lhs != rhs)
2718 return true;
2720 if (code == EQ_EXPR && lhs == rhs)
2721 return true;
2723 return false;
2726 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2727 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2729 static inline bool
2730 gimple_cond_false_p (const_gimple gs)
2732 tree lhs = gimple_cond_lhs (gs);
2733 tree rhs = gimple_cond_rhs (gs);
2734 enum tree_code code = gimple_cond_code (gs);
2736 if (lhs != boolean_true_node && lhs != boolean_false_node)
2737 return false;
2739 if (rhs != boolean_true_node && rhs != boolean_false_node)
2740 return false;
2742 if (code == NE_EXPR && lhs == rhs)
2743 return true;
2745 if (code == EQ_EXPR && lhs != rhs)
2746 return true;
2748 return false;
2751 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2752 'if (var == 1)' */
2754 static inline bool
2755 gimple_cond_single_var_p (gimple gs)
2757 if (gimple_cond_code (gs) == NE_EXPR
2758 && gimple_cond_rhs (gs) == boolean_false_node)
2759 return true;
2761 if (gimple_cond_code (gs) == EQ_EXPR
2762 && gimple_cond_rhs (gs) == boolean_true_node)
2763 return true;
2765 return false;
2768 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2770 static inline void
2771 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2773 gimple_cond_set_code (stmt, code);
2774 gimple_cond_set_lhs (stmt, lhs);
2775 gimple_cond_set_rhs (stmt, rhs);
2778 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2780 static inline tree
2781 gimple_label_label (const_gimple gs)
2783 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2784 return gimple_op (gs, 0);
2788 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2789 GS. */
2791 static inline void
2792 gimple_label_set_label (gimple gs, tree label)
2794 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2795 gimple_set_op (gs, 0, label);
2799 /* Return the destination of the unconditional jump GS. */
2801 static inline tree
2802 gimple_goto_dest (const_gimple gs)
2804 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2805 return gimple_op (gs, 0);
2809 /* Set DEST to be the destination of the unconditonal jump GS. */
2811 static inline void
2812 gimple_goto_set_dest (gimple gs, tree dest)
2814 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2815 gimple_set_op (gs, 0, dest);
2819 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2821 static inline tree
2822 gimple_bind_vars (const_gimple gs)
2824 GIMPLE_CHECK (gs, GIMPLE_BIND);
2825 return gs->gimple_bind.vars;
2829 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2830 statement GS. */
2832 static inline void
2833 gimple_bind_set_vars (gimple gs, tree vars)
2835 GIMPLE_CHECK (gs, GIMPLE_BIND);
2836 gs->gimple_bind.vars = vars;
2840 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2841 statement GS. */
2843 static inline void
2844 gimple_bind_append_vars (gimple gs, tree vars)
2846 GIMPLE_CHECK (gs, GIMPLE_BIND);
2847 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2851 static inline gimple_seq *
2852 gimple_bind_body_ptr (gimple gs)
2854 GIMPLE_CHECK (gs, GIMPLE_BIND);
2855 return &gs->gimple_bind.body;
2858 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2860 static inline gimple_seq
2861 gimple_bind_body (gimple gs)
2863 return *gimple_bind_body_ptr (gs);
2867 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2868 statement GS. */
2870 static inline void
2871 gimple_bind_set_body (gimple gs, gimple_seq seq)
2873 GIMPLE_CHECK (gs, GIMPLE_BIND);
2874 gs->gimple_bind.body = seq;
2878 /* Append a statement to the end of a GIMPLE_BIND's body. */
2880 static inline void
2881 gimple_bind_add_stmt (gimple gs, gimple stmt)
2883 GIMPLE_CHECK (gs, GIMPLE_BIND);
2884 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2888 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2890 static inline void
2891 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2893 GIMPLE_CHECK (gs, GIMPLE_BIND);
2894 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2898 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2899 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2901 static inline tree
2902 gimple_bind_block (const_gimple gs)
2904 GIMPLE_CHECK (gs, GIMPLE_BIND);
2905 return gs->gimple_bind.block;
2909 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2910 statement GS. */
2912 static inline void
2913 gimple_bind_set_block (gimple gs, tree block)
2915 GIMPLE_CHECK (gs, GIMPLE_BIND);
2916 gcc_gimple_checking_assert (block == NULL_TREE
2917 || TREE_CODE (block) == BLOCK);
2918 gs->gimple_bind.block = block;
2922 /* Return the number of input operands for GIMPLE_ASM GS. */
2924 static inline unsigned
2925 gimple_asm_ninputs (const_gimple gs)
2927 GIMPLE_CHECK (gs, GIMPLE_ASM);
2928 return gs->gimple_asm.ni;
2932 /* Return the number of output operands for GIMPLE_ASM GS. */
2934 static inline unsigned
2935 gimple_asm_noutputs (const_gimple gs)
2937 GIMPLE_CHECK (gs, GIMPLE_ASM);
2938 return gs->gimple_asm.no;
2942 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2944 static inline unsigned
2945 gimple_asm_nclobbers (const_gimple gs)
2947 GIMPLE_CHECK (gs, GIMPLE_ASM);
2948 return gs->gimple_asm.nc;
2951 /* Return the number of label operands for GIMPLE_ASM GS. */
2953 static inline unsigned
2954 gimple_asm_nlabels (const_gimple gs)
2956 GIMPLE_CHECK (gs, GIMPLE_ASM);
2957 return gs->gimple_asm.nl;
2960 /* Return input operand INDEX of GIMPLE_ASM GS. */
2962 static inline tree
2963 gimple_asm_input_op (const_gimple gs, unsigned index)
2965 GIMPLE_CHECK (gs, GIMPLE_ASM);
2966 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2967 return gimple_op (gs, index + gs->gimple_asm.no);
2970 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2972 static inline tree *
2973 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2975 GIMPLE_CHECK (gs, GIMPLE_ASM);
2976 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2977 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2981 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2983 static inline void
2984 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2986 GIMPLE_CHECK (gs, GIMPLE_ASM);
2987 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2988 && TREE_CODE (in_op) == TREE_LIST);
2989 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2993 /* Return output operand INDEX of GIMPLE_ASM GS. */
2995 static inline tree
2996 gimple_asm_output_op (const_gimple gs, unsigned index)
2998 GIMPLE_CHECK (gs, GIMPLE_ASM);
2999 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3000 return gimple_op (gs, index);
3003 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3005 static inline tree *
3006 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3008 GIMPLE_CHECK (gs, GIMPLE_ASM);
3009 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3010 return gimple_op_ptr (gs, index);
3014 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3016 static inline void
3017 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3019 GIMPLE_CHECK (gs, GIMPLE_ASM);
3020 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3021 && TREE_CODE (out_op) == TREE_LIST);
3022 gimple_set_op (gs, index, out_op);
3026 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3028 static inline tree
3029 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3031 GIMPLE_CHECK (gs, GIMPLE_ASM);
3032 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3033 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3037 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3039 static inline void
3040 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3042 GIMPLE_CHECK (gs, GIMPLE_ASM);
3043 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3044 && TREE_CODE (clobber_op) == TREE_LIST);
3045 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3048 /* Return label operand INDEX of GIMPLE_ASM GS. */
3050 static inline tree
3051 gimple_asm_label_op (const_gimple gs, unsigned index)
3053 GIMPLE_CHECK (gs, GIMPLE_ASM);
3054 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3055 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3058 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3060 static inline void
3061 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3063 GIMPLE_CHECK (gs, GIMPLE_ASM);
3064 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3065 && TREE_CODE (label_op) == TREE_LIST);
3066 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3069 /* Return the string representing the assembly instruction in
3070 GIMPLE_ASM GS. */
3072 static inline const char *
3073 gimple_asm_string (const_gimple gs)
3075 GIMPLE_CHECK (gs, GIMPLE_ASM);
3076 return gs->gimple_asm.string;
3080 /* Return true if GS is an asm statement marked volatile. */
3082 static inline bool
3083 gimple_asm_volatile_p (const_gimple gs)
3085 GIMPLE_CHECK (gs, GIMPLE_ASM);
3086 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3090 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3092 static inline void
3093 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3095 GIMPLE_CHECK (gs, GIMPLE_ASM);
3096 if (volatile_p)
3097 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3098 else
3099 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3103 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3105 static inline void
3106 gimple_asm_set_input (gimple gs, bool input_p)
3108 GIMPLE_CHECK (gs, GIMPLE_ASM);
3109 if (input_p)
3110 gs->gsbase.subcode |= GF_ASM_INPUT;
3111 else
3112 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3116 /* Return true if asm GS is an ASM_INPUT. */
3118 static inline bool
3119 gimple_asm_input_p (const_gimple gs)
3121 GIMPLE_CHECK (gs, GIMPLE_ASM);
3122 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3126 /* Return the types handled by GIMPLE_CATCH statement GS. */
3128 static inline tree
3129 gimple_catch_types (const_gimple gs)
3131 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3132 return gs->gimple_catch.types;
3136 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3138 static inline tree *
3139 gimple_catch_types_ptr (gimple gs)
3141 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3142 return &gs->gimple_catch.types;
3146 /* Return a pointer to the GIMPLE sequence representing the body of
3147 the handler of GIMPLE_CATCH statement GS. */
3149 static inline gimple_seq *
3150 gimple_catch_handler_ptr (gimple gs)
3152 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3153 return &gs->gimple_catch.handler;
3157 /* Return the GIMPLE sequence representing the body of the handler of
3158 GIMPLE_CATCH statement GS. */
3160 static inline gimple_seq
3161 gimple_catch_handler (gimple gs)
3163 return *gimple_catch_handler_ptr (gs);
3167 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3169 static inline void
3170 gimple_catch_set_types (gimple gs, tree t)
3172 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3173 gs->gimple_catch.types = t;
3177 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3179 static inline void
3180 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3182 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3183 gs->gimple_catch.handler = handler;
3187 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3189 static inline tree
3190 gimple_eh_filter_types (const_gimple gs)
3192 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3193 return gs->gimple_eh_filter.types;
3197 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3198 GS. */
3200 static inline tree *
3201 gimple_eh_filter_types_ptr (gimple gs)
3203 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3204 return &gs->gimple_eh_filter.types;
3208 /* Return a pointer to the sequence of statement to execute when
3209 GIMPLE_EH_FILTER statement fails. */
3211 static inline gimple_seq *
3212 gimple_eh_filter_failure_ptr (gimple gs)
3214 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3215 return &gs->gimple_eh_filter.failure;
3219 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3220 statement fails. */
3222 static inline gimple_seq
3223 gimple_eh_filter_failure (gimple gs)
3225 return *gimple_eh_filter_failure_ptr (gs);
3229 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3231 static inline void
3232 gimple_eh_filter_set_types (gimple gs, tree types)
3234 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3235 gs->gimple_eh_filter.types = types;
3239 /* Set FAILURE to be the sequence of statements to execute on failure
3240 for GIMPLE_EH_FILTER GS. */
3242 static inline void
3243 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3245 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3246 gs->gimple_eh_filter.failure = failure;
3249 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3251 static inline tree
3252 gimple_eh_must_not_throw_fndecl (gimple gs)
3254 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3255 return gs->gimple_eh_mnt.fndecl;
3258 /* Set the function decl to be called by GS to DECL. */
3260 static inline void
3261 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3263 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3264 gs->gimple_eh_mnt.fndecl = decl;
3267 /* GIMPLE_EH_ELSE accessors. */
3269 static inline gimple_seq *
3270 gimple_eh_else_n_body_ptr (gimple gs)
3272 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3273 return &gs->gimple_eh_else.n_body;
3276 static inline gimple_seq
3277 gimple_eh_else_n_body (gimple gs)
3279 return *gimple_eh_else_n_body_ptr (gs);
3282 static inline gimple_seq *
3283 gimple_eh_else_e_body_ptr (gimple gs)
3285 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3286 return &gs->gimple_eh_else.e_body;
3289 static inline gimple_seq
3290 gimple_eh_else_e_body (gimple gs)
3292 return *gimple_eh_else_e_body_ptr (gs);
3295 static inline void
3296 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3298 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3299 gs->gimple_eh_else.n_body = seq;
3302 static inline void
3303 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3305 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3306 gs->gimple_eh_else.e_body = seq;
3309 /* GIMPLE_TRY accessors. */
3311 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3312 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3314 static inline enum gimple_try_flags
3315 gimple_try_kind (const_gimple gs)
3317 GIMPLE_CHECK (gs, GIMPLE_TRY);
3318 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3322 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3324 static inline void
3325 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3327 GIMPLE_CHECK (gs, GIMPLE_TRY);
3328 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3329 || kind == GIMPLE_TRY_FINALLY);
3330 if (gimple_try_kind (gs) != kind)
3331 gs->gsbase.subcode = (unsigned int) kind;
3335 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3337 static inline bool
3338 gimple_try_catch_is_cleanup (const_gimple gs)
3340 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3341 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3345 /* Return a pointer to the sequence of statements used as the
3346 body for GIMPLE_TRY GS. */
3348 static inline gimple_seq *
3349 gimple_try_eval_ptr (gimple gs)
3351 GIMPLE_CHECK (gs, GIMPLE_TRY);
3352 return &gs->gimple_try.eval;
3356 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3358 static inline gimple_seq
3359 gimple_try_eval (gimple gs)
3361 return *gimple_try_eval_ptr (gs);
3365 /* Return a pointer to the sequence of statements used as the cleanup body for
3366 GIMPLE_TRY GS. */
3368 static inline gimple_seq *
3369 gimple_try_cleanup_ptr (gimple gs)
3371 GIMPLE_CHECK (gs, GIMPLE_TRY);
3372 return &gs->gimple_try.cleanup;
3376 /* Return the sequence of statements used as the cleanup body for
3377 GIMPLE_TRY GS. */
3379 static inline gimple_seq
3380 gimple_try_cleanup (gimple gs)
3382 return *gimple_try_cleanup_ptr (gs);
3386 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3388 static inline void
3389 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3391 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3392 if (catch_is_cleanup)
3393 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3394 else
3395 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3399 /* Set EVAL to be the sequence of statements to use as the body for
3400 GIMPLE_TRY GS. */
3402 static inline void
3403 gimple_try_set_eval (gimple gs, gimple_seq eval)
3405 GIMPLE_CHECK (gs, GIMPLE_TRY);
3406 gs->gimple_try.eval = eval;
3410 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3411 body for GIMPLE_TRY GS. */
3413 static inline void
3414 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3416 GIMPLE_CHECK (gs, GIMPLE_TRY);
3417 gs->gimple_try.cleanup = cleanup;
3421 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3423 static inline gimple_seq *
3424 gimple_wce_cleanup_ptr (gimple gs)
3426 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3427 return &gs->gimple_wce.cleanup;
3431 /* Return the cleanup sequence for cleanup statement GS. */
3433 static inline gimple_seq
3434 gimple_wce_cleanup (gimple gs)
3436 return *gimple_wce_cleanup_ptr (gs);
3440 /* Set CLEANUP to be the cleanup sequence for GS. */
3442 static inline void
3443 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3445 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3446 gs->gimple_wce.cleanup = cleanup;
3450 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3452 static inline bool
3453 gimple_wce_cleanup_eh_only (const_gimple gs)
3455 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3456 return gs->gsbase.subcode != 0;
3460 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3462 static inline void
3463 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3465 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3466 gs->gsbase.subcode = (unsigned int) eh_only_p;
3470 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3472 static inline unsigned
3473 gimple_phi_capacity (const_gimple gs)
3475 GIMPLE_CHECK (gs, GIMPLE_PHI);
3476 return gs->gimple_phi.capacity;
3480 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3481 be exactly the number of incoming edges for the basic block holding
3482 GS. */
3484 static inline unsigned
3485 gimple_phi_num_args (const_gimple gs)
3487 GIMPLE_CHECK (gs, GIMPLE_PHI);
3488 return gs->gimple_phi.nargs;
3492 /* Return the SSA name created by GIMPLE_PHI GS. */
3494 static inline tree
3495 gimple_phi_result (const_gimple gs)
3497 GIMPLE_CHECK (gs, GIMPLE_PHI);
3498 return gs->gimple_phi.result;
3501 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3503 static inline tree *
3504 gimple_phi_result_ptr (gimple gs)
3506 GIMPLE_CHECK (gs, GIMPLE_PHI);
3507 return &gs->gimple_phi.result;
3510 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3512 static inline void
3513 gimple_phi_set_result (gimple gs, tree result)
3515 GIMPLE_CHECK (gs, GIMPLE_PHI);
3516 gs->gimple_phi.result = result;
3517 if (result && TREE_CODE (result) == SSA_NAME)
3518 SSA_NAME_DEF_STMT (result) = gs;
3522 /* Return the PHI argument corresponding to incoming edge INDEX for
3523 GIMPLE_PHI GS. */
3525 static inline struct phi_arg_d *
3526 gimple_phi_arg (gimple gs, unsigned index)
3528 GIMPLE_CHECK (gs, GIMPLE_PHI);
3529 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3530 return &(gs->gimple_phi.args[index]);
3533 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3534 for GIMPLE_PHI GS. */
3536 static inline void
3537 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3539 GIMPLE_CHECK (gs, GIMPLE_PHI);
3540 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3541 gs->gimple_phi.args[index] = *phiarg;
3544 /* Return the region number for GIMPLE_RESX GS. */
3546 static inline int
3547 gimple_resx_region (const_gimple gs)
3549 GIMPLE_CHECK (gs, GIMPLE_RESX);
3550 return gs->gimple_eh_ctrl.region;
3553 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3555 static inline void
3556 gimple_resx_set_region (gimple gs, int region)
3558 GIMPLE_CHECK (gs, GIMPLE_RESX);
3559 gs->gimple_eh_ctrl.region = region;
3562 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3564 static inline int
3565 gimple_eh_dispatch_region (const_gimple gs)
3567 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3568 return gs->gimple_eh_ctrl.region;
3571 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3573 static inline void
3574 gimple_eh_dispatch_set_region (gimple gs, int region)
3576 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3577 gs->gimple_eh_ctrl.region = region;
3580 /* Return the number of labels associated with the switch statement GS. */
3582 static inline unsigned
3583 gimple_switch_num_labels (const_gimple gs)
3585 unsigned num_ops;
3586 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3587 num_ops = gimple_num_ops (gs);
3588 gcc_gimple_checking_assert (num_ops > 1);
3589 return num_ops - 1;
3593 /* Set NLABELS to be the number of labels for the switch statement GS. */
3595 static inline void
3596 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3598 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3599 gimple_set_num_ops (g, nlabels + 1);
3603 /* Return the index variable used by the switch statement GS. */
3605 static inline tree
3606 gimple_switch_index (const_gimple gs)
3608 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3609 return gimple_op (gs, 0);
3613 /* Return a pointer to the index variable for the switch statement GS. */
3615 static inline tree *
3616 gimple_switch_index_ptr (const_gimple gs)
3618 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3619 return gimple_op_ptr (gs, 0);
3623 /* Set INDEX to be the index variable for switch statement GS. */
3625 static inline void
3626 gimple_switch_set_index (gimple gs, tree index)
3628 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3629 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3630 gimple_set_op (gs, 0, index);
3634 /* Return the label numbered INDEX. The default label is 0, followed by any
3635 labels in a switch statement. */
3637 static inline tree
3638 gimple_switch_label (const_gimple gs, unsigned index)
3640 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3641 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3642 return gimple_op (gs, index + 1);
3645 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3647 static inline void
3648 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3650 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3651 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3652 && (label == NULL_TREE
3653 || TREE_CODE (label) == CASE_LABEL_EXPR));
3654 gimple_set_op (gs, index + 1, label);
3657 /* Return the default label for a switch statement. */
3659 static inline tree
3660 gimple_switch_default_label (const_gimple gs)
3662 tree label = gimple_switch_label (gs, 0);
3663 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3664 return label;
3667 /* Set the default label for a switch statement. */
3669 static inline void
3670 gimple_switch_set_default_label (gimple gs, tree label)
3672 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3673 gimple_switch_set_label (gs, 0, label);
3676 /* Return true if GS is a GIMPLE_DEBUG statement. */
3678 static inline bool
3679 is_gimple_debug (const_gimple gs)
3681 return gimple_code (gs) == GIMPLE_DEBUG;
3684 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3686 static inline bool
3687 gimple_debug_bind_p (const_gimple s)
3689 if (is_gimple_debug (s))
3690 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3692 return false;
3695 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3697 static inline tree
3698 gimple_debug_bind_get_var (gimple dbg)
3700 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3701 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3702 return gimple_op (dbg, 0);
3705 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3706 statement. */
3708 static inline tree
3709 gimple_debug_bind_get_value (gimple dbg)
3711 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3712 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3713 return gimple_op (dbg, 1);
3716 /* Return a pointer to the value bound to the variable in a
3717 GIMPLE_DEBUG bind statement. */
3719 static inline tree *
3720 gimple_debug_bind_get_value_ptr (gimple dbg)
3722 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3723 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3724 return gimple_op_ptr (dbg, 1);
3727 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3729 static inline void
3730 gimple_debug_bind_set_var (gimple dbg, tree var)
3732 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3733 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3734 gimple_set_op (dbg, 0, var);
3737 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3738 statement. */
3740 static inline void
3741 gimple_debug_bind_set_value (gimple dbg, tree value)
3743 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3744 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3745 gimple_set_op (dbg, 1, value);
3748 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3749 optimized away. */
3750 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3752 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3753 statement. */
3755 static inline void
3756 gimple_debug_bind_reset_value (gimple dbg)
3758 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3759 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3760 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3763 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3764 value. */
3766 static inline bool
3767 gimple_debug_bind_has_value_p (gimple dbg)
3769 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3770 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3771 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3774 #undef GIMPLE_DEBUG_BIND_NOVALUE
3776 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3778 static inline bool
3779 gimple_debug_source_bind_p (const_gimple s)
3781 if (is_gimple_debug (s))
3782 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3784 return false;
3787 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3789 static inline tree
3790 gimple_debug_source_bind_get_var (gimple dbg)
3792 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3793 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3794 return gimple_op (dbg, 0);
3797 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3798 statement. */
3800 static inline tree
3801 gimple_debug_source_bind_get_value (gimple dbg)
3803 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3804 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3805 return gimple_op (dbg, 1);
3808 /* Return a pointer to the value bound to the variable in a
3809 GIMPLE_DEBUG source bind statement. */
3811 static inline tree *
3812 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3814 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3815 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3816 return gimple_op_ptr (dbg, 1);
3819 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3821 static inline void
3822 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3824 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3825 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3826 gimple_set_op (dbg, 0, var);
3829 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3830 statement. */
3832 static inline void
3833 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3835 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3836 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3837 gimple_set_op (dbg, 1, value);
3840 /* Return a pointer to the body for the OMP statement GS. */
3842 static inline gimple_seq *
3843 gimple_omp_body_ptr (gimple gs)
3845 return &gs->omp.body;
3848 /* Return the body for the OMP statement GS. */
3850 static inline gimple_seq
3851 gimple_omp_body (gimple gs)
3853 return *gimple_omp_body_ptr (gs);
3856 /* Set BODY to be the body for the OMP statement GS. */
3858 static inline void
3859 gimple_omp_set_body (gimple gs, gimple_seq body)
3861 gs->omp.body = body;
3865 /* Return the name associated with OMP_CRITICAL statement GS. */
3867 static inline tree
3868 gimple_omp_critical_name (const_gimple gs)
3870 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3871 return gs->gimple_omp_critical.name;
3875 /* Return a pointer to the name associated with OMP critical statement GS. */
3877 static inline tree *
3878 gimple_omp_critical_name_ptr (gimple gs)
3880 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3881 return &gs->gimple_omp_critical.name;
3885 /* Set NAME to be the name associated with OMP critical statement GS. */
3887 static inline void
3888 gimple_omp_critical_set_name (gimple gs, tree name)
3890 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3891 gs->gimple_omp_critical.name = name;
3895 /* Return the clauses associated with OMP_FOR GS. */
3897 static inline tree
3898 gimple_omp_for_clauses (const_gimple gs)
3900 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3901 return gs->gimple_omp_for.clauses;
3905 /* Return a pointer to the OMP_FOR GS. */
3907 static inline tree *
3908 gimple_omp_for_clauses_ptr (gimple gs)
3910 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3911 return &gs->gimple_omp_for.clauses;
3915 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3917 static inline void
3918 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3920 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3921 gs->gimple_omp_for.clauses = clauses;
3925 /* Get the collapse count of OMP_FOR GS. */
3927 static inline size_t
3928 gimple_omp_for_collapse (gimple gs)
3930 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3931 return gs->gimple_omp_for.collapse;
3935 /* Return the index variable for OMP_FOR GS. */
3937 static inline tree
3938 gimple_omp_for_index (const_gimple gs, size_t i)
3940 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3941 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3942 return gs->gimple_omp_for.iter[i].index;
3946 /* Return a pointer to the index variable for OMP_FOR GS. */
3948 static inline tree *
3949 gimple_omp_for_index_ptr (gimple gs, size_t i)
3951 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3952 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3953 return &gs->gimple_omp_for.iter[i].index;
3957 /* Set INDEX to be the index variable for OMP_FOR GS. */
3959 static inline void
3960 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3962 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3963 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3964 gs->gimple_omp_for.iter[i].index = index;
3968 /* Return the initial value for OMP_FOR GS. */
3970 static inline tree
3971 gimple_omp_for_initial (const_gimple gs, size_t i)
3973 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3974 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3975 return gs->gimple_omp_for.iter[i].initial;
3979 /* Return a pointer to the initial value for OMP_FOR GS. */
3981 static inline tree *
3982 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3984 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3985 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3986 return &gs->gimple_omp_for.iter[i].initial;
3990 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3992 static inline void
3993 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3995 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3996 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3997 gs->gimple_omp_for.iter[i].initial = initial;
4001 /* Return the final value for OMP_FOR GS. */
4003 static inline tree
4004 gimple_omp_for_final (const_gimple gs, size_t i)
4006 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4007 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4008 return gs->gimple_omp_for.iter[i].final;
4012 /* Return a pointer to the final value for OMP_FOR GS. */
4014 static inline tree *
4015 gimple_omp_for_final_ptr (gimple gs, size_t i)
4017 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4018 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4019 return &gs->gimple_omp_for.iter[i].final;
4023 /* Set FINAL to be the final value for OMP_FOR GS. */
4025 static inline void
4026 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4028 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4029 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4030 gs->gimple_omp_for.iter[i].final = final;
4034 /* Return the increment value for OMP_FOR GS. */
4036 static inline tree
4037 gimple_omp_for_incr (const_gimple gs, size_t i)
4039 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4040 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4041 return gs->gimple_omp_for.iter[i].incr;
4045 /* Return a pointer to the increment value for OMP_FOR GS. */
4047 static inline tree *
4048 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4050 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4051 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4052 return &gs->gimple_omp_for.iter[i].incr;
4056 /* Set INCR to be the increment value for OMP_FOR GS. */
4058 static inline void
4059 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4061 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4062 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4063 gs->gimple_omp_for.iter[i].incr = incr;
4067 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4068 statement GS starts. */
4070 static inline gimple_seq *
4071 gimple_omp_for_pre_body_ptr (gimple gs)
4073 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4074 return &gs->gimple_omp_for.pre_body;
4078 /* Return the sequence of statements to execute before the OMP_FOR
4079 statement GS starts. */
4081 static inline gimple_seq
4082 gimple_omp_for_pre_body (gimple gs)
4084 return *gimple_omp_for_pre_body_ptr (gs);
4088 /* Set PRE_BODY to be the sequence of statements to execute before the
4089 OMP_FOR statement GS starts. */
4091 static inline void
4092 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4094 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4095 gs->gimple_omp_for.pre_body = pre_body;
4099 /* Return the clauses associated with OMP_PARALLEL GS. */
4101 static inline tree
4102 gimple_omp_parallel_clauses (const_gimple gs)
4104 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4105 return gs->gimple_omp_parallel.clauses;
4109 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4111 static inline tree *
4112 gimple_omp_parallel_clauses_ptr (gimple gs)
4114 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4115 return &gs->gimple_omp_parallel.clauses;
4119 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4120 GS. */
4122 static inline void
4123 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4125 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4126 gs->gimple_omp_parallel.clauses = clauses;
4130 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4132 static inline tree
4133 gimple_omp_parallel_child_fn (const_gimple gs)
4135 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4136 return gs->gimple_omp_parallel.child_fn;
4139 /* Return a pointer to the child function used to hold the body of
4140 OMP_PARALLEL GS. */
4142 static inline tree *
4143 gimple_omp_parallel_child_fn_ptr (gimple gs)
4145 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4146 return &gs->gimple_omp_parallel.child_fn;
4150 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4152 static inline void
4153 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4155 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4156 gs->gimple_omp_parallel.child_fn = child_fn;
4160 /* Return the artificial argument used to send variables and values
4161 from the parent to the children threads in OMP_PARALLEL GS. */
4163 static inline tree
4164 gimple_omp_parallel_data_arg (const_gimple gs)
4166 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4167 return gs->gimple_omp_parallel.data_arg;
4171 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4173 static inline tree *
4174 gimple_omp_parallel_data_arg_ptr (gimple gs)
4176 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4177 return &gs->gimple_omp_parallel.data_arg;
4181 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4183 static inline void
4184 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4186 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4187 gs->gimple_omp_parallel.data_arg = data_arg;
4191 /* Return the clauses associated with OMP_TASK GS. */
4193 static inline tree
4194 gimple_omp_task_clauses (const_gimple gs)
4196 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4197 return gs->gimple_omp_parallel.clauses;
4201 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4203 static inline tree *
4204 gimple_omp_task_clauses_ptr (gimple gs)
4206 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4207 return &gs->gimple_omp_parallel.clauses;
4211 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4212 GS. */
4214 static inline void
4215 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4217 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4218 gs->gimple_omp_parallel.clauses = clauses;
4222 /* Return the child function used to hold the body of OMP_TASK GS. */
4224 static inline tree
4225 gimple_omp_task_child_fn (const_gimple gs)
4227 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4228 return gs->gimple_omp_parallel.child_fn;
4231 /* Return a pointer to the child function used to hold the body of
4232 OMP_TASK GS. */
4234 static inline tree *
4235 gimple_omp_task_child_fn_ptr (gimple gs)
4237 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4238 return &gs->gimple_omp_parallel.child_fn;
4242 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4244 static inline void
4245 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4247 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4248 gs->gimple_omp_parallel.child_fn = child_fn;
4252 /* Return the artificial argument used to send variables and values
4253 from the parent to the children threads in OMP_TASK GS. */
4255 static inline tree
4256 gimple_omp_task_data_arg (const_gimple gs)
4258 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4259 return gs->gimple_omp_parallel.data_arg;
4263 /* Return a pointer to the data argument for OMP_TASK GS. */
4265 static inline tree *
4266 gimple_omp_task_data_arg_ptr (gimple gs)
4268 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4269 return &gs->gimple_omp_parallel.data_arg;
4273 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4275 static inline void
4276 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4278 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4279 gs->gimple_omp_parallel.data_arg = data_arg;
4283 /* Return the clauses associated with OMP_TASK GS. */
4285 static inline tree
4286 gimple_omp_taskreg_clauses (const_gimple gs)
4288 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4289 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4290 return gs->gimple_omp_parallel.clauses;
4294 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4296 static inline tree *
4297 gimple_omp_taskreg_clauses_ptr (gimple gs)
4299 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4300 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4301 return &gs->gimple_omp_parallel.clauses;
4305 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4306 GS. */
4308 static inline void
4309 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4311 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4312 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4313 gs->gimple_omp_parallel.clauses = clauses;
4317 /* Return the child function used to hold the body of OMP_TASK GS. */
4319 static inline tree
4320 gimple_omp_taskreg_child_fn (const_gimple gs)
4322 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4323 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4324 return gs->gimple_omp_parallel.child_fn;
4327 /* Return a pointer to the child function used to hold the body of
4328 OMP_TASK GS. */
4330 static inline tree *
4331 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4333 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4334 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4335 return &gs->gimple_omp_parallel.child_fn;
4339 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4341 static inline void
4342 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4344 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4345 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4346 gs->gimple_omp_parallel.child_fn = child_fn;
4350 /* Return the artificial argument used to send variables and values
4351 from the parent to the children threads in OMP_TASK GS. */
4353 static inline tree
4354 gimple_omp_taskreg_data_arg (const_gimple gs)
4356 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4357 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4358 return gs->gimple_omp_parallel.data_arg;
4362 /* Return a pointer to the data argument for OMP_TASK GS. */
4364 static inline tree *
4365 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4367 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4368 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4369 return &gs->gimple_omp_parallel.data_arg;
4373 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4375 static inline void
4376 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4378 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4379 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4380 gs->gimple_omp_parallel.data_arg = data_arg;
4384 /* Return the copy function used to hold the body of OMP_TASK GS. */
4386 static inline tree
4387 gimple_omp_task_copy_fn (const_gimple gs)
4389 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4390 return gs->gimple_omp_task.copy_fn;
4393 /* Return a pointer to the copy function used to hold the body of
4394 OMP_TASK GS. */
4396 static inline tree *
4397 gimple_omp_task_copy_fn_ptr (gimple gs)
4399 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4400 return &gs->gimple_omp_task.copy_fn;
4404 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4406 static inline void
4407 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4409 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4410 gs->gimple_omp_task.copy_fn = copy_fn;
4414 /* Return size of the data block in bytes in OMP_TASK GS. */
4416 static inline tree
4417 gimple_omp_task_arg_size (const_gimple gs)
4419 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4420 return gs->gimple_omp_task.arg_size;
4424 /* Return a pointer to the data block size for OMP_TASK GS. */
4426 static inline tree *
4427 gimple_omp_task_arg_size_ptr (gimple gs)
4429 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4430 return &gs->gimple_omp_task.arg_size;
4434 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4436 static inline void
4437 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4439 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4440 gs->gimple_omp_task.arg_size = arg_size;
4444 /* Return align of the data block in bytes in OMP_TASK GS. */
4446 static inline tree
4447 gimple_omp_task_arg_align (const_gimple gs)
4449 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4450 return gs->gimple_omp_task.arg_align;
4454 /* Return a pointer to the data block align for OMP_TASK GS. */
4456 static inline tree *
4457 gimple_omp_task_arg_align_ptr (gimple gs)
4459 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4460 return &gs->gimple_omp_task.arg_align;
4464 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4466 static inline void
4467 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4469 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4470 gs->gimple_omp_task.arg_align = arg_align;
4474 /* Return the clauses associated with OMP_SINGLE GS. */
4476 static inline tree
4477 gimple_omp_single_clauses (const_gimple gs)
4479 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4480 return gs->gimple_omp_single.clauses;
4484 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4486 static inline tree *
4487 gimple_omp_single_clauses_ptr (gimple gs)
4489 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4490 return &gs->gimple_omp_single.clauses;
4494 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4496 static inline void
4497 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4499 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4500 gs->gimple_omp_single.clauses = clauses;
4504 /* Return the clauses associated with OMP_SECTIONS GS. */
4506 static inline tree
4507 gimple_omp_sections_clauses (const_gimple gs)
4509 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4510 return gs->gimple_omp_sections.clauses;
4514 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4516 static inline tree *
4517 gimple_omp_sections_clauses_ptr (gimple gs)
4519 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4520 return &gs->gimple_omp_sections.clauses;
4524 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4525 GS. */
4527 static inline void
4528 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4530 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4531 gs->gimple_omp_sections.clauses = clauses;
4535 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4536 in GS. */
4538 static inline tree
4539 gimple_omp_sections_control (const_gimple gs)
4541 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4542 return gs->gimple_omp_sections.control;
4546 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4547 GS. */
4549 static inline tree *
4550 gimple_omp_sections_control_ptr (gimple gs)
4552 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4553 return &gs->gimple_omp_sections.control;
4557 /* Set CONTROL to be the set of clauses associated with the
4558 GIMPLE_OMP_SECTIONS in GS. */
4560 static inline void
4561 gimple_omp_sections_set_control (gimple gs, tree control)
4563 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4564 gs->gimple_omp_sections.control = control;
4568 /* Set COND to be the condition code for OMP_FOR GS. */
4570 static inline void
4571 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4573 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4574 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4575 && i < gs->gimple_omp_for.collapse);
4576 gs->gimple_omp_for.iter[i].cond = cond;
4580 /* Return the condition code associated with OMP_FOR GS. */
4582 static inline enum tree_code
4583 gimple_omp_for_cond (const_gimple gs, size_t i)
4585 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4586 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4587 return gs->gimple_omp_for.iter[i].cond;
4591 /* Set the value being stored in an atomic store. */
4593 static inline void
4594 gimple_omp_atomic_store_set_val (gimple g, tree val)
4596 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4597 g->gimple_omp_atomic_store.val = val;
4601 /* Return the value being stored in an atomic store. */
4603 static inline tree
4604 gimple_omp_atomic_store_val (const_gimple g)
4606 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4607 return g->gimple_omp_atomic_store.val;
4611 /* Return a pointer to the value being stored in an atomic store. */
4613 static inline tree *
4614 gimple_omp_atomic_store_val_ptr (gimple g)
4616 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4617 return &g->gimple_omp_atomic_store.val;
4621 /* Set the LHS of an atomic load. */
4623 static inline void
4624 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4626 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4627 g->gimple_omp_atomic_load.lhs = lhs;
4631 /* Get the LHS of an atomic load. */
4633 static inline tree
4634 gimple_omp_atomic_load_lhs (const_gimple g)
4636 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4637 return g->gimple_omp_atomic_load.lhs;
4641 /* Return a pointer to the LHS of an atomic load. */
4643 static inline tree *
4644 gimple_omp_atomic_load_lhs_ptr (gimple g)
4646 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4647 return &g->gimple_omp_atomic_load.lhs;
4651 /* Set the RHS of an atomic load. */
4653 static inline void
4654 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4656 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4657 g->gimple_omp_atomic_load.rhs = rhs;
4661 /* Get the RHS of an atomic load. */
4663 static inline tree
4664 gimple_omp_atomic_load_rhs (const_gimple g)
4666 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4667 return g->gimple_omp_atomic_load.rhs;
4671 /* Return a pointer to the RHS of an atomic load. */
4673 static inline tree *
4674 gimple_omp_atomic_load_rhs_ptr (gimple g)
4676 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4677 return &g->gimple_omp_atomic_load.rhs;
4681 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4683 static inline tree
4684 gimple_omp_continue_control_def (const_gimple g)
4686 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4687 return g->gimple_omp_continue.control_def;
4690 /* The same as above, but return the address. */
4692 static inline tree *
4693 gimple_omp_continue_control_def_ptr (gimple g)
4695 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4696 return &g->gimple_omp_continue.control_def;
4699 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4701 static inline void
4702 gimple_omp_continue_set_control_def (gimple g, tree def)
4704 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4705 g->gimple_omp_continue.control_def = def;
4709 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4711 static inline tree
4712 gimple_omp_continue_control_use (const_gimple g)
4714 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4715 return g->gimple_omp_continue.control_use;
4719 /* The same as above, but return the address. */
4721 static inline tree *
4722 gimple_omp_continue_control_use_ptr (gimple g)
4724 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4725 return &g->gimple_omp_continue.control_use;
4729 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4731 static inline void
4732 gimple_omp_continue_set_control_use (gimple g, tree use)
4734 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4735 g->gimple_omp_continue.control_use = use;
4738 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4740 static inline gimple_seq *
4741 gimple_transaction_body_ptr (gimple gs)
4743 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4744 return &gs->gimple_transaction.body;
4747 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4749 static inline gimple_seq
4750 gimple_transaction_body (gimple gs)
4752 return *gimple_transaction_body_ptr (gs);
4755 /* Return the label associated with a GIMPLE_TRANSACTION. */
4757 static inline tree
4758 gimple_transaction_label (const_gimple gs)
4760 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4761 return gs->gimple_transaction.label;
4764 static inline tree *
4765 gimple_transaction_label_ptr (gimple gs)
4767 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4768 return &gs->gimple_transaction.label;
4771 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4773 static inline unsigned int
4774 gimple_transaction_subcode (const_gimple gs)
4776 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4777 return gs->gsbase.subcode;
4780 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4782 static inline void
4783 gimple_transaction_set_body (gimple gs, gimple_seq body)
4785 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4786 gs->gimple_transaction.body = body;
4789 /* Set the label associated with a GIMPLE_TRANSACTION. */
4791 static inline void
4792 gimple_transaction_set_label (gimple gs, tree label)
4794 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4795 gs->gimple_transaction.label = label;
4798 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4800 static inline void
4801 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4803 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4804 gs->gsbase.subcode = subcode;
4808 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4810 static inline tree *
4811 gimple_return_retval_ptr (const_gimple gs)
4813 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4814 return gimple_op_ptr (gs, 0);
4817 /* Return the return value for GIMPLE_RETURN GS. */
4819 static inline tree
4820 gimple_return_retval (const_gimple gs)
4822 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4823 return gimple_op (gs, 0);
4827 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4829 static inline void
4830 gimple_return_set_retval (gimple gs, tree retval)
4832 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4833 gimple_set_op (gs, 0, retval);
4837 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4839 #define CASE_GIMPLE_OMP \
4840 case GIMPLE_OMP_PARALLEL: \
4841 case GIMPLE_OMP_TASK: \
4842 case GIMPLE_OMP_FOR: \
4843 case GIMPLE_OMP_SECTIONS: \
4844 case GIMPLE_OMP_SECTIONS_SWITCH: \
4845 case GIMPLE_OMP_SINGLE: \
4846 case GIMPLE_OMP_SECTION: \
4847 case GIMPLE_OMP_MASTER: \
4848 case GIMPLE_OMP_ORDERED: \
4849 case GIMPLE_OMP_CRITICAL: \
4850 case GIMPLE_OMP_RETURN: \
4851 case GIMPLE_OMP_ATOMIC_LOAD: \
4852 case GIMPLE_OMP_ATOMIC_STORE: \
4853 case GIMPLE_OMP_CONTINUE
4855 static inline bool
4856 is_gimple_omp (const_gimple stmt)
4858 switch (gimple_code (stmt))
4860 CASE_GIMPLE_OMP:
4861 return true;
4862 default:
4863 return false;
4868 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4870 static inline bool
4871 gimple_nop_p (const_gimple g)
4873 return gimple_code (g) == GIMPLE_NOP;
4877 /* Return true if GS is a GIMPLE_RESX. */
4879 static inline bool
4880 is_gimple_resx (const_gimple gs)
4882 return gimple_code (gs) == GIMPLE_RESX;
4885 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4887 static inline enum br_predictor
4888 gimple_predict_predictor (gimple gs)
4890 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4891 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4895 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4897 static inline void
4898 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4900 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4901 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4902 | (unsigned) predictor;
4906 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4908 static inline enum prediction
4909 gimple_predict_outcome (gimple gs)
4911 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4912 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4916 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4918 static inline void
4919 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4921 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4922 if (outcome == TAKEN)
4923 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4924 else
4925 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4929 /* Return the type of the main expression computed by STMT. Return
4930 void_type_node if the statement computes nothing. */
4932 static inline tree
4933 gimple_expr_type (const_gimple stmt)
4935 enum gimple_code code = gimple_code (stmt);
4937 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4939 tree type;
4940 /* In general we want to pass out a type that can be substituted
4941 for both the RHS and the LHS types if there is a possibly
4942 useless conversion involved. That means returning the
4943 original RHS type as far as we can reconstruct it. */
4944 if (code == GIMPLE_CALL)
4945 type = gimple_call_return_type (stmt);
4946 else
4947 switch (gimple_assign_rhs_code (stmt))
4949 case POINTER_PLUS_EXPR:
4950 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4951 break;
4953 default:
4954 /* As fallback use the type of the LHS. */
4955 type = TREE_TYPE (gimple_get_lhs (stmt));
4956 break;
4958 return type;
4960 else if (code == GIMPLE_COND)
4961 return boolean_type_node;
4962 else
4963 return void_type_node;
4966 /* Return true if TYPE is a suitable type for a scalar register variable. */
4968 static inline bool
4969 is_gimple_reg_type (tree type)
4971 return !AGGREGATE_TYPE_P (type);
4974 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4976 static inline gimple_stmt_iterator
4977 gsi_start_1 (gimple_seq *seq)
4979 gimple_stmt_iterator i;
4981 i.ptr = gimple_seq_first (*seq);
4982 i.seq = seq;
4983 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4985 return i;
4988 #define gsi_start(x) gsi_start_1(&(x))
4990 static inline gimple_stmt_iterator
4991 gsi_none (void)
4993 gimple_stmt_iterator i;
4994 i.ptr = NULL;
4995 i.seq = NULL;
4996 i.bb = NULL;
4997 return i;
5000 /* Return a new iterator pointing to the first statement in basic block BB. */
5002 static inline gimple_stmt_iterator
5003 gsi_start_bb (basic_block bb)
5005 gimple_stmt_iterator i;
5006 gimple_seq *seq;
5008 seq = bb_seq_addr (bb);
5009 i.ptr = gimple_seq_first (*seq);
5010 i.seq = seq;
5011 i.bb = bb;
5013 return i;
5017 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5019 static inline gimple_stmt_iterator
5020 gsi_last_1 (gimple_seq *seq)
5022 gimple_stmt_iterator i;
5024 i.ptr = gimple_seq_last (*seq);
5025 i.seq = seq;
5026 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5028 return i;
5031 #define gsi_last(x) gsi_last_1(&(x))
5033 /* Return a new iterator pointing to the last statement in basic block BB. */
5035 static inline gimple_stmt_iterator
5036 gsi_last_bb (basic_block bb)
5038 gimple_stmt_iterator i;
5039 gimple_seq *seq;
5041 seq = bb_seq_addr (bb);
5042 i.ptr = gimple_seq_last (*seq);
5043 i.seq = seq;
5044 i.bb = bb;
5046 return i;
5050 /* Return true if I is at the end of its sequence. */
5052 static inline bool
5053 gsi_end_p (gimple_stmt_iterator i)
5055 return i.ptr == NULL;
5059 /* Return true if I is one statement before the end of its sequence. */
5061 static inline bool
5062 gsi_one_before_end_p (gimple_stmt_iterator i)
5064 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5068 /* Advance the iterator to the next gimple statement. */
5070 static inline void
5071 gsi_next (gimple_stmt_iterator *i)
5073 i->ptr = i->ptr->gsbase.next;
5076 /* Advance the iterator to the previous gimple statement. */
5078 static inline void
5079 gsi_prev (gimple_stmt_iterator *i)
5081 gimple prev = i->ptr->gsbase.prev;
5082 if (prev->gsbase.next)
5083 i->ptr = prev;
5084 else
5085 i->ptr = NULL;
5088 /* Return the current stmt. */
5090 static inline gimple
5091 gsi_stmt (gimple_stmt_iterator i)
5093 return i.ptr;
5096 /* Return a block statement iterator that points to the first non-label
5097 statement in block BB. */
5099 static inline gimple_stmt_iterator
5100 gsi_after_labels (basic_block bb)
5102 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5104 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5105 gsi_next (&gsi);
5107 return gsi;
5110 /* Advance the iterator to the next non-debug gimple statement. */
5112 static inline void
5113 gsi_next_nondebug (gimple_stmt_iterator *i)
5117 gsi_next (i);
5119 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5122 /* Advance the iterator to the next non-debug gimple statement. */
5124 static inline void
5125 gsi_prev_nondebug (gimple_stmt_iterator *i)
5129 gsi_prev (i);
5131 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5134 /* Return a new iterator pointing to the first non-debug statement in
5135 basic block BB. */
5137 static inline gimple_stmt_iterator
5138 gsi_start_nondebug_bb (basic_block bb)
5140 gimple_stmt_iterator i = gsi_start_bb (bb);
5142 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5143 gsi_next_nondebug (&i);
5145 return i;
5148 /* Return a new iterator pointing to the last non-debug statement in
5149 basic block BB. */
5151 static inline gimple_stmt_iterator
5152 gsi_last_nondebug_bb (basic_block bb)
5154 gimple_stmt_iterator i = gsi_last_bb (bb);
5156 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5157 gsi_prev_nondebug (&i);
5159 return i;
5163 /* Return the basic block associated with this iterator. */
5165 static inline basic_block
5166 gsi_bb (gimple_stmt_iterator i)
5168 return i.bb;
5172 /* Return the sequence associated with this iterator. */
5174 static inline gimple_seq
5175 gsi_seq (gimple_stmt_iterator i)
5177 return *i.seq;
5181 enum gsi_iterator_update
5183 GSI_NEW_STMT, /* Only valid when single statement is added, move
5184 iterator to it. */
5185 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5186 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5187 for linking other statements in the same
5188 direction. */
5191 /* In gimple-iterator.c */
5192 gimple_stmt_iterator gsi_start_phis (basic_block);
5193 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5194 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5195 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5196 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5197 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5198 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5199 enum gsi_iterator_update);
5200 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5201 enum gsi_iterator_update);
5202 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5203 enum gsi_iterator_update);
5204 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5205 enum gsi_iterator_update);
5206 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5207 enum gsi_iterator_update);
5208 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5209 enum gsi_iterator_update);
5210 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5211 enum gsi_iterator_update);
5212 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5213 enum gsi_iterator_update);
5214 bool gsi_remove (gimple_stmt_iterator *, bool);
5215 gimple_stmt_iterator gsi_for_stmt (gimple);
5216 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5217 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5218 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5219 void gsi_insert_on_edge (edge, gimple);
5220 void gsi_insert_seq_on_edge (edge, gimple_seq);
5221 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5222 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5223 void gsi_commit_one_edge_insert (edge, basic_block *);
5224 void gsi_commit_edge_inserts (void);
5225 gimple gimple_call_copy_skip_args (gimple, bitmap);
5228 /* Convenience routines to walk all statements of a gimple function.
5229 Note that this is useful exclusively before the code is converted
5230 into SSA form. Once the program is in SSA form, the standard
5231 operand interface should be used to analyze/modify statements. */
5232 struct walk_stmt_info
5234 /* Points to the current statement being walked. */
5235 gimple_stmt_iterator gsi;
5237 /* Additional data that the callback functions may want to carry
5238 through the recursion. */
5239 void *info;
5241 /* Pointer map used to mark visited tree nodes when calling
5242 walk_tree on each operand. If set to NULL, duplicate tree nodes
5243 will be visited more than once. */
5244 struct pointer_set_t *pset;
5246 /* Operand returned by the callbacks. This is set when calling
5247 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5248 returns non-NULL, this field will contain the tree returned by
5249 the last callback. */
5250 tree callback_result;
5252 /* Indicates whether the operand being examined may be replaced
5253 with something that matches is_gimple_val (if true) or something
5254 slightly more complicated (if false). "Something" technically
5255 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5256 but we never try to form anything more complicated than that, so
5257 we don't bother checking.
5259 Also note that CALLBACK should update this flag while walking the
5260 sub-expressions of a statement. For instance, when walking the
5261 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5262 to true, however, when walking &var, the operand of that
5263 ADDR_EXPR does not need to be a GIMPLE value. */
5264 BOOL_BITFIELD val_only : 1;
5266 /* True if we are currently walking the LHS of an assignment. */
5267 BOOL_BITFIELD is_lhs : 1;
5269 /* Optional. Set to true by the callback functions if they made any
5270 changes. */
5271 BOOL_BITFIELD changed : 1;
5273 /* True if we're interested in location information. */
5274 BOOL_BITFIELD want_locations : 1;
5276 /* True if we've removed the statement that was processed. */
5277 BOOL_BITFIELD removed_stmt : 1;
5280 /* Callback for walk_gimple_stmt. Called for every statement found
5281 during traversal. The first argument points to the statement to
5282 walk. The second argument is a flag that the callback sets to
5283 'true' if it the callback handled all the operands and
5284 sub-statements of the statement (the default value of this flag is
5285 'false'). The third argument is an anonymous pointer to data
5286 to be used by the callback. */
5287 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5288 struct walk_stmt_info *);
5290 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5291 struct walk_stmt_info *);
5292 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5293 struct walk_stmt_info *);
5294 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5295 struct walk_stmt_info *);
5296 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5298 /* Enum and arrays used for allocation stats. Keep in sync with
5299 gimple.c:gimple_alloc_kind_names. */
5300 enum gimple_alloc_kind
5302 gimple_alloc_kind_assign, /* Assignments. */
5303 gimple_alloc_kind_phi, /* PHI nodes. */
5304 gimple_alloc_kind_cond, /* Conditionals. */
5305 gimple_alloc_kind_rest, /* Everything else. */
5306 gimple_alloc_kind_all
5309 extern int gimple_alloc_counts[];
5310 extern int gimple_alloc_sizes[];
5312 /* Return the allocation kind for a given stmt CODE. */
5313 static inline enum gimple_alloc_kind
5314 gimple_alloc_kind (enum gimple_code code)
5316 switch (code)
5318 case GIMPLE_ASSIGN:
5319 return gimple_alloc_kind_assign;
5320 case GIMPLE_PHI:
5321 return gimple_alloc_kind_phi;
5322 case GIMPLE_COND:
5323 return gimple_alloc_kind_cond;
5324 default:
5325 return gimple_alloc_kind_rest;
5329 extern void dump_gimple_statistics (void);
5331 /* In gimple-fold.c. */
5332 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5333 tree gimple_fold_builtin (gimple);
5334 bool fold_stmt (gimple_stmt_iterator *);
5335 bool fold_stmt_inplace (gimple_stmt_iterator *);
5336 tree get_symbol_constant_value (tree);
5337 tree canonicalize_constructor_val (tree, tree);
5338 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5339 enum tree_code, tree, tree);
5340 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5341 enum tree_code, tree, tree);
5343 bool gimple_val_nonnegative_real_p (tree);
5344 #endif /* GCC_GIMPLE_H */