2013-09-06 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / gimple.h
blob9f29561eb3787a9cc11b30da6139b4086f6e5065
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);
926 /* In gimplify.c */
927 extern tree create_tmp_var_raw (tree, const char *);
928 extern tree create_tmp_var_name (const char *);
929 extern tree create_tmp_var (tree, const char *);
930 extern tree create_tmp_reg (tree, const char *);
931 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
932 extern tree get_formal_tmp_var (tree, gimple_seq *);
933 extern void declare_vars (tree, gimple, bool);
934 extern void annotate_all_with_location (gimple_seq, location_t);
936 /* Validation of GIMPLE expressions. Note that these predicates only check
937 the basic form of the expression, they don't recurse to make sure that
938 underlying nodes are also of the right form. */
939 typedef bool (*gimple_predicate)(tree);
942 /* FIXME we should deduce this from the predicate. */
943 enum fallback {
944 fb_none = 0, /* Do not generate a temporary. */
946 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
947 gimplified expression. */
949 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
950 gimplified expression. */
952 fb_mayfail = 4, /* Gimplification may fail. Error issued
953 afterwards. */
954 fb_either= fb_rvalue | fb_lvalue
957 typedef int fallback_t;
959 enum gimplify_status {
960 GS_ERROR = -2, /* Something Bad Seen. */
961 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
962 GS_OK = 0, /* We did something, maybe more to do. */
963 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
966 /* Formal (expression) temporary table handling: multiple occurrences of
967 the same scalar expression are evaluated into the same temporary. */
969 typedef struct gimple_temp_hash_elt
971 tree val; /* Key */
972 tree temp; /* Value */
973 } elt_t;
975 /* Gimplify hashtable helper. */
977 struct gimplify_hasher : typed_free_remove <elt_t>
979 typedef elt_t value_type;
980 typedef elt_t compare_type;
981 static inline hashval_t hash (const value_type *);
982 static inline bool equal (const value_type *, const compare_type *);
985 inline hashval_t
986 gimplify_hasher::hash (const value_type *p)
988 tree t = p->val;
989 return iterative_hash_expr (t, 0);
992 inline bool
993 gimplify_hasher::equal (const value_type *p1, const compare_type *p2)
995 tree t1 = p1->val;
996 tree t2 = p2->val;
997 enum tree_code code = TREE_CODE (t1);
999 if (TREE_CODE (t2) != code
1000 || TREE_TYPE (t1) != TREE_TYPE (t2))
1001 return false;
1003 if (!operand_equal_p (t1, t2, 0))
1004 return false;
1006 #ifdef ENABLE_CHECKING
1007 /* Only allow them to compare equal if they also hash equal; otherwise
1008 results are nondeterminate, and we fail bootstrap comparison. */
1009 gcc_assert (hash (p1) == hash (p2));
1010 #endif
1012 return true;
1015 struct gimplify_ctx
1017 struct gimplify_ctx *prev_context;
1019 vec<gimple> bind_expr_stack;
1020 tree temps;
1021 gimple_seq conditional_cleanups;
1022 tree exit_label;
1023 tree return_temp;
1025 vec<tree> case_labels;
1026 /* The formal temporary table. Should this be persistent? */
1027 hash_table <gimplify_hasher> temp_htab;
1029 int conditions;
1030 bool save_stack;
1031 bool into_ssa;
1032 bool allow_rhs_cond_expr;
1033 bool in_cleanup_point_expr;
1036 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1037 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1038 fields). */
1039 static inline bool
1040 is_gimple_sizepos (tree expr)
1042 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1043 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1044 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1045 function, the gimplifier will want to replace it with a new variable,
1046 but that will cause problems if this type is from outside the function.
1047 It's OK to have that here. */
1048 return (expr == NULL_TREE
1049 || TREE_CONSTANT (expr)
1050 || TREE_CODE (expr) == VAR_DECL
1051 || CONTAINS_PLACEHOLDER_P (expr));
1054 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1055 bool (*) (tree), fallback_t);
1056 extern void gimplify_type_sizes (tree, gimple_seq *);
1057 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1058 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1059 bool, tree);
1060 extern bool gimplify_stmt (tree *, gimple_seq *);
1061 extern gimple gimplify_body (tree, bool);
1062 extern void push_gimplify_context (struct gimplify_ctx *);
1063 extern void pop_gimplify_context (gimple);
1064 extern void gimplify_and_add (tree, gimple_seq *);
1066 /* Miscellaneous helpers. */
1067 extern void gimple_add_tmp_var (tree);
1068 extern gimple gimple_current_bind_expr (void);
1069 extern vec<gimple> gimple_bind_expr_stack (void);
1070 extern tree voidify_wrapper_expr (tree, tree);
1071 extern tree build_and_jump (tree *);
1072 extern tree force_labels_r (tree *, int *, void *);
1073 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1074 gimple_seq *);
1075 struct gimplify_omp_ctx;
1076 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1077 extern tree gimple_boolify (tree);
1078 extern gimple_predicate rhs_predicate_for (tree);
1079 extern tree canonicalize_cond_expr_cond (tree);
1081 /* In omp-low.c. */
1082 extern tree omp_reduction_init (tree, tree);
1084 /* In trans-mem.c. */
1085 extern void diagnose_tm_safe_errors (tree);
1086 extern void compute_transaction_bits (void);
1088 /* In tree-nested.c. */
1089 extern void lower_nested_functions (tree);
1090 extern void insert_field_into_struct (tree, tree);
1092 /* In gimplify.c. */
1093 extern void gimplify_function_tree (tree);
1095 /* In cfgexpand.c. */
1096 extern tree gimple_assign_rhs_to_tree (gimple);
1098 /* In builtins.c */
1099 extern bool validate_gimple_arglist (const_gimple, ...);
1101 /* In tree-ssa.c */
1102 extern bool tree_ssa_useless_type_conversion (tree);
1103 extern tree tree_ssa_strip_useless_type_conversions (tree);
1104 extern bool useless_type_conversion_p (tree, tree);
1105 extern bool types_compatible_p (tree, tree);
1107 /* In tree-ssa-coalesce.c */
1108 extern bool gimple_can_coalesce_p (tree, tree);
1110 /* Return the first node in GIMPLE sequence S. */
1112 static inline gimple_seq_node
1113 gimple_seq_first (gimple_seq s)
1115 return s;
1119 /* Return the first statement in GIMPLE sequence S. */
1121 static inline gimple
1122 gimple_seq_first_stmt (gimple_seq s)
1124 gimple_seq_node n = gimple_seq_first (s);
1125 return n;
1129 /* Return the last node in GIMPLE sequence S. */
1131 static inline gimple_seq_node
1132 gimple_seq_last (gimple_seq s)
1134 return s ? s->gsbase.prev : NULL;
1138 /* Return the last statement in GIMPLE sequence S. */
1140 static inline gimple
1141 gimple_seq_last_stmt (gimple_seq s)
1143 gimple_seq_node n = gimple_seq_last (s);
1144 return n;
1148 /* Set the last node in GIMPLE sequence *PS to LAST. */
1150 static inline void
1151 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1153 (*ps)->gsbase.prev = last;
1157 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1159 static inline void
1160 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1162 *ps = first;
1166 /* Return true if GIMPLE sequence S is empty. */
1168 static inline bool
1169 gimple_seq_empty_p (gimple_seq s)
1171 return s == NULL;
1174 void gimple_seq_add_stmt (gimple_seq *, gimple);
1176 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1177 *SEQ_P is NULL, a new sequence is allocated. This function is
1178 similar to gimple_seq_add_stmt, but does not scan the operands.
1179 During gimplification, we need to manipulate statement sequences
1180 before the def/use vectors have been constructed. */
1181 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1183 /* Allocate a new sequence and initialize its first element with STMT. */
1185 static inline gimple_seq
1186 gimple_seq_alloc_with_stmt (gimple stmt)
1188 gimple_seq seq = NULL;
1189 gimple_seq_add_stmt (&seq, stmt);
1190 return seq;
1194 /* Returns the sequence of statements in BB. */
1196 static inline gimple_seq
1197 bb_seq (const_basic_block bb)
1199 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1202 static inline gimple_seq *
1203 bb_seq_addr (basic_block bb)
1205 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1208 /* Sets the sequence of statements in BB to SEQ. */
1210 static inline void
1211 set_bb_seq (basic_block bb, gimple_seq seq)
1213 gcc_checking_assert (!(bb->flags & BB_RTL));
1214 bb->il.gimple.seq = seq;
1218 /* Return the code for GIMPLE statement G. */
1220 static inline enum gimple_code
1221 gimple_code (const_gimple g)
1223 return g->gsbase.code;
1227 /* Return the GSS code used by a GIMPLE code. */
1229 static inline enum gimple_statement_structure_enum
1230 gss_for_code (enum gimple_code code)
1232 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1233 return gss_for_code_[code];
1237 /* Return which GSS code is used by GS. */
1239 static inline enum gimple_statement_structure_enum
1240 gimple_statement_structure (gimple gs)
1242 return gss_for_code (gimple_code (gs));
1246 /* Return true if statement G has sub-statements. This is only true for
1247 High GIMPLE statements. */
1249 static inline bool
1250 gimple_has_substatements (gimple g)
1252 switch (gimple_code (g))
1254 case GIMPLE_BIND:
1255 case GIMPLE_CATCH:
1256 case GIMPLE_EH_FILTER:
1257 case GIMPLE_EH_ELSE:
1258 case GIMPLE_TRY:
1259 case GIMPLE_OMP_FOR:
1260 case GIMPLE_OMP_MASTER:
1261 case GIMPLE_OMP_ORDERED:
1262 case GIMPLE_OMP_SECTION:
1263 case GIMPLE_OMP_PARALLEL:
1264 case GIMPLE_OMP_TASK:
1265 case GIMPLE_OMP_SECTIONS:
1266 case GIMPLE_OMP_SINGLE:
1267 case GIMPLE_OMP_CRITICAL:
1268 case GIMPLE_WITH_CLEANUP_EXPR:
1269 case GIMPLE_TRANSACTION:
1270 return true;
1272 default:
1273 return false;
1278 /* Return the basic block holding statement G. */
1280 static inline basic_block
1281 gimple_bb (const_gimple g)
1283 return g->gsbase.bb;
1287 /* Return the lexical scope block holding statement G. */
1289 static inline tree
1290 gimple_block (const_gimple g)
1292 return LOCATION_BLOCK (g->gsbase.location);
1296 /* Set BLOCK to be the lexical scope block holding statement G. */
1298 static inline void
1299 gimple_set_block (gimple g, tree block)
1301 if (block)
1302 g->gsbase.location =
1303 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1304 else
1305 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1309 /* Return location information for statement G. */
1311 static inline location_t
1312 gimple_location (const_gimple g)
1314 return g->gsbase.location;
1317 /* Return pointer to location information for statement G. */
1319 static inline const location_t *
1320 gimple_location_ptr (const_gimple g)
1322 return &g->gsbase.location;
1326 /* Set location information for statement G. */
1328 static inline void
1329 gimple_set_location (gimple g, location_t location)
1331 g->gsbase.location = location;
1335 /* Return true if G contains location information. */
1337 static inline bool
1338 gimple_has_location (const_gimple g)
1340 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1344 /* Return the file name of the location of STMT. */
1346 static inline const char *
1347 gimple_filename (const_gimple stmt)
1349 return LOCATION_FILE (gimple_location (stmt));
1353 /* Return the line number of the location of STMT. */
1355 static inline int
1356 gimple_lineno (const_gimple stmt)
1358 return LOCATION_LINE (gimple_location (stmt));
1362 /* Determine whether SEQ is a singleton. */
1364 static inline bool
1365 gimple_seq_singleton_p (gimple_seq seq)
1367 return ((gimple_seq_first (seq) != NULL)
1368 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1371 /* Return true if no warnings should be emitted for statement STMT. */
1373 static inline bool
1374 gimple_no_warning_p (const_gimple stmt)
1376 return stmt->gsbase.no_warning;
1379 /* Set the no_warning flag of STMT to NO_WARNING. */
1381 static inline void
1382 gimple_set_no_warning (gimple stmt, bool no_warning)
1384 stmt->gsbase.no_warning = (unsigned) no_warning;
1387 /* Set the visited status on statement STMT to VISITED_P. */
1389 static inline void
1390 gimple_set_visited (gimple stmt, bool visited_p)
1392 stmt->gsbase.visited = (unsigned) visited_p;
1396 /* Return the visited status for statement STMT. */
1398 static inline bool
1399 gimple_visited_p (gimple stmt)
1401 return stmt->gsbase.visited;
1405 /* Set pass local flag PLF on statement STMT to VAL_P. */
1407 static inline void
1408 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1410 if (val_p)
1411 stmt->gsbase.plf |= (unsigned int) plf;
1412 else
1413 stmt->gsbase.plf &= ~((unsigned int) plf);
1417 /* Return the value of pass local flag PLF on statement STMT. */
1419 static inline unsigned int
1420 gimple_plf (gimple stmt, enum plf_mask plf)
1422 return stmt->gsbase.plf & ((unsigned int) plf);
1426 /* Set the UID of statement. */
1428 static inline void
1429 gimple_set_uid (gimple g, unsigned uid)
1431 g->gsbase.uid = uid;
1435 /* Return the UID of statement. */
1437 static inline unsigned
1438 gimple_uid (const_gimple g)
1440 return g->gsbase.uid;
1444 /* Make statement G a singleton sequence. */
1446 static inline void
1447 gimple_init_singleton (gimple g)
1449 g->gsbase.next = NULL;
1450 g->gsbase.prev = g;
1454 /* Return true if GIMPLE statement G has register or memory operands. */
1456 static inline bool
1457 gimple_has_ops (const_gimple g)
1459 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1463 /* Return true if GIMPLE statement G has memory operands. */
1465 static inline bool
1466 gimple_has_mem_ops (const_gimple g)
1468 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1472 /* Return the set of USE operands for statement G. */
1474 static inline struct use_optype_d *
1475 gimple_use_ops (const_gimple g)
1477 if (!gimple_has_ops (g))
1478 return NULL;
1479 return g->gsops.opbase.use_ops;
1483 /* Set USE to be the set of USE operands for statement G. */
1485 static inline void
1486 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1488 gcc_gimple_checking_assert (gimple_has_ops (g));
1489 g->gsops.opbase.use_ops = use;
1493 /* Return the set of VUSE operand for statement G. */
1495 static inline use_operand_p
1496 gimple_vuse_op (const_gimple g)
1498 struct use_optype_d *ops;
1499 if (!gimple_has_mem_ops (g))
1500 return NULL_USE_OPERAND_P;
1501 ops = g->gsops.opbase.use_ops;
1502 if (ops
1503 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1504 return USE_OP_PTR (ops);
1505 return NULL_USE_OPERAND_P;
1508 /* Return the set of VDEF operand for statement G. */
1510 static inline def_operand_p
1511 gimple_vdef_op (gimple g)
1513 if (!gimple_has_mem_ops (g))
1514 return NULL_DEF_OPERAND_P;
1515 if (g->gsmembase.vdef)
1516 return &g->gsmembase.vdef;
1517 return NULL_DEF_OPERAND_P;
1521 /* Return the single VUSE operand of the statement G. */
1523 static inline tree
1524 gimple_vuse (const_gimple g)
1526 if (!gimple_has_mem_ops (g))
1527 return NULL_TREE;
1528 return g->gsmembase.vuse;
1531 /* Return the single VDEF operand of the statement G. */
1533 static inline tree
1534 gimple_vdef (const_gimple g)
1536 if (!gimple_has_mem_ops (g))
1537 return NULL_TREE;
1538 return g->gsmembase.vdef;
1541 /* Return the single VUSE operand of the statement G. */
1543 static inline tree *
1544 gimple_vuse_ptr (gimple g)
1546 if (!gimple_has_mem_ops (g))
1547 return NULL;
1548 return &g->gsmembase.vuse;
1551 /* Return the single VDEF operand of the statement G. */
1553 static inline tree *
1554 gimple_vdef_ptr (gimple g)
1556 if (!gimple_has_mem_ops (g))
1557 return NULL;
1558 return &g->gsmembase.vdef;
1561 /* Set the single VUSE operand of the statement G. */
1563 static inline void
1564 gimple_set_vuse (gimple g, tree vuse)
1566 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1567 g->gsmembase.vuse = vuse;
1570 /* Set the single VDEF operand of the statement G. */
1572 static inline void
1573 gimple_set_vdef (gimple g, tree vdef)
1575 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1576 g->gsmembase.vdef = vdef;
1580 /* Return true if statement G has operands and the modified field has
1581 been set. */
1583 static inline bool
1584 gimple_modified_p (const_gimple g)
1586 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1590 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1591 a MODIFIED field. */
1593 static inline void
1594 gimple_set_modified (gimple s, bool modifiedp)
1596 if (gimple_has_ops (s))
1597 s->gsbase.modified = (unsigned) modifiedp;
1601 /* Return the tree code for the expression computed by STMT. This is
1602 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1603 GIMPLE_CALL, return CALL_EXPR as the expression code for
1604 consistency. This is useful when the caller needs to deal with the
1605 three kinds of computation that GIMPLE supports. */
1607 static inline enum tree_code
1608 gimple_expr_code (const_gimple stmt)
1610 enum gimple_code code = gimple_code (stmt);
1611 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1612 return (enum tree_code) stmt->gsbase.subcode;
1613 else
1615 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1616 return CALL_EXPR;
1621 /* Mark statement S as modified, and update it. */
1623 static inline void
1624 update_stmt (gimple s)
1626 if (gimple_has_ops (s))
1628 gimple_set_modified (s, true);
1629 update_stmt_operands (s);
1633 /* Update statement S if it has been optimized. */
1635 static inline void
1636 update_stmt_if_modified (gimple s)
1638 if (gimple_modified_p (s))
1639 update_stmt_operands (s);
1642 /* Return true if statement STMT contains volatile operands. */
1644 static inline bool
1645 gimple_has_volatile_ops (const_gimple stmt)
1647 if (gimple_has_mem_ops (stmt))
1648 return stmt->gsbase.has_volatile_ops;
1649 else
1650 return false;
1654 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1656 static inline void
1657 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1659 if (gimple_has_mem_ops (stmt))
1660 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1663 /* Return true if BB is in a transaction. */
1665 static inline bool
1666 block_in_transaction (basic_block bb)
1668 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1671 /* Return true if STMT is in a transaction. */
1673 static inline bool
1674 gimple_in_transaction (gimple stmt)
1676 return block_in_transaction (gimple_bb (stmt));
1679 /* Return true if statement STMT may access memory. */
1681 static inline bool
1682 gimple_references_memory_p (gimple stmt)
1684 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1688 /* Return the subcode for OMP statement S. */
1690 static inline unsigned
1691 gimple_omp_subcode (const_gimple s)
1693 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1694 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1695 return s->gsbase.subcode;
1698 /* Set the subcode for OMP statement S to SUBCODE. */
1700 static inline void
1701 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1703 /* We only have 16 bits for the subcode. Assert that we are not
1704 overflowing it. */
1705 gcc_gimple_checking_assert (subcode < (1 << 16));
1706 s->gsbase.subcode = subcode;
1709 /* Set the nowait flag on OMP_RETURN statement S. */
1711 static inline void
1712 gimple_omp_return_set_nowait (gimple s)
1714 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1715 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1719 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1720 flag set. */
1722 static inline bool
1723 gimple_omp_return_nowait_p (const_gimple g)
1725 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1726 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1730 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1731 flag set. */
1733 static inline bool
1734 gimple_omp_section_last_p (const_gimple g)
1736 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1737 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1741 /* Set the GF_OMP_SECTION_LAST flag on G. */
1743 static inline void
1744 gimple_omp_section_set_last (gimple g)
1746 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1747 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1751 /* Return true if OMP parallel statement G has the
1752 GF_OMP_PARALLEL_COMBINED flag set. */
1754 static inline bool
1755 gimple_omp_parallel_combined_p (const_gimple g)
1757 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1758 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1762 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1763 value of COMBINED_P. */
1765 static inline void
1766 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1768 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1769 if (combined_p)
1770 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1771 else
1772 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1776 /* Return true if OMP atomic load/store statement G has the
1777 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1779 static inline bool
1780 gimple_omp_atomic_need_value_p (const_gimple g)
1782 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1783 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1784 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1788 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1790 static inline void
1791 gimple_omp_atomic_set_need_value (gimple g)
1793 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1794 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1795 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1799 /* Return the number of operands for statement GS. */
1801 static inline unsigned
1802 gimple_num_ops (const_gimple gs)
1804 return gs->gsbase.num_ops;
1808 /* Set the number of operands for statement GS. */
1810 static inline void
1811 gimple_set_num_ops (gimple gs, unsigned num_ops)
1813 gs->gsbase.num_ops = num_ops;
1817 /* Return the array of operands for statement GS. */
1819 static inline tree *
1820 gimple_ops (gimple gs)
1822 size_t off;
1824 /* All the tuples have their operand vector at the very bottom
1825 of the structure. Note that those structures that do not
1826 have an operand vector have a zero offset. */
1827 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1828 gcc_gimple_checking_assert (off != 0);
1830 return (tree *) ((char *) gs + off);
1834 /* Return operand I for statement GS. */
1836 static inline tree
1837 gimple_op (const_gimple gs, unsigned i)
1839 if (gimple_has_ops (gs))
1841 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1842 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1844 else
1845 return NULL_TREE;
1848 /* Return a pointer to operand I for statement GS. */
1850 static inline tree *
1851 gimple_op_ptr (const_gimple gs, unsigned i)
1853 if (gimple_has_ops (gs))
1855 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1856 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1858 else
1859 return NULL;
1862 /* Set operand I of statement GS to OP. */
1864 static inline void
1865 gimple_set_op (gimple gs, unsigned i, tree op)
1867 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1869 /* Note. It may be tempting to assert that OP matches
1870 is_gimple_operand, but that would be wrong. Different tuples
1871 accept slightly different sets of tree operands. Each caller
1872 should perform its own validation. */
1873 gimple_ops (gs)[i] = op;
1876 /* Return true if GS is a GIMPLE_ASSIGN. */
1878 static inline bool
1879 is_gimple_assign (const_gimple gs)
1881 return gimple_code (gs) == GIMPLE_ASSIGN;
1884 /* Determine if expression CODE is one of the valid expressions that can
1885 be used on the RHS of GIMPLE assignments. */
1887 static inline enum gimple_rhs_class
1888 get_gimple_rhs_class (enum tree_code code)
1890 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1893 /* Return the LHS of assignment statement GS. */
1895 static inline tree
1896 gimple_assign_lhs (const_gimple gs)
1898 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1899 return gimple_op (gs, 0);
1903 /* Return a pointer to the LHS of assignment statement GS. */
1905 static inline tree *
1906 gimple_assign_lhs_ptr (const_gimple gs)
1908 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1909 return gimple_op_ptr (gs, 0);
1913 /* Set LHS to be the LHS operand of assignment statement GS. */
1915 static inline void
1916 gimple_assign_set_lhs (gimple gs, tree lhs)
1918 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1919 gimple_set_op (gs, 0, lhs);
1921 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1922 SSA_NAME_DEF_STMT (lhs) = gs;
1926 /* Return the first operand on the RHS of assignment statement GS. */
1928 static inline tree
1929 gimple_assign_rhs1 (const_gimple gs)
1931 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1932 return gimple_op (gs, 1);
1936 /* Return a pointer to the first operand on the RHS of assignment
1937 statement GS. */
1939 static inline tree *
1940 gimple_assign_rhs1_ptr (const_gimple gs)
1942 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1943 return gimple_op_ptr (gs, 1);
1946 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1948 static inline void
1949 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1951 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1953 gimple_set_op (gs, 1, rhs);
1957 /* Return the second operand on the RHS of assignment statement GS.
1958 If GS does not have two operands, NULL is returned instead. */
1960 static inline tree
1961 gimple_assign_rhs2 (const_gimple gs)
1963 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1965 if (gimple_num_ops (gs) >= 3)
1966 return gimple_op (gs, 2);
1967 else
1968 return NULL_TREE;
1972 /* Return a pointer to the second operand on the RHS of assignment
1973 statement GS. */
1975 static inline tree *
1976 gimple_assign_rhs2_ptr (const_gimple gs)
1978 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1979 return gimple_op_ptr (gs, 2);
1983 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1985 static inline void
1986 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1988 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1990 gimple_set_op (gs, 2, rhs);
1993 /* Return the third operand on the RHS of assignment statement GS.
1994 If GS does not have two operands, NULL is returned instead. */
1996 static inline tree
1997 gimple_assign_rhs3 (const_gimple gs)
1999 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2001 if (gimple_num_ops (gs) >= 4)
2002 return gimple_op (gs, 3);
2003 else
2004 return NULL_TREE;
2007 /* Return a pointer to the third operand on the RHS of assignment
2008 statement GS. */
2010 static inline tree *
2011 gimple_assign_rhs3_ptr (const_gimple gs)
2013 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2014 return gimple_op_ptr (gs, 3);
2018 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2020 static inline void
2021 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2023 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2025 gimple_set_op (gs, 3, rhs);
2028 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2029 to see only a maximum of two operands. */
2031 static inline void
2032 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2033 tree op1, tree op2)
2035 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2038 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2039 to see only a maximum of two operands. */
2041 static inline void
2042 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
2043 tree *op1)
2045 tree op2;
2046 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
2047 gcc_assert (op2 == NULL_TREE);
2050 /* Returns true if GS is a nontemporal move. */
2052 static inline bool
2053 gimple_assign_nontemporal_move_p (const_gimple gs)
2055 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2056 return gs->gsbase.nontemporal_move;
2059 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2061 static inline void
2062 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2064 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2065 gs->gsbase.nontemporal_move = nontemporal;
2069 /* Return the code of the expression computed on the rhs of assignment
2070 statement GS. In case that the RHS is a single object, returns the
2071 tree code of the object. */
2073 static inline enum tree_code
2074 gimple_assign_rhs_code (const_gimple gs)
2076 enum tree_code code;
2077 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2079 code = (enum tree_code) gs->gsbase.subcode;
2080 /* While we initially set subcode to the TREE_CODE of the rhs for
2081 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2082 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2083 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2084 code = TREE_CODE (gimple_assign_rhs1 (gs));
2086 return code;
2090 /* Set CODE to be the code for the expression computed on the RHS of
2091 assignment S. */
2093 static inline void
2094 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2096 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2097 s->gsbase.subcode = code;
2101 /* Return the gimple rhs class of the code of the expression computed on
2102 the rhs of assignment statement GS.
2103 This will never return GIMPLE_INVALID_RHS. */
2105 static inline enum gimple_rhs_class
2106 gimple_assign_rhs_class (const_gimple gs)
2108 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2111 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2112 there is no operator associated with the assignment itself.
2113 Unlike gimple_assign_copy_p, this predicate returns true for
2114 any RHS operand, including those that perform an operation
2115 and do not have the semantics of a copy, such as COND_EXPR. */
2117 static inline bool
2118 gimple_assign_single_p (gimple gs)
2120 return (is_gimple_assign (gs)
2121 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2124 /* Return true if GS performs a store to its lhs. */
2126 static inline bool
2127 gimple_store_p (gimple gs)
2129 tree lhs = gimple_get_lhs (gs);
2130 return lhs && !is_gimple_reg (lhs);
2133 /* Return true if GS is an assignment that loads from its rhs1. */
2135 static inline bool
2136 gimple_assign_load_p (gimple gs)
2138 tree rhs;
2139 if (!gimple_assign_single_p (gs))
2140 return false;
2141 rhs = gimple_assign_rhs1 (gs);
2142 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2143 return true;
2144 rhs = get_base_address (rhs);
2145 return (DECL_P (rhs)
2146 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2150 /* Return true if S is a type-cast assignment. */
2152 static inline bool
2153 gimple_assign_cast_p (gimple s)
2155 if (is_gimple_assign (s))
2157 enum tree_code sc = gimple_assign_rhs_code (s);
2158 return CONVERT_EXPR_CODE_P (sc)
2159 || sc == VIEW_CONVERT_EXPR
2160 || sc == FIX_TRUNC_EXPR;
2163 return false;
2166 /* Return true if S is a clobber statement. */
2168 static inline bool
2169 gimple_clobber_p (gimple s)
2171 return gimple_assign_single_p (s)
2172 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2175 /* Return true if GS is a GIMPLE_CALL. */
2177 static inline bool
2178 is_gimple_call (const_gimple gs)
2180 return gimple_code (gs) == GIMPLE_CALL;
2183 /* Return the LHS of call statement GS. */
2185 static inline tree
2186 gimple_call_lhs (const_gimple gs)
2188 GIMPLE_CHECK (gs, GIMPLE_CALL);
2189 return gimple_op (gs, 0);
2193 /* Return a pointer to the LHS of call statement GS. */
2195 static inline tree *
2196 gimple_call_lhs_ptr (const_gimple gs)
2198 GIMPLE_CHECK (gs, GIMPLE_CALL);
2199 return gimple_op_ptr (gs, 0);
2203 /* Set LHS to be the LHS operand of call statement GS. */
2205 static inline void
2206 gimple_call_set_lhs (gimple gs, tree lhs)
2208 GIMPLE_CHECK (gs, GIMPLE_CALL);
2209 gimple_set_op (gs, 0, lhs);
2210 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2211 SSA_NAME_DEF_STMT (lhs) = gs;
2215 /* Return true if call GS calls an internal-only function, as enumerated
2216 by internal_fn. */
2218 static inline bool
2219 gimple_call_internal_p (const_gimple gs)
2221 GIMPLE_CHECK (gs, GIMPLE_CALL);
2222 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2226 /* Return the target of internal call GS. */
2228 static inline enum internal_fn
2229 gimple_call_internal_fn (const_gimple gs)
2231 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2232 return gs->gimple_call.u.internal_fn;
2236 /* Return the function type of the function called by GS. */
2238 static inline tree
2239 gimple_call_fntype (const_gimple gs)
2241 GIMPLE_CHECK (gs, GIMPLE_CALL);
2242 if (gimple_call_internal_p (gs))
2243 return NULL_TREE;
2244 return gs->gimple_call.u.fntype;
2247 /* Set the type of the function called by GS to FNTYPE. */
2249 static inline void
2250 gimple_call_set_fntype (gimple gs, tree fntype)
2252 GIMPLE_CHECK (gs, GIMPLE_CALL);
2253 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2254 gs->gimple_call.u.fntype = fntype;
2258 /* Return the tree node representing the function called by call
2259 statement GS. */
2261 static inline tree
2262 gimple_call_fn (const_gimple gs)
2264 GIMPLE_CHECK (gs, GIMPLE_CALL);
2265 return gimple_op (gs, 1);
2268 /* Return a pointer to the tree node representing the function called by call
2269 statement GS. */
2271 static inline tree *
2272 gimple_call_fn_ptr (const_gimple gs)
2274 GIMPLE_CHECK (gs, GIMPLE_CALL);
2275 return gimple_op_ptr (gs, 1);
2279 /* Set FN to be the function called by call statement GS. */
2281 static inline void
2282 gimple_call_set_fn (gimple gs, tree fn)
2284 GIMPLE_CHECK (gs, GIMPLE_CALL);
2285 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2286 gimple_set_op (gs, 1, fn);
2290 /* Set FNDECL to be the function called by call statement GS. */
2292 static inline void
2293 gimple_call_set_fndecl (gimple gs, tree decl)
2295 GIMPLE_CHECK (gs, GIMPLE_CALL);
2296 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2297 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2301 /* Set internal function FN to be the function called by call statement GS. */
2303 static inline void
2304 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2306 GIMPLE_CHECK (gs, GIMPLE_CALL);
2307 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2308 gs->gimple_call.u.internal_fn = fn;
2312 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2313 associated with the callee if known. Otherwise return NULL_TREE. */
2315 static inline tree
2316 gimple_call_addr_fndecl (const_tree fn)
2318 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2320 tree fndecl = TREE_OPERAND (fn, 0);
2321 if (TREE_CODE (fndecl) == MEM_REF
2322 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2323 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2324 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2325 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2326 return fndecl;
2328 return NULL_TREE;
2331 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2332 Otherwise return NULL. This function is analogous to
2333 get_callee_fndecl in tree land. */
2335 static inline tree
2336 gimple_call_fndecl (const_gimple gs)
2338 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2342 /* Return the type returned by call statement GS. */
2344 static inline tree
2345 gimple_call_return_type (const_gimple gs)
2347 tree type = gimple_call_fntype (gs);
2349 if (type == NULL_TREE)
2350 return TREE_TYPE (gimple_call_lhs (gs));
2352 /* The type returned by a function is the type of its
2353 function type. */
2354 return TREE_TYPE (type);
2358 /* Return the static chain for call statement GS. */
2360 static inline tree
2361 gimple_call_chain (const_gimple gs)
2363 GIMPLE_CHECK (gs, GIMPLE_CALL);
2364 return gimple_op (gs, 2);
2368 /* Return a pointer to the static chain for call statement GS. */
2370 static inline tree *
2371 gimple_call_chain_ptr (const_gimple gs)
2373 GIMPLE_CHECK (gs, GIMPLE_CALL);
2374 return gimple_op_ptr (gs, 2);
2377 /* Set CHAIN to be the static chain for call statement GS. */
2379 static inline void
2380 gimple_call_set_chain (gimple gs, tree chain)
2382 GIMPLE_CHECK (gs, GIMPLE_CALL);
2384 gimple_set_op (gs, 2, chain);
2388 /* Return the number of arguments used by call statement GS. */
2390 static inline unsigned
2391 gimple_call_num_args (const_gimple gs)
2393 unsigned num_ops;
2394 GIMPLE_CHECK (gs, GIMPLE_CALL);
2395 num_ops = gimple_num_ops (gs);
2396 return num_ops - 3;
2400 /* Return the argument at position INDEX for call statement GS. */
2402 static inline tree
2403 gimple_call_arg (const_gimple gs, unsigned index)
2405 GIMPLE_CHECK (gs, GIMPLE_CALL);
2406 return gimple_op (gs, index + 3);
2410 /* Return a pointer to the argument at position INDEX for call
2411 statement GS. */
2413 static inline tree *
2414 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2416 GIMPLE_CHECK (gs, GIMPLE_CALL);
2417 return gimple_op_ptr (gs, index + 3);
2421 /* Set ARG to be the argument at position INDEX for call statement GS. */
2423 static inline void
2424 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2426 GIMPLE_CHECK (gs, GIMPLE_CALL);
2427 gimple_set_op (gs, index + 3, arg);
2431 /* If TAIL_P is true, mark call statement S as being a tail call
2432 (i.e., a call just before the exit of a function). These calls are
2433 candidate for tail call optimization. */
2435 static inline void
2436 gimple_call_set_tail (gimple s, bool tail_p)
2438 GIMPLE_CHECK (s, GIMPLE_CALL);
2439 if (tail_p)
2440 s->gsbase.subcode |= GF_CALL_TAILCALL;
2441 else
2442 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2446 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2448 static inline bool
2449 gimple_call_tail_p (gimple s)
2451 GIMPLE_CHECK (s, GIMPLE_CALL);
2452 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2456 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2457 slot optimization. This transformation uses the target of the call
2458 expansion as the return slot for calls that return in memory. */
2460 static inline void
2461 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2463 GIMPLE_CHECK (s, GIMPLE_CALL);
2464 if (return_slot_opt_p)
2465 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2466 else
2467 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2471 /* Return true if S is marked for return slot optimization. */
2473 static inline bool
2474 gimple_call_return_slot_opt_p (gimple s)
2476 GIMPLE_CHECK (s, GIMPLE_CALL);
2477 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2481 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2482 thunk to the thunked-to function. */
2484 static inline void
2485 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2487 GIMPLE_CHECK (s, GIMPLE_CALL);
2488 if (from_thunk_p)
2489 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2490 else
2491 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2495 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2497 static inline bool
2498 gimple_call_from_thunk_p (gimple s)
2500 GIMPLE_CHECK (s, GIMPLE_CALL);
2501 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2505 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2506 argument pack in its argument list. */
2508 static inline void
2509 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2511 GIMPLE_CHECK (s, GIMPLE_CALL);
2512 if (pass_arg_pack_p)
2513 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2514 else
2515 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2519 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2520 argument pack in its argument list. */
2522 static inline bool
2523 gimple_call_va_arg_pack_p (gimple s)
2525 GIMPLE_CHECK (s, GIMPLE_CALL);
2526 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2530 /* Return true if S is a noreturn call. */
2532 static inline bool
2533 gimple_call_noreturn_p (gimple s)
2535 GIMPLE_CHECK (s, GIMPLE_CALL);
2536 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2540 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2541 even if the called function can throw in other cases. */
2543 static inline void
2544 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2546 GIMPLE_CHECK (s, GIMPLE_CALL);
2547 if (nothrow_p)
2548 s->gsbase.subcode |= GF_CALL_NOTHROW;
2549 else
2550 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2553 /* Return true if S is a nothrow call. */
2555 static inline bool
2556 gimple_call_nothrow_p (gimple s)
2558 GIMPLE_CHECK (s, GIMPLE_CALL);
2559 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2562 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2563 is known to be emitted for VLA objects. Those are wrapped by
2564 stack_save/stack_restore calls and hence can't lead to unbounded
2565 stack growth even when they occur in loops. */
2567 static inline void
2568 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2570 GIMPLE_CHECK (s, GIMPLE_CALL);
2571 if (for_var)
2572 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2573 else
2574 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2577 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2579 static inline bool
2580 gimple_call_alloca_for_var_p (gimple s)
2582 GIMPLE_CHECK (s, GIMPLE_CALL);
2583 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2586 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2588 static inline void
2589 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2591 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2592 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2593 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2597 /* Return a pointer to the points-to solution for the set of call-used
2598 variables of the call CALL. */
2600 static inline struct pt_solution *
2601 gimple_call_use_set (gimple call)
2603 GIMPLE_CHECK (call, GIMPLE_CALL);
2604 return &call->gimple_call.call_used;
2608 /* Return a pointer to the points-to solution for the set of call-used
2609 variables of the call CALL. */
2611 static inline struct pt_solution *
2612 gimple_call_clobber_set (gimple call)
2614 GIMPLE_CHECK (call, GIMPLE_CALL);
2615 return &call->gimple_call.call_clobbered;
2619 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2620 non-NULL lhs. */
2622 static inline bool
2623 gimple_has_lhs (gimple stmt)
2625 return (is_gimple_assign (stmt)
2626 || (is_gimple_call (stmt)
2627 && gimple_call_lhs (stmt) != NULL_TREE));
2631 /* Return the code of the predicate computed by conditional statement GS. */
2633 static inline enum tree_code
2634 gimple_cond_code (const_gimple gs)
2636 GIMPLE_CHECK (gs, GIMPLE_COND);
2637 return (enum tree_code) gs->gsbase.subcode;
2641 /* Set CODE to be the predicate code for the conditional statement GS. */
2643 static inline void
2644 gimple_cond_set_code (gimple gs, enum tree_code code)
2646 GIMPLE_CHECK (gs, GIMPLE_COND);
2647 gs->gsbase.subcode = code;
2651 /* Return the LHS of the predicate computed by conditional statement GS. */
2653 static inline tree
2654 gimple_cond_lhs (const_gimple gs)
2656 GIMPLE_CHECK (gs, GIMPLE_COND);
2657 return gimple_op (gs, 0);
2660 /* Return the pointer to the LHS of the predicate computed by conditional
2661 statement GS. */
2663 static inline tree *
2664 gimple_cond_lhs_ptr (const_gimple gs)
2666 GIMPLE_CHECK (gs, GIMPLE_COND);
2667 return gimple_op_ptr (gs, 0);
2670 /* Set LHS to be the LHS operand of the predicate computed by
2671 conditional statement GS. */
2673 static inline void
2674 gimple_cond_set_lhs (gimple gs, tree lhs)
2676 GIMPLE_CHECK (gs, GIMPLE_COND);
2677 gimple_set_op (gs, 0, lhs);
2681 /* Return the RHS operand of the predicate computed by conditional GS. */
2683 static inline tree
2684 gimple_cond_rhs (const_gimple gs)
2686 GIMPLE_CHECK (gs, GIMPLE_COND);
2687 return gimple_op (gs, 1);
2690 /* Return the pointer to the RHS operand of the predicate computed by
2691 conditional GS. */
2693 static inline tree *
2694 gimple_cond_rhs_ptr (const_gimple gs)
2696 GIMPLE_CHECK (gs, GIMPLE_COND);
2697 return gimple_op_ptr (gs, 1);
2701 /* Set RHS to be the RHS operand of the predicate computed by
2702 conditional statement GS. */
2704 static inline void
2705 gimple_cond_set_rhs (gimple gs, tree rhs)
2707 GIMPLE_CHECK (gs, GIMPLE_COND);
2708 gimple_set_op (gs, 1, rhs);
2712 /* Return the label used by conditional statement GS when its
2713 predicate evaluates to true. */
2715 static inline tree
2716 gimple_cond_true_label (const_gimple gs)
2718 GIMPLE_CHECK (gs, GIMPLE_COND);
2719 return gimple_op (gs, 2);
2723 /* Set LABEL to be the label used by conditional statement GS when its
2724 predicate evaluates to true. */
2726 static inline void
2727 gimple_cond_set_true_label (gimple gs, tree label)
2729 GIMPLE_CHECK (gs, GIMPLE_COND);
2730 gimple_set_op (gs, 2, label);
2734 /* Set LABEL to be the label used by conditional statement GS when its
2735 predicate evaluates to false. */
2737 static inline void
2738 gimple_cond_set_false_label (gimple gs, tree label)
2740 GIMPLE_CHECK (gs, GIMPLE_COND);
2741 gimple_set_op (gs, 3, label);
2745 /* Return the label used by conditional statement GS when its
2746 predicate evaluates to false. */
2748 static inline tree
2749 gimple_cond_false_label (const_gimple gs)
2751 GIMPLE_CHECK (gs, GIMPLE_COND);
2752 return gimple_op (gs, 3);
2756 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2758 static inline void
2759 gimple_cond_make_false (gimple gs)
2761 gimple_cond_set_lhs (gs, boolean_true_node);
2762 gimple_cond_set_rhs (gs, boolean_false_node);
2763 gs->gsbase.subcode = EQ_EXPR;
2767 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2769 static inline void
2770 gimple_cond_make_true (gimple gs)
2772 gimple_cond_set_lhs (gs, boolean_true_node);
2773 gimple_cond_set_rhs (gs, boolean_true_node);
2774 gs->gsbase.subcode = EQ_EXPR;
2777 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2778 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2780 static inline bool
2781 gimple_cond_true_p (const_gimple gs)
2783 tree lhs = gimple_cond_lhs (gs);
2784 tree rhs = gimple_cond_rhs (gs);
2785 enum tree_code code = gimple_cond_code (gs);
2787 if (lhs != boolean_true_node && lhs != boolean_false_node)
2788 return false;
2790 if (rhs != boolean_true_node && rhs != boolean_false_node)
2791 return false;
2793 if (code == NE_EXPR && lhs != rhs)
2794 return true;
2796 if (code == EQ_EXPR && lhs == rhs)
2797 return true;
2799 return false;
2802 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2803 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2805 static inline bool
2806 gimple_cond_false_p (const_gimple gs)
2808 tree lhs = gimple_cond_lhs (gs);
2809 tree rhs = gimple_cond_rhs (gs);
2810 enum tree_code code = gimple_cond_code (gs);
2812 if (lhs != boolean_true_node && lhs != boolean_false_node)
2813 return false;
2815 if (rhs != boolean_true_node && rhs != boolean_false_node)
2816 return false;
2818 if (code == NE_EXPR && lhs == rhs)
2819 return true;
2821 if (code == EQ_EXPR && lhs != rhs)
2822 return true;
2824 return false;
2827 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2829 static inline void
2830 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2832 gimple_cond_set_code (stmt, code);
2833 gimple_cond_set_lhs (stmt, lhs);
2834 gimple_cond_set_rhs (stmt, rhs);
2837 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2839 static inline tree
2840 gimple_label_label (const_gimple gs)
2842 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2843 return gimple_op (gs, 0);
2847 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2848 GS. */
2850 static inline void
2851 gimple_label_set_label (gimple gs, tree label)
2853 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2854 gimple_set_op (gs, 0, label);
2858 /* Return the destination of the unconditional jump GS. */
2860 static inline tree
2861 gimple_goto_dest (const_gimple gs)
2863 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2864 return gimple_op (gs, 0);
2868 /* Set DEST to be the destination of the unconditonal jump GS. */
2870 static inline void
2871 gimple_goto_set_dest (gimple gs, tree dest)
2873 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2874 gimple_set_op (gs, 0, dest);
2878 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2880 static inline tree
2881 gimple_bind_vars (const_gimple gs)
2883 GIMPLE_CHECK (gs, GIMPLE_BIND);
2884 return gs->gimple_bind.vars;
2888 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2889 statement GS. */
2891 static inline void
2892 gimple_bind_set_vars (gimple gs, tree vars)
2894 GIMPLE_CHECK (gs, GIMPLE_BIND);
2895 gs->gimple_bind.vars = vars;
2899 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2900 statement GS. */
2902 static inline void
2903 gimple_bind_append_vars (gimple gs, tree vars)
2905 GIMPLE_CHECK (gs, GIMPLE_BIND);
2906 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2910 static inline gimple_seq *
2911 gimple_bind_body_ptr (gimple gs)
2913 GIMPLE_CHECK (gs, GIMPLE_BIND);
2914 return &gs->gimple_bind.body;
2917 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2919 static inline gimple_seq
2920 gimple_bind_body (gimple gs)
2922 return *gimple_bind_body_ptr (gs);
2926 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2927 statement GS. */
2929 static inline void
2930 gimple_bind_set_body (gimple gs, gimple_seq seq)
2932 GIMPLE_CHECK (gs, GIMPLE_BIND);
2933 gs->gimple_bind.body = seq;
2937 /* Append a statement to the end of a GIMPLE_BIND's body. */
2939 static inline void
2940 gimple_bind_add_stmt (gimple gs, gimple stmt)
2942 GIMPLE_CHECK (gs, GIMPLE_BIND);
2943 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2947 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2949 static inline void
2950 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2952 GIMPLE_CHECK (gs, GIMPLE_BIND);
2953 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2957 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2958 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2960 static inline tree
2961 gimple_bind_block (const_gimple gs)
2963 GIMPLE_CHECK (gs, GIMPLE_BIND);
2964 return gs->gimple_bind.block;
2968 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2969 statement GS. */
2971 static inline void
2972 gimple_bind_set_block (gimple gs, tree block)
2974 GIMPLE_CHECK (gs, GIMPLE_BIND);
2975 gcc_gimple_checking_assert (block == NULL_TREE
2976 || TREE_CODE (block) == BLOCK);
2977 gs->gimple_bind.block = block;
2981 /* Return the number of input operands for GIMPLE_ASM GS. */
2983 static inline unsigned
2984 gimple_asm_ninputs (const_gimple gs)
2986 GIMPLE_CHECK (gs, GIMPLE_ASM);
2987 return gs->gimple_asm.ni;
2991 /* Return the number of output operands for GIMPLE_ASM GS. */
2993 static inline unsigned
2994 gimple_asm_noutputs (const_gimple gs)
2996 GIMPLE_CHECK (gs, GIMPLE_ASM);
2997 return gs->gimple_asm.no;
3001 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3003 static inline unsigned
3004 gimple_asm_nclobbers (const_gimple gs)
3006 GIMPLE_CHECK (gs, GIMPLE_ASM);
3007 return gs->gimple_asm.nc;
3010 /* Return the number of label operands for GIMPLE_ASM GS. */
3012 static inline unsigned
3013 gimple_asm_nlabels (const_gimple gs)
3015 GIMPLE_CHECK (gs, GIMPLE_ASM);
3016 return gs->gimple_asm.nl;
3019 /* Return input operand INDEX of GIMPLE_ASM GS. */
3021 static inline tree
3022 gimple_asm_input_op (const_gimple gs, unsigned index)
3024 GIMPLE_CHECK (gs, GIMPLE_ASM);
3025 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3026 return gimple_op (gs, index + gs->gimple_asm.no);
3029 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3031 static inline tree *
3032 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3034 GIMPLE_CHECK (gs, GIMPLE_ASM);
3035 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3036 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
3040 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3042 static inline void
3043 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3045 GIMPLE_CHECK (gs, GIMPLE_ASM);
3046 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
3047 && TREE_CODE (in_op) == TREE_LIST);
3048 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
3052 /* Return output operand INDEX of GIMPLE_ASM GS. */
3054 static inline tree
3055 gimple_asm_output_op (const_gimple gs, unsigned index)
3057 GIMPLE_CHECK (gs, GIMPLE_ASM);
3058 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3059 return gimple_op (gs, index);
3062 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3064 static inline tree *
3065 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3067 GIMPLE_CHECK (gs, GIMPLE_ASM);
3068 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3069 return gimple_op_ptr (gs, index);
3073 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3075 static inline void
3076 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3078 GIMPLE_CHECK (gs, GIMPLE_ASM);
3079 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3080 && TREE_CODE (out_op) == TREE_LIST);
3081 gimple_set_op (gs, index, out_op);
3085 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3087 static inline tree
3088 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3090 GIMPLE_CHECK (gs, GIMPLE_ASM);
3091 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3092 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3096 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3098 static inline void
3099 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3101 GIMPLE_CHECK (gs, GIMPLE_ASM);
3102 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3103 && TREE_CODE (clobber_op) == TREE_LIST);
3104 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3107 /* Return label operand INDEX of GIMPLE_ASM GS. */
3109 static inline tree
3110 gimple_asm_label_op (const_gimple gs, unsigned index)
3112 GIMPLE_CHECK (gs, GIMPLE_ASM);
3113 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3114 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3117 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3119 static inline void
3120 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3122 GIMPLE_CHECK (gs, GIMPLE_ASM);
3123 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3124 && TREE_CODE (label_op) == TREE_LIST);
3125 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3128 /* Return the string representing the assembly instruction in
3129 GIMPLE_ASM GS. */
3131 static inline const char *
3132 gimple_asm_string (const_gimple gs)
3134 GIMPLE_CHECK (gs, GIMPLE_ASM);
3135 return gs->gimple_asm.string;
3139 /* Return true if GS is an asm statement marked volatile. */
3141 static inline bool
3142 gimple_asm_volatile_p (const_gimple gs)
3144 GIMPLE_CHECK (gs, GIMPLE_ASM);
3145 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3149 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3151 static inline void
3152 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3154 GIMPLE_CHECK (gs, GIMPLE_ASM);
3155 if (volatile_p)
3156 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3157 else
3158 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3162 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3164 static inline void
3165 gimple_asm_set_input (gimple gs, bool input_p)
3167 GIMPLE_CHECK (gs, GIMPLE_ASM);
3168 if (input_p)
3169 gs->gsbase.subcode |= GF_ASM_INPUT;
3170 else
3171 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3175 /* Return true if asm GS is an ASM_INPUT. */
3177 static inline bool
3178 gimple_asm_input_p (const_gimple gs)
3180 GIMPLE_CHECK (gs, GIMPLE_ASM);
3181 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3185 /* Return the types handled by GIMPLE_CATCH statement GS. */
3187 static inline tree
3188 gimple_catch_types (const_gimple gs)
3190 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3191 return gs->gimple_catch.types;
3195 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3197 static inline tree *
3198 gimple_catch_types_ptr (gimple gs)
3200 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3201 return &gs->gimple_catch.types;
3205 /* Return a pointer to the GIMPLE sequence representing the body of
3206 the handler of GIMPLE_CATCH statement GS. */
3208 static inline gimple_seq *
3209 gimple_catch_handler_ptr (gimple gs)
3211 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3212 return &gs->gimple_catch.handler;
3216 /* Return the GIMPLE sequence representing the body of the handler of
3217 GIMPLE_CATCH statement GS. */
3219 static inline gimple_seq
3220 gimple_catch_handler (gimple gs)
3222 return *gimple_catch_handler_ptr (gs);
3226 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3228 static inline void
3229 gimple_catch_set_types (gimple gs, tree t)
3231 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3232 gs->gimple_catch.types = t;
3236 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3238 static inline void
3239 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3241 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3242 gs->gimple_catch.handler = handler;
3246 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3248 static inline tree
3249 gimple_eh_filter_types (const_gimple gs)
3251 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3252 return gs->gimple_eh_filter.types;
3256 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3257 GS. */
3259 static inline tree *
3260 gimple_eh_filter_types_ptr (gimple gs)
3262 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3263 return &gs->gimple_eh_filter.types;
3267 /* Return a pointer to the sequence of statement to execute when
3268 GIMPLE_EH_FILTER statement fails. */
3270 static inline gimple_seq *
3271 gimple_eh_filter_failure_ptr (gimple gs)
3273 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3274 return &gs->gimple_eh_filter.failure;
3278 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3279 statement fails. */
3281 static inline gimple_seq
3282 gimple_eh_filter_failure (gimple gs)
3284 return *gimple_eh_filter_failure_ptr (gs);
3288 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3290 static inline void
3291 gimple_eh_filter_set_types (gimple gs, tree types)
3293 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3294 gs->gimple_eh_filter.types = types;
3298 /* Set FAILURE to be the sequence of statements to execute on failure
3299 for GIMPLE_EH_FILTER GS. */
3301 static inline void
3302 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3304 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3305 gs->gimple_eh_filter.failure = failure;
3308 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3310 static inline tree
3311 gimple_eh_must_not_throw_fndecl (gimple gs)
3313 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3314 return gs->gimple_eh_mnt.fndecl;
3317 /* Set the function decl to be called by GS to DECL. */
3319 static inline void
3320 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3322 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3323 gs->gimple_eh_mnt.fndecl = decl;
3326 /* GIMPLE_EH_ELSE accessors. */
3328 static inline gimple_seq *
3329 gimple_eh_else_n_body_ptr (gimple gs)
3331 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3332 return &gs->gimple_eh_else.n_body;
3335 static inline gimple_seq
3336 gimple_eh_else_n_body (gimple gs)
3338 return *gimple_eh_else_n_body_ptr (gs);
3341 static inline gimple_seq *
3342 gimple_eh_else_e_body_ptr (gimple gs)
3344 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3345 return &gs->gimple_eh_else.e_body;
3348 static inline gimple_seq
3349 gimple_eh_else_e_body (gimple gs)
3351 return *gimple_eh_else_e_body_ptr (gs);
3354 static inline void
3355 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3357 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3358 gs->gimple_eh_else.n_body = seq;
3361 static inline void
3362 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3364 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3365 gs->gimple_eh_else.e_body = seq;
3368 /* GIMPLE_TRY accessors. */
3370 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3371 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3373 static inline enum gimple_try_flags
3374 gimple_try_kind (const_gimple gs)
3376 GIMPLE_CHECK (gs, GIMPLE_TRY);
3377 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3381 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3383 static inline void
3384 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3386 GIMPLE_CHECK (gs, GIMPLE_TRY);
3387 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3388 || kind == GIMPLE_TRY_FINALLY);
3389 if (gimple_try_kind (gs) != kind)
3390 gs->gsbase.subcode = (unsigned int) kind;
3394 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3396 static inline bool
3397 gimple_try_catch_is_cleanup (const_gimple gs)
3399 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3400 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3404 /* Return a pointer to the sequence of statements used as the
3405 body for GIMPLE_TRY GS. */
3407 static inline gimple_seq *
3408 gimple_try_eval_ptr (gimple gs)
3410 GIMPLE_CHECK (gs, GIMPLE_TRY);
3411 return &gs->gimple_try.eval;
3415 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3417 static inline gimple_seq
3418 gimple_try_eval (gimple gs)
3420 return *gimple_try_eval_ptr (gs);
3424 /* Return a pointer to the sequence of statements used as the cleanup body for
3425 GIMPLE_TRY GS. */
3427 static inline gimple_seq *
3428 gimple_try_cleanup_ptr (gimple gs)
3430 GIMPLE_CHECK (gs, GIMPLE_TRY);
3431 return &gs->gimple_try.cleanup;
3435 /* Return the sequence of statements used as the cleanup body for
3436 GIMPLE_TRY GS. */
3438 static inline gimple_seq
3439 gimple_try_cleanup (gimple gs)
3441 return *gimple_try_cleanup_ptr (gs);
3445 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3447 static inline void
3448 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3450 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3451 if (catch_is_cleanup)
3452 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3453 else
3454 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3458 /* Set EVAL to be the sequence of statements to use as the body for
3459 GIMPLE_TRY GS. */
3461 static inline void
3462 gimple_try_set_eval (gimple gs, gimple_seq eval)
3464 GIMPLE_CHECK (gs, GIMPLE_TRY);
3465 gs->gimple_try.eval = eval;
3469 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3470 body for GIMPLE_TRY GS. */
3472 static inline void
3473 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3475 GIMPLE_CHECK (gs, GIMPLE_TRY);
3476 gs->gimple_try.cleanup = cleanup;
3480 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3482 static inline gimple_seq *
3483 gimple_wce_cleanup_ptr (gimple gs)
3485 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3486 return &gs->gimple_wce.cleanup;
3490 /* Return the cleanup sequence for cleanup statement GS. */
3492 static inline gimple_seq
3493 gimple_wce_cleanup (gimple gs)
3495 return *gimple_wce_cleanup_ptr (gs);
3499 /* Set CLEANUP to be the cleanup sequence for GS. */
3501 static inline void
3502 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3504 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3505 gs->gimple_wce.cleanup = cleanup;
3509 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3511 static inline bool
3512 gimple_wce_cleanup_eh_only (const_gimple gs)
3514 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3515 return gs->gsbase.subcode != 0;
3519 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3521 static inline void
3522 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3524 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3525 gs->gsbase.subcode = (unsigned int) eh_only_p;
3529 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3531 static inline unsigned
3532 gimple_phi_capacity (const_gimple gs)
3534 GIMPLE_CHECK (gs, GIMPLE_PHI);
3535 return gs->gimple_phi.capacity;
3539 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3540 be exactly the number of incoming edges for the basic block holding
3541 GS. */
3543 static inline unsigned
3544 gimple_phi_num_args (const_gimple gs)
3546 GIMPLE_CHECK (gs, GIMPLE_PHI);
3547 return gs->gimple_phi.nargs;
3551 /* Return the SSA name created by GIMPLE_PHI GS. */
3553 static inline tree
3554 gimple_phi_result (const_gimple gs)
3556 GIMPLE_CHECK (gs, GIMPLE_PHI);
3557 return gs->gimple_phi.result;
3560 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3562 static inline tree *
3563 gimple_phi_result_ptr (gimple gs)
3565 GIMPLE_CHECK (gs, GIMPLE_PHI);
3566 return &gs->gimple_phi.result;
3569 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3571 static inline void
3572 gimple_phi_set_result (gimple gs, tree result)
3574 GIMPLE_CHECK (gs, GIMPLE_PHI);
3575 gs->gimple_phi.result = result;
3576 if (result && TREE_CODE (result) == SSA_NAME)
3577 SSA_NAME_DEF_STMT (result) = gs;
3581 /* Return the PHI argument corresponding to incoming edge INDEX for
3582 GIMPLE_PHI GS. */
3584 static inline struct phi_arg_d *
3585 gimple_phi_arg (gimple gs, unsigned index)
3587 GIMPLE_CHECK (gs, GIMPLE_PHI);
3588 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3589 return &(gs->gimple_phi.args[index]);
3592 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3593 for GIMPLE_PHI GS. */
3595 static inline void
3596 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3598 GIMPLE_CHECK (gs, GIMPLE_PHI);
3599 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3600 gs->gimple_phi.args[index] = *phiarg;
3603 /* Return the region number for GIMPLE_RESX GS. */
3605 static inline int
3606 gimple_resx_region (const_gimple gs)
3608 GIMPLE_CHECK (gs, GIMPLE_RESX);
3609 return gs->gimple_eh_ctrl.region;
3612 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3614 static inline void
3615 gimple_resx_set_region (gimple gs, int region)
3617 GIMPLE_CHECK (gs, GIMPLE_RESX);
3618 gs->gimple_eh_ctrl.region = region;
3621 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3623 static inline int
3624 gimple_eh_dispatch_region (const_gimple gs)
3626 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3627 return gs->gimple_eh_ctrl.region;
3630 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3632 static inline void
3633 gimple_eh_dispatch_set_region (gimple gs, int region)
3635 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3636 gs->gimple_eh_ctrl.region = region;
3639 /* Return the number of labels associated with the switch statement GS. */
3641 static inline unsigned
3642 gimple_switch_num_labels (const_gimple gs)
3644 unsigned num_ops;
3645 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3646 num_ops = gimple_num_ops (gs);
3647 gcc_gimple_checking_assert (num_ops > 1);
3648 return num_ops - 1;
3652 /* Set NLABELS to be the number of labels for the switch statement GS. */
3654 static inline void
3655 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3657 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3658 gimple_set_num_ops (g, nlabels + 1);
3662 /* Return the index variable used by the switch statement GS. */
3664 static inline tree
3665 gimple_switch_index (const_gimple gs)
3667 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3668 return gimple_op (gs, 0);
3672 /* Return a pointer to the index variable for the switch statement GS. */
3674 static inline tree *
3675 gimple_switch_index_ptr (const_gimple gs)
3677 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3678 return gimple_op_ptr (gs, 0);
3682 /* Set INDEX to be the index variable for switch statement GS. */
3684 static inline void
3685 gimple_switch_set_index (gimple gs, tree index)
3687 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3688 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3689 gimple_set_op (gs, 0, index);
3693 /* Return the label numbered INDEX. The default label is 0, followed by any
3694 labels in a switch statement. */
3696 static inline tree
3697 gimple_switch_label (const_gimple gs, unsigned index)
3699 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3700 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3701 return gimple_op (gs, index + 1);
3704 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3706 static inline void
3707 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3709 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3710 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3711 && (label == NULL_TREE
3712 || TREE_CODE (label) == CASE_LABEL_EXPR));
3713 gimple_set_op (gs, index + 1, label);
3716 /* Return the default label for a switch statement. */
3718 static inline tree
3719 gimple_switch_default_label (const_gimple gs)
3721 tree label = gimple_switch_label (gs, 0);
3722 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3723 return label;
3726 /* Set the default label for a switch statement. */
3728 static inline void
3729 gimple_switch_set_default_label (gimple gs, tree label)
3731 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3732 gimple_switch_set_label (gs, 0, label);
3735 /* Return true if GS is a GIMPLE_DEBUG statement. */
3737 static inline bool
3738 is_gimple_debug (const_gimple gs)
3740 return gimple_code (gs) == GIMPLE_DEBUG;
3743 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3745 static inline bool
3746 gimple_debug_bind_p (const_gimple s)
3748 if (is_gimple_debug (s))
3749 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3751 return false;
3754 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3756 static inline tree
3757 gimple_debug_bind_get_var (gimple dbg)
3759 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3760 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3761 return gimple_op (dbg, 0);
3764 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3765 statement. */
3767 static inline tree
3768 gimple_debug_bind_get_value (gimple dbg)
3770 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3771 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3772 return gimple_op (dbg, 1);
3775 /* Return a pointer to the value bound to the variable in a
3776 GIMPLE_DEBUG bind statement. */
3778 static inline tree *
3779 gimple_debug_bind_get_value_ptr (gimple dbg)
3781 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3782 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3783 return gimple_op_ptr (dbg, 1);
3786 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3788 static inline void
3789 gimple_debug_bind_set_var (gimple dbg, tree var)
3791 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3792 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3793 gimple_set_op (dbg, 0, var);
3796 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3797 statement. */
3799 static inline void
3800 gimple_debug_bind_set_value (gimple dbg, tree value)
3802 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3803 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3804 gimple_set_op (dbg, 1, value);
3807 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3808 optimized away. */
3809 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3811 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3812 statement. */
3814 static inline void
3815 gimple_debug_bind_reset_value (gimple dbg)
3817 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3818 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3819 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3822 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3823 value. */
3825 static inline bool
3826 gimple_debug_bind_has_value_p (gimple dbg)
3828 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3829 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3830 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3833 #undef GIMPLE_DEBUG_BIND_NOVALUE
3835 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3837 static inline bool
3838 gimple_debug_source_bind_p (const_gimple s)
3840 if (is_gimple_debug (s))
3841 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3843 return false;
3846 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3848 static inline tree
3849 gimple_debug_source_bind_get_var (gimple dbg)
3851 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3852 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3853 return gimple_op (dbg, 0);
3856 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3857 statement. */
3859 static inline tree
3860 gimple_debug_source_bind_get_value (gimple dbg)
3862 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3863 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3864 return gimple_op (dbg, 1);
3867 /* Return a pointer to the value bound to the variable in a
3868 GIMPLE_DEBUG source bind statement. */
3870 static inline tree *
3871 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3873 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3874 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3875 return gimple_op_ptr (dbg, 1);
3878 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3880 static inline void
3881 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3883 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3884 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3885 gimple_set_op (dbg, 0, var);
3888 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3889 statement. */
3891 static inline void
3892 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3894 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3895 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3896 gimple_set_op (dbg, 1, value);
3899 /* Return a pointer to the body for the OMP statement GS. */
3901 static inline gimple_seq *
3902 gimple_omp_body_ptr (gimple gs)
3904 return &gs->omp.body;
3907 /* Return the body for the OMP statement GS. */
3909 static inline gimple_seq
3910 gimple_omp_body (gimple gs)
3912 return *gimple_omp_body_ptr (gs);
3915 /* Set BODY to be the body for the OMP statement GS. */
3917 static inline void
3918 gimple_omp_set_body (gimple gs, gimple_seq body)
3920 gs->omp.body = body;
3924 /* Return the name associated with OMP_CRITICAL statement GS. */
3926 static inline tree
3927 gimple_omp_critical_name (const_gimple gs)
3929 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3930 return gs->gimple_omp_critical.name;
3934 /* Return a pointer to the name associated with OMP critical statement GS. */
3936 static inline tree *
3937 gimple_omp_critical_name_ptr (gimple gs)
3939 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3940 return &gs->gimple_omp_critical.name;
3944 /* Set NAME to be the name associated with OMP critical statement GS. */
3946 static inline void
3947 gimple_omp_critical_set_name (gimple gs, tree name)
3949 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3950 gs->gimple_omp_critical.name = name;
3954 /* Return the kind of OMP for statemement. */
3956 static inline int
3957 gimple_omp_for_kind (const_gimple g)
3959 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3960 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
3964 /* Set the OMP for kind. */
3966 static inline void
3967 gimple_omp_for_set_kind (gimple g, int kind)
3969 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3970 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_FOR_KIND_MASK)
3971 | (kind & GF_OMP_FOR_KIND_MASK);
3975 /* Return the clauses associated with OMP_FOR GS. */
3977 static inline tree
3978 gimple_omp_for_clauses (const_gimple gs)
3980 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3981 return gs->gimple_omp_for.clauses;
3985 /* Return a pointer to the OMP_FOR GS. */
3987 static inline tree *
3988 gimple_omp_for_clauses_ptr (gimple gs)
3990 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3991 return &gs->gimple_omp_for.clauses;
3995 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3997 static inline void
3998 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4000 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4001 gs->gimple_omp_for.clauses = clauses;
4005 /* Get the collapse count of OMP_FOR GS. */
4007 static inline size_t
4008 gimple_omp_for_collapse (gimple gs)
4010 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4011 return gs->gimple_omp_for.collapse;
4015 /* Return the index variable for OMP_FOR GS. */
4017 static inline tree
4018 gimple_omp_for_index (const_gimple gs, size_t i)
4020 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4021 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4022 return gs->gimple_omp_for.iter[i].index;
4026 /* Return a pointer to the index variable for OMP_FOR GS. */
4028 static inline tree *
4029 gimple_omp_for_index_ptr (gimple gs, size_t i)
4031 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4032 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4033 return &gs->gimple_omp_for.iter[i].index;
4037 /* Set INDEX to be the index variable for OMP_FOR GS. */
4039 static inline void
4040 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4042 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4043 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4044 gs->gimple_omp_for.iter[i].index = index;
4048 /* Return the initial value for OMP_FOR GS. */
4050 static inline tree
4051 gimple_omp_for_initial (const_gimple gs, size_t i)
4053 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4054 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4055 return gs->gimple_omp_for.iter[i].initial;
4059 /* Return a pointer to the initial value for OMP_FOR GS. */
4061 static inline tree *
4062 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4064 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4065 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4066 return &gs->gimple_omp_for.iter[i].initial;
4070 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4072 static inline void
4073 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4075 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4076 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4077 gs->gimple_omp_for.iter[i].initial = initial;
4081 /* Return the final value for OMP_FOR GS. */
4083 static inline tree
4084 gimple_omp_for_final (const_gimple gs, size_t i)
4086 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4087 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4088 return gs->gimple_omp_for.iter[i].final;
4092 /* Return a pointer to the final value for OMP_FOR GS. */
4094 static inline tree *
4095 gimple_omp_for_final_ptr (gimple gs, size_t i)
4097 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4098 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4099 return &gs->gimple_omp_for.iter[i].final;
4103 /* Set FINAL to be the final value for OMP_FOR GS. */
4105 static inline void
4106 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4108 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4109 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4110 gs->gimple_omp_for.iter[i].final = final;
4114 /* Return the increment value for OMP_FOR GS. */
4116 static inline tree
4117 gimple_omp_for_incr (const_gimple gs, size_t i)
4119 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4120 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4121 return gs->gimple_omp_for.iter[i].incr;
4125 /* Return a pointer to the increment value for OMP_FOR GS. */
4127 static inline tree *
4128 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4130 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4131 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4132 return &gs->gimple_omp_for.iter[i].incr;
4136 /* Set INCR to be the increment value for OMP_FOR GS. */
4138 static inline void
4139 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4141 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4142 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4143 gs->gimple_omp_for.iter[i].incr = incr;
4147 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4148 statement GS starts. */
4150 static inline gimple_seq *
4151 gimple_omp_for_pre_body_ptr (gimple gs)
4153 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4154 return &gs->gimple_omp_for.pre_body;
4158 /* Return the sequence of statements to execute before the OMP_FOR
4159 statement GS starts. */
4161 static inline gimple_seq
4162 gimple_omp_for_pre_body (gimple gs)
4164 return *gimple_omp_for_pre_body_ptr (gs);
4168 /* Set PRE_BODY to be the sequence of statements to execute before the
4169 OMP_FOR statement GS starts. */
4171 static inline void
4172 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4174 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4175 gs->gimple_omp_for.pre_body = pre_body;
4179 /* Return the clauses associated with OMP_PARALLEL GS. */
4181 static inline tree
4182 gimple_omp_parallel_clauses (const_gimple gs)
4184 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4185 return gs->gimple_omp_parallel.clauses;
4189 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4191 static inline tree *
4192 gimple_omp_parallel_clauses_ptr (gimple gs)
4194 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4195 return &gs->gimple_omp_parallel.clauses;
4199 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4200 GS. */
4202 static inline void
4203 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4205 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4206 gs->gimple_omp_parallel.clauses = clauses;
4210 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4212 static inline tree
4213 gimple_omp_parallel_child_fn (const_gimple gs)
4215 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4216 return gs->gimple_omp_parallel.child_fn;
4219 /* Return a pointer to the child function used to hold the body of
4220 OMP_PARALLEL GS. */
4222 static inline tree *
4223 gimple_omp_parallel_child_fn_ptr (gimple gs)
4225 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4226 return &gs->gimple_omp_parallel.child_fn;
4230 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4232 static inline void
4233 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4235 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4236 gs->gimple_omp_parallel.child_fn = child_fn;
4240 /* Return the artificial argument used to send variables and values
4241 from the parent to the children threads in OMP_PARALLEL GS. */
4243 static inline tree
4244 gimple_omp_parallel_data_arg (const_gimple gs)
4246 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4247 return gs->gimple_omp_parallel.data_arg;
4251 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4253 static inline tree *
4254 gimple_omp_parallel_data_arg_ptr (gimple gs)
4256 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4257 return &gs->gimple_omp_parallel.data_arg;
4261 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4263 static inline void
4264 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4266 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4267 gs->gimple_omp_parallel.data_arg = data_arg;
4271 /* Return the clauses associated with OMP_TASK GS. */
4273 static inline tree
4274 gimple_omp_task_clauses (const_gimple gs)
4276 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4277 return gs->gimple_omp_parallel.clauses;
4281 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4283 static inline tree *
4284 gimple_omp_task_clauses_ptr (gimple gs)
4286 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4287 return &gs->gimple_omp_parallel.clauses;
4291 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4292 GS. */
4294 static inline void
4295 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4297 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4298 gs->gimple_omp_parallel.clauses = clauses;
4302 /* Return the child function used to hold the body of OMP_TASK GS. */
4304 static inline tree
4305 gimple_omp_task_child_fn (const_gimple gs)
4307 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4308 return gs->gimple_omp_parallel.child_fn;
4311 /* Return a pointer to the child function used to hold the body of
4312 OMP_TASK GS. */
4314 static inline tree *
4315 gimple_omp_task_child_fn_ptr (gimple gs)
4317 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4318 return &gs->gimple_omp_parallel.child_fn;
4322 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4324 static inline void
4325 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4327 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4328 gs->gimple_omp_parallel.child_fn = child_fn;
4332 /* Return the artificial argument used to send variables and values
4333 from the parent to the children threads in OMP_TASK GS. */
4335 static inline tree
4336 gimple_omp_task_data_arg (const_gimple gs)
4338 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4339 return gs->gimple_omp_parallel.data_arg;
4343 /* Return a pointer to the data argument for OMP_TASK GS. */
4345 static inline tree *
4346 gimple_omp_task_data_arg_ptr (gimple gs)
4348 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4349 return &gs->gimple_omp_parallel.data_arg;
4353 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4355 static inline void
4356 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4358 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4359 gs->gimple_omp_parallel.data_arg = data_arg;
4363 /* Return the clauses associated with OMP_TASK GS. */
4365 static inline tree
4366 gimple_omp_taskreg_clauses (const_gimple gs)
4368 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4369 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4370 return gs->gimple_omp_parallel.clauses;
4374 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4376 static inline tree *
4377 gimple_omp_taskreg_clauses_ptr (gimple gs)
4379 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4380 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4381 return &gs->gimple_omp_parallel.clauses;
4385 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4386 GS. */
4388 static inline void
4389 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4391 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4392 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4393 gs->gimple_omp_parallel.clauses = clauses;
4397 /* Return the child function used to hold the body of OMP_TASK GS. */
4399 static inline tree
4400 gimple_omp_taskreg_child_fn (const_gimple gs)
4402 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4403 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4404 return gs->gimple_omp_parallel.child_fn;
4407 /* Return a pointer to the child function used to hold the body of
4408 OMP_TASK GS. */
4410 static inline tree *
4411 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4413 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4414 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4415 return &gs->gimple_omp_parallel.child_fn;
4419 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4421 static inline void
4422 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4424 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4425 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4426 gs->gimple_omp_parallel.child_fn = child_fn;
4430 /* Return the artificial argument used to send variables and values
4431 from the parent to the children threads in OMP_TASK GS. */
4433 static inline tree
4434 gimple_omp_taskreg_data_arg (const_gimple gs)
4436 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4437 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4438 return gs->gimple_omp_parallel.data_arg;
4442 /* Return a pointer to the data argument for OMP_TASK GS. */
4444 static inline tree *
4445 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4447 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4448 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4449 return &gs->gimple_omp_parallel.data_arg;
4453 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4455 static inline void
4456 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4458 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4459 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4460 gs->gimple_omp_parallel.data_arg = data_arg;
4464 /* Return the copy function used to hold the body of OMP_TASK GS. */
4466 static inline tree
4467 gimple_omp_task_copy_fn (const_gimple gs)
4469 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4470 return gs->gimple_omp_task.copy_fn;
4473 /* Return a pointer to the copy function used to hold the body of
4474 OMP_TASK GS. */
4476 static inline tree *
4477 gimple_omp_task_copy_fn_ptr (gimple gs)
4479 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4480 return &gs->gimple_omp_task.copy_fn;
4484 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4486 static inline void
4487 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4489 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4490 gs->gimple_omp_task.copy_fn = copy_fn;
4494 /* Return size of the data block in bytes in OMP_TASK GS. */
4496 static inline tree
4497 gimple_omp_task_arg_size (const_gimple gs)
4499 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4500 return gs->gimple_omp_task.arg_size;
4504 /* Return a pointer to the data block size for OMP_TASK GS. */
4506 static inline tree *
4507 gimple_omp_task_arg_size_ptr (gimple gs)
4509 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4510 return &gs->gimple_omp_task.arg_size;
4514 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4516 static inline void
4517 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4519 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4520 gs->gimple_omp_task.arg_size = arg_size;
4524 /* Return align of the data block in bytes in OMP_TASK GS. */
4526 static inline tree
4527 gimple_omp_task_arg_align (const_gimple gs)
4529 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4530 return gs->gimple_omp_task.arg_align;
4534 /* Return a pointer to the data block align for OMP_TASK GS. */
4536 static inline tree *
4537 gimple_omp_task_arg_align_ptr (gimple gs)
4539 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4540 return &gs->gimple_omp_task.arg_align;
4544 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4546 static inline void
4547 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4549 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4550 gs->gimple_omp_task.arg_align = arg_align;
4554 /* Return the clauses associated with OMP_SINGLE GS. */
4556 static inline tree
4557 gimple_omp_single_clauses (const_gimple gs)
4559 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4560 return gs->gimple_omp_single.clauses;
4564 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4566 static inline tree *
4567 gimple_omp_single_clauses_ptr (gimple gs)
4569 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4570 return &gs->gimple_omp_single.clauses;
4574 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4576 static inline void
4577 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4579 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4580 gs->gimple_omp_single.clauses = clauses;
4584 /* Return the clauses associated with OMP_SECTIONS GS. */
4586 static inline tree
4587 gimple_omp_sections_clauses (const_gimple gs)
4589 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4590 return gs->gimple_omp_sections.clauses;
4594 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4596 static inline tree *
4597 gimple_omp_sections_clauses_ptr (gimple gs)
4599 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4600 return &gs->gimple_omp_sections.clauses;
4604 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4605 GS. */
4607 static inline void
4608 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4610 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4611 gs->gimple_omp_sections.clauses = clauses;
4615 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4616 in GS. */
4618 static inline tree
4619 gimple_omp_sections_control (const_gimple gs)
4621 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4622 return gs->gimple_omp_sections.control;
4626 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4627 GS. */
4629 static inline tree *
4630 gimple_omp_sections_control_ptr (gimple gs)
4632 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4633 return &gs->gimple_omp_sections.control;
4637 /* Set CONTROL to be the set of clauses associated with the
4638 GIMPLE_OMP_SECTIONS in GS. */
4640 static inline void
4641 gimple_omp_sections_set_control (gimple gs, tree control)
4643 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4644 gs->gimple_omp_sections.control = control;
4648 /* Set COND to be the condition code for OMP_FOR GS. */
4650 static inline void
4651 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4653 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4654 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4655 && i < gs->gimple_omp_for.collapse);
4656 gs->gimple_omp_for.iter[i].cond = cond;
4660 /* Return the condition code associated with OMP_FOR GS. */
4662 static inline enum tree_code
4663 gimple_omp_for_cond (const_gimple gs, size_t i)
4665 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4666 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4667 return gs->gimple_omp_for.iter[i].cond;
4671 /* Set the value being stored in an atomic store. */
4673 static inline void
4674 gimple_omp_atomic_store_set_val (gimple g, tree val)
4676 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4677 g->gimple_omp_atomic_store.val = val;
4681 /* Return the value being stored in an atomic store. */
4683 static inline tree
4684 gimple_omp_atomic_store_val (const_gimple g)
4686 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4687 return g->gimple_omp_atomic_store.val;
4691 /* Return a pointer to the value being stored in an atomic store. */
4693 static inline tree *
4694 gimple_omp_atomic_store_val_ptr (gimple g)
4696 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4697 return &g->gimple_omp_atomic_store.val;
4701 /* Set the LHS of an atomic load. */
4703 static inline void
4704 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4706 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4707 g->gimple_omp_atomic_load.lhs = lhs;
4711 /* Get the LHS of an atomic load. */
4713 static inline tree
4714 gimple_omp_atomic_load_lhs (const_gimple g)
4716 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4717 return g->gimple_omp_atomic_load.lhs;
4721 /* Return a pointer to the LHS of an atomic load. */
4723 static inline tree *
4724 gimple_omp_atomic_load_lhs_ptr (gimple g)
4726 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4727 return &g->gimple_omp_atomic_load.lhs;
4731 /* Set the RHS of an atomic load. */
4733 static inline void
4734 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4736 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4737 g->gimple_omp_atomic_load.rhs = rhs;
4741 /* Get the RHS of an atomic load. */
4743 static inline tree
4744 gimple_omp_atomic_load_rhs (const_gimple g)
4746 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4747 return g->gimple_omp_atomic_load.rhs;
4751 /* Return a pointer to the RHS of an atomic load. */
4753 static inline tree *
4754 gimple_omp_atomic_load_rhs_ptr (gimple g)
4756 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4757 return &g->gimple_omp_atomic_load.rhs;
4761 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4763 static inline tree
4764 gimple_omp_continue_control_def (const_gimple g)
4766 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4767 return g->gimple_omp_continue.control_def;
4770 /* The same as above, but return the address. */
4772 static inline tree *
4773 gimple_omp_continue_control_def_ptr (gimple g)
4775 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4776 return &g->gimple_omp_continue.control_def;
4779 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4781 static inline void
4782 gimple_omp_continue_set_control_def (gimple g, tree def)
4784 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4785 g->gimple_omp_continue.control_def = def;
4789 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4791 static inline tree
4792 gimple_omp_continue_control_use (const_gimple g)
4794 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4795 return g->gimple_omp_continue.control_use;
4799 /* The same as above, but return the address. */
4801 static inline tree *
4802 gimple_omp_continue_control_use_ptr (gimple g)
4804 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4805 return &g->gimple_omp_continue.control_use;
4809 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4811 static inline void
4812 gimple_omp_continue_set_control_use (gimple g, tree use)
4814 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4815 g->gimple_omp_continue.control_use = use;
4818 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4820 static inline gimple_seq *
4821 gimple_transaction_body_ptr (gimple gs)
4823 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4824 return &gs->gimple_transaction.body;
4827 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4829 static inline gimple_seq
4830 gimple_transaction_body (gimple gs)
4832 return *gimple_transaction_body_ptr (gs);
4835 /* Return the label associated with a GIMPLE_TRANSACTION. */
4837 static inline tree
4838 gimple_transaction_label (const_gimple gs)
4840 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4841 return gs->gimple_transaction.label;
4844 static inline tree *
4845 gimple_transaction_label_ptr (gimple gs)
4847 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4848 return &gs->gimple_transaction.label;
4851 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4853 static inline unsigned int
4854 gimple_transaction_subcode (const_gimple gs)
4856 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4857 return gs->gsbase.subcode;
4860 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4862 static inline void
4863 gimple_transaction_set_body (gimple gs, gimple_seq body)
4865 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4866 gs->gimple_transaction.body = body;
4869 /* Set the label associated with a GIMPLE_TRANSACTION. */
4871 static inline void
4872 gimple_transaction_set_label (gimple gs, tree label)
4874 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4875 gs->gimple_transaction.label = label;
4878 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4880 static inline void
4881 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4883 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4884 gs->gsbase.subcode = subcode;
4888 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4890 static inline tree *
4891 gimple_return_retval_ptr (const_gimple gs)
4893 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4894 return gimple_op_ptr (gs, 0);
4897 /* Return the return value for GIMPLE_RETURN GS. */
4899 static inline tree
4900 gimple_return_retval (const_gimple gs)
4902 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4903 return gimple_op (gs, 0);
4907 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4909 static inline void
4910 gimple_return_set_retval (gimple gs, tree retval)
4912 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4913 gimple_set_op (gs, 0, retval);
4917 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4919 #define CASE_GIMPLE_OMP \
4920 case GIMPLE_OMP_PARALLEL: \
4921 case GIMPLE_OMP_TASK: \
4922 case GIMPLE_OMP_FOR: \
4923 case GIMPLE_OMP_SECTIONS: \
4924 case GIMPLE_OMP_SECTIONS_SWITCH: \
4925 case GIMPLE_OMP_SINGLE: \
4926 case GIMPLE_OMP_SECTION: \
4927 case GIMPLE_OMP_MASTER: \
4928 case GIMPLE_OMP_ORDERED: \
4929 case GIMPLE_OMP_CRITICAL: \
4930 case GIMPLE_OMP_RETURN: \
4931 case GIMPLE_OMP_ATOMIC_LOAD: \
4932 case GIMPLE_OMP_ATOMIC_STORE: \
4933 case GIMPLE_OMP_CONTINUE
4935 static inline bool
4936 is_gimple_omp (const_gimple stmt)
4938 switch (gimple_code (stmt))
4940 CASE_GIMPLE_OMP:
4941 return true;
4942 default:
4943 return false;
4948 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4950 static inline bool
4951 gimple_nop_p (const_gimple g)
4953 return gimple_code (g) == GIMPLE_NOP;
4957 /* Return true if GS is a GIMPLE_RESX. */
4959 static inline bool
4960 is_gimple_resx (const_gimple gs)
4962 return gimple_code (gs) == GIMPLE_RESX;
4965 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4967 static inline enum br_predictor
4968 gimple_predict_predictor (gimple gs)
4970 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4971 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4975 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4977 static inline void
4978 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4980 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4981 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4982 | (unsigned) predictor;
4986 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4988 static inline enum prediction
4989 gimple_predict_outcome (gimple gs)
4991 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4992 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4996 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4998 static inline void
4999 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5001 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5002 if (outcome == TAKEN)
5003 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
5004 else
5005 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
5009 /* Return the type of the main expression computed by STMT. Return
5010 void_type_node if the statement computes nothing. */
5012 static inline tree
5013 gimple_expr_type (const_gimple stmt)
5015 enum gimple_code code = gimple_code (stmt);
5017 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5019 tree type;
5020 /* In general we want to pass out a type that can be substituted
5021 for both the RHS and the LHS types if there is a possibly
5022 useless conversion involved. That means returning the
5023 original RHS type as far as we can reconstruct it. */
5024 if (code == GIMPLE_CALL)
5025 type = gimple_call_return_type (stmt);
5026 else
5027 switch (gimple_assign_rhs_code (stmt))
5029 case POINTER_PLUS_EXPR:
5030 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5031 break;
5033 default:
5034 /* As fallback use the type of the LHS. */
5035 type = TREE_TYPE (gimple_get_lhs (stmt));
5036 break;
5038 return type;
5040 else if (code == GIMPLE_COND)
5041 return boolean_type_node;
5042 else
5043 return void_type_node;
5046 /* Return true if TYPE is a suitable type for a scalar register variable. */
5048 static inline bool
5049 is_gimple_reg_type (tree type)
5051 return !AGGREGATE_TYPE_P (type);
5054 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5056 static inline gimple_stmt_iterator
5057 gsi_start_1 (gimple_seq *seq)
5059 gimple_stmt_iterator i;
5061 i.ptr = gimple_seq_first (*seq);
5062 i.seq = seq;
5063 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5065 return i;
5068 #define gsi_start(x) gsi_start_1(&(x))
5070 static inline gimple_stmt_iterator
5071 gsi_none (void)
5073 gimple_stmt_iterator i;
5074 i.ptr = NULL;
5075 i.seq = NULL;
5076 i.bb = NULL;
5077 return i;
5080 /* Return a new iterator pointing to the first statement in basic block BB. */
5082 static inline gimple_stmt_iterator
5083 gsi_start_bb (basic_block bb)
5085 gimple_stmt_iterator i;
5086 gimple_seq *seq;
5088 seq = bb_seq_addr (bb);
5089 i.ptr = gimple_seq_first (*seq);
5090 i.seq = seq;
5091 i.bb = bb;
5093 return i;
5097 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5099 static inline gimple_stmt_iterator
5100 gsi_last_1 (gimple_seq *seq)
5102 gimple_stmt_iterator i;
5104 i.ptr = gimple_seq_last (*seq);
5105 i.seq = seq;
5106 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5108 return i;
5111 #define gsi_last(x) gsi_last_1(&(x))
5113 /* Return a new iterator pointing to the last statement in basic block BB. */
5115 static inline gimple_stmt_iterator
5116 gsi_last_bb (basic_block bb)
5118 gimple_stmt_iterator i;
5119 gimple_seq *seq;
5121 seq = bb_seq_addr (bb);
5122 i.ptr = gimple_seq_last (*seq);
5123 i.seq = seq;
5124 i.bb = bb;
5126 return i;
5130 /* Return true if I is at the end of its sequence. */
5132 static inline bool
5133 gsi_end_p (gimple_stmt_iterator i)
5135 return i.ptr == NULL;
5139 /* Return true if I is one statement before the end of its sequence. */
5141 static inline bool
5142 gsi_one_before_end_p (gimple_stmt_iterator i)
5144 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5148 /* Advance the iterator to the next gimple statement. */
5150 static inline void
5151 gsi_next (gimple_stmt_iterator *i)
5153 i->ptr = i->ptr->gsbase.next;
5156 /* Advance the iterator to the previous gimple statement. */
5158 static inline void
5159 gsi_prev (gimple_stmt_iterator *i)
5161 gimple prev = i->ptr->gsbase.prev;
5162 if (prev->gsbase.next)
5163 i->ptr = prev;
5164 else
5165 i->ptr = NULL;
5168 /* Return the current stmt. */
5170 static inline gimple
5171 gsi_stmt (gimple_stmt_iterator i)
5173 return i.ptr;
5176 /* Return a block statement iterator that points to the first non-label
5177 statement in block BB. */
5179 static inline gimple_stmt_iterator
5180 gsi_after_labels (basic_block bb)
5182 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5184 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5185 gsi_next (&gsi);
5187 return gsi;
5190 /* Advance the iterator to the next non-debug gimple statement. */
5192 static inline void
5193 gsi_next_nondebug (gimple_stmt_iterator *i)
5197 gsi_next (i);
5199 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5202 /* Advance the iterator to the next non-debug gimple statement. */
5204 static inline void
5205 gsi_prev_nondebug (gimple_stmt_iterator *i)
5209 gsi_prev (i);
5211 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5214 /* Return a new iterator pointing to the first non-debug statement in
5215 basic block BB. */
5217 static inline gimple_stmt_iterator
5218 gsi_start_nondebug_bb (basic_block bb)
5220 gimple_stmt_iterator i = gsi_start_bb (bb);
5222 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5223 gsi_next_nondebug (&i);
5225 return i;
5228 /* Return a new iterator pointing to the last non-debug statement in
5229 basic block BB. */
5231 static inline gimple_stmt_iterator
5232 gsi_last_nondebug_bb (basic_block bb)
5234 gimple_stmt_iterator i = gsi_last_bb (bb);
5236 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5237 gsi_prev_nondebug (&i);
5239 return i;
5243 /* Return the basic block associated with this iterator. */
5245 static inline basic_block
5246 gsi_bb (gimple_stmt_iterator i)
5248 return i.bb;
5252 /* Return the sequence associated with this iterator. */
5254 static inline gimple_seq
5255 gsi_seq (gimple_stmt_iterator i)
5257 return *i.seq;
5261 enum gsi_iterator_update
5263 GSI_NEW_STMT, /* Only valid when single statement is added, move
5264 iterator to it. */
5265 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5266 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5267 for linking other statements in the same
5268 direction. */
5271 /* In gimple-iterator.c */
5272 gimple_stmt_iterator gsi_start_phis (basic_block);
5273 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5274 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5275 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5276 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5277 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5278 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5279 enum gsi_iterator_update);
5280 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5281 enum gsi_iterator_update);
5282 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5283 enum gsi_iterator_update);
5284 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5285 enum gsi_iterator_update);
5286 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5287 enum gsi_iterator_update);
5288 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5289 enum gsi_iterator_update);
5290 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5291 enum gsi_iterator_update);
5292 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5293 enum gsi_iterator_update);
5294 bool gsi_remove (gimple_stmt_iterator *, bool);
5295 gimple_stmt_iterator gsi_for_stmt (gimple);
5296 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5297 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5298 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5299 void gsi_insert_on_edge (edge, gimple);
5300 void gsi_insert_seq_on_edge (edge, gimple_seq);
5301 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5302 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5303 void gsi_commit_one_edge_insert (edge, basic_block *);
5304 void gsi_commit_edge_inserts (void);
5305 gimple gimple_call_copy_skip_args (gimple, bitmap);
5308 /* Convenience routines to walk all statements of a gimple function.
5309 Note that this is useful exclusively before the code is converted
5310 into SSA form. Once the program is in SSA form, the standard
5311 operand interface should be used to analyze/modify statements. */
5312 struct walk_stmt_info
5314 /* Points to the current statement being walked. */
5315 gimple_stmt_iterator gsi;
5317 /* Additional data that the callback functions may want to carry
5318 through the recursion. */
5319 void *info;
5321 /* Pointer map used to mark visited tree nodes when calling
5322 walk_tree on each operand. If set to NULL, duplicate tree nodes
5323 will be visited more than once. */
5324 struct pointer_set_t *pset;
5326 /* Operand returned by the callbacks. This is set when calling
5327 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5328 returns non-NULL, this field will contain the tree returned by
5329 the last callback. */
5330 tree callback_result;
5332 /* Indicates whether the operand being examined may be replaced
5333 with something that matches is_gimple_val (if true) or something
5334 slightly more complicated (if false). "Something" technically
5335 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5336 but we never try to form anything more complicated than that, so
5337 we don't bother checking.
5339 Also note that CALLBACK should update this flag while walking the
5340 sub-expressions of a statement. For instance, when walking the
5341 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5342 to true, however, when walking &var, the operand of that
5343 ADDR_EXPR does not need to be a GIMPLE value. */
5344 BOOL_BITFIELD val_only : 1;
5346 /* True if we are currently walking the LHS of an assignment. */
5347 BOOL_BITFIELD is_lhs : 1;
5349 /* Optional. Set to true by the callback functions if they made any
5350 changes. */
5351 BOOL_BITFIELD changed : 1;
5353 /* True if we're interested in location information. */
5354 BOOL_BITFIELD want_locations : 1;
5356 /* True if we've removed the statement that was processed. */
5357 BOOL_BITFIELD removed_stmt : 1;
5360 /* Callback for walk_gimple_stmt. Called for every statement found
5361 during traversal. The first argument points to the statement to
5362 walk. The second argument is a flag that the callback sets to
5363 'true' if it the callback handled all the operands and
5364 sub-statements of the statement (the default value of this flag is
5365 'false'). The third argument is an anonymous pointer to data
5366 to be used by the callback. */
5367 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5368 struct walk_stmt_info *);
5370 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5371 struct walk_stmt_info *);
5372 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5373 struct walk_stmt_info *);
5374 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5375 struct walk_stmt_info *);
5376 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5378 /* Enum and arrays used for allocation stats. Keep in sync with
5379 gimple.c:gimple_alloc_kind_names. */
5380 enum gimple_alloc_kind
5382 gimple_alloc_kind_assign, /* Assignments. */
5383 gimple_alloc_kind_phi, /* PHI nodes. */
5384 gimple_alloc_kind_cond, /* Conditionals. */
5385 gimple_alloc_kind_rest, /* Everything else. */
5386 gimple_alloc_kind_all
5389 extern int gimple_alloc_counts[];
5390 extern int gimple_alloc_sizes[];
5392 /* Return the allocation kind for a given stmt CODE. */
5393 static inline enum gimple_alloc_kind
5394 gimple_alloc_kind (enum gimple_code code)
5396 switch (code)
5398 case GIMPLE_ASSIGN:
5399 return gimple_alloc_kind_assign;
5400 case GIMPLE_PHI:
5401 return gimple_alloc_kind_phi;
5402 case GIMPLE_COND:
5403 return gimple_alloc_kind_cond;
5404 default:
5405 return gimple_alloc_kind_rest;
5409 extern void dump_gimple_statistics (void);
5411 /* In gimple-fold.c. */
5412 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5413 tree gimple_fold_builtin (gimple);
5414 bool fold_stmt (gimple_stmt_iterator *);
5415 bool fold_stmt_inplace (gimple_stmt_iterator *);
5416 tree get_symbol_constant_value (tree);
5417 tree canonicalize_constructor_val (tree, tree);
5418 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5419 enum tree_code, tree, tree);
5420 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5421 enum tree_code, tree, tree);
5423 bool gimple_val_nonnegative_real_p (tree);
5426 /* Set the location of all statements in SEQ to LOC. */
5428 static inline void
5429 gimple_seq_set_location (gimple_seq seq, location_t loc)
5431 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5432 gimple_set_location (gsi_stmt (i), loc);
5435 #endif /* GCC_GIMPLE_H */