* gcc.dg/guality/guality.exp: Skip on AIX.
[official-gcc.git] / gcc / gimple.h
blob8ae07c9ba5d9d78a34140375189e8ea0f8c4c269
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,
114 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
115 a thread synchronization via some sort of barrier. The exact barrier
116 that would otherwise be emitted is dependent on the OMP statement with
117 which this return is associated. */
118 GF_OMP_RETURN_NOWAIT = 1 << 0,
120 GF_OMP_SECTION_LAST = 1 << 0,
121 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
122 GF_PREDICT_TAKEN = 1 << 15
125 /* Currently, there are only two types of gimple debug stmt. Others are
126 envisioned, for example, to enable the generation of is_stmt notes
127 in line number information, to mark sequence points, etc. This
128 subcode is to be used to tell them apart. */
129 enum gimple_debug_subcode {
130 GIMPLE_DEBUG_BIND = 0,
131 GIMPLE_DEBUG_SOURCE_BIND = 1
134 /* Masks for selecting a pass local flag (PLF) to work on. These
135 masks are used by gimple_set_plf and gimple_plf. */
136 enum plf_mask {
137 GF_PLF_1 = 1 << 0,
138 GF_PLF_2 = 1 << 1
141 /* Iterator object for GIMPLE statement sequences. */
143 struct gimple_stmt_iterator_d
145 /* Sequence node holding the current statement. */
146 gimple_seq_node ptr;
148 /* Sequence and basic block holding the statement. These fields
149 are necessary to handle edge cases such as when statement is
150 added to an empty basic block or when the last statement of a
151 block/sequence is removed. */
152 gimple_seq *seq;
153 basic_block bb;
156 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
157 are for 64 bit hosts. */
159 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
160 /* [ WORD 1 ]
161 Main identifying code for a tuple. */
162 ENUM_BITFIELD(gimple_code) code : 8;
164 /* Nonzero if a warning should not be emitted on this tuple. */
165 unsigned int no_warning : 1;
167 /* Nonzero if this tuple has been visited. Passes are responsible
168 for clearing this bit before using it. */
169 unsigned int visited : 1;
171 /* Nonzero if this tuple represents a non-temporal move. */
172 unsigned int nontemporal_move : 1;
174 /* Pass local flags. These flags are free for any pass to use as
175 they see fit. Passes should not assume that these flags contain
176 any useful value when the pass starts. Any initial state that
177 the pass requires should be set on entry to the pass. See
178 gimple_set_plf and gimple_plf for usage. */
179 unsigned int plf : 2;
181 /* Nonzero if this statement has been modified and needs to have its
182 operands rescanned. */
183 unsigned modified : 1;
185 /* Nonzero if this statement contains volatile operands. */
186 unsigned has_volatile_ops : 1;
188 /* The SUBCODE field can be used for tuple-specific flags for tuples
189 that do not require subcodes. Note that SUBCODE should be at
190 least as wide as tree codes, as several tuples store tree codes
191 in there. */
192 unsigned int subcode : 16;
194 /* UID of this statement. This is used by passes that want to
195 assign IDs to statements. It must be assigned and used by each
196 pass. By default it should be assumed to contain garbage. */
197 unsigned uid;
199 /* [ WORD 2 ]
200 Locus information for debug info. */
201 location_t location;
203 /* Number of operands in this tuple. */
204 unsigned num_ops;
206 /* [ WORD 3 ]
207 Basic block holding this statement. */
208 basic_block bb;
210 /* [ WORD 4-5 ]
211 Linked lists of gimple statements. The next pointers form
212 a NULL terminated list, the prev pointers are a cyclic list.
213 A gimple statement is hence also a double-ended list of
214 statements, with the pointer itself being the first element,
215 and the prev pointer being the last. */
216 gimple next;
217 gimple GTY((skip)) prev;
221 /* Base structure for tuples with operands. */
223 struct GTY(()) gimple_statement_with_ops_base
225 /* [ WORD 1-6 ] */
226 struct gimple_statement_base gsbase;
228 /* [ WORD 7 ]
229 SSA operand vectors. NOTE: It should be possible to
230 amalgamate these vectors with the operand vector OP. However,
231 the SSA operand vectors are organized differently and contain
232 more information (like immediate use chaining). */
233 struct use_optype_d GTY((skip (""))) *use_ops;
237 /* Statements that take register operands. */
239 struct GTY(()) gimple_statement_with_ops
241 /* [ WORD 1-7 ] */
242 struct gimple_statement_with_ops_base opbase;
244 /* [ WORD 8 ]
245 Operand vector. NOTE! This must always be the last field
246 of this structure. In particular, this means that this
247 structure cannot be embedded inside another one. */
248 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
252 /* Base for statements that take both memory and register operands. */
254 struct GTY(()) gimple_statement_with_memory_ops_base
256 /* [ WORD 1-7 ] */
257 struct gimple_statement_with_ops_base opbase;
259 /* [ WORD 8-9 ]
260 Virtual operands for this statement. The GC will pick them
261 up via the ssa_names array. */
262 tree GTY((skip (""))) vdef;
263 tree GTY((skip (""))) vuse;
267 /* Statements that take both memory and register operands. */
269 struct GTY(()) gimple_statement_with_memory_ops
271 /* [ WORD 1-9 ] */
272 struct gimple_statement_with_memory_ops_base membase;
274 /* [ WORD 10 ]
275 Operand vector. NOTE! This must always be the last field
276 of this structure. In particular, this means that this
277 structure cannot be embedded inside another one. */
278 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
282 /* Call statements that take both memory and register operands. */
284 struct GTY(()) gimple_statement_call
286 /* [ WORD 1-9 ] */
287 struct gimple_statement_with_memory_ops_base membase;
289 /* [ WORD 10-13 ] */
290 struct pt_solution call_used;
291 struct pt_solution call_clobbered;
293 /* [ WORD 14 ] */
294 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
295 tree GTY ((tag ("0"))) fntype;
296 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
297 } u;
299 /* [ WORD 15 ]
300 Operand vector. NOTE! This must always be the last field
301 of this structure. In particular, this means that this
302 structure cannot be embedded inside another one. */
303 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
307 /* OpenMP statements (#pragma omp). */
309 struct GTY(()) gimple_statement_omp {
310 /* [ WORD 1-6 ] */
311 struct gimple_statement_base gsbase;
313 /* [ WORD 7 ] */
314 gimple_seq body;
318 /* GIMPLE_BIND */
320 struct GTY(()) gimple_statement_bind {
321 /* [ WORD 1-6 ] */
322 struct gimple_statement_base gsbase;
324 /* [ WORD 7 ]
325 Variables declared in this scope. */
326 tree vars;
328 /* [ WORD 8 ]
329 This is different than the BLOCK field in gimple_statement_base,
330 which is analogous to TREE_BLOCK (i.e., the lexical block holding
331 this statement). This field is the equivalent of BIND_EXPR_BLOCK
332 in tree land (i.e., the lexical scope defined by this bind). See
333 gimple-low.c. */
334 tree block;
336 /* [ WORD 9 ] */
337 gimple_seq body;
341 /* GIMPLE_CATCH */
343 struct GTY(()) gimple_statement_catch {
344 /* [ WORD 1-6 ] */
345 struct gimple_statement_base gsbase;
347 /* [ WORD 7 ] */
348 tree types;
350 /* [ WORD 8 ] */
351 gimple_seq handler;
355 /* GIMPLE_EH_FILTER */
357 struct GTY(()) gimple_statement_eh_filter {
358 /* [ WORD 1-6 ] */
359 struct gimple_statement_base gsbase;
361 /* [ WORD 7 ]
362 Filter types. */
363 tree types;
365 /* [ WORD 8 ]
366 Failure actions. */
367 gimple_seq failure;
370 /* GIMPLE_EH_ELSE */
372 struct GTY(()) gimple_statement_eh_else {
373 /* [ WORD 1-6 ] */
374 struct gimple_statement_base gsbase;
376 /* [ WORD 7,8 ] */
377 gimple_seq n_body, e_body;
380 /* GIMPLE_EH_MUST_NOT_THROW */
382 struct GTY(()) gimple_statement_eh_mnt {
383 /* [ WORD 1-6 ] */
384 struct gimple_statement_base gsbase;
386 /* [ WORD 7 ] Abort function decl. */
387 tree fndecl;
390 /* GIMPLE_PHI */
392 struct GTY(()) gimple_statement_phi {
393 /* [ WORD 1-6 ] */
394 struct gimple_statement_base gsbase;
396 /* [ WORD 7 ] */
397 unsigned capacity;
398 unsigned nargs;
400 /* [ WORD 8 ] */
401 tree result;
403 /* [ WORD 9 ] */
404 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
408 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
410 struct GTY(()) gimple_statement_eh_ctrl
412 /* [ WORD 1-6 ] */
413 struct gimple_statement_base gsbase;
415 /* [ WORD 7 ]
416 Exception region number. */
417 int region;
421 /* GIMPLE_TRY */
423 struct GTY(()) gimple_statement_try {
424 /* [ WORD 1-6 ] */
425 struct gimple_statement_base gsbase;
427 /* [ WORD 7 ]
428 Expression to evaluate. */
429 gimple_seq eval;
431 /* [ WORD 8 ]
432 Cleanup expression. */
433 gimple_seq cleanup;
436 /* Kind of GIMPLE_TRY statements. */
437 enum gimple_try_flags
439 /* A try/catch. */
440 GIMPLE_TRY_CATCH = 1 << 0,
442 /* A try/finally. */
443 GIMPLE_TRY_FINALLY = 1 << 1,
444 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
446 /* Analogous to TRY_CATCH_IS_CLEANUP. */
447 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
450 /* GIMPLE_WITH_CLEANUP_EXPR */
452 struct GTY(()) gimple_statement_wce {
453 /* [ WORD 1-6 ] */
454 struct gimple_statement_base gsbase;
456 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
457 executed if an exception is thrown, not on normal exit of its
458 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
459 in TARGET_EXPRs. */
461 /* [ WORD 7 ]
462 Cleanup expression. */
463 gimple_seq cleanup;
467 /* GIMPLE_ASM */
469 struct GTY(()) gimple_statement_asm
471 /* [ WORD 1-9 ] */
472 struct gimple_statement_with_memory_ops_base membase;
474 /* [ WORD 10 ]
475 __asm__ statement. */
476 const char *string;
478 /* [ WORD 11 ]
479 Number of inputs, outputs, clobbers, labels. */
480 unsigned char ni;
481 unsigned char no;
482 unsigned char nc;
483 unsigned char nl;
485 /* [ WORD 12 ]
486 Operand vector. NOTE! This must always be the last field
487 of this structure. In particular, this means that this
488 structure cannot be embedded inside another one. */
489 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
492 /* GIMPLE_OMP_CRITICAL */
494 struct GTY(()) gimple_statement_omp_critical {
495 /* [ WORD 1-7 ] */
496 struct gimple_statement_omp omp;
498 /* [ WORD 8 ]
499 Critical section name. */
500 tree name;
504 struct GTY(()) gimple_omp_for_iter {
505 /* Condition code. */
506 enum tree_code cond;
508 /* Index variable. */
509 tree index;
511 /* Initial value. */
512 tree initial;
514 /* Final value. */
515 tree final;
517 /* Increment. */
518 tree incr;
521 /* GIMPLE_OMP_FOR */
523 struct GTY(()) gimple_statement_omp_for {
524 /* [ WORD 1-7 ] */
525 struct gimple_statement_omp omp;
527 /* [ WORD 8 ] */
528 tree clauses;
530 /* [ WORD 9 ]
531 Number of elements in iter array. */
532 size_t collapse;
534 /* [ WORD 10 ] */
535 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
537 /* [ WORD 11 ]
538 Pre-body evaluated before the loop body begins. */
539 gimple_seq pre_body;
543 /* GIMPLE_OMP_PARALLEL */
545 struct GTY(()) gimple_statement_omp_parallel {
546 /* [ WORD 1-7 ] */
547 struct gimple_statement_omp omp;
549 /* [ WORD 8 ]
550 Clauses. */
551 tree clauses;
553 /* [ WORD 9 ]
554 Child function holding the body of the parallel region. */
555 tree child_fn;
557 /* [ WORD 10 ]
558 Shared data argument. */
559 tree data_arg;
563 /* GIMPLE_OMP_TASK */
565 struct GTY(()) gimple_statement_omp_task {
566 /* [ WORD 1-10 ] */
567 struct gimple_statement_omp_parallel par;
569 /* [ WORD 11 ]
570 Child function holding firstprivate initialization if needed. */
571 tree copy_fn;
573 /* [ WORD 12-13 ]
574 Size and alignment in bytes of the argument data block. */
575 tree arg_size;
576 tree arg_align;
580 /* GIMPLE_OMP_SECTION */
581 /* Uses struct gimple_statement_omp. */
584 /* GIMPLE_OMP_SECTIONS */
586 struct GTY(()) gimple_statement_omp_sections {
587 /* [ WORD 1-7 ] */
588 struct gimple_statement_omp omp;
590 /* [ WORD 8 ] */
591 tree clauses;
593 /* [ WORD 9 ]
594 The control variable used for deciding which of the sections to
595 execute. */
596 tree control;
599 /* GIMPLE_OMP_CONTINUE.
601 Note: This does not inherit from gimple_statement_omp, because we
602 do not need the body field. */
604 struct GTY(()) gimple_statement_omp_continue {
605 /* [ WORD 1-6 ] */
606 struct gimple_statement_base gsbase;
608 /* [ WORD 7 ] */
609 tree control_def;
611 /* [ WORD 8 ] */
612 tree control_use;
615 /* GIMPLE_OMP_SINGLE */
617 struct GTY(()) gimple_statement_omp_single {
618 /* [ WORD 1-7 ] */
619 struct gimple_statement_omp omp;
621 /* [ WORD 7 ] */
622 tree clauses;
626 /* GIMPLE_OMP_ATOMIC_LOAD.
627 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
628 contains a sequence, which we don't need here. */
630 struct GTY(()) gimple_statement_omp_atomic_load {
631 /* [ WORD 1-6 ] */
632 struct gimple_statement_base gsbase;
634 /* [ WORD 7-8 ] */
635 tree rhs, lhs;
638 /* GIMPLE_OMP_ATOMIC_STORE.
639 See note on GIMPLE_OMP_ATOMIC_LOAD. */
641 struct GTY(()) gimple_statement_omp_atomic_store {
642 /* [ WORD 1-6 ] */
643 struct gimple_statement_base gsbase;
645 /* [ WORD 7 ] */
646 tree val;
649 /* GIMPLE_TRANSACTION. */
651 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
653 /* The __transaction_atomic was declared [[outer]] or it is
654 __transaction_relaxed. */
655 #define GTMA_IS_OUTER (1u << 0)
656 #define GTMA_IS_RELAXED (1u << 1)
657 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
659 /* The transaction is seen to not have an abort. */
660 #define GTMA_HAVE_ABORT (1u << 2)
661 /* The transaction is seen to have loads or stores. */
662 #define GTMA_HAVE_LOAD (1u << 3)
663 #define GTMA_HAVE_STORE (1u << 4)
664 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
665 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
666 /* The transaction WILL enter serial irrevocable mode.
667 An irrevocable block post-dominates the entire transaction, such
668 that all invocations of the transaction will go serial-irrevocable.
669 In such case, we don't bother instrumenting the transaction, and
670 tell the runtime that it should begin the transaction in
671 serial-irrevocable mode. */
672 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
673 /* The transaction contains no instrumentation code whatsover, most
674 likely because it is guaranteed to go irrevocable upon entry. */
675 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
677 struct GTY(()) gimple_statement_transaction
679 /* [ WORD 1-9 ] */
680 struct gimple_statement_with_memory_ops_base gsbase;
682 /* [ WORD 10 ] */
683 gimple_seq body;
685 /* [ WORD 11 ] */
686 tree label;
689 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
690 enum gimple_statement_structure_enum {
691 #include "gsstruct.def"
692 LAST_GSS_ENUM
694 #undef DEFGSSTRUCT
697 /* Define the overall contents of a gimple tuple. It may be any of the
698 structures declared above for various types of tuples. */
700 union GTY ((desc ("gimple_statement_structure (&%h)"),
701 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
702 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
703 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
704 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
705 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
706 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
707 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
708 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
709 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
710 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
711 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
712 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
713 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
714 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
715 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
716 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
717 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
718 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
719 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
720 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
721 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
722 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
723 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
724 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
725 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
726 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
727 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
730 /* In gimple.c. */
732 /* Helper functions to build GIMPLE statements. */
733 tree create_gimple_tmp (tree, enum ssa_mode = M_SSA);
734 gimple build_assign (enum tree_code, tree, int, enum ssa_mode = M_SSA);
735 gimple build_assign (enum tree_code, gimple, int, enum ssa_mode = M_SSA);
736 gimple build_assign (enum tree_code, tree, tree, enum ssa_mode = M_SSA);
737 gimple build_assign (enum tree_code, gimple, tree, enum ssa_mode = M_SSA);
738 gimple build_assign (enum tree_code, tree, gimple, enum ssa_mode = M_SSA);
739 gimple build_assign (enum tree_code, gimple, gimple, enum ssa_mode = M_SSA);
740 gimple build_type_cast (tree, tree, enum ssa_mode = M_SSA);
741 gimple build_type_cast (tree, gimple, enum ssa_mode = M_SSA);
743 /* Offset in bytes to the location of the operand vector.
744 Zero if there is no operand vector for this tuple structure. */
745 extern size_t const gimple_ops_offset_[];
747 /* Map GIMPLE codes to GSS codes. */
748 extern enum gimple_statement_structure_enum const gss_for_code_[];
750 /* This variable holds the currently expanded gimple statement for purposes
751 of comminucating the profile info to the builtin expanders. */
752 extern gimple currently_expanding_gimple_stmt;
754 gimple gimple_build_return (tree);
756 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
757 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
759 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
761 gimple
762 gimple_build_assign_with_ops (enum tree_code, tree,
763 tree, tree CXX_MEM_STAT_INFO);
764 gimple
765 gimple_build_assign_with_ops (enum tree_code, tree,
766 tree, tree, tree CXX_MEM_STAT_INFO);
768 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
769 #define gimple_build_debug_bind(var,val,stmt) \
770 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
771 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
772 #define gimple_build_debug_source_bind(var,val,stmt) \
773 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
775 gimple gimple_build_call_vec (tree, vec<tree> );
776 gimple gimple_build_call (tree, unsigned, ...);
777 gimple gimple_build_call_valist (tree, unsigned, va_list);
778 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
779 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
780 gimple gimple_build_call_from_tree (tree);
781 gimple gimplify_assign (tree, tree, gimple_seq *);
782 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
783 gimple gimple_build_label (tree label);
784 gimple gimple_build_goto (tree dest);
785 gimple gimple_build_nop (void);
786 gimple gimple_build_bind (tree, gimple_seq, tree);
787 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
788 vec<tree, va_gc> *, vec<tree, va_gc> *,
789 vec<tree, va_gc> *);
790 gimple gimple_build_catch (tree, gimple_seq);
791 gimple gimple_build_eh_filter (tree, gimple_seq);
792 gimple gimple_build_eh_must_not_throw (tree);
793 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
794 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
795 gimple gimple_build_wce (gimple_seq);
796 gimple gimple_build_resx (int);
797 gimple gimple_build_eh_dispatch (int);
798 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
799 gimple gimple_build_switch (tree, tree, vec<tree> );
800 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
801 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
802 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
803 gimple gimple_build_omp_critical (gimple_seq, tree);
804 gimple gimple_build_omp_section (gimple_seq);
805 gimple gimple_build_omp_continue (tree, tree);
806 gimple gimple_build_omp_master (gimple_seq);
807 gimple gimple_build_omp_return (bool);
808 gimple gimple_build_omp_ordered (gimple_seq);
809 gimple gimple_build_omp_sections (gimple_seq, tree);
810 gimple gimple_build_omp_sections_switch (void);
811 gimple gimple_build_omp_single (gimple_seq, tree);
812 gimple gimple_build_cdt (tree, tree);
813 gimple gimple_build_omp_atomic_load (tree, tree);
814 gimple gimple_build_omp_atomic_store (tree);
815 gimple gimple_build_transaction (gimple_seq, tree);
816 gimple gimple_build_predict (enum br_predictor, enum prediction);
817 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
818 void sort_case_labels (vec<tree> );
819 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
820 void gimple_set_body (tree, gimple_seq);
821 gimple_seq gimple_body (tree);
822 bool gimple_has_body_p (tree);
823 gimple_seq gimple_seq_alloc (void);
824 void gimple_seq_free (gimple_seq);
825 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
826 gimple_seq gimple_seq_copy (gimple_seq);
827 bool gimple_call_same_target_p (const_gimple, const_gimple);
828 int gimple_call_flags (const_gimple);
829 int gimple_call_return_flags (const_gimple);
830 int gimple_call_arg_flags (const_gimple, unsigned);
831 void gimple_call_reset_alias_info (gimple);
832 bool gimple_assign_copy_p (gimple);
833 bool gimple_assign_ssa_name_copy_p (gimple);
834 bool gimple_assign_unary_nop_p (gimple);
835 void gimple_set_bb (gimple, basic_block);
836 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
837 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
838 tree, tree, tree);
839 tree gimple_get_lhs (const_gimple);
840 void gimple_set_lhs (gimple, tree);
841 void gimple_replace_lhs (gimple, tree);
842 gimple gimple_copy (gimple);
843 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
844 gimple gimple_build_cond_from_tree (tree, tree, tree);
845 void gimple_cond_set_condition_from_tree (gimple, tree);
846 bool gimple_has_side_effects (const_gimple);
847 bool gimple_could_trap_p (gimple);
848 bool gimple_could_trap_p_1 (gimple, bool, bool);
849 bool gimple_assign_rhs_could_trap_p (gimple);
850 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
851 bool empty_body_p (gimple_seq);
852 unsigned get_gimple_rhs_num_ops (enum tree_code);
853 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
854 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
855 const char *gimple_decl_printable_name (tree, int);
856 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
857 tree gimple_extract_devirt_binfo_from_cst (tree);
859 /* Returns true iff T is a scalar register variable. */
860 extern bool is_gimple_reg (tree);
861 /* Returns true iff T is any sort of variable. */
862 extern bool is_gimple_variable (tree);
863 /* Returns true iff T is any sort of symbol. */
864 extern bool is_gimple_id (tree);
865 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
866 extern bool is_gimple_min_lval (tree);
867 /* Returns true iff T is something whose address can be taken. */
868 extern bool is_gimple_addressable (tree);
869 /* Returns true iff T is any valid GIMPLE lvalue. */
870 extern bool is_gimple_lvalue (tree);
872 /* Returns true iff T is a GIMPLE address. */
873 bool is_gimple_address (const_tree);
874 /* Returns true iff T is a GIMPLE invariant address. */
875 bool is_gimple_invariant_address (const_tree);
876 /* Returns true iff T is a GIMPLE invariant address at interprocedural
877 level. */
878 bool is_gimple_ip_invariant_address (const_tree);
879 /* Returns true iff T is a valid GIMPLE constant. */
880 bool is_gimple_constant (const_tree);
881 /* Returns true iff T is a GIMPLE restricted function invariant. */
882 extern bool is_gimple_min_invariant (const_tree);
883 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
884 extern bool is_gimple_ip_invariant (const_tree);
885 /* Returns true iff T is a GIMPLE rvalue. */
886 extern bool is_gimple_val (tree);
887 /* Returns true iff T is a GIMPLE asm statement input. */
888 extern bool is_gimple_asm_val (tree);
889 /* Returns true iff T is a valid address operand of a MEM_REF. */
890 bool is_gimple_mem_ref_addr (tree);
892 /* Returns true iff T is a valid if-statement condition. */
893 extern bool is_gimple_condexpr (tree);
895 /* Returns true iff T is a valid call address expression. */
896 extern bool is_gimple_call_addr (tree);
898 /* Return TRUE iff stmt is a call to a built-in function. */
899 extern bool is_gimple_builtin_call (gimple stmt);
901 extern void recalculate_side_effects (tree);
902 extern bool gimple_compare_field_offset (tree, tree);
903 extern tree gimple_register_canonical_type (tree);
904 extern void print_gimple_types_stats (const char *);
905 extern void free_gimple_type_tables (void);
906 extern tree gimple_unsigned_type (tree);
907 extern tree gimple_signed_type (tree);
908 extern alias_set_type gimple_get_alias_set (tree);
909 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
910 unsigned *);
911 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
912 bool (*)(gimple, tree, void *),
913 bool (*)(gimple, tree, void *),
914 bool (*)(gimple, tree, void *));
915 extern bool walk_stmt_load_store_ops (gimple, void *,
916 bool (*)(gimple, tree, void *),
917 bool (*)(gimple, tree, void *));
918 extern bool gimple_ior_addresses_taken (bitmap, gimple);
919 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
920 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
921 extern bool gimple_asm_clobbers_memory_p (const_gimple);
923 /* In gimplify.c */
924 extern tree create_tmp_var_raw (tree, const char *);
925 extern tree create_tmp_var_name (const char *);
926 extern tree create_tmp_var (tree, const char *);
927 extern tree create_tmp_reg (tree, const char *);
928 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
929 extern tree get_formal_tmp_var (tree, gimple_seq *);
930 extern void declare_vars (tree, gimple, bool);
931 extern void annotate_all_with_location (gimple_seq, location_t);
933 /* Validation of GIMPLE expressions. Note that these predicates only check
934 the basic form of the expression, they don't recurse to make sure that
935 underlying nodes are also of the right form. */
936 typedef bool (*gimple_predicate)(tree);
939 /* FIXME we should deduce this from the predicate. */
940 enum fallback {
941 fb_none = 0, /* Do not generate a temporary. */
943 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
944 gimplified expression. */
946 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
947 gimplified expression. */
949 fb_mayfail = 4, /* Gimplification may fail. Error issued
950 afterwards. */
951 fb_either= fb_rvalue | fb_lvalue
954 typedef int fallback_t;
956 enum gimplify_status {
957 GS_ERROR = -2, /* Something Bad Seen. */
958 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
959 GS_OK = 0, /* We did something, maybe more to do. */
960 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
963 /* Formal (expression) temporary table handling: multiple occurrences of
964 the same scalar expression are evaluated into the same temporary. */
966 typedef struct gimple_temp_hash_elt
968 tree val; /* Key */
969 tree temp; /* Value */
970 } elt_t;
972 /* Gimplify hashtable helper. */
974 struct gimplify_hasher : typed_free_remove <elt_t>
976 typedef elt_t value_type;
977 typedef elt_t compare_type;
978 static inline hashval_t hash (const value_type *);
979 static inline bool equal (const value_type *, const compare_type *);
982 inline hashval_t
983 gimplify_hasher::hash (const value_type *p)
985 tree t = p->val;
986 return iterative_hash_expr (t, 0);
989 inline bool
990 gimplify_hasher::equal (const value_type *p1, const compare_type *p2)
992 tree t1 = p1->val;
993 tree t2 = p2->val;
994 enum tree_code code = TREE_CODE (t1);
996 if (TREE_CODE (t2) != code
997 || TREE_TYPE (t1) != TREE_TYPE (t2))
998 return false;
1000 if (!operand_equal_p (t1, t2, 0))
1001 return false;
1003 #ifdef ENABLE_CHECKING
1004 /* Only allow them to compare equal if they also hash equal; otherwise
1005 results are nondeterminate, and we fail bootstrap comparison. */
1006 gcc_assert (hash (p1) == hash (p2));
1007 #endif
1009 return true;
1012 struct gimplify_ctx
1014 struct gimplify_ctx *prev_context;
1016 vec<gimple> bind_expr_stack;
1017 tree temps;
1018 gimple_seq conditional_cleanups;
1019 tree exit_label;
1020 tree return_temp;
1022 vec<tree> case_labels;
1023 /* The formal temporary table. Should this be persistent? */
1024 hash_table <gimplify_hasher> temp_htab;
1026 int conditions;
1027 bool save_stack;
1028 bool into_ssa;
1029 bool allow_rhs_cond_expr;
1030 bool in_cleanup_point_expr;
1033 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1034 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1035 fields). */
1036 static inline bool
1037 is_gimple_sizepos (tree expr)
1039 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1040 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1041 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1042 function, the gimplifier will want to replace it with a new variable,
1043 but that will cause problems if this type is from outside the function.
1044 It's OK to have that here. */
1045 return (expr == NULL_TREE
1046 || TREE_CONSTANT (expr)
1047 || TREE_CODE (expr) == VAR_DECL
1048 || CONTAINS_PLACEHOLDER_P (expr));
1051 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1052 bool (*) (tree), fallback_t);
1053 extern void gimplify_type_sizes (tree, gimple_seq *);
1054 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1055 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1056 bool, tree);
1057 extern bool gimplify_stmt (tree *, gimple_seq *);
1058 extern gimple gimplify_body (tree, bool);
1059 extern void push_gimplify_context (struct gimplify_ctx *);
1060 extern void pop_gimplify_context (gimple);
1061 extern void gimplify_and_add (tree, gimple_seq *);
1063 /* Miscellaneous helpers. */
1064 extern void gimple_add_tmp_var (tree);
1065 extern gimple gimple_current_bind_expr (void);
1066 extern vec<gimple> gimple_bind_expr_stack (void);
1067 extern tree voidify_wrapper_expr (tree, tree);
1068 extern tree build_and_jump (tree *);
1069 extern tree force_labels_r (tree *, int *, void *);
1070 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1071 gimple_seq *);
1072 struct gimplify_omp_ctx;
1073 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1074 extern tree gimple_boolify (tree);
1075 extern gimple_predicate rhs_predicate_for (tree);
1076 extern tree canonicalize_cond_expr_cond (tree);
1078 /* In omp-low.c. */
1079 extern tree omp_reduction_init (tree, tree);
1081 /* In trans-mem.c. */
1082 extern void diagnose_tm_safe_errors (tree);
1083 extern void compute_transaction_bits (void);
1085 /* In tree-nested.c. */
1086 extern void lower_nested_functions (tree);
1087 extern void insert_field_into_struct (tree, tree);
1089 /* In gimplify.c. */
1090 extern void gimplify_function_tree (tree);
1092 /* In cfgexpand.c. */
1093 extern tree gimple_assign_rhs_to_tree (gimple);
1095 /* In builtins.c */
1096 extern bool validate_gimple_arglist (const_gimple, ...);
1098 /* In tree-ssa.c */
1099 extern bool tree_ssa_useless_type_conversion (tree);
1100 extern tree tree_ssa_strip_useless_type_conversions (tree);
1101 extern bool useless_type_conversion_p (tree, tree);
1102 extern bool types_compatible_p (tree, tree);
1104 /* In tree-ssa-coalesce.c */
1105 extern bool gimple_can_coalesce_p (tree, tree);
1107 /* Return the first node in GIMPLE sequence S. */
1109 static inline gimple_seq_node
1110 gimple_seq_first (gimple_seq s)
1112 return s;
1116 /* Return the first statement in GIMPLE sequence S. */
1118 static inline gimple
1119 gimple_seq_first_stmt (gimple_seq s)
1121 gimple_seq_node n = gimple_seq_first (s);
1122 return n;
1126 /* Return the last node in GIMPLE sequence S. */
1128 static inline gimple_seq_node
1129 gimple_seq_last (gimple_seq s)
1131 return s ? s->gsbase.prev : NULL;
1135 /* Return the last statement in GIMPLE sequence S. */
1137 static inline gimple
1138 gimple_seq_last_stmt (gimple_seq s)
1140 gimple_seq_node n = gimple_seq_last (s);
1141 return n;
1145 /* Set the last node in GIMPLE sequence *PS to LAST. */
1147 static inline void
1148 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1150 (*ps)->gsbase.prev = last;
1154 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1156 static inline void
1157 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1159 *ps = first;
1163 /* Return true if GIMPLE sequence S is empty. */
1165 static inline bool
1166 gimple_seq_empty_p (gimple_seq s)
1168 return s == NULL;
1171 void gimple_seq_add_stmt (gimple_seq *, gimple);
1173 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1174 *SEQ_P is NULL, a new sequence is allocated. This function is
1175 similar to gimple_seq_add_stmt, but does not scan the operands.
1176 During gimplification, we need to manipulate statement sequences
1177 before the def/use vectors have been constructed. */
1178 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1180 /* Allocate a new sequence and initialize its first element with STMT. */
1182 static inline gimple_seq
1183 gimple_seq_alloc_with_stmt (gimple stmt)
1185 gimple_seq seq = NULL;
1186 gimple_seq_add_stmt (&seq, stmt);
1187 return seq;
1191 /* Returns the sequence of statements in BB. */
1193 static inline gimple_seq
1194 bb_seq (const_basic_block bb)
1196 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1199 static inline gimple_seq *
1200 bb_seq_addr (basic_block bb)
1202 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1205 /* Sets the sequence of statements in BB to SEQ. */
1207 static inline void
1208 set_bb_seq (basic_block bb, gimple_seq seq)
1210 gcc_checking_assert (!(bb->flags & BB_RTL));
1211 bb->il.gimple.seq = seq;
1215 /* Return the code for GIMPLE statement G. */
1217 static inline enum gimple_code
1218 gimple_code (const_gimple g)
1220 return g->gsbase.code;
1224 /* Return the GSS code used by a GIMPLE code. */
1226 static inline enum gimple_statement_structure_enum
1227 gss_for_code (enum gimple_code code)
1229 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1230 return gss_for_code_[code];
1234 /* Return which GSS code is used by GS. */
1236 static inline enum gimple_statement_structure_enum
1237 gimple_statement_structure (gimple gs)
1239 return gss_for_code (gimple_code (gs));
1243 /* Return true if statement G has sub-statements. This is only true for
1244 High GIMPLE statements. */
1246 static inline bool
1247 gimple_has_substatements (gimple g)
1249 switch (gimple_code (g))
1251 case GIMPLE_BIND:
1252 case GIMPLE_CATCH:
1253 case GIMPLE_EH_FILTER:
1254 case GIMPLE_EH_ELSE:
1255 case GIMPLE_TRY:
1256 case GIMPLE_OMP_FOR:
1257 case GIMPLE_OMP_MASTER:
1258 case GIMPLE_OMP_ORDERED:
1259 case GIMPLE_OMP_SECTION:
1260 case GIMPLE_OMP_PARALLEL:
1261 case GIMPLE_OMP_TASK:
1262 case GIMPLE_OMP_SECTIONS:
1263 case GIMPLE_OMP_SINGLE:
1264 case GIMPLE_OMP_CRITICAL:
1265 case GIMPLE_WITH_CLEANUP_EXPR:
1266 case GIMPLE_TRANSACTION:
1267 return true;
1269 default:
1270 return false;
1275 /* Return the basic block holding statement G. */
1277 static inline basic_block
1278 gimple_bb (const_gimple g)
1280 return g->gsbase.bb;
1284 /* Return the lexical scope block holding statement G. */
1286 static inline tree
1287 gimple_block (const_gimple g)
1289 return LOCATION_BLOCK (g->gsbase.location);
1293 /* Set BLOCK to be the lexical scope block holding statement G. */
1295 static inline void
1296 gimple_set_block (gimple g, tree block)
1298 if (block)
1299 g->gsbase.location =
1300 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1301 else
1302 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1306 /* Return location information for statement G. */
1308 static inline location_t
1309 gimple_location (const_gimple g)
1311 return g->gsbase.location;
1314 /* Return pointer to location information for statement G. */
1316 static inline const location_t *
1317 gimple_location_ptr (const_gimple g)
1319 return &g->gsbase.location;
1323 /* Set location information for statement G. */
1325 static inline void
1326 gimple_set_location (gimple g, location_t location)
1328 g->gsbase.location = location;
1332 /* Return true if G contains location information. */
1334 static inline bool
1335 gimple_has_location (const_gimple g)
1337 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1341 /* Return the file name of the location of STMT. */
1343 static inline const char *
1344 gimple_filename (const_gimple stmt)
1346 return LOCATION_FILE (gimple_location (stmt));
1350 /* Return the line number of the location of STMT. */
1352 static inline int
1353 gimple_lineno (const_gimple stmt)
1355 return LOCATION_LINE (gimple_location (stmt));
1359 /* Determine whether SEQ is a singleton. */
1361 static inline bool
1362 gimple_seq_singleton_p (gimple_seq seq)
1364 return ((gimple_seq_first (seq) != NULL)
1365 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1368 /* Return true if no warnings should be emitted for statement STMT. */
1370 static inline bool
1371 gimple_no_warning_p (const_gimple stmt)
1373 return stmt->gsbase.no_warning;
1376 /* Set the no_warning flag of STMT to NO_WARNING. */
1378 static inline void
1379 gimple_set_no_warning (gimple stmt, bool no_warning)
1381 stmt->gsbase.no_warning = (unsigned) no_warning;
1384 /* Set the visited status on statement STMT to VISITED_P. */
1386 static inline void
1387 gimple_set_visited (gimple stmt, bool visited_p)
1389 stmt->gsbase.visited = (unsigned) visited_p;
1393 /* Return the visited status for statement STMT. */
1395 static inline bool
1396 gimple_visited_p (gimple stmt)
1398 return stmt->gsbase.visited;
1402 /* Set pass local flag PLF on statement STMT to VAL_P. */
1404 static inline void
1405 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1407 if (val_p)
1408 stmt->gsbase.plf |= (unsigned int) plf;
1409 else
1410 stmt->gsbase.plf &= ~((unsigned int) plf);
1414 /* Return the value of pass local flag PLF on statement STMT. */
1416 static inline unsigned int
1417 gimple_plf (gimple stmt, enum plf_mask plf)
1419 return stmt->gsbase.plf & ((unsigned int) plf);
1423 /* Set the UID of statement. */
1425 static inline void
1426 gimple_set_uid (gimple g, unsigned uid)
1428 g->gsbase.uid = uid;
1432 /* Return the UID of statement. */
1434 static inline unsigned
1435 gimple_uid (const_gimple g)
1437 return g->gsbase.uid;
1441 /* Make statement G a singleton sequence. */
1443 static inline void
1444 gimple_init_singleton (gimple g)
1446 g->gsbase.next = NULL;
1447 g->gsbase.prev = g;
1451 /* Return true if GIMPLE statement G has register or memory operands. */
1453 static inline bool
1454 gimple_has_ops (const_gimple g)
1456 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1460 /* Return true if GIMPLE statement G has memory operands. */
1462 static inline bool
1463 gimple_has_mem_ops (const_gimple g)
1465 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1469 /* Return the set of USE operands for statement G. */
1471 static inline struct use_optype_d *
1472 gimple_use_ops (const_gimple g)
1474 if (!gimple_has_ops (g))
1475 return NULL;
1476 return g->gsops.opbase.use_ops;
1480 /* Set USE to be the set of USE operands for statement G. */
1482 static inline void
1483 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1485 gcc_gimple_checking_assert (gimple_has_ops (g));
1486 g->gsops.opbase.use_ops = use;
1490 /* Return the set of VUSE operand for statement G. */
1492 static inline use_operand_p
1493 gimple_vuse_op (const_gimple g)
1495 struct use_optype_d *ops;
1496 if (!gimple_has_mem_ops (g))
1497 return NULL_USE_OPERAND_P;
1498 ops = g->gsops.opbase.use_ops;
1499 if (ops
1500 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1501 return USE_OP_PTR (ops);
1502 return NULL_USE_OPERAND_P;
1505 /* Return the set of VDEF operand for statement G. */
1507 static inline def_operand_p
1508 gimple_vdef_op (gimple g)
1510 if (!gimple_has_mem_ops (g))
1511 return NULL_DEF_OPERAND_P;
1512 if (g->gsmembase.vdef)
1513 return &g->gsmembase.vdef;
1514 return NULL_DEF_OPERAND_P;
1518 /* Return the single VUSE operand of the statement G. */
1520 static inline tree
1521 gimple_vuse (const_gimple g)
1523 if (!gimple_has_mem_ops (g))
1524 return NULL_TREE;
1525 return g->gsmembase.vuse;
1528 /* Return the single VDEF operand of the statement G. */
1530 static inline tree
1531 gimple_vdef (const_gimple g)
1533 if (!gimple_has_mem_ops (g))
1534 return NULL_TREE;
1535 return g->gsmembase.vdef;
1538 /* Return the single VUSE operand of the statement G. */
1540 static inline tree *
1541 gimple_vuse_ptr (gimple g)
1543 if (!gimple_has_mem_ops (g))
1544 return NULL;
1545 return &g->gsmembase.vuse;
1548 /* Return the single VDEF operand of the statement G. */
1550 static inline tree *
1551 gimple_vdef_ptr (gimple g)
1553 if (!gimple_has_mem_ops (g))
1554 return NULL;
1555 return &g->gsmembase.vdef;
1558 /* Set the single VUSE operand of the statement G. */
1560 static inline void
1561 gimple_set_vuse (gimple g, tree vuse)
1563 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1564 g->gsmembase.vuse = vuse;
1567 /* Set the single VDEF operand of the statement G. */
1569 static inline void
1570 gimple_set_vdef (gimple g, tree vdef)
1572 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1573 g->gsmembase.vdef = vdef;
1577 /* Return true if statement G has operands and the modified field has
1578 been set. */
1580 static inline bool
1581 gimple_modified_p (const_gimple g)
1583 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1587 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1588 a MODIFIED field. */
1590 static inline void
1591 gimple_set_modified (gimple s, bool modifiedp)
1593 if (gimple_has_ops (s))
1594 s->gsbase.modified = (unsigned) modifiedp;
1598 /* Return the tree code for the expression computed by STMT. This is
1599 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1600 GIMPLE_CALL, return CALL_EXPR as the expression code for
1601 consistency. This is useful when the caller needs to deal with the
1602 three kinds of computation that GIMPLE supports. */
1604 static inline enum tree_code
1605 gimple_expr_code (const_gimple stmt)
1607 enum gimple_code code = gimple_code (stmt);
1608 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1609 return (enum tree_code) stmt->gsbase.subcode;
1610 else
1612 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1613 return CALL_EXPR;
1618 /* Mark statement S as modified, and update it. */
1620 static inline void
1621 update_stmt (gimple s)
1623 if (gimple_has_ops (s))
1625 gimple_set_modified (s, true);
1626 update_stmt_operands (s);
1630 /* Update statement S if it has been optimized. */
1632 static inline void
1633 update_stmt_if_modified (gimple s)
1635 if (gimple_modified_p (s))
1636 update_stmt_operands (s);
1639 /* Return true if statement STMT contains volatile operands. */
1641 static inline bool
1642 gimple_has_volatile_ops (const_gimple stmt)
1644 if (gimple_has_mem_ops (stmt))
1645 return stmt->gsbase.has_volatile_ops;
1646 else
1647 return false;
1651 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1653 static inline void
1654 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1656 if (gimple_has_mem_ops (stmt))
1657 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1660 /* Return true if BB is in a transaction. */
1662 static inline bool
1663 block_in_transaction (basic_block bb)
1665 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1668 /* Return true if STMT is in a transaction. */
1670 static inline bool
1671 gimple_in_transaction (gimple stmt)
1673 return block_in_transaction (gimple_bb (stmt));
1676 /* Return true if statement STMT may access memory. */
1678 static inline bool
1679 gimple_references_memory_p (gimple stmt)
1681 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1685 /* Return the subcode for OMP statement S. */
1687 static inline unsigned
1688 gimple_omp_subcode (const_gimple s)
1690 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1691 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1692 return s->gsbase.subcode;
1695 /* Set the subcode for OMP statement S to SUBCODE. */
1697 static inline void
1698 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1700 /* We only have 16 bits for the subcode. Assert that we are not
1701 overflowing it. */
1702 gcc_gimple_checking_assert (subcode < (1 << 16));
1703 s->gsbase.subcode = subcode;
1706 /* Set the nowait flag on OMP_RETURN statement S. */
1708 static inline void
1709 gimple_omp_return_set_nowait (gimple s)
1711 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1712 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1716 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1717 flag set. */
1719 static inline bool
1720 gimple_omp_return_nowait_p (const_gimple g)
1722 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1723 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1727 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1728 flag set. */
1730 static inline bool
1731 gimple_omp_section_last_p (const_gimple g)
1733 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1734 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1738 /* Set the GF_OMP_SECTION_LAST flag on G. */
1740 static inline void
1741 gimple_omp_section_set_last (gimple g)
1743 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1744 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1748 /* Return true if OMP parallel statement G has the
1749 GF_OMP_PARALLEL_COMBINED flag set. */
1751 static inline bool
1752 gimple_omp_parallel_combined_p (const_gimple g)
1754 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1755 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1759 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1760 value of COMBINED_P. */
1762 static inline void
1763 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1765 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1766 if (combined_p)
1767 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1768 else
1769 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1773 /* Return true if OMP atomic load/store statement G has the
1774 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1776 static inline bool
1777 gimple_omp_atomic_need_value_p (const_gimple g)
1779 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1780 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1781 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1785 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1787 static inline void
1788 gimple_omp_atomic_set_need_value (gimple g)
1790 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1791 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1792 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1796 /* Return the number of operands for statement GS. */
1798 static inline unsigned
1799 gimple_num_ops (const_gimple gs)
1801 return gs->gsbase.num_ops;
1805 /* Set the number of operands for statement GS. */
1807 static inline void
1808 gimple_set_num_ops (gimple gs, unsigned num_ops)
1810 gs->gsbase.num_ops = num_ops;
1814 /* Return the array of operands for statement GS. */
1816 static inline tree *
1817 gimple_ops (gimple gs)
1819 size_t off;
1821 /* All the tuples have their operand vector at the very bottom
1822 of the structure. Note that those structures that do not
1823 have an operand vector have a zero offset. */
1824 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1825 gcc_gimple_checking_assert (off != 0);
1827 return (tree *) ((char *) gs + off);
1831 /* Return operand I for statement GS. */
1833 static inline tree
1834 gimple_op (const_gimple gs, unsigned i)
1836 if (gimple_has_ops (gs))
1838 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1839 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1841 else
1842 return NULL_TREE;
1845 /* Return a pointer to operand I for statement GS. */
1847 static inline tree *
1848 gimple_op_ptr (const_gimple gs, unsigned i)
1850 if (gimple_has_ops (gs))
1852 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1853 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1855 else
1856 return NULL;
1859 /* Set operand I of statement GS to OP. */
1861 static inline void
1862 gimple_set_op (gimple gs, unsigned i, tree op)
1864 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1866 /* Note. It may be tempting to assert that OP matches
1867 is_gimple_operand, but that would be wrong. Different tuples
1868 accept slightly different sets of tree operands. Each caller
1869 should perform its own validation. */
1870 gimple_ops (gs)[i] = op;
1873 /* Return true if GS is a GIMPLE_ASSIGN. */
1875 static inline bool
1876 is_gimple_assign (const_gimple gs)
1878 return gimple_code (gs) == GIMPLE_ASSIGN;
1881 /* Determine if expression CODE is one of the valid expressions that can
1882 be used on the RHS of GIMPLE assignments. */
1884 static inline enum gimple_rhs_class
1885 get_gimple_rhs_class (enum tree_code code)
1887 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1890 /* Return the LHS of assignment statement GS. */
1892 static inline tree
1893 gimple_assign_lhs (const_gimple gs)
1895 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1896 return gimple_op (gs, 0);
1900 /* Return a pointer to the LHS of assignment statement GS. */
1902 static inline tree *
1903 gimple_assign_lhs_ptr (const_gimple gs)
1905 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1906 return gimple_op_ptr (gs, 0);
1910 /* Set LHS to be the LHS operand of assignment statement GS. */
1912 static inline void
1913 gimple_assign_set_lhs (gimple gs, tree lhs)
1915 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1916 gimple_set_op (gs, 0, lhs);
1918 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1919 SSA_NAME_DEF_STMT (lhs) = gs;
1923 /* Return the first operand on the RHS of assignment statement GS. */
1925 static inline tree
1926 gimple_assign_rhs1 (const_gimple gs)
1928 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1929 return gimple_op (gs, 1);
1933 /* Return a pointer to the first operand on the RHS of assignment
1934 statement GS. */
1936 static inline tree *
1937 gimple_assign_rhs1_ptr (const_gimple gs)
1939 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1940 return gimple_op_ptr (gs, 1);
1943 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1945 static inline void
1946 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1948 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1950 gimple_set_op (gs, 1, rhs);
1954 /* Return the second operand on the RHS of assignment statement GS.
1955 If GS does not have two operands, NULL is returned instead. */
1957 static inline tree
1958 gimple_assign_rhs2 (const_gimple gs)
1960 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1962 if (gimple_num_ops (gs) >= 3)
1963 return gimple_op (gs, 2);
1964 else
1965 return NULL_TREE;
1969 /* Return a pointer to the second operand on the RHS of assignment
1970 statement GS. */
1972 static inline tree *
1973 gimple_assign_rhs2_ptr (const_gimple gs)
1975 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1976 return gimple_op_ptr (gs, 2);
1980 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1982 static inline void
1983 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1985 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1987 gimple_set_op (gs, 2, rhs);
1990 /* Return the third operand on the RHS of assignment statement GS.
1991 If GS does not have two operands, NULL is returned instead. */
1993 static inline tree
1994 gimple_assign_rhs3 (const_gimple gs)
1996 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1998 if (gimple_num_ops (gs) >= 4)
1999 return gimple_op (gs, 3);
2000 else
2001 return NULL_TREE;
2004 /* Return a pointer to the third operand on the RHS of assignment
2005 statement GS. */
2007 static inline tree *
2008 gimple_assign_rhs3_ptr (const_gimple gs)
2010 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2011 return gimple_op_ptr (gs, 3);
2015 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2017 static inline void
2018 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2020 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2022 gimple_set_op (gs, 3, rhs);
2025 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2026 to see only a maximum of two operands. */
2028 static inline void
2029 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2030 tree op1, tree op2)
2032 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2035 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2036 to see only a maximum of two operands. */
2038 static inline void
2039 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
2040 tree *op1)
2042 tree op2;
2043 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
2044 gcc_assert (op2 == NULL_TREE);
2047 /* Returns true if GS is a nontemporal move. */
2049 static inline bool
2050 gimple_assign_nontemporal_move_p (const_gimple gs)
2052 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2053 return gs->gsbase.nontemporal_move;
2056 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2058 static inline void
2059 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2061 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2062 gs->gsbase.nontemporal_move = nontemporal;
2066 /* Return the code of the expression computed on the rhs of assignment
2067 statement GS. In case that the RHS is a single object, returns the
2068 tree code of the object. */
2070 static inline enum tree_code
2071 gimple_assign_rhs_code (const_gimple gs)
2073 enum tree_code code;
2074 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2076 code = (enum tree_code) gs->gsbase.subcode;
2077 /* While we initially set subcode to the TREE_CODE of the rhs for
2078 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2079 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2080 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2081 code = TREE_CODE (gimple_assign_rhs1 (gs));
2083 return code;
2087 /* Set CODE to be the code for the expression computed on the RHS of
2088 assignment S. */
2090 static inline void
2091 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2093 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2094 s->gsbase.subcode = code;
2098 /* Return the gimple rhs class of the code of the expression computed on
2099 the rhs of assignment statement GS.
2100 This will never return GIMPLE_INVALID_RHS. */
2102 static inline enum gimple_rhs_class
2103 gimple_assign_rhs_class (const_gimple gs)
2105 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2108 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2109 there is no operator associated with the assignment itself.
2110 Unlike gimple_assign_copy_p, this predicate returns true for
2111 any RHS operand, including those that perform an operation
2112 and do not have the semantics of a copy, such as COND_EXPR. */
2114 static inline bool
2115 gimple_assign_single_p (gimple gs)
2117 return (is_gimple_assign (gs)
2118 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2121 /* Return true if GS performs a store to its lhs. */
2123 static inline bool
2124 gimple_store_p (gimple gs)
2126 tree lhs = gimple_get_lhs (gs);
2127 return lhs && !is_gimple_reg (lhs);
2130 /* Return true if GS is an assignment that loads from its rhs1. */
2132 static inline bool
2133 gimple_assign_load_p (gimple gs)
2135 tree rhs;
2136 if (!gimple_assign_single_p (gs))
2137 return false;
2138 rhs = gimple_assign_rhs1 (gs);
2139 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2140 return true;
2141 rhs = get_base_address (rhs);
2142 return (DECL_P (rhs)
2143 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2147 /* Return true if S is a type-cast assignment. */
2149 static inline bool
2150 gimple_assign_cast_p (gimple s)
2152 if (is_gimple_assign (s))
2154 enum tree_code sc = gimple_assign_rhs_code (s);
2155 return CONVERT_EXPR_CODE_P (sc)
2156 || sc == VIEW_CONVERT_EXPR
2157 || sc == FIX_TRUNC_EXPR;
2160 return false;
2163 /* Return true if S is a clobber statement. */
2165 static inline bool
2166 gimple_clobber_p (gimple s)
2168 return gimple_assign_single_p (s)
2169 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2172 /* Return true if GS is a GIMPLE_CALL. */
2174 static inline bool
2175 is_gimple_call (const_gimple gs)
2177 return gimple_code (gs) == GIMPLE_CALL;
2180 /* Return the LHS of call statement GS. */
2182 static inline tree
2183 gimple_call_lhs (const_gimple gs)
2185 GIMPLE_CHECK (gs, GIMPLE_CALL);
2186 return gimple_op (gs, 0);
2190 /* Return a pointer to the LHS of call statement GS. */
2192 static inline tree *
2193 gimple_call_lhs_ptr (const_gimple gs)
2195 GIMPLE_CHECK (gs, GIMPLE_CALL);
2196 return gimple_op_ptr (gs, 0);
2200 /* Set LHS to be the LHS operand of call statement GS. */
2202 static inline void
2203 gimple_call_set_lhs (gimple gs, tree lhs)
2205 GIMPLE_CHECK (gs, GIMPLE_CALL);
2206 gimple_set_op (gs, 0, lhs);
2207 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2208 SSA_NAME_DEF_STMT (lhs) = gs;
2212 /* Return true if call GS calls an internal-only function, as enumerated
2213 by internal_fn. */
2215 static inline bool
2216 gimple_call_internal_p (const_gimple gs)
2218 GIMPLE_CHECK (gs, GIMPLE_CALL);
2219 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2223 /* Return the target of internal call GS. */
2225 static inline enum internal_fn
2226 gimple_call_internal_fn (const_gimple gs)
2228 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2229 return gs->gimple_call.u.internal_fn;
2233 /* Return the function type of the function called by GS. */
2235 static inline tree
2236 gimple_call_fntype (const_gimple gs)
2238 GIMPLE_CHECK (gs, GIMPLE_CALL);
2239 if (gimple_call_internal_p (gs))
2240 return NULL_TREE;
2241 return gs->gimple_call.u.fntype;
2244 /* Set the type of the function called by GS to FNTYPE. */
2246 static inline void
2247 gimple_call_set_fntype (gimple gs, tree fntype)
2249 GIMPLE_CHECK (gs, GIMPLE_CALL);
2250 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2251 gs->gimple_call.u.fntype = fntype;
2255 /* Return the tree node representing the function called by call
2256 statement GS. */
2258 static inline tree
2259 gimple_call_fn (const_gimple gs)
2261 GIMPLE_CHECK (gs, GIMPLE_CALL);
2262 return gimple_op (gs, 1);
2265 /* Return a pointer to the tree node representing the function called by call
2266 statement GS. */
2268 static inline tree *
2269 gimple_call_fn_ptr (const_gimple gs)
2271 GIMPLE_CHECK (gs, GIMPLE_CALL);
2272 return gimple_op_ptr (gs, 1);
2276 /* Set FN to be the function called by call statement GS. */
2278 static inline void
2279 gimple_call_set_fn (gimple gs, tree fn)
2281 GIMPLE_CHECK (gs, GIMPLE_CALL);
2282 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2283 gimple_set_op (gs, 1, fn);
2287 /* Set FNDECL to be the function called by call statement GS. */
2289 static inline void
2290 gimple_call_set_fndecl (gimple gs, tree decl)
2292 GIMPLE_CHECK (gs, GIMPLE_CALL);
2293 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2294 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2298 /* Set internal function FN to be the function called by call statement GS. */
2300 static inline void
2301 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2303 GIMPLE_CHECK (gs, GIMPLE_CALL);
2304 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2305 gs->gimple_call.u.internal_fn = fn;
2309 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2310 associated with the callee if known. Otherwise return NULL_TREE. */
2312 static inline tree
2313 gimple_call_addr_fndecl (const_tree fn)
2315 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2317 tree fndecl = TREE_OPERAND (fn, 0);
2318 if (TREE_CODE (fndecl) == MEM_REF
2319 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2320 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2321 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2322 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2323 return fndecl;
2325 return NULL_TREE;
2328 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2329 Otherwise return NULL. This function is analogous to
2330 get_callee_fndecl in tree land. */
2332 static inline tree
2333 gimple_call_fndecl (const_gimple gs)
2335 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2339 /* Return the type returned by call statement GS. */
2341 static inline tree
2342 gimple_call_return_type (const_gimple gs)
2344 tree type = gimple_call_fntype (gs);
2346 if (type == NULL_TREE)
2347 return TREE_TYPE (gimple_call_lhs (gs));
2349 /* The type returned by a function is the type of its
2350 function type. */
2351 return TREE_TYPE (type);
2355 /* Return the static chain for call statement GS. */
2357 static inline tree
2358 gimple_call_chain (const_gimple gs)
2360 GIMPLE_CHECK (gs, GIMPLE_CALL);
2361 return gimple_op (gs, 2);
2365 /* Return a pointer to the static chain for call statement GS. */
2367 static inline tree *
2368 gimple_call_chain_ptr (const_gimple gs)
2370 GIMPLE_CHECK (gs, GIMPLE_CALL);
2371 return gimple_op_ptr (gs, 2);
2374 /* Set CHAIN to be the static chain for call statement GS. */
2376 static inline void
2377 gimple_call_set_chain (gimple gs, tree chain)
2379 GIMPLE_CHECK (gs, GIMPLE_CALL);
2381 gimple_set_op (gs, 2, chain);
2385 /* Return the number of arguments used by call statement GS. */
2387 static inline unsigned
2388 gimple_call_num_args (const_gimple gs)
2390 unsigned num_ops;
2391 GIMPLE_CHECK (gs, GIMPLE_CALL);
2392 num_ops = gimple_num_ops (gs);
2393 return num_ops - 3;
2397 /* Return the argument at position INDEX for call statement GS. */
2399 static inline tree
2400 gimple_call_arg (const_gimple gs, unsigned index)
2402 GIMPLE_CHECK (gs, GIMPLE_CALL);
2403 return gimple_op (gs, index + 3);
2407 /* Return a pointer to the argument at position INDEX for call
2408 statement GS. */
2410 static inline tree *
2411 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2413 GIMPLE_CHECK (gs, GIMPLE_CALL);
2414 return gimple_op_ptr (gs, index + 3);
2418 /* Set ARG to be the argument at position INDEX for call statement GS. */
2420 static inline void
2421 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2423 GIMPLE_CHECK (gs, GIMPLE_CALL);
2424 gimple_set_op (gs, index + 3, arg);
2428 /* If TAIL_P is true, mark call statement S as being a tail call
2429 (i.e., a call just before the exit of a function). These calls are
2430 candidate for tail call optimization. */
2432 static inline void
2433 gimple_call_set_tail (gimple s, bool tail_p)
2435 GIMPLE_CHECK (s, GIMPLE_CALL);
2436 if (tail_p)
2437 s->gsbase.subcode |= GF_CALL_TAILCALL;
2438 else
2439 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2443 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2445 static inline bool
2446 gimple_call_tail_p (gimple s)
2448 GIMPLE_CHECK (s, GIMPLE_CALL);
2449 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2453 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2454 slot optimization. This transformation uses the target of the call
2455 expansion as the return slot for calls that return in memory. */
2457 static inline void
2458 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2460 GIMPLE_CHECK (s, GIMPLE_CALL);
2461 if (return_slot_opt_p)
2462 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2463 else
2464 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2468 /* Return true if S is marked for return slot optimization. */
2470 static inline bool
2471 gimple_call_return_slot_opt_p (gimple s)
2473 GIMPLE_CHECK (s, GIMPLE_CALL);
2474 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2478 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2479 thunk to the thunked-to function. */
2481 static inline void
2482 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2484 GIMPLE_CHECK (s, GIMPLE_CALL);
2485 if (from_thunk_p)
2486 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2487 else
2488 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2492 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2494 static inline bool
2495 gimple_call_from_thunk_p (gimple s)
2497 GIMPLE_CHECK (s, GIMPLE_CALL);
2498 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2502 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2503 argument pack in its argument list. */
2505 static inline void
2506 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2508 GIMPLE_CHECK (s, GIMPLE_CALL);
2509 if (pass_arg_pack_p)
2510 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2511 else
2512 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2516 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2517 argument pack in its argument list. */
2519 static inline bool
2520 gimple_call_va_arg_pack_p (gimple s)
2522 GIMPLE_CHECK (s, GIMPLE_CALL);
2523 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2527 /* Return true if S is a noreturn call. */
2529 static inline bool
2530 gimple_call_noreturn_p (gimple s)
2532 GIMPLE_CHECK (s, GIMPLE_CALL);
2533 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2537 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2538 even if the called function can throw in other cases. */
2540 static inline void
2541 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2543 GIMPLE_CHECK (s, GIMPLE_CALL);
2544 if (nothrow_p)
2545 s->gsbase.subcode |= GF_CALL_NOTHROW;
2546 else
2547 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2550 /* Return true if S is a nothrow call. */
2552 static inline bool
2553 gimple_call_nothrow_p (gimple s)
2555 GIMPLE_CHECK (s, GIMPLE_CALL);
2556 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2559 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2560 is known to be emitted for VLA objects. Those are wrapped by
2561 stack_save/stack_restore calls and hence can't lead to unbounded
2562 stack growth even when they occur in loops. */
2564 static inline void
2565 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2567 GIMPLE_CHECK (s, GIMPLE_CALL);
2568 if (for_var)
2569 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2570 else
2571 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2574 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2576 static inline bool
2577 gimple_call_alloca_for_var_p (gimple s)
2579 GIMPLE_CHECK (s, GIMPLE_CALL);
2580 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2583 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2585 static inline void
2586 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2588 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2589 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2590 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2594 /* Return a pointer to the points-to solution for the set of call-used
2595 variables of the call CALL. */
2597 static inline struct pt_solution *
2598 gimple_call_use_set (gimple call)
2600 GIMPLE_CHECK (call, GIMPLE_CALL);
2601 return &call->gimple_call.call_used;
2605 /* Return a pointer to the points-to solution for the set of call-used
2606 variables of the call CALL. */
2608 static inline struct pt_solution *
2609 gimple_call_clobber_set (gimple call)
2611 GIMPLE_CHECK (call, GIMPLE_CALL);
2612 return &call->gimple_call.call_clobbered;
2616 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2617 non-NULL lhs. */
2619 static inline bool
2620 gimple_has_lhs (gimple stmt)
2622 return (is_gimple_assign (stmt)
2623 || (is_gimple_call (stmt)
2624 && gimple_call_lhs (stmt) != NULL_TREE));
2628 /* Return the code of the predicate computed by conditional statement GS. */
2630 static inline enum tree_code
2631 gimple_cond_code (const_gimple gs)
2633 GIMPLE_CHECK (gs, GIMPLE_COND);
2634 return (enum tree_code) gs->gsbase.subcode;
2638 /* Set CODE to be the predicate code for the conditional statement GS. */
2640 static inline void
2641 gimple_cond_set_code (gimple gs, enum tree_code code)
2643 GIMPLE_CHECK (gs, GIMPLE_COND);
2644 gs->gsbase.subcode = code;
2648 /* Return the LHS of the predicate computed by conditional statement GS. */
2650 static inline tree
2651 gimple_cond_lhs (const_gimple gs)
2653 GIMPLE_CHECK (gs, GIMPLE_COND);
2654 return gimple_op (gs, 0);
2657 /* Return the pointer to the LHS of the predicate computed by conditional
2658 statement GS. */
2660 static inline tree *
2661 gimple_cond_lhs_ptr (const_gimple gs)
2663 GIMPLE_CHECK (gs, GIMPLE_COND);
2664 return gimple_op_ptr (gs, 0);
2667 /* Set LHS to be the LHS operand of the predicate computed by
2668 conditional statement GS. */
2670 static inline void
2671 gimple_cond_set_lhs (gimple gs, tree lhs)
2673 GIMPLE_CHECK (gs, GIMPLE_COND);
2674 gimple_set_op (gs, 0, lhs);
2678 /* Return the RHS operand of the predicate computed by conditional GS. */
2680 static inline tree
2681 gimple_cond_rhs (const_gimple gs)
2683 GIMPLE_CHECK (gs, GIMPLE_COND);
2684 return gimple_op (gs, 1);
2687 /* Return the pointer to the RHS operand of the predicate computed by
2688 conditional GS. */
2690 static inline tree *
2691 gimple_cond_rhs_ptr (const_gimple gs)
2693 GIMPLE_CHECK (gs, GIMPLE_COND);
2694 return gimple_op_ptr (gs, 1);
2698 /* Set RHS to be the RHS operand of the predicate computed by
2699 conditional statement GS. */
2701 static inline void
2702 gimple_cond_set_rhs (gimple gs, tree rhs)
2704 GIMPLE_CHECK (gs, GIMPLE_COND);
2705 gimple_set_op (gs, 1, rhs);
2709 /* Return the label used by conditional statement GS when its
2710 predicate evaluates to true. */
2712 static inline tree
2713 gimple_cond_true_label (const_gimple gs)
2715 GIMPLE_CHECK (gs, GIMPLE_COND);
2716 return gimple_op (gs, 2);
2720 /* Set LABEL to be the label used by conditional statement GS when its
2721 predicate evaluates to true. */
2723 static inline void
2724 gimple_cond_set_true_label (gimple gs, tree label)
2726 GIMPLE_CHECK (gs, GIMPLE_COND);
2727 gimple_set_op (gs, 2, label);
2731 /* Set LABEL to be the label used by conditional statement GS when its
2732 predicate evaluates to false. */
2734 static inline void
2735 gimple_cond_set_false_label (gimple gs, tree label)
2737 GIMPLE_CHECK (gs, GIMPLE_COND);
2738 gimple_set_op (gs, 3, label);
2742 /* Return the label used by conditional statement GS when its
2743 predicate evaluates to false. */
2745 static inline tree
2746 gimple_cond_false_label (const_gimple gs)
2748 GIMPLE_CHECK (gs, GIMPLE_COND);
2749 return gimple_op (gs, 3);
2753 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2755 static inline void
2756 gimple_cond_make_false (gimple gs)
2758 gimple_cond_set_lhs (gs, boolean_true_node);
2759 gimple_cond_set_rhs (gs, boolean_false_node);
2760 gs->gsbase.subcode = EQ_EXPR;
2764 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2766 static inline void
2767 gimple_cond_make_true (gimple gs)
2769 gimple_cond_set_lhs (gs, boolean_true_node);
2770 gimple_cond_set_rhs (gs, boolean_true_node);
2771 gs->gsbase.subcode = EQ_EXPR;
2774 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2775 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2777 static inline bool
2778 gimple_cond_true_p (const_gimple gs)
2780 tree lhs = gimple_cond_lhs (gs);
2781 tree rhs = gimple_cond_rhs (gs);
2782 enum tree_code code = gimple_cond_code (gs);
2784 if (lhs != boolean_true_node && lhs != boolean_false_node)
2785 return false;
2787 if (rhs != boolean_true_node && rhs != boolean_false_node)
2788 return false;
2790 if (code == NE_EXPR && lhs != rhs)
2791 return true;
2793 if (code == EQ_EXPR && lhs == rhs)
2794 return true;
2796 return false;
2799 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2800 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2802 static inline bool
2803 gimple_cond_false_p (const_gimple gs)
2805 tree lhs = gimple_cond_lhs (gs);
2806 tree rhs = gimple_cond_rhs (gs);
2807 enum tree_code code = gimple_cond_code (gs);
2809 if (lhs != boolean_true_node && lhs != boolean_false_node)
2810 return false;
2812 if (rhs != boolean_true_node && rhs != boolean_false_node)
2813 return false;
2815 if (code == NE_EXPR && lhs == rhs)
2816 return true;
2818 if (code == EQ_EXPR && lhs != rhs)
2819 return true;
2821 return false;
2824 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2826 static inline void
2827 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2829 gimple_cond_set_code (stmt, code);
2830 gimple_cond_set_lhs (stmt, lhs);
2831 gimple_cond_set_rhs (stmt, rhs);
2834 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2836 static inline tree
2837 gimple_label_label (const_gimple gs)
2839 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2840 return gimple_op (gs, 0);
2844 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2845 GS. */
2847 static inline void
2848 gimple_label_set_label (gimple gs, tree label)
2850 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2851 gimple_set_op (gs, 0, label);
2855 /* Return the destination of the unconditional jump GS. */
2857 static inline tree
2858 gimple_goto_dest (const_gimple gs)
2860 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2861 return gimple_op (gs, 0);
2865 /* Set DEST to be the destination of the unconditonal jump GS. */
2867 static inline void
2868 gimple_goto_set_dest (gimple gs, tree dest)
2870 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2871 gimple_set_op (gs, 0, dest);
2875 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2877 static inline tree
2878 gimple_bind_vars (const_gimple gs)
2880 GIMPLE_CHECK (gs, GIMPLE_BIND);
2881 return gs->gimple_bind.vars;
2885 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2886 statement GS. */
2888 static inline void
2889 gimple_bind_set_vars (gimple gs, tree vars)
2891 GIMPLE_CHECK (gs, GIMPLE_BIND);
2892 gs->gimple_bind.vars = vars;
2896 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2897 statement GS. */
2899 static inline void
2900 gimple_bind_append_vars (gimple gs, tree vars)
2902 GIMPLE_CHECK (gs, GIMPLE_BIND);
2903 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2907 static inline gimple_seq *
2908 gimple_bind_body_ptr (gimple gs)
2910 GIMPLE_CHECK (gs, GIMPLE_BIND);
2911 return &gs->gimple_bind.body;
2914 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2916 static inline gimple_seq
2917 gimple_bind_body (gimple gs)
2919 return *gimple_bind_body_ptr (gs);
2923 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2924 statement GS. */
2926 static inline void
2927 gimple_bind_set_body (gimple gs, gimple_seq seq)
2929 GIMPLE_CHECK (gs, GIMPLE_BIND);
2930 gs->gimple_bind.body = seq;
2934 /* Append a statement to the end of a GIMPLE_BIND's body. */
2936 static inline void
2937 gimple_bind_add_stmt (gimple gs, gimple stmt)
2939 GIMPLE_CHECK (gs, GIMPLE_BIND);
2940 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2944 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2946 static inline void
2947 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2949 GIMPLE_CHECK (gs, GIMPLE_BIND);
2950 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2954 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2955 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2957 static inline tree
2958 gimple_bind_block (const_gimple gs)
2960 GIMPLE_CHECK (gs, GIMPLE_BIND);
2961 return gs->gimple_bind.block;
2965 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2966 statement GS. */
2968 static inline void
2969 gimple_bind_set_block (gimple gs, tree block)
2971 GIMPLE_CHECK (gs, GIMPLE_BIND);
2972 gcc_gimple_checking_assert (block == NULL_TREE
2973 || TREE_CODE (block) == BLOCK);
2974 gs->gimple_bind.block = block;
2978 /* Return the number of input operands for GIMPLE_ASM GS. */
2980 static inline unsigned
2981 gimple_asm_ninputs (const_gimple gs)
2983 GIMPLE_CHECK (gs, GIMPLE_ASM);
2984 return gs->gimple_asm.ni;
2988 /* Return the number of output operands for GIMPLE_ASM GS. */
2990 static inline unsigned
2991 gimple_asm_noutputs (const_gimple gs)
2993 GIMPLE_CHECK (gs, GIMPLE_ASM);
2994 return gs->gimple_asm.no;
2998 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3000 static inline unsigned
3001 gimple_asm_nclobbers (const_gimple gs)
3003 GIMPLE_CHECK (gs, GIMPLE_ASM);
3004 return gs->gimple_asm.nc;
3007 /* Return the number of label operands for GIMPLE_ASM GS. */
3009 static inline unsigned
3010 gimple_asm_nlabels (const_gimple gs)
3012 GIMPLE_CHECK (gs, GIMPLE_ASM);
3013 return gs->gimple_asm.nl;
3016 /* Return input operand INDEX of GIMPLE_ASM GS. */
3018 static inline tree
3019 gimple_asm_input_op (const_gimple gs, unsigned index)
3021 GIMPLE_CHECK (gs, GIMPLE_ASM);
3022 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3023 return gimple_op (gs, index + gs->gimple_asm.no);
3026 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3028 static inline tree *
3029 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3031 GIMPLE_CHECK (gs, GIMPLE_ASM);
3032 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3033 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
3037 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3039 static inline void
3040 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3042 GIMPLE_CHECK (gs, GIMPLE_ASM);
3043 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
3044 && TREE_CODE (in_op) == TREE_LIST);
3045 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
3049 /* Return output operand INDEX of GIMPLE_ASM GS. */
3051 static inline tree
3052 gimple_asm_output_op (const_gimple gs, unsigned index)
3054 GIMPLE_CHECK (gs, GIMPLE_ASM);
3055 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3056 return gimple_op (gs, index);
3059 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3061 static inline tree *
3062 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3064 GIMPLE_CHECK (gs, GIMPLE_ASM);
3065 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3066 return gimple_op_ptr (gs, index);
3070 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3072 static inline void
3073 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3075 GIMPLE_CHECK (gs, GIMPLE_ASM);
3076 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3077 && TREE_CODE (out_op) == TREE_LIST);
3078 gimple_set_op (gs, index, out_op);
3082 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3084 static inline tree
3085 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3087 GIMPLE_CHECK (gs, GIMPLE_ASM);
3088 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3089 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3093 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3095 static inline void
3096 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3098 GIMPLE_CHECK (gs, GIMPLE_ASM);
3099 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3100 && TREE_CODE (clobber_op) == TREE_LIST);
3101 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3104 /* Return label operand INDEX of GIMPLE_ASM GS. */
3106 static inline tree
3107 gimple_asm_label_op (const_gimple gs, unsigned index)
3109 GIMPLE_CHECK (gs, GIMPLE_ASM);
3110 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3111 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3114 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3116 static inline void
3117 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3119 GIMPLE_CHECK (gs, GIMPLE_ASM);
3120 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3121 && TREE_CODE (label_op) == TREE_LIST);
3122 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3125 /* Return the string representing the assembly instruction in
3126 GIMPLE_ASM GS. */
3128 static inline const char *
3129 gimple_asm_string (const_gimple gs)
3131 GIMPLE_CHECK (gs, GIMPLE_ASM);
3132 return gs->gimple_asm.string;
3136 /* Return true if GS is an asm statement marked volatile. */
3138 static inline bool
3139 gimple_asm_volatile_p (const_gimple gs)
3141 GIMPLE_CHECK (gs, GIMPLE_ASM);
3142 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3146 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3148 static inline void
3149 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3151 GIMPLE_CHECK (gs, GIMPLE_ASM);
3152 if (volatile_p)
3153 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3154 else
3155 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3159 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3161 static inline void
3162 gimple_asm_set_input (gimple gs, bool input_p)
3164 GIMPLE_CHECK (gs, GIMPLE_ASM);
3165 if (input_p)
3166 gs->gsbase.subcode |= GF_ASM_INPUT;
3167 else
3168 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3172 /* Return true if asm GS is an ASM_INPUT. */
3174 static inline bool
3175 gimple_asm_input_p (const_gimple gs)
3177 GIMPLE_CHECK (gs, GIMPLE_ASM);
3178 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3182 /* Return the types handled by GIMPLE_CATCH statement GS. */
3184 static inline tree
3185 gimple_catch_types (const_gimple gs)
3187 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3188 return gs->gimple_catch.types;
3192 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3194 static inline tree *
3195 gimple_catch_types_ptr (gimple gs)
3197 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3198 return &gs->gimple_catch.types;
3202 /* Return a pointer to the GIMPLE sequence representing the body of
3203 the handler of GIMPLE_CATCH statement GS. */
3205 static inline gimple_seq *
3206 gimple_catch_handler_ptr (gimple gs)
3208 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3209 return &gs->gimple_catch.handler;
3213 /* Return the GIMPLE sequence representing the body of the handler of
3214 GIMPLE_CATCH statement GS. */
3216 static inline gimple_seq
3217 gimple_catch_handler (gimple gs)
3219 return *gimple_catch_handler_ptr (gs);
3223 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3225 static inline void
3226 gimple_catch_set_types (gimple gs, tree t)
3228 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3229 gs->gimple_catch.types = t;
3233 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3235 static inline void
3236 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3238 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3239 gs->gimple_catch.handler = handler;
3243 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3245 static inline tree
3246 gimple_eh_filter_types (const_gimple gs)
3248 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3249 return gs->gimple_eh_filter.types;
3253 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3254 GS. */
3256 static inline tree *
3257 gimple_eh_filter_types_ptr (gimple gs)
3259 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3260 return &gs->gimple_eh_filter.types;
3264 /* Return a pointer to the sequence of statement to execute when
3265 GIMPLE_EH_FILTER statement fails. */
3267 static inline gimple_seq *
3268 gimple_eh_filter_failure_ptr (gimple gs)
3270 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3271 return &gs->gimple_eh_filter.failure;
3275 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3276 statement fails. */
3278 static inline gimple_seq
3279 gimple_eh_filter_failure (gimple gs)
3281 return *gimple_eh_filter_failure_ptr (gs);
3285 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3287 static inline void
3288 gimple_eh_filter_set_types (gimple gs, tree types)
3290 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3291 gs->gimple_eh_filter.types = types;
3295 /* Set FAILURE to be the sequence of statements to execute on failure
3296 for GIMPLE_EH_FILTER GS. */
3298 static inline void
3299 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3301 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3302 gs->gimple_eh_filter.failure = failure;
3305 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3307 static inline tree
3308 gimple_eh_must_not_throw_fndecl (gimple gs)
3310 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3311 return gs->gimple_eh_mnt.fndecl;
3314 /* Set the function decl to be called by GS to DECL. */
3316 static inline void
3317 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3319 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3320 gs->gimple_eh_mnt.fndecl = decl;
3323 /* GIMPLE_EH_ELSE accessors. */
3325 static inline gimple_seq *
3326 gimple_eh_else_n_body_ptr (gimple gs)
3328 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3329 return &gs->gimple_eh_else.n_body;
3332 static inline gimple_seq
3333 gimple_eh_else_n_body (gimple gs)
3335 return *gimple_eh_else_n_body_ptr (gs);
3338 static inline gimple_seq *
3339 gimple_eh_else_e_body_ptr (gimple gs)
3341 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3342 return &gs->gimple_eh_else.e_body;
3345 static inline gimple_seq
3346 gimple_eh_else_e_body (gimple gs)
3348 return *gimple_eh_else_e_body_ptr (gs);
3351 static inline void
3352 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3354 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3355 gs->gimple_eh_else.n_body = seq;
3358 static inline void
3359 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3361 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3362 gs->gimple_eh_else.e_body = seq;
3365 /* GIMPLE_TRY accessors. */
3367 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3368 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3370 static inline enum gimple_try_flags
3371 gimple_try_kind (const_gimple gs)
3373 GIMPLE_CHECK (gs, GIMPLE_TRY);
3374 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3378 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3380 static inline void
3381 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3383 GIMPLE_CHECK (gs, GIMPLE_TRY);
3384 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3385 || kind == GIMPLE_TRY_FINALLY);
3386 if (gimple_try_kind (gs) != kind)
3387 gs->gsbase.subcode = (unsigned int) kind;
3391 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3393 static inline bool
3394 gimple_try_catch_is_cleanup (const_gimple gs)
3396 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3397 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3401 /* Return a pointer to the sequence of statements used as the
3402 body for GIMPLE_TRY GS. */
3404 static inline gimple_seq *
3405 gimple_try_eval_ptr (gimple gs)
3407 GIMPLE_CHECK (gs, GIMPLE_TRY);
3408 return &gs->gimple_try.eval;
3412 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3414 static inline gimple_seq
3415 gimple_try_eval (gimple gs)
3417 return *gimple_try_eval_ptr (gs);
3421 /* Return a pointer to the sequence of statements used as the cleanup body for
3422 GIMPLE_TRY GS. */
3424 static inline gimple_seq *
3425 gimple_try_cleanup_ptr (gimple gs)
3427 GIMPLE_CHECK (gs, GIMPLE_TRY);
3428 return &gs->gimple_try.cleanup;
3432 /* Return the sequence of statements used as the cleanup body for
3433 GIMPLE_TRY GS. */
3435 static inline gimple_seq
3436 gimple_try_cleanup (gimple gs)
3438 return *gimple_try_cleanup_ptr (gs);
3442 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3444 static inline void
3445 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3447 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3448 if (catch_is_cleanup)
3449 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3450 else
3451 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3455 /* Set EVAL to be the sequence of statements to use as the body for
3456 GIMPLE_TRY GS. */
3458 static inline void
3459 gimple_try_set_eval (gimple gs, gimple_seq eval)
3461 GIMPLE_CHECK (gs, GIMPLE_TRY);
3462 gs->gimple_try.eval = eval;
3466 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3467 body for GIMPLE_TRY GS. */
3469 static inline void
3470 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3472 GIMPLE_CHECK (gs, GIMPLE_TRY);
3473 gs->gimple_try.cleanup = cleanup;
3477 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3479 static inline gimple_seq *
3480 gimple_wce_cleanup_ptr (gimple gs)
3482 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3483 return &gs->gimple_wce.cleanup;
3487 /* Return the cleanup sequence for cleanup statement GS. */
3489 static inline gimple_seq
3490 gimple_wce_cleanup (gimple gs)
3492 return *gimple_wce_cleanup_ptr (gs);
3496 /* Set CLEANUP to be the cleanup sequence for GS. */
3498 static inline void
3499 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3501 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3502 gs->gimple_wce.cleanup = cleanup;
3506 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3508 static inline bool
3509 gimple_wce_cleanup_eh_only (const_gimple gs)
3511 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3512 return gs->gsbase.subcode != 0;
3516 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3518 static inline void
3519 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3521 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3522 gs->gsbase.subcode = (unsigned int) eh_only_p;
3526 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3528 static inline unsigned
3529 gimple_phi_capacity (const_gimple gs)
3531 GIMPLE_CHECK (gs, GIMPLE_PHI);
3532 return gs->gimple_phi.capacity;
3536 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3537 be exactly the number of incoming edges for the basic block holding
3538 GS. */
3540 static inline unsigned
3541 gimple_phi_num_args (const_gimple gs)
3543 GIMPLE_CHECK (gs, GIMPLE_PHI);
3544 return gs->gimple_phi.nargs;
3548 /* Return the SSA name created by GIMPLE_PHI GS. */
3550 static inline tree
3551 gimple_phi_result (const_gimple gs)
3553 GIMPLE_CHECK (gs, GIMPLE_PHI);
3554 return gs->gimple_phi.result;
3557 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3559 static inline tree *
3560 gimple_phi_result_ptr (gimple gs)
3562 GIMPLE_CHECK (gs, GIMPLE_PHI);
3563 return &gs->gimple_phi.result;
3566 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3568 static inline void
3569 gimple_phi_set_result (gimple gs, tree result)
3571 GIMPLE_CHECK (gs, GIMPLE_PHI);
3572 gs->gimple_phi.result = result;
3573 if (result && TREE_CODE (result) == SSA_NAME)
3574 SSA_NAME_DEF_STMT (result) = gs;
3578 /* Return the PHI argument corresponding to incoming edge INDEX for
3579 GIMPLE_PHI GS. */
3581 static inline struct phi_arg_d *
3582 gimple_phi_arg (gimple gs, unsigned index)
3584 GIMPLE_CHECK (gs, GIMPLE_PHI);
3585 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3586 return &(gs->gimple_phi.args[index]);
3589 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3590 for GIMPLE_PHI GS. */
3592 static inline void
3593 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3595 GIMPLE_CHECK (gs, GIMPLE_PHI);
3596 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3597 gs->gimple_phi.args[index] = *phiarg;
3600 /* Return the region number for GIMPLE_RESX GS. */
3602 static inline int
3603 gimple_resx_region (const_gimple gs)
3605 GIMPLE_CHECK (gs, GIMPLE_RESX);
3606 return gs->gimple_eh_ctrl.region;
3609 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3611 static inline void
3612 gimple_resx_set_region (gimple gs, int region)
3614 GIMPLE_CHECK (gs, GIMPLE_RESX);
3615 gs->gimple_eh_ctrl.region = region;
3618 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3620 static inline int
3621 gimple_eh_dispatch_region (const_gimple gs)
3623 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3624 return gs->gimple_eh_ctrl.region;
3627 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3629 static inline void
3630 gimple_eh_dispatch_set_region (gimple gs, int region)
3632 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3633 gs->gimple_eh_ctrl.region = region;
3636 /* Return the number of labels associated with the switch statement GS. */
3638 static inline unsigned
3639 gimple_switch_num_labels (const_gimple gs)
3641 unsigned num_ops;
3642 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3643 num_ops = gimple_num_ops (gs);
3644 gcc_gimple_checking_assert (num_ops > 1);
3645 return num_ops - 1;
3649 /* Set NLABELS to be the number of labels for the switch statement GS. */
3651 static inline void
3652 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3654 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3655 gimple_set_num_ops (g, nlabels + 1);
3659 /* Return the index variable used by the switch statement GS. */
3661 static inline tree
3662 gimple_switch_index (const_gimple gs)
3664 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3665 return gimple_op (gs, 0);
3669 /* Return a pointer to the index variable for the switch statement GS. */
3671 static inline tree *
3672 gimple_switch_index_ptr (const_gimple gs)
3674 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3675 return gimple_op_ptr (gs, 0);
3679 /* Set INDEX to be the index variable for switch statement GS. */
3681 static inline void
3682 gimple_switch_set_index (gimple gs, tree index)
3684 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3685 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3686 gimple_set_op (gs, 0, index);
3690 /* Return the label numbered INDEX. The default label is 0, followed by any
3691 labels in a switch statement. */
3693 static inline tree
3694 gimple_switch_label (const_gimple gs, unsigned index)
3696 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3697 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3698 return gimple_op (gs, index + 1);
3701 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3703 static inline void
3704 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3706 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3707 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3708 && (label == NULL_TREE
3709 || TREE_CODE (label) == CASE_LABEL_EXPR));
3710 gimple_set_op (gs, index + 1, label);
3713 /* Return the default label for a switch statement. */
3715 static inline tree
3716 gimple_switch_default_label (const_gimple gs)
3718 tree label = gimple_switch_label (gs, 0);
3719 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3720 return label;
3723 /* Set the default label for a switch statement. */
3725 static inline void
3726 gimple_switch_set_default_label (gimple gs, tree label)
3728 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3729 gimple_switch_set_label (gs, 0, label);
3732 /* Return true if GS is a GIMPLE_DEBUG statement. */
3734 static inline bool
3735 is_gimple_debug (const_gimple gs)
3737 return gimple_code (gs) == GIMPLE_DEBUG;
3740 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3742 static inline bool
3743 gimple_debug_bind_p (const_gimple s)
3745 if (is_gimple_debug (s))
3746 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3748 return false;
3751 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3753 static inline tree
3754 gimple_debug_bind_get_var (gimple dbg)
3756 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3757 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3758 return gimple_op (dbg, 0);
3761 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3762 statement. */
3764 static inline tree
3765 gimple_debug_bind_get_value (gimple dbg)
3767 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3768 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3769 return gimple_op (dbg, 1);
3772 /* Return a pointer to the value bound to the variable in a
3773 GIMPLE_DEBUG bind statement. */
3775 static inline tree *
3776 gimple_debug_bind_get_value_ptr (gimple dbg)
3778 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3779 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3780 return gimple_op_ptr (dbg, 1);
3783 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3785 static inline void
3786 gimple_debug_bind_set_var (gimple dbg, tree var)
3788 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3789 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3790 gimple_set_op (dbg, 0, var);
3793 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3794 statement. */
3796 static inline void
3797 gimple_debug_bind_set_value (gimple dbg, tree value)
3799 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3800 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3801 gimple_set_op (dbg, 1, value);
3804 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3805 optimized away. */
3806 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3808 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3809 statement. */
3811 static inline void
3812 gimple_debug_bind_reset_value (gimple dbg)
3814 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3815 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3816 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3819 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3820 value. */
3822 static inline bool
3823 gimple_debug_bind_has_value_p (gimple dbg)
3825 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3826 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3827 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3830 #undef GIMPLE_DEBUG_BIND_NOVALUE
3832 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3834 static inline bool
3835 gimple_debug_source_bind_p (const_gimple s)
3837 if (is_gimple_debug (s))
3838 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3840 return false;
3843 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3845 static inline tree
3846 gimple_debug_source_bind_get_var (gimple dbg)
3848 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3849 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3850 return gimple_op (dbg, 0);
3853 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3854 statement. */
3856 static inline tree
3857 gimple_debug_source_bind_get_value (gimple dbg)
3859 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3860 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3861 return gimple_op (dbg, 1);
3864 /* Return a pointer to the value bound to the variable in a
3865 GIMPLE_DEBUG source bind statement. */
3867 static inline tree *
3868 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3870 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3871 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3872 return gimple_op_ptr (dbg, 1);
3875 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3877 static inline void
3878 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3880 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3881 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3882 gimple_set_op (dbg, 0, var);
3885 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3886 statement. */
3888 static inline void
3889 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3891 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3892 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3893 gimple_set_op (dbg, 1, value);
3896 /* Return a pointer to the body for the OMP statement GS. */
3898 static inline gimple_seq *
3899 gimple_omp_body_ptr (gimple gs)
3901 return &gs->omp.body;
3904 /* Return the body for the OMP statement GS. */
3906 static inline gimple_seq
3907 gimple_omp_body (gimple gs)
3909 return *gimple_omp_body_ptr (gs);
3912 /* Set BODY to be the body for the OMP statement GS. */
3914 static inline void
3915 gimple_omp_set_body (gimple gs, gimple_seq body)
3917 gs->omp.body = body;
3921 /* Return the name associated with OMP_CRITICAL statement GS. */
3923 static inline tree
3924 gimple_omp_critical_name (const_gimple gs)
3926 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3927 return gs->gimple_omp_critical.name;
3931 /* Return a pointer to the name associated with OMP critical statement GS. */
3933 static inline tree *
3934 gimple_omp_critical_name_ptr (gimple gs)
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3937 return &gs->gimple_omp_critical.name;
3941 /* Set NAME to be the name associated with OMP critical statement GS. */
3943 static inline void
3944 gimple_omp_critical_set_name (gimple gs, tree name)
3946 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3947 gs->gimple_omp_critical.name = name;
3951 /* Return the clauses associated with OMP_FOR GS. */
3953 static inline tree
3954 gimple_omp_for_clauses (const_gimple gs)
3956 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3957 return gs->gimple_omp_for.clauses;
3961 /* Return a pointer to the OMP_FOR GS. */
3963 static inline tree *
3964 gimple_omp_for_clauses_ptr (gimple gs)
3966 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3967 return &gs->gimple_omp_for.clauses;
3971 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3973 static inline void
3974 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3976 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3977 gs->gimple_omp_for.clauses = clauses;
3981 /* Get the collapse count of OMP_FOR GS. */
3983 static inline size_t
3984 gimple_omp_for_collapse (gimple gs)
3986 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3987 return gs->gimple_omp_for.collapse;
3991 /* Return the index variable for OMP_FOR GS. */
3993 static inline tree
3994 gimple_omp_for_index (const_gimple gs, size_t i)
3996 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3997 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3998 return gs->gimple_omp_for.iter[i].index;
4002 /* Return a pointer to the index variable for OMP_FOR GS. */
4004 static inline tree *
4005 gimple_omp_for_index_ptr (gimple gs, size_t i)
4007 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4008 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4009 return &gs->gimple_omp_for.iter[i].index;
4013 /* Set INDEX to be the index variable for OMP_FOR GS. */
4015 static inline void
4016 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4018 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4019 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4020 gs->gimple_omp_for.iter[i].index = index;
4024 /* Return the initial value for OMP_FOR GS. */
4026 static inline tree
4027 gimple_omp_for_initial (const_gimple gs, size_t i)
4029 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4030 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4031 return gs->gimple_omp_for.iter[i].initial;
4035 /* Return a pointer to the initial value for OMP_FOR GS. */
4037 static inline tree *
4038 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4040 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4041 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4042 return &gs->gimple_omp_for.iter[i].initial;
4046 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4048 static inline void
4049 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4051 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4052 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4053 gs->gimple_omp_for.iter[i].initial = initial;
4057 /* Return the final value for OMP_FOR GS. */
4059 static inline tree
4060 gimple_omp_for_final (const_gimple gs, size_t i)
4062 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4063 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4064 return gs->gimple_omp_for.iter[i].final;
4068 /* Return a pointer to the final value for OMP_FOR GS. */
4070 static inline tree *
4071 gimple_omp_for_final_ptr (gimple gs, size_t i)
4073 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4074 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4075 return &gs->gimple_omp_for.iter[i].final;
4079 /* Set FINAL to be the final value for OMP_FOR GS. */
4081 static inline void
4082 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4084 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4085 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4086 gs->gimple_omp_for.iter[i].final = final;
4090 /* Return the increment value for OMP_FOR GS. */
4092 static inline tree
4093 gimple_omp_for_incr (const_gimple gs, size_t i)
4095 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4096 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4097 return gs->gimple_omp_for.iter[i].incr;
4101 /* Return a pointer to the increment value for OMP_FOR GS. */
4103 static inline tree *
4104 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4106 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4107 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4108 return &gs->gimple_omp_for.iter[i].incr;
4112 /* Set INCR to be the increment value for OMP_FOR GS. */
4114 static inline void
4115 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4117 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4118 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4119 gs->gimple_omp_for.iter[i].incr = incr;
4123 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4124 statement GS starts. */
4126 static inline gimple_seq *
4127 gimple_omp_for_pre_body_ptr (gimple gs)
4129 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4130 return &gs->gimple_omp_for.pre_body;
4134 /* Return the sequence of statements to execute before the OMP_FOR
4135 statement GS starts. */
4137 static inline gimple_seq
4138 gimple_omp_for_pre_body (gimple gs)
4140 return *gimple_omp_for_pre_body_ptr (gs);
4144 /* Set PRE_BODY to be the sequence of statements to execute before the
4145 OMP_FOR statement GS starts. */
4147 static inline void
4148 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4150 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4151 gs->gimple_omp_for.pre_body = pre_body;
4155 /* Return the clauses associated with OMP_PARALLEL GS. */
4157 static inline tree
4158 gimple_omp_parallel_clauses (const_gimple gs)
4160 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4161 return gs->gimple_omp_parallel.clauses;
4165 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4167 static inline tree *
4168 gimple_omp_parallel_clauses_ptr (gimple gs)
4170 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4171 return &gs->gimple_omp_parallel.clauses;
4175 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4176 GS. */
4178 static inline void
4179 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4181 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4182 gs->gimple_omp_parallel.clauses = clauses;
4186 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4188 static inline tree
4189 gimple_omp_parallel_child_fn (const_gimple gs)
4191 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4192 return gs->gimple_omp_parallel.child_fn;
4195 /* Return a pointer to the child function used to hold the body of
4196 OMP_PARALLEL GS. */
4198 static inline tree *
4199 gimple_omp_parallel_child_fn_ptr (gimple gs)
4201 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4202 return &gs->gimple_omp_parallel.child_fn;
4206 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4208 static inline void
4209 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4211 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4212 gs->gimple_omp_parallel.child_fn = child_fn;
4216 /* Return the artificial argument used to send variables and values
4217 from the parent to the children threads in OMP_PARALLEL GS. */
4219 static inline tree
4220 gimple_omp_parallel_data_arg (const_gimple gs)
4222 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4223 return gs->gimple_omp_parallel.data_arg;
4227 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4229 static inline tree *
4230 gimple_omp_parallel_data_arg_ptr (gimple gs)
4232 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4233 return &gs->gimple_omp_parallel.data_arg;
4237 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4239 static inline void
4240 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4242 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4243 gs->gimple_omp_parallel.data_arg = data_arg;
4247 /* Return the clauses associated with OMP_TASK GS. */
4249 static inline tree
4250 gimple_omp_task_clauses (const_gimple gs)
4252 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4253 return gs->gimple_omp_parallel.clauses;
4257 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4259 static inline tree *
4260 gimple_omp_task_clauses_ptr (gimple gs)
4262 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4263 return &gs->gimple_omp_parallel.clauses;
4267 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4268 GS. */
4270 static inline void
4271 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4273 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4274 gs->gimple_omp_parallel.clauses = clauses;
4278 /* Return the child function used to hold the body of OMP_TASK GS. */
4280 static inline tree
4281 gimple_omp_task_child_fn (const_gimple gs)
4283 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4284 return gs->gimple_omp_parallel.child_fn;
4287 /* Return a pointer to the child function used to hold the body of
4288 OMP_TASK GS. */
4290 static inline tree *
4291 gimple_omp_task_child_fn_ptr (gimple gs)
4293 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4294 return &gs->gimple_omp_parallel.child_fn;
4298 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4300 static inline void
4301 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4303 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4304 gs->gimple_omp_parallel.child_fn = child_fn;
4308 /* Return the artificial argument used to send variables and values
4309 from the parent to the children threads in OMP_TASK GS. */
4311 static inline tree
4312 gimple_omp_task_data_arg (const_gimple gs)
4314 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4315 return gs->gimple_omp_parallel.data_arg;
4319 /* Return a pointer to the data argument for OMP_TASK GS. */
4321 static inline tree *
4322 gimple_omp_task_data_arg_ptr (gimple gs)
4324 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4325 return &gs->gimple_omp_parallel.data_arg;
4329 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4331 static inline void
4332 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4334 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4335 gs->gimple_omp_parallel.data_arg = data_arg;
4339 /* Return the clauses associated with OMP_TASK GS. */
4341 static inline tree
4342 gimple_omp_taskreg_clauses (const_gimple gs)
4344 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4345 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4346 return gs->gimple_omp_parallel.clauses;
4350 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4352 static inline tree *
4353 gimple_omp_taskreg_clauses_ptr (gimple gs)
4355 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4356 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4357 return &gs->gimple_omp_parallel.clauses;
4361 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4362 GS. */
4364 static inline void
4365 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4367 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4368 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4369 gs->gimple_omp_parallel.clauses = clauses;
4373 /* Return the child function used to hold the body of OMP_TASK GS. */
4375 static inline tree
4376 gimple_omp_taskreg_child_fn (const_gimple gs)
4378 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4379 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4380 return gs->gimple_omp_parallel.child_fn;
4383 /* Return a pointer to the child function used to hold the body of
4384 OMP_TASK GS. */
4386 static inline tree *
4387 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4389 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4390 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4391 return &gs->gimple_omp_parallel.child_fn;
4395 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4397 static inline void
4398 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4400 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4401 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4402 gs->gimple_omp_parallel.child_fn = child_fn;
4406 /* Return the artificial argument used to send variables and values
4407 from the parent to the children threads in OMP_TASK GS. */
4409 static inline tree
4410 gimple_omp_taskreg_data_arg (const_gimple gs)
4412 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4413 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4414 return gs->gimple_omp_parallel.data_arg;
4418 /* Return a pointer to the data argument for OMP_TASK GS. */
4420 static inline tree *
4421 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4423 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4424 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4425 return &gs->gimple_omp_parallel.data_arg;
4429 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4431 static inline void
4432 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4434 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4435 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4436 gs->gimple_omp_parallel.data_arg = data_arg;
4440 /* Return the copy function used to hold the body of OMP_TASK GS. */
4442 static inline tree
4443 gimple_omp_task_copy_fn (const_gimple gs)
4445 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4446 return gs->gimple_omp_task.copy_fn;
4449 /* Return a pointer to the copy function used to hold the body of
4450 OMP_TASK GS. */
4452 static inline tree *
4453 gimple_omp_task_copy_fn_ptr (gimple gs)
4455 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4456 return &gs->gimple_omp_task.copy_fn;
4460 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4462 static inline void
4463 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4465 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4466 gs->gimple_omp_task.copy_fn = copy_fn;
4470 /* Return size of the data block in bytes in OMP_TASK GS. */
4472 static inline tree
4473 gimple_omp_task_arg_size (const_gimple gs)
4475 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4476 return gs->gimple_omp_task.arg_size;
4480 /* Return a pointer to the data block size for OMP_TASK GS. */
4482 static inline tree *
4483 gimple_omp_task_arg_size_ptr (gimple gs)
4485 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4486 return &gs->gimple_omp_task.arg_size;
4490 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4492 static inline void
4493 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4495 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4496 gs->gimple_omp_task.arg_size = arg_size;
4500 /* Return align of the data block in bytes in OMP_TASK GS. */
4502 static inline tree
4503 gimple_omp_task_arg_align (const_gimple gs)
4505 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4506 return gs->gimple_omp_task.arg_align;
4510 /* Return a pointer to the data block align for OMP_TASK GS. */
4512 static inline tree *
4513 gimple_omp_task_arg_align_ptr (gimple gs)
4515 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4516 return &gs->gimple_omp_task.arg_align;
4520 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4522 static inline void
4523 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4525 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4526 gs->gimple_omp_task.arg_align = arg_align;
4530 /* Return the clauses associated with OMP_SINGLE GS. */
4532 static inline tree
4533 gimple_omp_single_clauses (const_gimple gs)
4535 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4536 return gs->gimple_omp_single.clauses;
4540 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4542 static inline tree *
4543 gimple_omp_single_clauses_ptr (gimple gs)
4545 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4546 return &gs->gimple_omp_single.clauses;
4550 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4552 static inline void
4553 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4555 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4556 gs->gimple_omp_single.clauses = clauses;
4560 /* Return the clauses associated with OMP_SECTIONS GS. */
4562 static inline tree
4563 gimple_omp_sections_clauses (const_gimple gs)
4565 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4566 return gs->gimple_omp_sections.clauses;
4570 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4572 static inline tree *
4573 gimple_omp_sections_clauses_ptr (gimple gs)
4575 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4576 return &gs->gimple_omp_sections.clauses;
4580 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4581 GS. */
4583 static inline void
4584 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4586 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4587 gs->gimple_omp_sections.clauses = clauses;
4591 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4592 in GS. */
4594 static inline tree
4595 gimple_omp_sections_control (const_gimple gs)
4597 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4598 return gs->gimple_omp_sections.control;
4602 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4603 GS. */
4605 static inline tree *
4606 gimple_omp_sections_control_ptr (gimple gs)
4608 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4609 return &gs->gimple_omp_sections.control;
4613 /* Set CONTROL to be the set of clauses associated with the
4614 GIMPLE_OMP_SECTIONS in GS. */
4616 static inline void
4617 gimple_omp_sections_set_control (gimple gs, tree control)
4619 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4620 gs->gimple_omp_sections.control = control;
4624 /* Set COND to be the condition code for OMP_FOR GS. */
4626 static inline void
4627 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4629 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4630 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4631 && i < gs->gimple_omp_for.collapse);
4632 gs->gimple_omp_for.iter[i].cond = cond;
4636 /* Return the condition code associated with OMP_FOR GS. */
4638 static inline enum tree_code
4639 gimple_omp_for_cond (const_gimple gs, size_t i)
4641 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4642 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4643 return gs->gimple_omp_for.iter[i].cond;
4647 /* Set the value being stored in an atomic store. */
4649 static inline void
4650 gimple_omp_atomic_store_set_val (gimple g, tree val)
4652 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4653 g->gimple_omp_atomic_store.val = val;
4657 /* Return the value being stored in an atomic store. */
4659 static inline tree
4660 gimple_omp_atomic_store_val (const_gimple g)
4662 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4663 return g->gimple_omp_atomic_store.val;
4667 /* Return a pointer to the value being stored in an atomic store. */
4669 static inline tree *
4670 gimple_omp_atomic_store_val_ptr (gimple g)
4672 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4673 return &g->gimple_omp_atomic_store.val;
4677 /* Set the LHS of an atomic load. */
4679 static inline void
4680 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4682 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4683 g->gimple_omp_atomic_load.lhs = lhs;
4687 /* Get the LHS of an atomic load. */
4689 static inline tree
4690 gimple_omp_atomic_load_lhs (const_gimple g)
4692 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4693 return g->gimple_omp_atomic_load.lhs;
4697 /* Return a pointer to the LHS of an atomic load. */
4699 static inline tree *
4700 gimple_omp_atomic_load_lhs_ptr (gimple g)
4702 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4703 return &g->gimple_omp_atomic_load.lhs;
4707 /* Set the RHS of an atomic load. */
4709 static inline void
4710 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4712 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4713 g->gimple_omp_atomic_load.rhs = rhs;
4717 /* Get the RHS of an atomic load. */
4719 static inline tree
4720 gimple_omp_atomic_load_rhs (const_gimple g)
4722 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4723 return g->gimple_omp_atomic_load.rhs;
4727 /* Return a pointer to the RHS of an atomic load. */
4729 static inline tree *
4730 gimple_omp_atomic_load_rhs_ptr (gimple g)
4732 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4733 return &g->gimple_omp_atomic_load.rhs;
4737 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4739 static inline tree
4740 gimple_omp_continue_control_def (const_gimple g)
4742 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4743 return g->gimple_omp_continue.control_def;
4746 /* The same as above, but return the address. */
4748 static inline tree *
4749 gimple_omp_continue_control_def_ptr (gimple g)
4751 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4752 return &g->gimple_omp_continue.control_def;
4755 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4757 static inline void
4758 gimple_omp_continue_set_control_def (gimple g, tree def)
4760 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4761 g->gimple_omp_continue.control_def = def;
4765 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4767 static inline tree
4768 gimple_omp_continue_control_use (const_gimple g)
4770 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4771 return g->gimple_omp_continue.control_use;
4775 /* The same as above, but return the address. */
4777 static inline tree *
4778 gimple_omp_continue_control_use_ptr (gimple g)
4780 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4781 return &g->gimple_omp_continue.control_use;
4785 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4787 static inline void
4788 gimple_omp_continue_set_control_use (gimple g, tree use)
4790 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4791 g->gimple_omp_continue.control_use = use;
4794 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4796 static inline gimple_seq *
4797 gimple_transaction_body_ptr (gimple gs)
4799 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4800 return &gs->gimple_transaction.body;
4803 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4805 static inline gimple_seq
4806 gimple_transaction_body (gimple gs)
4808 return *gimple_transaction_body_ptr (gs);
4811 /* Return the label associated with a GIMPLE_TRANSACTION. */
4813 static inline tree
4814 gimple_transaction_label (const_gimple gs)
4816 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4817 return gs->gimple_transaction.label;
4820 static inline tree *
4821 gimple_transaction_label_ptr (gimple gs)
4823 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4824 return &gs->gimple_transaction.label;
4827 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4829 static inline unsigned int
4830 gimple_transaction_subcode (const_gimple gs)
4832 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4833 return gs->gsbase.subcode;
4836 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4838 static inline void
4839 gimple_transaction_set_body (gimple gs, gimple_seq body)
4841 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4842 gs->gimple_transaction.body = body;
4845 /* Set the label associated with a GIMPLE_TRANSACTION. */
4847 static inline void
4848 gimple_transaction_set_label (gimple gs, tree label)
4850 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4851 gs->gimple_transaction.label = label;
4854 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4856 static inline void
4857 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4859 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4860 gs->gsbase.subcode = subcode;
4864 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4866 static inline tree *
4867 gimple_return_retval_ptr (const_gimple gs)
4869 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4870 return gimple_op_ptr (gs, 0);
4873 /* Return the return value for GIMPLE_RETURN GS. */
4875 static inline tree
4876 gimple_return_retval (const_gimple gs)
4878 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4879 return gimple_op (gs, 0);
4883 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4885 static inline void
4886 gimple_return_set_retval (gimple gs, tree retval)
4888 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4889 gimple_set_op (gs, 0, retval);
4893 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4895 #define CASE_GIMPLE_OMP \
4896 case GIMPLE_OMP_PARALLEL: \
4897 case GIMPLE_OMP_TASK: \
4898 case GIMPLE_OMP_FOR: \
4899 case GIMPLE_OMP_SECTIONS: \
4900 case GIMPLE_OMP_SECTIONS_SWITCH: \
4901 case GIMPLE_OMP_SINGLE: \
4902 case GIMPLE_OMP_SECTION: \
4903 case GIMPLE_OMP_MASTER: \
4904 case GIMPLE_OMP_ORDERED: \
4905 case GIMPLE_OMP_CRITICAL: \
4906 case GIMPLE_OMP_RETURN: \
4907 case GIMPLE_OMP_ATOMIC_LOAD: \
4908 case GIMPLE_OMP_ATOMIC_STORE: \
4909 case GIMPLE_OMP_CONTINUE
4911 static inline bool
4912 is_gimple_omp (const_gimple stmt)
4914 switch (gimple_code (stmt))
4916 CASE_GIMPLE_OMP:
4917 return true;
4918 default:
4919 return false;
4924 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4926 static inline bool
4927 gimple_nop_p (const_gimple g)
4929 return gimple_code (g) == GIMPLE_NOP;
4933 /* Return true if GS is a GIMPLE_RESX. */
4935 static inline bool
4936 is_gimple_resx (const_gimple gs)
4938 return gimple_code (gs) == GIMPLE_RESX;
4941 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4943 static inline enum br_predictor
4944 gimple_predict_predictor (gimple gs)
4946 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4947 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4951 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4953 static inline void
4954 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4956 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4957 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4958 | (unsigned) predictor;
4962 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4964 static inline enum prediction
4965 gimple_predict_outcome (gimple gs)
4967 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4968 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4972 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4974 static inline void
4975 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4977 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4978 if (outcome == TAKEN)
4979 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4980 else
4981 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4985 /* Return the type of the main expression computed by STMT. Return
4986 void_type_node if the statement computes nothing. */
4988 static inline tree
4989 gimple_expr_type (const_gimple stmt)
4991 enum gimple_code code = gimple_code (stmt);
4993 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4995 tree type;
4996 /* In general we want to pass out a type that can be substituted
4997 for both the RHS and the LHS types if there is a possibly
4998 useless conversion involved. That means returning the
4999 original RHS type as far as we can reconstruct it. */
5000 if (code == GIMPLE_CALL)
5001 type = gimple_call_return_type (stmt);
5002 else
5003 switch (gimple_assign_rhs_code (stmt))
5005 case POINTER_PLUS_EXPR:
5006 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5007 break;
5009 default:
5010 /* As fallback use the type of the LHS. */
5011 type = TREE_TYPE (gimple_get_lhs (stmt));
5012 break;
5014 return type;
5016 else if (code == GIMPLE_COND)
5017 return boolean_type_node;
5018 else
5019 return void_type_node;
5022 /* Return true if TYPE is a suitable type for a scalar register variable. */
5024 static inline bool
5025 is_gimple_reg_type (tree type)
5027 return !AGGREGATE_TYPE_P (type);
5030 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5032 static inline gimple_stmt_iterator
5033 gsi_start_1 (gimple_seq *seq)
5035 gimple_stmt_iterator i;
5037 i.ptr = gimple_seq_first (*seq);
5038 i.seq = seq;
5039 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5041 return i;
5044 #define gsi_start(x) gsi_start_1(&(x))
5046 static inline gimple_stmt_iterator
5047 gsi_none (void)
5049 gimple_stmt_iterator i;
5050 i.ptr = NULL;
5051 i.seq = NULL;
5052 i.bb = NULL;
5053 return i;
5056 /* Return a new iterator pointing to the first statement in basic block BB. */
5058 static inline gimple_stmt_iterator
5059 gsi_start_bb (basic_block bb)
5061 gimple_stmt_iterator i;
5062 gimple_seq *seq;
5064 seq = bb_seq_addr (bb);
5065 i.ptr = gimple_seq_first (*seq);
5066 i.seq = seq;
5067 i.bb = bb;
5069 return i;
5073 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5075 static inline gimple_stmt_iterator
5076 gsi_last_1 (gimple_seq *seq)
5078 gimple_stmt_iterator i;
5080 i.ptr = gimple_seq_last (*seq);
5081 i.seq = seq;
5082 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5084 return i;
5087 #define gsi_last(x) gsi_last_1(&(x))
5089 /* Return a new iterator pointing to the last statement in basic block BB. */
5091 static inline gimple_stmt_iterator
5092 gsi_last_bb (basic_block bb)
5094 gimple_stmt_iterator i;
5095 gimple_seq *seq;
5097 seq = bb_seq_addr (bb);
5098 i.ptr = gimple_seq_last (*seq);
5099 i.seq = seq;
5100 i.bb = bb;
5102 return i;
5106 /* Return true if I is at the end of its sequence. */
5108 static inline bool
5109 gsi_end_p (gimple_stmt_iterator i)
5111 return i.ptr == NULL;
5115 /* Return true if I is one statement before the end of its sequence. */
5117 static inline bool
5118 gsi_one_before_end_p (gimple_stmt_iterator i)
5120 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5124 /* Advance the iterator to the next gimple statement. */
5126 static inline void
5127 gsi_next (gimple_stmt_iterator *i)
5129 i->ptr = i->ptr->gsbase.next;
5132 /* Advance the iterator to the previous gimple statement. */
5134 static inline void
5135 gsi_prev (gimple_stmt_iterator *i)
5137 gimple prev = i->ptr->gsbase.prev;
5138 if (prev->gsbase.next)
5139 i->ptr = prev;
5140 else
5141 i->ptr = NULL;
5144 /* Return the current stmt. */
5146 static inline gimple
5147 gsi_stmt (gimple_stmt_iterator i)
5149 return i.ptr;
5152 /* Return a block statement iterator that points to the first non-label
5153 statement in block BB. */
5155 static inline gimple_stmt_iterator
5156 gsi_after_labels (basic_block bb)
5158 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5160 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5161 gsi_next (&gsi);
5163 return gsi;
5166 /* Advance the iterator to the next non-debug gimple statement. */
5168 static inline void
5169 gsi_next_nondebug (gimple_stmt_iterator *i)
5173 gsi_next (i);
5175 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5178 /* Advance the iterator to the next non-debug gimple statement. */
5180 static inline void
5181 gsi_prev_nondebug (gimple_stmt_iterator *i)
5185 gsi_prev (i);
5187 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5190 /* Return a new iterator pointing to the first non-debug statement in
5191 basic block BB. */
5193 static inline gimple_stmt_iterator
5194 gsi_start_nondebug_bb (basic_block bb)
5196 gimple_stmt_iterator i = gsi_start_bb (bb);
5198 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5199 gsi_next_nondebug (&i);
5201 return i;
5204 /* Return a new iterator pointing to the last non-debug statement in
5205 basic block BB. */
5207 static inline gimple_stmt_iterator
5208 gsi_last_nondebug_bb (basic_block bb)
5210 gimple_stmt_iterator i = gsi_last_bb (bb);
5212 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5213 gsi_prev_nondebug (&i);
5215 return i;
5219 /* Return the basic block associated with this iterator. */
5221 static inline basic_block
5222 gsi_bb (gimple_stmt_iterator i)
5224 return i.bb;
5228 /* Return the sequence associated with this iterator. */
5230 static inline gimple_seq
5231 gsi_seq (gimple_stmt_iterator i)
5233 return *i.seq;
5237 enum gsi_iterator_update
5239 GSI_NEW_STMT, /* Only valid when single statement is added, move
5240 iterator to it. */
5241 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5242 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5243 for linking other statements in the same
5244 direction. */
5247 /* In gimple-iterator.c */
5248 gimple_stmt_iterator gsi_start_phis (basic_block);
5249 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5250 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5251 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5252 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5253 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5254 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5255 enum gsi_iterator_update);
5256 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5257 enum gsi_iterator_update);
5258 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5259 enum gsi_iterator_update);
5260 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5261 enum gsi_iterator_update);
5262 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5263 enum gsi_iterator_update);
5264 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5265 enum gsi_iterator_update);
5266 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5267 enum gsi_iterator_update);
5268 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5269 enum gsi_iterator_update);
5270 bool gsi_remove (gimple_stmt_iterator *, bool);
5271 gimple_stmt_iterator gsi_for_stmt (gimple);
5272 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5273 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5274 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5275 void gsi_insert_on_edge (edge, gimple);
5276 void gsi_insert_seq_on_edge (edge, gimple_seq);
5277 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5278 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5279 void gsi_commit_one_edge_insert (edge, basic_block *);
5280 void gsi_commit_edge_inserts (void);
5281 gimple gimple_call_copy_skip_args (gimple, bitmap);
5284 /* Convenience routines to walk all statements of a gimple function.
5285 Note that this is useful exclusively before the code is converted
5286 into SSA form. Once the program is in SSA form, the standard
5287 operand interface should be used to analyze/modify statements. */
5288 struct walk_stmt_info
5290 /* Points to the current statement being walked. */
5291 gimple_stmt_iterator gsi;
5293 /* Additional data that the callback functions may want to carry
5294 through the recursion. */
5295 void *info;
5297 /* Pointer map used to mark visited tree nodes when calling
5298 walk_tree on each operand. If set to NULL, duplicate tree nodes
5299 will be visited more than once. */
5300 struct pointer_set_t *pset;
5302 /* Operand returned by the callbacks. This is set when calling
5303 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5304 returns non-NULL, this field will contain the tree returned by
5305 the last callback. */
5306 tree callback_result;
5308 /* Indicates whether the operand being examined may be replaced
5309 with something that matches is_gimple_val (if true) or something
5310 slightly more complicated (if false). "Something" technically
5311 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5312 but we never try to form anything more complicated than that, so
5313 we don't bother checking.
5315 Also note that CALLBACK should update this flag while walking the
5316 sub-expressions of a statement. For instance, when walking the
5317 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5318 to true, however, when walking &var, the operand of that
5319 ADDR_EXPR does not need to be a GIMPLE value. */
5320 BOOL_BITFIELD val_only : 1;
5322 /* True if we are currently walking the LHS of an assignment. */
5323 BOOL_BITFIELD is_lhs : 1;
5325 /* Optional. Set to true by the callback functions if they made any
5326 changes. */
5327 BOOL_BITFIELD changed : 1;
5329 /* True if we're interested in location information. */
5330 BOOL_BITFIELD want_locations : 1;
5332 /* True if we've removed the statement that was processed. */
5333 BOOL_BITFIELD removed_stmt : 1;
5336 /* Callback for walk_gimple_stmt. Called for every statement found
5337 during traversal. The first argument points to the statement to
5338 walk. The second argument is a flag that the callback sets to
5339 'true' if it the callback handled all the operands and
5340 sub-statements of the statement (the default value of this flag is
5341 'false'). The third argument is an anonymous pointer to data
5342 to be used by the callback. */
5343 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5344 struct walk_stmt_info *);
5346 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5347 struct walk_stmt_info *);
5348 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5349 struct walk_stmt_info *);
5350 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5351 struct walk_stmt_info *);
5352 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5354 /* Enum and arrays used for allocation stats. Keep in sync with
5355 gimple.c:gimple_alloc_kind_names. */
5356 enum gimple_alloc_kind
5358 gimple_alloc_kind_assign, /* Assignments. */
5359 gimple_alloc_kind_phi, /* PHI nodes. */
5360 gimple_alloc_kind_cond, /* Conditionals. */
5361 gimple_alloc_kind_rest, /* Everything else. */
5362 gimple_alloc_kind_all
5365 extern int gimple_alloc_counts[];
5366 extern int gimple_alloc_sizes[];
5368 /* Return the allocation kind for a given stmt CODE. */
5369 static inline enum gimple_alloc_kind
5370 gimple_alloc_kind (enum gimple_code code)
5372 switch (code)
5374 case GIMPLE_ASSIGN:
5375 return gimple_alloc_kind_assign;
5376 case GIMPLE_PHI:
5377 return gimple_alloc_kind_phi;
5378 case GIMPLE_COND:
5379 return gimple_alloc_kind_cond;
5380 default:
5381 return gimple_alloc_kind_rest;
5385 extern void dump_gimple_statistics (void);
5387 /* In gimple-fold.c. */
5388 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5389 tree gimple_fold_builtin (gimple);
5390 bool fold_stmt (gimple_stmt_iterator *);
5391 bool fold_stmt_inplace (gimple_stmt_iterator *);
5392 tree get_symbol_constant_value (tree);
5393 tree canonicalize_constructor_val (tree, tree);
5394 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5395 enum tree_code, tree, tree);
5396 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5397 enum tree_code, tree, tree);
5399 bool gimple_val_nonnegative_real_p (tree);
5402 /* Set the location of all statements in SEQ to LOC. */
5404 static inline void
5405 gimple_seq_set_location (gimple_seq seq, location_t loc)
5407 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5408 gimple_set_location (gsi_stmt (i), loc);
5411 #endif /* GCC_GIMPLE_H */