* ChangeLog: Fix whitespace.
[official-gcc.git] / gcc / gimple.h
blob0eb23fc39e893eda890e3b5a78d81783d7f31501
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-ssa-alias.h"
31 #include "internal-fn.h"
32 #include "gimple-fold.h"
33 #include "tree-eh.h"
34 #include "gimple-expr.h"
35 #include "is-a.h"
37 typedef gimple gimple_seq_node;
39 /* For each block, the PHI nodes that need to be rewritten are stored into
40 these vectors. */
41 typedef vec<gimple> gimple_vec;
43 enum gimple_code {
44 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
45 #include "gimple.def"
46 #undef DEFGSCODE
47 LAST_AND_UNUSED_GIMPLE_CODE
50 extern const char *const gimple_code_name[];
51 extern const unsigned char gimple_rhs_class_table[];
53 /* Error out if a gimple tuple is addressed incorrectly. */
54 #if defined ENABLE_GIMPLE_CHECKING
55 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
56 extern void gimple_check_failed (const_gimple, const char *, int, \
57 const char *, enum gimple_code, \
58 enum tree_code) ATTRIBUTE_NORETURN;
60 #define GIMPLE_CHECK(GS, CODE) \
61 do { \
62 const_gimple __gs = (GS); \
63 if (gimple_code (__gs) != (CODE)) \
64 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
65 (CODE), ERROR_MARK); \
66 } while (0)
67 #else /* not ENABLE_GIMPLE_CHECKING */
68 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
69 #define GIMPLE_CHECK(GS, CODE) (void)0
70 #endif
72 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
73 get_gimple_rhs_class. */
74 enum gimple_rhs_class
76 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
77 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
78 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
79 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
80 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
81 name, a _DECL, a _REF, etc. */
84 /* Specific flags for individual GIMPLE statements. These flags are
85 always stored in gimple_statement_base.subcode and they may only be
86 defined for statement codes that do not use subcodes.
88 Values for the masks can overlap as long as the overlapping values
89 are never used in the same statement class.
91 The maximum mask value that can be defined is 1 << 15 (i.e., each
92 statement code can hold up to 16 bitflags).
94 Keep this list sorted. */
95 enum gf_mask {
96 GF_ASM_INPUT = 1 << 0,
97 GF_ASM_VOLATILE = 1 << 1,
98 GF_CALL_FROM_THUNK = 1 << 0,
99 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
100 GF_CALL_TAILCALL = 1 << 2,
101 GF_CALL_VA_ARG_PACK = 1 << 3,
102 GF_CALL_NOTHROW = 1 << 4,
103 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
104 GF_CALL_INTERNAL = 1 << 6,
105 GF_CALL_WITH_BOUNDS = 1 << 7,
106 GF_OMP_PARALLEL_COMBINED = 1 << 0,
107 GF_OMP_FOR_KIND_MASK = 3 << 0,
108 GF_OMP_FOR_KIND_FOR = 0 << 0,
109 GF_OMP_FOR_KIND_DISTRIBUTE = 1 << 0,
110 GF_OMP_FOR_KIND_SIMD = 2 << 0,
111 GF_OMP_FOR_KIND_CILKSIMD = 3 << 0,
112 GF_OMP_FOR_COMBINED = 1 << 2,
113 GF_OMP_FOR_COMBINED_INTO = 1 << 3,
114 GF_OMP_TARGET_KIND_MASK = 3 << 0,
115 GF_OMP_TARGET_KIND_REGION = 0 << 0,
116 GF_OMP_TARGET_KIND_DATA = 1 << 0,
117 GF_OMP_TARGET_KIND_UPDATE = 2 << 0,
119 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
120 a thread synchronization via some sort of barrier. The exact barrier
121 that would otherwise be emitted is dependent on the OMP statement with
122 which this return is associated. */
123 GF_OMP_RETURN_NOWAIT = 1 << 0,
125 GF_OMP_SECTION_LAST = 1 << 0,
126 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
127 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
128 GF_PREDICT_TAKEN = 1 << 15
131 /* Currently, there are only two types of gimple debug stmt. Others are
132 envisioned, for example, to enable the generation of is_stmt notes
133 in line number information, to mark sequence points, etc. This
134 subcode is to be used to tell them apart. */
135 enum gimple_debug_subcode {
136 GIMPLE_DEBUG_BIND = 0,
137 GIMPLE_DEBUG_SOURCE_BIND = 1
140 /* Masks for selecting a pass local flag (PLF) to work on. These
141 masks are used by gimple_set_plf and gimple_plf. */
142 enum plf_mask {
143 GF_PLF_1 = 1 << 0,
144 GF_PLF_2 = 1 << 1
147 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
148 are for 64 bit hosts. */
150 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
151 chain_next ("%h.next"), variable_size))
152 gimple_statement_base
154 /* [ WORD 1 ]
155 Main identifying code for a tuple. */
156 ENUM_BITFIELD(gimple_code) code : 8;
158 /* Nonzero if a warning should not be emitted on this tuple. */
159 unsigned int no_warning : 1;
161 /* Nonzero if this tuple has been visited. Passes are responsible
162 for clearing this bit before using it. */
163 unsigned int visited : 1;
165 /* Nonzero if this tuple represents a non-temporal move. */
166 unsigned int nontemporal_move : 1;
168 /* Pass local flags. These flags are free for any pass to use as
169 they see fit. Passes should not assume that these flags contain
170 any useful value when the pass starts. Any initial state that
171 the pass requires should be set on entry to the pass. See
172 gimple_set_plf and gimple_plf for usage. */
173 unsigned int plf : 2;
175 /* Nonzero if this statement has been modified and needs to have its
176 operands rescanned. */
177 unsigned modified : 1;
179 /* Nonzero if this statement contains volatile operands. */
180 unsigned has_volatile_ops : 1;
182 /* The SUBCODE field can be used for tuple-specific flags for tuples
183 that do not require subcodes. Note that SUBCODE should be at
184 least as wide as tree codes, as several tuples store tree codes
185 in there. */
186 unsigned int subcode : 16;
188 /* UID of this statement. This is used by passes that want to
189 assign IDs to statements. It must be assigned and used by each
190 pass. By default it should be assumed to contain garbage. */
191 unsigned uid;
193 /* [ WORD 2 ]
194 Locus information for debug info. */
195 location_t location;
197 /* Number of operands in this tuple. */
198 unsigned num_ops;
200 /* [ WORD 3 ]
201 Basic block holding this statement. */
202 basic_block bb;
204 /* [ WORD 4-5 ]
205 Linked lists of gimple statements. The next pointers form
206 a NULL terminated list, the prev pointers are a cyclic list.
207 A gimple statement is hence also a double-ended list of
208 statements, with the pointer itself being the first element,
209 and the prev pointer being the last. */
210 gimple next;
211 gimple GTY((skip)) prev;
215 /* Base structure for tuples with operands. */
217 /* This gimple subclass has no tag value. */
218 struct GTY(())
219 gimple_statement_with_ops_base : public gimple_statement_base
221 /* [ WORD 1-6 ] : base class */
223 /* [ WORD 7 ]
224 SSA operand vectors. NOTE: It should be possible to
225 amalgamate these vectors with the operand vector OP. However,
226 the SSA operand vectors are organized differently and contain
227 more information (like immediate use chaining). */
228 struct use_optype_d GTY((skip (""))) *use_ops;
232 /* Statements that take register operands. */
234 struct GTY((tag("GSS_WITH_OPS")))
235 gimple_statement_with_ops : public gimple_statement_with_ops_base
237 /* [ WORD 1-7 ] : base class */
239 /* [ WORD 8 ]
240 Operand vector. NOTE! This must always be the last field
241 of this structure. In particular, this means that this
242 structure cannot be embedded inside another one. */
243 tree GTY((length ("%h.num_ops"))) op[1];
247 /* Base for statements that take both memory and register operands. */
249 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
250 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
252 /* [ WORD 1-7 ] : base class */
254 /* [ WORD 8-9 ]
255 Virtual operands for this statement. The GC will pick them
256 up via the ssa_names array. */
257 tree GTY((skip (""))) vdef;
258 tree GTY((skip (""))) vuse;
262 /* Statements that take both memory and register operands. */
264 struct GTY((tag("GSS_WITH_MEM_OPS")))
265 gimple_statement_with_memory_ops :
266 public gimple_statement_with_memory_ops_base
268 /* [ WORD 1-9 ] : base class */
270 /* [ WORD 10 ]
271 Operand vector. NOTE! This must always be the last field
272 of this structure. In particular, this means that this
273 structure cannot be embedded inside another one. */
274 tree GTY((length ("%h.num_ops"))) op[1];
278 /* Call statements that take both memory and register operands. */
280 struct GTY((tag("GSS_CALL")))
281 gimple_statement_call : public gimple_statement_with_memory_ops_base
283 /* [ WORD 1-9 ] : base class */
285 /* [ WORD 10-13 ] */
286 struct pt_solution call_used;
287 struct pt_solution call_clobbered;
289 /* [ WORD 14 ] */
290 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
291 tree GTY ((tag ("0"))) fntype;
292 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
293 } u;
295 /* [ WORD 15 ]
296 Operand vector. NOTE! This must always be the last field
297 of this structure. In particular, this means that this
298 structure cannot be embedded inside another one. */
299 tree GTY((length ("%h.num_ops"))) op[1];
303 /* OpenMP statements (#pragma omp). */
305 struct GTY((tag("GSS_OMP")))
306 gimple_statement_omp : public gimple_statement_base
308 /* [ WORD 1-6 ] : base class */
310 /* [ WORD 7 ] */
311 gimple_seq body;
315 /* GIMPLE_BIND */
317 struct GTY((tag("GSS_BIND")))
318 gimple_statement_bind : public gimple_statement_base
320 /* [ WORD 1-6 ] : base class */
322 /* [ WORD 7 ]
323 Variables declared in this scope. */
324 tree vars;
326 /* [ WORD 8 ]
327 This is different than the BLOCK field in gimple_statement_base,
328 which is analogous to TREE_BLOCK (i.e., the lexical block holding
329 this statement). This field is the equivalent of BIND_EXPR_BLOCK
330 in tree land (i.e., the lexical scope defined by this bind). See
331 gimple-low.c. */
332 tree block;
334 /* [ WORD 9 ] */
335 gimple_seq body;
339 /* GIMPLE_CATCH */
341 struct GTY((tag("GSS_CATCH")))
342 gimple_statement_catch : public gimple_statement_base
344 /* [ WORD 1-6 ] : base class */
346 /* [ WORD 7 ] */
347 tree types;
349 /* [ WORD 8 ] */
350 gimple_seq handler;
354 /* GIMPLE_EH_FILTER */
356 struct GTY((tag("GSS_EH_FILTER")))
357 gimple_statement_eh_filter : public gimple_statement_base
359 /* [ WORD 1-6 ] : base class */
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((tag("GSS_EH_ELSE")))
373 gimple_statement_eh_else : public gimple_statement_base
375 /* [ WORD 1-6 ] : base class */
377 /* [ WORD 7,8 ] */
378 gimple_seq n_body, e_body;
381 /* GIMPLE_EH_MUST_NOT_THROW */
383 struct GTY((tag("GSS_EH_MNT")))
384 gimple_statement_eh_mnt : public gimple_statement_base
386 /* [ WORD 1-6 ] : base class */
388 /* [ WORD 7 ] Abort function decl. */
389 tree fndecl;
392 /* GIMPLE_PHI */
394 struct GTY((tag("GSS_PHI")))
395 gimple_statement_phi : public gimple_statement_base
397 /* [ WORD 1-6 ] : base class */
399 /* [ WORD 7 ] */
400 unsigned capacity;
401 unsigned nargs;
403 /* [ WORD 8 ] */
404 tree result;
406 /* [ WORD 9 ] */
407 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
411 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
413 struct GTY((tag("GSS_EH_CTRL")))
414 gimple_statement_eh_ctrl : public gimple_statement_base
416 /* [ WORD 1-6 ] : base class */
418 /* [ WORD 7 ]
419 Exception region number. */
420 int region;
424 /* GIMPLE_TRY */
426 struct GTY((tag("GSS_TRY")))
427 gimple_statement_try : public gimple_statement_base
429 /* [ WORD 1-6 ] : base class */
431 /* [ WORD 7 ]
432 Expression to evaluate. */
433 gimple_seq eval;
435 /* [ WORD 8 ]
436 Cleanup expression. */
437 gimple_seq cleanup;
440 /* Kind of GIMPLE_TRY statements. */
441 enum gimple_try_flags
443 /* A try/catch. */
444 GIMPLE_TRY_CATCH = 1 << 0,
446 /* A try/finally. */
447 GIMPLE_TRY_FINALLY = 1 << 1,
448 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
450 /* Analogous to TRY_CATCH_IS_CLEANUP. */
451 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
454 /* GIMPLE_WITH_CLEANUP_EXPR */
456 struct GTY((tag("GSS_WCE")))
457 gimple_statement_wce : public gimple_statement_base
459 /* [ WORD 1-6 ] : base class */
461 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
462 executed if an exception is thrown, not on normal exit of its
463 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
464 in TARGET_EXPRs. */
466 /* [ WORD 7 ]
467 Cleanup expression. */
468 gimple_seq cleanup;
472 /* GIMPLE_ASM */
474 struct GTY((tag("GSS_ASM")))
475 gimple_statement_asm : public gimple_statement_with_memory_ops_base
477 /* [ WORD 1-9 ] : base class */
479 /* [ WORD 10 ]
480 __asm__ statement. */
481 const char *string;
483 /* [ WORD 11 ]
484 Number of inputs, outputs, clobbers, labels. */
485 unsigned char ni;
486 unsigned char no;
487 unsigned char nc;
488 unsigned char nl;
490 /* [ WORD 12 ]
491 Operand vector. NOTE! This must always be the last field
492 of this structure. In particular, this means that this
493 structure cannot be embedded inside another one. */
494 tree GTY((length ("%h.num_ops"))) op[1];
497 /* GIMPLE_OMP_CRITICAL */
499 struct GTY((tag("GSS_OMP_CRITICAL")))
500 gimple_statement_omp_critical : public gimple_statement_omp
502 /* [ WORD 1-7 ] : base class */
504 /* [ WORD 8 ]
505 Critical section name. */
506 tree name;
510 struct GTY(()) gimple_omp_for_iter {
511 /* Condition code. */
512 enum tree_code cond;
514 /* Index variable. */
515 tree index;
517 /* Initial value. */
518 tree initial;
520 /* Final value. */
521 tree final;
523 /* Increment. */
524 tree incr;
527 /* GIMPLE_OMP_FOR */
529 struct GTY((tag("GSS_OMP_FOR")))
530 gimple_statement_omp_for : public gimple_statement_omp
532 /* [ WORD 1-7 ] : base class */
534 /* [ WORD 8 ] */
535 tree clauses;
537 /* [ WORD 9 ]
538 Number of elements in iter array. */
539 size_t collapse;
541 /* [ WORD 10 ] */
542 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
544 /* [ WORD 11 ]
545 Pre-body evaluated before the loop body begins. */
546 gimple_seq pre_body;
550 /* GIMPLE_OMP_PARALLEL */
552 struct GTY((tag("GSS_OMP_PARALLEL")))
553 gimple_statement_omp_parallel : public gimple_statement_omp
555 /* [ WORD 1-7 ] : base class */
557 /* [ WORD 8 ]
558 Clauses. */
559 tree clauses;
561 /* [ WORD 9 ]
562 Child function holding the body of the parallel region. */
563 tree child_fn;
565 /* [ WORD 10 ]
566 Shared data argument. */
567 tree data_arg;
571 /* GIMPLE_OMP_TASK */
573 struct GTY((tag("GSS_OMP_TASK")))
574 gimple_statement_omp_task : public gimple_statement_omp_parallel
576 /* [ WORD 1-10 ] : base class */
578 /* [ WORD 11 ]
579 Child function holding firstprivate initialization if needed. */
580 tree copy_fn;
582 /* [ WORD 12-13 ]
583 Size and alignment in bytes of the argument data block. */
584 tree arg_size;
585 tree arg_align;
589 /* GIMPLE_OMP_SECTION */
590 /* Uses struct gimple_statement_omp. */
593 /* GIMPLE_OMP_SECTIONS */
595 struct GTY((tag("GSS_OMP_SECTIONS")))
596 gimple_statement_omp_sections : public gimple_statement_omp
598 /* [ WORD 1-7 ] : base class */
600 /* [ WORD 8 ] */
601 tree clauses;
603 /* [ WORD 9 ]
604 The control variable used for deciding which of the sections to
605 execute. */
606 tree control;
609 /* GIMPLE_OMP_CONTINUE.
611 Note: This does not inherit from gimple_statement_omp, because we
612 do not need the body field. */
614 struct GTY((tag("GSS_OMP_CONTINUE")))
615 gimple_statement_omp_continue : public gimple_statement_base
617 /* [ WORD 1-6 ] : base class */
619 /* [ WORD 7 ] */
620 tree control_def;
622 /* [ WORD 8 ] */
623 tree control_use;
626 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS */
628 struct GTY((tag("GSS_OMP_SINGLE")))
629 gimple_statement_omp_single : public gimple_statement_omp
631 /* [ WORD 1-7 ] : base class */
633 /* [ WORD 7 ] */
634 tree clauses;
638 /* GIMPLE_OMP_ATOMIC_LOAD.
639 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
640 contains a sequence, which we don't need here. */
642 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
643 gimple_statement_omp_atomic_load : public gimple_statement_base
645 /* [ WORD 1-6 ] : base class */
647 /* [ WORD 7-8 ] */
648 tree rhs, lhs;
651 /* GIMPLE_OMP_ATOMIC_STORE.
652 See note on GIMPLE_OMP_ATOMIC_LOAD. */
654 struct GTY((tag("GSS_OMP_ATOMIC_STORE")))
655 gimple_statement_omp_atomic_store : public gimple_statement_base
657 /* [ WORD 1-6 ] : base class */
659 /* [ WORD 7 ] */
660 tree val;
663 /* GIMPLE_TRANSACTION. */
665 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
667 /* The __transaction_atomic was declared [[outer]] or it is
668 __transaction_relaxed. */
669 #define GTMA_IS_OUTER (1u << 0)
670 #define GTMA_IS_RELAXED (1u << 1)
671 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
673 /* The transaction is seen to not have an abort. */
674 #define GTMA_HAVE_ABORT (1u << 2)
675 /* The transaction is seen to have loads or stores. */
676 #define GTMA_HAVE_LOAD (1u << 3)
677 #define GTMA_HAVE_STORE (1u << 4)
678 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
679 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
680 /* The transaction WILL enter serial irrevocable mode.
681 An irrevocable block post-dominates the entire transaction, such
682 that all invocations of the transaction will go serial-irrevocable.
683 In such case, we don't bother instrumenting the transaction, and
684 tell the runtime that it should begin the transaction in
685 serial-irrevocable mode. */
686 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
687 /* The transaction contains no instrumentation code whatsover, most
688 likely because it is guaranteed to go irrevocable upon entry. */
689 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
691 struct GTY((tag("GSS_TRANSACTION")))
692 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
694 /* [ WORD 1-9 ] : base class */
696 /* [ WORD 10 ] */
697 gimple_seq body;
699 /* [ WORD 11 ] */
700 tree label;
703 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
704 enum gimple_statement_structure_enum {
705 #include "gsstruct.def"
706 LAST_GSS_ENUM
708 #undef DEFGSSTRUCT
710 template <>
711 template <>
712 inline bool
713 is_a_helper <gimple_statement_asm>::test (gimple gs)
715 return gs->code == GIMPLE_ASM;
718 template <>
719 template <>
720 inline bool
721 is_a_helper <gimple_statement_bind>::test (gimple gs)
723 return gs->code == GIMPLE_BIND;
726 template <>
727 template <>
728 inline bool
729 is_a_helper <gimple_statement_call>::test (gimple gs)
731 return gs->code == GIMPLE_CALL;
734 template <>
735 template <>
736 inline bool
737 is_a_helper <gimple_statement_catch>::test (gimple gs)
739 return gs->code == GIMPLE_CATCH;
742 template <>
743 template <>
744 inline bool
745 is_a_helper <gimple_statement_eh_ctrl>::test (gimple gs)
747 return gs->code == GIMPLE_RESX || gs->code == GIMPLE_EH_DISPATCH;
750 template <>
751 template <>
752 inline bool
753 is_a_helper <gimple_statement_eh_else>::test (gimple gs)
755 return gs->code == GIMPLE_EH_ELSE;
758 template <>
759 template <>
760 inline bool
761 is_a_helper <gimple_statement_eh_filter>::test (gimple gs)
763 return gs->code == GIMPLE_EH_FILTER;
766 template <>
767 template <>
768 inline bool
769 is_a_helper <gimple_statement_eh_mnt>::test (gimple gs)
771 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
774 template <>
775 template <>
776 inline bool
777 is_a_helper <gimple_statement_omp_atomic_load>::test (gimple gs)
779 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
782 template <>
783 template <>
784 inline bool
785 is_a_helper <gimple_statement_omp_atomic_store>::test (gimple gs)
787 return gs->code == GIMPLE_OMP_ATOMIC_STORE || gs->code == GIMPLE_OMP_RETURN;
790 template <>
791 template <>
792 inline bool
793 is_a_helper <gimple_statement_omp_continue>::test (gimple gs)
795 return gs->code == GIMPLE_OMP_CONTINUE;
798 template <>
799 template <>
800 inline bool
801 is_a_helper <gimple_statement_omp_critical>::test (gimple gs)
803 return gs->code == GIMPLE_OMP_CRITICAL;
806 template <>
807 template <>
808 inline bool
809 is_a_helper <gimple_statement_omp_for>::test (gimple gs)
811 return gs->code == GIMPLE_OMP_FOR;
814 template <>
815 template <>
816 inline bool
817 is_a_helper <gimple_statement_omp_parallel>::test (gimple gs)
819 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK || gs->code == GIMPLE_OMP_TARGET;
822 template <>
823 template <>
824 inline bool
825 is_a_helper <gimple_statement_omp_sections>::test (gimple gs)
827 return gs->code == GIMPLE_OMP_SECTIONS;
830 template <>
831 template <>
832 inline bool
833 is_a_helper <gimple_statement_omp_single>::test (gimple gs)
835 return gs->code == GIMPLE_OMP_SINGLE || gs->code == GIMPLE_OMP_TEAMS;
838 template <>
839 template <>
840 inline bool
841 is_a_helper <gimple_statement_omp_task>::test (gimple gs)
843 return gs->code == GIMPLE_OMP_TASK;
846 template <>
847 template <>
848 inline bool
849 is_a_helper <gimple_statement_phi>::test (gimple gs)
851 return gs->code == GIMPLE_PHI;
854 template <>
855 template <>
856 inline bool
857 is_a_helper <gimple_statement_transaction>::test (gimple gs)
859 return gs->code == GIMPLE_TRANSACTION;
862 template <>
863 template <>
864 inline bool
865 is_a_helper <gimple_statement_try>::test (gimple gs)
867 return gs->code == GIMPLE_TRY;
870 template <>
871 template <>
872 inline bool
873 is_a_helper <gimple_statement_wce>::test (gimple gs)
875 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
878 template <>
879 template <>
880 inline bool
881 is_a_helper <const gimple_statement_asm>::test (const_gimple gs)
883 return gs->code == GIMPLE_ASM;
886 template <>
887 template <>
888 inline bool
889 is_a_helper <const gimple_statement_bind>::test (const_gimple gs)
891 return gs->code == GIMPLE_BIND;
894 template <>
895 template <>
896 inline bool
897 is_a_helper <const gimple_statement_call>::test (const_gimple gs)
899 return gs->code == GIMPLE_CALL;
902 template <>
903 template <>
904 inline bool
905 is_a_helper <const gimple_statement_catch>::test (const_gimple gs)
907 return gs->code == GIMPLE_CATCH;
910 template <>
911 template <>
912 inline bool
913 is_a_helper <const gimple_statement_eh_ctrl>::test (const_gimple gs)
915 return gs->code == GIMPLE_RESX || gs->code == GIMPLE_EH_DISPATCH;
918 template <>
919 template <>
920 inline bool
921 is_a_helper <const gimple_statement_eh_filter>::test (const_gimple gs)
923 return gs->code == GIMPLE_EH_FILTER;
926 template <>
927 template <>
928 inline bool
929 is_a_helper <const gimple_statement_omp_atomic_load>::test (const_gimple gs)
931 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
934 template <>
935 template <>
936 inline bool
937 is_a_helper <const gimple_statement_omp_atomic_store>::test (const_gimple gs)
939 return gs->code == GIMPLE_OMP_ATOMIC_STORE || gs->code == GIMPLE_OMP_RETURN;
942 template <>
943 template <>
944 inline bool
945 is_a_helper <const gimple_statement_omp_continue>::test (const_gimple gs)
947 return gs->code == GIMPLE_OMP_CONTINUE;
950 template <>
951 template <>
952 inline bool
953 is_a_helper <const gimple_statement_omp_critical>::test (const_gimple gs)
955 return gs->code == GIMPLE_OMP_CRITICAL;
958 template <>
959 template <>
960 inline bool
961 is_a_helper <const gimple_statement_omp_for>::test (const_gimple gs)
963 return gs->code == GIMPLE_OMP_FOR;
966 template <>
967 template <>
968 inline bool
969 is_a_helper <const gimple_statement_omp_parallel>::test (const_gimple gs)
971 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK || gs->code == GIMPLE_OMP_TARGET;
974 template <>
975 template <>
976 inline bool
977 is_a_helper <const gimple_statement_omp_sections>::test (const_gimple gs)
979 return gs->code == GIMPLE_OMP_SECTIONS;
982 template <>
983 template <>
984 inline bool
985 is_a_helper <const gimple_statement_omp_single>::test (const_gimple gs)
987 return gs->code == GIMPLE_OMP_SINGLE || gs->code == GIMPLE_OMP_TEAMS;
990 template <>
991 template <>
992 inline bool
993 is_a_helper <const gimple_statement_omp_task>::test (const_gimple gs)
995 return gs->code == GIMPLE_OMP_TASK;
998 template <>
999 template <>
1000 inline bool
1001 is_a_helper <const gimple_statement_phi>::test (const_gimple gs)
1003 return gs->code == GIMPLE_PHI;
1006 template <>
1007 template <>
1008 inline bool
1009 is_a_helper <const gimple_statement_transaction>::test (const_gimple gs)
1011 return gs->code == GIMPLE_TRANSACTION;
1014 /* Offset in bytes to the location of the operand vector.
1015 Zero if there is no operand vector for this tuple structure. */
1016 extern size_t const gimple_ops_offset_[];
1018 /* Map GIMPLE codes to GSS codes. */
1019 extern enum gimple_statement_structure_enum const gss_for_code_[];
1021 /* This variable holds the currently expanded gimple statement for purposes
1022 of comminucating the profile info to the builtin expanders. */
1023 extern gimple currently_expanding_gimple_stmt;
1025 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1026 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1027 gimple gimple_build_return (tree);
1028 void gimple_call_reset_alias_info (gimple);
1029 gimple gimple_build_call_vec (tree, vec<tree> );
1030 gimple gimple_build_call (tree, unsigned, ...);
1031 gimple gimple_build_call_valist (tree, unsigned, va_list);
1032 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1033 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1034 gimple gimple_build_call_from_tree (tree);
1035 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1036 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1037 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1038 tree, tree, tree CXX_MEM_STAT_INFO);
1039 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1040 tree, tree CXX_MEM_STAT_INFO);
1041 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1042 gimple gimple_build_cond_from_tree (tree, tree, tree);
1043 void gimple_cond_set_condition_from_tree (gimple, tree);
1044 gimple gimple_build_label (tree label);
1045 gimple gimple_build_goto (tree dest);
1046 gimple gimple_build_nop (void);
1047 gimple gimple_build_bind (tree, gimple_seq, tree);
1048 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1049 vec<tree, va_gc> *, vec<tree, va_gc> *,
1050 vec<tree, va_gc> *);
1051 gimple gimple_build_catch (tree, gimple_seq);
1052 gimple gimple_build_eh_filter (tree, gimple_seq);
1053 gimple gimple_build_eh_must_not_throw (tree);
1054 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1055 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1056 enum gimple_try_flags);
1057 gimple gimple_build_wce (gimple_seq);
1058 gimple gimple_build_resx (int);
1059 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1060 gimple gimple_build_switch (tree, tree, vec<tree> );
1061 gimple gimple_build_eh_dispatch (int);
1062 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1063 #define gimple_build_debug_bind(var,val,stmt) \
1064 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1065 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1066 #define gimple_build_debug_source_bind(var,val,stmt) \
1067 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1068 gimple gimple_build_omp_critical (gimple_seq, tree);
1069 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1070 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1071 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1072 gimple gimple_build_omp_section (gimple_seq);
1073 gimple gimple_build_omp_master (gimple_seq);
1074 gimple gimple_build_omp_taskgroup (gimple_seq);
1075 gimple gimple_build_omp_continue (tree, tree);
1076 gimple gimple_build_omp_ordered (gimple_seq);
1077 gimple gimple_build_omp_return (bool);
1078 gimple gimple_build_omp_sections (gimple_seq, tree);
1079 gimple gimple_build_omp_sections_switch (void);
1080 gimple gimple_build_omp_single (gimple_seq, tree);
1081 gimple gimple_build_omp_target (gimple_seq, int, tree);
1082 gimple gimple_build_omp_teams (gimple_seq, tree);
1083 gimple gimple_build_omp_atomic_load (tree, tree);
1084 gimple gimple_build_omp_atomic_store (tree);
1085 gimple gimple_build_transaction (gimple_seq, tree);
1086 gimple gimple_build_predict (enum br_predictor, enum prediction);
1087 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1088 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1089 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1090 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1091 location_t);
1092 extern void annotate_all_with_location (gimple_seq, location_t);
1093 bool empty_body_p (gimple_seq);
1094 gimple_seq gimple_seq_copy (gimple_seq);
1095 bool gimple_call_same_target_p (const_gimple, const_gimple);
1096 int gimple_call_flags (const_gimple);
1097 int gimple_call_arg_flags (const_gimple, unsigned);
1098 int gimple_call_return_flags (const_gimple);
1099 bool gimple_assign_copy_p (gimple);
1100 bool gimple_assign_ssa_name_copy_p (gimple);
1101 bool gimple_assign_unary_nop_p (gimple);
1102 void gimple_set_bb (gimple, basic_block);
1103 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1104 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1105 tree, tree, tree);
1106 tree gimple_get_lhs (const_gimple);
1107 void gimple_set_lhs (gimple, tree);
1108 gimple gimple_copy (gimple);
1109 bool gimple_has_side_effects (const_gimple);
1110 bool gimple_could_trap_p_1 (gimple, bool, bool);
1111 bool gimple_could_trap_p (gimple);
1112 bool gimple_assign_rhs_could_trap_p (gimple);
1113 extern void dump_gimple_statistics (void);
1114 unsigned get_gimple_rhs_num_ops (enum tree_code);
1115 extern void recalculate_side_effects (tree);
1116 extern tree canonicalize_cond_expr_cond (tree);
1117 gimple gimple_call_copy_skip_args (gimple, bitmap);
1118 extern bool gimple_compare_field_offset (tree, tree);
1119 extern tree gimple_unsigned_type (tree);
1120 extern tree gimple_signed_type (tree);
1121 extern alias_set_type gimple_get_alias_set (tree);
1122 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1123 extern bool is_gimple_builtin_call (gimple stmt);
1124 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
1125 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1126 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1127 extern void dump_decl_set (FILE *, bitmap);
1128 extern bool nonfreeing_call_p (gimple);
1129 extern bool infer_nonnull_range (gimple, tree);
1130 extern void sort_case_labels (vec<tree> );
1131 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1132 extern void gimple_seq_set_location (gimple_seq , location_t);
1134 /* Formal (expression) temporary table handling: multiple occurrences of
1135 the same scalar expression are evaluated into the same temporary. */
1137 typedef struct gimple_temp_hash_elt
1139 tree val; /* Key */
1140 tree temp; /* Value */
1141 } elt_t;
1143 /* Get the number of the next statement uid to be allocated. */
1144 static inline unsigned int
1145 gimple_stmt_max_uid (struct function *fn)
1147 return fn->last_stmt_uid;
1150 /* Set the number of the next statement uid to be allocated. */
1151 static inline void
1152 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1154 fn->last_stmt_uid = maxid;
1157 /* Set the number of the next statement uid to be allocated. */
1158 static inline unsigned int
1159 inc_gimple_stmt_max_uid (struct function *fn)
1161 return fn->last_stmt_uid++;
1164 /* Return the first node in GIMPLE sequence S. */
1166 static inline gimple_seq_node
1167 gimple_seq_first (gimple_seq s)
1169 return s;
1173 /* Return the first statement in GIMPLE sequence S. */
1175 static inline gimple
1176 gimple_seq_first_stmt (gimple_seq s)
1178 gimple_seq_node n = gimple_seq_first (s);
1179 return n;
1183 /* Return the last node in GIMPLE sequence S. */
1185 static inline gimple_seq_node
1186 gimple_seq_last (gimple_seq s)
1188 return s ? s->prev : NULL;
1192 /* Return the last statement in GIMPLE sequence S. */
1194 static inline gimple
1195 gimple_seq_last_stmt (gimple_seq s)
1197 gimple_seq_node n = gimple_seq_last (s);
1198 return n;
1202 /* Set the last node in GIMPLE sequence *PS to LAST. */
1204 static inline void
1205 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1207 (*ps)->prev = last;
1211 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1213 static inline void
1214 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1216 *ps = first;
1220 /* Return true if GIMPLE sequence S is empty. */
1222 static inline bool
1223 gimple_seq_empty_p (gimple_seq s)
1225 return s == NULL;
1228 /* Allocate a new sequence and initialize its first element with STMT. */
1230 static inline gimple_seq
1231 gimple_seq_alloc_with_stmt (gimple stmt)
1233 gimple_seq seq = NULL;
1234 gimple_seq_add_stmt (&seq, stmt);
1235 return seq;
1239 /* Returns the sequence of statements in BB. */
1241 static inline gimple_seq
1242 bb_seq (const_basic_block bb)
1244 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1247 static inline gimple_seq *
1248 bb_seq_addr (basic_block bb)
1250 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1253 /* Sets the sequence of statements in BB to SEQ. */
1255 static inline void
1256 set_bb_seq (basic_block bb, gimple_seq seq)
1258 gcc_checking_assert (!(bb->flags & BB_RTL));
1259 bb->il.gimple.seq = seq;
1263 /* Return the code for GIMPLE statement G. */
1265 static inline enum gimple_code
1266 gimple_code (const_gimple g)
1268 return g->code;
1272 /* Return the GSS code used by a GIMPLE code. */
1274 static inline enum gimple_statement_structure_enum
1275 gss_for_code (enum gimple_code code)
1277 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1278 return gss_for_code_[code];
1282 /* Return which GSS code is used by GS. */
1284 static inline enum gimple_statement_structure_enum
1285 gimple_statement_structure (gimple gs)
1287 return gss_for_code (gimple_code (gs));
1291 /* Return true if statement G has sub-statements. This is only true for
1292 High GIMPLE statements. */
1294 static inline bool
1295 gimple_has_substatements (gimple g)
1297 switch (gimple_code (g))
1299 case GIMPLE_BIND:
1300 case GIMPLE_CATCH:
1301 case GIMPLE_EH_FILTER:
1302 case GIMPLE_EH_ELSE:
1303 case GIMPLE_TRY:
1304 case GIMPLE_OMP_FOR:
1305 case GIMPLE_OMP_MASTER:
1306 case GIMPLE_OMP_TASKGROUP:
1307 case GIMPLE_OMP_ORDERED:
1308 case GIMPLE_OMP_SECTION:
1309 case GIMPLE_OMP_PARALLEL:
1310 case GIMPLE_OMP_TASK:
1311 case GIMPLE_OMP_SECTIONS:
1312 case GIMPLE_OMP_SINGLE:
1313 case GIMPLE_OMP_TARGET:
1314 case GIMPLE_OMP_TEAMS:
1315 case GIMPLE_OMP_CRITICAL:
1316 case GIMPLE_WITH_CLEANUP_EXPR:
1317 case GIMPLE_TRANSACTION:
1318 return true;
1320 default:
1321 return false;
1326 /* Return the basic block holding statement G. */
1328 static inline basic_block
1329 gimple_bb (const_gimple g)
1331 return g->bb;
1335 /* Return the lexical scope block holding statement G. */
1337 static inline tree
1338 gimple_block (const_gimple g)
1340 return LOCATION_BLOCK (g->location);
1344 /* Set BLOCK to be the lexical scope block holding statement G. */
1346 static inline void
1347 gimple_set_block (gimple g, tree block)
1349 if (block)
1350 g->location =
1351 COMBINE_LOCATION_DATA (line_table, g->location, block);
1352 else
1353 g->location = LOCATION_LOCUS (g->location);
1357 /* Return location information for statement G. */
1359 static inline location_t
1360 gimple_location (const_gimple g)
1362 return g->location;
1365 /* Return pointer to location information for statement G. */
1367 static inline const location_t *
1368 gimple_location_ptr (const_gimple g)
1370 return &g->location;
1374 /* Set location information for statement G. */
1376 static inline void
1377 gimple_set_location (gimple g, location_t location)
1379 g->location = location;
1383 /* Return true if G contains location information. */
1385 static inline bool
1386 gimple_has_location (const_gimple g)
1388 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1392 /* Return the file name of the location of STMT. */
1394 static inline const char *
1395 gimple_filename (const_gimple stmt)
1397 return LOCATION_FILE (gimple_location (stmt));
1401 /* Return the line number of the location of STMT. */
1403 static inline int
1404 gimple_lineno (const_gimple stmt)
1406 return LOCATION_LINE (gimple_location (stmt));
1410 /* Determine whether SEQ is a singleton. */
1412 static inline bool
1413 gimple_seq_singleton_p (gimple_seq seq)
1415 return ((gimple_seq_first (seq) != NULL)
1416 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1419 /* Return true if no warnings should be emitted for statement STMT. */
1421 static inline bool
1422 gimple_no_warning_p (const_gimple stmt)
1424 return stmt->no_warning;
1427 /* Set the no_warning flag of STMT to NO_WARNING. */
1429 static inline void
1430 gimple_set_no_warning (gimple stmt, bool no_warning)
1432 stmt->no_warning = (unsigned) no_warning;
1435 /* Set the visited status on statement STMT to VISITED_P. */
1437 static inline void
1438 gimple_set_visited (gimple stmt, bool visited_p)
1440 stmt->visited = (unsigned) visited_p;
1444 /* Return the visited status for statement STMT. */
1446 static inline bool
1447 gimple_visited_p (gimple stmt)
1449 return stmt->visited;
1453 /* Set pass local flag PLF on statement STMT to VAL_P. */
1455 static inline void
1456 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1458 if (val_p)
1459 stmt->plf |= (unsigned int) plf;
1460 else
1461 stmt->plf &= ~((unsigned int) plf);
1465 /* Return the value of pass local flag PLF on statement STMT. */
1467 static inline unsigned int
1468 gimple_plf (gimple stmt, enum plf_mask plf)
1470 return stmt->plf & ((unsigned int) plf);
1474 /* Set the UID of statement. */
1476 static inline void
1477 gimple_set_uid (gimple g, unsigned uid)
1479 g->uid = uid;
1483 /* Return the UID of statement. */
1485 static inline unsigned
1486 gimple_uid (const_gimple g)
1488 return g->uid;
1492 /* Make statement G a singleton sequence. */
1494 static inline void
1495 gimple_init_singleton (gimple g)
1497 g->next = NULL;
1498 g->prev = g;
1502 /* Return true if GIMPLE statement G has register or memory operands. */
1504 static inline bool
1505 gimple_has_ops (const_gimple g)
1507 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1510 template <>
1511 template <>
1512 inline bool
1513 is_a_helper <const gimple_statement_with_ops>::test (const_gimple gs)
1515 return gimple_has_ops (gs);
1518 template <>
1519 template <>
1520 inline bool
1521 is_a_helper <gimple_statement_with_ops>::test (gimple gs)
1523 return gimple_has_ops (gs);
1526 /* Return true if GIMPLE statement G has memory operands. */
1528 static inline bool
1529 gimple_has_mem_ops (const_gimple g)
1531 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1534 template <>
1535 template <>
1536 inline bool
1537 is_a_helper <const gimple_statement_with_memory_ops>::test (const_gimple gs)
1539 return gimple_has_mem_ops (gs);
1542 template <>
1543 template <>
1544 inline bool
1545 is_a_helper <gimple_statement_with_memory_ops>::test (gimple gs)
1547 return gimple_has_mem_ops (gs);
1550 /* Return the set of USE operands for statement G. */
1552 static inline struct use_optype_d *
1553 gimple_use_ops (const_gimple g)
1555 const gimple_statement_with_ops *ops_stmt =
1556 dyn_cast <const gimple_statement_with_ops> (g);
1557 if (!ops_stmt)
1558 return NULL;
1559 return ops_stmt->use_ops;
1563 /* Set USE to be the set of USE operands for statement G. */
1565 static inline void
1566 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1568 gimple_statement_with_ops *ops_stmt =
1569 as_a <gimple_statement_with_ops> (g);
1570 ops_stmt->use_ops = use;
1574 /* Return the single VUSE operand of the statement G. */
1576 static inline tree
1577 gimple_vuse (const_gimple g)
1579 const gimple_statement_with_memory_ops *mem_ops_stmt =
1580 dyn_cast <const gimple_statement_with_memory_ops> (g);
1581 if (!mem_ops_stmt)
1582 return NULL_TREE;
1583 return mem_ops_stmt->vuse;
1586 /* Return the single VDEF operand of the statement G. */
1588 static inline tree
1589 gimple_vdef (const_gimple g)
1591 const gimple_statement_with_memory_ops *mem_ops_stmt =
1592 dyn_cast <const gimple_statement_with_memory_ops> (g);
1593 if (!mem_ops_stmt)
1594 return NULL_TREE;
1595 return mem_ops_stmt->vdef;
1598 /* Return the single VUSE operand of the statement G. */
1600 static inline tree *
1601 gimple_vuse_ptr (gimple g)
1603 gimple_statement_with_memory_ops *mem_ops_stmt =
1604 dyn_cast <gimple_statement_with_memory_ops> (g);
1605 if (!mem_ops_stmt)
1606 return NULL;
1607 return &mem_ops_stmt->vuse;
1610 /* Return the single VDEF operand of the statement G. */
1612 static inline tree *
1613 gimple_vdef_ptr (gimple g)
1615 gimple_statement_with_memory_ops *mem_ops_stmt =
1616 dyn_cast <gimple_statement_with_memory_ops> (g);
1617 if (!mem_ops_stmt)
1618 return NULL;
1619 return &mem_ops_stmt->vdef;
1622 /* Set the single VUSE operand of the statement G. */
1624 static inline void
1625 gimple_set_vuse (gimple g, tree vuse)
1627 gimple_statement_with_memory_ops *mem_ops_stmt =
1628 as_a <gimple_statement_with_memory_ops> (g);
1629 mem_ops_stmt->vuse = vuse;
1632 /* Set the single VDEF operand of the statement G. */
1634 static inline void
1635 gimple_set_vdef (gimple g, tree vdef)
1637 gimple_statement_with_memory_ops *mem_ops_stmt =
1638 as_a <gimple_statement_with_memory_ops> (g);
1639 mem_ops_stmt->vdef = vdef;
1643 /* Return true if statement G has operands and the modified field has
1644 been set. */
1646 static inline bool
1647 gimple_modified_p (const_gimple g)
1649 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1653 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1654 a MODIFIED field. */
1656 static inline void
1657 gimple_set_modified (gimple s, bool modifiedp)
1659 if (gimple_has_ops (s))
1660 s->modified = (unsigned) modifiedp;
1664 /* Return the tree code for the expression computed by STMT. This is
1665 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1666 GIMPLE_CALL, return CALL_EXPR as the expression code for
1667 consistency. This is useful when the caller needs to deal with the
1668 three kinds of computation that GIMPLE supports. */
1670 static inline enum tree_code
1671 gimple_expr_code (const_gimple stmt)
1673 enum gimple_code code = gimple_code (stmt);
1674 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1675 return (enum tree_code) stmt->subcode;
1676 else
1678 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1679 return CALL_EXPR;
1684 /* Return true if statement STMT contains volatile operands. */
1686 static inline bool
1687 gimple_has_volatile_ops (const_gimple stmt)
1689 if (gimple_has_mem_ops (stmt))
1690 return stmt->has_volatile_ops;
1691 else
1692 return false;
1696 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1698 static inline void
1699 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1701 if (gimple_has_mem_ops (stmt))
1702 stmt->has_volatile_ops = (unsigned) volatilep;
1705 /* Return true if STMT is in a transaction. */
1707 static inline bool
1708 gimple_in_transaction (gimple stmt)
1710 return bb_in_transaction (gimple_bb (stmt));
1713 /* Return true if statement STMT may access memory. */
1715 static inline bool
1716 gimple_references_memory_p (gimple stmt)
1718 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1722 /* Return the subcode for OMP statement S. */
1724 static inline unsigned
1725 gimple_omp_subcode (const_gimple s)
1727 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1728 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1729 return s->subcode;
1732 /* Set the subcode for OMP statement S to SUBCODE. */
1734 static inline void
1735 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1737 /* We only have 16 bits for the subcode. Assert that we are not
1738 overflowing it. */
1739 gcc_gimple_checking_assert (subcode < (1 << 16));
1740 s->subcode = subcode;
1743 /* Set the nowait flag on OMP_RETURN statement S. */
1745 static inline void
1746 gimple_omp_return_set_nowait (gimple s)
1748 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1749 s->subcode |= GF_OMP_RETURN_NOWAIT;
1753 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1754 flag set. */
1756 static inline bool
1757 gimple_omp_return_nowait_p (const_gimple g)
1759 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1760 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1764 /* Set the LHS of OMP return. */
1766 static inline void
1767 gimple_omp_return_set_lhs (gimple g, tree lhs)
1769 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
1770 as_a <gimple_statement_omp_atomic_store> (g);
1771 omp_atomic_store_stmt->val = lhs;
1775 /* Get the LHS of OMP return. */
1777 static inline tree
1778 gimple_omp_return_lhs (const_gimple g)
1780 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
1781 as_a <const gimple_statement_omp_atomic_store> (g);
1782 return omp_atomic_store_stmt->val;
1786 /* Return a pointer to the LHS of OMP return. */
1788 static inline tree *
1789 gimple_omp_return_lhs_ptr (gimple g)
1791 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
1792 as_a <gimple_statement_omp_atomic_store> (g);
1793 return &omp_atomic_store_stmt->val;
1797 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1798 flag set. */
1800 static inline bool
1801 gimple_omp_section_last_p (const_gimple g)
1803 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1804 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1808 /* Set the GF_OMP_SECTION_LAST flag on G. */
1810 static inline void
1811 gimple_omp_section_set_last (gimple g)
1813 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1814 g->subcode |= GF_OMP_SECTION_LAST;
1818 /* Return true if OMP parallel statement G has the
1819 GF_OMP_PARALLEL_COMBINED flag set. */
1821 static inline bool
1822 gimple_omp_parallel_combined_p (const_gimple g)
1824 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1825 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1829 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1830 value of COMBINED_P. */
1832 static inline void
1833 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1835 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1836 if (combined_p)
1837 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1838 else
1839 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1843 /* Return true if OMP atomic load/store statement G has the
1844 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1846 static inline bool
1847 gimple_omp_atomic_need_value_p (const_gimple g)
1849 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1850 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1851 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1855 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1857 static inline void
1858 gimple_omp_atomic_set_need_value (gimple g)
1860 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1861 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1862 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1866 /* Return true if OMP atomic load/store statement G has the
1867 GF_OMP_ATOMIC_SEQ_CST flag set. */
1869 static inline bool
1870 gimple_omp_atomic_seq_cst_p (const_gimple g)
1872 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1873 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1874 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
1878 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
1880 static inline void
1881 gimple_omp_atomic_set_seq_cst (gimple g)
1883 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1884 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1885 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
1889 /* Return the number of operands for statement GS. */
1891 static inline unsigned
1892 gimple_num_ops (const_gimple gs)
1894 return gs->num_ops;
1898 /* Set the number of operands for statement GS. */
1900 static inline void
1901 gimple_set_num_ops (gimple gs, unsigned num_ops)
1903 gs->num_ops = num_ops;
1907 /* Return the array of operands for statement GS. */
1909 static inline tree *
1910 gimple_ops (gimple gs)
1912 size_t off;
1914 /* All the tuples have their operand vector at the very bottom
1915 of the structure. Note that those structures that do not
1916 have an operand vector have a zero offset. */
1917 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1918 gcc_gimple_checking_assert (off != 0);
1920 return (tree *) ((char *) gs + off);
1924 /* Return operand I for statement GS. */
1926 static inline tree
1927 gimple_op (const_gimple gs, unsigned i)
1929 if (gimple_has_ops (gs))
1931 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1932 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1934 else
1935 return NULL_TREE;
1938 /* Return a pointer to operand I for statement GS. */
1940 static inline tree *
1941 gimple_op_ptr (const_gimple gs, unsigned i)
1943 if (gimple_has_ops (gs))
1945 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1946 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1948 else
1949 return NULL;
1952 /* Set operand I of statement GS to OP. */
1954 static inline void
1955 gimple_set_op (gimple gs, unsigned i, tree op)
1957 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1959 /* Note. It may be tempting to assert that OP matches
1960 is_gimple_operand, but that would be wrong. Different tuples
1961 accept slightly different sets of tree operands. Each caller
1962 should perform its own validation. */
1963 gimple_ops (gs)[i] = op;
1966 /* Return true if GS is a GIMPLE_ASSIGN. */
1968 static inline bool
1969 is_gimple_assign (const_gimple gs)
1971 return gimple_code (gs) == GIMPLE_ASSIGN;
1974 /* Determine if expression CODE is one of the valid expressions that can
1975 be used on the RHS of GIMPLE assignments. */
1977 static inline enum gimple_rhs_class
1978 get_gimple_rhs_class (enum tree_code code)
1980 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1983 /* Return the LHS of assignment statement GS. */
1985 static inline tree
1986 gimple_assign_lhs (const_gimple gs)
1988 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1989 return gimple_op (gs, 0);
1993 /* Return a pointer to the LHS of assignment statement GS. */
1995 static inline tree *
1996 gimple_assign_lhs_ptr (const_gimple gs)
1998 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1999 return gimple_op_ptr (gs, 0);
2003 /* Set LHS to be the LHS operand of assignment statement GS. */
2005 static inline void
2006 gimple_assign_set_lhs (gimple gs, tree lhs)
2008 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2009 gimple_set_op (gs, 0, lhs);
2011 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2012 SSA_NAME_DEF_STMT (lhs) = gs;
2016 /* Return the first operand on the RHS of assignment statement GS. */
2018 static inline tree
2019 gimple_assign_rhs1 (const_gimple gs)
2021 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2022 return gimple_op (gs, 1);
2026 /* Return a pointer to the first operand on the RHS of assignment
2027 statement GS. */
2029 static inline tree *
2030 gimple_assign_rhs1_ptr (const_gimple gs)
2032 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2033 return gimple_op_ptr (gs, 1);
2036 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2038 static inline void
2039 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2041 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2043 gimple_set_op (gs, 1, rhs);
2047 /* Return the second operand on the RHS of assignment statement GS.
2048 If GS does not have two operands, NULL is returned instead. */
2050 static inline tree
2051 gimple_assign_rhs2 (const_gimple gs)
2053 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2055 if (gimple_num_ops (gs) >= 3)
2056 return gimple_op (gs, 2);
2057 else
2058 return NULL_TREE;
2062 /* Return a pointer to the second operand on the RHS of assignment
2063 statement GS. */
2065 static inline tree *
2066 gimple_assign_rhs2_ptr (const_gimple gs)
2068 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2069 return gimple_op_ptr (gs, 2);
2073 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2075 static inline void
2076 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2078 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2080 gimple_set_op (gs, 2, rhs);
2083 /* Return the third operand on the RHS of assignment statement GS.
2084 If GS does not have two operands, NULL is returned instead. */
2086 static inline tree
2087 gimple_assign_rhs3 (const_gimple gs)
2089 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2091 if (gimple_num_ops (gs) >= 4)
2092 return gimple_op (gs, 3);
2093 else
2094 return NULL_TREE;
2097 /* Return a pointer to the third operand on the RHS of assignment
2098 statement GS. */
2100 static inline tree *
2101 gimple_assign_rhs3_ptr (const_gimple gs)
2103 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2104 return gimple_op_ptr (gs, 3);
2108 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2110 static inline void
2111 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2113 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2115 gimple_set_op (gs, 3, rhs);
2118 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2119 to see only a maximum of two operands. */
2121 static inline void
2122 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2123 tree op1, tree op2)
2125 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2128 /* Returns true if GS is a nontemporal move. */
2130 static inline bool
2131 gimple_assign_nontemporal_move_p (const_gimple gs)
2133 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2134 return gs->nontemporal_move;
2137 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2139 static inline void
2140 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2142 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2143 gs->nontemporal_move = nontemporal;
2147 /* Return the code of the expression computed on the rhs of assignment
2148 statement GS. In case that the RHS is a single object, returns the
2149 tree code of the object. */
2151 static inline enum tree_code
2152 gimple_assign_rhs_code (const_gimple gs)
2154 enum tree_code code;
2155 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2157 code = (enum tree_code) gs->subcode;
2158 /* While we initially set subcode to the TREE_CODE of the rhs for
2159 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2160 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2161 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2162 code = TREE_CODE (gimple_assign_rhs1 (gs));
2164 return code;
2168 /* Set CODE to be the code for the expression computed on the RHS of
2169 assignment S. */
2171 static inline void
2172 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2174 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2175 s->subcode = code;
2179 /* Return the gimple rhs class of the code of the expression computed on
2180 the rhs of assignment statement GS.
2181 This will never return GIMPLE_INVALID_RHS. */
2183 static inline enum gimple_rhs_class
2184 gimple_assign_rhs_class (const_gimple gs)
2186 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2189 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2190 there is no operator associated with the assignment itself.
2191 Unlike gimple_assign_copy_p, this predicate returns true for
2192 any RHS operand, including those that perform an operation
2193 and do not have the semantics of a copy, such as COND_EXPR. */
2195 static inline bool
2196 gimple_assign_single_p (gimple gs)
2198 return (is_gimple_assign (gs)
2199 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2202 /* Return true if GS performs a store to its lhs. */
2204 static inline bool
2205 gimple_store_p (gimple gs)
2207 tree lhs = gimple_get_lhs (gs);
2208 return lhs && !is_gimple_reg (lhs);
2211 /* Return true if GS is an assignment that loads from its rhs1. */
2213 static inline bool
2214 gimple_assign_load_p (gimple gs)
2216 tree rhs;
2217 if (!gimple_assign_single_p (gs))
2218 return false;
2219 rhs = gimple_assign_rhs1 (gs);
2220 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2221 return true;
2222 rhs = get_base_address (rhs);
2223 return (DECL_P (rhs)
2224 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2228 /* Return true if S is a type-cast assignment. */
2230 static inline bool
2231 gimple_assign_cast_p (gimple s)
2233 if (is_gimple_assign (s))
2235 enum tree_code sc = gimple_assign_rhs_code (s);
2236 return CONVERT_EXPR_CODE_P (sc)
2237 || sc == VIEW_CONVERT_EXPR
2238 || sc == FIX_TRUNC_EXPR;
2241 return false;
2244 /* Return true if S is a clobber statement. */
2246 static inline bool
2247 gimple_clobber_p (gimple s)
2249 return gimple_assign_single_p (s)
2250 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2253 /* Return true if GS is a GIMPLE_CALL. */
2255 static inline bool
2256 is_gimple_call (const_gimple gs)
2258 return gimple_code (gs) == GIMPLE_CALL;
2261 /* Return the LHS of call statement GS. */
2263 static inline tree
2264 gimple_call_lhs (const_gimple gs)
2266 GIMPLE_CHECK (gs, GIMPLE_CALL);
2267 return gimple_op (gs, 0);
2271 /* Return a pointer to the LHS of call statement GS. */
2273 static inline tree *
2274 gimple_call_lhs_ptr (const_gimple gs)
2276 GIMPLE_CHECK (gs, GIMPLE_CALL);
2277 return gimple_op_ptr (gs, 0);
2281 /* Set LHS to be the LHS operand of call statement GS. */
2283 static inline void
2284 gimple_call_set_lhs (gimple gs, tree lhs)
2286 GIMPLE_CHECK (gs, GIMPLE_CALL);
2287 gimple_set_op (gs, 0, lhs);
2288 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2289 SSA_NAME_DEF_STMT (lhs) = gs;
2293 /* Return true if call GS calls an internal-only function, as enumerated
2294 by internal_fn. */
2296 static inline bool
2297 gimple_call_internal_p (const_gimple gs)
2299 GIMPLE_CHECK (gs, GIMPLE_CALL);
2300 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2304 /* Return true if call GS is marked as instrumented by
2305 Pointer Bounds Checker. */
2307 static inline bool
2308 gimple_call_with_bounds_p (const_gimple gs)
2310 GIMPLE_CHECK (gs, GIMPLE_CALL);
2311 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2315 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2316 Pointer Bounds Checker. */
2318 static inline void
2319 gimple_call_set_with_bounds (gimple gs, bool with_bounds)
2321 GIMPLE_CHECK (gs, GIMPLE_CALL);
2322 if (with_bounds)
2323 gs->subcode |= GF_CALL_WITH_BOUNDS;
2324 else
2325 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2329 /* Return the target of internal call GS. */
2331 static inline enum internal_fn
2332 gimple_call_internal_fn (const_gimple gs)
2334 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2335 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2339 /* Return the function type of the function called by GS. */
2341 static inline tree
2342 gimple_call_fntype (const_gimple gs)
2344 const gimple_statement_call *call_stmt =
2345 as_a <const gimple_statement_call> (gs);
2346 if (gimple_call_internal_p (gs))
2347 return NULL_TREE;
2348 return call_stmt->u.fntype;
2351 /* Set the type of the function called by GS to FNTYPE. */
2353 static inline void
2354 gimple_call_set_fntype (gimple gs, tree fntype)
2356 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2357 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2358 call_stmt->u.fntype = fntype;
2362 /* Return the tree node representing the function called by call
2363 statement GS. */
2365 static inline tree
2366 gimple_call_fn (const_gimple gs)
2368 GIMPLE_CHECK (gs, GIMPLE_CALL);
2369 return gimple_op (gs, 1);
2372 /* Return a pointer to the tree node representing the function called by call
2373 statement GS. */
2375 static inline tree *
2376 gimple_call_fn_ptr (const_gimple gs)
2378 GIMPLE_CHECK (gs, GIMPLE_CALL);
2379 return gimple_op_ptr (gs, 1);
2383 /* Set FN to be the function called by call statement GS. */
2385 static inline void
2386 gimple_call_set_fn (gimple gs, tree fn)
2388 GIMPLE_CHECK (gs, GIMPLE_CALL);
2389 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2390 gimple_set_op (gs, 1, fn);
2394 /* Set FNDECL to be the function called by call statement GS. */
2396 static inline void
2397 gimple_call_set_fndecl (gimple gs, tree decl)
2399 GIMPLE_CHECK (gs, GIMPLE_CALL);
2400 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2401 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2405 /* Set internal function FN to be the function called by call statement GS. */
2407 static inline void
2408 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2410 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2411 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2412 call_stmt->u.internal_fn = fn;
2416 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2417 Otherwise return NULL. This function is analogous to
2418 get_callee_fndecl in tree land. */
2420 static inline tree
2421 gimple_call_fndecl (const_gimple gs)
2423 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2427 /* Return the type returned by call statement GS. */
2429 static inline tree
2430 gimple_call_return_type (const_gimple gs)
2432 tree type = gimple_call_fntype (gs);
2434 if (type == NULL_TREE)
2435 return TREE_TYPE (gimple_call_lhs (gs));
2437 /* The type returned by a function is the type of its
2438 function type. */
2439 return TREE_TYPE (type);
2443 /* Return the static chain for call statement GS. */
2445 static inline tree
2446 gimple_call_chain (const_gimple gs)
2448 GIMPLE_CHECK (gs, GIMPLE_CALL);
2449 return gimple_op (gs, 2);
2453 /* Return a pointer to the static chain for call statement GS. */
2455 static inline tree *
2456 gimple_call_chain_ptr (const_gimple gs)
2458 GIMPLE_CHECK (gs, GIMPLE_CALL);
2459 return gimple_op_ptr (gs, 2);
2462 /* Set CHAIN to be the static chain for call statement GS. */
2464 static inline void
2465 gimple_call_set_chain (gimple gs, tree chain)
2467 GIMPLE_CHECK (gs, GIMPLE_CALL);
2469 gimple_set_op (gs, 2, chain);
2473 /* Return the number of arguments used by call statement GS. */
2475 static inline unsigned
2476 gimple_call_num_args (const_gimple gs)
2478 unsigned num_ops;
2479 GIMPLE_CHECK (gs, GIMPLE_CALL);
2480 num_ops = gimple_num_ops (gs);
2481 return num_ops - 3;
2485 /* Return the argument at position INDEX for call statement GS. */
2487 static inline tree
2488 gimple_call_arg (const_gimple gs, unsigned index)
2490 GIMPLE_CHECK (gs, GIMPLE_CALL);
2491 return gimple_op (gs, index + 3);
2495 /* Return a pointer to the argument at position INDEX for call
2496 statement GS. */
2498 static inline tree *
2499 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2501 GIMPLE_CHECK (gs, GIMPLE_CALL);
2502 return gimple_op_ptr (gs, index + 3);
2506 /* Set ARG to be the argument at position INDEX for call statement GS. */
2508 static inline void
2509 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2511 GIMPLE_CHECK (gs, GIMPLE_CALL);
2512 gimple_set_op (gs, index + 3, arg);
2516 /* If TAIL_P is true, mark call statement S as being a tail call
2517 (i.e., a call just before the exit of a function). These calls are
2518 candidate for tail call optimization. */
2520 static inline void
2521 gimple_call_set_tail (gimple s, bool tail_p)
2523 GIMPLE_CHECK (s, GIMPLE_CALL);
2524 if (tail_p)
2525 s->subcode |= GF_CALL_TAILCALL;
2526 else
2527 s->subcode &= ~GF_CALL_TAILCALL;
2531 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2533 static inline bool
2534 gimple_call_tail_p (gimple s)
2536 GIMPLE_CHECK (s, GIMPLE_CALL);
2537 return (s->subcode & GF_CALL_TAILCALL) != 0;
2541 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2542 slot optimization. This transformation uses the target of the call
2543 expansion as the return slot for calls that return in memory. */
2545 static inline void
2546 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2548 GIMPLE_CHECK (s, GIMPLE_CALL);
2549 if (return_slot_opt_p)
2550 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2551 else
2552 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2556 /* Return true if S is marked for return slot optimization. */
2558 static inline bool
2559 gimple_call_return_slot_opt_p (gimple s)
2561 GIMPLE_CHECK (s, GIMPLE_CALL);
2562 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2566 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2567 thunk to the thunked-to function. */
2569 static inline void
2570 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2572 GIMPLE_CHECK (s, GIMPLE_CALL);
2573 if (from_thunk_p)
2574 s->subcode |= GF_CALL_FROM_THUNK;
2575 else
2576 s->subcode &= ~GF_CALL_FROM_THUNK;
2580 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2582 static inline bool
2583 gimple_call_from_thunk_p (gimple s)
2585 GIMPLE_CHECK (s, GIMPLE_CALL);
2586 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2590 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2591 argument pack in its argument list. */
2593 static inline void
2594 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2596 GIMPLE_CHECK (s, GIMPLE_CALL);
2597 if (pass_arg_pack_p)
2598 s->subcode |= GF_CALL_VA_ARG_PACK;
2599 else
2600 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2604 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2605 argument pack in its argument list. */
2607 static inline bool
2608 gimple_call_va_arg_pack_p (gimple s)
2610 GIMPLE_CHECK (s, GIMPLE_CALL);
2611 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2615 /* Return true if S is a noreturn call. */
2617 static inline bool
2618 gimple_call_noreturn_p (gimple s)
2620 GIMPLE_CHECK (s, GIMPLE_CALL);
2621 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2625 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2626 even if the called function can throw in other cases. */
2628 static inline void
2629 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2631 GIMPLE_CHECK (s, GIMPLE_CALL);
2632 if (nothrow_p)
2633 s->subcode |= GF_CALL_NOTHROW;
2634 else
2635 s->subcode &= ~GF_CALL_NOTHROW;
2638 /* Return true if S is a nothrow call. */
2640 static inline bool
2641 gimple_call_nothrow_p (gimple s)
2643 GIMPLE_CHECK (s, GIMPLE_CALL);
2644 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2647 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2648 is known to be emitted for VLA objects. Those are wrapped by
2649 stack_save/stack_restore calls and hence can't lead to unbounded
2650 stack growth even when they occur in loops. */
2652 static inline void
2653 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2655 GIMPLE_CHECK (s, GIMPLE_CALL);
2656 if (for_var)
2657 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2658 else
2659 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2662 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2664 static inline bool
2665 gimple_call_alloca_for_var_p (gimple s)
2667 GIMPLE_CHECK (s, GIMPLE_CALL);
2668 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2671 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2673 static inline void
2674 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2676 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2677 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2678 dest_call->subcode = orig_call->subcode;
2682 /* Return a pointer to the points-to solution for the set of call-used
2683 variables of the call CALL. */
2685 static inline struct pt_solution *
2686 gimple_call_use_set (gimple call)
2688 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2689 return &call_stmt->call_used;
2693 /* Return a pointer to the points-to solution for the set of call-used
2694 variables of the call CALL. */
2696 static inline struct pt_solution *
2697 gimple_call_clobber_set (gimple call)
2699 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2700 return &call_stmt->call_clobbered;
2704 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2705 non-NULL lhs. */
2707 static inline bool
2708 gimple_has_lhs (gimple stmt)
2710 return (is_gimple_assign (stmt)
2711 || (is_gimple_call (stmt)
2712 && gimple_call_lhs (stmt) != NULL_TREE));
2716 /* Return the code of the predicate computed by conditional statement GS. */
2718 static inline enum tree_code
2719 gimple_cond_code (const_gimple gs)
2721 GIMPLE_CHECK (gs, GIMPLE_COND);
2722 return (enum tree_code) gs->subcode;
2726 /* Set CODE to be the predicate code for the conditional statement GS. */
2728 static inline void
2729 gimple_cond_set_code (gimple gs, enum tree_code code)
2731 GIMPLE_CHECK (gs, GIMPLE_COND);
2732 gs->subcode = code;
2736 /* Return the LHS of the predicate computed by conditional statement GS. */
2738 static inline tree
2739 gimple_cond_lhs (const_gimple gs)
2741 GIMPLE_CHECK (gs, GIMPLE_COND);
2742 return gimple_op (gs, 0);
2745 /* Return the pointer to the LHS of the predicate computed by conditional
2746 statement GS. */
2748 static inline tree *
2749 gimple_cond_lhs_ptr (const_gimple gs)
2751 GIMPLE_CHECK (gs, GIMPLE_COND);
2752 return gimple_op_ptr (gs, 0);
2755 /* Set LHS to be the LHS operand of the predicate computed by
2756 conditional statement GS. */
2758 static inline void
2759 gimple_cond_set_lhs (gimple gs, tree lhs)
2761 GIMPLE_CHECK (gs, GIMPLE_COND);
2762 gimple_set_op (gs, 0, lhs);
2766 /* Return the RHS operand of the predicate computed by conditional GS. */
2768 static inline tree
2769 gimple_cond_rhs (const_gimple gs)
2771 GIMPLE_CHECK (gs, GIMPLE_COND);
2772 return gimple_op (gs, 1);
2775 /* Return the pointer to the RHS operand of the predicate computed by
2776 conditional GS. */
2778 static inline tree *
2779 gimple_cond_rhs_ptr (const_gimple gs)
2781 GIMPLE_CHECK (gs, GIMPLE_COND);
2782 return gimple_op_ptr (gs, 1);
2786 /* Set RHS to be the RHS operand of the predicate computed by
2787 conditional statement GS. */
2789 static inline void
2790 gimple_cond_set_rhs (gimple gs, tree rhs)
2792 GIMPLE_CHECK (gs, GIMPLE_COND);
2793 gimple_set_op (gs, 1, rhs);
2797 /* Return the label used by conditional statement GS when its
2798 predicate evaluates to true. */
2800 static inline tree
2801 gimple_cond_true_label (const_gimple gs)
2803 GIMPLE_CHECK (gs, GIMPLE_COND);
2804 return gimple_op (gs, 2);
2808 /* Set LABEL to be the label used by conditional statement GS when its
2809 predicate evaluates to true. */
2811 static inline void
2812 gimple_cond_set_true_label (gimple gs, tree label)
2814 GIMPLE_CHECK (gs, GIMPLE_COND);
2815 gimple_set_op (gs, 2, label);
2819 /* Set LABEL to be the label used by conditional statement GS when its
2820 predicate evaluates to false. */
2822 static inline void
2823 gimple_cond_set_false_label (gimple gs, tree label)
2825 GIMPLE_CHECK (gs, GIMPLE_COND);
2826 gimple_set_op (gs, 3, label);
2830 /* Return the label used by conditional statement GS when its
2831 predicate evaluates to false. */
2833 static inline tree
2834 gimple_cond_false_label (const_gimple gs)
2836 GIMPLE_CHECK (gs, GIMPLE_COND);
2837 return gimple_op (gs, 3);
2841 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2843 static inline void
2844 gimple_cond_make_false (gimple gs)
2846 gimple_cond_set_lhs (gs, boolean_true_node);
2847 gimple_cond_set_rhs (gs, boolean_false_node);
2848 gs->subcode = EQ_EXPR;
2852 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2854 static inline void
2855 gimple_cond_make_true (gimple gs)
2857 gimple_cond_set_lhs (gs, boolean_true_node);
2858 gimple_cond_set_rhs (gs, boolean_true_node);
2859 gs->subcode = EQ_EXPR;
2862 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2863 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2865 static inline bool
2866 gimple_cond_true_p (const_gimple gs)
2868 tree lhs = gimple_cond_lhs (gs);
2869 tree rhs = gimple_cond_rhs (gs);
2870 enum tree_code code = gimple_cond_code (gs);
2872 if (lhs != boolean_true_node && lhs != boolean_false_node)
2873 return false;
2875 if (rhs != boolean_true_node && rhs != boolean_false_node)
2876 return false;
2878 if (code == NE_EXPR && lhs != rhs)
2879 return true;
2881 if (code == EQ_EXPR && lhs == rhs)
2882 return true;
2884 return false;
2887 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2888 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2890 static inline bool
2891 gimple_cond_false_p (const_gimple gs)
2893 tree lhs = gimple_cond_lhs (gs);
2894 tree rhs = gimple_cond_rhs (gs);
2895 enum tree_code code = gimple_cond_code (gs);
2897 if (lhs != boolean_true_node && lhs != boolean_false_node)
2898 return false;
2900 if (rhs != boolean_true_node && rhs != boolean_false_node)
2901 return false;
2903 if (code == NE_EXPR && lhs == rhs)
2904 return true;
2906 if (code == EQ_EXPR && lhs != rhs)
2907 return true;
2909 return false;
2912 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2914 static inline void
2915 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2917 gimple_cond_set_code (stmt, code);
2918 gimple_cond_set_lhs (stmt, lhs);
2919 gimple_cond_set_rhs (stmt, rhs);
2922 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2924 static inline tree
2925 gimple_label_label (const_gimple gs)
2927 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2928 return gimple_op (gs, 0);
2932 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2933 GS. */
2935 static inline void
2936 gimple_label_set_label (gimple gs, tree label)
2938 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2939 gimple_set_op (gs, 0, label);
2943 /* Return the destination of the unconditional jump GS. */
2945 static inline tree
2946 gimple_goto_dest (const_gimple gs)
2948 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2949 return gimple_op (gs, 0);
2953 /* Set DEST to be the destination of the unconditonal jump GS. */
2955 static inline void
2956 gimple_goto_set_dest (gimple gs, tree dest)
2958 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2959 gimple_set_op (gs, 0, dest);
2963 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2965 static inline tree
2966 gimple_bind_vars (const_gimple gs)
2968 const gimple_statement_bind *bind_stmt =
2969 as_a <const gimple_statement_bind> (gs);
2970 return bind_stmt->vars;
2974 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2975 statement GS. */
2977 static inline void
2978 gimple_bind_set_vars (gimple gs, tree vars)
2980 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
2981 bind_stmt->vars = vars;
2985 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2986 statement GS. */
2988 static inline void
2989 gimple_bind_append_vars (gimple gs, tree vars)
2991 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
2992 bind_stmt->vars = chainon (bind_stmt->vars, vars);
2996 static inline gimple_seq *
2997 gimple_bind_body_ptr (gimple gs)
2999 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3000 return &bind_stmt->body;
3003 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3005 static inline gimple_seq
3006 gimple_bind_body (gimple gs)
3008 return *gimple_bind_body_ptr (gs);
3012 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3013 statement GS. */
3015 static inline void
3016 gimple_bind_set_body (gimple gs, gimple_seq seq)
3018 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3019 bind_stmt->body = seq;
3023 /* Append a statement to the end of a GIMPLE_BIND's body. */
3025 static inline void
3026 gimple_bind_add_stmt (gimple gs, gimple stmt)
3028 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3029 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3033 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3035 static inline void
3036 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3038 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3039 gimple_seq_add_seq (&bind_stmt->body, seq);
3043 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3044 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3046 static inline tree
3047 gimple_bind_block (const_gimple gs)
3049 const gimple_statement_bind *bind_stmt =
3050 as_a <const gimple_statement_bind> (gs);
3051 return bind_stmt->block;
3055 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3056 statement GS. */
3058 static inline void
3059 gimple_bind_set_block (gimple gs, tree block)
3061 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3062 gcc_gimple_checking_assert (block == NULL_TREE
3063 || TREE_CODE (block) == BLOCK);
3064 bind_stmt->block = block;
3068 /* Return the number of input operands for GIMPLE_ASM GS. */
3070 static inline unsigned
3071 gimple_asm_ninputs (const_gimple gs)
3073 const gimple_statement_asm *asm_stmt =
3074 as_a <const gimple_statement_asm> (gs);
3075 return asm_stmt->ni;
3079 /* Return the number of output operands for GIMPLE_ASM GS. */
3081 static inline unsigned
3082 gimple_asm_noutputs (const_gimple gs)
3084 const gimple_statement_asm *asm_stmt =
3085 as_a <const gimple_statement_asm> (gs);
3086 return asm_stmt->no;
3090 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3092 static inline unsigned
3093 gimple_asm_nclobbers (const_gimple gs)
3095 const gimple_statement_asm *asm_stmt =
3096 as_a <const gimple_statement_asm> (gs);
3097 return asm_stmt->nc;
3100 /* Return the number of label operands for GIMPLE_ASM GS. */
3102 static inline unsigned
3103 gimple_asm_nlabels (const_gimple gs)
3105 const gimple_statement_asm *asm_stmt =
3106 as_a <const gimple_statement_asm> (gs);
3107 return asm_stmt->nl;
3110 /* Return input operand INDEX of GIMPLE_ASM GS. */
3112 static inline tree
3113 gimple_asm_input_op (const_gimple gs, unsigned index)
3115 const gimple_statement_asm *asm_stmt =
3116 as_a <const gimple_statement_asm> (gs);
3117 gcc_gimple_checking_assert (index < asm_stmt->ni);
3118 return gimple_op (gs, index + asm_stmt->no);
3121 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3123 static inline tree *
3124 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3126 const gimple_statement_asm *asm_stmt =
3127 as_a <const gimple_statement_asm> (gs);
3128 gcc_gimple_checking_assert (index < asm_stmt->ni);
3129 return gimple_op_ptr (gs, index + asm_stmt->no);
3133 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3135 static inline void
3136 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3138 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3139 gcc_gimple_checking_assert (index < asm_stmt->ni
3140 && TREE_CODE (in_op) == TREE_LIST);
3141 gimple_set_op (gs, index + asm_stmt->no, in_op);
3145 /* Return output operand INDEX of GIMPLE_ASM GS. */
3147 static inline tree
3148 gimple_asm_output_op (const_gimple gs, unsigned index)
3150 const gimple_statement_asm *asm_stmt =
3151 as_a <const gimple_statement_asm> (gs);
3152 gcc_gimple_checking_assert (index < asm_stmt->no);
3153 return gimple_op (gs, index);
3156 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3158 static inline tree *
3159 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3161 const gimple_statement_asm *asm_stmt =
3162 as_a <const gimple_statement_asm> (gs);
3163 gcc_gimple_checking_assert (index < asm_stmt->no);
3164 return gimple_op_ptr (gs, index);
3168 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3170 static inline void
3171 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3173 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3174 gcc_gimple_checking_assert (index < asm_stmt->no
3175 && TREE_CODE (out_op) == TREE_LIST);
3176 gimple_set_op (gs, index, out_op);
3180 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3182 static inline tree
3183 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3185 const gimple_statement_asm *asm_stmt =
3186 as_a <const gimple_statement_asm> (gs);
3187 gcc_gimple_checking_assert (index < asm_stmt->nc);
3188 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3192 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3194 static inline void
3195 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3197 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3198 gcc_gimple_checking_assert (index < asm_stmt->nc
3199 && TREE_CODE (clobber_op) == TREE_LIST);
3200 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3203 /* Return label operand INDEX of GIMPLE_ASM GS. */
3205 static inline tree
3206 gimple_asm_label_op (const_gimple gs, unsigned index)
3208 const gimple_statement_asm *asm_stmt =
3209 as_a <const gimple_statement_asm> (gs);
3210 gcc_gimple_checking_assert (index < asm_stmt->nl);
3211 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3214 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3216 static inline void
3217 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3219 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3220 gcc_gimple_checking_assert (index < asm_stmt->nl
3221 && TREE_CODE (label_op) == TREE_LIST);
3222 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3225 /* Return the string representing the assembly instruction in
3226 GIMPLE_ASM GS. */
3228 static inline const char *
3229 gimple_asm_string (const_gimple gs)
3231 const gimple_statement_asm *asm_stmt =
3232 as_a <const gimple_statement_asm> (gs);
3233 return asm_stmt->string;
3237 /* Return true if GS is an asm statement marked volatile. */
3239 static inline bool
3240 gimple_asm_volatile_p (const_gimple gs)
3242 GIMPLE_CHECK (gs, GIMPLE_ASM);
3243 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3247 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3249 static inline void
3250 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3252 GIMPLE_CHECK (gs, GIMPLE_ASM);
3253 if (volatile_p)
3254 gs->subcode |= GF_ASM_VOLATILE;
3255 else
3256 gs->subcode &= ~GF_ASM_VOLATILE;
3260 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3262 static inline void
3263 gimple_asm_set_input (gimple gs, bool input_p)
3265 GIMPLE_CHECK (gs, GIMPLE_ASM);
3266 if (input_p)
3267 gs->subcode |= GF_ASM_INPUT;
3268 else
3269 gs->subcode &= ~GF_ASM_INPUT;
3273 /* Return true if asm GS is an ASM_INPUT. */
3275 static inline bool
3276 gimple_asm_input_p (const_gimple gs)
3278 GIMPLE_CHECK (gs, GIMPLE_ASM);
3279 return (gs->subcode & GF_ASM_INPUT) != 0;
3283 /* Return the types handled by GIMPLE_CATCH statement GS. */
3285 static inline tree
3286 gimple_catch_types (const_gimple gs)
3288 const gimple_statement_catch *catch_stmt =
3289 as_a <const gimple_statement_catch> (gs);
3290 return catch_stmt->types;
3294 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3296 static inline tree *
3297 gimple_catch_types_ptr (gimple gs)
3299 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3300 return &catch_stmt->types;
3304 /* Return a pointer to the GIMPLE sequence representing the body of
3305 the handler of GIMPLE_CATCH statement GS. */
3307 static inline gimple_seq *
3308 gimple_catch_handler_ptr (gimple gs)
3310 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3311 return &catch_stmt->handler;
3315 /* Return the GIMPLE sequence representing the body of the handler of
3316 GIMPLE_CATCH statement GS. */
3318 static inline gimple_seq
3319 gimple_catch_handler (gimple gs)
3321 return *gimple_catch_handler_ptr (gs);
3325 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3327 static inline void
3328 gimple_catch_set_types (gimple gs, tree t)
3330 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3331 catch_stmt->types = t;
3335 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3337 static inline void
3338 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3340 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3341 catch_stmt->handler = handler;
3345 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3347 static inline tree
3348 gimple_eh_filter_types (const_gimple gs)
3350 const gimple_statement_eh_filter *eh_filter_stmt =
3351 as_a <const gimple_statement_eh_filter> (gs);
3352 return eh_filter_stmt->types;
3356 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3357 GS. */
3359 static inline tree *
3360 gimple_eh_filter_types_ptr (gimple gs)
3362 gimple_statement_eh_filter *eh_filter_stmt =
3363 as_a <gimple_statement_eh_filter> (gs);
3364 return &eh_filter_stmt->types;
3368 /* Return a pointer to the sequence of statement to execute when
3369 GIMPLE_EH_FILTER statement fails. */
3371 static inline gimple_seq *
3372 gimple_eh_filter_failure_ptr (gimple gs)
3374 gimple_statement_eh_filter *eh_filter_stmt =
3375 as_a <gimple_statement_eh_filter> (gs);
3376 return &eh_filter_stmt->failure;
3380 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3381 statement fails. */
3383 static inline gimple_seq
3384 gimple_eh_filter_failure (gimple gs)
3386 return *gimple_eh_filter_failure_ptr (gs);
3390 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3392 static inline void
3393 gimple_eh_filter_set_types (gimple gs, tree types)
3395 gimple_statement_eh_filter *eh_filter_stmt =
3396 as_a <gimple_statement_eh_filter> (gs);
3397 eh_filter_stmt->types = types;
3401 /* Set FAILURE to be the sequence of statements to execute on failure
3402 for GIMPLE_EH_FILTER GS. */
3404 static inline void
3405 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3407 gimple_statement_eh_filter *eh_filter_stmt =
3408 as_a <gimple_statement_eh_filter> (gs);
3409 eh_filter_stmt->failure = failure;
3412 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3414 static inline tree
3415 gimple_eh_must_not_throw_fndecl (gimple gs)
3417 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3418 return eh_mnt_stmt->fndecl;
3421 /* Set the function decl to be called by GS to DECL. */
3423 static inline void
3424 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3426 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3427 eh_mnt_stmt->fndecl = decl;
3430 /* GIMPLE_EH_ELSE accessors. */
3432 static inline gimple_seq *
3433 gimple_eh_else_n_body_ptr (gimple gs)
3435 gimple_statement_eh_else *eh_else_stmt =
3436 as_a <gimple_statement_eh_else> (gs);
3437 return &eh_else_stmt->n_body;
3440 static inline gimple_seq
3441 gimple_eh_else_n_body (gimple gs)
3443 return *gimple_eh_else_n_body_ptr (gs);
3446 static inline gimple_seq *
3447 gimple_eh_else_e_body_ptr (gimple gs)
3449 gimple_statement_eh_else *eh_else_stmt =
3450 as_a <gimple_statement_eh_else> (gs);
3451 return &eh_else_stmt->e_body;
3454 static inline gimple_seq
3455 gimple_eh_else_e_body (gimple gs)
3457 return *gimple_eh_else_e_body_ptr (gs);
3460 static inline void
3461 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3463 gimple_statement_eh_else *eh_else_stmt =
3464 as_a <gimple_statement_eh_else> (gs);
3465 eh_else_stmt->n_body = seq;
3468 static inline void
3469 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3471 gimple_statement_eh_else *eh_else_stmt =
3472 as_a <gimple_statement_eh_else> (gs);
3473 eh_else_stmt->e_body = seq;
3476 /* GIMPLE_TRY accessors. */
3478 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3479 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3481 static inline enum gimple_try_flags
3482 gimple_try_kind (const_gimple gs)
3484 GIMPLE_CHECK (gs, GIMPLE_TRY);
3485 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3489 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3491 static inline void
3492 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3494 GIMPLE_CHECK (gs, GIMPLE_TRY);
3495 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3496 || kind == GIMPLE_TRY_FINALLY);
3497 if (gimple_try_kind (gs) != kind)
3498 gs->subcode = (unsigned int) kind;
3502 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3504 static inline bool
3505 gimple_try_catch_is_cleanup (const_gimple gs)
3507 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3508 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3512 /* Return a pointer to the sequence of statements used as the
3513 body for GIMPLE_TRY GS. */
3515 static inline gimple_seq *
3516 gimple_try_eval_ptr (gimple gs)
3518 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3519 return &try_stmt->eval;
3523 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3525 static inline gimple_seq
3526 gimple_try_eval (gimple gs)
3528 return *gimple_try_eval_ptr (gs);
3532 /* Return a pointer to the sequence of statements used as the cleanup body for
3533 GIMPLE_TRY GS. */
3535 static inline gimple_seq *
3536 gimple_try_cleanup_ptr (gimple gs)
3538 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3539 return &try_stmt->cleanup;
3543 /* Return the sequence of statements used as the cleanup body for
3544 GIMPLE_TRY GS. */
3546 static inline gimple_seq
3547 gimple_try_cleanup (gimple gs)
3549 return *gimple_try_cleanup_ptr (gs);
3553 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3555 static inline void
3556 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3558 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3559 if (catch_is_cleanup)
3560 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3561 else
3562 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3566 /* Set EVAL to be the sequence of statements to use as the body for
3567 GIMPLE_TRY GS. */
3569 static inline void
3570 gimple_try_set_eval (gimple gs, gimple_seq eval)
3572 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3573 try_stmt->eval = eval;
3577 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3578 body for GIMPLE_TRY GS. */
3580 static inline void
3581 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3583 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3584 try_stmt->cleanup = cleanup;
3588 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3590 static inline gimple_seq *
3591 gimple_wce_cleanup_ptr (gimple gs)
3593 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3594 return &wce_stmt->cleanup;
3598 /* Return the cleanup sequence for cleanup statement GS. */
3600 static inline gimple_seq
3601 gimple_wce_cleanup (gimple gs)
3603 return *gimple_wce_cleanup_ptr (gs);
3607 /* Set CLEANUP to be the cleanup sequence for GS. */
3609 static inline void
3610 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3612 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3613 wce_stmt->cleanup = cleanup;
3617 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3619 static inline bool
3620 gimple_wce_cleanup_eh_only (const_gimple gs)
3622 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3623 return gs->subcode != 0;
3627 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3629 static inline void
3630 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3632 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3633 gs->subcode = (unsigned int) eh_only_p;
3637 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3639 static inline unsigned
3640 gimple_phi_capacity (const_gimple gs)
3642 const gimple_statement_phi *phi_stmt =
3643 as_a <const gimple_statement_phi> (gs);
3644 return phi_stmt->capacity;
3648 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3649 be exactly the number of incoming edges for the basic block holding
3650 GS. */
3652 static inline unsigned
3653 gimple_phi_num_args (const_gimple gs)
3655 const gimple_statement_phi *phi_stmt =
3656 as_a <const gimple_statement_phi> (gs);
3657 return phi_stmt->nargs;
3661 /* Return the SSA name created by GIMPLE_PHI GS. */
3663 static inline tree
3664 gimple_phi_result (const_gimple gs)
3666 const gimple_statement_phi *phi_stmt =
3667 as_a <const gimple_statement_phi> (gs);
3668 return phi_stmt->result;
3671 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3673 static inline tree *
3674 gimple_phi_result_ptr (gimple gs)
3676 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3677 return &phi_stmt->result;
3680 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3682 static inline void
3683 gimple_phi_set_result (gimple gs, tree result)
3685 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3686 phi_stmt->result = result;
3687 if (result && TREE_CODE (result) == SSA_NAME)
3688 SSA_NAME_DEF_STMT (result) = gs;
3692 /* Return the PHI argument corresponding to incoming edge INDEX for
3693 GIMPLE_PHI GS. */
3695 static inline struct phi_arg_d *
3696 gimple_phi_arg (gimple gs, unsigned index)
3698 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3699 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3700 return &(phi_stmt->args[index]);
3703 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3704 for GIMPLE_PHI GS. */
3706 static inline void
3707 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3709 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3710 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3711 phi_stmt->args[index] = *phiarg;
3714 /* Return the PHI nodes for basic block BB, or NULL if there are no
3715 PHI nodes. */
3717 static inline gimple_seq
3718 phi_nodes (const_basic_block bb)
3720 gcc_checking_assert (!(bb->flags & BB_RTL));
3721 return bb->il.gimple.phi_nodes;
3724 /* Return a pointer to the PHI nodes for basic block BB. */
3726 static inline gimple_seq *
3727 phi_nodes_ptr (basic_block bb)
3729 gcc_checking_assert (!(bb->flags & BB_RTL));
3730 return &bb->il.gimple.phi_nodes;
3733 /* Return the tree operand for argument I of PHI node GS. */
3735 static inline tree
3736 gimple_phi_arg_def (gimple gs, size_t index)
3738 return gimple_phi_arg (gs, index)->def;
3742 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3744 static inline tree *
3745 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3747 return &gimple_phi_arg (gs, index)->def;
3750 /* Return the edge associated with argument I of phi node GS. */
3752 static inline edge
3753 gimple_phi_arg_edge (gimple gs, size_t i)
3755 return EDGE_PRED (gimple_bb (gs), i);
3758 /* Return the source location of gimple argument I of phi node GS. */
3760 static inline source_location
3761 gimple_phi_arg_location (gimple gs, size_t i)
3763 return gimple_phi_arg (gs, i)->locus;
3766 /* Return the source location of the argument on edge E of phi node GS. */
3768 static inline source_location
3769 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3771 return gimple_phi_arg (gs, e->dest_idx)->locus;
3774 /* Set the source location of gimple argument I of phi node GS to LOC. */
3776 static inline void
3777 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3779 gimple_phi_arg (gs, i)->locus = loc;
3782 /* Return TRUE if argument I of phi node GS has a location record. */
3784 static inline bool
3785 gimple_phi_arg_has_location (gimple gs, size_t i)
3787 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3791 /* Return the region number for GIMPLE_RESX GS. */
3793 static inline int
3794 gimple_resx_region (const_gimple gs)
3796 const gimple_statement_eh_ctrl *eh_ctrl_stmt =
3797 as_a <const gimple_statement_eh_ctrl> (gs);
3798 return eh_ctrl_stmt->region;
3801 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3803 static inline void
3804 gimple_resx_set_region (gimple gs, int region)
3806 gimple_statement_eh_ctrl *eh_ctrl_stmt =
3807 as_a <gimple_statement_eh_ctrl> (gs);
3808 eh_ctrl_stmt->region = region;
3811 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3813 static inline int
3814 gimple_eh_dispatch_region (const_gimple gs)
3816 const gimple_statement_eh_ctrl *eh_ctrl_stmt =
3817 as_a <const gimple_statement_eh_ctrl> (gs);
3818 return eh_ctrl_stmt->region;
3821 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3823 static inline void
3824 gimple_eh_dispatch_set_region (gimple gs, int region)
3826 gimple_statement_eh_ctrl *eh_ctrl_stmt =
3827 as_a <gimple_statement_eh_ctrl> (gs);
3828 eh_ctrl_stmt->region = region;
3831 /* Return the number of labels associated with the switch statement GS. */
3833 static inline unsigned
3834 gimple_switch_num_labels (const_gimple gs)
3836 unsigned num_ops;
3837 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3838 num_ops = gimple_num_ops (gs);
3839 gcc_gimple_checking_assert (num_ops > 1);
3840 return num_ops - 1;
3844 /* Set NLABELS to be the number of labels for the switch statement GS. */
3846 static inline void
3847 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3849 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3850 gimple_set_num_ops (g, nlabels + 1);
3854 /* Return the index variable used by the switch statement GS. */
3856 static inline tree
3857 gimple_switch_index (const_gimple gs)
3859 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3860 return gimple_op (gs, 0);
3864 /* Return a pointer to the index variable for the switch statement GS. */
3866 static inline tree *
3867 gimple_switch_index_ptr (const_gimple gs)
3869 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3870 return gimple_op_ptr (gs, 0);
3874 /* Set INDEX to be the index variable for switch statement GS. */
3876 static inline void
3877 gimple_switch_set_index (gimple gs, tree index)
3879 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3880 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3881 gimple_set_op (gs, 0, index);
3885 /* Return the label numbered INDEX. The default label is 0, followed by any
3886 labels in a switch statement. */
3888 static inline tree
3889 gimple_switch_label (const_gimple gs, unsigned index)
3891 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3892 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3893 return gimple_op (gs, index + 1);
3896 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3898 static inline void
3899 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3901 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3902 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3903 && (label == NULL_TREE
3904 || TREE_CODE (label) == CASE_LABEL_EXPR));
3905 gimple_set_op (gs, index + 1, label);
3908 /* Return the default label for a switch statement. */
3910 static inline tree
3911 gimple_switch_default_label (const_gimple gs)
3913 tree label = gimple_switch_label (gs, 0);
3914 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3915 return label;
3918 /* Set the default label for a switch statement. */
3920 static inline void
3921 gimple_switch_set_default_label (gimple gs, tree label)
3923 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3924 gimple_switch_set_label (gs, 0, label);
3927 /* Return true if GS is a GIMPLE_DEBUG statement. */
3929 static inline bool
3930 is_gimple_debug (const_gimple gs)
3932 return gimple_code (gs) == GIMPLE_DEBUG;
3935 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3937 static inline bool
3938 gimple_debug_bind_p (const_gimple s)
3940 if (is_gimple_debug (s))
3941 return s->subcode == GIMPLE_DEBUG_BIND;
3943 return false;
3946 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3948 static inline tree
3949 gimple_debug_bind_get_var (gimple dbg)
3951 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3952 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3953 return gimple_op (dbg, 0);
3956 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3957 statement. */
3959 static inline tree
3960 gimple_debug_bind_get_value (gimple dbg)
3962 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3963 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3964 return gimple_op (dbg, 1);
3967 /* Return a pointer to the value bound to the variable in a
3968 GIMPLE_DEBUG bind statement. */
3970 static inline tree *
3971 gimple_debug_bind_get_value_ptr (gimple dbg)
3973 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3974 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3975 return gimple_op_ptr (dbg, 1);
3978 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3980 static inline void
3981 gimple_debug_bind_set_var (gimple dbg, tree var)
3983 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3984 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3985 gimple_set_op (dbg, 0, var);
3988 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3989 statement. */
3991 static inline void
3992 gimple_debug_bind_set_value (gimple dbg, tree value)
3994 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3995 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3996 gimple_set_op (dbg, 1, value);
3999 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4000 optimized away. */
4001 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4003 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4004 statement. */
4006 static inline void
4007 gimple_debug_bind_reset_value (gimple dbg)
4009 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4010 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4011 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4014 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4015 value. */
4017 static inline bool
4018 gimple_debug_bind_has_value_p (gimple dbg)
4020 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4021 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4022 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4025 #undef GIMPLE_DEBUG_BIND_NOVALUE
4027 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4029 static inline bool
4030 gimple_debug_source_bind_p (const_gimple s)
4032 if (is_gimple_debug (s))
4033 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4035 return false;
4038 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4040 static inline tree
4041 gimple_debug_source_bind_get_var (gimple dbg)
4043 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4044 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4045 return gimple_op (dbg, 0);
4048 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4049 statement. */
4051 static inline tree
4052 gimple_debug_source_bind_get_value (gimple dbg)
4054 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4055 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4056 return gimple_op (dbg, 1);
4059 /* Return a pointer to the value bound to the variable in a
4060 GIMPLE_DEBUG source bind statement. */
4062 static inline tree *
4063 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4065 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4066 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4067 return gimple_op_ptr (dbg, 1);
4070 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4072 static inline void
4073 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4075 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4076 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4077 gimple_set_op (dbg, 0, var);
4080 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4081 statement. */
4083 static inline void
4084 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4086 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4087 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4088 gimple_set_op (dbg, 1, value);
4091 /* Return the line number for EXPR, or return -1 if we have no line
4092 number information for it. */
4093 static inline int
4094 get_lineno (const_gimple stmt)
4096 location_t loc;
4098 if (!stmt)
4099 return -1;
4101 loc = gimple_location (stmt);
4102 if (loc == UNKNOWN_LOCATION)
4103 return -1;
4105 return LOCATION_LINE (loc);
4108 /* Return a pointer to the body for the OMP statement GS. */
4110 static inline gimple_seq *
4111 gimple_omp_body_ptr (gimple gs)
4113 return &static_cast <gimple_statement_omp *> (gs)->body;
4116 /* Return the body for the OMP statement GS. */
4118 static inline gimple_seq
4119 gimple_omp_body (gimple gs)
4121 return *gimple_omp_body_ptr (gs);
4124 /* Set BODY to be the body for the OMP statement GS. */
4126 static inline void
4127 gimple_omp_set_body (gimple gs, gimple_seq body)
4129 static_cast <gimple_statement_omp *> (gs)->body = body;
4133 /* Return the name associated with OMP_CRITICAL statement GS. */
4135 static inline tree
4136 gimple_omp_critical_name (const_gimple gs)
4138 const gimple_statement_omp_critical *omp_critical_stmt =
4139 as_a <const gimple_statement_omp_critical> (gs);
4140 return omp_critical_stmt->name;
4144 /* Return a pointer to the name associated with OMP critical statement GS. */
4146 static inline tree *
4147 gimple_omp_critical_name_ptr (gimple gs)
4149 gimple_statement_omp_critical *omp_critical_stmt =
4150 as_a <gimple_statement_omp_critical> (gs);
4151 return &omp_critical_stmt->name;
4155 /* Set NAME to be the name associated with OMP critical statement GS. */
4157 static inline void
4158 gimple_omp_critical_set_name (gimple gs, tree name)
4160 gimple_statement_omp_critical *omp_critical_stmt =
4161 as_a <gimple_statement_omp_critical> (gs);
4162 omp_critical_stmt->name = name;
4166 /* Return the kind of OMP for statemement. */
4168 static inline int
4169 gimple_omp_for_kind (const_gimple g)
4171 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4172 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4176 /* Set the OMP for kind. */
4178 static inline void
4179 gimple_omp_for_set_kind (gimple g, int kind)
4181 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4182 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4183 | (kind & GF_OMP_FOR_KIND_MASK);
4187 /* Return true if OMP for statement G has the
4188 GF_OMP_FOR_COMBINED flag set. */
4190 static inline bool
4191 gimple_omp_for_combined_p (const_gimple g)
4193 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4194 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4198 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4199 value of COMBINED_P. */
4201 static inline void
4202 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4204 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4205 if (combined_p)
4206 g->subcode |= GF_OMP_FOR_COMBINED;
4207 else
4208 g->subcode &= ~GF_OMP_FOR_COMBINED;
4212 /* Return true if OMP for statement G has the
4213 GF_OMP_FOR_COMBINED_INTO flag set. */
4215 static inline bool
4216 gimple_omp_for_combined_into_p (const_gimple g)
4218 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4219 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4223 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4224 value of COMBINED_P. */
4226 static inline void
4227 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4229 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4230 if (combined_p)
4231 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4232 else
4233 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4237 /* Return the clauses associated with OMP_FOR GS. */
4239 static inline tree
4240 gimple_omp_for_clauses (const_gimple gs)
4242 const gimple_statement_omp_for *omp_for_stmt =
4243 as_a <const gimple_statement_omp_for> (gs);
4244 return omp_for_stmt->clauses;
4248 /* Return a pointer to the OMP_FOR GS. */
4250 static inline tree *
4251 gimple_omp_for_clauses_ptr (gimple gs)
4253 gimple_statement_omp_for *omp_for_stmt =
4254 as_a <gimple_statement_omp_for> (gs);
4255 return &omp_for_stmt->clauses;
4259 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4261 static inline void
4262 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4264 gimple_statement_omp_for *omp_for_stmt =
4265 as_a <gimple_statement_omp_for> (gs);
4266 omp_for_stmt->clauses = clauses;
4270 /* Get the collapse count of OMP_FOR GS. */
4272 static inline size_t
4273 gimple_omp_for_collapse (gimple gs)
4275 gimple_statement_omp_for *omp_for_stmt =
4276 as_a <gimple_statement_omp_for> (gs);
4277 return omp_for_stmt->collapse;
4281 /* Return the index variable for OMP_FOR GS. */
4283 static inline tree
4284 gimple_omp_for_index (const_gimple gs, size_t i)
4286 const gimple_statement_omp_for *omp_for_stmt =
4287 as_a <const gimple_statement_omp_for> (gs);
4288 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4289 return omp_for_stmt->iter[i].index;
4293 /* Return a pointer to the index variable for OMP_FOR GS. */
4295 static inline tree *
4296 gimple_omp_for_index_ptr (gimple gs, size_t i)
4298 gimple_statement_omp_for *omp_for_stmt =
4299 as_a <gimple_statement_omp_for> (gs);
4300 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4301 return &omp_for_stmt->iter[i].index;
4305 /* Set INDEX to be the index variable for OMP_FOR GS. */
4307 static inline void
4308 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4310 gimple_statement_omp_for *omp_for_stmt =
4311 as_a <gimple_statement_omp_for> (gs);
4312 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4313 omp_for_stmt->iter[i].index = index;
4317 /* Return the initial value for OMP_FOR GS. */
4319 static inline tree
4320 gimple_omp_for_initial (const_gimple gs, size_t i)
4322 const gimple_statement_omp_for *omp_for_stmt =
4323 as_a <const gimple_statement_omp_for> (gs);
4324 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4325 return omp_for_stmt->iter[i].initial;
4329 /* Return a pointer to the initial value for OMP_FOR GS. */
4331 static inline tree *
4332 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4334 gimple_statement_omp_for *omp_for_stmt =
4335 as_a <gimple_statement_omp_for> (gs);
4336 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4337 return &omp_for_stmt->iter[i].initial;
4341 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4343 static inline void
4344 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4346 gimple_statement_omp_for *omp_for_stmt =
4347 as_a <gimple_statement_omp_for> (gs);
4348 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4349 omp_for_stmt->iter[i].initial = initial;
4353 /* Return the final value for OMP_FOR GS. */
4355 static inline tree
4356 gimple_omp_for_final (const_gimple gs, size_t i)
4358 const gimple_statement_omp_for *omp_for_stmt =
4359 as_a <const gimple_statement_omp_for> (gs);
4360 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4361 return omp_for_stmt->iter[i].final;
4365 /* Return a pointer to the final value for OMP_FOR GS. */
4367 static inline tree *
4368 gimple_omp_for_final_ptr (gimple gs, size_t i)
4370 gimple_statement_omp_for *omp_for_stmt =
4371 as_a <gimple_statement_omp_for> (gs);
4372 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4373 return &omp_for_stmt->iter[i].final;
4377 /* Set FINAL to be the final value for OMP_FOR GS. */
4379 static inline void
4380 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4382 gimple_statement_omp_for *omp_for_stmt =
4383 as_a <gimple_statement_omp_for> (gs);
4384 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4385 omp_for_stmt->iter[i].final = final;
4389 /* Return the increment value for OMP_FOR GS. */
4391 static inline tree
4392 gimple_omp_for_incr (const_gimple gs, size_t i)
4394 const gimple_statement_omp_for *omp_for_stmt =
4395 as_a <const gimple_statement_omp_for> (gs);
4396 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4397 return omp_for_stmt->iter[i].incr;
4401 /* Return a pointer to the increment value for OMP_FOR GS. */
4403 static inline tree *
4404 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4406 gimple_statement_omp_for *omp_for_stmt =
4407 as_a <gimple_statement_omp_for> (gs);
4408 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4409 return &omp_for_stmt->iter[i].incr;
4413 /* Set INCR to be the increment value for OMP_FOR GS. */
4415 static inline void
4416 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4418 gimple_statement_omp_for *omp_for_stmt =
4419 as_a <gimple_statement_omp_for> (gs);
4420 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4421 omp_for_stmt->iter[i].incr = incr;
4425 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4426 statement GS starts. */
4428 static inline gimple_seq *
4429 gimple_omp_for_pre_body_ptr (gimple gs)
4431 gimple_statement_omp_for *omp_for_stmt =
4432 as_a <gimple_statement_omp_for> (gs);
4433 return &omp_for_stmt->pre_body;
4437 /* Return the sequence of statements to execute before the OMP_FOR
4438 statement GS starts. */
4440 static inline gimple_seq
4441 gimple_omp_for_pre_body (gimple gs)
4443 return *gimple_omp_for_pre_body_ptr (gs);
4447 /* Set PRE_BODY to be the sequence of statements to execute before the
4448 OMP_FOR statement GS starts. */
4450 static inline void
4451 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4453 gimple_statement_omp_for *omp_for_stmt =
4454 as_a <gimple_statement_omp_for> (gs);
4455 omp_for_stmt->pre_body = pre_body;
4459 /* Return the clauses associated with OMP_PARALLEL GS. */
4461 static inline tree
4462 gimple_omp_parallel_clauses (const_gimple gs)
4464 const gimple_statement_omp_parallel *omp_parallel_stmt =
4465 as_a <const gimple_statement_omp_parallel> (gs);
4466 return omp_parallel_stmt->clauses;
4470 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4472 static inline tree *
4473 gimple_omp_parallel_clauses_ptr (gimple gs)
4475 gimple_statement_omp_parallel *omp_parallel_stmt =
4476 as_a <gimple_statement_omp_parallel> (gs);
4477 return &omp_parallel_stmt->clauses;
4481 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4482 GS. */
4484 static inline void
4485 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4487 gimple_statement_omp_parallel *omp_parallel_stmt =
4488 as_a <gimple_statement_omp_parallel> (gs);
4489 omp_parallel_stmt->clauses = clauses;
4493 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4495 static inline tree
4496 gimple_omp_parallel_child_fn (const_gimple gs)
4498 const gimple_statement_omp_parallel *omp_parallel_stmt =
4499 as_a <const gimple_statement_omp_parallel> (gs);
4500 return omp_parallel_stmt->child_fn;
4503 /* Return a pointer to the child function used to hold the body of
4504 OMP_PARALLEL GS. */
4506 static inline tree *
4507 gimple_omp_parallel_child_fn_ptr (gimple gs)
4509 gimple_statement_omp_parallel *omp_parallel_stmt =
4510 as_a <gimple_statement_omp_parallel> (gs);
4511 return &omp_parallel_stmt->child_fn;
4515 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4517 static inline void
4518 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4520 gimple_statement_omp_parallel *omp_parallel_stmt =
4521 as_a <gimple_statement_omp_parallel> (gs);
4522 omp_parallel_stmt->child_fn = child_fn;
4526 /* Return the artificial argument used to send variables and values
4527 from the parent to the children threads in OMP_PARALLEL GS. */
4529 static inline tree
4530 gimple_omp_parallel_data_arg (const_gimple gs)
4532 const gimple_statement_omp_parallel *omp_parallel_stmt =
4533 as_a <const gimple_statement_omp_parallel> (gs);
4534 return omp_parallel_stmt->data_arg;
4538 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4540 static inline tree *
4541 gimple_omp_parallel_data_arg_ptr (gimple gs)
4543 gimple_statement_omp_parallel *omp_parallel_stmt =
4544 as_a <gimple_statement_omp_parallel> (gs);
4545 return &omp_parallel_stmt->data_arg;
4549 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4551 static inline void
4552 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4554 gimple_statement_omp_parallel *omp_parallel_stmt =
4555 as_a <gimple_statement_omp_parallel> (gs);
4556 omp_parallel_stmt->data_arg = data_arg;
4560 /* Return the clauses associated with OMP_TASK GS. */
4562 static inline tree
4563 gimple_omp_task_clauses (const_gimple gs)
4565 const gimple_statement_omp_task *omp_task_stmt =
4566 as_a <const gimple_statement_omp_task> (gs);
4567 return omp_task_stmt->clauses;
4571 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4573 static inline tree *
4574 gimple_omp_task_clauses_ptr (gimple gs)
4576 gimple_statement_omp_task *omp_task_stmt =
4577 as_a <gimple_statement_omp_task> (gs);
4578 return &omp_task_stmt->clauses;
4582 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4583 GS. */
4585 static inline void
4586 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4588 gimple_statement_omp_task *omp_task_stmt =
4589 as_a <gimple_statement_omp_task> (gs);
4590 omp_task_stmt->clauses = clauses;
4594 /* Return the child function used to hold the body of OMP_TASK GS. */
4596 static inline tree
4597 gimple_omp_task_child_fn (const_gimple gs)
4599 const gimple_statement_omp_task *omp_task_stmt =
4600 as_a <const gimple_statement_omp_task> (gs);
4601 return omp_task_stmt->child_fn;
4604 /* Return a pointer to the child function used to hold the body of
4605 OMP_TASK GS. */
4607 static inline tree *
4608 gimple_omp_task_child_fn_ptr (gimple gs)
4610 gimple_statement_omp_task *omp_task_stmt =
4611 as_a <gimple_statement_omp_task> (gs);
4612 return &omp_task_stmt->child_fn;
4616 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4618 static inline void
4619 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4621 gimple_statement_omp_task *omp_task_stmt =
4622 as_a <gimple_statement_omp_task> (gs);
4623 omp_task_stmt->child_fn = child_fn;
4627 /* Return the artificial argument used to send variables and values
4628 from the parent to the children threads in OMP_TASK GS. */
4630 static inline tree
4631 gimple_omp_task_data_arg (const_gimple gs)
4633 const gimple_statement_omp_task *omp_task_stmt =
4634 as_a <const gimple_statement_omp_task> (gs);
4635 return omp_task_stmt->data_arg;
4639 /* Return a pointer to the data argument for OMP_TASK GS. */
4641 static inline tree *
4642 gimple_omp_task_data_arg_ptr (gimple gs)
4644 gimple_statement_omp_task *omp_task_stmt =
4645 as_a <gimple_statement_omp_task> (gs);
4646 return &omp_task_stmt->data_arg;
4650 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4652 static inline void
4653 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4655 gimple_statement_omp_task *omp_task_stmt =
4656 as_a <gimple_statement_omp_task> (gs);
4657 omp_task_stmt->data_arg = data_arg;
4661 /* Return the clauses associated with OMP_TASK GS. */
4663 static inline tree
4664 gimple_omp_taskreg_clauses (const_gimple gs)
4666 const gimple_statement_omp_parallel *omp_parallel_stmt =
4667 as_a <const gimple_statement_omp_parallel> (gs);
4668 return omp_parallel_stmt->clauses;
4672 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4674 static inline tree *
4675 gimple_omp_taskreg_clauses_ptr (gimple gs)
4677 gimple_statement_omp_parallel *omp_parallel_stmt =
4678 as_a <gimple_statement_omp_parallel> (gs);
4679 return &omp_parallel_stmt->clauses;
4683 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4684 GS. */
4686 static inline void
4687 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4689 gimple_statement_omp_parallel *omp_parallel_stmt =
4690 as_a <gimple_statement_omp_parallel> (gs);
4691 omp_parallel_stmt->clauses = clauses;
4695 /* Return the child function used to hold the body of OMP_TASK GS. */
4697 static inline tree
4698 gimple_omp_taskreg_child_fn (const_gimple gs)
4700 const gimple_statement_omp_parallel *omp_parallel_stmt =
4701 as_a <const gimple_statement_omp_parallel> (gs);
4702 return omp_parallel_stmt->child_fn;
4705 /* Return a pointer to the child function used to hold the body of
4706 OMP_TASK GS. */
4708 static inline tree *
4709 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4711 gimple_statement_omp_parallel *omp_parallel_stmt =
4712 as_a <gimple_statement_omp_parallel> (gs);
4713 return &omp_parallel_stmt->child_fn;
4717 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4719 static inline void
4720 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4722 gimple_statement_omp_parallel *omp_parallel_stmt =
4723 as_a <gimple_statement_omp_parallel> (gs);
4724 omp_parallel_stmt->child_fn = child_fn;
4728 /* Return the artificial argument used to send variables and values
4729 from the parent to the children threads in OMP_TASK GS. */
4731 static inline tree
4732 gimple_omp_taskreg_data_arg (const_gimple gs)
4734 const gimple_statement_omp_parallel *omp_parallel_stmt =
4735 as_a <const gimple_statement_omp_parallel> (gs);
4736 return omp_parallel_stmt->data_arg;
4740 /* Return a pointer to the data argument for OMP_TASK GS. */
4742 static inline tree *
4743 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4745 gimple_statement_omp_parallel *omp_parallel_stmt =
4746 as_a <gimple_statement_omp_parallel> (gs);
4747 return &omp_parallel_stmt->data_arg;
4751 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4753 static inline void
4754 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4756 gimple_statement_omp_parallel *omp_parallel_stmt =
4757 as_a <gimple_statement_omp_parallel> (gs);
4758 omp_parallel_stmt->data_arg = data_arg;
4762 /* Return the copy function used to hold the body of OMP_TASK GS. */
4764 static inline tree
4765 gimple_omp_task_copy_fn (const_gimple gs)
4767 const gimple_statement_omp_task *omp_task_stmt =
4768 as_a <const gimple_statement_omp_task> (gs);
4769 return omp_task_stmt->copy_fn;
4772 /* Return a pointer to the copy function used to hold the body of
4773 OMP_TASK GS. */
4775 static inline tree *
4776 gimple_omp_task_copy_fn_ptr (gimple gs)
4778 gimple_statement_omp_task *omp_task_stmt =
4779 as_a <gimple_statement_omp_task> (gs);
4780 return &omp_task_stmt->copy_fn;
4784 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4786 static inline void
4787 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4789 gimple_statement_omp_task *omp_task_stmt =
4790 as_a <gimple_statement_omp_task> (gs);
4791 omp_task_stmt->copy_fn = copy_fn;
4795 /* Return size of the data block in bytes in OMP_TASK GS. */
4797 static inline tree
4798 gimple_omp_task_arg_size (const_gimple gs)
4800 const gimple_statement_omp_task *omp_task_stmt =
4801 as_a <const gimple_statement_omp_task> (gs);
4802 return omp_task_stmt->arg_size;
4806 /* Return a pointer to the data block size for OMP_TASK GS. */
4808 static inline tree *
4809 gimple_omp_task_arg_size_ptr (gimple gs)
4811 gimple_statement_omp_task *omp_task_stmt =
4812 as_a <gimple_statement_omp_task> (gs);
4813 return &omp_task_stmt->arg_size;
4817 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4819 static inline void
4820 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4822 gimple_statement_omp_task *omp_task_stmt =
4823 as_a <gimple_statement_omp_task> (gs);
4824 omp_task_stmt->arg_size = arg_size;
4828 /* Return align of the data block in bytes in OMP_TASK GS. */
4830 static inline tree
4831 gimple_omp_task_arg_align (const_gimple gs)
4833 const gimple_statement_omp_task *omp_task_stmt =
4834 as_a <const gimple_statement_omp_task> (gs);
4835 return omp_task_stmt->arg_align;
4839 /* Return a pointer to the data block align for OMP_TASK GS. */
4841 static inline tree *
4842 gimple_omp_task_arg_align_ptr (gimple gs)
4844 gimple_statement_omp_task *omp_task_stmt =
4845 as_a <gimple_statement_omp_task> (gs);
4846 return &omp_task_stmt->arg_align;
4850 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4852 static inline void
4853 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4855 gimple_statement_omp_task *omp_task_stmt =
4856 as_a <gimple_statement_omp_task> (gs);
4857 omp_task_stmt->arg_align = arg_align;
4861 /* Return the clauses associated with OMP_SINGLE GS. */
4863 static inline tree
4864 gimple_omp_single_clauses (const_gimple gs)
4866 const gimple_statement_omp_single *omp_single_stmt =
4867 as_a <const gimple_statement_omp_single> (gs);
4868 return omp_single_stmt->clauses;
4872 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4874 static inline tree *
4875 gimple_omp_single_clauses_ptr (gimple gs)
4877 gimple_statement_omp_single *omp_single_stmt =
4878 as_a <gimple_statement_omp_single> (gs);
4879 return &omp_single_stmt->clauses;
4883 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4885 static inline void
4886 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4888 gimple_statement_omp_single *omp_single_stmt =
4889 as_a <gimple_statement_omp_single> (gs);
4890 omp_single_stmt->clauses = clauses;
4894 /* Return the clauses associated with OMP_TARGET GS. */
4896 static inline tree
4897 gimple_omp_target_clauses (const_gimple gs)
4899 const gimple_statement_omp_parallel *omp_parallel_stmt =
4900 as_a <const gimple_statement_omp_parallel> (gs);
4901 return omp_parallel_stmt->clauses;
4905 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
4907 static inline tree *
4908 gimple_omp_target_clauses_ptr (gimple gs)
4910 gimple_statement_omp_parallel *omp_parallel_stmt =
4911 as_a <gimple_statement_omp_parallel> (gs);
4912 return &omp_parallel_stmt->clauses;
4916 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
4918 static inline void
4919 gimple_omp_target_set_clauses (gimple gs, tree clauses)
4921 gimple_statement_omp_parallel *omp_parallel_stmt =
4922 as_a <gimple_statement_omp_parallel> (gs);
4923 omp_parallel_stmt->clauses = clauses;
4927 /* Return the kind of OMP target statemement. */
4929 static inline int
4930 gimple_omp_target_kind (const_gimple g)
4932 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
4933 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
4937 /* Set the OMP target kind. */
4939 static inline void
4940 gimple_omp_target_set_kind (gimple g, int kind)
4942 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
4943 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
4944 | (kind & GF_OMP_TARGET_KIND_MASK);
4948 /* Return the child function used to hold the body of OMP_TARGET GS. */
4950 static inline tree
4951 gimple_omp_target_child_fn (const_gimple gs)
4953 const gimple_statement_omp_parallel *omp_parallel_stmt =
4954 as_a <const gimple_statement_omp_parallel> (gs);
4955 return omp_parallel_stmt->child_fn;
4958 /* Return a pointer to the child function used to hold the body of
4959 OMP_TARGET GS. */
4961 static inline tree *
4962 gimple_omp_target_child_fn_ptr (gimple gs)
4964 gimple_statement_omp_parallel *omp_parallel_stmt =
4965 as_a <gimple_statement_omp_parallel> (gs);
4966 return &omp_parallel_stmt->child_fn;
4970 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
4972 static inline void
4973 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
4975 gimple_statement_omp_parallel *omp_parallel_stmt =
4976 as_a <gimple_statement_omp_parallel> (gs);
4977 omp_parallel_stmt->child_fn = child_fn;
4981 /* Return the artificial argument used to send variables and values
4982 from the parent to the children threads in OMP_TARGET GS. */
4984 static inline tree
4985 gimple_omp_target_data_arg (const_gimple gs)
4987 const gimple_statement_omp_parallel *omp_parallel_stmt =
4988 as_a <const gimple_statement_omp_parallel> (gs);
4989 return omp_parallel_stmt->data_arg;
4993 /* Return a pointer to the data argument for OMP_TARGET GS. */
4995 static inline tree *
4996 gimple_omp_target_data_arg_ptr (gimple gs)
4998 gimple_statement_omp_parallel *omp_parallel_stmt =
4999 as_a <gimple_statement_omp_parallel> (gs);
5000 return &omp_parallel_stmt->data_arg;
5004 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5006 static inline void
5007 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5009 gimple_statement_omp_parallel *omp_parallel_stmt =
5010 as_a <gimple_statement_omp_parallel> (gs);
5011 omp_parallel_stmt->data_arg = data_arg;
5015 /* Return the clauses associated with OMP_TEAMS GS. */
5017 static inline tree
5018 gimple_omp_teams_clauses (const_gimple gs)
5020 const gimple_statement_omp_single *omp_single_stmt =
5021 as_a <const gimple_statement_omp_single> (gs);
5022 return omp_single_stmt->clauses;
5026 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5028 static inline tree *
5029 gimple_omp_teams_clauses_ptr (gimple gs)
5031 gimple_statement_omp_single *omp_single_stmt =
5032 as_a <gimple_statement_omp_single> (gs);
5033 return &omp_single_stmt->clauses;
5037 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5039 static inline void
5040 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5042 gimple_statement_omp_single *omp_single_stmt =
5043 as_a <gimple_statement_omp_single> (gs);
5044 omp_single_stmt->clauses = clauses;
5048 /* Return the clauses associated with OMP_SECTIONS GS. */
5050 static inline tree
5051 gimple_omp_sections_clauses (const_gimple gs)
5053 const gimple_statement_omp_sections *omp_sections_stmt =
5054 as_a <const gimple_statement_omp_sections> (gs);
5055 return omp_sections_stmt->clauses;
5059 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5061 static inline tree *
5062 gimple_omp_sections_clauses_ptr (gimple gs)
5064 gimple_statement_omp_sections *omp_sections_stmt =
5065 as_a <gimple_statement_omp_sections> (gs);
5066 return &omp_sections_stmt->clauses;
5070 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5071 GS. */
5073 static inline void
5074 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5076 gimple_statement_omp_sections *omp_sections_stmt =
5077 as_a <gimple_statement_omp_sections> (gs);
5078 omp_sections_stmt->clauses = clauses;
5082 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5083 in GS. */
5085 static inline tree
5086 gimple_omp_sections_control (const_gimple gs)
5088 const gimple_statement_omp_sections *omp_sections_stmt =
5089 as_a <const gimple_statement_omp_sections> (gs);
5090 return omp_sections_stmt->control;
5094 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5095 GS. */
5097 static inline tree *
5098 gimple_omp_sections_control_ptr (gimple gs)
5100 gimple_statement_omp_sections *omp_sections_stmt =
5101 as_a <gimple_statement_omp_sections> (gs);
5102 return &omp_sections_stmt->control;
5106 /* Set CONTROL to be the set of clauses associated with the
5107 GIMPLE_OMP_SECTIONS in GS. */
5109 static inline void
5110 gimple_omp_sections_set_control (gimple gs, tree control)
5112 gimple_statement_omp_sections *omp_sections_stmt =
5113 as_a <gimple_statement_omp_sections> (gs);
5114 omp_sections_stmt->control = control;
5118 /* Set COND to be the condition code for OMP_FOR GS. */
5120 static inline void
5121 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5123 gimple_statement_omp_for *omp_for_stmt =
5124 as_a <gimple_statement_omp_for> (gs);
5125 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5126 && i < omp_for_stmt->collapse);
5127 omp_for_stmt->iter[i].cond = cond;
5131 /* Return the condition code associated with OMP_FOR GS. */
5133 static inline enum tree_code
5134 gimple_omp_for_cond (const_gimple gs, size_t i)
5136 const gimple_statement_omp_for *omp_for_stmt =
5137 as_a <const gimple_statement_omp_for> (gs);
5138 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5139 return omp_for_stmt->iter[i].cond;
5143 /* Set the value being stored in an atomic store. */
5145 static inline void
5146 gimple_omp_atomic_store_set_val (gimple g, tree val)
5148 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5149 as_a <gimple_statement_omp_atomic_store> (g);
5150 omp_atomic_store_stmt->val = val;
5154 /* Return the value being stored in an atomic store. */
5156 static inline tree
5157 gimple_omp_atomic_store_val (const_gimple g)
5159 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5160 as_a <const gimple_statement_omp_atomic_store> (g);
5161 return omp_atomic_store_stmt->val;
5165 /* Return a pointer to the value being stored in an atomic store. */
5167 static inline tree *
5168 gimple_omp_atomic_store_val_ptr (gimple g)
5170 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5171 as_a <gimple_statement_omp_atomic_store> (g);
5172 return &omp_atomic_store_stmt->val;
5176 /* Set the LHS of an atomic load. */
5178 static inline void
5179 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5181 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5182 as_a <gimple_statement_omp_atomic_load> (g);
5183 omp_atomic_load_stmt->lhs = lhs;
5187 /* Get the LHS of an atomic load. */
5189 static inline tree
5190 gimple_omp_atomic_load_lhs (const_gimple g)
5192 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5193 as_a <const gimple_statement_omp_atomic_load> (g);
5194 return omp_atomic_load_stmt->lhs;
5198 /* Return a pointer to the LHS of an atomic load. */
5200 static inline tree *
5201 gimple_omp_atomic_load_lhs_ptr (gimple g)
5203 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5204 as_a <gimple_statement_omp_atomic_load> (g);
5205 return &omp_atomic_load_stmt->lhs;
5209 /* Set the RHS of an atomic load. */
5211 static inline void
5212 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5214 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5215 as_a <gimple_statement_omp_atomic_load> (g);
5216 omp_atomic_load_stmt->rhs = rhs;
5220 /* Get the RHS of an atomic load. */
5222 static inline tree
5223 gimple_omp_atomic_load_rhs (const_gimple g)
5225 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5226 as_a <const gimple_statement_omp_atomic_load> (g);
5227 return omp_atomic_load_stmt->rhs;
5231 /* Return a pointer to the RHS of an atomic load. */
5233 static inline tree *
5234 gimple_omp_atomic_load_rhs_ptr (gimple g)
5236 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5237 as_a <gimple_statement_omp_atomic_load> (g);
5238 return &omp_atomic_load_stmt->rhs;
5242 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5244 static inline tree
5245 gimple_omp_continue_control_def (const_gimple g)
5247 const gimple_statement_omp_continue *omp_continue_stmt =
5248 as_a <const gimple_statement_omp_continue> (g);
5249 return omp_continue_stmt->control_def;
5252 /* The same as above, but return the address. */
5254 static inline tree *
5255 gimple_omp_continue_control_def_ptr (gimple g)
5257 gimple_statement_omp_continue *omp_continue_stmt =
5258 as_a <gimple_statement_omp_continue> (g);
5259 return &omp_continue_stmt->control_def;
5262 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5264 static inline void
5265 gimple_omp_continue_set_control_def (gimple g, tree def)
5267 gimple_statement_omp_continue *omp_continue_stmt =
5268 as_a <gimple_statement_omp_continue> (g);
5269 omp_continue_stmt->control_def = def;
5273 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5275 static inline tree
5276 gimple_omp_continue_control_use (const_gimple g)
5278 const gimple_statement_omp_continue *omp_continue_stmt =
5279 as_a <const gimple_statement_omp_continue> (g);
5280 return omp_continue_stmt->control_use;
5284 /* The same as above, but return the address. */
5286 static inline tree *
5287 gimple_omp_continue_control_use_ptr (gimple g)
5289 gimple_statement_omp_continue *omp_continue_stmt =
5290 as_a <gimple_statement_omp_continue> (g);
5291 return &omp_continue_stmt->control_use;
5295 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5297 static inline void
5298 gimple_omp_continue_set_control_use (gimple g, tree use)
5300 gimple_statement_omp_continue *omp_continue_stmt =
5301 as_a <gimple_statement_omp_continue> (g);
5302 omp_continue_stmt->control_use = use;
5305 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5307 static inline gimple_seq *
5308 gimple_transaction_body_ptr (gimple gs)
5310 gimple_statement_transaction *transaction_stmt =
5311 as_a <gimple_statement_transaction> (gs);
5312 return &transaction_stmt->body;
5315 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5317 static inline gimple_seq
5318 gimple_transaction_body (gimple gs)
5320 return *gimple_transaction_body_ptr (gs);
5323 /* Return the label associated with a GIMPLE_TRANSACTION. */
5325 static inline tree
5326 gimple_transaction_label (const_gimple gs)
5328 const gimple_statement_transaction *transaction_stmt =
5329 as_a <const gimple_statement_transaction> (gs);
5330 return transaction_stmt->label;
5333 static inline tree *
5334 gimple_transaction_label_ptr (gimple gs)
5336 gimple_statement_transaction *transaction_stmt =
5337 as_a <gimple_statement_transaction> (gs);
5338 return &transaction_stmt->label;
5341 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5343 static inline unsigned int
5344 gimple_transaction_subcode (const_gimple gs)
5346 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5347 return gs->subcode;
5350 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5352 static inline void
5353 gimple_transaction_set_body (gimple gs, gimple_seq body)
5355 gimple_statement_transaction *transaction_stmt =
5356 as_a <gimple_statement_transaction> (gs);
5357 transaction_stmt->body = body;
5360 /* Set the label associated with a GIMPLE_TRANSACTION. */
5362 static inline void
5363 gimple_transaction_set_label (gimple gs, tree label)
5365 gimple_statement_transaction *transaction_stmt =
5366 as_a <gimple_statement_transaction> (gs);
5367 transaction_stmt->label = label;
5370 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5372 static inline void
5373 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5375 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5376 gs->subcode = subcode;
5380 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5382 static inline tree *
5383 gimple_return_retval_ptr (const_gimple gs)
5385 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5386 return gimple_op_ptr (gs, 0);
5389 /* Return the return value for GIMPLE_RETURN GS. */
5391 static inline tree
5392 gimple_return_retval (const_gimple gs)
5394 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5395 return gimple_op (gs, 0);
5399 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5401 static inline void
5402 gimple_return_set_retval (gimple gs, tree retval)
5404 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5405 gimple_set_op (gs, 0, retval);
5409 /* Return the return bounds for GIMPLE_RETURN GS. */
5411 static inline tree
5412 gimple_return_retbnd (const_gimple gs)
5414 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5415 return gimple_op (gs, 1);
5419 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5421 static inline void
5422 gimple_return_set_retbnd (gimple gs, tree retval)
5424 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5425 gimple_set_op (gs, 1, retval);
5429 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5431 #define CASE_GIMPLE_OMP \
5432 case GIMPLE_OMP_PARALLEL: \
5433 case GIMPLE_OMP_TASK: \
5434 case GIMPLE_OMP_FOR: \
5435 case GIMPLE_OMP_SECTIONS: \
5436 case GIMPLE_OMP_SECTIONS_SWITCH: \
5437 case GIMPLE_OMP_SINGLE: \
5438 case GIMPLE_OMP_TARGET: \
5439 case GIMPLE_OMP_TEAMS: \
5440 case GIMPLE_OMP_SECTION: \
5441 case GIMPLE_OMP_MASTER: \
5442 case GIMPLE_OMP_TASKGROUP: \
5443 case GIMPLE_OMP_ORDERED: \
5444 case GIMPLE_OMP_CRITICAL: \
5445 case GIMPLE_OMP_RETURN: \
5446 case GIMPLE_OMP_ATOMIC_LOAD: \
5447 case GIMPLE_OMP_ATOMIC_STORE: \
5448 case GIMPLE_OMP_CONTINUE
5450 static inline bool
5451 is_gimple_omp (const_gimple stmt)
5453 switch (gimple_code (stmt))
5455 CASE_GIMPLE_OMP:
5456 return true;
5457 default:
5458 return false;
5463 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5465 static inline bool
5466 gimple_nop_p (const_gimple g)
5468 return gimple_code (g) == GIMPLE_NOP;
5472 /* Return true if GS is a GIMPLE_RESX. */
5474 static inline bool
5475 is_gimple_resx (const_gimple gs)
5477 return gimple_code (gs) == GIMPLE_RESX;
5480 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5482 static inline enum br_predictor
5483 gimple_predict_predictor (gimple gs)
5485 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5486 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5490 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5492 static inline void
5493 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5495 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5496 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5497 | (unsigned) predictor;
5501 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5503 static inline enum prediction
5504 gimple_predict_outcome (gimple gs)
5506 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5507 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5511 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5513 static inline void
5514 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5516 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5517 if (outcome == TAKEN)
5518 gs->subcode |= GF_PREDICT_TAKEN;
5519 else
5520 gs->subcode &= ~GF_PREDICT_TAKEN;
5524 /* Return the type of the main expression computed by STMT. Return
5525 void_type_node if the statement computes nothing. */
5527 static inline tree
5528 gimple_expr_type (const_gimple stmt)
5530 enum gimple_code code = gimple_code (stmt);
5532 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5534 tree type;
5535 /* In general we want to pass out a type that can be substituted
5536 for both the RHS and the LHS types if there is a possibly
5537 useless conversion involved. That means returning the
5538 original RHS type as far as we can reconstruct it. */
5539 if (code == GIMPLE_CALL)
5540 type = gimple_call_return_type (stmt);
5541 else
5542 switch (gimple_assign_rhs_code (stmt))
5544 case POINTER_PLUS_EXPR:
5545 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5546 break;
5548 default:
5549 /* As fallback use the type of the LHS. */
5550 type = TREE_TYPE (gimple_get_lhs (stmt));
5551 break;
5553 return type;
5555 else if (code == GIMPLE_COND)
5556 return boolean_type_node;
5557 else
5558 return void_type_node;
5561 /* Enum and arrays used for allocation stats. Keep in sync with
5562 gimple.c:gimple_alloc_kind_names. */
5563 enum gimple_alloc_kind
5565 gimple_alloc_kind_assign, /* Assignments. */
5566 gimple_alloc_kind_phi, /* PHI nodes. */
5567 gimple_alloc_kind_cond, /* Conditionals. */
5568 gimple_alloc_kind_rest, /* Everything else. */
5569 gimple_alloc_kind_all
5572 extern int gimple_alloc_counts[];
5573 extern int gimple_alloc_sizes[];
5575 /* Return the allocation kind for a given stmt CODE. */
5576 static inline enum gimple_alloc_kind
5577 gimple_alloc_kind (enum gimple_code code)
5579 switch (code)
5581 case GIMPLE_ASSIGN:
5582 return gimple_alloc_kind_assign;
5583 case GIMPLE_PHI:
5584 return gimple_alloc_kind_phi;
5585 case GIMPLE_COND:
5586 return gimple_alloc_kind_cond;
5587 default:
5588 return gimple_alloc_kind_rest;
5592 /* Return true if a location should not be emitted for this statement
5593 by annotate_all_with_location. */
5595 static inline bool
5596 gimple_do_not_emit_location_p (gimple g)
5598 return gimple_plf (g, GF_PLF_1);
5601 /* Mark statement G so a location will not be emitted by
5602 annotate_one_with_location. */
5604 static inline void
5605 gimple_set_do_not_emit_location (gimple g)
5607 /* The PLF flags are initialized to 0 when a new tuple is created,
5608 so no need to initialize it anywhere. */
5609 gimple_set_plf (g, GF_PLF_1, true);
5613 /* Macros for showing usage statistics. */
5614 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5615 ? (x) \
5616 : ((x) < 1024*1024*10 \
5617 ? (x) / 1024 \
5618 : (x) / (1024*1024))))
5620 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5622 #endif /* GCC_GIMPLE_H */