2013-09-18 Marc Glisse <marc.glisse@inria.fr>
[official-gcc.git] / gcc / gimple.h
blob5f1280586d2614a448909c2a82e57d327c081b91
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2013 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "hash-table.h"
27 #include "vec.h"
28 #include "ggc.h"
29 #include "basic-block.h"
30 #include "tree.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
33 #include "internal-fn.h"
35 typedef gimple gimple_seq_node;
37 /* Types of supported temporaries. GIMPLE temporaries may be symbols
38 in normal form (i.e., regular decls) or SSA names. This enum is
39 used by create_gimple_tmp to tell it what kind of temporary the
40 caller wants. */
41 enum ssa_mode {
42 M_SSA = 0,
43 M_NORMAL
46 /* For each block, the PHI nodes that need to be rewritten are stored into
47 these vectors. */
48 typedef vec<gimple> gimple_vec;
50 enum gimple_code {
51 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
52 #include "gimple.def"
53 #undef DEFGSCODE
54 LAST_AND_UNUSED_GIMPLE_CODE
57 extern const char *const gimple_code_name[];
58 extern const unsigned char gimple_rhs_class_table[];
60 /* Error out if a gimple tuple is addressed incorrectly. */
61 #if defined ENABLE_GIMPLE_CHECKING
62 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
63 extern void gimple_check_failed (const_gimple, const char *, int, \
64 const char *, enum gimple_code, \
65 enum tree_code) ATTRIBUTE_NORETURN;
67 #define GIMPLE_CHECK(GS, CODE) \
68 do { \
69 const_gimple __gs = (GS); \
70 if (gimple_code (__gs) != (CODE)) \
71 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
72 (CODE), ERROR_MARK); \
73 } while (0)
74 #else /* not ENABLE_GIMPLE_CHECKING */
75 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
76 #define GIMPLE_CHECK(GS, CODE) (void)0
77 #endif
79 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
80 get_gimple_rhs_class. */
81 enum gimple_rhs_class
83 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
84 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
85 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
86 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
87 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
88 name, a _DECL, a _REF, etc. */
91 /* Specific flags for individual GIMPLE statements. These flags are
92 always stored in gimple_statement_base.subcode and they may only be
93 defined for statement codes that do not use sub-codes.
95 Values for the masks can overlap as long as the overlapping values
96 are never used in the same statement class.
98 The maximum mask value that can be defined is 1 << 15 (i.e., each
99 statement code can hold up to 16 bitflags).
101 Keep this list sorted. */
102 enum gf_mask {
103 GF_ASM_INPUT = 1 << 0,
104 GF_ASM_VOLATILE = 1 << 1,
105 GF_CALL_FROM_THUNK = 1 << 0,
106 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
107 GF_CALL_TAILCALL = 1 << 2,
108 GF_CALL_VA_ARG_PACK = 1 << 3,
109 GF_CALL_NOTHROW = 1 << 4,
110 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
111 GF_CALL_INTERNAL = 1 << 6,
112 GF_OMP_PARALLEL_COMBINED = 1 << 0,
113 GF_OMP_FOR_KIND_MASK = 3 << 0,
114 GF_OMP_FOR_KIND_FOR = 0 << 0,
115 GF_OMP_FOR_KIND_SIMD = 1 << 0,
117 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
118 a thread synchronization via some sort of barrier. The exact barrier
119 that would otherwise be emitted is dependent on the OMP statement with
120 which this return is associated. */
121 GF_OMP_RETURN_NOWAIT = 1 << 0,
123 GF_OMP_SECTION_LAST = 1 << 0,
124 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
125 GF_PREDICT_TAKEN = 1 << 15
128 /* Currently, there are only two types of gimple debug stmt. Others are
129 envisioned, for example, to enable the generation of is_stmt notes
130 in line number information, to mark sequence points, etc. This
131 subcode is to be used to tell them apart. */
132 enum gimple_debug_subcode {
133 GIMPLE_DEBUG_BIND = 0,
134 GIMPLE_DEBUG_SOURCE_BIND = 1
137 /* Masks for selecting a pass local flag (PLF) to work on. These
138 masks are used by gimple_set_plf and gimple_plf. */
139 enum plf_mask {
140 GF_PLF_1 = 1 << 0,
141 GF_PLF_2 = 1 << 1
144 /* Iterator object for GIMPLE statement sequences. */
146 struct gimple_stmt_iterator_d
148 /* Sequence node holding the current statement. */
149 gimple_seq_node ptr;
151 /* Sequence and basic block holding the statement. These fields
152 are necessary to handle edge cases such as when statement is
153 added to an empty basic block or when the last statement of a
154 block/sequence is removed. */
155 gimple_seq *seq;
156 basic_block bb;
159 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
160 are for 64 bit hosts. */
162 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
163 /* [ WORD 1 ]
164 Main identifying code for a tuple. */
165 ENUM_BITFIELD(gimple_code) code : 8;
167 /* Nonzero if a warning should not be emitted on this tuple. */
168 unsigned int no_warning : 1;
170 /* Nonzero if this tuple has been visited. Passes are responsible
171 for clearing this bit before using it. */
172 unsigned int visited : 1;
174 /* Nonzero if this tuple represents a non-temporal move. */
175 unsigned int nontemporal_move : 1;
177 /* Pass local flags. These flags are free for any pass to use as
178 they see fit. Passes should not assume that these flags contain
179 any useful value when the pass starts. Any initial state that
180 the pass requires should be set on entry to the pass. See
181 gimple_set_plf and gimple_plf for usage. */
182 unsigned int plf : 2;
184 /* Nonzero if this statement has been modified and needs to have its
185 operands rescanned. */
186 unsigned modified : 1;
188 /* Nonzero if this statement contains volatile operands. */
189 unsigned has_volatile_ops : 1;
191 /* The SUBCODE field can be used for tuple-specific flags for tuples
192 that do not require subcodes. Note that SUBCODE should be at
193 least as wide as tree codes, as several tuples store tree codes
194 in there. */
195 unsigned int subcode : 16;
197 /* UID of this statement. This is used by passes that want to
198 assign IDs to statements. It must be assigned and used by each
199 pass. By default it should be assumed to contain garbage. */
200 unsigned uid;
202 /* [ WORD 2 ]
203 Locus information for debug info. */
204 location_t location;
206 /* Number of operands in this tuple. */
207 unsigned num_ops;
209 /* [ WORD 3 ]
210 Basic block holding this statement. */
211 basic_block bb;
213 /* [ WORD 4-5 ]
214 Linked lists of gimple statements. The next pointers form
215 a NULL terminated list, the prev pointers are a cyclic list.
216 A gimple statement is hence also a double-ended list of
217 statements, with the pointer itself being the first element,
218 and the prev pointer being the last. */
219 gimple next;
220 gimple GTY((skip)) prev;
224 /* Base structure for tuples with operands. */
226 struct GTY(()) gimple_statement_with_ops_base
228 /* [ WORD 1-6 ] */
229 struct gimple_statement_base gsbase;
231 /* [ WORD 7 ]
232 SSA operand vectors. NOTE: It should be possible to
233 amalgamate these vectors with the operand vector OP. However,
234 the SSA operand vectors are organized differently and contain
235 more information (like immediate use chaining). */
236 struct use_optype_d GTY((skip (""))) *use_ops;
240 /* Statements that take register operands. */
242 struct GTY(()) gimple_statement_with_ops
244 /* [ WORD 1-7 ] */
245 struct gimple_statement_with_ops_base opbase;
247 /* [ WORD 8 ]
248 Operand vector. NOTE! This must always be the last field
249 of this structure. In particular, this means that this
250 structure cannot be embedded inside another one. */
251 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
255 /* Base for statements that take both memory and register operands. */
257 struct GTY(()) gimple_statement_with_memory_ops_base
259 /* [ WORD 1-7 ] */
260 struct gimple_statement_with_ops_base opbase;
262 /* [ WORD 8-9 ]
263 Virtual operands for this statement. The GC will pick them
264 up via the ssa_names array. */
265 tree GTY((skip (""))) vdef;
266 tree GTY((skip (""))) vuse;
270 /* Statements that take both memory and register operands. */
272 struct GTY(()) gimple_statement_with_memory_ops
274 /* [ WORD 1-9 ] */
275 struct gimple_statement_with_memory_ops_base membase;
277 /* [ WORD 10 ]
278 Operand vector. NOTE! This must always be the last field
279 of this structure. In particular, this means that this
280 structure cannot be embedded inside another one. */
281 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
285 /* Call statements that take both memory and register operands. */
287 struct GTY(()) gimple_statement_call
289 /* [ WORD 1-9 ] */
290 struct gimple_statement_with_memory_ops_base membase;
292 /* [ WORD 10-13 ] */
293 struct pt_solution call_used;
294 struct pt_solution call_clobbered;
296 /* [ WORD 14 ] */
297 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
298 tree GTY ((tag ("0"))) fntype;
299 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
300 } u;
302 /* [ WORD 15 ]
303 Operand vector. NOTE! This must always be the last field
304 of this structure. In particular, this means that this
305 structure cannot be embedded inside another one. */
306 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
310 /* OpenMP statements (#pragma omp). */
312 struct GTY(()) gimple_statement_omp {
313 /* [ WORD 1-6 ] */
314 struct gimple_statement_base gsbase;
316 /* [ WORD 7 ] */
317 gimple_seq body;
321 /* GIMPLE_BIND */
323 struct GTY(()) gimple_statement_bind {
324 /* [ WORD 1-6 ] */
325 struct gimple_statement_base gsbase;
327 /* [ WORD 7 ]
328 Variables declared in this scope. */
329 tree vars;
331 /* [ WORD 8 ]
332 This is different than the BLOCK field in gimple_statement_base,
333 which is analogous to TREE_BLOCK (i.e., the lexical block holding
334 this statement). This field is the equivalent of BIND_EXPR_BLOCK
335 in tree land (i.e., the lexical scope defined by this bind). See
336 gimple-low.c. */
337 tree block;
339 /* [ WORD 9 ] */
340 gimple_seq body;
344 /* GIMPLE_CATCH */
346 struct GTY(()) gimple_statement_catch {
347 /* [ WORD 1-6 ] */
348 struct gimple_statement_base gsbase;
350 /* [ WORD 7 ] */
351 tree types;
353 /* [ WORD 8 ] */
354 gimple_seq handler;
358 /* GIMPLE_EH_FILTER */
360 struct GTY(()) gimple_statement_eh_filter {
361 /* [ WORD 1-6 ] */
362 struct gimple_statement_base gsbase;
364 /* [ WORD 7 ]
365 Filter types. */
366 tree types;
368 /* [ WORD 8 ]
369 Failure actions. */
370 gimple_seq failure;
373 /* GIMPLE_EH_ELSE */
375 struct GTY(()) gimple_statement_eh_else {
376 /* [ WORD 1-6 ] */
377 struct gimple_statement_base gsbase;
379 /* [ WORD 7,8 ] */
380 gimple_seq n_body, e_body;
383 /* GIMPLE_EH_MUST_NOT_THROW */
385 struct GTY(()) gimple_statement_eh_mnt {
386 /* [ WORD 1-6 ] */
387 struct gimple_statement_base gsbase;
389 /* [ WORD 7 ] Abort function decl. */
390 tree fndecl;
393 /* GIMPLE_PHI */
395 struct GTY(()) gimple_statement_phi {
396 /* [ WORD 1-6 ] */
397 struct gimple_statement_base gsbase;
399 /* [ WORD 7 ] */
400 unsigned capacity;
401 unsigned nargs;
403 /* [ WORD 8 ] */
404 tree result;
406 /* [ WORD 9 ] */
407 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
411 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
413 struct GTY(()) gimple_statement_eh_ctrl
415 /* [ WORD 1-6 ] */
416 struct gimple_statement_base gsbase;
418 /* [ WORD 7 ]
419 Exception region number. */
420 int region;
424 /* GIMPLE_TRY */
426 struct GTY(()) gimple_statement_try {
427 /* [ WORD 1-6 ] */
428 struct gimple_statement_base gsbase;
430 /* [ WORD 7 ]
431 Expression to evaluate. */
432 gimple_seq eval;
434 /* [ WORD 8 ]
435 Cleanup expression. */
436 gimple_seq cleanup;
439 /* Kind of GIMPLE_TRY statements. */
440 enum gimple_try_flags
442 /* A try/catch. */
443 GIMPLE_TRY_CATCH = 1 << 0,
445 /* A try/finally. */
446 GIMPLE_TRY_FINALLY = 1 << 1,
447 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
449 /* Analogous to TRY_CATCH_IS_CLEANUP. */
450 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
453 /* GIMPLE_WITH_CLEANUP_EXPR */
455 struct GTY(()) gimple_statement_wce {
456 /* [ WORD 1-6 ] */
457 struct gimple_statement_base gsbase;
459 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
460 executed if an exception is thrown, not on normal exit of its
461 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
462 in TARGET_EXPRs. */
464 /* [ WORD 7 ]
465 Cleanup expression. */
466 gimple_seq cleanup;
470 /* GIMPLE_ASM */
472 struct GTY(()) gimple_statement_asm
474 /* [ WORD 1-9 ] */
475 struct gimple_statement_with_memory_ops_base membase;
477 /* [ WORD 10 ]
478 __asm__ statement. */
479 const char *string;
481 /* [ WORD 11 ]
482 Number of inputs, outputs, clobbers, labels. */
483 unsigned char ni;
484 unsigned char no;
485 unsigned char nc;
486 unsigned char nl;
488 /* [ WORD 12 ]
489 Operand vector. NOTE! This must always be the last field
490 of this structure. In particular, this means that this
491 structure cannot be embedded inside another one. */
492 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
495 /* GIMPLE_OMP_CRITICAL */
497 struct GTY(()) gimple_statement_omp_critical {
498 /* [ WORD 1-7 ] */
499 struct gimple_statement_omp omp;
501 /* [ WORD 8 ]
502 Critical section name. */
503 tree name;
507 struct GTY(()) gimple_omp_for_iter {
508 /* Condition code. */
509 enum tree_code cond;
511 /* Index variable. */
512 tree index;
514 /* Initial value. */
515 tree initial;
517 /* Final value. */
518 tree final;
520 /* Increment. */
521 tree incr;
524 /* GIMPLE_OMP_FOR */
526 struct GTY(()) gimple_statement_omp_for {
527 /* [ WORD 1-7 ] */
528 struct gimple_statement_omp omp;
530 /* [ WORD 8 ] */
531 tree clauses;
533 /* [ WORD 9 ]
534 Number of elements in iter array. */
535 size_t collapse;
537 /* [ WORD 10 ] */
538 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
540 /* [ WORD 11 ]
541 Pre-body evaluated before the loop body begins. */
542 gimple_seq pre_body;
546 /* GIMPLE_OMP_PARALLEL */
548 struct GTY(()) gimple_statement_omp_parallel {
549 /* [ WORD 1-7 ] */
550 struct gimple_statement_omp omp;
552 /* [ WORD 8 ]
553 Clauses. */
554 tree clauses;
556 /* [ WORD 9 ]
557 Child function holding the body of the parallel region. */
558 tree child_fn;
560 /* [ WORD 10 ]
561 Shared data argument. */
562 tree data_arg;
566 /* GIMPLE_OMP_TASK */
568 struct GTY(()) gimple_statement_omp_task {
569 /* [ WORD 1-10 ] */
570 struct gimple_statement_omp_parallel par;
572 /* [ WORD 11 ]
573 Child function holding firstprivate initialization if needed. */
574 tree copy_fn;
576 /* [ WORD 12-13 ]
577 Size and alignment in bytes of the argument data block. */
578 tree arg_size;
579 tree arg_align;
583 /* GIMPLE_OMP_SECTION */
584 /* Uses struct gimple_statement_omp. */
587 /* GIMPLE_OMP_SECTIONS */
589 struct GTY(()) gimple_statement_omp_sections {
590 /* [ WORD 1-7 ] */
591 struct gimple_statement_omp omp;
593 /* [ WORD 8 ] */
594 tree clauses;
596 /* [ WORD 9 ]
597 The control variable used for deciding which of the sections to
598 execute. */
599 tree control;
602 /* GIMPLE_OMP_CONTINUE.
604 Note: This does not inherit from gimple_statement_omp, because we
605 do not need the body field. */
607 struct GTY(()) gimple_statement_omp_continue {
608 /* [ WORD 1-6 ] */
609 struct gimple_statement_base gsbase;
611 /* [ WORD 7 ] */
612 tree control_def;
614 /* [ WORD 8 ] */
615 tree control_use;
618 /* GIMPLE_OMP_SINGLE */
620 struct GTY(()) gimple_statement_omp_single {
621 /* [ WORD 1-7 ] */
622 struct gimple_statement_omp omp;
624 /* [ WORD 7 ] */
625 tree clauses;
629 /* GIMPLE_OMP_ATOMIC_LOAD.
630 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
631 contains a sequence, which we don't need here. */
633 struct GTY(()) gimple_statement_omp_atomic_load {
634 /* [ WORD 1-6 ] */
635 struct gimple_statement_base gsbase;
637 /* [ WORD 7-8 ] */
638 tree rhs, lhs;
641 /* GIMPLE_OMP_ATOMIC_STORE.
642 See note on GIMPLE_OMP_ATOMIC_LOAD. */
644 struct GTY(()) gimple_statement_omp_atomic_store {
645 /* [ WORD 1-6 ] */
646 struct gimple_statement_base gsbase;
648 /* [ WORD 7 ] */
649 tree val;
652 /* GIMPLE_TRANSACTION. */
654 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
656 /* The __transaction_atomic was declared [[outer]] or it is
657 __transaction_relaxed. */
658 #define GTMA_IS_OUTER (1u << 0)
659 #define GTMA_IS_RELAXED (1u << 1)
660 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
662 /* The transaction is seen to not have an abort. */
663 #define GTMA_HAVE_ABORT (1u << 2)
664 /* The transaction is seen to have loads or stores. */
665 #define GTMA_HAVE_LOAD (1u << 3)
666 #define GTMA_HAVE_STORE (1u << 4)
667 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
668 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
669 /* The transaction WILL enter serial irrevocable mode.
670 An irrevocable block post-dominates the entire transaction, such
671 that all invocations of the transaction will go serial-irrevocable.
672 In such case, we don't bother instrumenting the transaction, and
673 tell the runtime that it should begin the transaction in
674 serial-irrevocable mode. */
675 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
676 /* The transaction contains no instrumentation code whatsover, most
677 likely because it is guaranteed to go irrevocable upon entry. */
678 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
680 struct GTY(()) gimple_statement_transaction
682 /* [ WORD 1-9 ] */
683 struct gimple_statement_with_memory_ops_base gsbase;
685 /* [ WORD 10 ] */
686 gimple_seq body;
688 /* [ WORD 11 ] */
689 tree label;
692 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
693 enum gimple_statement_structure_enum {
694 #include "gsstruct.def"
695 LAST_GSS_ENUM
697 #undef DEFGSSTRUCT
700 /* Define the overall contents of a gimple tuple. It may be any of the
701 structures declared above for various types of tuples. */
703 union GTY ((desc ("gimple_statement_structure (&%h)"),
704 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
705 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
706 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
707 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
708 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
709 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
710 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
711 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
712 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
713 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
714 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
715 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
716 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
717 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
718 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
719 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
720 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
721 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
722 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
723 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
724 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
725 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
726 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
727 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
728 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
729 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
730 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
733 /* In gimple.c. */
735 /* Helper functions to build GIMPLE statements. */
736 tree create_gimple_tmp (tree, enum ssa_mode = M_SSA);
737 gimple build_assign (enum tree_code, tree, int, enum ssa_mode = M_SSA);
738 gimple build_assign (enum tree_code, gimple, int, enum ssa_mode = M_SSA);
739 gimple build_assign (enum tree_code, tree, tree, enum ssa_mode = M_SSA);
740 gimple build_assign (enum tree_code, gimple, tree, enum ssa_mode = M_SSA);
741 gimple build_assign (enum tree_code, tree, gimple, enum ssa_mode = M_SSA);
742 gimple build_assign (enum tree_code, gimple, gimple, enum ssa_mode = M_SSA);
743 gimple build_type_cast (tree, tree, enum ssa_mode = M_SSA);
744 gimple build_type_cast (tree, gimple, enum ssa_mode = M_SSA);
746 /* Offset in bytes to the location of the operand vector.
747 Zero if there is no operand vector for this tuple structure. */
748 extern size_t const gimple_ops_offset_[];
750 /* Map GIMPLE codes to GSS codes. */
751 extern enum gimple_statement_structure_enum const gss_for_code_[];
753 /* This variable holds the currently expanded gimple statement for purposes
754 of comminucating the profile info to the builtin expanders. */
755 extern gimple currently_expanding_gimple_stmt;
757 gimple gimple_build_return (tree);
759 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
760 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
762 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
764 gimple
765 gimple_build_assign_with_ops (enum tree_code, tree,
766 tree, tree CXX_MEM_STAT_INFO);
767 gimple
768 gimple_build_assign_with_ops (enum tree_code, tree,
769 tree, tree, tree CXX_MEM_STAT_INFO);
771 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
772 #define gimple_build_debug_bind(var,val,stmt) \
773 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
774 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
775 #define gimple_build_debug_source_bind(var,val,stmt) \
776 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
778 gimple gimple_build_call_vec (tree, vec<tree> );
779 gimple gimple_build_call (tree, unsigned, ...);
780 gimple gimple_build_call_valist (tree, unsigned, va_list);
781 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
782 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
783 gimple gimple_build_call_from_tree (tree);
784 gimple gimplify_assign (tree, tree, gimple_seq *);
785 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
786 gimple gimple_build_label (tree label);
787 gimple gimple_build_goto (tree dest);
788 gimple gimple_build_nop (void);
789 gimple gimple_build_bind (tree, gimple_seq, tree);
790 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
791 vec<tree, va_gc> *, vec<tree, va_gc> *,
792 vec<tree, va_gc> *);
793 gimple gimple_build_catch (tree, gimple_seq);
794 gimple gimple_build_eh_filter (tree, gimple_seq);
795 gimple gimple_build_eh_must_not_throw (tree);
796 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
797 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
798 gimple gimple_build_wce (gimple_seq);
799 gimple gimple_build_resx (int);
800 gimple gimple_build_eh_dispatch (int);
801 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
802 gimple gimple_build_switch (tree, tree, vec<tree> );
803 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
804 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
805 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
806 gimple gimple_build_omp_critical (gimple_seq, tree);
807 gimple gimple_build_omp_section (gimple_seq);
808 gimple gimple_build_omp_continue (tree, tree);
809 gimple gimple_build_omp_master (gimple_seq);
810 gimple gimple_build_omp_return (bool);
811 gimple gimple_build_omp_ordered (gimple_seq);
812 gimple gimple_build_omp_sections (gimple_seq, tree);
813 gimple gimple_build_omp_sections_switch (void);
814 gimple gimple_build_omp_single (gimple_seq, tree);
815 gimple gimple_build_cdt (tree, tree);
816 gimple gimple_build_omp_atomic_load (tree, tree);
817 gimple gimple_build_omp_atomic_store (tree);
818 gimple gimple_build_transaction (gimple_seq, tree);
819 gimple gimple_build_predict (enum br_predictor, enum prediction);
820 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
821 void sort_case_labels (vec<tree> );
822 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
823 void gimple_set_body (tree, gimple_seq);
824 gimple_seq gimple_body (tree);
825 bool gimple_has_body_p (tree);
826 gimple_seq gimple_seq_alloc (void);
827 void gimple_seq_free (gimple_seq);
828 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
829 gimple_seq gimple_seq_copy (gimple_seq);
830 bool gimple_call_same_target_p (const_gimple, const_gimple);
831 int gimple_call_flags (const_gimple);
832 int gimple_call_return_flags (const_gimple);
833 int gimple_call_arg_flags (const_gimple, unsigned);
834 void gimple_call_reset_alias_info (gimple);
835 bool gimple_assign_copy_p (gimple);
836 bool gimple_assign_ssa_name_copy_p (gimple);
837 bool gimple_assign_unary_nop_p (gimple);
838 void gimple_set_bb (gimple, basic_block);
839 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
840 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
841 tree, tree, tree);
842 tree gimple_get_lhs (const_gimple);
843 void gimple_set_lhs (gimple, tree);
844 void gimple_replace_lhs (gimple, tree);
845 gimple gimple_copy (gimple);
846 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
847 gimple gimple_build_cond_from_tree (tree, tree, tree);
848 void gimple_cond_set_condition_from_tree (gimple, tree);
849 bool gimple_has_side_effects (const_gimple);
850 bool gimple_could_trap_p (gimple);
851 bool gimple_could_trap_p_1 (gimple, bool, bool);
852 bool gimple_assign_rhs_could_trap_p (gimple);
853 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
854 bool empty_body_p (gimple_seq);
855 unsigned get_gimple_rhs_num_ops (enum tree_code);
856 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
857 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
858 const char *gimple_decl_printable_name (tree, int);
859 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
860 tree gimple_extract_devirt_binfo_from_cst (tree, tree);
862 /* Returns true iff T is a scalar register variable. */
863 extern bool is_gimple_reg (tree);
864 /* Returns true iff T is any sort of variable. */
865 extern bool is_gimple_variable (tree);
866 /* Returns true iff T is any sort of symbol. */
867 extern bool is_gimple_id (tree);
868 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
869 extern bool is_gimple_min_lval (tree);
870 /* Returns true iff T is something whose address can be taken. */
871 extern bool is_gimple_addressable (tree);
872 /* Returns true iff T is any valid GIMPLE lvalue. */
873 extern bool is_gimple_lvalue (tree);
875 /* Returns true iff T is a GIMPLE address. */
876 bool is_gimple_address (const_tree);
877 /* Returns true iff T is a GIMPLE invariant address. */
878 bool is_gimple_invariant_address (const_tree);
879 /* Returns true iff T is a GIMPLE invariant address at interprocedural
880 level. */
881 bool is_gimple_ip_invariant_address (const_tree);
882 /* Returns true iff T is a valid GIMPLE constant. */
883 bool is_gimple_constant (const_tree);
884 /* Returns true iff T is a GIMPLE restricted function invariant. */
885 extern bool is_gimple_min_invariant (const_tree);
886 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
887 extern bool is_gimple_ip_invariant (const_tree);
888 /* Returns true iff T is a GIMPLE rvalue. */
889 extern bool is_gimple_val (tree);
890 /* Returns true iff T is a GIMPLE asm statement input. */
891 extern bool is_gimple_asm_val (tree);
892 /* Returns true iff T is a valid address operand of a MEM_REF. */
893 bool is_gimple_mem_ref_addr (tree);
895 /* Returns true iff T is a valid if-statement condition. */
896 extern bool is_gimple_condexpr (tree);
898 /* Returns true iff T is a valid call address expression. */
899 extern bool is_gimple_call_addr (tree);
901 /* Return TRUE iff stmt is a call to a built-in function. */
902 extern bool is_gimple_builtin_call (gimple stmt);
904 extern void recalculate_side_effects (tree);
905 extern bool gimple_compare_field_offset (tree, tree);
906 extern tree gimple_register_canonical_type (tree);
907 extern void print_gimple_types_stats (const char *);
908 extern void free_gimple_type_tables (void);
909 extern tree gimple_unsigned_type (tree);
910 extern tree gimple_signed_type (tree);
911 extern alias_set_type gimple_get_alias_set (tree);
912 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
913 unsigned *);
914 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
915 bool (*)(gimple, tree, void *),
916 bool (*)(gimple, tree, void *),
917 bool (*)(gimple, tree, void *));
918 extern bool walk_stmt_load_store_ops (gimple, void *,
919 bool (*)(gimple, tree, void *),
920 bool (*)(gimple, tree, void *));
921 extern bool gimple_ior_addresses_taken (bitmap, gimple);
922 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
923 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
924 extern bool gimple_asm_clobbers_memory_p (const_gimple);
925 extern bool useless_type_conversion_p (tree, tree);
926 extern bool types_compatible_p (tree, tree);
928 /* In gimplify.c */
929 extern tree create_tmp_var_raw (tree, const char *);
930 extern tree create_tmp_var_name (const char *);
931 extern tree create_tmp_var (tree, const char *);
932 extern tree create_tmp_reg (tree, const char *);
933 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
934 extern tree get_formal_tmp_var (tree, gimple_seq *);
935 extern void declare_vars (tree, gimple, bool);
936 extern void annotate_all_with_location (gimple_seq, location_t);
938 /* Validation of GIMPLE expressions. Note that these predicates only check
939 the basic form of the expression, they don't recurse to make sure that
940 underlying nodes are also of the right form. */
941 typedef bool (*gimple_predicate)(tree);
944 /* FIXME we should deduce this from the predicate. */
945 enum fallback {
946 fb_none = 0, /* Do not generate a temporary. */
948 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
949 gimplified expression. */
951 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
952 gimplified expression. */
954 fb_mayfail = 4, /* Gimplification may fail. Error issued
955 afterwards. */
956 fb_either= fb_rvalue | fb_lvalue
959 typedef int fallback_t;
961 enum gimplify_status {
962 GS_ERROR = -2, /* Something Bad Seen. */
963 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
964 GS_OK = 0, /* We did something, maybe more to do. */
965 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
968 /* Formal (expression) temporary table handling: multiple occurrences of
969 the same scalar expression are evaluated into the same temporary. */
971 typedef struct gimple_temp_hash_elt
973 tree val; /* Key */
974 tree temp; /* Value */
975 } elt_t;
977 /* Gimplify hashtable helper. */
979 struct gimplify_hasher : typed_free_remove <elt_t>
981 typedef elt_t value_type;
982 typedef elt_t compare_type;
983 static inline hashval_t hash (const value_type *);
984 static inline bool equal (const value_type *, const compare_type *);
987 inline hashval_t
988 gimplify_hasher::hash (const value_type *p)
990 tree t = p->val;
991 return iterative_hash_expr (t, 0);
994 inline bool
995 gimplify_hasher::equal (const value_type *p1, const compare_type *p2)
997 tree t1 = p1->val;
998 tree t2 = p2->val;
999 enum tree_code code = TREE_CODE (t1);
1001 if (TREE_CODE (t2) != code
1002 || TREE_TYPE (t1) != TREE_TYPE (t2))
1003 return false;
1005 if (!operand_equal_p (t1, t2, 0))
1006 return false;
1008 #ifdef ENABLE_CHECKING
1009 /* Only allow them to compare equal if they also hash equal; otherwise
1010 results are nondeterminate, and we fail bootstrap comparison. */
1011 gcc_assert (hash (p1) == hash (p2));
1012 #endif
1014 return true;
1017 struct gimplify_ctx
1019 struct gimplify_ctx *prev_context;
1021 vec<gimple> bind_expr_stack;
1022 tree temps;
1023 gimple_seq conditional_cleanups;
1024 tree exit_label;
1025 tree return_temp;
1027 vec<tree> case_labels;
1028 /* The formal temporary table. Should this be persistent? */
1029 hash_table <gimplify_hasher> temp_htab;
1031 int conditions;
1032 bool save_stack;
1033 bool into_ssa;
1034 bool allow_rhs_cond_expr;
1035 bool in_cleanup_point_expr;
1038 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1039 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1040 fields). */
1041 static inline bool
1042 is_gimple_sizepos (tree expr)
1044 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1045 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1046 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1047 function, the gimplifier will want to replace it with a new variable,
1048 but that will cause problems if this type is from outside the function.
1049 It's OK to have that here. */
1050 return (expr == NULL_TREE
1051 || TREE_CONSTANT (expr)
1052 || TREE_CODE (expr) == VAR_DECL
1053 || CONTAINS_PLACEHOLDER_P (expr));
1056 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1057 bool (*) (tree), fallback_t);
1058 extern void gimplify_type_sizes (tree, gimple_seq *);
1059 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1060 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1061 bool, tree);
1062 extern bool gimplify_stmt (tree *, gimple_seq *);
1063 extern gimple gimplify_body (tree, bool);
1064 extern void push_gimplify_context (struct gimplify_ctx *);
1065 extern void pop_gimplify_context (gimple);
1066 extern void gimplify_and_add (tree, gimple_seq *);
1068 /* Miscellaneous helpers. */
1069 extern void gimple_add_tmp_var (tree);
1070 extern gimple gimple_current_bind_expr (void);
1071 extern vec<gimple> gimple_bind_expr_stack (void);
1072 extern tree voidify_wrapper_expr (tree, tree);
1073 extern tree build_and_jump (tree *);
1074 extern tree force_labels_r (tree *, int *, void *);
1075 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1076 gimple_seq *);
1077 struct gimplify_omp_ctx;
1078 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1079 extern tree gimple_boolify (tree);
1080 extern gimple_predicate rhs_predicate_for (tree);
1081 extern tree canonicalize_cond_expr_cond (tree);
1083 /* In omp-low.c. */
1084 extern tree omp_reduction_init (tree, tree);
1086 /* In trans-mem.c. */
1087 extern void diagnose_tm_safe_errors (tree);
1088 extern void compute_transaction_bits (void);
1090 /* In tree-nested.c. */
1091 extern void lower_nested_functions (tree);
1092 extern void insert_field_into_struct (tree, tree);
1094 /* In gimplify.c. */
1095 extern void gimplify_function_tree (tree);
1097 /* In cfgexpand.c. */
1098 extern tree gimple_assign_rhs_to_tree (gimple);
1100 /* In builtins.c */
1101 extern bool validate_gimple_arglist (const_gimple, ...);
1103 /* In tree-ssa-coalesce.c */
1104 extern bool gimple_can_coalesce_p (tree, tree);
1106 /* Return the first node in GIMPLE sequence S. */
1108 static inline gimple_seq_node
1109 gimple_seq_first (gimple_seq s)
1111 return s;
1115 /* Return the first statement in GIMPLE sequence S. */
1117 static inline gimple
1118 gimple_seq_first_stmt (gimple_seq s)
1120 gimple_seq_node n = gimple_seq_first (s);
1121 return n;
1125 /* Return the last node in GIMPLE sequence S. */
1127 static inline gimple_seq_node
1128 gimple_seq_last (gimple_seq s)
1130 return s ? s->gsbase.prev : NULL;
1134 /* Return the last statement in GIMPLE sequence S. */
1136 static inline gimple
1137 gimple_seq_last_stmt (gimple_seq s)
1139 gimple_seq_node n = gimple_seq_last (s);
1140 return n;
1144 /* Set the last node in GIMPLE sequence *PS to LAST. */
1146 static inline void
1147 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1149 (*ps)->gsbase.prev = last;
1153 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1155 static inline void
1156 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1158 *ps = first;
1162 /* Return true if GIMPLE sequence S is empty. */
1164 static inline bool
1165 gimple_seq_empty_p (gimple_seq s)
1167 return s == NULL;
1170 void gimple_seq_add_stmt (gimple_seq *, gimple);
1172 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1173 *SEQ_P is NULL, a new sequence is allocated. This function is
1174 similar to gimple_seq_add_stmt, but does not scan the operands.
1175 During gimplification, we need to manipulate statement sequences
1176 before the def/use vectors have been constructed. */
1177 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1179 /* Allocate a new sequence and initialize its first element with STMT. */
1181 static inline gimple_seq
1182 gimple_seq_alloc_with_stmt (gimple stmt)
1184 gimple_seq seq = NULL;
1185 gimple_seq_add_stmt (&seq, stmt);
1186 return seq;
1190 /* Returns the sequence of statements in BB. */
1192 static inline gimple_seq
1193 bb_seq (const_basic_block bb)
1195 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1198 static inline gimple_seq *
1199 bb_seq_addr (basic_block bb)
1201 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1204 /* Sets the sequence of statements in BB to SEQ. */
1206 static inline void
1207 set_bb_seq (basic_block bb, gimple_seq seq)
1209 gcc_checking_assert (!(bb->flags & BB_RTL));
1210 bb->il.gimple.seq = seq;
1214 /* Return the code for GIMPLE statement G. */
1216 static inline enum gimple_code
1217 gimple_code (const_gimple g)
1219 return g->gsbase.code;
1223 /* Return the GSS code used by a GIMPLE code. */
1225 static inline enum gimple_statement_structure_enum
1226 gss_for_code (enum gimple_code code)
1228 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1229 return gss_for_code_[code];
1233 /* Return which GSS code is used by GS. */
1235 static inline enum gimple_statement_structure_enum
1236 gimple_statement_structure (gimple gs)
1238 return gss_for_code (gimple_code (gs));
1242 /* Return true if statement G has sub-statements. This is only true for
1243 High GIMPLE statements. */
1245 static inline bool
1246 gimple_has_substatements (gimple g)
1248 switch (gimple_code (g))
1250 case GIMPLE_BIND:
1251 case GIMPLE_CATCH:
1252 case GIMPLE_EH_FILTER:
1253 case GIMPLE_EH_ELSE:
1254 case GIMPLE_TRY:
1255 case GIMPLE_OMP_FOR:
1256 case GIMPLE_OMP_MASTER:
1257 case GIMPLE_OMP_ORDERED:
1258 case GIMPLE_OMP_SECTION:
1259 case GIMPLE_OMP_PARALLEL:
1260 case GIMPLE_OMP_TASK:
1261 case GIMPLE_OMP_SECTIONS:
1262 case GIMPLE_OMP_SINGLE:
1263 case GIMPLE_OMP_CRITICAL:
1264 case GIMPLE_WITH_CLEANUP_EXPR:
1265 case GIMPLE_TRANSACTION:
1266 return true;
1268 default:
1269 return false;
1274 /* Return the basic block holding statement G. */
1276 static inline basic_block
1277 gimple_bb (const_gimple g)
1279 return g->gsbase.bb;
1283 /* Return the lexical scope block holding statement G. */
1285 static inline tree
1286 gimple_block (const_gimple g)
1288 return LOCATION_BLOCK (g->gsbase.location);
1292 /* Set BLOCK to be the lexical scope block holding statement G. */
1294 static inline void
1295 gimple_set_block (gimple g, tree block)
1297 if (block)
1298 g->gsbase.location =
1299 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1300 else
1301 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1305 /* Return location information for statement G. */
1307 static inline location_t
1308 gimple_location (const_gimple g)
1310 return g->gsbase.location;
1313 /* Return pointer to location information for statement G. */
1315 static inline const location_t *
1316 gimple_location_ptr (const_gimple g)
1318 return &g->gsbase.location;
1322 /* Set location information for statement G. */
1324 static inline void
1325 gimple_set_location (gimple g, location_t location)
1327 g->gsbase.location = location;
1331 /* Return true if G contains location information. */
1333 static inline bool
1334 gimple_has_location (const_gimple g)
1336 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1340 /* Return the file name of the location of STMT. */
1342 static inline const char *
1343 gimple_filename (const_gimple stmt)
1345 return LOCATION_FILE (gimple_location (stmt));
1349 /* Return the line number of the location of STMT. */
1351 static inline int
1352 gimple_lineno (const_gimple stmt)
1354 return LOCATION_LINE (gimple_location (stmt));
1358 /* Determine whether SEQ is a singleton. */
1360 static inline bool
1361 gimple_seq_singleton_p (gimple_seq seq)
1363 return ((gimple_seq_first (seq) != NULL)
1364 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1367 /* Return true if no warnings should be emitted for statement STMT. */
1369 static inline bool
1370 gimple_no_warning_p (const_gimple stmt)
1372 return stmt->gsbase.no_warning;
1375 /* Set the no_warning flag of STMT to NO_WARNING. */
1377 static inline void
1378 gimple_set_no_warning (gimple stmt, bool no_warning)
1380 stmt->gsbase.no_warning = (unsigned) no_warning;
1383 /* Set the visited status on statement STMT to VISITED_P. */
1385 static inline void
1386 gimple_set_visited (gimple stmt, bool visited_p)
1388 stmt->gsbase.visited = (unsigned) visited_p;
1392 /* Return the visited status for statement STMT. */
1394 static inline bool
1395 gimple_visited_p (gimple stmt)
1397 return stmt->gsbase.visited;
1401 /* Set pass local flag PLF on statement STMT to VAL_P. */
1403 static inline void
1404 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1406 if (val_p)
1407 stmt->gsbase.plf |= (unsigned int) plf;
1408 else
1409 stmt->gsbase.plf &= ~((unsigned int) plf);
1413 /* Return the value of pass local flag PLF on statement STMT. */
1415 static inline unsigned int
1416 gimple_plf (gimple stmt, enum plf_mask plf)
1418 return stmt->gsbase.plf & ((unsigned int) plf);
1422 /* Set the UID of statement. */
1424 static inline void
1425 gimple_set_uid (gimple g, unsigned uid)
1427 g->gsbase.uid = uid;
1431 /* Return the UID of statement. */
1433 static inline unsigned
1434 gimple_uid (const_gimple g)
1436 return g->gsbase.uid;
1440 /* Make statement G a singleton sequence. */
1442 static inline void
1443 gimple_init_singleton (gimple g)
1445 g->gsbase.next = NULL;
1446 g->gsbase.prev = g;
1450 /* Return true if GIMPLE statement G has register or memory operands. */
1452 static inline bool
1453 gimple_has_ops (const_gimple g)
1455 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1459 /* Return true if GIMPLE statement G has memory operands. */
1461 static inline bool
1462 gimple_has_mem_ops (const_gimple g)
1464 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1468 /* Return the set of USE operands for statement G. */
1470 static inline struct use_optype_d *
1471 gimple_use_ops (const_gimple g)
1473 if (!gimple_has_ops (g))
1474 return NULL;
1475 return g->gsops.opbase.use_ops;
1479 /* Set USE to be the set of USE operands for statement G. */
1481 static inline void
1482 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1484 gcc_gimple_checking_assert (gimple_has_ops (g));
1485 g->gsops.opbase.use_ops = use;
1489 /* Return the set of VUSE operand for statement G. */
1491 static inline use_operand_p
1492 gimple_vuse_op (const_gimple g)
1494 struct use_optype_d *ops;
1495 if (!gimple_has_mem_ops (g))
1496 return NULL_USE_OPERAND_P;
1497 ops = g->gsops.opbase.use_ops;
1498 if (ops
1499 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1500 return USE_OP_PTR (ops);
1501 return NULL_USE_OPERAND_P;
1504 /* Return the set of VDEF operand for statement G. */
1506 static inline def_operand_p
1507 gimple_vdef_op (gimple g)
1509 if (!gimple_has_mem_ops (g))
1510 return NULL_DEF_OPERAND_P;
1511 if (g->gsmembase.vdef)
1512 return &g->gsmembase.vdef;
1513 return NULL_DEF_OPERAND_P;
1517 /* Return the single VUSE operand of the statement G. */
1519 static inline tree
1520 gimple_vuse (const_gimple g)
1522 if (!gimple_has_mem_ops (g))
1523 return NULL_TREE;
1524 return g->gsmembase.vuse;
1527 /* Return the single VDEF operand of the statement G. */
1529 static inline tree
1530 gimple_vdef (const_gimple g)
1532 if (!gimple_has_mem_ops (g))
1533 return NULL_TREE;
1534 return g->gsmembase.vdef;
1537 /* Return the single VUSE operand of the statement G. */
1539 static inline tree *
1540 gimple_vuse_ptr (gimple g)
1542 if (!gimple_has_mem_ops (g))
1543 return NULL;
1544 return &g->gsmembase.vuse;
1547 /* Return the single VDEF operand of the statement G. */
1549 static inline tree *
1550 gimple_vdef_ptr (gimple g)
1552 if (!gimple_has_mem_ops (g))
1553 return NULL;
1554 return &g->gsmembase.vdef;
1557 /* Set the single VUSE operand of the statement G. */
1559 static inline void
1560 gimple_set_vuse (gimple g, tree vuse)
1562 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1563 g->gsmembase.vuse = vuse;
1566 /* Set the single VDEF operand of the statement G. */
1568 static inline void
1569 gimple_set_vdef (gimple g, tree vdef)
1571 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1572 g->gsmembase.vdef = vdef;
1576 /* Return true if statement G has operands and the modified field has
1577 been set. */
1579 static inline bool
1580 gimple_modified_p (const_gimple g)
1582 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1586 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1587 a MODIFIED field. */
1589 static inline void
1590 gimple_set_modified (gimple s, bool modifiedp)
1592 if (gimple_has_ops (s))
1593 s->gsbase.modified = (unsigned) modifiedp;
1597 /* Return the tree code for the expression computed by STMT. This is
1598 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1599 GIMPLE_CALL, return CALL_EXPR as the expression code for
1600 consistency. This is useful when the caller needs to deal with the
1601 three kinds of computation that GIMPLE supports. */
1603 static inline enum tree_code
1604 gimple_expr_code (const_gimple stmt)
1606 enum gimple_code code = gimple_code (stmt);
1607 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1608 return (enum tree_code) stmt->gsbase.subcode;
1609 else
1611 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1612 return CALL_EXPR;
1617 /* Mark statement S as modified, and update it. */
1619 static inline void
1620 update_stmt (gimple s)
1622 if (gimple_has_ops (s))
1624 gimple_set_modified (s, true);
1625 update_stmt_operands (s);
1629 /* Update statement S if it has been optimized. */
1631 static inline void
1632 update_stmt_if_modified (gimple s)
1634 if (gimple_modified_p (s))
1635 update_stmt_operands (s);
1638 /* Return true if statement STMT contains volatile operands. */
1640 static inline bool
1641 gimple_has_volatile_ops (const_gimple stmt)
1643 if (gimple_has_mem_ops (stmt))
1644 return stmt->gsbase.has_volatile_ops;
1645 else
1646 return false;
1650 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1652 static inline void
1653 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1655 if (gimple_has_mem_ops (stmt))
1656 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1659 /* Return true if BB is in a transaction. */
1661 static inline bool
1662 block_in_transaction (basic_block bb)
1664 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1667 /* Return true if STMT is in a transaction. */
1669 static inline bool
1670 gimple_in_transaction (gimple stmt)
1672 return block_in_transaction (gimple_bb (stmt));
1675 /* Return true if statement STMT may access memory. */
1677 static inline bool
1678 gimple_references_memory_p (gimple stmt)
1680 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1684 /* Return the subcode for OMP statement S. */
1686 static inline unsigned
1687 gimple_omp_subcode (const_gimple s)
1689 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1690 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1691 return s->gsbase.subcode;
1694 /* Set the subcode for OMP statement S to SUBCODE. */
1696 static inline void
1697 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1699 /* We only have 16 bits for the subcode. Assert that we are not
1700 overflowing it. */
1701 gcc_gimple_checking_assert (subcode < (1 << 16));
1702 s->gsbase.subcode = subcode;
1705 /* Set the nowait flag on OMP_RETURN statement S. */
1707 static inline void
1708 gimple_omp_return_set_nowait (gimple s)
1710 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1711 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1715 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1716 flag set. */
1718 static inline bool
1719 gimple_omp_return_nowait_p (const_gimple g)
1721 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1722 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1726 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1727 flag set. */
1729 static inline bool
1730 gimple_omp_section_last_p (const_gimple g)
1732 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1733 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1737 /* Set the GF_OMP_SECTION_LAST flag on G. */
1739 static inline void
1740 gimple_omp_section_set_last (gimple g)
1742 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1743 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1747 /* Return true if OMP parallel statement G has the
1748 GF_OMP_PARALLEL_COMBINED flag set. */
1750 static inline bool
1751 gimple_omp_parallel_combined_p (const_gimple g)
1753 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1754 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1758 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1759 value of COMBINED_P. */
1761 static inline void
1762 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1764 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1765 if (combined_p)
1766 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1767 else
1768 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1772 /* Return true if OMP atomic load/store statement G has the
1773 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1775 static inline bool
1776 gimple_omp_atomic_need_value_p (const_gimple g)
1778 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1779 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1780 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1784 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1786 static inline void
1787 gimple_omp_atomic_set_need_value (gimple g)
1789 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1790 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1791 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1795 /* Return the number of operands for statement GS. */
1797 static inline unsigned
1798 gimple_num_ops (const_gimple gs)
1800 return gs->gsbase.num_ops;
1804 /* Set the number of operands for statement GS. */
1806 static inline void
1807 gimple_set_num_ops (gimple gs, unsigned num_ops)
1809 gs->gsbase.num_ops = num_ops;
1813 /* Return the array of operands for statement GS. */
1815 static inline tree *
1816 gimple_ops (gimple gs)
1818 size_t off;
1820 /* All the tuples have their operand vector at the very bottom
1821 of the structure. Note that those structures that do not
1822 have an operand vector have a zero offset. */
1823 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1824 gcc_gimple_checking_assert (off != 0);
1826 return (tree *) ((char *) gs + off);
1830 /* Return operand I for statement GS. */
1832 static inline tree
1833 gimple_op (const_gimple gs, unsigned i)
1835 if (gimple_has_ops (gs))
1837 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1838 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1840 else
1841 return NULL_TREE;
1844 /* Return a pointer to operand I for statement GS. */
1846 static inline tree *
1847 gimple_op_ptr (const_gimple gs, unsigned i)
1849 if (gimple_has_ops (gs))
1851 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1852 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1854 else
1855 return NULL;
1858 /* Set operand I of statement GS to OP. */
1860 static inline void
1861 gimple_set_op (gimple gs, unsigned i, tree op)
1863 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1865 /* Note. It may be tempting to assert that OP matches
1866 is_gimple_operand, but that would be wrong. Different tuples
1867 accept slightly different sets of tree operands. Each caller
1868 should perform its own validation. */
1869 gimple_ops (gs)[i] = op;
1872 /* Return true if GS is a GIMPLE_ASSIGN. */
1874 static inline bool
1875 is_gimple_assign (const_gimple gs)
1877 return gimple_code (gs) == GIMPLE_ASSIGN;
1880 /* Determine if expression CODE is one of the valid expressions that can
1881 be used on the RHS of GIMPLE assignments. */
1883 static inline enum gimple_rhs_class
1884 get_gimple_rhs_class (enum tree_code code)
1886 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1889 /* Return the LHS of assignment statement GS. */
1891 static inline tree
1892 gimple_assign_lhs (const_gimple gs)
1894 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1895 return gimple_op (gs, 0);
1899 /* Return a pointer to the LHS of assignment statement GS. */
1901 static inline tree *
1902 gimple_assign_lhs_ptr (const_gimple gs)
1904 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1905 return gimple_op_ptr (gs, 0);
1909 /* Set LHS to be the LHS operand of assignment statement GS. */
1911 static inline void
1912 gimple_assign_set_lhs (gimple gs, tree lhs)
1914 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1915 gimple_set_op (gs, 0, lhs);
1917 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1918 SSA_NAME_DEF_STMT (lhs) = gs;
1922 /* Return the first operand on the RHS of assignment statement GS. */
1924 static inline tree
1925 gimple_assign_rhs1 (const_gimple gs)
1927 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1928 return gimple_op (gs, 1);
1932 /* Return a pointer to the first operand on the RHS of assignment
1933 statement GS. */
1935 static inline tree *
1936 gimple_assign_rhs1_ptr (const_gimple gs)
1938 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1939 return gimple_op_ptr (gs, 1);
1942 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1944 static inline void
1945 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1947 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1949 gimple_set_op (gs, 1, rhs);
1953 /* Return the second operand on the RHS of assignment statement GS.
1954 If GS does not have two operands, NULL is returned instead. */
1956 static inline tree
1957 gimple_assign_rhs2 (const_gimple gs)
1959 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1961 if (gimple_num_ops (gs) >= 3)
1962 return gimple_op (gs, 2);
1963 else
1964 return NULL_TREE;
1968 /* Return a pointer to the second operand on the RHS of assignment
1969 statement GS. */
1971 static inline tree *
1972 gimple_assign_rhs2_ptr (const_gimple gs)
1974 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1975 return gimple_op_ptr (gs, 2);
1979 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1981 static inline void
1982 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1984 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1986 gimple_set_op (gs, 2, rhs);
1989 /* Return the third operand on the RHS of assignment statement GS.
1990 If GS does not have two operands, NULL is returned instead. */
1992 static inline tree
1993 gimple_assign_rhs3 (const_gimple gs)
1995 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1997 if (gimple_num_ops (gs) >= 4)
1998 return gimple_op (gs, 3);
1999 else
2000 return NULL_TREE;
2003 /* Return a pointer to the third operand on the RHS of assignment
2004 statement GS. */
2006 static inline tree *
2007 gimple_assign_rhs3_ptr (const_gimple gs)
2009 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2010 return gimple_op_ptr (gs, 3);
2014 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2016 static inline void
2017 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2019 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2021 gimple_set_op (gs, 3, rhs);
2024 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2025 to see only a maximum of two operands. */
2027 static inline void
2028 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2029 tree op1, tree op2)
2031 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2034 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2035 to see only a maximum of two operands. */
2037 static inline void
2038 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
2039 tree *op1)
2041 tree op2;
2042 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
2043 gcc_assert (op2 == NULL_TREE);
2046 /* Returns true if GS is a nontemporal move. */
2048 static inline bool
2049 gimple_assign_nontemporal_move_p (const_gimple gs)
2051 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2052 return gs->gsbase.nontemporal_move;
2055 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2057 static inline void
2058 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2060 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2061 gs->gsbase.nontemporal_move = nontemporal;
2065 /* Return the code of the expression computed on the rhs of assignment
2066 statement GS. In case that the RHS is a single object, returns the
2067 tree code of the object. */
2069 static inline enum tree_code
2070 gimple_assign_rhs_code (const_gimple gs)
2072 enum tree_code code;
2073 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2075 code = (enum tree_code) gs->gsbase.subcode;
2076 /* While we initially set subcode to the TREE_CODE of the rhs for
2077 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2078 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2079 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2080 code = TREE_CODE (gimple_assign_rhs1 (gs));
2082 return code;
2086 /* Set CODE to be the code for the expression computed on the RHS of
2087 assignment S. */
2089 static inline void
2090 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2092 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2093 s->gsbase.subcode = code;
2097 /* Return the gimple rhs class of the code of the expression computed on
2098 the rhs of assignment statement GS.
2099 This will never return GIMPLE_INVALID_RHS. */
2101 static inline enum gimple_rhs_class
2102 gimple_assign_rhs_class (const_gimple gs)
2104 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2107 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2108 there is no operator associated with the assignment itself.
2109 Unlike gimple_assign_copy_p, this predicate returns true for
2110 any RHS operand, including those that perform an operation
2111 and do not have the semantics of a copy, such as COND_EXPR. */
2113 static inline bool
2114 gimple_assign_single_p (gimple gs)
2116 return (is_gimple_assign (gs)
2117 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2120 /* Return true if GS performs a store to its lhs. */
2122 static inline bool
2123 gimple_store_p (gimple gs)
2125 tree lhs = gimple_get_lhs (gs);
2126 return lhs && !is_gimple_reg (lhs);
2129 /* Return true if GS is an assignment that loads from its rhs1. */
2131 static inline bool
2132 gimple_assign_load_p (gimple gs)
2134 tree rhs;
2135 if (!gimple_assign_single_p (gs))
2136 return false;
2137 rhs = gimple_assign_rhs1 (gs);
2138 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2139 return true;
2140 rhs = get_base_address (rhs);
2141 return (DECL_P (rhs)
2142 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2146 /* Return true if S is a type-cast assignment. */
2148 static inline bool
2149 gimple_assign_cast_p (gimple s)
2151 if (is_gimple_assign (s))
2153 enum tree_code sc = gimple_assign_rhs_code (s);
2154 return CONVERT_EXPR_CODE_P (sc)
2155 || sc == VIEW_CONVERT_EXPR
2156 || sc == FIX_TRUNC_EXPR;
2159 return false;
2162 /* Return true if S is a clobber statement. */
2164 static inline bool
2165 gimple_clobber_p (gimple s)
2167 return gimple_assign_single_p (s)
2168 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2171 /* Return true if GS is a GIMPLE_CALL. */
2173 static inline bool
2174 is_gimple_call (const_gimple gs)
2176 return gimple_code (gs) == GIMPLE_CALL;
2179 /* Return the LHS of call statement GS. */
2181 static inline tree
2182 gimple_call_lhs (const_gimple gs)
2184 GIMPLE_CHECK (gs, GIMPLE_CALL);
2185 return gimple_op (gs, 0);
2189 /* Return a pointer to the LHS of call statement GS. */
2191 static inline tree *
2192 gimple_call_lhs_ptr (const_gimple gs)
2194 GIMPLE_CHECK (gs, GIMPLE_CALL);
2195 return gimple_op_ptr (gs, 0);
2199 /* Set LHS to be the LHS operand of call statement GS. */
2201 static inline void
2202 gimple_call_set_lhs (gimple gs, tree lhs)
2204 GIMPLE_CHECK (gs, GIMPLE_CALL);
2205 gimple_set_op (gs, 0, lhs);
2206 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2207 SSA_NAME_DEF_STMT (lhs) = gs;
2211 /* Return true if call GS calls an internal-only function, as enumerated
2212 by internal_fn. */
2214 static inline bool
2215 gimple_call_internal_p (const_gimple gs)
2217 GIMPLE_CHECK (gs, GIMPLE_CALL);
2218 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2222 /* Return the target of internal call GS. */
2224 static inline enum internal_fn
2225 gimple_call_internal_fn (const_gimple gs)
2227 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2228 return gs->gimple_call.u.internal_fn;
2232 /* Return the function type of the function called by GS. */
2234 static inline tree
2235 gimple_call_fntype (const_gimple gs)
2237 GIMPLE_CHECK (gs, GIMPLE_CALL);
2238 if (gimple_call_internal_p (gs))
2239 return NULL_TREE;
2240 return gs->gimple_call.u.fntype;
2243 /* Set the type of the function called by GS to FNTYPE. */
2245 static inline void
2246 gimple_call_set_fntype (gimple gs, tree fntype)
2248 GIMPLE_CHECK (gs, GIMPLE_CALL);
2249 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2250 gs->gimple_call.u.fntype = fntype;
2254 /* Return the tree node representing the function called by call
2255 statement GS. */
2257 static inline tree
2258 gimple_call_fn (const_gimple gs)
2260 GIMPLE_CHECK (gs, GIMPLE_CALL);
2261 return gimple_op (gs, 1);
2264 /* Return a pointer to the tree node representing the function called by call
2265 statement GS. */
2267 static inline tree *
2268 gimple_call_fn_ptr (const_gimple gs)
2270 GIMPLE_CHECK (gs, GIMPLE_CALL);
2271 return gimple_op_ptr (gs, 1);
2275 /* Set FN to be the function called by call statement GS. */
2277 static inline void
2278 gimple_call_set_fn (gimple gs, tree fn)
2280 GIMPLE_CHECK (gs, GIMPLE_CALL);
2281 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2282 gimple_set_op (gs, 1, fn);
2286 /* Set FNDECL to be the function called by call statement GS. */
2288 static inline void
2289 gimple_call_set_fndecl (gimple gs, tree decl)
2291 GIMPLE_CHECK (gs, GIMPLE_CALL);
2292 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2293 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2297 /* Set internal function FN to be the function called by call statement GS. */
2299 static inline void
2300 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2302 GIMPLE_CHECK (gs, GIMPLE_CALL);
2303 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2304 gs->gimple_call.u.internal_fn = fn;
2308 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2309 associated with the callee if known. Otherwise return NULL_TREE. */
2311 static inline tree
2312 gimple_call_addr_fndecl (const_tree fn)
2314 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2316 tree fndecl = TREE_OPERAND (fn, 0);
2317 if (TREE_CODE (fndecl) == MEM_REF
2318 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2319 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2320 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2321 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2322 return fndecl;
2324 return NULL_TREE;
2327 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2328 Otherwise return NULL. This function is analogous to
2329 get_callee_fndecl in tree land. */
2331 static inline tree
2332 gimple_call_fndecl (const_gimple gs)
2334 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2338 /* Return the type returned by call statement GS. */
2340 static inline tree
2341 gimple_call_return_type (const_gimple gs)
2343 tree type = gimple_call_fntype (gs);
2345 if (type == NULL_TREE)
2346 return TREE_TYPE (gimple_call_lhs (gs));
2348 /* The type returned by a function is the type of its
2349 function type. */
2350 return TREE_TYPE (type);
2354 /* Return the static chain for call statement GS. */
2356 static inline tree
2357 gimple_call_chain (const_gimple gs)
2359 GIMPLE_CHECK (gs, GIMPLE_CALL);
2360 return gimple_op (gs, 2);
2364 /* Return a pointer to the static chain for call statement GS. */
2366 static inline tree *
2367 gimple_call_chain_ptr (const_gimple gs)
2369 GIMPLE_CHECK (gs, GIMPLE_CALL);
2370 return gimple_op_ptr (gs, 2);
2373 /* Set CHAIN to be the static chain for call statement GS. */
2375 static inline void
2376 gimple_call_set_chain (gimple gs, tree chain)
2378 GIMPLE_CHECK (gs, GIMPLE_CALL);
2380 gimple_set_op (gs, 2, chain);
2384 /* Return the number of arguments used by call statement GS. */
2386 static inline unsigned
2387 gimple_call_num_args (const_gimple gs)
2389 unsigned num_ops;
2390 GIMPLE_CHECK (gs, GIMPLE_CALL);
2391 num_ops = gimple_num_ops (gs);
2392 return num_ops - 3;
2396 /* Return the argument at position INDEX for call statement GS. */
2398 static inline tree
2399 gimple_call_arg (const_gimple gs, unsigned index)
2401 GIMPLE_CHECK (gs, GIMPLE_CALL);
2402 return gimple_op (gs, index + 3);
2406 /* Return a pointer to the argument at position INDEX for call
2407 statement GS. */
2409 static inline tree *
2410 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2412 GIMPLE_CHECK (gs, GIMPLE_CALL);
2413 return gimple_op_ptr (gs, index + 3);
2417 /* Set ARG to be the argument at position INDEX for call statement GS. */
2419 static inline void
2420 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2422 GIMPLE_CHECK (gs, GIMPLE_CALL);
2423 gimple_set_op (gs, index + 3, arg);
2427 /* If TAIL_P is true, mark call statement S as being a tail call
2428 (i.e., a call just before the exit of a function). These calls are
2429 candidate for tail call optimization. */
2431 static inline void
2432 gimple_call_set_tail (gimple s, bool tail_p)
2434 GIMPLE_CHECK (s, GIMPLE_CALL);
2435 if (tail_p)
2436 s->gsbase.subcode |= GF_CALL_TAILCALL;
2437 else
2438 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2442 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2444 static inline bool
2445 gimple_call_tail_p (gimple s)
2447 GIMPLE_CHECK (s, GIMPLE_CALL);
2448 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2452 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2453 slot optimization. This transformation uses the target of the call
2454 expansion as the return slot for calls that return in memory. */
2456 static inline void
2457 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2459 GIMPLE_CHECK (s, GIMPLE_CALL);
2460 if (return_slot_opt_p)
2461 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2462 else
2463 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2467 /* Return true if S is marked for return slot optimization. */
2469 static inline bool
2470 gimple_call_return_slot_opt_p (gimple s)
2472 GIMPLE_CHECK (s, GIMPLE_CALL);
2473 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2477 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2478 thunk to the thunked-to function. */
2480 static inline void
2481 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2483 GIMPLE_CHECK (s, GIMPLE_CALL);
2484 if (from_thunk_p)
2485 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2486 else
2487 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2491 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2493 static inline bool
2494 gimple_call_from_thunk_p (gimple s)
2496 GIMPLE_CHECK (s, GIMPLE_CALL);
2497 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2501 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2502 argument pack in its argument list. */
2504 static inline void
2505 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2507 GIMPLE_CHECK (s, GIMPLE_CALL);
2508 if (pass_arg_pack_p)
2509 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2510 else
2511 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2515 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2516 argument pack in its argument list. */
2518 static inline bool
2519 gimple_call_va_arg_pack_p (gimple s)
2521 GIMPLE_CHECK (s, GIMPLE_CALL);
2522 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2526 /* Return true if S is a noreturn call. */
2528 static inline bool
2529 gimple_call_noreturn_p (gimple s)
2531 GIMPLE_CHECK (s, GIMPLE_CALL);
2532 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2536 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2537 even if the called function can throw in other cases. */
2539 static inline void
2540 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2542 GIMPLE_CHECK (s, GIMPLE_CALL);
2543 if (nothrow_p)
2544 s->gsbase.subcode |= GF_CALL_NOTHROW;
2545 else
2546 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2549 /* Return true if S is a nothrow call. */
2551 static inline bool
2552 gimple_call_nothrow_p (gimple s)
2554 GIMPLE_CHECK (s, GIMPLE_CALL);
2555 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2558 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2559 is known to be emitted for VLA objects. Those are wrapped by
2560 stack_save/stack_restore calls and hence can't lead to unbounded
2561 stack growth even when they occur in loops. */
2563 static inline void
2564 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2566 GIMPLE_CHECK (s, GIMPLE_CALL);
2567 if (for_var)
2568 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2569 else
2570 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2573 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2575 static inline bool
2576 gimple_call_alloca_for_var_p (gimple s)
2578 GIMPLE_CHECK (s, GIMPLE_CALL);
2579 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2582 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2584 static inline void
2585 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2587 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2588 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2589 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2593 /* Return a pointer to the points-to solution for the set of call-used
2594 variables of the call CALL. */
2596 static inline struct pt_solution *
2597 gimple_call_use_set (gimple call)
2599 GIMPLE_CHECK (call, GIMPLE_CALL);
2600 return &call->gimple_call.call_used;
2604 /* Return a pointer to the points-to solution for the set of call-used
2605 variables of the call CALL. */
2607 static inline struct pt_solution *
2608 gimple_call_clobber_set (gimple call)
2610 GIMPLE_CHECK (call, GIMPLE_CALL);
2611 return &call->gimple_call.call_clobbered;
2615 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2616 non-NULL lhs. */
2618 static inline bool
2619 gimple_has_lhs (gimple stmt)
2621 return (is_gimple_assign (stmt)
2622 || (is_gimple_call (stmt)
2623 && gimple_call_lhs (stmt) != NULL_TREE));
2627 /* Return the code of the predicate computed by conditional statement GS. */
2629 static inline enum tree_code
2630 gimple_cond_code (const_gimple gs)
2632 GIMPLE_CHECK (gs, GIMPLE_COND);
2633 return (enum tree_code) gs->gsbase.subcode;
2637 /* Set CODE to be the predicate code for the conditional statement GS. */
2639 static inline void
2640 gimple_cond_set_code (gimple gs, enum tree_code code)
2642 GIMPLE_CHECK (gs, GIMPLE_COND);
2643 gs->gsbase.subcode = code;
2647 /* Return the LHS of the predicate computed by conditional statement GS. */
2649 static inline tree
2650 gimple_cond_lhs (const_gimple gs)
2652 GIMPLE_CHECK (gs, GIMPLE_COND);
2653 return gimple_op (gs, 0);
2656 /* Return the pointer to the LHS of the predicate computed by conditional
2657 statement GS. */
2659 static inline tree *
2660 gimple_cond_lhs_ptr (const_gimple gs)
2662 GIMPLE_CHECK (gs, GIMPLE_COND);
2663 return gimple_op_ptr (gs, 0);
2666 /* Set LHS to be the LHS operand of the predicate computed by
2667 conditional statement GS. */
2669 static inline void
2670 gimple_cond_set_lhs (gimple gs, tree lhs)
2672 GIMPLE_CHECK (gs, GIMPLE_COND);
2673 gimple_set_op (gs, 0, lhs);
2677 /* Return the RHS operand of the predicate computed by conditional GS. */
2679 static inline tree
2680 gimple_cond_rhs (const_gimple gs)
2682 GIMPLE_CHECK (gs, GIMPLE_COND);
2683 return gimple_op (gs, 1);
2686 /* Return the pointer to the RHS operand of the predicate computed by
2687 conditional GS. */
2689 static inline tree *
2690 gimple_cond_rhs_ptr (const_gimple gs)
2692 GIMPLE_CHECK (gs, GIMPLE_COND);
2693 return gimple_op_ptr (gs, 1);
2697 /* Set RHS to be the RHS operand of the predicate computed by
2698 conditional statement GS. */
2700 static inline void
2701 gimple_cond_set_rhs (gimple gs, tree rhs)
2703 GIMPLE_CHECK (gs, GIMPLE_COND);
2704 gimple_set_op (gs, 1, rhs);
2708 /* Return the label used by conditional statement GS when its
2709 predicate evaluates to true. */
2711 static inline tree
2712 gimple_cond_true_label (const_gimple gs)
2714 GIMPLE_CHECK (gs, GIMPLE_COND);
2715 return gimple_op (gs, 2);
2719 /* Set LABEL to be the label used by conditional statement GS when its
2720 predicate evaluates to true. */
2722 static inline void
2723 gimple_cond_set_true_label (gimple gs, tree label)
2725 GIMPLE_CHECK (gs, GIMPLE_COND);
2726 gimple_set_op (gs, 2, label);
2730 /* Set LABEL to be the label used by conditional statement GS when its
2731 predicate evaluates to false. */
2733 static inline void
2734 gimple_cond_set_false_label (gimple gs, tree label)
2736 GIMPLE_CHECK (gs, GIMPLE_COND);
2737 gimple_set_op (gs, 3, label);
2741 /* Return the label used by conditional statement GS when its
2742 predicate evaluates to false. */
2744 static inline tree
2745 gimple_cond_false_label (const_gimple gs)
2747 GIMPLE_CHECK (gs, GIMPLE_COND);
2748 return gimple_op (gs, 3);
2752 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2754 static inline void
2755 gimple_cond_make_false (gimple gs)
2757 gimple_cond_set_lhs (gs, boolean_true_node);
2758 gimple_cond_set_rhs (gs, boolean_false_node);
2759 gs->gsbase.subcode = EQ_EXPR;
2763 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2765 static inline void
2766 gimple_cond_make_true (gimple gs)
2768 gimple_cond_set_lhs (gs, boolean_true_node);
2769 gimple_cond_set_rhs (gs, boolean_true_node);
2770 gs->gsbase.subcode = EQ_EXPR;
2773 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2774 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2776 static inline bool
2777 gimple_cond_true_p (const_gimple gs)
2779 tree lhs = gimple_cond_lhs (gs);
2780 tree rhs = gimple_cond_rhs (gs);
2781 enum tree_code code = gimple_cond_code (gs);
2783 if (lhs != boolean_true_node && lhs != boolean_false_node)
2784 return false;
2786 if (rhs != boolean_true_node && rhs != boolean_false_node)
2787 return false;
2789 if (code == NE_EXPR && lhs != rhs)
2790 return true;
2792 if (code == EQ_EXPR && lhs == rhs)
2793 return true;
2795 return false;
2798 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2799 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2801 static inline bool
2802 gimple_cond_false_p (const_gimple gs)
2804 tree lhs = gimple_cond_lhs (gs);
2805 tree rhs = gimple_cond_rhs (gs);
2806 enum tree_code code = gimple_cond_code (gs);
2808 if (lhs != boolean_true_node && lhs != boolean_false_node)
2809 return false;
2811 if (rhs != boolean_true_node && rhs != boolean_false_node)
2812 return false;
2814 if (code == NE_EXPR && lhs == rhs)
2815 return true;
2817 if (code == EQ_EXPR && lhs != rhs)
2818 return true;
2820 return false;
2823 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2825 static inline void
2826 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2828 gimple_cond_set_code (stmt, code);
2829 gimple_cond_set_lhs (stmt, lhs);
2830 gimple_cond_set_rhs (stmt, rhs);
2833 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2835 static inline tree
2836 gimple_label_label (const_gimple gs)
2838 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2839 return gimple_op (gs, 0);
2843 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2844 GS. */
2846 static inline void
2847 gimple_label_set_label (gimple gs, tree label)
2849 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2850 gimple_set_op (gs, 0, label);
2854 /* Return the destination of the unconditional jump GS. */
2856 static inline tree
2857 gimple_goto_dest (const_gimple gs)
2859 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2860 return gimple_op (gs, 0);
2864 /* Set DEST to be the destination of the unconditonal jump GS. */
2866 static inline void
2867 gimple_goto_set_dest (gimple gs, tree dest)
2869 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2870 gimple_set_op (gs, 0, dest);
2874 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2876 static inline tree
2877 gimple_bind_vars (const_gimple gs)
2879 GIMPLE_CHECK (gs, GIMPLE_BIND);
2880 return gs->gimple_bind.vars;
2884 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2885 statement GS. */
2887 static inline void
2888 gimple_bind_set_vars (gimple gs, tree vars)
2890 GIMPLE_CHECK (gs, GIMPLE_BIND);
2891 gs->gimple_bind.vars = vars;
2895 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2896 statement GS. */
2898 static inline void
2899 gimple_bind_append_vars (gimple gs, tree vars)
2901 GIMPLE_CHECK (gs, GIMPLE_BIND);
2902 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2906 static inline gimple_seq *
2907 gimple_bind_body_ptr (gimple gs)
2909 GIMPLE_CHECK (gs, GIMPLE_BIND);
2910 return &gs->gimple_bind.body;
2913 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2915 static inline gimple_seq
2916 gimple_bind_body (gimple gs)
2918 return *gimple_bind_body_ptr (gs);
2922 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2923 statement GS. */
2925 static inline void
2926 gimple_bind_set_body (gimple gs, gimple_seq seq)
2928 GIMPLE_CHECK (gs, GIMPLE_BIND);
2929 gs->gimple_bind.body = seq;
2933 /* Append a statement to the end of a GIMPLE_BIND's body. */
2935 static inline void
2936 gimple_bind_add_stmt (gimple gs, gimple stmt)
2938 GIMPLE_CHECK (gs, GIMPLE_BIND);
2939 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2943 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2945 static inline void
2946 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2948 GIMPLE_CHECK (gs, GIMPLE_BIND);
2949 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2953 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2954 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2956 static inline tree
2957 gimple_bind_block (const_gimple gs)
2959 GIMPLE_CHECK (gs, GIMPLE_BIND);
2960 return gs->gimple_bind.block;
2964 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2965 statement GS. */
2967 static inline void
2968 gimple_bind_set_block (gimple gs, tree block)
2970 GIMPLE_CHECK (gs, GIMPLE_BIND);
2971 gcc_gimple_checking_assert (block == NULL_TREE
2972 || TREE_CODE (block) == BLOCK);
2973 gs->gimple_bind.block = block;
2977 /* Return the number of input operands for GIMPLE_ASM GS. */
2979 static inline unsigned
2980 gimple_asm_ninputs (const_gimple gs)
2982 GIMPLE_CHECK (gs, GIMPLE_ASM);
2983 return gs->gimple_asm.ni;
2987 /* Return the number of output operands for GIMPLE_ASM GS. */
2989 static inline unsigned
2990 gimple_asm_noutputs (const_gimple gs)
2992 GIMPLE_CHECK (gs, GIMPLE_ASM);
2993 return gs->gimple_asm.no;
2997 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2999 static inline unsigned
3000 gimple_asm_nclobbers (const_gimple gs)
3002 GIMPLE_CHECK (gs, GIMPLE_ASM);
3003 return gs->gimple_asm.nc;
3006 /* Return the number of label operands for GIMPLE_ASM GS. */
3008 static inline unsigned
3009 gimple_asm_nlabels (const_gimple gs)
3011 GIMPLE_CHECK (gs, GIMPLE_ASM);
3012 return gs->gimple_asm.nl;
3015 /* Return input operand INDEX of GIMPLE_ASM GS. */
3017 static inline tree
3018 gimple_asm_input_op (const_gimple gs, unsigned index)
3020 GIMPLE_CHECK (gs, GIMPLE_ASM);
3021 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3022 return gimple_op (gs, index + gs->gimple_asm.no);
3025 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3027 static inline tree *
3028 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3030 GIMPLE_CHECK (gs, GIMPLE_ASM);
3031 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3032 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
3036 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3038 static inline void
3039 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3041 GIMPLE_CHECK (gs, GIMPLE_ASM);
3042 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
3043 && TREE_CODE (in_op) == TREE_LIST);
3044 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
3048 /* Return output operand INDEX of GIMPLE_ASM GS. */
3050 static inline tree
3051 gimple_asm_output_op (const_gimple gs, unsigned index)
3053 GIMPLE_CHECK (gs, GIMPLE_ASM);
3054 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3055 return gimple_op (gs, index);
3058 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3060 static inline tree *
3061 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3063 GIMPLE_CHECK (gs, GIMPLE_ASM);
3064 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3065 return gimple_op_ptr (gs, index);
3069 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3071 static inline void
3072 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3074 GIMPLE_CHECK (gs, GIMPLE_ASM);
3075 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3076 && TREE_CODE (out_op) == TREE_LIST);
3077 gimple_set_op (gs, index, out_op);
3081 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3083 static inline tree
3084 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3086 GIMPLE_CHECK (gs, GIMPLE_ASM);
3087 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3088 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3092 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3094 static inline void
3095 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3097 GIMPLE_CHECK (gs, GIMPLE_ASM);
3098 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3099 && TREE_CODE (clobber_op) == TREE_LIST);
3100 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3103 /* Return label operand INDEX of GIMPLE_ASM GS. */
3105 static inline tree
3106 gimple_asm_label_op (const_gimple gs, unsigned index)
3108 GIMPLE_CHECK (gs, GIMPLE_ASM);
3109 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3110 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3113 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3115 static inline void
3116 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3118 GIMPLE_CHECK (gs, GIMPLE_ASM);
3119 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3120 && TREE_CODE (label_op) == TREE_LIST);
3121 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3124 /* Return the string representing the assembly instruction in
3125 GIMPLE_ASM GS. */
3127 static inline const char *
3128 gimple_asm_string (const_gimple gs)
3130 GIMPLE_CHECK (gs, GIMPLE_ASM);
3131 return gs->gimple_asm.string;
3135 /* Return true if GS is an asm statement marked volatile. */
3137 static inline bool
3138 gimple_asm_volatile_p (const_gimple gs)
3140 GIMPLE_CHECK (gs, GIMPLE_ASM);
3141 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3145 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3147 static inline void
3148 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3150 GIMPLE_CHECK (gs, GIMPLE_ASM);
3151 if (volatile_p)
3152 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3153 else
3154 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3158 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3160 static inline void
3161 gimple_asm_set_input (gimple gs, bool input_p)
3163 GIMPLE_CHECK (gs, GIMPLE_ASM);
3164 if (input_p)
3165 gs->gsbase.subcode |= GF_ASM_INPUT;
3166 else
3167 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3171 /* Return true if asm GS is an ASM_INPUT. */
3173 static inline bool
3174 gimple_asm_input_p (const_gimple gs)
3176 GIMPLE_CHECK (gs, GIMPLE_ASM);
3177 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3181 /* Return the types handled by GIMPLE_CATCH statement GS. */
3183 static inline tree
3184 gimple_catch_types (const_gimple gs)
3186 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3187 return gs->gimple_catch.types;
3191 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3193 static inline tree *
3194 gimple_catch_types_ptr (gimple gs)
3196 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3197 return &gs->gimple_catch.types;
3201 /* Return a pointer to the GIMPLE sequence representing the body of
3202 the handler of GIMPLE_CATCH statement GS. */
3204 static inline gimple_seq *
3205 gimple_catch_handler_ptr (gimple gs)
3207 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3208 return &gs->gimple_catch.handler;
3212 /* Return the GIMPLE sequence representing the body of the handler of
3213 GIMPLE_CATCH statement GS. */
3215 static inline gimple_seq
3216 gimple_catch_handler (gimple gs)
3218 return *gimple_catch_handler_ptr (gs);
3222 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3224 static inline void
3225 gimple_catch_set_types (gimple gs, tree t)
3227 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3228 gs->gimple_catch.types = t;
3232 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3234 static inline void
3235 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3237 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3238 gs->gimple_catch.handler = handler;
3242 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3244 static inline tree
3245 gimple_eh_filter_types (const_gimple gs)
3247 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3248 return gs->gimple_eh_filter.types;
3252 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3253 GS. */
3255 static inline tree *
3256 gimple_eh_filter_types_ptr (gimple gs)
3258 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3259 return &gs->gimple_eh_filter.types;
3263 /* Return a pointer to the sequence of statement to execute when
3264 GIMPLE_EH_FILTER statement fails. */
3266 static inline gimple_seq *
3267 gimple_eh_filter_failure_ptr (gimple gs)
3269 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3270 return &gs->gimple_eh_filter.failure;
3274 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3275 statement fails. */
3277 static inline gimple_seq
3278 gimple_eh_filter_failure (gimple gs)
3280 return *gimple_eh_filter_failure_ptr (gs);
3284 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3286 static inline void
3287 gimple_eh_filter_set_types (gimple gs, tree types)
3289 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3290 gs->gimple_eh_filter.types = types;
3294 /* Set FAILURE to be the sequence of statements to execute on failure
3295 for GIMPLE_EH_FILTER GS. */
3297 static inline void
3298 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3300 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3301 gs->gimple_eh_filter.failure = failure;
3304 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3306 static inline tree
3307 gimple_eh_must_not_throw_fndecl (gimple gs)
3309 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3310 return gs->gimple_eh_mnt.fndecl;
3313 /* Set the function decl to be called by GS to DECL. */
3315 static inline void
3316 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3318 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3319 gs->gimple_eh_mnt.fndecl = decl;
3322 /* GIMPLE_EH_ELSE accessors. */
3324 static inline gimple_seq *
3325 gimple_eh_else_n_body_ptr (gimple gs)
3327 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3328 return &gs->gimple_eh_else.n_body;
3331 static inline gimple_seq
3332 gimple_eh_else_n_body (gimple gs)
3334 return *gimple_eh_else_n_body_ptr (gs);
3337 static inline gimple_seq *
3338 gimple_eh_else_e_body_ptr (gimple gs)
3340 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3341 return &gs->gimple_eh_else.e_body;
3344 static inline gimple_seq
3345 gimple_eh_else_e_body (gimple gs)
3347 return *gimple_eh_else_e_body_ptr (gs);
3350 static inline void
3351 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3353 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3354 gs->gimple_eh_else.n_body = seq;
3357 static inline void
3358 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3360 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3361 gs->gimple_eh_else.e_body = seq;
3364 /* GIMPLE_TRY accessors. */
3366 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3367 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3369 static inline enum gimple_try_flags
3370 gimple_try_kind (const_gimple gs)
3372 GIMPLE_CHECK (gs, GIMPLE_TRY);
3373 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3377 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3379 static inline void
3380 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3382 GIMPLE_CHECK (gs, GIMPLE_TRY);
3383 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3384 || kind == GIMPLE_TRY_FINALLY);
3385 if (gimple_try_kind (gs) != kind)
3386 gs->gsbase.subcode = (unsigned int) kind;
3390 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3392 static inline bool
3393 gimple_try_catch_is_cleanup (const_gimple gs)
3395 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3396 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3400 /* Return a pointer to the sequence of statements used as the
3401 body for GIMPLE_TRY GS. */
3403 static inline gimple_seq *
3404 gimple_try_eval_ptr (gimple gs)
3406 GIMPLE_CHECK (gs, GIMPLE_TRY);
3407 return &gs->gimple_try.eval;
3411 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3413 static inline gimple_seq
3414 gimple_try_eval (gimple gs)
3416 return *gimple_try_eval_ptr (gs);
3420 /* Return a pointer to the sequence of statements used as the cleanup body for
3421 GIMPLE_TRY GS. */
3423 static inline gimple_seq *
3424 gimple_try_cleanup_ptr (gimple gs)
3426 GIMPLE_CHECK (gs, GIMPLE_TRY);
3427 return &gs->gimple_try.cleanup;
3431 /* Return the sequence of statements used as the cleanup body for
3432 GIMPLE_TRY GS. */
3434 static inline gimple_seq
3435 gimple_try_cleanup (gimple gs)
3437 return *gimple_try_cleanup_ptr (gs);
3441 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3443 static inline void
3444 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3446 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3447 if (catch_is_cleanup)
3448 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3449 else
3450 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3454 /* Set EVAL to be the sequence of statements to use as the body for
3455 GIMPLE_TRY GS. */
3457 static inline void
3458 gimple_try_set_eval (gimple gs, gimple_seq eval)
3460 GIMPLE_CHECK (gs, GIMPLE_TRY);
3461 gs->gimple_try.eval = eval;
3465 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3466 body for GIMPLE_TRY GS. */
3468 static inline void
3469 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3471 GIMPLE_CHECK (gs, GIMPLE_TRY);
3472 gs->gimple_try.cleanup = cleanup;
3476 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3478 static inline gimple_seq *
3479 gimple_wce_cleanup_ptr (gimple gs)
3481 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3482 return &gs->gimple_wce.cleanup;
3486 /* Return the cleanup sequence for cleanup statement GS. */
3488 static inline gimple_seq
3489 gimple_wce_cleanup (gimple gs)
3491 return *gimple_wce_cleanup_ptr (gs);
3495 /* Set CLEANUP to be the cleanup sequence for GS. */
3497 static inline void
3498 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3500 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3501 gs->gimple_wce.cleanup = cleanup;
3505 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3507 static inline bool
3508 gimple_wce_cleanup_eh_only (const_gimple gs)
3510 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3511 return gs->gsbase.subcode != 0;
3515 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3517 static inline void
3518 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3520 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3521 gs->gsbase.subcode = (unsigned int) eh_only_p;
3525 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3527 static inline unsigned
3528 gimple_phi_capacity (const_gimple gs)
3530 GIMPLE_CHECK (gs, GIMPLE_PHI);
3531 return gs->gimple_phi.capacity;
3535 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3536 be exactly the number of incoming edges for the basic block holding
3537 GS. */
3539 static inline unsigned
3540 gimple_phi_num_args (const_gimple gs)
3542 GIMPLE_CHECK (gs, GIMPLE_PHI);
3543 return gs->gimple_phi.nargs;
3547 /* Return the SSA name created by GIMPLE_PHI GS. */
3549 static inline tree
3550 gimple_phi_result (const_gimple gs)
3552 GIMPLE_CHECK (gs, GIMPLE_PHI);
3553 return gs->gimple_phi.result;
3556 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3558 static inline tree *
3559 gimple_phi_result_ptr (gimple gs)
3561 GIMPLE_CHECK (gs, GIMPLE_PHI);
3562 return &gs->gimple_phi.result;
3565 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3567 static inline void
3568 gimple_phi_set_result (gimple gs, tree result)
3570 GIMPLE_CHECK (gs, GIMPLE_PHI);
3571 gs->gimple_phi.result = result;
3572 if (result && TREE_CODE (result) == SSA_NAME)
3573 SSA_NAME_DEF_STMT (result) = gs;
3577 /* Return the PHI argument corresponding to incoming edge INDEX for
3578 GIMPLE_PHI GS. */
3580 static inline struct phi_arg_d *
3581 gimple_phi_arg (gimple gs, unsigned index)
3583 GIMPLE_CHECK (gs, GIMPLE_PHI);
3584 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3585 return &(gs->gimple_phi.args[index]);
3588 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3589 for GIMPLE_PHI GS. */
3591 static inline void
3592 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3594 GIMPLE_CHECK (gs, GIMPLE_PHI);
3595 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3596 gs->gimple_phi.args[index] = *phiarg;
3599 /* Return the region number for GIMPLE_RESX GS. */
3601 static inline int
3602 gimple_resx_region (const_gimple gs)
3604 GIMPLE_CHECK (gs, GIMPLE_RESX);
3605 return gs->gimple_eh_ctrl.region;
3608 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3610 static inline void
3611 gimple_resx_set_region (gimple gs, int region)
3613 GIMPLE_CHECK (gs, GIMPLE_RESX);
3614 gs->gimple_eh_ctrl.region = region;
3617 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3619 static inline int
3620 gimple_eh_dispatch_region (const_gimple gs)
3622 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3623 return gs->gimple_eh_ctrl.region;
3626 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3628 static inline void
3629 gimple_eh_dispatch_set_region (gimple gs, int region)
3631 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3632 gs->gimple_eh_ctrl.region = region;
3635 /* Return the number of labels associated with the switch statement GS. */
3637 static inline unsigned
3638 gimple_switch_num_labels (const_gimple gs)
3640 unsigned num_ops;
3641 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3642 num_ops = gimple_num_ops (gs);
3643 gcc_gimple_checking_assert (num_ops > 1);
3644 return num_ops - 1;
3648 /* Set NLABELS to be the number of labels for the switch statement GS. */
3650 static inline void
3651 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3653 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3654 gimple_set_num_ops (g, nlabels + 1);
3658 /* Return the index variable used by the switch statement GS. */
3660 static inline tree
3661 gimple_switch_index (const_gimple gs)
3663 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3664 return gimple_op (gs, 0);
3668 /* Return a pointer to the index variable for the switch statement GS. */
3670 static inline tree *
3671 gimple_switch_index_ptr (const_gimple gs)
3673 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3674 return gimple_op_ptr (gs, 0);
3678 /* Set INDEX to be the index variable for switch statement GS. */
3680 static inline void
3681 gimple_switch_set_index (gimple gs, tree index)
3683 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3684 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3685 gimple_set_op (gs, 0, index);
3689 /* Return the label numbered INDEX. The default label is 0, followed by any
3690 labels in a switch statement. */
3692 static inline tree
3693 gimple_switch_label (const_gimple gs, unsigned index)
3695 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3696 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3697 return gimple_op (gs, index + 1);
3700 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3702 static inline void
3703 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3705 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3706 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3707 && (label == NULL_TREE
3708 || TREE_CODE (label) == CASE_LABEL_EXPR));
3709 gimple_set_op (gs, index + 1, label);
3712 /* Return the default label for a switch statement. */
3714 static inline tree
3715 gimple_switch_default_label (const_gimple gs)
3717 tree label = gimple_switch_label (gs, 0);
3718 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3719 return label;
3722 /* Set the default label for a switch statement. */
3724 static inline void
3725 gimple_switch_set_default_label (gimple gs, tree label)
3727 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3728 gimple_switch_set_label (gs, 0, label);
3731 /* Return true if GS is a GIMPLE_DEBUG statement. */
3733 static inline bool
3734 is_gimple_debug (const_gimple gs)
3736 return gimple_code (gs) == GIMPLE_DEBUG;
3739 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3741 static inline bool
3742 gimple_debug_bind_p (const_gimple s)
3744 if (is_gimple_debug (s))
3745 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3747 return false;
3750 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3752 static inline tree
3753 gimple_debug_bind_get_var (gimple dbg)
3755 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3756 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3757 return gimple_op (dbg, 0);
3760 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3761 statement. */
3763 static inline tree
3764 gimple_debug_bind_get_value (gimple dbg)
3766 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3767 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3768 return gimple_op (dbg, 1);
3771 /* Return a pointer to the value bound to the variable in a
3772 GIMPLE_DEBUG bind statement. */
3774 static inline tree *
3775 gimple_debug_bind_get_value_ptr (gimple dbg)
3777 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3778 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3779 return gimple_op_ptr (dbg, 1);
3782 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3784 static inline void
3785 gimple_debug_bind_set_var (gimple dbg, tree var)
3787 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3788 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3789 gimple_set_op (dbg, 0, var);
3792 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3793 statement. */
3795 static inline void
3796 gimple_debug_bind_set_value (gimple dbg, tree value)
3798 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3799 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3800 gimple_set_op (dbg, 1, value);
3803 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3804 optimized away. */
3805 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3807 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3808 statement. */
3810 static inline void
3811 gimple_debug_bind_reset_value (gimple dbg)
3813 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3814 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3815 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3818 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3819 value. */
3821 static inline bool
3822 gimple_debug_bind_has_value_p (gimple dbg)
3824 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3825 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3826 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3829 #undef GIMPLE_DEBUG_BIND_NOVALUE
3831 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3833 static inline bool
3834 gimple_debug_source_bind_p (const_gimple s)
3836 if (is_gimple_debug (s))
3837 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3839 return false;
3842 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3844 static inline tree
3845 gimple_debug_source_bind_get_var (gimple dbg)
3847 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3848 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3849 return gimple_op (dbg, 0);
3852 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3853 statement. */
3855 static inline tree
3856 gimple_debug_source_bind_get_value (gimple dbg)
3858 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3859 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3860 return gimple_op (dbg, 1);
3863 /* Return a pointer to the value bound to the variable in a
3864 GIMPLE_DEBUG source bind statement. */
3866 static inline tree *
3867 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3869 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3870 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3871 return gimple_op_ptr (dbg, 1);
3874 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3876 static inline void
3877 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3879 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3880 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3881 gimple_set_op (dbg, 0, var);
3884 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3885 statement. */
3887 static inline void
3888 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3890 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3891 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3892 gimple_set_op (dbg, 1, value);
3895 /* Return a pointer to the body for the OMP statement GS. */
3897 static inline gimple_seq *
3898 gimple_omp_body_ptr (gimple gs)
3900 return &gs->omp.body;
3903 /* Return the body for the OMP statement GS. */
3905 static inline gimple_seq
3906 gimple_omp_body (gimple gs)
3908 return *gimple_omp_body_ptr (gs);
3911 /* Set BODY to be the body for the OMP statement GS. */
3913 static inline void
3914 gimple_omp_set_body (gimple gs, gimple_seq body)
3916 gs->omp.body = body;
3920 /* Return the name associated with OMP_CRITICAL statement GS. */
3922 static inline tree
3923 gimple_omp_critical_name (const_gimple gs)
3925 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3926 return gs->gimple_omp_critical.name;
3930 /* Return a pointer to the name associated with OMP critical statement GS. */
3932 static inline tree *
3933 gimple_omp_critical_name_ptr (gimple gs)
3935 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3936 return &gs->gimple_omp_critical.name;
3940 /* Set NAME to be the name associated with OMP critical statement GS. */
3942 static inline void
3943 gimple_omp_critical_set_name (gimple gs, tree name)
3945 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3946 gs->gimple_omp_critical.name = name;
3950 /* Return the kind of OMP for statemement. */
3952 static inline int
3953 gimple_omp_for_kind (const_gimple g)
3955 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3956 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
3960 /* Set the OMP for kind. */
3962 static inline void
3963 gimple_omp_for_set_kind (gimple g, int kind)
3965 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3966 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_FOR_KIND_MASK)
3967 | (kind & GF_OMP_FOR_KIND_MASK);
3971 /* Return the clauses associated with OMP_FOR GS. */
3973 static inline tree
3974 gimple_omp_for_clauses (const_gimple gs)
3976 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3977 return gs->gimple_omp_for.clauses;
3981 /* Return a pointer to the OMP_FOR GS. */
3983 static inline tree *
3984 gimple_omp_for_clauses_ptr (gimple gs)
3986 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3987 return &gs->gimple_omp_for.clauses;
3991 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3993 static inline void
3994 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3996 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3997 gs->gimple_omp_for.clauses = clauses;
4001 /* Get the collapse count of OMP_FOR GS. */
4003 static inline size_t
4004 gimple_omp_for_collapse (gimple gs)
4006 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4007 return gs->gimple_omp_for.collapse;
4011 /* Return the index variable for OMP_FOR GS. */
4013 static inline tree
4014 gimple_omp_for_index (const_gimple gs, size_t i)
4016 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4017 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4018 return gs->gimple_omp_for.iter[i].index;
4022 /* Return a pointer to the index variable for OMP_FOR GS. */
4024 static inline tree *
4025 gimple_omp_for_index_ptr (gimple gs, size_t i)
4027 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4028 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4029 return &gs->gimple_omp_for.iter[i].index;
4033 /* Set INDEX to be the index variable for OMP_FOR GS. */
4035 static inline void
4036 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4038 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4039 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4040 gs->gimple_omp_for.iter[i].index = index;
4044 /* Return the initial value for OMP_FOR GS. */
4046 static inline tree
4047 gimple_omp_for_initial (const_gimple gs, size_t i)
4049 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4050 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4051 return gs->gimple_omp_for.iter[i].initial;
4055 /* Return a pointer to the initial value for OMP_FOR GS. */
4057 static inline tree *
4058 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4060 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4061 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4062 return &gs->gimple_omp_for.iter[i].initial;
4066 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4068 static inline void
4069 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4071 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4072 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4073 gs->gimple_omp_for.iter[i].initial = initial;
4077 /* Return the final value for OMP_FOR GS. */
4079 static inline tree
4080 gimple_omp_for_final (const_gimple gs, size_t i)
4082 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4083 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4084 return gs->gimple_omp_for.iter[i].final;
4088 /* Return a pointer to the final value for OMP_FOR GS. */
4090 static inline tree *
4091 gimple_omp_for_final_ptr (gimple gs, size_t i)
4093 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4094 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4095 return &gs->gimple_omp_for.iter[i].final;
4099 /* Set FINAL to be the final value for OMP_FOR GS. */
4101 static inline void
4102 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4104 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4105 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4106 gs->gimple_omp_for.iter[i].final = final;
4110 /* Return the increment value for OMP_FOR GS. */
4112 static inline tree
4113 gimple_omp_for_incr (const_gimple gs, size_t i)
4115 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4116 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4117 return gs->gimple_omp_for.iter[i].incr;
4121 /* Return a pointer to the increment value for OMP_FOR GS. */
4123 static inline tree *
4124 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4126 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4127 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4128 return &gs->gimple_omp_for.iter[i].incr;
4132 /* Set INCR to be the increment value for OMP_FOR GS. */
4134 static inline void
4135 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4137 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4138 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4139 gs->gimple_omp_for.iter[i].incr = incr;
4143 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4144 statement GS starts. */
4146 static inline gimple_seq *
4147 gimple_omp_for_pre_body_ptr (gimple gs)
4149 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4150 return &gs->gimple_omp_for.pre_body;
4154 /* Return the sequence of statements to execute before the OMP_FOR
4155 statement GS starts. */
4157 static inline gimple_seq
4158 gimple_omp_for_pre_body (gimple gs)
4160 return *gimple_omp_for_pre_body_ptr (gs);
4164 /* Set PRE_BODY to be the sequence of statements to execute before the
4165 OMP_FOR statement GS starts. */
4167 static inline void
4168 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4170 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4171 gs->gimple_omp_for.pre_body = pre_body;
4175 /* Return the clauses associated with OMP_PARALLEL GS. */
4177 static inline tree
4178 gimple_omp_parallel_clauses (const_gimple gs)
4180 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4181 return gs->gimple_omp_parallel.clauses;
4185 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4187 static inline tree *
4188 gimple_omp_parallel_clauses_ptr (gimple gs)
4190 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4191 return &gs->gimple_omp_parallel.clauses;
4195 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4196 GS. */
4198 static inline void
4199 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4201 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4202 gs->gimple_omp_parallel.clauses = clauses;
4206 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4208 static inline tree
4209 gimple_omp_parallel_child_fn (const_gimple gs)
4211 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4212 return gs->gimple_omp_parallel.child_fn;
4215 /* Return a pointer to the child function used to hold the body of
4216 OMP_PARALLEL GS. */
4218 static inline tree *
4219 gimple_omp_parallel_child_fn_ptr (gimple gs)
4221 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4222 return &gs->gimple_omp_parallel.child_fn;
4226 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4228 static inline void
4229 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4231 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4232 gs->gimple_omp_parallel.child_fn = child_fn;
4236 /* Return the artificial argument used to send variables and values
4237 from the parent to the children threads in OMP_PARALLEL GS. */
4239 static inline tree
4240 gimple_omp_parallel_data_arg (const_gimple gs)
4242 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4243 return gs->gimple_omp_parallel.data_arg;
4247 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4249 static inline tree *
4250 gimple_omp_parallel_data_arg_ptr (gimple gs)
4252 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4253 return &gs->gimple_omp_parallel.data_arg;
4257 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4259 static inline void
4260 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4262 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4263 gs->gimple_omp_parallel.data_arg = data_arg;
4267 /* Return the clauses associated with OMP_TASK GS. */
4269 static inline tree
4270 gimple_omp_task_clauses (const_gimple gs)
4272 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4273 return gs->gimple_omp_parallel.clauses;
4277 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4279 static inline tree *
4280 gimple_omp_task_clauses_ptr (gimple gs)
4282 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4283 return &gs->gimple_omp_parallel.clauses;
4287 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4288 GS. */
4290 static inline void
4291 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4293 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4294 gs->gimple_omp_parallel.clauses = clauses;
4298 /* Return the child function used to hold the body of OMP_TASK GS. */
4300 static inline tree
4301 gimple_omp_task_child_fn (const_gimple gs)
4303 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4304 return gs->gimple_omp_parallel.child_fn;
4307 /* Return a pointer to the child function used to hold the body of
4308 OMP_TASK GS. */
4310 static inline tree *
4311 gimple_omp_task_child_fn_ptr (gimple gs)
4313 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4314 return &gs->gimple_omp_parallel.child_fn;
4318 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4320 static inline void
4321 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4323 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4324 gs->gimple_omp_parallel.child_fn = child_fn;
4328 /* Return the artificial argument used to send variables and values
4329 from the parent to the children threads in OMP_TASK GS. */
4331 static inline tree
4332 gimple_omp_task_data_arg (const_gimple gs)
4334 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4335 return gs->gimple_omp_parallel.data_arg;
4339 /* Return a pointer to the data argument for OMP_TASK GS. */
4341 static inline tree *
4342 gimple_omp_task_data_arg_ptr (gimple gs)
4344 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4345 return &gs->gimple_omp_parallel.data_arg;
4349 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4351 static inline void
4352 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4354 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4355 gs->gimple_omp_parallel.data_arg = data_arg;
4359 /* Return the clauses associated with OMP_TASK GS. */
4361 static inline tree
4362 gimple_omp_taskreg_clauses (const_gimple gs)
4364 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4365 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4366 return gs->gimple_omp_parallel.clauses;
4370 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4372 static inline tree *
4373 gimple_omp_taskreg_clauses_ptr (gimple gs)
4375 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4376 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4377 return &gs->gimple_omp_parallel.clauses;
4381 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4382 GS. */
4384 static inline void
4385 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4387 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4388 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4389 gs->gimple_omp_parallel.clauses = clauses;
4393 /* Return the child function used to hold the body of OMP_TASK GS. */
4395 static inline tree
4396 gimple_omp_taskreg_child_fn (const_gimple gs)
4398 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4399 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4400 return gs->gimple_omp_parallel.child_fn;
4403 /* Return a pointer to the child function used to hold the body of
4404 OMP_TASK GS. */
4406 static inline tree *
4407 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4409 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4410 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4411 return &gs->gimple_omp_parallel.child_fn;
4415 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4417 static inline void
4418 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4420 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4421 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4422 gs->gimple_omp_parallel.child_fn = child_fn;
4426 /* Return the artificial argument used to send variables and values
4427 from the parent to the children threads in OMP_TASK GS. */
4429 static inline tree
4430 gimple_omp_taskreg_data_arg (const_gimple gs)
4432 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4433 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4434 return gs->gimple_omp_parallel.data_arg;
4438 /* Return a pointer to the data argument for OMP_TASK GS. */
4440 static inline tree *
4441 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4443 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4444 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4445 return &gs->gimple_omp_parallel.data_arg;
4449 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4451 static inline void
4452 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4454 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4455 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4456 gs->gimple_omp_parallel.data_arg = data_arg;
4460 /* Return the copy function used to hold the body of OMP_TASK GS. */
4462 static inline tree
4463 gimple_omp_task_copy_fn (const_gimple gs)
4465 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4466 return gs->gimple_omp_task.copy_fn;
4469 /* Return a pointer to the copy function used to hold the body of
4470 OMP_TASK GS. */
4472 static inline tree *
4473 gimple_omp_task_copy_fn_ptr (gimple gs)
4475 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4476 return &gs->gimple_omp_task.copy_fn;
4480 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4482 static inline void
4483 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4485 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4486 gs->gimple_omp_task.copy_fn = copy_fn;
4490 /* Return size of the data block in bytes in OMP_TASK GS. */
4492 static inline tree
4493 gimple_omp_task_arg_size (const_gimple gs)
4495 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4496 return gs->gimple_omp_task.arg_size;
4500 /* Return a pointer to the data block size for OMP_TASK GS. */
4502 static inline tree *
4503 gimple_omp_task_arg_size_ptr (gimple gs)
4505 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4506 return &gs->gimple_omp_task.arg_size;
4510 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4512 static inline void
4513 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4515 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4516 gs->gimple_omp_task.arg_size = arg_size;
4520 /* Return align of the data block in bytes in OMP_TASK GS. */
4522 static inline tree
4523 gimple_omp_task_arg_align (const_gimple gs)
4525 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4526 return gs->gimple_omp_task.arg_align;
4530 /* Return a pointer to the data block align for OMP_TASK GS. */
4532 static inline tree *
4533 gimple_omp_task_arg_align_ptr (gimple gs)
4535 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4536 return &gs->gimple_omp_task.arg_align;
4540 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4542 static inline void
4543 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4545 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4546 gs->gimple_omp_task.arg_align = arg_align;
4550 /* Return the clauses associated with OMP_SINGLE GS. */
4552 static inline tree
4553 gimple_omp_single_clauses (const_gimple gs)
4555 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4556 return gs->gimple_omp_single.clauses;
4560 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4562 static inline tree *
4563 gimple_omp_single_clauses_ptr (gimple gs)
4565 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4566 return &gs->gimple_omp_single.clauses;
4570 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4572 static inline void
4573 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4575 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4576 gs->gimple_omp_single.clauses = clauses;
4580 /* Return the clauses associated with OMP_SECTIONS GS. */
4582 static inline tree
4583 gimple_omp_sections_clauses (const_gimple gs)
4585 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4586 return gs->gimple_omp_sections.clauses;
4590 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4592 static inline tree *
4593 gimple_omp_sections_clauses_ptr (gimple gs)
4595 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4596 return &gs->gimple_omp_sections.clauses;
4600 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4601 GS. */
4603 static inline void
4604 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4606 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4607 gs->gimple_omp_sections.clauses = clauses;
4611 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4612 in GS. */
4614 static inline tree
4615 gimple_omp_sections_control (const_gimple gs)
4617 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4618 return gs->gimple_omp_sections.control;
4622 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4623 GS. */
4625 static inline tree *
4626 gimple_omp_sections_control_ptr (gimple gs)
4628 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4629 return &gs->gimple_omp_sections.control;
4633 /* Set CONTROL to be the set of clauses associated with the
4634 GIMPLE_OMP_SECTIONS in GS. */
4636 static inline void
4637 gimple_omp_sections_set_control (gimple gs, tree control)
4639 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4640 gs->gimple_omp_sections.control = control;
4644 /* Set COND to be the condition code for OMP_FOR GS. */
4646 static inline void
4647 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4649 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4650 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4651 && i < gs->gimple_omp_for.collapse);
4652 gs->gimple_omp_for.iter[i].cond = cond;
4656 /* Return the condition code associated with OMP_FOR GS. */
4658 static inline enum tree_code
4659 gimple_omp_for_cond (const_gimple gs, size_t i)
4661 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4662 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4663 return gs->gimple_omp_for.iter[i].cond;
4667 /* Set the value being stored in an atomic store. */
4669 static inline void
4670 gimple_omp_atomic_store_set_val (gimple g, tree val)
4672 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4673 g->gimple_omp_atomic_store.val = val;
4677 /* Return the value being stored in an atomic store. */
4679 static inline tree
4680 gimple_omp_atomic_store_val (const_gimple g)
4682 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4683 return g->gimple_omp_atomic_store.val;
4687 /* Return a pointer to the value being stored in an atomic store. */
4689 static inline tree *
4690 gimple_omp_atomic_store_val_ptr (gimple g)
4692 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4693 return &g->gimple_omp_atomic_store.val;
4697 /* Set the LHS of an atomic load. */
4699 static inline void
4700 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4702 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4703 g->gimple_omp_atomic_load.lhs = lhs;
4707 /* Get the LHS of an atomic load. */
4709 static inline tree
4710 gimple_omp_atomic_load_lhs (const_gimple g)
4712 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4713 return g->gimple_omp_atomic_load.lhs;
4717 /* Return a pointer to the LHS of an atomic load. */
4719 static inline tree *
4720 gimple_omp_atomic_load_lhs_ptr (gimple g)
4722 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4723 return &g->gimple_omp_atomic_load.lhs;
4727 /* Set the RHS of an atomic load. */
4729 static inline void
4730 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4732 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4733 g->gimple_omp_atomic_load.rhs = rhs;
4737 /* Get the RHS of an atomic load. */
4739 static inline tree
4740 gimple_omp_atomic_load_rhs (const_gimple g)
4742 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4743 return g->gimple_omp_atomic_load.rhs;
4747 /* Return a pointer to the RHS of an atomic load. */
4749 static inline tree *
4750 gimple_omp_atomic_load_rhs_ptr (gimple g)
4752 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4753 return &g->gimple_omp_atomic_load.rhs;
4757 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4759 static inline tree
4760 gimple_omp_continue_control_def (const_gimple g)
4762 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4763 return g->gimple_omp_continue.control_def;
4766 /* The same as above, but return the address. */
4768 static inline tree *
4769 gimple_omp_continue_control_def_ptr (gimple g)
4771 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4772 return &g->gimple_omp_continue.control_def;
4775 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4777 static inline void
4778 gimple_omp_continue_set_control_def (gimple g, tree def)
4780 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4781 g->gimple_omp_continue.control_def = def;
4785 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4787 static inline tree
4788 gimple_omp_continue_control_use (const_gimple g)
4790 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4791 return g->gimple_omp_continue.control_use;
4795 /* The same as above, but return the address. */
4797 static inline tree *
4798 gimple_omp_continue_control_use_ptr (gimple g)
4800 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4801 return &g->gimple_omp_continue.control_use;
4805 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4807 static inline void
4808 gimple_omp_continue_set_control_use (gimple g, tree use)
4810 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4811 g->gimple_omp_continue.control_use = use;
4814 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4816 static inline gimple_seq *
4817 gimple_transaction_body_ptr (gimple gs)
4819 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4820 return &gs->gimple_transaction.body;
4823 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4825 static inline gimple_seq
4826 gimple_transaction_body (gimple gs)
4828 return *gimple_transaction_body_ptr (gs);
4831 /* Return the label associated with a GIMPLE_TRANSACTION. */
4833 static inline tree
4834 gimple_transaction_label (const_gimple gs)
4836 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4837 return gs->gimple_transaction.label;
4840 static inline tree *
4841 gimple_transaction_label_ptr (gimple gs)
4843 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4844 return &gs->gimple_transaction.label;
4847 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4849 static inline unsigned int
4850 gimple_transaction_subcode (const_gimple gs)
4852 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4853 return gs->gsbase.subcode;
4856 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4858 static inline void
4859 gimple_transaction_set_body (gimple gs, gimple_seq body)
4861 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4862 gs->gimple_transaction.body = body;
4865 /* Set the label associated with a GIMPLE_TRANSACTION. */
4867 static inline void
4868 gimple_transaction_set_label (gimple gs, tree label)
4870 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4871 gs->gimple_transaction.label = label;
4874 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4876 static inline void
4877 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4879 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4880 gs->gsbase.subcode = subcode;
4884 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4886 static inline tree *
4887 gimple_return_retval_ptr (const_gimple gs)
4889 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4890 return gimple_op_ptr (gs, 0);
4893 /* Return the return value for GIMPLE_RETURN GS. */
4895 static inline tree
4896 gimple_return_retval (const_gimple gs)
4898 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4899 return gimple_op (gs, 0);
4903 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4905 static inline void
4906 gimple_return_set_retval (gimple gs, tree retval)
4908 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4909 gimple_set_op (gs, 0, retval);
4913 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4915 #define CASE_GIMPLE_OMP \
4916 case GIMPLE_OMP_PARALLEL: \
4917 case GIMPLE_OMP_TASK: \
4918 case GIMPLE_OMP_FOR: \
4919 case GIMPLE_OMP_SECTIONS: \
4920 case GIMPLE_OMP_SECTIONS_SWITCH: \
4921 case GIMPLE_OMP_SINGLE: \
4922 case GIMPLE_OMP_SECTION: \
4923 case GIMPLE_OMP_MASTER: \
4924 case GIMPLE_OMP_ORDERED: \
4925 case GIMPLE_OMP_CRITICAL: \
4926 case GIMPLE_OMP_RETURN: \
4927 case GIMPLE_OMP_ATOMIC_LOAD: \
4928 case GIMPLE_OMP_ATOMIC_STORE: \
4929 case GIMPLE_OMP_CONTINUE
4931 static inline bool
4932 is_gimple_omp (const_gimple stmt)
4934 switch (gimple_code (stmt))
4936 CASE_GIMPLE_OMP:
4937 return true;
4938 default:
4939 return false;
4944 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4946 static inline bool
4947 gimple_nop_p (const_gimple g)
4949 return gimple_code (g) == GIMPLE_NOP;
4953 /* Return true if GS is a GIMPLE_RESX. */
4955 static inline bool
4956 is_gimple_resx (const_gimple gs)
4958 return gimple_code (gs) == GIMPLE_RESX;
4961 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4963 static inline enum br_predictor
4964 gimple_predict_predictor (gimple gs)
4966 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4967 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4971 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4973 static inline void
4974 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4976 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4977 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4978 | (unsigned) predictor;
4982 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4984 static inline enum prediction
4985 gimple_predict_outcome (gimple gs)
4987 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4988 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4992 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4994 static inline void
4995 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4997 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4998 if (outcome == TAKEN)
4999 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
5000 else
5001 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
5005 /* Return the type of the main expression computed by STMT. Return
5006 void_type_node if the statement computes nothing. */
5008 static inline tree
5009 gimple_expr_type (const_gimple stmt)
5011 enum gimple_code code = gimple_code (stmt);
5013 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5015 tree type;
5016 /* In general we want to pass out a type that can be substituted
5017 for both the RHS and the LHS types if there is a possibly
5018 useless conversion involved. That means returning the
5019 original RHS type as far as we can reconstruct it. */
5020 if (code == GIMPLE_CALL)
5021 type = gimple_call_return_type (stmt);
5022 else
5023 switch (gimple_assign_rhs_code (stmt))
5025 case POINTER_PLUS_EXPR:
5026 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5027 break;
5029 default:
5030 /* As fallback use the type of the LHS. */
5031 type = TREE_TYPE (gimple_get_lhs (stmt));
5032 break;
5034 return type;
5036 else if (code == GIMPLE_COND)
5037 return boolean_type_node;
5038 else
5039 return void_type_node;
5042 /* Return true if TYPE is a suitable type for a scalar register variable. */
5044 static inline bool
5045 is_gimple_reg_type (tree type)
5047 return !AGGREGATE_TYPE_P (type);
5050 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5052 static inline gimple_stmt_iterator
5053 gsi_start_1 (gimple_seq *seq)
5055 gimple_stmt_iterator i;
5057 i.ptr = gimple_seq_first (*seq);
5058 i.seq = seq;
5059 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5061 return i;
5064 #define gsi_start(x) gsi_start_1(&(x))
5066 static inline gimple_stmt_iterator
5067 gsi_none (void)
5069 gimple_stmt_iterator i;
5070 i.ptr = NULL;
5071 i.seq = NULL;
5072 i.bb = NULL;
5073 return i;
5076 /* Return a new iterator pointing to the first statement in basic block BB. */
5078 static inline gimple_stmt_iterator
5079 gsi_start_bb (basic_block bb)
5081 gimple_stmt_iterator i;
5082 gimple_seq *seq;
5084 seq = bb_seq_addr (bb);
5085 i.ptr = gimple_seq_first (*seq);
5086 i.seq = seq;
5087 i.bb = bb;
5089 return i;
5093 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5095 static inline gimple_stmt_iterator
5096 gsi_last_1 (gimple_seq *seq)
5098 gimple_stmt_iterator i;
5100 i.ptr = gimple_seq_last (*seq);
5101 i.seq = seq;
5102 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5104 return i;
5107 #define gsi_last(x) gsi_last_1(&(x))
5109 /* Return a new iterator pointing to the last statement in basic block BB. */
5111 static inline gimple_stmt_iterator
5112 gsi_last_bb (basic_block bb)
5114 gimple_stmt_iterator i;
5115 gimple_seq *seq;
5117 seq = bb_seq_addr (bb);
5118 i.ptr = gimple_seq_last (*seq);
5119 i.seq = seq;
5120 i.bb = bb;
5122 return i;
5126 /* Return true if I is at the end of its sequence. */
5128 static inline bool
5129 gsi_end_p (gimple_stmt_iterator i)
5131 return i.ptr == NULL;
5135 /* Return true if I is one statement before the end of its sequence. */
5137 static inline bool
5138 gsi_one_before_end_p (gimple_stmt_iterator i)
5140 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5144 /* Advance the iterator to the next gimple statement. */
5146 static inline void
5147 gsi_next (gimple_stmt_iterator *i)
5149 i->ptr = i->ptr->gsbase.next;
5152 /* Advance the iterator to the previous gimple statement. */
5154 static inline void
5155 gsi_prev (gimple_stmt_iterator *i)
5157 gimple prev = i->ptr->gsbase.prev;
5158 if (prev->gsbase.next)
5159 i->ptr = prev;
5160 else
5161 i->ptr = NULL;
5164 /* Return the current stmt. */
5166 static inline gimple
5167 gsi_stmt (gimple_stmt_iterator i)
5169 return i.ptr;
5172 /* Return a block statement iterator that points to the first non-label
5173 statement in block BB. */
5175 static inline gimple_stmt_iterator
5176 gsi_after_labels (basic_block bb)
5178 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5180 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5181 gsi_next (&gsi);
5183 return gsi;
5186 /* Advance the iterator to the next non-debug gimple statement. */
5188 static inline void
5189 gsi_next_nondebug (gimple_stmt_iterator *i)
5193 gsi_next (i);
5195 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5198 /* Advance the iterator to the next non-debug gimple statement. */
5200 static inline void
5201 gsi_prev_nondebug (gimple_stmt_iterator *i)
5205 gsi_prev (i);
5207 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5210 /* Return a new iterator pointing to the first non-debug statement in
5211 basic block BB. */
5213 static inline gimple_stmt_iterator
5214 gsi_start_nondebug_bb (basic_block bb)
5216 gimple_stmt_iterator i = gsi_start_bb (bb);
5218 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5219 gsi_next_nondebug (&i);
5221 return i;
5224 /* Return a new iterator pointing to the last non-debug statement in
5225 basic block BB. */
5227 static inline gimple_stmt_iterator
5228 gsi_last_nondebug_bb (basic_block bb)
5230 gimple_stmt_iterator i = gsi_last_bb (bb);
5232 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5233 gsi_prev_nondebug (&i);
5235 return i;
5239 /* Return the basic block associated with this iterator. */
5241 static inline basic_block
5242 gsi_bb (gimple_stmt_iterator i)
5244 return i.bb;
5248 /* Return the sequence associated with this iterator. */
5250 static inline gimple_seq
5251 gsi_seq (gimple_stmt_iterator i)
5253 return *i.seq;
5257 enum gsi_iterator_update
5259 GSI_NEW_STMT, /* Only valid when single statement is added, move
5260 iterator to it. */
5261 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5262 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5263 for linking other statements in the same
5264 direction. */
5267 /* In gimple-iterator.c */
5268 gimple_stmt_iterator gsi_start_phis (basic_block);
5269 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5270 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5271 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5272 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5273 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5274 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5275 enum gsi_iterator_update);
5276 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5277 enum gsi_iterator_update);
5278 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5279 enum gsi_iterator_update);
5280 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5281 enum gsi_iterator_update);
5282 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5283 enum gsi_iterator_update);
5284 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5285 enum gsi_iterator_update);
5286 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5287 enum gsi_iterator_update);
5288 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5289 enum gsi_iterator_update);
5290 bool gsi_remove (gimple_stmt_iterator *, bool);
5291 gimple_stmt_iterator gsi_for_stmt (gimple);
5292 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5293 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5294 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5295 void gsi_insert_on_edge (edge, gimple);
5296 void gsi_insert_seq_on_edge (edge, gimple_seq);
5297 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5298 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5299 void gsi_commit_one_edge_insert (edge, basic_block *);
5300 void gsi_commit_edge_inserts (void);
5301 gimple gimple_call_copy_skip_args (gimple, bitmap);
5304 /* Convenience routines to walk all statements of a gimple function.
5305 Note that this is useful exclusively before the code is converted
5306 into SSA form. Once the program is in SSA form, the standard
5307 operand interface should be used to analyze/modify statements. */
5308 struct walk_stmt_info
5310 /* Points to the current statement being walked. */
5311 gimple_stmt_iterator gsi;
5313 /* Additional data that the callback functions may want to carry
5314 through the recursion. */
5315 void *info;
5317 /* Pointer map used to mark visited tree nodes when calling
5318 walk_tree on each operand. If set to NULL, duplicate tree nodes
5319 will be visited more than once. */
5320 struct pointer_set_t *pset;
5322 /* Operand returned by the callbacks. This is set when calling
5323 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5324 returns non-NULL, this field will contain the tree returned by
5325 the last callback. */
5326 tree callback_result;
5328 /* Indicates whether the operand being examined may be replaced
5329 with something that matches is_gimple_val (if true) or something
5330 slightly more complicated (if false). "Something" technically
5331 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5332 but we never try to form anything more complicated than that, so
5333 we don't bother checking.
5335 Also note that CALLBACK should update this flag while walking the
5336 sub-expressions of a statement. For instance, when walking the
5337 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5338 to true, however, when walking &var, the operand of that
5339 ADDR_EXPR does not need to be a GIMPLE value. */
5340 BOOL_BITFIELD val_only : 1;
5342 /* True if we are currently walking the LHS of an assignment. */
5343 BOOL_BITFIELD is_lhs : 1;
5345 /* Optional. Set to true by the callback functions if they made any
5346 changes. */
5347 BOOL_BITFIELD changed : 1;
5349 /* True if we're interested in location information. */
5350 BOOL_BITFIELD want_locations : 1;
5352 /* True if we've removed the statement that was processed. */
5353 BOOL_BITFIELD removed_stmt : 1;
5356 /* Callback for walk_gimple_stmt. Called for every statement found
5357 during traversal. The first argument points to the statement to
5358 walk. The second argument is a flag that the callback sets to
5359 'true' if it the callback handled all the operands and
5360 sub-statements of the statement (the default value of this flag is
5361 'false'). The third argument is an anonymous pointer to data
5362 to be used by the callback. */
5363 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5364 struct walk_stmt_info *);
5366 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5367 struct walk_stmt_info *);
5368 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5369 struct walk_stmt_info *);
5370 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5371 struct walk_stmt_info *);
5372 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5374 /* Enum and arrays used for allocation stats. Keep in sync with
5375 gimple.c:gimple_alloc_kind_names. */
5376 enum gimple_alloc_kind
5378 gimple_alloc_kind_assign, /* Assignments. */
5379 gimple_alloc_kind_phi, /* PHI nodes. */
5380 gimple_alloc_kind_cond, /* Conditionals. */
5381 gimple_alloc_kind_rest, /* Everything else. */
5382 gimple_alloc_kind_all
5385 extern int gimple_alloc_counts[];
5386 extern int gimple_alloc_sizes[];
5388 /* Return the allocation kind for a given stmt CODE. */
5389 static inline enum gimple_alloc_kind
5390 gimple_alloc_kind (enum gimple_code code)
5392 switch (code)
5394 case GIMPLE_ASSIGN:
5395 return gimple_alloc_kind_assign;
5396 case GIMPLE_PHI:
5397 return gimple_alloc_kind_phi;
5398 case GIMPLE_COND:
5399 return gimple_alloc_kind_cond;
5400 default:
5401 return gimple_alloc_kind_rest;
5405 extern void dump_gimple_statistics (void);
5407 /* In gimple-fold.c. */
5408 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5409 tree gimple_fold_builtin (gimple);
5410 bool fold_stmt (gimple_stmt_iterator *);
5411 bool fold_stmt_inplace (gimple_stmt_iterator *);
5412 tree get_symbol_constant_value (tree);
5413 tree canonicalize_constructor_val (tree, tree);
5414 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5415 enum tree_code, tree, tree);
5416 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5417 enum tree_code, tree, tree);
5419 bool gimple_val_nonnegative_real_p (tree);
5422 /* Set the location of all statements in SEQ to LOC. */
5424 static inline void
5425 gimple_seq_set_location (gimple_seq seq, location_t loc)
5427 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5428 gimple_set_location (gsi_stmt (i), loc);
5431 #endif /* GCC_GIMPLE_H */