Merge trunk version 202825 into gupc branch.
[official-gcc.git] / gcc / gimple.h
blob789a7f02338f92cabfe733472f333d386d71ee60
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 bool flag_instrument_functions_exclude_p (tree);
1071 extern gimple gimple_current_bind_expr (void);
1072 extern vec<gimple> gimple_bind_expr_stack (void);
1073 extern tree voidify_wrapper_expr (tree, tree);
1074 extern tree build_and_jump (tree *);
1075 extern tree force_labels_r (tree *, int *, void *);
1076 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1077 gimple_seq *);
1078 struct gimplify_omp_ctx;
1079 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1080 extern tree gimple_boolify (tree);
1081 extern gimple_predicate rhs_predicate_for (tree);
1082 extern tree canonicalize_cond_expr_cond (tree);
1084 /* In omp-low.c. */
1085 extern tree omp_reduction_init (tree, tree);
1087 /* In trans-mem.c. */
1088 extern void diagnose_tm_safe_errors (tree);
1089 extern void compute_transaction_bits (void);
1091 /* In tree-nested.c. */
1092 extern void lower_nested_functions (tree);
1093 extern void insert_field_into_struct (tree, tree);
1095 /* In gimplify.c. */
1096 extern void gimplify_function_tree (tree);
1098 /* In cfgexpand.c. */
1099 extern tree gimple_assign_rhs_to_tree (gimple);
1101 /* In builtins.c */
1102 extern bool validate_gimple_arglist (const_gimple, ...);
1104 /* In tree-ssa-coalesce.c */
1105 extern bool gimple_can_coalesce_p (tree, tree);
1107 /* Return the first node in GIMPLE sequence S. */
1109 static inline gimple_seq_node
1110 gimple_seq_first (gimple_seq s)
1112 return s;
1116 /* Return the first statement in GIMPLE sequence S. */
1118 static inline gimple
1119 gimple_seq_first_stmt (gimple_seq s)
1121 gimple_seq_node n = gimple_seq_first (s);
1122 return n;
1126 /* Return the last node in GIMPLE sequence S. */
1128 static inline gimple_seq_node
1129 gimple_seq_last (gimple_seq s)
1131 return s ? s->gsbase.prev : NULL;
1135 /* Return the last statement in GIMPLE sequence S. */
1137 static inline gimple
1138 gimple_seq_last_stmt (gimple_seq s)
1140 gimple_seq_node n = gimple_seq_last (s);
1141 return n;
1145 /* Set the last node in GIMPLE sequence *PS to LAST. */
1147 static inline void
1148 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1150 (*ps)->gsbase.prev = last;
1154 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1156 static inline void
1157 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1159 *ps = first;
1163 /* Return true if GIMPLE sequence S is empty. */
1165 static inline bool
1166 gimple_seq_empty_p (gimple_seq s)
1168 return s == NULL;
1171 void gimple_seq_add_stmt (gimple_seq *, gimple);
1173 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1174 *SEQ_P is NULL, a new sequence is allocated. This function is
1175 similar to gimple_seq_add_stmt, but does not scan the operands.
1176 During gimplification, we need to manipulate statement sequences
1177 before the def/use vectors have been constructed. */
1178 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1180 /* Allocate a new sequence and initialize its first element with STMT. */
1182 static inline gimple_seq
1183 gimple_seq_alloc_with_stmt (gimple stmt)
1185 gimple_seq seq = NULL;
1186 gimple_seq_add_stmt (&seq, stmt);
1187 return seq;
1191 /* Returns the sequence of statements in BB. */
1193 static inline gimple_seq
1194 bb_seq (const_basic_block bb)
1196 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1199 static inline gimple_seq *
1200 bb_seq_addr (basic_block bb)
1202 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1205 /* Sets the sequence of statements in BB to SEQ. */
1207 static inline void
1208 set_bb_seq (basic_block bb, gimple_seq seq)
1210 gcc_checking_assert (!(bb->flags & BB_RTL));
1211 bb->il.gimple.seq = seq;
1215 /* Return the code for GIMPLE statement G. */
1217 static inline enum gimple_code
1218 gimple_code (const_gimple g)
1220 return g->gsbase.code;
1224 /* Return the GSS code used by a GIMPLE code. */
1226 static inline enum gimple_statement_structure_enum
1227 gss_for_code (enum gimple_code code)
1229 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1230 return gss_for_code_[code];
1234 /* Return which GSS code is used by GS. */
1236 static inline enum gimple_statement_structure_enum
1237 gimple_statement_structure (gimple gs)
1239 return gss_for_code (gimple_code (gs));
1243 /* Return true if statement G has sub-statements. This is only true for
1244 High GIMPLE statements. */
1246 static inline bool
1247 gimple_has_substatements (gimple g)
1249 switch (gimple_code (g))
1251 case GIMPLE_BIND:
1252 case GIMPLE_CATCH:
1253 case GIMPLE_EH_FILTER:
1254 case GIMPLE_EH_ELSE:
1255 case GIMPLE_TRY:
1256 case GIMPLE_OMP_FOR:
1257 case GIMPLE_OMP_MASTER:
1258 case GIMPLE_OMP_ORDERED:
1259 case GIMPLE_OMP_SECTION:
1260 case GIMPLE_OMP_PARALLEL:
1261 case GIMPLE_OMP_TASK:
1262 case GIMPLE_OMP_SECTIONS:
1263 case GIMPLE_OMP_SINGLE:
1264 case GIMPLE_OMP_CRITICAL:
1265 case GIMPLE_WITH_CLEANUP_EXPR:
1266 case GIMPLE_TRANSACTION:
1267 return true;
1269 default:
1270 return false;
1275 /* Return the basic block holding statement G. */
1277 static inline basic_block
1278 gimple_bb (const_gimple g)
1280 return g->gsbase.bb;
1284 /* Return the lexical scope block holding statement G. */
1286 static inline tree
1287 gimple_block (const_gimple g)
1289 return LOCATION_BLOCK (g->gsbase.location);
1293 /* Set BLOCK to be the lexical scope block holding statement G. */
1295 static inline void
1296 gimple_set_block (gimple g, tree block)
1298 if (block)
1299 g->gsbase.location =
1300 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1301 else
1302 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1306 /* Return location information for statement G. */
1308 static inline location_t
1309 gimple_location (const_gimple g)
1311 return g->gsbase.location;
1314 /* Return pointer to location information for statement G. */
1316 static inline const location_t *
1317 gimple_location_ptr (const_gimple g)
1319 return &g->gsbase.location;
1323 /* Set location information for statement G. */
1325 static inline void
1326 gimple_set_location (gimple g, location_t location)
1328 g->gsbase.location = location;
1332 /* Return true if G contains location information. */
1334 static inline bool
1335 gimple_has_location (const_gimple g)
1337 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1341 /* Return the file name of the location of STMT. */
1343 static inline const char *
1344 gimple_filename (const_gimple stmt)
1346 return LOCATION_FILE (gimple_location (stmt));
1350 /* Return the line number of the location of STMT. */
1352 static inline int
1353 gimple_lineno (const_gimple stmt)
1355 return LOCATION_LINE (gimple_location (stmt));
1359 /* Determine whether SEQ is a singleton. */
1361 static inline bool
1362 gimple_seq_singleton_p (gimple_seq seq)
1364 return ((gimple_seq_first (seq) != NULL)
1365 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1368 /* Return true if no warnings should be emitted for statement STMT. */
1370 static inline bool
1371 gimple_no_warning_p (const_gimple stmt)
1373 return stmt->gsbase.no_warning;
1376 /* Set the no_warning flag of STMT to NO_WARNING. */
1378 static inline void
1379 gimple_set_no_warning (gimple stmt, bool no_warning)
1381 stmt->gsbase.no_warning = (unsigned) no_warning;
1384 /* Set the visited status on statement STMT to VISITED_P. */
1386 static inline void
1387 gimple_set_visited (gimple stmt, bool visited_p)
1389 stmt->gsbase.visited = (unsigned) visited_p;
1393 /* Return the visited status for statement STMT. */
1395 static inline bool
1396 gimple_visited_p (gimple stmt)
1398 return stmt->gsbase.visited;
1402 /* Set pass local flag PLF on statement STMT to VAL_P. */
1404 static inline void
1405 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1407 if (val_p)
1408 stmt->gsbase.plf |= (unsigned int) plf;
1409 else
1410 stmt->gsbase.plf &= ~((unsigned int) plf);
1414 /* Return the value of pass local flag PLF on statement STMT. */
1416 static inline unsigned int
1417 gimple_plf (gimple stmt, enum plf_mask plf)
1419 return stmt->gsbase.plf & ((unsigned int) plf);
1423 /* Set the UID of statement. */
1425 static inline void
1426 gimple_set_uid (gimple g, unsigned uid)
1428 g->gsbase.uid = uid;
1432 /* Return the UID of statement. */
1434 static inline unsigned
1435 gimple_uid (const_gimple g)
1437 return g->gsbase.uid;
1441 /* Make statement G a singleton sequence. */
1443 static inline void
1444 gimple_init_singleton (gimple g)
1446 g->gsbase.next = NULL;
1447 g->gsbase.prev = g;
1451 /* Return true if GIMPLE statement G has register or memory operands. */
1453 static inline bool
1454 gimple_has_ops (const_gimple g)
1456 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1460 /* Return true if GIMPLE statement G has memory operands. */
1462 static inline bool
1463 gimple_has_mem_ops (const_gimple g)
1465 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1469 /* Return the set of USE operands for statement G. */
1471 static inline struct use_optype_d *
1472 gimple_use_ops (const_gimple g)
1474 if (!gimple_has_ops (g))
1475 return NULL;
1476 return g->gsops.opbase.use_ops;
1480 /* Set USE to be the set of USE operands for statement G. */
1482 static inline void
1483 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1485 gcc_gimple_checking_assert (gimple_has_ops (g));
1486 g->gsops.opbase.use_ops = use;
1490 /* Return the set of VUSE operand for statement G. */
1492 static inline use_operand_p
1493 gimple_vuse_op (const_gimple g)
1495 struct use_optype_d *ops;
1496 if (!gimple_has_mem_ops (g))
1497 return NULL_USE_OPERAND_P;
1498 ops = g->gsops.opbase.use_ops;
1499 if (ops
1500 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1501 return USE_OP_PTR (ops);
1502 return NULL_USE_OPERAND_P;
1505 /* Return the set of VDEF operand for statement G. */
1507 static inline def_operand_p
1508 gimple_vdef_op (gimple g)
1510 if (!gimple_has_mem_ops (g))
1511 return NULL_DEF_OPERAND_P;
1512 if (g->gsmembase.vdef)
1513 return &g->gsmembase.vdef;
1514 return NULL_DEF_OPERAND_P;
1518 /* Return the single VUSE operand of the statement G. */
1520 static inline tree
1521 gimple_vuse (const_gimple g)
1523 if (!gimple_has_mem_ops (g))
1524 return NULL_TREE;
1525 return g->gsmembase.vuse;
1528 /* Return the single VDEF operand of the statement G. */
1530 static inline tree
1531 gimple_vdef (const_gimple g)
1533 if (!gimple_has_mem_ops (g))
1534 return NULL_TREE;
1535 return g->gsmembase.vdef;
1538 /* Return the single VUSE operand of the statement G. */
1540 static inline tree *
1541 gimple_vuse_ptr (gimple g)
1543 if (!gimple_has_mem_ops (g))
1544 return NULL;
1545 return &g->gsmembase.vuse;
1548 /* Return the single VDEF operand of the statement G. */
1550 static inline tree *
1551 gimple_vdef_ptr (gimple g)
1553 if (!gimple_has_mem_ops (g))
1554 return NULL;
1555 return &g->gsmembase.vdef;
1558 /* Set the single VUSE operand of the statement G. */
1560 static inline void
1561 gimple_set_vuse (gimple g, tree vuse)
1563 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1564 g->gsmembase.vuse = vuse;
1567 /* Set the single VDEF operand of the statement G. */
1569 static inline void
1570 gimple_set_vdef (gimple g, tree vdef)
1572 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1573 g->gsmembase.vdef = vdef;
1577 /* Return true if statement G has operands and the modified field has
1578 been set. */
1580 static inline bool
1581 gimple_modified_p (const_gimple g)
1583 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1587 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1588 a MODIFIED field. */
1590 static inline void
1591 gimple_set_modified (gimple s, bool modifiedp)
1593 if (gimple_has_ops (s))
1594 s->gsbase.modified = (unsigned) modifiedp;
1598 /* Return the tree code for the expression computed by STMT. This is
1599 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1600 GIMPLE_CALL, return CALL_EXPR as the expression code for
1601 consistency. This is useful when the caller needs to deal with the
1602 three kinds of computation that GIMPLE supports. */
1604 static inline enum tree_code
1605 gimple_expr_code (const_gimple stmt)
1607 enum gimple_code code = gimple_code (stmt);
1608 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1609 return (enum tree_code) stmt->gsbase.subcode;
1610 else
1612 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1613 return CALL_EXPR;
1618 /* Mark statement S as modified, and update it. */
1620 static inline void
1621 update_stmt (gimple s)
1623 if (gimple_has_ops (s))
1625 gimple_set_modified (s, true);
1626 update_stmt_operands (s);
1630 /* Update statement S if it has been optimized. */
1632 static inline void
1633 update_stmt_if_modified (gimple s)
1635 if (gimple_modified_p (s))
1636 update_stmt_operands (s);
1639 /* Return true if statement STMT contains volatile operands. */
1641 static inline bool
1642 gimple_has_volatile_ops (const_gimple stmt)
1644 if (gimple_has_mem_ops (stmt))
1645 return stmt->gsbase.has_volatile_ops;
1646 else
1647 return false;
1651 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1653 static inline void
1654 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1656 if (gimple_has_mem_ops (stmt))
1657 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1660 /* Return true if BB is in a transaction. */
1662 static inline bool
1663 block_in_transaction (basic_block bb)
1665 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1668 /* Return true if STMT is in a transaction. */
1670 static inline bool
1671 gimple_in_transaction (gimple stmt)
1673 return block_in_transaction (gimple_bb (stmt));
1676 /* Return true if statement STMT may access memory. */
1678 static inline bool
1679 gimple_references_memory_p (gimple stmt)
1681 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1685 /* Return the subcode for OMP statement S. */
1687 static inline unsigned
1688 gimple_omp_subcode (const_gimple s)
1690 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1691 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1692 return s->gsbase.subcode;
1695 /* Set the subcode for OMP statement S to SUBCODE. */
1697 static inline void
1698 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1700 /* We only have 16 bits for the subcode. Assert that we are not
1701 overflowing it. */
1702 gcc_gimple_checking_assert (subcode < (1 << 16));
1703 s->gsbase.subcode = subcode;
1706 /* Set the nowait flag on OMP_RETURN statement S. */
1708 static inline void
1709 gimple_omp_return_set_nowait (gimple s)
1711 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1712 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1716 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1717 flag set. */
1719 static inline bool
1720 gimple_omp_return_nowait_p (const_gimple g)
1722 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1723 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1727 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1728 flag set. */
1730 static inline bool
1731 gimple_omp_section_last_p (const_gimple g)
1733 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1734 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1738 /* Set the GF_OMP_SECTION_LAST flag on G. */
1740 static inline void
1741 gimple_omp_section_set_last (gimple g)
1743 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1744 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1748 /* Return true if OMP parallel statement G has the
1749 GF_OMP_PARALLEL_COMBINED flag set. */
1751 static inline bool
1752 gimple_omp_parallel_combined_p (const_gimple g)
1754 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1755 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1759 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1760 value of COMBINED_P. */
1762 static inline void
1763 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1765 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1766 if (combined_p)
1767 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1768 else
1769 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1773 /* Return true if OMP atomic load/store statement G has the
1774 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1776 static inline bool
1777 gimple_omp_atomic_need_value_p (const_gimple g)
1779 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1780 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1781 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1785 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1787 static inline void
1788 gimple_omp_atomic_set_need_value (gimple g)
1790 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1791 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1792 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1796 /* Return the number of operands for statement GS. */
1798 static inline unsigned
1799 gimple_num_ops (const_gimple gs)
1801 return gs->gsbase.num_ops;
1805 /* Set the number of operands for statement GS. */
1807 static inline void
1808 gimple_set_num_ops (gimple gs, unsigned num_ops)
1810 gs->gsbase.num_ops = num_ops;
1814 /* Return the array of operands for statement GS. */
1816 static inline tree *
1817 gimple_ops (gimple gs)
1819 size_t off;
1821 /* All the tuples have their operand vector at the very bottom
1822 of the structure. Note that those structures that do not
1823 have an operand vector have a zero offset. */
1824 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1825 gcc_gimple_checking_assert (off != 0);
1827 return (tree *) ((char *) gs + off);
1831 /* Return operand I for statement GS. */
1833 static inline tree
1834 gimple_op (const_gimple gs, unsigned i)
1836 if (gimple_has_ops (gs))
1838 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1839 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1841 else
1842 return NULL_TREE;
1845 /* Return a pointer to operand I for statement GS. */
1847 static inline tree *
1848 gimple_op_ptr (const_gimple gs, unsigned i)
1850 if (gimple_has_ops (gs))
1852 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1853 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1855 else
1856 return NULL;
1859 /* Set operand I of statement GS to OP. */
1861 static inline void
1862 gimple_set_op (gimple gs, unsigned i, tree op)
1864 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1866 /* Note. It may be tempting to assert that OP matches
1867 is_gimple_operand, but that would be wrong. Different tuples
1868 accept slightly different sets of tree operands. Each caller
1869 should perform its own validation. */
1870 gimple_ops (gs)[i] = op;
1873 /* Return true if GS is a GIMPLE_ASSIGN. */
1875 static inline bool
1876 is_gimple_assign (const_gimple gs)
1878 return gimple_code (gs) == GIMPLE_ASSIGN;
1881 /* Determine if expression CODE is one of the valid expressions that can
1882 be used on the RHS of GIMPLE assignments. */
1884 static inline enum gimple_rhs_class
1885 get_gimple_rhs_class (enum tree_code code)
1887 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1890 /* Return the LHS of assignment statement GS. */
1892 static inline tree
1893 gimple_assign_lhs (const_gimple gs)
1895 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1896 return gimple_op (gs, 0);
1900 /* Return a pointer to the LHS of assignment statement GS. */
1902 static inline tree *
1903 gimple_assign_lhs_ptr (const_gimple gs)
1905 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1906 return gimple_op_ptr (gs, 0);
1910 /* Set LHS to be the LHS operand of assignment statement GS. */
1912 static inline void
1913 gimple_assign_set_lhs (gimple gs, tree lhs)
1915 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1916 gimple_set_op (gs, 0, lhs);
1918 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1919 SSA_NAME_DEF_STMT (lhs) = gs;
1923 /* Return the first operand on the RHS of assignment statement GS. */
1925 static inline tree
1926 gimple_assign_rhs1 (const_gimple gs)
1928 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1929 return gimple_op (gs, 1);
1933 /* Return a pointer to the first operand on the RHS of assignment
1934 statement GS. */
1936 static inline tree *
1937 gimple_assign_rhs1_ptr (const_gimple gs)
1939 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1940 return gimple_op_ptr (gs, 1);
1943 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1945 static inline void
1946 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1948 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1950 gimple_set_op (gs, 1, rhs);
1954 /* Return the second operand on the RHS of assignment statement GS.
1955 If GS does not have two operands, NULL is returned instead. */
1957 static inline tree
1958 gimple_assign_rhs2 (const_gimple gs)
1960 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1962 if (gimple_num_ops (gs) >= 3)
1963 return gimple_op (gs, 2);
1964 else
1965 return NULL_TREE;
1969 /* Return a pointer to the second operand on the RHS of assignment
1970 statement GS. */
1972 static inline tree *
1973 gimple_assign_rhs2_ptr (const_gimple gs)
1975 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1976 return gimple_op_ptr (gs, 2);
1980 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1982 static inline void
1983 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1985 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1987 gimple_set_op (gs, 2, rhs);
1990 /* Return the third operand on the RHS of assignment statement GS.
1991 If GS does not have two operands, NULL is returned instead. */
1993 static inline tree
1994 gimple_assign_rhs3 (const_gimple gs)
1996 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1998 if (gimple_num_ops (gs) >= 4)
1999 return gimple_op (gs, 3);
2000 else
2001 return NULL_TREE;
2004 /* Return a pointer to the third operand on the RHS of assignment
2005 statement GS. */
2007 static inline tree *
2008 gimple_assign_rhs3_ptr (const_gimple gs)
2010 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2011 return gimple_op_ptr (gs, 3);
2015 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2017 static inline void
2018 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2020 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2022 gimple_set_op (gs, 3, rhs);
2025 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2026 to see only a maximum of two operands. */
2028 static inline void
2029 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2030 tree op1, tree op2)
2032 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2035 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2036 to see only a maximum of two operands. */
2038 static inline void
2039 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
2040 tree *op1)
2042 tree op2;
2043 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
2044 gcc_assert (op2 == NULL_TREE);
2047 /* Returns true if GS is a nontemporal move. */
2049 static inline bool
2050 gimple_assign_nontemporal_move_p (const_gimple gs)
2052 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2053 return gs->gsbase.nontemporal_move;
2056 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2058 static inline void
2059 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2061 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2062 gs->gsbase.nontemporal_move = nontemporal;
2066 /* Return the code of the expression computed on the rhs of assignment
2067 statement GS. In case that the RHS is a single object, returns the
2068 tree code of the object. */
2070 static inline enum tree_code
2071 gimple_assign_rhs_code (const_gimple gs)
2073 enum tree_code code;
2074 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2076 code = (enum tree_code) gs->gsbase.subcode;
2077 /* While we initially set subcode to the TREE_CODE of the rhs for
2078 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2079 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2080 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2081 code = TREE_CODE (gimple_assign_rhs1 (gs));
2083 return code;
2087 /* Set CODE to be the code for the expression computed on the RHS of
2088 assignment S. */
2090 static inline void
2091 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2093 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2094 s->gsbase.subcode = code;
2098 /* Return the gimple rhs class of the code of the expression computed on
2099 the rhs of assignment statement GS.
2100 This will never return GIMPLE_INVALID_RHS. */
2102 static inline enum gimple_rhs_class
2103 gimple_assign_rhs_class (const_gimple gs)
2105 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2108 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2109 there is no operator associated with the assignment itself.
2110 Unlike gimple_assign_copy_p, this predicate returns true for
2111 any RHS operand, including those that perform an operation
2112 and do not have the semantics of a copy, such as COND_EXPR. */
2114 static inline bool
2115 gimple_assign_single_p (gimple gs)
2117 return (is_gimple_assign (gs)
2118 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2121 /* Return true if GS performs a store to its lhs. */
2123 static inline bool
2124 gimple_store_p (gimple gs)
2126 tree lhs = gimple_get_lhs (gs);
2127 return lhs && !is_gimple_reg (lhs);
2130 /* Return true if GS is an assignment that loads from its rhs1. */
2132 static inline bool
2133 gimple_assign_load_p (gimple gs)
2135 tree rhs;
2136 if (!gimple_assign_single_p (gs))
2137 return false;
2138 rhs = gimple_assign_rhs1 (gs);
2139 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2140 return true;
2141 rhs = get_base_address (rhs);
2142 return (DECL_P (rhs)
2143 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2147 /* Return true if S is a type-cast assignment. */
2149 static inline bool
2150 gimple_assign_cast_p (gimple s)
2152 if (is_gimple_assign (s))
2154 enum tree_code sc = gimple_assign_rhs_code (s);
2155 return CONVERT_EXPR_CODE_P (sc)
2156 || sc == VIEW_CONVERT_EXPR
2157 || sc == FIX_TRUNC_EXPR;
2160 return false;
2163 /* Return true if S is a clobber statement. */
2165 static inline bool
2166 gimple_clobber_p (gimple s)
2168 return gimple_assign_single_p (s)
2169 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2172 /* Return true if GS is a GIMPLE_CALL. */
2174 static inline bool
2175 is_gimple_call (const_gimple gs)
2177 return gimple_code (gs) == GIMPLE_CALL;
2180 /* Return the LHS of call statement GS. */
2182 static inline tree
2183 gimple_call_lhs (const_gimple gs)
2185 GIMPLE_CHECK (gs, GIMPLE_CALL);
2186 return gimple_op (gs, 0);
2190 /* Return a pointer to the LHS of call statement GS. */
2192 static inline tree *
2193 gimple_call_lhs_ptr (const_gimple gs)
2195 GIMPLE_CHECK (gs, GIMPLE_CALL);
2196 return gimple_op_ptr (gs, 0);
2200 /* Set LHS to be the LHS operand of call statement GS. */
2202 static inline void
2203 gimple_call_set_lhs (gimple gs, tree lhs)
2205 GIMPLE_CHECK (gs, GIMPLE_CALL);
2206 gimple_set_op (gs, 0, lhs);
2207 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2208 SSA_NAME_DEF_STMT (lhs) = gs;
2212 /* Return true if call GS calls an internal-only function, as enumerated
2213 by internal_fn. */
2215 static inline bool
2216 gimple_call_internal_p (const_gimple gs)
2218 GIMPLE_CHECK (gs, GIMPLE_CALL);
2219 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2223 /* Return the target of internal call GS. */
2225 static inline enum internal_fn
2226 gimple_call_internal_fn (const_gimple gs)
2228 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2229 return gs->gimple_call.u.internal_fn;
2233 /* Return the function type of the function called by GS. */
2235 static inline tree
2236 gimple_call_fntype (const_gimple gs)
2238 GIMPLE_CHECK (gs, GIMPLE_CALL);
2239 if (gimple_call_internal_p (gs))
2240 return NULL_TREE;
2241 return gs->gimple_call.u.fntype;
2244 /* Set the type of the function called by GS to FNTYPE. */
2246 static inline void
2247 gimple_call_set_fntype (gimple gs, tree fntype)
2249 GIMPLE_CHECK (gs, GIMPLE_CALL);
2250 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2251 gs->gimple_call.u.fntype = fntype;
2255 /* Return the tree node representing the function called by call
2256 statement GS. */
2258 static inline tree
2259 gimple_call_fn (const_gimple gs)
2261 GIMPLE_CHECK (gs, GIMPLE_CALL);
2262 return gimple_op (gs, 1);
2265 /* Return a pointer to the tree node representing the function called by call
2266 statement GS. */
2268 static inline tree *
2269 gimple_call_fn_ptr (const_gimple gs)
2271 GIMPLE_CHECK (gs, GIMPLE_CALL);
2272 return gimple_op_ptr (gs, 1);
2276 /* Set FN to be the function called by call statement GS. */
2278 static inline void
2279 gimple_call_set_fn (gimple gs, tree fn)
2281 GIMPLE_CHECK (gs, GIMPLE_CALL);
2282 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2283 gimple_set_op (gs, 1, fn);
2287 /* Set FNDECL to be the function called by call statement GS. */
2289 static inline void
2290 gimple_call_set_fndecl (gimple gs, tree decl)
2292 GIMPLE_CHECK (gs, GIMPLE_CALL);
2293 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2294 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2298 /* Set internal function FN to be the function called by call statement GS. */
2300 static inline void
2301 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2303 GIMPLE_CHECK (gs, GIMPLE_CALL);
2304 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2305 gs->gimple_call.u.internal_fn = fn;
2309 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2310 associated with the callee if known. Otherwise return NULL_TREE. */
2312 static inline tree
2313 gimple_call_addr_fndecl (const_tree fn)
2315 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2317 tree fndecl = TREE_OPERAND (fn, 0);
2318 if (TREE_CODE (fndecl) == MEM_REF
2319 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2320 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2321 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2322 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2323 return fndecl;
2325 return NULL_TREE;
2328 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2329 Otherwise return NULL. This function is analogous to
2330 get_callee_fndecl in tree land. */
2332 static inline tree
2333 gimple_call_fndecl (const_gimple gs)
2335 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2339 /* Return the type returned by call statement GS. */
2341 static inline tree
2342 gimple_call_return_type (const_gimple gs)
2344 tree type = gimple_call_fntype (gs);
2346 if (type == NULL_TREE)
2347 return TREE_TYPE (gimple_call_lhs (gs));
2349 /* The type returned by a function is the type of its
2350 function type. */
2351 return TREE_TYPE (type);
2355 /* Return the static chain for call statement GS. */
2357 static inline tree
2358 gimple_call_chain (const_gimple gs)
2360 GIMPLE_CHECK (gs, GIMPLE_CALL);
2361 return gimple_op (gs, 2);
2365 /* Return a pointer to the static chain for call statement GS. */
2367 static inline tree *
2368 gimple_call_chain_ptr (const_gimple gs)
2370 GIMPLE_CHECK (gs, GIMPLE_CALL);
2371 return gimple_op_ptr (gs, 2);
2374 /* Set CHAIN to be the static chain for call statement GS. */
2376 static inline void
2377 gimple_call_set_chain (gimple gs, tree chain)
2379 GIMPLE_CHECK (gs, GIMPLE_CALL);
2381 gimple_set_op (gs, 2, chain);
2385 /* Return the number of arguments used by call statement GS. */
2387 static inline unsigned
2388 gimple_call_num_args (const_gimple gs)
2390 unsigned num_ops;
2391 GIMPLE_CHECK (gs, GIMPLE_CALL);
2392 num_ops = gimple_num_ops (gs);
2393 return num_ops - 3;
2397 /* Return the argument at position INDEX for call statement GS. */
2399 static inline tree
2400 gimple_call_arg (const_gimple gs, unsigned index)
2402 GIMPLE_CHECK (gs, GIMPLE_CALL);
2403 return gimple_op (gs, index + 3);
2407 /* Return a pointer to the argument at position INDEX for call
2408 statement GS. */
2410 static inline tree *
2411 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2413 GIMPLE_CHECK (gs, GIMPLE_CALL);
2414 return gimple_op_ptr (gs, index + 3);
2418 /* Set ARG to be the argument at position INDEX for call statement GS. */
2420 static inline void
2421 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2423 GIMPLE_CHECK (gs, GIMPLE_CALL);
2424 gimple_set_op (gs, index + 3, arg);
2428 /* If TAIL_P is true, mark call statement S as being a tail call
2429 (i.e., a call just before the exit of a function). These calls are
2430 candidate for tail call optimization. */
2432 static inline void
2433 gimple_call_set_tail (gimple s, bool tail_p)
2435 GIMPLE_CHECK (s, GIMPLE_CALL);
2436 if (tail_p)
2437 s->gsbase.subcode |= GF_CALL_TAILCALL;
2438 else
2439 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2443 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2445 static inline bool
2446 gimple_call_tail_p (gimple s)
2448 GIMPLE_CHECK (s, GIMPLE_CALL);
2449 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2453 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2454 slot optimization. This transformation uses the target of the call
2455 expansion as the return slot for calls that return in memory. */
2457 static inline void
2458 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2460 GIMPLE_CHECK (s, GIMPLE_CALL);
2461 if (return_slot_opt_p)
2462 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2463 else
2464 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2468 /* Return true if S is marked for return slot optimization. */
2470 static inline bool
2471 gimple_call_return_slot_opt_p (gimple s)
2473 GIMPLE_CHECK (s, GIMPLE_CALL);
2474 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2478 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2479 thunk to the thunked-to function. */
2481 static inline void
2482 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2484 GIMPLE_CHECK (s, GIMPLE_CALL);
2485 if (from_thunk_p)
2486 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2487 else
2488 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2492 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2494 static inline bool
2495 gimple_call_from_thunk_p (gimple s)
2497 GIMPLE_CHECK (s, GIMPLE_CALL);
2498 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2502 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2503 argument pack in its argument list. */
2505 static inline void
2506 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2508 GIMPLE_CHECK (s, GIMPLE_CALL);
2509 if (pass_arg_pack_p)
2510 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2511 else
2512 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2516 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2517 argument pack in its argument list. */
2519 static inline bool
2520 gimple_call_va_arg_pack_p (gimple s)
2522 GIMPLE_CHECK (s, GIMPLE_CALL);
2523 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2527 /* Return true if S is a noreturn call. */
2529 static inline bool
2530 gimple_call_noreturn_p (gimple s)
2532 GIMPLE_CHECK (s, GIMPLE_CALL);
2533 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2537 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2538 even if the called function can throw in other cases. */
2540 static inline void
2541 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2543 GIMPLE_CHECK (s, GIMPLE_CALL);
2544 if (nothrow_p)
2545 s->gsbase.subcode |= GF_CALL_NOTHROW;
2546 else
2547 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2550 /* Return true if S is a nothrow call. */
2552 static inline bool
2553 gimple_call_nothrow_p (gimple s)
2555 GIMPLE_CHECK (s, GIMPLE_CALL);
2556 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2559 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2560 is known to be emitted for VLA objects. Those are wrapped by
2561 stack_save/stack_restore calls and hence can't lead to unbounded
2562 stack growth even when they occur in loops. */
2564 static inline void
2565 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2567 GIMPLE_CHECK (s, GIMPLE_CALL);
2568 if (for_var)
2569 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2570 else
2571 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2574 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2576 static inline bool
2577 gimple_call_alloca_for_var_p (gimple s)
2579 GIMPLE_CHECK (s, GIMPLE_CALL);
2580 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2583 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2585 static inline void
2586 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2588 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2589 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2590 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2594 /* Return a pointer to the points-to solution for the set of call-used
2595 variables of the call CALL. */
2597 static inline struct pt_solution *
2598 gimple_call_use_set (gimple call)
2600 GIMPLE_CHECK (call, GIMPLE_CALL);
2601 return &call->gimple_call.call_used;
2605 /* Return a pointer to the points-to solution for the set of call-used
2606 variables of the call CALL. */
2608 static inline struct pt_solution *
2609 gimple_call_clobber_set (gimple call)
2611 GIMPLE_CHECK (call, GIMPLE_CALL);
2612 return &call->gimple_call.call_clobbered;
2616 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2617 non-NULL lhs. */
2619 static inline bool
2620 gimple_has_lhs (gimple stmt)
2622 return (is_gimple_assign (stmt)
2623 || (is_gimple_call (stmt)
2624 && gimple_call_lhs (stmt) != NULL_TREE));
2628 /* Return the code of the predicate computed by conditional statement GS. */
2630 static inline enum tree_code
2631 gimple_cond_code (const_gimple gs)
2633 GIMPLE_CHECK (gs, GIMPLE_COND);
2634 return (enum tree_code) gs->gsbase.subcode;
2638 /* Set CODE to be the predicate code for the conditional statement GS. */
2640 static inline void
2641 gimple_cond_set_code (gimple gs, enum tree_code code)
2643 GIMPLE_CHECK (gs, GIMPLE_COND);
2644 gs->gsbase.subcode = code;
2648 /* Return the LHS of the predicate computed by conditional statement GS. */
2650 static inline tree
2651 gimple_cond_lhs (const_gimple gs)
2653 GIMPLE_CHECK (gs, GIMPLE_COND);
2654 return gimple_op (gs, 0);
2657 /* Return the pointer to the LHS of the predicate computed by conditional
2658 statement GS. */
2660 static inline tree *
2661 gimple_cond_lhs_ptr (const_gimple gs)
2663 GIMPLE_CHECK (gs, GIMPLE_COND);
2664 return gimple_op_ptr (gs, 0);
2667 /* Set LHS to be the LHS operand of the predicate computed by
2668 conditional statement GS. */
2670 static inline void
2671 gimple_cond_set_lhs (gimple gs, tree lhs)
2673 GIMPLE_CHECK (gs, GIMPLE_COND);
2674 gimple_set_op (gs, 0, lhs);
2678 /* Return the RHS operand of the predicate computed by conditional GS. */
2680 static inline tree
2681 gimple_cond_rhs (const_gimple gs)
2683 GIMPLE_CHECK (gs, GIMPLE_COND);
2684 return gimple_op (gs, 1);
2687 /* Return the pointer to the RHS operand of the predicate computed by
2688 conditional GS. */
2690 static inline tree *
2691 gimple_cond_rhs_ptr (const_gimple gs)
2693 GIMPLE_CHECK (gs, GIMPLE_COND);
2694 return gimple_op_ptr (gs, 1);
2698 /* Set RHS to be the RHS operand of the predicate computed by
2699 conditional statement GS. */
2701 static inline void
2702 gimple_cond_set_rhs (gimple gs, tree rhs)
2704 GIMPLE_CHECK (gs, GIMPLE_COND);
2705 gimple_set_op (gs, 1, rhs);
2709 /* Return the label used by conditional statement GS when its
2710 predicate evaluates to true. */
2712 static inline tree
2713 gimple_cond_true_label (const_gimple gs)
2715 GIMPLE_CHECK (gs, GIMPLE_COND);
2716 return gimple_op (gs, 2);
2720 /* Set LABEL to be the label used by conditional statement GS when its
2721 predicate evaluates to true. */
2723 static inline void
2724 gimple_cond_set_true_label (gimple gs, tree label)
2726 GIMPLE_CHECK (gs, GIMPLE_COND);
2727 gimple_set_op (gs, 2, label);
2731 /* Set LABEL to be the label used by conditional statement GS when its
2732 predicate evaluates to false. */
2734 static inline void
2735 gimple_cond_set_false_label (gimple gs, tree label)
2737 GIMPLE_CHECK (gs, GIMPLE_COND);
2738 gimple_set_op (gs, 3, label);
2742 /* Return the label used by conditional statement GS when its
2743 predicate evaluates to false. */
2745 static inline tree
2746 gimple_cond_false_label (const_gimple gs)
2748 GIMPLE_CHECK (gs, GIMPLE_COND);
2749 return gimple_op (gs, 3);
2753 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2755 static inline void
2756 gimple_cond_make_false (gimple gs)
2758 gimple_cond_set_lhs (gs, boolean_true_node);
2759 gimple_cond_set_rhs (gs, boolean_false_node);
2760 gs->gsbase.subcode = EQ_EXPR;
2764 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2766 static inline void
2767 gimple_cond_make_true (gimple gs)
2769 gimple_cond_set_lhs (gs, boolean_true_node);
2770 gimple_cond_set_rhs (gs, boolean_true_node);
2771 gs->gsbase.subcode = EQ_EXPR;
2774 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2775 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2777 static inline bool
2778 gimple_cond_true_p (const_gimple gs)
2780 tree lhs = gimple_cond_lhs (gs);
2781 tree rhs = gimple_cond_rhs (gs);
2782 enum tree_code code = gimple_cond_code (gs);
2784 if (lhs != boolean_true_node && lhs != boolean_false_node)
2785 return false;
2787 if (rhs != boolean_true_node && rhs != boolean_false_node)
2788 return false;
2790 if (code == NE_EXPR && lhs != rhs)
2791 return true;
2793 if (code == EQ_EXPR && lhs == rhs)
2794 return true;
2796 return false;
2799 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2800 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2802 static inline bool
2803 gimple_cond_false_p (const_gimple gs)
2805 tree lhs = gimple_cond_lhs (gs);
2806 tree rhs = gimple_cond_rhs (gs);
2807 enum tree_code code = gimple_cond_code (gs);
2809 if (lhs != boolean_true_node && lhs != boolean_false_node)
2810 return false;
2812 if (rhs != boolean_true_node && rhs != boolean_false_node)
2813 return false;
2815 if (code == NE_EXPR && lhs == rhs)
2816 return true;
2818 if (code == EQ_EXPR && lhs != rhs)
2819 return true;
2821 return false;
2824 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2826 static inline void
2827 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2829 gimple_cond_set_code (stmt, code);
2830 gimple_cond_set_lhs (stmt, lhs);
2831 gimple_cond_set_rhs (stmt, rhs);
2834 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2836 static inline tree
2837 gimple_label_label (const_gimple gs)
2839 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2840 return gimple_op (gs, 0);
2844 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2845 GS. */
2847 static inline void
2848 gimple_label_set_label (gimple gs, tree label)
2850 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2851 gimple_set_op (gs, 0, label);
2855 /* Return the destination of the unconditional jump GS. */
2857 static inline tree
2858 gimple_goto_dest (const_gimple gs)
2860 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2861 return gimple_op (gs, 0);
2865 /* Set DEST to be the destination of the unconditonal jump GS. */
2867 static inline void
2868 gimple_goto_set_dest (gimple gs, tree dest)
2870 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2871 gimple_set_op (gs, 0, dest);
2875 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2877 static inline tree
2878 gimple_bind_vars (const_gimple gs)
2880 GIMPLE_CHECK (gs, GIMPLE_BIND);
2881 return gs->gimple_bind.vars;
2885 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2886 statement GS. */
2888 static inline void
2889 gimple_bind_set_vars (gimple gs, tree vars)
2891 GIMPLE_CHECK (gs, GIMPLE_BIND);
2892 gs->gimple_bind.vars = vars;
2896 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2897 statement GS. */
2899 static inline void
2900 gimple_bind_append_vars (gimple gs, tree vars)
2902 GIMPLE_CHECK (gs, GIMPLE_BIND);
2903 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2907 static inline gimple_seq *
2908 gimple_bind_body_ptr (gimple gs)
2910 GIMPLE_CHECK (gs, GIMPLE_BIND);
2911 return &gs->gimple_bind.body;
2914 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2916 static inline gimple_seq
2917 gimple_bind_body (gimple gs)
2919 return *gimple_bind_body_ptr (gs);
2923 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2924 statement GS. */
2926 static inline void
2927 gimple_bind_set_body (gimple gs, gimple_seq seq)
2929 GIMPLE_CHECK (gs, GIMPLE_BIND);
2930 gs->gimple_bind.body = seq;
2934 /* Append a statement to the end of a GIMPLE_BIND's body. */
2936 static inline void
2937 gimple_bind_add_stmt (gimple gs, gimple stmt)
2939 GIMPLE_CHECK (gs, GIMPLE_BIND);
2940 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2944 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2946 static inline void
2947 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2949 GIMPLE_CHECK (gs, GIMPLE_BIND);
2950 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2954 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2955 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2957 static inline tree
2958 gimple_bind_block (const_gimple gs)
2960 GIMPLE_CHECK (gs, GIMPLE_BIND);
2961 return gs->gimple_bind.block;
2965 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2966 statement GS. */
2968 static inline void
2969 gimple_bind_set_block (gimple gs, tree block)
2971 GIMPLE_CHECK (gs, GIMPLE_BIND);
2972 gcc_gimple_checking_assert (block == NULL_TREE
2973 || TREE_CODE (block) == BLOCK);
2974 gs->gimple_bind.block = block;
2978 /* Return the number of input operands for GIMPLE_ASM GS. */
2980 static inline unsigned
2981 gimple_asm_ninputs (const_gimple gs)
2983 GIMPLE_CHECK (gs, GIMPLE_ASM);
2984 return gs->gimple_asm.ni;
2988 /* Return the number of output operands for GIMPLE_ASM GS. */
2990 static inline unsigned
2991 gimple_asm_noutputs (const_gimple gs)
2993 GIMPLE_CHECK (gs, GIMPLE_ASM);
2994 return gs->gimple_asm.no;
2998 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3000 static inline unsigned
3001 gimple_asm_nclobbers (const_gimple gs)
3003 GIMPLE_CHECK (gs, GIMPLE_ASM);
3004 return gs->gimple_asm.nc;
3007 /* Return the number of label operands for GIMPLE_ASM GS. */
3009 static inline unsigned
3010 gimple_asm_nlabels (const_gimple gs)
3012 GIMPLE_CHECK (gs, GIMPLE_ASM);
3013 return gs->gimple_asm.nl;
3016 /* Return input operand INDEX of GIMPLE_ASM GS. */
3018 static inline tree
3019 gimple_asm_input_op (const_gimple gs, unsigned index)
3021 GIMPLE_CHECK (gs, GIMPLE_ASM);
3022 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3023 return gimple_op (gs, index + gs->gimple_asm.no);
3026 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3028 static inline tree *
3029 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3031 GIMPLE_CHECK (gs, GIMPLE_ASM);
3032 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3033 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
3037 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3039 static inline void
3040 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3042 GIMPLE_CHECK (gs, GIMPLE_ASM);
3043 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
3044 && TREE_CODE (in_op) == TREE_LIST);
3045 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
3049 /* Return output operand INDEX of GIMPLE_ASM GS. */
3051 static inline tree
3052 gimple_asm_output_op (const_gimple gs, unsigned index)
3054 GIMPLE_CHECK (gs, GIMPLE_ASM);
3055 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3056 return gimple_op (gs, index);
3059 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3061 static inline tree *
3062 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3064 GIMPLE_CHECK (gs, GIMPLE_ASM);
3065 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3066 return gimple_op_ptr (gs, index);
3070 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3072 static inline void
3073 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3075 GIMPLE_CHECK (gs, GIMPLE_ASM);
3076 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3077 && TREE_CODE (out_op) == TREE_LIST);
3078 gimple_set_op (gs, index, out_op);
3082 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3084 static inline tree
3085 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3087 GIMPLE_CHECK (gs, GIMPLE_ASM);
3088 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3089 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3093 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3095 static inline void
3096 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3098 GIMPLE_CHECK (gs, GIMPLE_ASM);
3099 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3100 && TREE_CODE (clobber_op) == TREE_LIST);
3101 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3104 /* Return label operand INDEX of GIMPLE_ASM GS. */
3106 static inline tree
3107 gimple_asm_label_op (const_gimple gs, unsigned index)
3109 GIMPLE_CHECK (gs, GIMPLE_ASM);
3110 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3111 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3114 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3116 static inline void
3117 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3119 GIMPLE_CHECK (gs, GIMPLE_ASM);
3120 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3121 && TREE_CODE (label_op) == TREE_LIST);
3122 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3125 /* Return the string representing the assembly instruction in
3126 GIMPLE_ASM GS. */
3128 static inline const char *
3129 gimple_asm_string (const_gimple gs)
3131 GIMPLE_CHECK (gs, GIMPLE_ASM);
3132 return gs->gimple_asm.string;
3136 /* Return true if GS is an asm statement marked volatile. */
3138 static inline bool
3139 gimple_asm_volatile_p (const_gimple gs)
3141 GIMPLE_CHECK (gs, GIMPLE_ASM);
3142 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3146 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3148 static inline void
3149 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3151 GIMPLE_CHECK (gs, GIMPLE_ASM);
3152 if (volatile_p)
3153 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3154 else
3155 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3159 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3161 static inline void
3162 gimple_asm_set_input (gimple gs, bool input_p)
3164 GIMPLE_CHECK (gs, GIMPLE_ASM);
3165 if (input_p)
3166 gs->gsbase.subcode |= GF_ASM_INPUT;
3167 else
3168 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3172 /* Return true if asm GS is an ASM_INPUT. */
3174 static inline bool
3175 gimple_asm_input_p (const_gimple gs)
3177 GIMPLE_CHECK (gs, GIMPLE_ASM);
3178 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3182 /* Return the types handled by GIMPLE_CATCH statement GS. */
3184 static inline tree
3185 gimple_catch_types (const_gimple gs)
3187 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3188 return gs->gimple_catch.types;
3192 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3194 static inline tree *
3195 gimple_catch_types_ptr (gimple gs)
3197 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3198 return &gs->gimple_catch.types;
3202 /* Return a pointer to the GIMPLE sequence representing the body of
3203 the handler of GIMPLE_CATCH statement GS. */
3205 static inline gimple_seq *
3206 gimple_catch_handler_ptr (gimple gs)
3208 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3209 return &gs->gimple_catch.handler;
3213 /* Return the GIMPLE sequence representing the body of the handler of
3214 GIMPLE_CATCH statement GS. */
3216 static inline gimple_seq
3217 gimple_catch_handler (gimple gs)
3219 return *gimple_catch_handler_ptr (gs);
3223 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3225 static inline void
3226 gimple_catch_set_types (gimple gs, tree t)
3228 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3229 gs->gimple_catch.types = t;
3233 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3235 static inline void
3236 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3238 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3239 gs->gimple_catch.handler = handler;
3243 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3245 static inline tree
3246 gimple_eh_filter_types (const_gimple gs)
3248 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3249 return gs->gimple_eh_filter.types;
3253 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3254 GS. */
3256 static inline tree *
3257 gimple_eh_filter_types_ptr (gimple gs)
3259 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3260 return &gs->gimple_eh_filter.types;
3264 /* Return a pointer to the sequence of statement to execute when
3265 GIMPLE_EH_FILTER statement fails. */
3267 static inline gimple_seq *
3268 gimple_eh_filter_failure_ptr (gimple gs)
3270 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3271 return &gs->gimple_eh_filter.failure;
3275 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3276 statement fails. */
3278 static inline gimple_seq
3279 gimple_eh_filter_failure (gimple gs)
3281 return *gimple_eh_filter_failure_ptr (gs);
3285 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3287 static inline void
3288 gimple_eh_filter_set_types (gimple gs, tree types)
3290 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3291 gs->gimple_eh_filter.types = types;
3295 /* Set FAILURE to be the sequence of statements to execute on failure
3296 for GIMPLE_EH_FILTER GS. */
3298 static inline void
3299 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3301 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3302 gs->gimple_eh_filter.failure = failure;
3305 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3307 static inline tree
3308 gimple_eh_must_not_throw_fndecl (gimple gs)
3310 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3311 return gs->gimple_eh_mnt.fndecl;
3314 /* Set the function decl to be called by GS to DECL. */
3316 static inline void
3317 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3319 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3320 gs->gimple_eh_mnt.fndecl = decl;
3323 /* GIMPLE_EH_ELSE accessors. */
3325 static inline gimple_seq *
3326 gimple_eh_else_n_body_ptr (gimple gs)
3328 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3329 return &gs->gimple_eh_else.n_body;
3332 static inline gimple_seq
3333 gimple_eh_else_n_body (gimple gs)
3335 return *gimple_eh_else_n_body_ptr (gs);
3338 static inline gimple_seq *
3339 gimple_eh_else_e_body_ptr (gimple gs)
3341 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3342 return &gs->gimple_eh_else.e_body;
3345 static inline gimple_seq
3346 gimple_eh_else_e_body (gimple gs)
3348 return *gimple_eh_else_e_body_ptr (gs);
3351 static inline void
3352 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3354 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3355 gs->gimple_eh_else.n_body = seq;
3358 static inline void
3359 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3361 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3362 gs->gimple_eh_else.e_body = seq;
3365 /* GIMPLE_TRY accessors. */
3367 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3368 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3370 static inline enum gimple_try_flags
3371 gimple_try_kind (const_gimple gs)
3373 GIMPLE_CHECK (gs, GIMPLE_TRY);
3374 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3378 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3380 static inline void
3381 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3383 GIMPLE_CHECK (gs, GIMPLE_TRY);
3384 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3385 || kind == GIMPLE_TRY_FINALLY);
3386 if (gimple_try_kind (gs) != kind)
3387 gs->gsbase.subcode = (unsigned int) kind;
3391 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3393 static inline bool
3394 gimple_try_catch_is_cleanup (const_gimple gs)
3396 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3397 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3401 /* Return a pointer to the sequence of statements used as the
3402 body for GIMPLE_TRY GS. */
3404 static inline gimple_seq *
3405 gimple_try_eval_ptr (gimple gs)
3407 GIMPLE_CHECK (gs, GIMPLE_TRY);
3408 return &gs->gimple_try.eval;
3412 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3414 static inline gimple_seq
3415 gimple_try_eval (gimple gs)
3417 return *gimple_try_eval_ptr (gs);
3421 /* Return a pointer to the sequence of statements used as the cleanup body for
3422 GIMPLE_TRY GS. */
3424 static inline gimple_seq *
3425 gimple_try_cleanup_ptr (gimple gs)
3427 GIMPLE_CHECK (gs, GIMPLE_TRY);
3428 return &gs->gimple_try.cleanup;
3432 /* Return the sequence of statements used as the cleanup body for
3433 GIMPLE_TRY GS. */
3435 static inline gimple_seq
3436 gimple_try_cleanup (gimple gs)
3438 return *gimple_try_cleanup_ptr (gs);
3442 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3444 static inline void
3445 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3447 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3448 if (catch_is_cleanup)
3449 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3450 else
3451 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3455 /* Set EVAL to be the sequence of statements to use as the body for
3456 GIMPLE_TRY GS. */
3458 static inline void
3459 gimple_try_set_eval (gimple gs, gimple_seq eval)
3461 GIMPLE_CHECK (gs, GIMPLE_TRY);
3462 gs->gimple_try.eval = eval;
3466 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3467 body for GIMPLE_TRY GS. */
3469 static inline void
3470 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3472 GIMPLE_CHECK (gs, GIMPLE_TRY);
3473 gs->gimple_try.cleanup = cleanup;
3477 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3479 static inline gimple_seq *
3480 gimple_wce_cleanup_ptr (gimple gs)
3482 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3483 return &gs->gimple_wce.cleanup;
3487 /* Return the cleanup sequence for cleanup statement GS. */
3489 static inline gimple_seq
3490 gimple_wce_cleanup (gimple gs)
3492 return *gimple_wce_cleanup_ptr (gs);
3496 /* Set CLEANUP to be the cleanup sequence for GS. */
3498 static inline void
3499 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3501 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3502 gs->gimple_wce.cleanup = cleanup;
3506 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3508 static inline bool
3509 gimple_wce_cleanup_eh_only (const_gimple gs)
3511 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3512 return gs->gsbase.subcode != 0;
3516 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3518 static inline void
3519 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3521 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3522 gs->gsbase.subcode = (unsigned int) eh_only_p;
3526 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3528 static inline unsigned
3529 gimple_phi_capacity (const_gimple gs)
3531 GIMPLE_CHECK (gs, GIMPLE_PHI);
3532 return gs->gimple_phi.capacity;
3536 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3537 be exactly the number of incoming edges for the basic block holding
3538 GS. */
3540 static inline unsigned
3541 gimple_phi_num_args (const_gimple gs)
3543 GIMPLE_CHECK (gs, GIMPLE_PHI);
3544 return gs->gimple_phi.nargs;
3548 /* Return the SSA name created by GIMPLE_PHI GS. */
3550 static inline tree
3551 gimple_phi_result (const_gimple gs)
3553 GIMPLE_CHECK (gs, GIMPLE_PHI);
3554 return gs->gimple_phi.result;
3557 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3559 static inline tree *
3560 gimple_phi_result_ptr (gimple gs)
3562 GIMPLE_CHECK (gs, GIMPLE_PHI);
3563 return &gs->gimple_phi.result;
3566 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3568 static inline void
3569 gimple_phi_set_result (gimple gs, tree result)
3571 GIMPLE_CHECK (gs, GIMPLE_PHI);
3572 gs->gimple_phi.result = result;
3573 if (result && TREE_CODE (result) == SSA_NAME)
3574 SSA_NAME_DEF_STMT (result) = gs;
3578 /* Return the PHI argument corresponding to incoming edge INDEX for
3579 GIMPLE_PHI GS. */
3581 static inline struct phi_arg_d *
3582 gimple_phi_arg (gimple gs, unsigned index)
3584 GIMPLE_CHECK (gs, GIMPLE_PHI);
3585 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3586 return &(gs->gimple_phi.args[index]);
3589 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3590 for GIMPLE_PHI GS. */
3592 static inline void
3593 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3595 GIMPLE_CHECK (gs, GIMPLE_PHI);
3596 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3597 gs->gimple_phi.args[index] = *phiarg;
3600 /* Return the region number for GIMPLE_RESX GS. */
3602 static inline int
3603 gimple_resx_region (const_gimple gs)
3605 GIMPLE_CHECK (gs, GIMPLE_RESX);
3606 return gs->gimple_eh_ctrl.region;
3609 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3611 static inline void
3612 gimple_resx_set_region (gimple gs, int region)
3614 GIMPLE_CHECK (gs, GIMPLE_RESX);
3615 gs->gimple_eh_ctrl.region = region;
3618 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3620 static inline int
3621 gimple_eh_dispatch_region (const_gimple gs)
3623 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3624 return gs->gimple_eh_ctrl.region;
3627 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3629 static inline void
3630 gimple_eh_dispatch_set_region (gimple gs, int region)
3632 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3633 gs->gimple_eh_ctrl.region = region;
3636 /* Return the number of labels associated with the switch statement GS. */
3638 static inline unsigned
3639 gimple_switch_num_labels (const_gimple gs)
3641 unsigned num_ops;
3642 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3643 num_ops = gimple_num_ops (gs);
3644 gcc_gimple_checking_assert (num_ops > 1);
3645 return num_ops - 1;
3649 /* Set NLABELS to be the number of labels for the switch statement GS. */
3651 static inline void
3652 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3654 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3655 gimple_set_num_ops (g, nlabels + 1);
3659 /* Return the index variable used by the switch statement GS. */
3661 static inline tree
3662 gimple_switch_index (const_gimple gs)
3664 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3665 return gimple_op (gs, 0);
3669 /* Return a pointer to the index variable for the switch statement GS. */
3671 static inline tree *
3672 gimple_switch_index_ptr (const_gimple gs)
3674 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3675 return gimple_op_ptr (gs, 0);
3679 /* Set INDEX to be the index variable for switch statement GS. */
3681 static inline void
3682 gimple_switch_set_index (gimple gs, tree index)
3684 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3685 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3686 gimple_set_op (gs, 0, index);
3690 /* Return the label numbered INDEX. The default label is 0, followed by any
3691 labels in a switch statement. */
3693 static inline tree
3694 gimple_switch_label (const_gimple gs, unsigned index)
3696 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3697 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3698 return gimple_op (gs, index + 1);
3701 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3703 static inline void
3704 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3706 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3707 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3708 && (label == NULL_TREE
3709 || TREE_CODE (label) == CASE_LABEL_EXPR));
3710 gimple_set_op (gs, index + 1, label);
3713 /* Return the default label for a switch statement. */
3715 static inline tree
3716 gimple_switch_default_label (const_gimple gs)
3718 tree label = gimple_switch_label (gs, 0);
3719 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3720 return label;
3723 /* Set the default label for a switch statement. */
3725 static inline void
3726 gimple_switch_set_default_label (gimple gs, tree label)
3728 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3729 gimple_switch_set_label (gs, 0, label);
3732 /* Return true if GS is a GIMPLE_DEBUG statement. */
3734 static inline bool
3735 is_gimple_debug (const_gimple gs)
3737 return gimple_code (gs) == GIMPLE_DEBUG;
3740 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3742 static inline bool
3743 gimple_debug_bind_p (const_gimple s)
3745 if (is_gimple_debug (s))
3746 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3748 return false;
3751 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3753 static inline tree
3754 gimple_debug_bind_get_var (gimple dbg)
3756 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3757 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3758 return gimple_op (dbg, 0);
3761 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3762 statement. */
3764 static inline tree
3765 gimple_debug_bind_get_value (gimple dbg)
3767 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3768 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3769 return gimple_op (dbg, 1);
3772 /* Return a pointer to the value bound to the variable in a
3773 GIMPLE_DEBUG bind statement. */
3775 static inline tree *
3776 gimple_debug_bind_get_value_ptr (gimple dbg)
3778 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3779 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3780 return gimple_op_ptr (dbg, 1);
3783 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3785 static inline void
3786 gimple_debug_bind_set_var (gimple dbg, tree var)
3788 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3789 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3790 gimple_set_op (dbg, 0, var);
3793 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3794 statement. */
3796 static inline void
3797 gimple_debug_bind_set_value (gimple dbg, tree value)
3799 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3800 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3801 gimple_set_op (dbg, 1, value);
3804 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3805 optimized away. */
3806 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3808 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3809 statement. */
3811 static inline void
3812 gimple_debug_bind_reset_value (gimple dbg)
3814 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3815 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3816 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3819 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3820 value. */
3822 static inline bool
3823 gimple_debug_bind_has_value_p (gimple dbg)
3825 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3826 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3827 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3830 #undef GIMPLE_DEBUG_BIND_NOVALUE
3832 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3834 static inline bool
3835 gimple_debug_source_bind_p (const_gimple s)
3837 if (is_gimple_debug (s))
3838 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3840 return false;
3843 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3845 static inline tree
3846 gimple_debug_source_bind_get_var (gimple dbg)
3848 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3849 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3850 return gimple_op (dbg, 0);
3853 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3854 statement. */
3856 static inline tree
3857 gimple_debug_source_bind_get_value (gimple dbg)
3859 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3860 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3861 return gimple_op (dbg, 1);
3864 /* Return a pointer to the value bound to the variable in a
3865 GIMPLE_DEBUG source bind statement. */
3867 static inline tree *
3868 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3870 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3871 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3872 return gimple_op_ptr (dbg, 1);
3875 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3877 static inline void
3878 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3880 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3881 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3882 gimple_set_op (dbg, 0, var);
3885 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3886 statement. */
3888 static inline void
3889 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3891 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3892 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3893 gimple_set_op (dbg, 1, value);
3896 /* Return a pointer to the body for the OMP statement GS. */
3898 static inline gimple_seq *
3899 gimple_omp_body_ptr (gimple gs)
3901 return &gs->omp.body;
3904 /* Return the body for the OMP statement GS. */
3906 static inline gimple_seq
3907 gimple_omp_body (gimple gs)
3909 return *gimple_omp_body_ptr (gs);
3912 /* Set BODY to be the body for the OMP statement GS. */
3914 static inline void
3915 gimple_omp_set_body (gimple gs, gimple_seq body)
3917 gs->omp.body = body;
3921 /* Return the name associated with OMP_CRITICAL statement GS. */
3923 static inline tree
3924 gimple_omp_critical_name (const_gimple gs)
3926 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3927 return gs->gimple_omp_critical.name;
3931 /* Return a pointer to the name associated with OMP critical statement GS. */
3933 static inline tree *
3934 gimple_omp_critical_name_ptr (gimple gs)
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3937 return &gs->gimple_omp_critical.name;
3941 /* Set NAME to be the name associated with OMP critical statement GS. */
3943 static inline void
3944 gimple_omp_critical_set_name (gimple gs, tree name)
3946 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3947 gs->gimple_omp_critical.name = name;
3951 /* Return the kind of OMP for statemement. */
3953 static inline int
3954 gimple_omp_for_kind (const_gimple g)
3956 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3957 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
3961 /* Set the OMP for kind. */
3963 static inline void
3964 gimple_omp_for_set_kind (gimple g, int kind)
3966 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3967 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_FOR_KIND_MASK)
3968 | (kind & GF_OMP_FOR_KIND_MASK);
3972 /* Return the clauses associated with OMP_FOR GS. */
3974 static inline tree
3975 gimple_omp_for_clauses (const_gimple gs)
3977 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3978 return gs->gimple_omp_for.clauses;
3982 /* Return a pointer to the OMP_FOR GS. */
3984 static inline tree *
3985 gimple_omp_for_clauses_ptr (gimple gs)
3987 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3988 return &gs->gimple_omp_for.clauses;
3992 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3994 static inline void
3995 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3997 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3998 gs->gimple_omp_for.clauses = clauses;
4002 /* Get the collapse count of OMP_FOR GS. */
4004 static inline size_t
4005 gimple_omp_for_collapse (gimple gs)
4007 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4008 return gs->gimple_omp_for.collapse;
4012 /* Return the index variable for OMP_FOR GS. */
4014 static inline tree
4015 gimple_omp_for_index (const_gimple gs, size_t i)
4017 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4018 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4019 return gs->gimple_omp_for.iter[i].index;
4023 /* Return a pointer to the index variable for OMP_FOR GS. */
4025 static inline tree *
4026 gimple_omp_for_index_ptr (gimple gs, size_t i)
4028 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4029 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4030 return &gs->gimple_omp_for.iter[i].index;
4034 /* Set INDEX to be the index variable for OMP_FOR GS. */
4036 static inline void
4037 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4039 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4040 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4041 gs->gimple_omp_for.iter[i].index = index;
4045 /* Return the initial value for OMP_FOR GS. */
4047 static inline tree
4048 gimple_omp_for_initial (const_gimple gs, size_t i)
4050 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4051 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4052 return gs->gimple_omp_for.iter[i].initial;
4056 /* Return a pointer to the initial value for OMP_FOR GS. */
4058 static inline tree *
4059 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4061 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4062 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4063 return &gs->gimple_omp_for.iter[i].initial;
4067 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4069 static inline void
4070 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4072 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4073 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4074 gs->gimple_omp_for.iter[i].initial = initial;
4078 /* Return the final value for OMP_FOR GS. */
4080 static inline tree
4081 gimple_omp_for_final (const_gimple gs, size_t i)
4083 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4084 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4085 return gs->gimple_omp_for.iter[i].final;
4089 /* Return a pointer to the final value for OMP_FOR GS. */
4091 static inline tree *
4092 gimple_omp_for_final_ptr (gimple gs, size_t i)
4094 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4095 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4096 return &gs->gimple_omp_for.iter[i].final;
4100 /* Set FINAL to be the final value for OMP_FOR GS. */
4102 static inline void
4103 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4105 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4106 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4107 gs->gimple_omp_for.iter[i].final = final;
4111 /* Return the increment value for OMP_FOR GS. */
4113 static inline tree
4114 gimple_omp_for_incr (const_gimple gs, size_t i)
4116 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4117 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4118 return gs->gimple_omp_for.iter[i].incr;
4122 /* Return a pointer to the increment value for OMP_FOR GS. */
4124 static inline tree *
4125 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4127 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4128 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4129 return &gs->gimple_omp_for.iter[i].incr;
4133 /* Set INCR to be the increment value for OMP_FOR GS. */
4135 static inline void
4136 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4138 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4139 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4140 gs->gimple_omp_for.iter[i].incr = incr;
4144 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4145 statement GS starts. */
4147 static inline gimple_seq *
4148 gimple_omp_for_pre_body_ptr (gimple gs)
4150 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4151 return &gs->gimple_omp_for.pre_body;
4155 /* Return the sequence of statements to execute before the OMP_FOR
4156 statement GS starts. */
4158 static inline gimple_seq
4159 gimple_omp_for_pre_body (gimple gs)
4161 return *gimple_omp_for_pre_body_ptr (gs);
4165 /* Set PRE_BODY to be the sequence of statements to execute before the
4166 OMP_FOR statement GS starts. */
4168 static inline void
4169 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4171 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4172 gs->gimple_omp_for.pre_body = pre_body;
4176 /* Return the clauses associated with OMP_PARALLEL GS. */
4178 static inline tree
4179 gimple_omp_parallel_clauses (const_gimple gs)
4181 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4182 return gs->gimple_omp_parallel.clauses;
4186 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4188 static inline tree *
4189 gimple_omp_parallel_clauses_ptr (gimple gs)
4191 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4192 return &gs->gimple_omp_parallel.clauses;
4196 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4197 GS. */
4199 static inline void
4200 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4202 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4203 gs->gimple_omp_parallel.clauses = clauses;
4207 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4209 static inline tree
4210 gimple_omp_parallel_child_fn (const_gimple gs)
4212 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4213 return gs->gimple_omp_parallel.child_fn;
4216 /* Return a pointer to the child function used to hold the body of
4217 OMP_PARALLEL GS. */
4219 static inline tree *
4220 gimple_omp_parallel_child_fn_ptr (gimple gs)
4222 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4223 return &gs->gimple_omp_parallel.child_fn;
4227 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4229 static inline void
4230 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4232 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4233 gs->gimple_omp_parallel.child_fn = child_fn;
4237 /* Return the artificial argument used to send variables and values
4238 from the parent to the children threads in OMP_PARALLEL GS. */
4240 static inline tree
4241 gimple_omp_parallel_data_arg (const_gimple gs)
4243 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4244 return gs->gimple_omp_parallel.data_arg;
4248 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4250 static inline tree *
4251 gimple_omp_parallel_data_arg_ptr (gimple gs)
4253 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4254 return &gs->gimple_omp_parallel.data_arg;
4258 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4260 static inline void
4261 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4263 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4264 gs->gimple_omp_parallel.data_arg = data_arg;
4268 /* Return the clauses associated with OMP_TASK GS. */
4270 static inline tree
4271 gimple_omp_task_clauses (const_gimple gs)
4273 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4274 return gs->gimple_omp_parallel.clauses;
4278 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4280 static inline tree *
4281 gimple_omp_task_clauses_ptr (gimple gs)
4283 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4284 return &gs->gimple_omp_parallel.clauses;
4288 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4289 GS. */
4291 static inline void
4292 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4294 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4295 gs->gimple_omp_parallel.clauses = clauses;
4299 /* Return the child function used to hold the body of OMP_TASK GS. */
4301 static inline tree
4302 gimple_omp_task_child_fn (const_gimple gs)
4304 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4305 return gs->gimple_omp_parallel.child_fn;
4308 /* Return a pointer to the child function used to hold the body of
4309 OMP_TASK GS. */
4311 static inline tree *
4312 gimple_omp_task_child_fn_ptr (gimple gs)
4314 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4315 return &gs->gimple_omp_parallel.child_fn;
4319 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4321 static inline void
4322 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4324 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4325 gs->gimple_omp_parallel.child_fn = child_fn;
4329 /* Return the artificial argument used to send variables and values
4330 from the parent to the children threads in OMP_TASK GS. */
4332 static inline tree
4333 gimple_omp_task_data_arg (const_gimple gs)
4335 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4336 return gs->gimple_omp_parallel.data_arg;
4340 /* Return a pointer to the data argument for OMP_TASK GS. */
4342 static inline tree *
4343 gimple_omp_task_data_arg_ptr (gimple gs)
4345 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4346 return &gs->gimple_omp_parallel.data_arg;
4350 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4352 static inline void
4353 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4355 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4356 gs->gimple_omp_parallel.data_arg = data_arg;
4360 /* Return the clauses associated with OMP_TASK GS. */
4362 static inline tree
4363 gimple_omp_taskreg_clauses (const_gimple gs)
4365 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4366 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4367 return gs->gimple_omp_parallel.clauses;
4371 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4373 static inline tree *
4374 gimple_omp_taskreg_clauses_ptr (gimple gs)
4376 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4377 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4378 return &gs->gimple_omp_parallel.clauses;
4382 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4383 GS. */
4385 static inline void
4386 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4388 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4389 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4390 gs->gimple_omp_parallel.clauses = clauses;
4394 /* Return the child function used to hold the body of OMP_TASK GS. */
4396 static inline tree
4397 gimple_omp_taskreg_child_fn (const_gimple gs)
4399 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4400 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4401 return gs->gimple_omp_parallel.child_fn;
4404 /* Return a pointer to the child function used to hold the body of
4405 OMP_TASK GS. */
4407 static inline tree *
4408 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4410 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4411 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4412 return &gs->gimple_omp_parallel.child_fn;
4416 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4418 static inline void
4419 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4421 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4422 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4423 gs->gimple_omp_parallel.child_fn = child_fn;
4427 /* Return the artificial argument used to send variables and values
4428 from the parent to the children threads in OMP_TASK GS. */
4430 static inline tree
4431 gimple_omp_taskreg_data_arg (const_gimple gs)
4433 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4434 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4435 return gs->gimple_omp_parallel.data_arg;
4439 /* Return a pointer to the data argument for OMP_TASK GS. */
4441 static inline tree *
4442 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4444 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4445 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4446 return &gs->gimple_omp_parallel.data_arg;
4450 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4452 static inline void
4453 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4455 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4456 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4457 gs->gimple_omp_parallel.data_arg = data_arg;
4461 /* Return the copy function used to hold the body of OMP_TASK GS. */
4463 static inline tree
4464 gimple_omp_task_copy_fn (const_gimple gs)
4466 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4467 return gs->gimple_omp_task.copy_fn;
4470 /* Return a pointer to the copy function used to hold the body of
4471 OMP_TASK GS. */
4473 static inline tree *
4474 gimple_omp_task_copy_fn_ptr (gimple gs)
4476 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4477 return &gs->gimple_omp_task.copy_fn;
4481 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4483 static inline void
4484 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4486 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4487 gs->gimple_omp_task.copy_fn = copy_fn;
4491 /* Return size of the data block in bytes in OMP_TASK GS. */
4493 static inline tree
4494 gimple_omp_task_arg_size (const_gimple gs)
4496 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4497 return gs->gimple_omp_task.arg_size;
4501 /* Return a pointer to the data block size for OMP_TASK GS. */
4503 static inline tree *
4504 gimple_omp_task_arg_size_ptr (gimple gs)
4506 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4507 return &gs->gimple_omp_task.arg_size;
4511 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4513 static inline void
4514 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4516 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4517 gs->gimple_omp_task.arg_size = arg_size;
4521 /* Return align of the data block in bytes in OMP_TASK GS. */
4523 static inline tree
4524 gimple_omp_task_arg_align (const_gimple gs)
4526 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4527 return gs->gimple_omp_task.arg_align;
4531 /* Return a pointer to the data block align for OMP_TASK GS. */
4533 static inline tree *
4534 gimple_omp_task_arg_align_ptr (gimple gs)
4536 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4537 return &gs->gimple_omp_task.arg_align;
4541 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4543 static inline void
4544 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4546 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4547 gs->gimple_omp_task.arg_align = arg_align;
4551 /* Return the clauses associated with OMP_SINGLE GS. */
4553 static inline tree
4554 gimple_omp_single_clauses (const_gimple gs)
4556 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4557 return gs->gimple_omp_single.clauses;
4561 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4563 static inline tree *
4564 gimple_omp_single_clauses_ptr (gimple gs)
4566 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4567 return &gs->gimple_omp_single.clauses;
4571 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4573 static inline void
4574 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4576 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4577 gs->gimple_omp_single.clauses = clauses;
4581 /* Return the clauses associated with OMP_SECTIONS GS. */
4583 static inline tree
4584 gimple_omp_sections_clauses (const_gimple gs)
4586 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4587 return gs->gimple_omp_sections.clauses;
4591 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4593 static inline tree *
4594 gimple_omp_sections_clauses_ptr (gimple gs)
4596 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4597 return &gs->gimple_omp_sections.clauses;
4601 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4602 GS. */
4604 static inline void
4605 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4607 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4608 gs->gimple_omp_sections.clauses = clauses;
4612 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4613 in GS. */
4615 static inline tree
4616 gimple_omp_sections_control (const_gimple gs)
4618 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4619 return gs->gimple_omp_sections.control;
4623 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4624 GS. */
4626 static inline tree *
4627 gimple_omp_sections_control_ptr (gimple gs)
4629 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4630 return &gs->gimple_omp_sections.control;
4634 /* Set CONTROL to be the set of clauses associated with the
4635 GIMPLE_OMP_SECTIONS in GS. */
4637 static inline void
4638 gimple_omp_sections_set_control (gimple gs, tree control)
4640 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4641 gs->gimple_omp_sections.control = control;
4645 /* Set COND to be the condition code for OMP_FOR GS. */
4647 static inline void
4648 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4650 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4651 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4652 && i < gs->gimple_omp_for.collapse);
4653 gs->gimple_omp_for.iter[i].cond = cond;
4657 /* Return the condition code associated with OMP_FOR GS. */
4659 static inline enum tree_code
4660 gimple_omp_for_cond (const_gimple gs, size_t i)
4662 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4663 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4664 return gs->gimple_omp_for.iter[i].cond;
4668 /* Set the value being stored in an atomic store. */
4670 static inline void
4671 gimple_omp_atomic_store_set_val (gimple g, tree val)
4673 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4674 g->gimple_omp_atomic_store.val = val;
4678 /* Return the value being stored in an atomic store. */
4680 static inline tree
4681 gimple_omp_atomic_store_val (const_gimple g)
4683 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4684 return g->gimple_omp_atomic_store.val;
4688 /* Return a pointer to the value being stored in an atomic store. */
4690 static inline tree *
4691 gimple_omp_atomic_store_val_ptr (gimple g)
4693 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4694 return &g->gimple_omp_atomic_store.val;
4698 /* Set the LHS of an atomic load. */
4700 static inline void
4701 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4703 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4704 g->gimple_omp_atomic_load.lhs = lhs;
4708 /* Get the LHS of an atomic load. */
4710 static inline tree
4711 gimple_omp_atomic_load_lhs (const_gimple g)
4713 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4714 return g->gimple_omp_atomic_load.lhs;
4718 /* Return a pointer to the LHS of an atomic load. */
4720 static inline tree *
4721 gimple_omp_atomic_load_lhs_ptr (gimple g)
4723 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4724 return &g->gimple_omp_atomic_load.lhs;
4728 /* Set the RHS of an atomic load. */
4730 static inline void
4731 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4733 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4734 g->gimple_omp_atomic_load.rhs = rhs;
4738 /* Get the RHS of an atomic load. */
4740 static inline tree
4741 gimple_omp_atomic_load_rhs (const_gimple g)
4743 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4744 return g->gimple_omp_atomic_load.rhs;
4748 /* Return a pointer to the RHS of an atomic load. */
4750 static inline tree *
4751 gimple_omp_atomic_load_rhs_ptr (gimple g)
4753 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4754 return &g->gimple_omp_atomic_load.rhs;
4758 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4760 static inline tree
4761 gimple_omp_continue_control_def (const_gimple g)
4763 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4764 return g->gimple_omp_continue.control_def;
4767 /* The same as above, but return the address. */
4769 static inline tree *
4770 gimple_omp_continue_control_def_ptr (gimple g)
4772 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4773 return &g->gimple_omp_continue.control_def;
4776 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4778 static inline void
4779 gimple_omp_continue_set_control_def (gimple g, tree def)
4781 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4782 g->gimple_omp_continue.control_def = def;
4786 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4788 static inline tree
4789 gimple_omp_continue_control_use (const_gimple g)
4791 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4792 return g->gimple_omp_continue.control_use;
4796 /* The same as above, but return the address. */
4798 static inline tree *
4799 gimple_omp_continue_control_use_ptr (gimple g)
4801 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4802 return &g->gimple_omp_continue.control_use;
4806 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4808 static inline void
4809 gimple_omp_continue_set_control_use (gimple g, tree use)
4811 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4812 g->gimple_omp_continue.control_use = use;
4815 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4817 static inline gimple_seq *
4818 gimple_transaction_body_ptr (gimple gs)
4820 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4821 return &gs->gimple_transaction.body;
4824 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4826 static inline gimple_seq
4827 gimple_transaction_body (gimple gs)
4829 return *gimple_transaction_body_ptr (gs);
4832 /* Return the label associated with a GIMPLE_TRANSACTION. */
4834 static inline tree
4835 gimple_transaction_label (const_gimple gs)
4837 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4838 return gs->gimple_transaction.label;
4841 static inline tree *
4842 gimple_transaction_label_ptr (gimple gs)
4844 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4845 return &gs->gimple_transaction.label;
4848 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4850 static inline unsigned int
4851 gimple_transaction_subcode (const_gimple gs)
4853 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4854 return gs->gsbase.subcode;
4857 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4859 static inline void
4860 gimple_transaction_set_body (gimple gs, gimple_seq body)
4862 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4863 gs->gimple_transaction.body = body;
4866 /* Set the label associated with a GIMPLE_TRANSACTION. */
4868 static inline void
4869 gimple_transaction_set_label (gimple gs, tree label)
4871 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4872 gs->gimple_transaction.label = label;
4875 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4877 static inline void
4878 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4880 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4881 gs->gsbase.subcode = subcode;
4885 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4887 static inline tree *
4888 gimple_return_retval_ptr (const_gimple gs)
4890 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4891 return gimple_op_ptr (gs, 0);
4894 /* Return the return value for GIMPLE_RETURN GS. */
4896 static inline tree
4897 gimple_return_retval (const_gimple gs)
4899 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4900 return gimple_op (gs, 0);
4904 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4906 static inline void
4907 gimple_return_set_retval (gimple gs, tree retval)
4909 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4910 gimple_set_op (gs, 0, retval);
4914 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4916 #define CASE_GIMPLE_OMP \
4917 case GIMPLE_OMP_PARALLEL: \
4918 case GIMPLE_OMP_TASK: \
4919 case GIMPLE_OMP_FOR: \
4920 case GIMPLE_OMP_SECTIONS: \
4921 case GIMPLE_OMP_SECTIONS_SWITCH: \
4922 case GIMPLE_OMP_SINGLE: \
4923 case GIMPLE_OMP_SECTION: \
4924 case GIMPLE_OMP_MASTER: \
4925 case GIMPLE_OMP_ORDERED: \
4926 case GIMPLE_OMP_CRITICAL: \
4927 case GIMPLE_OMP_RETURN: \
4928 case GIMPLE_OMP_ATOMIC_LOAD: \
4929 case GIMPLE_OMP_ATOMIC_STORE: \
4930 case GIMPLE_OMP_CONTINUE
4932 static inline bool
4933 is_gimple_omp (const_gimple stmt)
4935 switch (gimple_code (stmt))
4937 CASE_GIMPLE_OMP:
4938 return true;
4939 default:
4940 return false;
4945 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4947 static inline bool
4948 gimple_nop_p (const_gimple g)
4950 return gimple_code (g) == GIMPLE_NOP;
4954 /* Return true if GS is a GIMPLE_RESX. */
4956 static inline bool
4957 is_gimple_resx (const_gimple gs)
4959 return gimple_code (gs) == GIMPLE_RESX;
4962 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4964 static inline enum br_predictor
4965 gimple_predict_predictor (gimple gs)
4967 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4968 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4972 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4974 static inline void
4975 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4977 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4978 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4979 | (unsigned) predictor;
4983 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4985 static inline enum prediction
4986 gimple_predict_outcome (gimple gs)
4988 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4989 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4993 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4995 static inline void
4996 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4998 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4999 if (outcome == TAKEN)
5000 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
5001 else
5002 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
5006 /* Return the type of the main expression computed by STMT. Return
5007 void_type_node if the statement computes nothing. */
5009 static inline tree
5010 gimple_expr_type (const_gimple stmt)
5012 enum gimple_code code = gimple_code (stmt);
5014 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5016 tree type;
5017 /* In general we want to pass out a type that can be substituted
5018 for both the RHS and the LHS types if there is a possibly
5019 useless conversion involved. That means returning the
5020 original RHS type as far as we can reconstruct it. */
5021 if (code == GIMPLE_CALL)
5022 type = gimple_call_return_type (stmt);
5023 else
5024 switch (gimple_assign_rhs_code (stmt))
5026 case POINTER_PLUS_EXPR:
5027 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5028 break;
5030 default:
5031 /* As fallback use the type of the LHS. */
5032 type = TREE_TYPE (gimple_get_lhs (stmt));
5033 break;
5035 return type;
5037 else if (code == GIMPLE_COND)
5038 return boolean_type_node;
5039 else
5040 return void_type_node;
5043 /* Return true if TYPE is a suitable type for a scalar register variable. */
5045 static inline bool
5046 is_gimple_reg_type (tree type)
5048 return !AGGREGATE_TYPE_P (type);
5051 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5053 static inline gimple_stmt_iterator
5054 gsi_start_1 (gimple_seq *seq)
5056 gimple_stmt_iterator i;
5058 i.ptr = gimple_seq_first (*seq);
5059 i.seq = seq;
5060 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5062 return i;
5065 #define gsi_start(x) gsi_start_1(&(x))
5067 static inline gimple_stmt_iterator
5068 gsi_none (void)
5070 gimple_stmt_iterator i;
5071 i.ptr = NULL;
5072 i.seq = NULL;
5073 i.bb = NULL;
5074 return i;
5077 /* Return a new iterator pointing to the first statement in basic block BB. */
5079 static inline gimple_stmt_iterator
5080 gsi_start_bb (basic_block bb)
5082 gimple_stmt_iterator i;
5083 gimple_seq *seq;
5085 seq = bb_seq_addr (bb);
5086 i.ptr = gimple_seq_first (*seq);
5087 i.seq = seq;
5088 i.bb = bb;
5090 return i;
5094 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5096 static inline gimple_stmt_iterator
5097 gsi_last_1 (gimple_seq *seq)
5099 gimple_stmt_iterator i;
5101 i.ptr = gimple_seq_last (*seq);
5102 i.seq = seq;
5103 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5105 return i;
5108 #define gsi_last(x) gsi_last_1(&(x))
5110 /* Return a new iterator pointing to the last statement in basic block BB. */
5112 static inline gimple_stmt_iterator
5113 gsi_last_bb (basic_block bb)
5115 gimple_stmt_iterator i;
5116 gimple_seq *seq;
5118 seq = bb_seq_addr (bb);
5119 i.ptr = gimple_seq_last (*seq);
5120 i.seq = seq;
5121 i.bb = bb;
5123 return i;
5127 /* Return true if I is at the end of its sequence. */
5129 static inline bool
5130 gsi_end_p (gimple_stmt_iterator i)
5132 return i.ptr == NULL;
5136 /* Return true if I is one statement before the end of its sequence. */
5138 static inline bool
5139 gsi_one_before_end_p (gimple_stmt_iterator i)
5141 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5145 /* Advance the iterator to the next gimple statement. */
5147 static inline void
5148 gsi_next (gimple_stmt_iterator *i)
5150 i->ptr = i->ptr->gsbase.next;
5153 /* Advance the iterator to the previous gimple statement. */
5155 static inline void
5156 gsi_prev (gimple_stmt_iterator *i)
5158 gimple prev = i->ptr->gsbase.prev;
5159 if (prev->gsbase.next)
5160 i->ptr = prev;
5161 else
5162 i->ptr = NULL;
5165 /* Return the current stmt. */
5167 static inline gimple
5168 gsi_stmt (gimple_stmt_iterator i)
5170 return i.ptr;
5173 /* Return a block statement iterator that points to the first non-label
5174 statement in block BB. */
5176 static inline gimple_stmt_iterator
5177 gsi_after_labels (basic_block bb)
5179 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5181 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5182 gsi_next (&gsi);
5184 return gsi;
5187 /* Advance the iterator to the next non-debug gimple statement. */
5189 static inline void
5190 gsi_next_nondebug (gimple_stmt_iterator *i)
5194 gsi_next (i);
5196 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5199 /* Advance the iterator to the next non-debug gimple statement. */
5201 static inline void
5202 gsi_prev_nondebug (gimple_stmt_iterator *i)
5206 gsi_prev (i);
5208 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5211 /* Return a new iterator pointing to the first non-debug statement in
5212 basic block BB. */
5214 static inline gimple_stmt_iterator
5215 gsi_start_nondebug_bb (basic_block bb)
5217 gimple_stmt_iterator i = gsi_start_bb (bb);
5219 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5220 gsi_next_nondebug (&i);
5222 return i;
5225 /* Return a new iterator pointing to the last non-debug statement in
5226 basic block BB. */
5228 static inline gimple_stmt_iterator
5229 gsi_last_nondebug_bb (basic_block bb)
5231 gimple_stmt_iterator i = gsi_last_bb (bb);
5233 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5234 gsi_prev_nondebug (&i);
5236 return i;
5240 /* Return the basic block associated with this iterator. */
5242 static inline basic_block
5243 gsi_bb (gimple_stmt_iterator i)
5245 return i.bb;
5249 /* Return the sequence associated with this iterator. */
5251 static inline gimple_seq
5252 gsi_seq (gimple_stmt_iterator i)
5254 return *i.seq;
5258 enum gsi_iterator_update
5260 GSI_NEW_STMT, /* Only valid when single statement is added, move
5261 iterator to it. */
5262 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5263 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5264 for linking other statements in the same
5265 direction. */
5268 /* In gimple-iterator.c */
5269 gimple_stmt_iterator gsi_start_phis (basic_block);
5270 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5271 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5272 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5273 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5274 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5275 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5276 enum gsi_iterator_update);
5277 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5278 enum gsi_iterator_update);
5279 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5280 enum gsi_iterator_update);
5281 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5282 enum gsi_iterator_update);
5283 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5284 enum gsi_iterator_update);
5285 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5286 enum gsi_iterator_update);
5287 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5288 enum gsi_iterator_update);
5289 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5290 enum gsi_iterator_update);
5291 bool gsi_remove (gimple_stmt_iterator *, bool);
5292 gimple_stmt_iterator gsi_for_stmt (gimple);
5293 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5294 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5295 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5296 void gsi_insert_on_edge (edge, gimple);
5297 void gsi_insert_seq_on_edge (edge, gimple_seq);
5298 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5299 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5300 void gsi_commit_one_edge_insert (edge, basic_block *);
5301 void gsi_commit_edge_inserts (void);
5302 gimple gimple_call_copy_skip_args (gimple, bitmap);
5305 /* Convenience routines to walk all statements of a gimple function.
5306 Note that this is useful exclusively before the code is converted
5307 into SSA form. Once the program is in SSA form, the standard
5308 operand interface should be used to analyze/modify statements. */
5309 struct walk_stmt_info
5311 /* Points to the current statement being walked. */
5312 gimple_stmt_iterator gsi;
5314 /* Additional data that the callback functions may want to carry
5315 through the recursion. */
5316 void *info;
5318 /* Pointer map used to mark visited tree nodes when calling
5319 walk_tree on each operand. If set to NULL, duplicate tree nodes
5320 will be visited more than once. */
5321 struct pointer_set_t *pset;
5323 /* Operand returned by the callbacks. This is set when calling
5324 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5325 returns non-NULL, this field will contain the tree returned by
5326 the last callback. */
5327 tree callback_result;
5329 /* Indicates whether the operand being examined may be replaced
5330 with something that matches is_gimple_val (if true) or something
5331 slightly more complicated (if false). "Something" technically
5332 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5333 but we never try to form anything more complicated than that, so
5334 we don't bother checking.
5336 Also note that CALLBACK should update this flag while walking the
5337 sub-expressions of a statement. For instance, when walking the
5338 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5339 to true, however, when walking &var, the operand of that
5340 ADDR_EXPR does not need to be a GIMPLE value. */
5341 BOOL_BITFIELD val_only : 1;
5343 /* True if we are currently walking the LHS of an assignment. */
5344 BOOL_BITFIELD is_lhs : 1;
5346 /* Optional. Set to true by the callback functions if they made any
5347 changes. */
5348 BOOL_BITFIELD changed : 1;
5350 /* True if we're interested in location information. */
5351 BOOL_BITFIELD want_locations : 1;
5353 /* True if we've removed the statement that was processed. */
5354 BOOL_BITFIELD removed_stmt : 1;
5357 /* Callback for walk_gimple_stmt. Called for every statement found
5358 during traversal. The first argument points to the statement to
5359 walk. The second argument is a flag that the callback sets to
5360 'true' if it the callback handled all the operands and
5361 sub-statements of the statement (the default value of this flag is
5362 'false'). The third argument is an anonymous pointer to data
5363 to be used by the callback. */
5364 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5365 struct walk_stmt_info *);
5367 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5368 struct walk_stmt_info *);
5369 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5370 struct walk_stmt_info *);
5371 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5372 struct walk_stmt_info *);
5373 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5375 /* Enum and arrays used for allocation stats. Keep in sync with
5376 gimple.c:gimple_alloc_kind_names. */
5377 enum gimple_alloc_kind
5379 gimple_alloc_kind_assign, /* Assignments. */
5380 gimple_alloc_kind_phi, /* PHI nodes. */
5381 gimple_alloc_kind_cond, /* Conditionals. */
5382 gimple_alloc_kind_rest, /* Everything else. */
5383 gimple_alloc_kind_all
5386 extern int gimple_alloc_counts[];
5387 extern int gimple_alloc_sizes[];
5389 /* Return the allocation kind for a given stmt CODE. */
5390 static inline enum gimple_alloc_kind
5391 gimple_alloc_kind (enum gimple_code code)
5393 switch (code)
5395 case GIMPLE_ASSIGN:
5396 return gimple_alloc_kind_assign;
5397 case GIMPLE_PHI:
5398 return gimple_alloc_kind_phi;
5399 case GIMPLE_COND:
5400 return gimple_alloc_kind_cond;
5401 default:
5402 return gimple_alloc_kind_rest;
5406 extern void dump_gimple_statistics (void);
5408 /* In gimple-fold.c. */
5409 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5410 tree gimple_fold_builtin (gimple);
5411 bool fold_stmt (gimple_stmt_iterator *);
5412 bool fold_stmt_inplace (gimple_stmt_iterator *);
5413 tree get_symbol_constant_value (tree);
5414 tree canonicalize_constructor_val (tree, tree);
5415 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5416 enum tree_code, tree, tree);
5417 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5418 enum tree_code, tree, tree);
5420 bool gimple_val_nonnegative_real_p (tree);
5423 /* Set the location of all statements in SEQ to LOC. */
5425 static inline void
5426 gimple_seq_set_location (gimple_seq seq, location_t loc)
5428 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5429 gimple_set_location (gsi_stmt (i), loc);
5432 #endif /* GCC_GIMPLE_H */