* Makefile.in (C_COMMON_OBJS): Depend on c-cilkplus.o.
[official-gcc.git] / gcc / gimple.h
blobc7cb9f75d18c83f5949d67ef3bba0ac081baada8
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"
36 typedef gimple gimple_seq_node;
38 /* For each block, the PHI nodes that need to be rewritten are stored into
39 these vectors. */
40 typedef vec<gimple> gimple_vec;
42 enum gimple_code {
43 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
44 #include "gimple.def"
45 #undef DEFGSCODE
46 LAST_AND_UNUSED_GIMPLE_CODE
49 extern const char *const gimple_code_name[];
50 extern const unsigned char gimple_rhs_class_table[];
52 /* Error out if a gimple tuple is addressed incorrectly. */
53 #if defined ENABLE_GIMPLE_CHECKING
54 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
55 extern void gimple_check_failed (const_gimple, const char *, int, \
56 const char *, enum gimple_code, \
57 enum tree_code) ATTRIBUTE_NORETURN;
59 #define GIMPLE_CHECK(GS, CODE) \
60 do { \
61 const_gimple __gs = (GS); \
62 if (gimple_code (__gs) != (CODE)) \
63 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
64 (CODE), ERROR_MARK); \
65 } while (0)
66 #else /* not ENABLE_GIMPLE_CHECKING */
67 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
68 #define GIMPLE_CHECK(GS, CODE) (void)0
69 #endif
71 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
72 get_gimple_rhs_class. */
73 enum gimple_rhs_class
75 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
76 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
77 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
78 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
79 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
80 name, a _DECL, a _REF, etc. */
83 /* Specific flags for individual GIMPLE statements. These flags are
84 always stored in gimple_statement_base.subcode and they may only be
85 defined for statement codes that do not use subcodes.
87 Values for the masks can overlap as long as the overlapping values
88 are never used in the same statement class.
90 The maximum mask value that can be defined is 1 << 15 (i.e., each
91 statement code can hold up to 16 bitflags).
93 Keep this list sorted. */
94 enum gf_mask {
95 GF_ASM_INPUT = 1 << 0,
96 GF_ASM_VOLATILE = 1 << 1,
97 GF_CALL_FROM_THUNK = 1 << 0,
98 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
99 GF_CALL_TAILCALL = 1 << 2,
100 GF_CALL_VA_ARG_PACK = 1 << 3,
101 GF_CALL_NOTHROW = 1 << 4,
102 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
103 GF_CALL_INTERNAL = 1 << 6,
104 GF_OMP_PARALLEL_COMBINED = 1 << 0,
105 GF_OMP_FOR_KIND_MASK = 7,
106 GF_OMP_FOR_KIND_FOR = 0 << 0,
107 GF_OMP_FOR_KIND_SIMD = 2 << 0,
108 GF_OMP_FOR_KIND_CILKSIMD = 3 << 0,
109 GF_OMP_FOR_KIND_DISTRIBUTE = 1 << 2,
110 GF_OMP_FOR_COMBINED = 1 << 3,
111 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
112 GF_OMP_TARGET_KIND_MASK = 3 << 0,
113 GF_OMP_TARGET_KIND_REGION = 0 << 0,
114 GF_OMP_TARGET_KIND_DATA = 1 << 0,
115 GF_OMP_TARGET_KIND_UPDATE = 2 << 0,
117 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
118 a thread synchronization via some sort of barrier. The exact barrier
119 that would otherwise be emitted is dependent on the OMP statement with
120 which this return is associated. */
121 GF_OMP_RETURN_NOWAIT = 1 << 0,
123 GF_OMP_SECTION_LAST = 1 << 0,
124 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
125 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
126 GF_PREDICT_TAKEN = 1 << 15
129 /* Currently, there are only two types of gimple debug stmt. Others are
130 envisioned, for example, to enable the generation of is_stmt notes
131 in line number information, to mark sequence points, etc. This
132 subcode is to be used to tell them apart. */
133 enum gimple_debug_subcode {
134 GIMPLE_DEBUG_BIND = 0,
135 GIMPLE_DEBUG_SOURCE_BIND = 1
138 /* Masks for selecting a pass local flag (PLF) to work on. These
139 masks are used by gimple_set_plf and gimple_plf. */
140 enum plf_mask {
141 GF_PLF_1 = 1 << 0,
142 GF_PLF_2 = 1 << 1
145 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
146 are for 64 bit hosts. */
148 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
149 /* [ WORD 1 ]
150 Main identifying code for a tuple. */
151 ENUM_BITFIELD(gimple_code) code : 8;
153 /* Nonzero if a warning should not be emitted on this tuple. */
154 unsigned int no_warning : 1;
156 /* Nonzero if this tuple has been visited. Passes are responsible
157 for clearing this bit before using it. */
158 unsigned int visited : 1;
160 /* Nonzero if this tuple represents a non-temporal move. */
161 unsigned int nontemporal_move : 1;
163 /* Pass local flags. These flags are free for any pass to use as
164 they see fit. Passes should not assume that these flags contain
165 any useful value when the pass starts. Any initial state that
166 the pass requires should be set on entry to the pass. See
167 gimple_set_plf and gimple_plf for usage. */
168 unsigned int plf : 2;
170 /* Nonzero if this statement has been modified and needs to have its
171 operands rescanned. */
172 unsigned modified : 1;
174 /* Nonzero if this statement contains volatile operands. */
175 unsigned has_volatile_ops : 1;
177 /* The SUBCODE field can be used for tuple-specific flags for tuples
178 that do not require subcodes. Note that SUBCODE should be at
179 least as wide as tree codes, as several tuples store tree codes
180 in there. */
181 unsigned int subcode : 16;
183 /* UID of this statement. This is used by passes that want to
184 assign IDs to statements. It must be assigned and used by each
185 pass. By default it should be assumed to contain garbage. */
186 unsigned uid;
188 /* [ WORD 2 ]
189 Locus information for debug info. */
190 location_t location;
192 /* Number of operands in this tuple. */
193 unsigned num_ops;
195 /* [ WORD 3 ]
196 Basic block holding this statement. */
197 basic_block bb;
199 /* [ WORD 4-5 ]
200 Linked lists of gimple statements. The next pointers form
201 a NULL terminated list, the prev pointers are a cyclic list.
202 A gimple statement is hence also a double-ended list of
203 statements, with the pointer itself being the first element,
204 and the prev pointer being the last. */
205 gimple next;
206 gimple GTY((skip)) prev;
210 /* Base structure for tuples with operands. */
212 struct GTY(()) gimple_statement_with_ops_base
214 /* [ WORD 1-6 ] */
215 struct gimple_statement_base gsbase;
217 /* [ WORD 7 ]
218 SSA operand vectors. NOTE: It should be possible to
219 amalgamate these vectors with the operand vector OP. However,
220 the SSA operand vectors are organized differently and contain
221 more information (like immediate use chaining). */
222 struct use_optype_d GTY((skip (""))) *use_ops;
226 /* Statements that take register operands. */
228 struct GTY(()) gimple_statement_with_ops
230 /* [ WORD 1-7 ] */
231 struct gimple_statement_with_ops_base opbase;
233 /* [ WORD 8 ]
234 Operand vector. NOTE! This must always be the last field
235 of this structure. In particular, this means that this
236 structure cannot be embedded inside another one. */
237 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
241 /* Base for statements that take both memory and register operands. */
243 struct GTY(()) gimple_statement_with_memory_ops_base
245 /* [ WORD 1-7 ] */
246 struct gimple_statement_with_ops_base opbase;
248 /* [ WORD 8-9 ]
249 Virtual operands for this statement. The GC will pick them
250 up via the ssa_names array. */
251 tree GTY((skip (""))) vdef;
252 tree GTY((skip (""))) vuse;
256 /* Statements that take both memory and register operands. */
258 struct GTY(()) gimple_statement_with_memory_ops
260 /* [ WORD 1-9 ] */
261 struct gimple_statement_with_memory_ops_base membase;
263 /* [ WORD 10 ]
264 Operand vector. NOTE! This must always be the last field
265 of this structure. In particular, this means that this
266 structure cannot be embedded inside another one. */
267 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
271 /* Call statements that take both memory and register operands. */
273 struct GTY(()) gimple_statement_call
275 /* [ WORD 1-9 ] */
276 struct gimple_statement_with_memory_ops_base membase;
278 /* [ WORD 10-13 ] */
279 struct pt_solution call_used;
280 struct pt_solution call_clobbered;
282 /* [ WORD 14 ] */
283 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
284 tree GTY ((tag ("0"))) fntype;
285 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
286 } u;
288 /* [ WORD 15 ]
289 Operand vector. NOTE! This must always be the last field
290 of this structure. In particular, this means that this
291 structure cannot be embedded inside another one. */
292 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
296 /* OpenMP statements (#pragma omp). */
298 struct GTY(()) gimple_statement_omp {
299 /* [ WORD 1-6 ] */
300 struct gimple_statement_base gsbase;
302 /* [ WORD 7 ] */
303 gimple_seq body;
307 /* GIMPLE_BIND */
309 struct GTY(()) gimple_statement_bind {
310 /* [ WORD 1-6 ] */
311 struct gimple_statement_base gsbase;
313 /* [ WORD 7 ]
314 Variables declared in this scope. */
315 tree vars;
317 /* [ WORD 8 ]
318 This is different than the BLOCK field in gimple_statement_base,
319 which is analogous to TREE_BLOCK (i.e., the lexical block holding
320 this statement). This field is the equivalent of BIND_EXPR_BLOCK
321 in tree land (i.e., the lexical scope defined by this bind). See
322 gimple-low.c. */
323 tree block;
325 /* [ WORD 9 ] */
326 gimple_seq body;
330 /* GIMPLE_CATCH */
332 struct GTY(()) gimple_statement_catch {
333 /* [ WORD 1-6 ] */
334 struct gimple_statement_base gsbase;
336 /* [ WORD 7 ] */
337 tree types;
339 /* [ WORD 8 ] */
340 gimple_seq handler;
344 /* GIMPLE_EH_FILTER */
346 struct GTY(()) gimple_statement_eh_filter {
347 /* [ WORD 1-6 ] */
348 struct gimple_statement_base gsbase;
350 /* [ WORD 7 ]
351 Filter types. */
352 tree types;
354 /* [ WORD 8 ]
355 Failure actions. */
356 gimple_seq failure;
359 /* GIMPLE_EH_ELSE */
361 struct GTY(()) gimple_statement_eh_else {
362 /* [ WORD 1-6 ] */
363 struct gimple_statement_base gsbase;
365 /* [ WORD 7,8 ] */
366 gimple_seq n_body, e_body;
369 /* GIMPLE_EH_MUST_NOT_THROW */
371 struct GTY(()) gimple_statement_eh_mnt {
372 /* [ WORD 1-6 ] */
373 struct gimple_statement_base gsbase;
375 /* [ WORD 7 ] Abort function decl. */
376 tree fndecl;
379 /* GIMPLE_PHI */
381 struct GTY(()) gimple_statement_phi {
382 /* [ WORD 1-6 ] */
383 struct gimple_statement_base gsbase;
385 /* [ WORD 7 ] */
386 unsigned capacity;
387 unsigned nargs;
389 /* [ WORD 8 ] */
390 tree result;
392 /* [ WORD 9 ] */
393 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
397 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
399 struct GTY(()) gimple_statement_eh_ctrl
401 /* [ WORD 1-6 ] */
402 struct gimple_statement_base gsbase;
404 /* [ WORD 7 ]
405 Exception region number. */
406 int region;
410 /* GIMPLE_TRY */
412 struct GTY(()) gimple_statement_try {
413 /* [ WORD 1-6 ] */
414 struct gimple_statement_base gsbase;
416 /* [ WORD 7 ]
417 Expression to evaluate. */
418 gimple_seq eval;
420 /* [ WORD 8 ]
421 Cleanup expression. */
422 gimple_seq cleanup;
425 /* Kind of GIMPLE_TRY statements. */
426 enum gimple_try_flags
428 /* A try/catch. */
429 GIMPLE_TRY_CATCH = 1 << 0,
431 /* A try/finally. */
432 GIMPLE_TRY_FINALLY = 1 << 1,
433 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
435 /* Analogous to TRY_CATCH_IS_CLEANUP. */
436 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
439 /* GIMPLE_WITH_CLEANUP_EXPR */
441 struct GTY(()) gimple_statement_wce {
442 /* [ WORD 1-6 ] */
443 struct gimple_statement_base gsbase;
445 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
446 executed if an exception is thrown, not on normal exit of its
447 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
448 in TARGET_EXPRs. */
450 /* [ WORD 7 ]
451 Cleanup expression. */
452 gimple_seq cleanup;
456 /* GIMPLE_ASM */
458 struct GTY(()) gimple_statement_asm
460 /* [ WORD 1-9 ] */
461 struct gimple_statement_with_memory_ops_base membase;
463 /* [ WORD 10 ]
464 __asm__ statement. */
465 const char *string;
467 /* [ WORD 11 ]
468 Number of inputs, outputs, clobbers, labels. */
469 unsigned char ni;
470 unsigned char no;
471 unsigned char nc;
472 unsigned char nl;
474 /* [ WORD 12 ]
475 Operand vector. NOTE! This must always be the last field
476 of this structure. In particular, this means that this
477 structure cannot be embedded inside another one. */
478 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
481 /* GIMPLE_OMP_CRITICAL */
483 struct GTY(()) gimple_statement_omp_critical {
484 /* [ WORD 1-7 ] */
485 struct gimple_statement_omp omp;
487 /* [ WORD 8 ]
488 Critical section name. */
489 tree name;
493 struct GTY(()) gimple_omp_for_iter {
494 /* Condition code. */
495 enum tree_code cond;
497 /* Index variable. */
498 tree index;
500 /* Initial value. */
501 tree initial;
503 /* Final value. */
504 tree final;
506 /* Increment. */
507 tree incr;
510 /* GIMPLE_OMP_FOR */
512 struct GTY(()) gimple_statement_omp_for {
513 /* [ WORD 1-7 ] */
514 struct gimple_statement_omp omp;
516 /* [ WORD 8 ] */
517 tree clauses;
519 /* [ WORD 9 ]
520 Number of elements in iter array. */
521 size_t collapse;
523 /* [ WORD 10 ] */
524 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
526 /* [ WORD 11 ]
527 Pre-body evaluated before the loop body begins. */
528 gimple_seq pre_body;
532 /* GIMPLE_OMP_PARALLEL */
534 struct GTY(()) gimple_statement_omp_parallel {
535 /* [ WORD 1-7 ] */
536 struct gimple_statement_omp omp;
538 /* [ WORD 8 ]
539 Clauses. */
540 tree clauses;
542 /* [ WORD 9 ]
543 Child function holding the body of the parallel region. */
544 tree child_fn;
546 /* [ WORD 10 ]
547 Shared data argument. */
548 tree data_arg;
552 /* GIMPLE_OMP_TASK */
554 struct GTY(()) gimple_statement_omp_task {
555 /* [ WORD 1-10 ] */
556 struct gimple_statement_omp_parallel par;
558 /* [ WORD 11 ]
559 Child function holding firstprivate initialization if needed. */
560 tree copy_fn;
562 /* [ WORD 12-13 ]
563 Size and alignment in bytes of the argument data block. */
564 tree arg_size;
565 tree arg_align;
569 /* GIMPLE_OMP_SECTION */
570 /* Uses struct gimple_statement_omp. */
573 /* GIMPLE_OMP_SECTIONS */
575 struct GTY(()) gimple_statement_omp_sections {
576 /* [ WORD 1-7 ] */
577 struct gimple_statement_omp omp;
579 /* [ WORD 8 ] */
580 tree clauses;
582 /* [ WORD 9 ]
583 The control variable used for deciding which of the sections to
584 execute. */
585 tree control;
588 /* GIMPLE_OMP_CONTINUE.
590 Note: This does not inherit from gimple_statement_omp, because we
591 do not need the body field. */
593 struct GTY(()) gimple_statement_omp_continue {
594 /* [ WORD 1-6 ] */
595 struct gimple_statement_base gsbase;
597 /* [ WORD 7 ] */
598 tree control_def;
600 /* [ WORD 8 ] */
601 tree control_use;
604 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS */
606 struct GTY(()) gimple_statement_omp_single {
607 /* [ WORD 1-7 ] */
608 struct gimple_statement_omp omp;
610 /* [ WORD 7 ] */
611 tree clauses;
615 /* GIMPLE_OMP_ATOMIC_LOAD.
616 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
617 contains a sequence, which we don't need here. */
619 struct GTY(()) gimple_statement_omp_atomic_load {
620 /* [ WORD 1-6 ] */
621 struct gimple_statement_base gsbase;
623 /* [ WORD 7-8 ] */
624 tree rhs, lhs;
627 /* GIMPLE_OMP_ATOMIC_STORE.
628 See note on GIMPLE_OMP_ATOMIC_LOAD. */
630 struct GTY(()) gimple_statement_omp_atomic_store {
631 /* [ WORD 1-6 ] */
632 struct gimple_statement_base gsbase;
634 /* [ WORD 7 ] */
635 tree val;
638 /* GIMPLE_TRANSACTION. */
640 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
642 /* The __transaction_atomic was declared [[outer]] or it is
643 __transaction_relaxed. */
644 #define GTMA_IS_OUTER (1u << 0)
645 #define GTMA_IS_RELAXED (1u << 1)
646 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
648 /* The transaction is seen to not have an abort. */
649 #define GTMA_HAVE_ABORT (1u << 2)
650 /* The transaction is seen to have loads or stores. */
651 #define GTMA_HAVE_LOAD (1u << 3)
652 #define GTMA_HAVE_STORE (1u << 4)
653 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
654 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
655 /* The transaction WILL enter serial irrevocable mode.
656 An irrevocable block post-dominates the entire transaction, such
657 that all invocations of the transaction will go serial-irrevocable.
658 In such case, we don't bother instrumenting the transaction, and
659 tell the runtime that it should begin the transaction in
660 serial-irrevocable mode. */
661 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
662 /* The transaction contains no instrumentation code whatsover, most
663 likely because it is guaranteed to go irrevocable upon entry. */
664 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
666 struct GTY(()) gimple_statement_transaction
668 /* [ WORD 1-9 ] */
669 struct gimple_statement_with_memory_ops_base gsbase;
671 /* [ WORD 10 ] */
672 gimple_seq body;
674 /* [ WORD 11 ] */
675 tree label;
678 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
679 enum gimple_statement_structure_enum {
680 #include "gsstruct.def"
681 LAST_GSS_ENUM
683 #undef DEFGSSTRUCT
686 /* Define the overall contents of a gimple tuple. It may be any of the
687 structures declared above for various types of tuples. */
689 union GTY ((desc ("gimple_statement_structure (&%h)"),
690 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
691 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
692 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
693 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
694 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
695 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
696 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
697 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
698 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
699 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
700 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
701 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
702 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
703 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
704 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
705 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
706 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
707 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
708 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
709 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
710 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
711 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
712 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
713 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
714 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
715 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
716 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
719 /* Offset in bytes to the location of the operand vector.
720 Zero if there is no operand vector for this tuple structure. */
721 extern size_t const gimple_ops_offset_[];
723 /* Map GIMPLE codes to GSS codes. */
724 extern enum gimple_statement_structure_enum const gss_for_code_[];
726 /* This variable holds the currently expanded gimple statement for purposes
727 of comminucating the profile info to the builtin expanders. */
728 extern gimple currently_expanding_gimple_stmt;
730 gimple gimple_build_return (tree);
732 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
733 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
735 gimple
736 gimple_build_assign_with_ops (enum tree_code, tree,
737 tree, tree CXX_MEM_STAT_INFO);
738 gimple
739 gimple_build_assign_with_ops (enum tree_code, tree,
740 tree, tree, tree CXX_MEM_STAT_INFO);
742 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
743 #define gimple_build_debug_bind(var,val,stmt) \
744 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
745 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
746 #define gimple_build_debug_source_bind(var,val,stmt) \
747 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
749 gimple gimple_build_call_vec (tree, vec<tree> );
750 gimple gimple_build_call (tree, unsigned, ...);
751 gimple gimple_build_call_valist (tree, unsigned, va_list);
752 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
753 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
754 gimple gimple_build_call_from_tree (tree);
755 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
756 gimple gimple_build_label (tree label);
757 gimple gimple_build_goto (tree dest);
758 gimple gimple_build_nop (void);
759 gimple gimple_build_bind (tree, gimple_seq, tree);
760 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
761 vec<tree, va_gc> *, vec<tree, va_gc> *,
762 vec<tree, va_gc> *);
763 gimple gimple_build_catch (tree, gimple_seq);
764 gimple gimple_build_eh_filter (tree, gimple_seq);
765 gimple gimple_build_eh_must_not_throw (tree);
766 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
767 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
768 gimple gimple_build_wce (gimple_seq);
769 gimple gimple_build_resx (int);
770 gimple gimple_build_eh_dispatch (int);
771 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
772 gimple gimple_build_switch (tree, tree, vec<tree> );
773 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
774 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
775 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
776 gimple gimple_build_omp_critical (gimple_seq, tree);
777 gimple gimple_build_omp_section (gimple_seq);
778 gimple gimple_build_omp_continue (tree, tree);
779 gimple gimple_build_omp_master (gimple_seq);
780 gimple gimple_build_omp_taskgroup (gimple_seq);
781 gimple gimple_build_omp_return (bool);
782 gimple gimple_build_omp_ordered (gimple_seq);
783 gimple gimple_build_omp_sections (gimple_seq, tree);
784 gimple gimple_build_omp_sections_switch (void);
785 gimple gimple_build_omp_single (gimple_seq, tree);
786 gimple gimple_build_omp_target (gimple_seq, int, tree);
787 gimple gimple_build_omp_teams (gimple_seq, tree);
788 gimple gimple_build_cdt (tree, tree);
789 gimple gimple_build_omp_atomic_load (tree, tree);
790 gimple gimple_build_omp_atomic_store (tree);
791 gimple gimple_build_transaction (gimple_seq, tree);
792 gimple gimple_build_predict (enum br_predictor, enum prediction);
793 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
794 gimple_seq gimple_seq_alloc (void);
795 void gimple_seq_free (gimple_seq);
796 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
797 gimple_seq gimple_seq_copy (gimple_seq);
798 bool gimple_call_same_target_p (const_gimple, const_gimple);
799 int gimple_call_flags (const_gimple);
800 int gimple_call_return_flags (const_gimple);
801 int gimple_call_arg_flags (const_gimple, unsigned);
802 void gimple_call_reset_alias_info (gimple);
803 bool gimple_assign_copy_p (gimple);
804 bool gimple_assign_ssa_name_copy_p (gimple);
805 bool gimple_assign_unary_nop_p (gimple);
806 void gimple_set_bb (gimple, basic_block);
807 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
808 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
809 tree, tree, tree);
810 tree gimple_get_lhs (const_gimple);
811 void gimple_set_lhs (gimple, tree);
812 void gimple_replace_lhs (gimple, tree);
813 gimple gimple_copy (gimple);
814 gimple gimple_build_cond_from_tree (tree, tree, tree);
815 void gimple_cond_set_condition_from_tree (gimple, tree);
816 bool gimple_has_side_effects (const_gimple);
817 bool gimple_could_trap_p (gimple);
818 bool gimple_could_trap_p_1 (gimple, bool, bool);
819 bool gimple_assign_rhs_could_trap_p (gimple);
820 bool empty_body_p (gimple_seq);
821 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
822 location_t);
823 extern void annotate_all_with_location (gimple_seq, location_t);
824 unsigned get_gimple_rhs_num_ops (enum tree_code);
825 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
826 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
828 /* Return TRUE iff stmt is a call to a built-in function. */
829 extern bool is_gimple_builtin_call (gimple stmt);
831 extern void recalculate_side_effects (tree);
832 extern bool gimple_compare_field_offset (tree, tree);
833 extern tree gimple_unsigned_type (tree);
834 extern tree gimple_signed_type (tree);
835 extern alias_set_type gimple_get_alias_set (tree);
836 extern bool gimple_ior_addresses_taken (bitmap, gimple);
837 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
838 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
839 extern bool gimple_asm_clobbers_memory_p (const_gimple);
840 extern unsigned gimple_call_get_nobnd_arg_index (const_gimple, unsigned);
842 /* Formal (expression) temporary table handling: multiple occurrences of
843 the same scalar expression are evaluated into the same temporary. */
845 typedef struct gimple_temp_hash_elt
847 tree val; /* Key */
848 tree temp; /* Value */
849 } elt_t;
851 /* Get the number of the next statement uid to be allocated. */
852 static inline unsigned int
853 gimple_stmt_max_uid (struct function *fn)
855 return fn->last_stmt_uid;
858 /* Set the number of the next statement uid to be allocated. */
859 static inline void
860 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
862 fn->last_stmt_uid = maxid;
865 /* Set the number of the next statement uid to be allocated. */
866 static inline unsigned int
867 inc_gimple_stmt_max_uid (struct function *fn)
869 return fn->last_stmt_uid++;
872 /* Miscellaneous helpers. */
873 extern tree canonicalize_cond_expr_cond (tree);
874 extern void dump_decl_set (FILE *, bitmap);
875 extern bool nonfreeing_call_p (gimple);
876 extern bool infer_nonnull_range (gimple, tree);
878 /* In trans-mem.c. */
879 extern void diagnose_tm_safe_errors (tree);
880 extern void compute_transaction_bits (void);
881 extern bool is_tm_ending (gimple);
883 /* In tree-nested.c. */
884 extern void lower_nested_functions (tree);
885 extern void insert_field_into_struct (tree, tree);
887 /* In cfgexpand.c. */
888 extern tree gimple_assign_rhs_to_tree (gimple);
890 /* In builtins.c */
891 extern bool validate_gimple_arglist (const_gimple, ...);
893 /* Return the first node in GIMPLE sequence S. */
895 static inline gimple_seq_node
896 gimple_seq_first (gimple_seq s)
898 return s;
902 /* Return the first statement in GIMPLE sequence S. */
904 static inline gimple
905 gimple_seq_first_stmt (gimple_seq s)
907 gimple_seq_node n = gimple_seq_first (s);
908 return n;
912 /* Return the last node in GIMPLE sequence S. */
914 static inline gimple_seq_node
915 gimple_seq_last (gimple_seq s)
917 return s ? s->gsbase.prev : NULL;
921 /* Return the last statement in GIMPLE sequence S. */
923 static inline gimple
924 gimple_seq_last_stmt (gimple_seq s)
926 gimple_seq_node n = gimple_seq_last (s);
927 return n;
931 /* Set the last node in GIMPLE sequence *PS to LAST. */
933 static inline void
934 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
936 (*ps)->gsbase.prev = last;
940 /* Set the first node in GIMPLE sequence *PS to FIRST. */
942 static inline void
943 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
945 *ps = first;
949 /* Return true if GIMPLE sequence S is empty. */
951 static inline bool
952 gimple_seq_empty_p (gimple_seq s)
954 return s == NULL;
957 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
958 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
960 /* Allocate a new sequence and initialize its first element with STMT. */
962 static inline gimple_seq
963 gimple_seq_alloc_with_stmt (gimple stmt)
965 gimple_seq seq = NULL;
966 gimple_seq_add_stmt (&seq, stmt);
967 return seq;
971 /* Returns the sequence of statements in BB. */
973 static inline gimple_seq
974 bb_seq (const_basic_block bb)
976 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
979 static inline gimple_seq *
980 bb_seq_addr (basic_block bb)
982 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
985 /* Sets the sequence of statements in BB to SEQ. */
987 static inline void
988 set_bb_seq (basic_block bb, gimple_seq seq)
990 gcc_checking_assert (!(bb->flags & BB_RTL));
991 bb->il.gimple.seq = seq;
995 /* Return the code for GIMPLE statement G. */
997 static inline enum gimple_code
998 gimple_code (const_gimple g)
1000 return g->gsbase.code;
1004 /* Return the GSS code used by a GIMPLE code. */
1006 static inline enum gimple_statement_structure_enum
1007 gss_for_code (enum gimple_code code)
1009 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1010 return gss_for_code_[code];
1014 /* Return which GSS code is used by GS. */
1016 static inline enum gimple_statement_structure_enum
1017 gimple_statement_structure (gimple gs)
1019 return gss_for_code (gimple_code (gs));
1023 /* Return true if statement G has sub-statements. This is only true for
1024 High GIMPLE statements. */
1026 static inline bool
1027 gimple_has_substatements (gimple g)
1029 switch (gimple_code (g))
1031 case GIMPLE_BIND:
1032 case GIMPLE_CATCH:
1033 case GIMPLE_EH_FILTER:
1034 case GIMPLE_EH_ELSE:
1035 case GIMPLE_TRY:
1036 case GIMPLE_OMP_FOR:
1037 case GIMPLE_OMP_MASTER:
1038 case GIMPLE_OMP_TASKGROUP:
1039 case GIMPLE_OMP_ORDERED:
1040 case GIMPLE_OMP_SECTION:
1041 case GIMPLE_OMP_PARALLEL:
1042 case GIMPLE_OMP_TASK:
1043 case GIMPLE_OMP_SECTIONS:
1044 case GIMPLE_OMP_SINGLE:
1045 case GIMPLE_OMP_TARGET:
1046 case GIMPLE_OMP_TEAMS:
1047 case GIMPLE_OMP_CRITICAL:
1048 case GIMPLE_WITH_CLEANUP_EXPR:
1049 case GIMPLE_TRANSACTION:
1050 return true;
1052 default:
1053 return false;
1058 /* Return the basic block holding statement G. */
1060 static inline basic_block
1061 gimple_bb (const_gimple g)
1063 return g->gsbase.bb;
1067 /* Return the lexical scope block holding statement G. */
1069 static inline tree
1070 gimple_block (const_gimple g)
1072 return LOCATION_BLOCK (g->gsbase.location);
1076 /* Set BLOCK to be the lexical scope block holding statement G. */
1078 static inline void
1079 gimple_set_block (gimple g, tree block)
1081 if (block)
1082 g->gsbase.location =
1083 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1084 else
1085 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1089 /* Return location information for statement G. */
1091 static inline location_t
1092 gimple_location (const_gimple g)
1094 return g->gsbase.location;
1097 /* Return pointer to location information for statement G. */
1099 static inline const location_t *
1100 gimple_location_ptr (const_gimple g)
1102 return &g->gsbase.location;
1106 /* Set location information for statement G. */
1108 static inline void
1109 gimple_set_location (gimple g, location_t location)
1111 g->gsbase.location = location;
1115 /* Return true if G contains location information. */
1117 static inline bool
1118 gimple_has_location (const_gimple g)
1120 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1124 /* Return the file name of the location of STMT. */
1126 static inline const char *
1127 gimple_filename (const_gimple stmt)
1129 return LOCATION_FILE (gimple_location (stmt));
1133 /* Return the line number of the location of STMT. */
1135 static inline int
1136 gimple_lineno (const_gimple stmt)
1138 return LOCATION_LINE (gimple_location (stmt));
1142 /* Determine whether SEQ is a singleton. */
1144 static inline bool
1145 gimple_seq_singleton_p (gimple_seq seq)
1147 return ((gimple_seq_first (seq) != NULL)
1148 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1151 /* Return true if no warnings should be emitted for statement STMT. */
1153 static inline bool
1154 gimple_no_warning_p (const_gimple stmt)
1156 return stmt->gsbase.no_warning;
1159 /* Set the no_warning flag of STMT to NO_WARNING. */
1161 static inline void
1162 gimple_set_no_warning (gimple stmt, bool no_warning)
1164 stmt->gsbase.no_warning = (unsigned) no_warning;
1167 /* Set the visited status on statement STMT to VISITED_P. */
1169 static inline void
1170 gimple_set_visited (gimple stmt, bool visited_p)
1172 stmt->gsbase.visited = (unsigned) visited_p;
1176 /* Return the visited status for statement STMT. */
1178 static inline bool
1179 gimple_visited_p (gimple stmt)
1181 return stmt->gsbase.visited;
1185 /* Set pass local flag PLF on statement STMT to VAL_P. */
1187 static inline void
1188 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1190 if (val_p)
1191 stmt->gsbase.plf |= (unsigned int) plf;
1192 else
1193 stmt->gsbase.plf &= ~((unsigned int) plf);
1197 /* Return the value of pass local flag PLF on statement STMT. */
1199 static inline unsigned int
1200 gimple_plf (gimple stmt, enum plf_mask plf)
1202 return stmt->gsbase.plf & ((unsigned int) plf);
1206 /* Set the UID of statement. */
1208 static inline void
1209 gimple_set_uid (gimple g, unsigned uid)
1211 g->gsbase.uid = uid;
1215 /* Return the UID of statement. */
1217 static inline unsigned
1218 gimple_uid (const_gimple g)
1220 return g->gsbase.uid;
1224 /* Make statement G a singleton sequence. */
1226 static inline void
1227 gimple_init_singleton (gimple g)
1229 g->gsbase.next = NULL;
1230 g->gsbase.prev = g;
1234 /* Return true if GIMPLE statement G has register or memory operands. */
1236 static inline bool
1237 gimple_has_ops (const_gimple g)
1239 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1243 /* Return true if GIMPLE statement G has memory operands. */
1245 static inline bool
1246 gimple_has_mem_ops (const_gimple g)
1248 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1252 /* Return the set of USE operands for statement G. */
1254 static inline struct use_optype_d *
1255 gimple_use_ops (const_gimple g)
1257 if (!gimple_has_ops (g))
1258 return NULL;
1259 return g->gsops.opbase.use_ops;
1263 /* Set USE to be the set of USE operands for statement G. */
1265 static inline void
1266 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1268 gcc_gimple_checking_assert (gimple_has_ops (g));
1269 g->gsops.opbase.use_ops = use;
1273 /* Return the single VUSE operand of the statement G. */
1275 static inline tree
1276 gimple_vuse (const_gimple g)
1278 if (!gimple_has_mem_ops (g))
1279 return NULL_TREE;
1280 return g->gsmembase.vuse;
1283 /* Return the single VDEF operand of the statement G. */
1285 static inline tree
1286 gimple_vdef (const_gimple g)
1288 if (!gimple_has_mem_ops (g))
1289 return NULL_TREE;
1290 return g->gsmembase.vdef;
1293 /* Return the single VUSE operand of the statement G. */
1295 static inline tree *
1296 gimple_vuse_ptr (gimple g)
1298 if (!gimple_has_mem_ops (g))
1299 return NULL;
1300 return &g->gsmembase.vuse;
1303 /* Return the single VDEF operand of the statement G. */
1305 static inline tree *
1306 gimple_vdef_ptr (gimple g)
1308 if (!gimple_has_mem_ops (g))
1309 return NULL;
1310 return &g->gsmembase.vdef;
1313 /* Set the single VUSE operand of the statement G. */
1315 static inline void
1316 gimple_set_vuse (gimple g, tree vuse)
1318 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1319 g->gsmembase.vuse = vuse;
1322 /* Set the single VDEF operand of the statement G. */
1324 static inline void
1325 gimple_set_vdef (gimple g, tree vdef)
1327 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1328 g->gsmembase.vdef = vdef;
1332 /* Return true if statement G has operands and the modified field has
1333 been set. */
1335 static inline bool
1336 gimple_modified_p (const_gimple g)
1338 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1342 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1343 a MODIFIED field. */
1345 static inline void
1346 gimple_set_modified (gimple s, bool modifiedp)
1348 if (gimple_has_ops (s))
1349 s->gsbase.modified = (unsigned) modifiedp;
1353 /* Return the tree code for the expression computed by STMT. This is
1354 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1355 GIMPLE_CALL, return CALL_EXPR as the expression code for
1356 consistency. This is useful when the caller needs to deal with the
1357 three kinds of computation that GIMPLE supports. */
1359 static inline enum tree_code
1360 gimple_expr_code (const_gimple stmt)
1362 enum gimple_code code = gimple_code (stmt);
1363 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1364 return (enum tree_code) stmt->gsbase.subcode;
1365 else
1367 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1368 return CALL_EXPR;
1373 /* Return true if statement STMT contains volatile operands. */
1375 static inline bool
1376 gimple_has_volatile_ops (const_gimple stmt)
1378 if (gimple_has_mem_ops (stmt))
1379 return stmt->gsbase.has_volatile_ops;
1380 else
1381 return false;
1385 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1387 static inline void
1388 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1390 if (gimple_has_mem_ops (stmt))
1391 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1394 /* Return true if STMT is in a transaction. */
1396 static inline bool
1397 gimple_in_transaction (gimple stmt)
1399 return bb_in_transaction (gimple_bb (stmt));
1402 /* Return true if statement STMT may access memory. */
1404 static inline bool
1405 gimple_references_memory_p (gimple stmt)
1407 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1411 /* Return the subcode for OMP statement S. */
1413 static inline unsigned
1414 gimple_omp_subcode (const_gimple s)
1416 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1417 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1418 return s->gsbase.subcode;
1421 /* Set the subcode for OMP statement S to SUBCODE. */
1423 static inline void
1424 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1426 /* We only have 16 bits for the subcode. Assert that we are not
1427 overflowing it. */
1428 gcc_gimple_checking_assert (subcode < (1 << 16));
1429 s->gsbase.subcode = subcode;
1432 /* Set the nowait flag on OMP_RETURN statement S. */
1434 static inline void
1435 gimple_omp_return_set_nowait (gimple s)
1437 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1438 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1442 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1443 flag set. */
1445 static inline bool
1446 gimple_omp_return_nowait_p (const_gimple g)
1448 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1449 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1453 /* Set the LHS of OMP return. */
1455 static inline void
1456 gimple_omp_return_set_lhs (gimple g, tree lhs)
1458 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1459 g->gimple_omp_atomic_store.val = lhs;
1463 /* Get the LHS of OMP return. */
1465 static inline tree
1466 gimple_omp_return_lhs (const_gimple g)
1468 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1469 return g->gimple_omp_atomic_store.val;
1473 /* Return a pointer to the LHS of OMP return. */
1475 static inline tree *
1476 gimple_omp_return_lhs_ptr (gimple g)
1478 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1479 return &g->gimple_omp_atomic_store.val;
1483 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1484 flag set. */
1486 static inline bool
1487 gimple_omp_section_last_p (const_gimple g)
1489 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1490 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1494 /* Set the GF_OMP_SECTION_LAST flag on G. */
1496 static inline void
1497 gimple_omp_section_set_last (gimple g)
1499 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1500 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1504 /* Return true if OMP parallel statement G has the
1505 GF_OMP_PARALLEL_COMBINED flag set. */
1507 static inline bool
1508 gimple_omp_parallel_combined_p (const_gimple g)
1510 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1511 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1515 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1516 value of COMBINED_P. */
1518 static inline void
1519 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1521 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1522 if (combined_p)
1523 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1524 else
1525 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1529 /* Return true if OMP atomic load/store statement G has the
1530 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1532 static inline bool
1533 gimple_omp_atomic_need_value_p (const_gimple g)
1535 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1536 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1537 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1541 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1543 static inline void
1544 gimple_omp_atomic_set_need_value (gimple g)
1546 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1547 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1548 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1552 /* Return true if OMP atomic load/store statement G has the
1553 GF_OMP_ATOMIC_SEQ_CST flag set. */
1555 static inline bool
1556 gimple_omp_atomic_seq_cst_p (const_gimple g)
1558 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1559 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1560 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
1564 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
1566 static inline void
1567 gimple_omp_atomic_set_seq_cst (gimple g)
1569 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1570 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1571 g->gsbase.subcode |= GF_OMP_ATOMIC_SEQ_CST;
1575 /* Return the number of operands for statement GS. */
1577 static inline unsigned
1578 gimple_num_ops (const_gimple gs)
1580 return gs->gsbase.num_ops;
1584 /* Set the number of operands for statement GS. */
1586 static inline void
1587 gimple_set_num_ops (gimple gs, unsigned num_ops)
1589 gs->gsbase.num_ops = num_ops;
1593 /* Return the array of operands for statement GS. */
1595 static inline tree *
1596 gimple_ops (gimple gs)
1598 size_t off;
1600 /* All the tuples have their operand vector at the very bottom
1601 of the structure. Note that those structures that do not
1602 have an operand vector have a zero offset. */
1603 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1604 gcc_gimple_checking_assert (off != 0);
1606 return (tree *) ((char *) gs + off);
1610 /* Return operand I for statement GS. */
1612 static inline tree
1613 gimple_op (const_gimple gs, unsigned i)
1615 if (gimple_has_ops (gs))
1617 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1618 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1620 else
1621 return NULL_TREE;
1624 /* Return a pointer to operand I for statement GS. */
1626 static inline tree *
1627 gimple_op_ptr (const_gimple gs, unsigned i)
1629 if (gimple_has_ops (gs))
1631 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1632 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1634 else
1635 return NULL;
1638 /* Set operand I of statement GS to OP. */
1640 static inline void
1641 gimple_set_op (gimple gs, unsigned i, tree op)
1643 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1645 /* Note. It may be tempting to assert that OP matches
1646 is_gimple_operand, but that would be wrong. Different tuples
1647 accept slightly different sets of tree operands. Each caller
1648 should perform its own validation. */
1649 gimple_ops (gs)[i] = op;
1652 /* Return true if GS is a GIMPLE_ASSIGN. */
1654 static inline bool
1655 is_gimple_assign (const_gimple gs)
1657 return gimple_code (gs) == GIMPLE_ASSIGN;
1660 /* Determine if expression CODE is one of the valid expressions that can
1661 be used on the RHS of GIMPLE assignments. */
1663 static inline enum gimple_rhs_class
1664 get_gimple_rhs_class (enum tree_code code)
1666 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1669 /* Return the LHS of assignment statement GS. */
1671 static inline tree
1672 gimple_assign_lhs (const_gimple gs)
1674 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1675 return gimple_op (gs, 0);
1679 /* Return a pointer to the LHS of assignment statement GS. */
1681 static inline tree *
1682 gimple_assign_lhs_ptr (const_gimple gs)
1684 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1685 return gimple_op_ptr (gs, 0);
1689 /* Set LHS to be the LHS operand of assignment statement GS. */
1691 static inline void
1692 gimple_assign_set_lhs (gimple gs, tree lhs)
1694 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1695 gimple_set_op (gs, 0, lhs);
1697 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1698 SSA_NAME_DEF_STMT (lhs) = gs;
1702 /* Return the first operand on the RHS of assignment statement GS. */
1704 static inline tree
1705 gimple_assign_rhs1 (const_gimple gs)
1707 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1708 return gimple_op (gs, 1);
1712 /* Return a pointer to the first operand on the RHS of assignment
1713 statement GS. */
1715 static inline tree *
1716 gimple_assign_rhs1_ptr (const_gimple gs)
1718 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1719 return gimple_op_ptr (gs, 1);
1722 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1724 static inline void
1725 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1727 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1729 gimple_set_op (gs, 1, rhs);
1733 /* Return the second operand on the RHS of assignment statement GS.
1734 If GS does not have two operands, NULL is returned instead. */
1736 static inline tree
1737 gimple_assign_rhs2 (const_gimple gs)
1739 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1741 if (gimple_num_ops (gs) >= 3)
1742 return gimple_op (gs, 2);
1743 else
1744 return NULL_TREE;
1748 /* Return a pointer to the second operand on the RHS of assignment
1749 statement GS. */
1751 static inline tree *
1752 gimple_assign_rhs2_ptr (const_gimple gs)
1754 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1755 return gimple_op_ptr (gs, 2);
1759 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1761 static inline void
1762 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1764 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1766 gimple_set_op (gs, 2, rhs);
1769 /* Return the third operand on the RHS of assignment statement GS.
1770 If GS does not have two operands, NULL is returned instead. */
1772 static inline tree
1773 gimple_assign_rhs3 (const_gimple gs)
1775 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1777 if (gimple_num_ops (gs) >= 4)
1778 return gimple_op (gs, 3);
1779 else
1780 return NULL_TREE;
1783 /* Return a pointer to the third operand on the RHS of assignment
1784 statement GS. */
1786 static inline tree *
1787 gimple_assign_rhs3_ptr (const_gimple gs)
1789 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1790 return gimple_op_ptr (gs, 3);
1794 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1796 static inline void
1797 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1799 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1801 gimple_set_op (gs, 3, rhs);
1804 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1805 to see only a maximum of two operands. */
1807 static inline void
1808 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1809 tree op1, tree op2)
1811 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1814 /* Returns true if GS is a nontemporal move. */
1816 static inline bool
1817 gimple_assign_nontemporal_move_p (const_gimple gs)
1819 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1820 return gs->gsbase.nontemporal_move;
1823 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1825 static inline void
1826 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1828 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1829 gs->gsbase.nontemporal_move = nontemporal;
1833 /* Return the code of the expression computed on the rhs of assignment
1834 statement GS. In case that the RHS is a single object, returns the
1835 tree code of the object. */
1837 static inline enum tree_code
1838 gimple_assign_rhs_code (const_gimple gs)
1840 enum tree_code code;
1841 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1843 code = (enum tree_code) gs->gsbase.subcode;
1844 /* While we initially set subcode to the TREE_CODE of the rhs for
1845 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1846 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1847 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1848 code = TREE_CODE (gimple_assign_rhs1 (gs));
1850 return code;
1854 /* Set CODE to be the code for the expression computed on the RHS of
1855 assignment S. */
1857 static inline void
1858 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1860 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1861 s->gsbase.subcode = code;
1865 /* Return the gimple rhs class of the code of the expression computed on
1866 the rhs of assignment statement GS.
1867 This will never return GIMPLE_INVALID_RHS. */
1869 static inline enum gimple_rhs_class
1870 gimple_assign_rhs_class (const_gimple gs)
1872 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1875 /* Return true if GS is an assignment with a singleton RHS, i.e.,
1876 there is no operator associated with the assignment itself.
1877 Unlike gimple_assign_copy_p, this predicate returns true for
1878 any RHS operand, including those that perform an operation
1879 and do not have the semantics of a copy, such as COND_EXPR. */
1881 static inline bool
1882 gimple_assign_single_p (gimple gs)
1884 return (is_gimple_assign (gs)
1885 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
1888 /* Return true if GS performs a store to its lhs. */
1890 static inline bool
1891 gimple_store_p (gimple gs)
1893 tree lhs = gimple_get_lhs (gs);
1894 return lhs && !is_gimple_reg (lhs);
1897 /* Return true if GS is an assignment that loads from its rhs1. */
1899 static inline bool
1900 gimple_assign_load_p (gimple gs)
1902 tree rhs;
1903 if (!gimple_assign_single_p (gs))
1904 return false;
1905 rhs = gimple_assign_rhs1 (gs);
1906 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
1907 return true;
1908 rhs = get_base_address (rhs);
1909 return (DECL_P (rhs)
1910 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
1914 /* Return true if S is a type-cast assignment. */
1916 static inline bool
1917 gimple_assign_cast_p (gimple s)
1919 if (is_gimple_assign (s))
1921 enum tree_code sc = gimple_assign_rhs_code (s);
1922 return CONVERT_EXPR_CODE_P (sc)
1923 || sc == VIEW_CONVERT_EXPR
1924 || sc == FIX_TRUNC_EXPR;
1927 return false;
1930 /* Return true if S is a clobber statement. */
1932 static inline bool
1933 gimple_clobber_p (gimple s)
1935 return gimple_assign_single_p (s)
1936 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
1939 /* Return true if GS is a GIMPLE_CALL. */
1941 static inline bool
1942 is_gimple_call (const_gimple gs)
1944 return gimple_code (gs) == GIMPLE_CALL;
1947 /* Return the LHS of call statement GS. */
1949 static inline tree
1950 gimple_call_lhs (const_gimple gs)
1952 GIMPLE_CHECK (gs, GIMPLE_CALL);
1953 return gimple_op (gs, 0);
1957 /* Return a pointer to the LHS of call statement GS. */
1959 static inline tree *
1960 gimple_call_lhs_ptr (const_gimple gs)
1962 GIMPLE_CHECK (gs, GIMPLE_CALL);
1963 return gimple_op_ptr (gs, 0);
1967 /* Set LHS to be the LHS operand of call statement GS. */
1969 static inline void
1970 gimple_call_set_lhs (gimple gs, tree lhs)
1972 GIMPLE_CHECK (gs, GIMPLE_CALL);
1973 gimple_set_op (gs, 0, lhs);
1974 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1975 SSA_NAME_DEF_STMT (lhs) = gs;
1979 /* Return true if call GS calls an internal-only function, as enumerated
1980 by internal_fn. */
1982 static inline bool
1983 gimple_call_internal_p (const_gimple gs)
1985 GIMPLE_CHECK (gs, GIMPLE_CALL);
1986 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
1990 /* Return the target of internal call GS. */
1992 static inline enum internal_fn
1993 gimple_call_internal_fn (const_gimple gs)
1995 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
1996 return gs->gimple_call.u.internal_fn;
2000 /* Return the function type of the function called by GS. */
2002 static inline tree
2003 gimple_call_fntype (const_gimple gs)
2005 GIMPLE_CHECK (gs, GIMPLE_CALL);
2006 if (gimple_call_internal_p (gs))
2007 return NULL_TREE;
2008 return gs->gimple_call.u.fntype;
2011 /* Set the type of the function called by GS to FNTYPE. */
2013 static inline void
2014 gimple_call_set_fntype (gimple gs, tree fntype)
2016 GIMPLE_CHECK (gs, GIMPLE_CALL);
2017 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2018 gs->gimple_call.u.fntype = fntype;
2022 /* Return the tree node representing the function called by call
2023 statement GS. */
2025 static inline tree
2026 gimple_call_fn (const_gimple gs)
2028 GIMPLE_CHECK (gs, GIMPLE_CALL);
2029 return gimple_op (gs, 1);
2032 /* Return a pointer to the tree node representing the function called by call
2033 statement GS. */
2035 static inline tree *
2036 gimple_call_fn_ptr (const_gimple gs)
2038 GIMPLE_CHECK (gs, GIMPLE_CALL);
2039 return gimple_op_ptr (gs, 1);
2043 /* Set FN to be the function called by call statement GS. */
2045 static inline void
2046 gimple_call_set_fn (gimple gs, tree fn)
2048 GIMPLE_CHECK (gs, GIMPLE_CALL);
2049 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2050 gimple_set_op (gs, 1, fn);
2054 /* Set FNDECL to be the function called by call statement GS. */
2056 static inline void
2057 gimple_call_set_fndecl (gimple gs, tree decl)
2059 GIMPLE_CHECK (gs, GIMPLE_CALL);
2060 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2061 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2065 /* Set internal function FN to be the function called by call statement GS. */
2067 static inline void
2068 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2070 GIMPLE_CHECK (gs, GIMPLE_CALL);
2071 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2072 gs->gimple_call.u.internal_fn = fn;
2076 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2077 Otherwise return NULL. This function is analogous to
2078 get_callee_fndecl in tree land. */
2080 static inline tree
2081 gimple_call_fndecl (const_gimple gs)
2083 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2087 /* Return the type returned by call statement GS. */
2089 static inline tree
2090 gimple_call_return_type (const_gimple gs)
2092 tree type = gimple_call_fntype (gs);
2094 if (type == NULL_TREE)
2095 return TREE_TYPE (gimple_call_lhs (gs));
2097 /* The type returned by a function is the type of its
2098 function type. */
2099 return TREE_TYPE (type);
2103 /* Return the static chain for call statement GS. */
2105 static inline tree
2106 gimple_call_chain (const_gimple gs)
2108 GIMPLE_CHECK (gs, GIMPLE_CALL);
2109 return gimple_op (gs, 2);
2113 /* Return a pointer to the static chain for call statement GS. */
2115 static inline tree *
2116 gimple_call_chain_ptr (const_gimple gs)
2118 GIMPLE_CHECK (gs, GIMPLE_CALL);
2119 return gimple_op_ptr (gs, 2);
2122 /* Set CHAIN to be the static chain for call statement GS. */
2124 static inline void
2125 gimple_call_set_chain (gimple gs, tree chain)
2127 GIMPLE_CHECK (gs, GIMPLE_CALL);
2129 gimple_set_op (gs, 2, chain);
2133 /* Return the number of arguments used by call statement GS. */
2135 static inline unsigned
2136 gimple_call_num_args (const_gimple gs)
2138 unsigned num_ops;
2139 GIMPLE_CHECK (gs, GIMPLE_CALL);
2140 num_ops = gimple_num_ops (gs);
2141 return num_ops - 3;
2145 /* Return the argument at position INDEX for call statement GS. */
2147 static inline tree
2148 gimple_call_arg (const_gimple gs, unsigned index)
2150 GIMPLE_CHECK (gs, GIMPLE_CALL);
2151 return gimple_op (gs, index + 3);
2155 /* Return the number of arguments used by call statement GS
2156 ignoring bound ones. */
2158 static inline unsigned
2159 gimple_call_num_nobnd_args (const_gimple gs)
2161 unsigned num_args = gimple_call_num_args (gs);
2162 unsigned res = num_args;
2163 for (unsigned n = 0; n < num_args; n++)
2164 if (POINTER_BOUNDS_P (gimple_call_arg (gs, n)))
2165 res--;
2166 return res;
2170 /* Return INDEX's call argument ignoring bound ones. */
2171 static inline tree
2172 gimple_call_nobnd_arg (const_gimple gs, unsigned index)
2174 /* No bound args may exist if pointers checker is off. */
2175 if (!flag_check_pointer_bounds)
2176 return gimple_call_arg (gs, index);
2177 return gimple_call_arg (gs, gimple_call_get_nobnd_arg_index (gs, index));
2181 /* Return a pointer to the argument at position INDEX for call
2182 statement GS. */
2184 static inline tree *
2185 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2187 GIMPLE_CHECK (gs, GIMPLE_CALL);
2188 return gimple_op_ptr (gs, index + 3);
2192 /* Set ARG to be the argument at position INDEX for call statement GS. */
2194 static inline void
2195 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2197 GIMPLE_CHECK (gs, GIMPLE_CALL);
2198 gimple_set_op (gs, index + 3, arg);
2202 /* If TAIL_P is true, mark call statement S as being a tail call
2203 (i.e., a call just before the exit of a function). These calls are
2204 candidate for tail call optimization. */
2206 static inline void
2207 gimple_call_set_tail (gimple s, bool tail_p)
2209 GIMPLE_CHECK (s, GIMPLE_CALL);
2210 if (tail_p)
2211 s->gsbase.subcode |= GF_CALL_TAILCALL;
2212 else
2213 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2217 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2219 static inline bool
2220 gimple_call_tail_p (gimple s)
2222 GIMPLE_CHECK (s, GIMPLE_CALL);
2223 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2227 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2228 slot optimization. This transformation uses the target of the call
2229 expansion as the return slot for calls that return in memory. */
2231 static inline void
2232 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2234 GIMPLE_CHECK (s, GIMPLE_CALL);
2235 if (return_slot_opt_p)
2236 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2237 else
2238 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2242 /* Return true if S is marked for return slot optimization. */
2244 static inline bool
2245 gimple_call_return_slot_opt_p (gimple s)
2247 GIMPLE_CHECK (s, GIMPLE_CALL);
2248 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2252 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2253 thunk to the thunked-to function. */
2255 static inline void
2256 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2258 GIMPLE_CHECK (s, GIMPLE_CALL);
2259 if (from_thunk_p)
2260 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2261 else
2262 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2266 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2268 static inline bool
2269 gimple_call_from_thunk_p (gimple s)
2271 GIMPLE_CHECK (s, GIMPLE_CALL);
2272 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2276 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2277 argument pack in its argument list. */
2279 static inline void
2280 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2282 GIMPLE_CHECK (s, GIMPLE_CALL);
2283 if (pass_arg_pack_p)
2284 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2285 else
2286 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2290 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2291 argument pack in its argument list. */
2293 static inline bool
2294 gimple_call_va_arg_pack_p (gimple s)
2296 GIMPLE_CHECK (s, GIMPLE_CALL);
2297 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2301 /* Return true if S is a noreturn call. */
2303 static inline bool
2304 gimple_call_noreturn_p (gimple s)
2306 GIMPLE_CHECK (s, GIMPLE_CALL);
2307 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2311 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2312 even if the called function can throw in other cases. */
2314 static inline void
2315 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2317 GIMPLE_CHECK (s, GIMPLE_CALL);
2318 if (nothrow_p)
2319 s->gsbase.subcode |= GF_CALL_NOTHROW;
2320 else
2321 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2324 /* Return true if S is a nothrow call. */
2326 static inline bool
2327 gimple_call_nothrow_p (gimple s)
2329 GIMPLE_CHECK (s, GIMPLE_CALL);
2330 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2333 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2334 is known to be emitted for VLA objects. Those are wrapped by
2335 stack_save/stack_restore calls and hence can't lead to unbounded
2336 stack growth even when they occur in loops. */
2338 static inline void
2339 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2341 GIMPLE_CHECK (s, GIMPLE_CALL);
2342 if (for_var)
2343 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2344 else
2345 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2348 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2350 static inline bool
2351 gimple_call_alloca_for_var_p (gimple s)
2353 GIMPLE_CHECK (s, GIMPLE_CALL);
2354 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2357 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2359 static inline void
2360 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2362 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2363 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2364 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2368 /* Return a pointer to the points-to solution for the set of call-used
2369 variables of the call CALL. */
2371 static inline struct pt_solution *
2372 gimple_call_use_set (gimple call)
2374 GIMPLE_CHECK (call, GIMPLE_CALL);
2375 return &call->gimple_call.call_used;
2379 /* Return a pointer to the points-to solution for the set of call-used
2380 variables of the call CALL. */
2382 static inline struct pt_solution *
2383 gimple_call_clobber_set (gimple call)
2385 GIMPLE_CHECK (call, GIMPLE_CALL);
2386 return &call->gimple_call.call_clobbered;
2390 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2391 non-NULL lhs. */
2393 static inline bool
2394 gimple_has_lhs (gimple stmt)
2396 return (is_gimple_assign (stmt)
2397 || (is_gimple_call (stmt)
2398 && gimple_call_lhs (stmt) != NULL_TREE));
2402 /* Return the code of the predicate computed by conditional statement GS. */
2404 static inline enum tree_code
2405 gimple_cond_code (const_gimple gs)
2407 GIMPLE_CHECK (gs, GIMPLE_COND);
2408 return (enum tree_code) gs->gsbase.subcode;
2412 /* Set CODE to be the predicate code for the conditional statement GS. */
2414 static inline void
2415 gimple_cond_set_code (gimple gs, enum tree_code code)
2417 GIMPLE_CHECK (gs, GIMPLE_COND);
2418 gs->gsbase.subcode = code;
2422 /* Return the LHS of the predicate computed by conditional statement GS. */
2424 static inline tree
2425 gimple_cond_lhs (const_gimple gs)
2427 GIMPLE_CHECK (gs, GIMPLE_COND);
2428 return gimple_op (gs, 0);
2431 /* Return the pointer to the LHS of the predicate computed by conditional
2432 statement GS. */
2434 static inline tree *
2435 gimple_cond_lhs_ptr (const_gimple gs)
2437 GIMPLE_CHECK (gs, GIMPLE_COND);
2438 return gimple_op_ptr (gs, 0);
2441 /* Set LHS to be the LHS operand of the predicate computed by
2442 conditional statement GS. */
2444 static inline void
2445 gimple_cond_set_lhs (gimple gs, tree lhs)
2447 GIMPLE_CHECK (gs, GIMPLE_COND);
2448 gimple_set_op (gs, 0, lhs);
2452 /* Return the RHS operand of the predicate computed by conditional GS. */
2454 static inline tree
2455 gimple_cond_rhs (const_gimple gs)
2457 GIMPLE_CHECK (gs, GIMPLE_COND);
2458 return gimple_op (gs, 1);
2461 /* Return the pointer to the RHS operand of the predicate computed by
2462 conditional GS. */
2464 static inline tree *
2465 gimple_cond_rhs_ptr (const_gimple gs)
2467 GIMPLE_CHECK (gs, GIMPLE_COND);
2468 return gimple_op_ptr (gs, 1);
2472 /* Set RHS to be the RHS operand of the predicate computed by
2473 conditional statement GS. */
2475 static inline void
2476 gimple_cond_set_rhs (gimple gs, tree rhs)
2478 GIMPLE_CHECK (gs, GIMPLE_COND);
2479 gimple_set_op (gs, 1, rhs);
2483 /* Return the label used by conditional statement GS when its
2484 predicate evaluates to true. */
2486 static inline tree
2487 gimple_cond_true_label (const_gimple gs)
2489 GIMPLE_CHECK (gs, GIMPLE_COND);
2490 return gimple_op (gs, 2);
2494 /* Set LABEL to be the label used by conditional statement GS when its
2495 predicate evaluates to true. */
2497 static inline void
2498 gimple_cond_set_true_label (gimple gs, tree label)
2500 GIMPLE_CHECK (gs, GIMPLE_COND);
2501 gimple_set_op (gs, 2, label);
2505 /* Set LABEL to be the label used by conditional statement GS when its
2506 predicate evaluates to false. */
2508 static inline void
2509 gimple_cond_set_false_label (gimple gs, tree label)
2511 GIMPLE_CHECK (gs, GIMPLE_COND);
2512 gimple_set_op (gs, 3, label);
2516 /* Return the label used by conditional statement GS when its
2517 predicate evaluates to false. */
2519 static inline tree
2520 gimple_cond_false_label (const_gimple gs)
2522 GIMPLE_CHECK (gs, GIMPLE_COND);
2523 return gimple_op (gs, 3);
2527 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2529 static inline void
2530 gimple_cond_make_false (gimple gs)
2532 gimple_cond_set_lhs (gs, boolean_true_node);
2533 gimple_cond_set_rhs (gs, boolean_false_node);
2534 gs->gsbase.subcode = EQ_EXPR;
2538 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2540 static inline void
2541 gimple_cond_make_true (gimple gs)
2543 gimple_cond_set_lhs (gs, boolean_true_node);
2544 gimple_cond_set_rhs (gs, boolean_true_node);
2545 gs->gsbase.subcode = EQ_EXPR;
2548 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2549 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2551 static inline bool
2552 gimple_cond_true_p (const_gimple gs)
2554 tree lhs = gimple_cond_lhs (gs);
2555 tree rhs = gimple_cond_rhs (gs);
2556 enum tree_code code = gimple_cond_code (gs);
2558 if (lhs != boolean_true_node && lhs != boolean_false_node)
2559 return false;
2561 if (rhs != boolean_true_node && rhs != boolean_false_node)
2562 return false;
2564 if (code == NE_EXPR && lhs != rhs)
2565 return true;
2567 if (code == EQ_EXPR && lhs == rhs)
2568 return true;
2570 return false;
2573 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2574 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2576 static inline bool
2577 gimple_cond_false_p (const_gimple gs)
2579 tree lhs = gimple_cond_lhs (gs);
2580 tree rhs = gimple_cond_rhs (gs);
2581 enum tree_code code = gimple_cond_code (gs);
2583 if (lhs != boolean_true_node && lhs != boolean_false_node)
2584 return false;
2586 if (rhs != boolean_true_node && rhs != boolean_false_node)
2587 return false;
2589 if (code == NE_EXPR && lhs == rhs)
2590 return true;
2592 if (code == EQ_EXPR && lhs != rhs)
2593 return true;
2595 return false;
2598 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2600 static inline void
2601 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2603 gimple_cond_set_code (stmt, code);
2604 gimple_cond_set_lhs (stmt, lhs);
2605 gimple_cond_set_rhs (stmt, rhs);
2608 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2610 static inline tree
2611 gimple_label_label (const_gimple gs)
2613 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2614 return gimple_op (gs, 0);
2618 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2619 GS. */
2621 static inline void
2622 gimple_label_set_label (gimple gs, tree label)
2624 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2625 gimple_set_op (gs, 0, label);
2629 /* Return the destination of the unconditional jump GS. */
2631 static inline tree
2632 gimple_goto_dest (const_gimple gs)
2634 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2635 return gimple_op (gs, 0);
2639 /* Set DEST to be the destination of the unconditonal jump GS. */
2641 static inline void
2642 gimple_goto_set_dest (gimple gs, tree dest)
2644 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2645 gimple_set_op (gs, 0, dest);
2649 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2651 static inline tree
2652 gimple_bind_vars (const_gimple gs)
2654 GIMPLE_CHECK (gs, GIMPLE_BIND);
2655 return gs->gimple_bind.vars;
2659 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2660 statement GS. */
2662 static inline void
2663 gimple_bind_set_vars (gimple gs, tree vars)
2665 GIMPLE_CHECK (gs, GIMPLE_BIND);
2666 gs->gimple_bind.vars = vars;
2670 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2671 statement GS. */
2673 static inline void
2674 gimple_bind_append_vars (gimple gs, tree vars)
2676 GIMPLE_CHECK (gs, GIMPLE_BIND);
2677 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2681 static inline gimple_seq *
2682 gimple_bind_body_ptr (gimple gs)
2684 GIMPLE_CHECK (gs, GIMPLE_BIND);
2685 return &gs->gimple_bind.body;
2688 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2690 static inline gimple_seq
2691 gimple_bind_body (gimple gs)
2693 return *gimple_bind_body_ptr (gs);
2697 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2698 statement GS. */
2700 static inline void
2701 gimple_bind_set_body (gimple gs, gimple_seq seq)
2703 GIMPLE_CHECK (gs, GIMPLE_BIND);
2704 gs->gimple_bind.body = seq;
2708 /* Append a statement to the end of a GIMPLE_BIND's body. */
2710 static inline void
2711 gimple_bind_add_stmt (gimple gs, gimple stmt)
2713 GIMPLE_CHECK (gs, GIMPLE_BIND);
2714 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2718 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2720 static inline void
2721 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2723 GIMPLE_CHECK (gs, GIMPLE_BIND);
2724 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2728 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2729 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2731 static inline tree
2732 gimple_bind_block (const_gimple gs)
2734 GIMPLE_CHECK (gs, GIMPLE_BIND);
2735 return gs->gimple_bind.block;
2739 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2740 statement GS. */
2742 static inline void
2743 gimple_bind_set_block (gimple gs, tree block)
2745 GIMPLE_CHECK (gs, GIMPLE_BIND);
2746 gcc_gimple_checking_assert (block == NULL_TREE
2747 || TREE_CODE (block) == BLOCK);
2748 gs->gimple_bind.block = block;
2752 /* Return the number of input operands for GIMPLE_ASM GS. */
2754 static inline unsigned
2755 gimple_asm_ninputs (const_gimple gs)
2757 GIMPLE_CHECK (gs, GIMPLE_ASM);
2758 return gs->gimple_asm.ni;
2762 /* Return the number of output operands for GIMPLE_ASM GS. */
2764 static inline unsigned
2765 gimple_asm_noutputs (const_gimple gs)
2767 GIMPLE_CHECK (gs, GIMPLE_ASM);
2768 return gs->gimple_asm.no;
2772 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2774 static inline unsigned
2775 gimple_asm_nclobbers (const_gimple gs)
2777 GIMPLE_CHECK (gs, GIMPLE_ASM);
2778 return gs->gimple_asm.nc;
2781 /* Return the number of label operands for GIMPLE_ASM GS. */
2783 static inline unsigned
2784 gimple_asm_nlabels (const_gimple gs)
2786 GIMPLE_CHECK (gs, GIMPLE_ASM);
2787 return gs->gimple_asm.nl;
2790 /* Return input operand INDEX of GIMPLE_ASM GS. */
2792 static inline tree
2793 gimple_asm_input_op (const_gimple gs, unsigned index)
2795 GIMPLE_CHECK (gs, GIMPLE_ASM);
2796 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2797 return gimple_op (gs, index + gs->gimple_asm.no);
2800 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2802 static inline tree *
2803 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2805 GIMPLE_CHECK (gs, GIMPLE_ASM);
2806 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2807 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2811 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2813 static inline void
2814 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2816 GIMPLE_CHECK (gs, GIMPLE_ASM);
2817 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2818 && TREE_CODE (in_op) == TREE_LIST);
2819 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2823 /* Return output operand INDEX of GIMPLE_ASM GS. */
2825 static inline tree
2826 gimple_asm_output_op (const_gimple gs, unsigned index)
2828 GIMPLE_CHECK (gs, GIMPLE_ASM);
2829 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
2830 return gimple_op (gs, index);
2833 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2835 static inline tree *
2836 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2838 GIMPLE_CHECK (gs, GIMPLE_ASM);
2839 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
2840 return gimple_op_ptr (gs, index);
2844 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2846 static inline void
2847 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2849 GIMPLE_CHECK (gs, GIMPLE_ASM);
2850 gcc_gimple_checking_assert (index < gs->gimple_asm.no
2851 && TREE_CODE (out_op) == TREE_LIST);
2852 gimple_set_op (gs, index, out_op);
2856 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2858 static inline tree
2859 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2861 GIMPLE_CHECK (gs, GIMPLE_ASM);
2862 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
2863 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2867 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2869 static inline void
2870 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2872 GIMPLE_CHECK (gs, GIMPLE_ASM);
2873 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
2874 && TREE_CODE (clobber_op) == TREE_LIST);
2875 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2878 /* Return label operand INDEX of GIMPLE_ASM GS. */
2880 static inline tree
2881 gimple_asm_label_op (const_gimple gs, unsigned index)
2883 GIMPLE_CHECK (gs, GIMPLE_ASM);
2884 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
2885 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2888 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2890 static inline void
2891 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2893 GIMPLE_CHECK (gs, GIMPLE_ASM);
2894 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
2895 && TREE_CODE (label_op) == TREE_LIST);
2896 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2899 /* Return the string representing the assembly instruction in
2900 GIMPLE_ASM GS. */
2902 static inline const char *
2903 gimple_asm_string (const_gimple gs)
2905 GIMPLE_CHECK (gs, GIMPLE_ASM);
2906 return gs->gimple_asm.string;
2910 /* Return true if GS is an asm statement marked volatile. */
2912 static inline bool
2913 gimple_asm_volatile_p (const_gimple gs)
2915 GIMPLE_CHECK (gs, GIMPLE_ASM);
2916 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2920 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2922 static inline void
2923 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2925 GIMPLE_CHECK (gs, GIMPLE_ASM);
2926 if (volatile_p)
2927 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2928 else
2929 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2933 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2935 static inline void
2936 gimple_asm_set_input (gimple gs, bool input_p)
2938 GIMPLE_CHECK (gs, GIMPLE_ASM);
2939 if (input_p)
2940 gs->gsbase.subcode |= GF_ASM_INPUT;
2941 else
2942 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2946 /* Return true if asm GS is an ASM_INPUT. */
2948 static inline bool
2949 gimple_asm_input_p (const_gimple gs)
2951 GIMPLE_CHECK (gs, GIMPLE_ASM);
2952 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2956 /* Return the types handled by GIMPLE_CATCH statement GS. */
2958 static inline tree
2959 gimple_catch_types (const_gimple gs)
2961 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2962 return gs->gimple_catch.types;
2966 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2968 static inline tree *
2969 gimple_catch_types_ptr (gimple gs)
2971 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2972 return &gs->gimple_catch.types;
2976 /* Return a pointer to the GIMPLE sequence representing the body of
2977 the handler of GIMPLE_CATCH statement GS. */
2979 static inline gimple_seq *
2980 gimple_catch_handler_ptr (gimple gs)
2982 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2983 return &gs->gimple_catch.handler;
2987 /* Return the GIMPLE sequence representing the body of the handler of
2988 GIMPLE_CATCH statement GS. */
2990 static inline gimple_seq
2991 gimple_catch_handler (gimple gs)
2993 return *gimple_catch_handler_ptr (gs);
2997 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2999 static inline void
3000 gimple_catch_set_types (gimple gs, tree t)
3002 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3003 gs->gimple_catch.types = t;
3007 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3009 static inline void
3010 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3012 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3013 gs->gimple_catch.handler = handler;
3017 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3019 static inline tree
3020 gimple_eh_filter_types (const_gimple gs)
3022 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3023 return gs->gimple_eh_filter.types;
3027 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3028 GS. */
3030 static inline tree *
3031 gimple_eh_filter_types_ptr (gimple gs)
3033 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3034 return &gs->gimple_eh_filter.types;
3038 /* Return a pointer to the sequence of statement to execute when
3039 GIMPLE_EH_FILTER statement fails. */
3041 static inline gimple_seq *
3042 gimple_eh_filter_failure_ptr (gimple gs)
3044 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3045 return &gs->gimple_eh_filter.failure;
3049 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3050 statement fails. */
3052 static inline gimple_seq
3053 gimple_eh_filter_failure (gimple gs)
3055 return *gimple_eh_filter_failure_ptr (gs);
3059 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3061 static inline void
3062 gimple_eh_filter_set_types (gimple gs, tree types)
3064 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3065 gs->gimple_eh_filter.types = types;
3069 /* Set FAILURE to be the sequence of statements to execute on failure
3070 for GIMPLE_EH_FILTER GS. */
3072 static inline void
3073 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3075 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3076 gs->gimple_eh_filter.failure = failure;
3079 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3081 static inline tree
3082 gimple_eh_must_not_throw_fndecl (gimple gs)
3084 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3085 return gs->gimple_eh_mnt.fndecl;
3088 /* Set the function decl to be called by GS to DECL. */
3090 static inline void
3091 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3093 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3094 gs->gimple_eh_mnt.fndecl = decl;
3097 /* GIMPLE_EH_ELSE accessors. */
3099 static inline gimple_seq *
3100 gimple_eh_else_n_body_ptr (gimple gs)
3102 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3103 return &gs->gimple_eh_else.n_body;
3106 static inline gimple_seq
3107 gimple_eh_else_n_body (gimple gs)
3109 return *gimple_eh_else_n_body_ptr (gs);
3112 static inline gimple_seq *
3113 gimple_eh_else_e_body_ptr (gimple gs)
3115 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3116 return &gs->gimple_eh_else.e_body;
3119 static inline gimple_seq
3120 gimple_eh_else_e_body (gimple gs)
3122 return *gimple_eh_else_e_body_ptr (gs);
3125 static inline void
3126 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3128 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3129 gs->gimple_eh_else.n_body = seq;
3132 static inline void
3133 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3135 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3136 gs->gimple_eh_else.e_body = seq;
3139 /* GIMPLE_TRY accessors. */
3141 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3142 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3144 static inline enum gimple_try_flags
3145 gimple_try_kind (const_gimple gs)
3147 GIMPLE_CHECK (gs, GIMPLE_TRY);
3148 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3152 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3154 static inline void
3155 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3157 GIMPLE_CHECK (gs, GIMPLE_TRY);
3158 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3159 || kind == GIMPLE_TRY_FINALLY);
3160 if (gimple_try_kind (gs) != kind)
3161 gs->gsbase.subcode = (unsigned int) kind;
3165 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3167 static inline bool
3168 gimple_try_catch_is_cleanup (const_gimple gs)
3170 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3171 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3175 /* Return a pointer to the sequence of statements used as the
3176 body for GIMPLE_TRY GS. */
3178 static inline gimple_seq *
3179 gimple_try_eval_ptr (gimple gs)
3181 GIMPLE_CHECK (gs, GIMPLE_TRY);
3182 return &gs->gimple_try.eval;
3186 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3188 static inline gimple_seq
3189 gimple_try_eval (gimple gs)
3191 return *gimple_try_eval_ptr (gs);
3195 /* Return a pointer to the sequence of statements used as the cleanup body for
3196 GIMPLE_TRY GS. */
3198 static inline gimple_seq *
3199 gimple_try_cleanup_ptr (gimple gs)
3201 GIMPLE_CHECK (gs, GIMPLE_TRY);
3202 return &gs->gimple_try.cleanup;
3206 /* Return the sequence of statements used as the cleanup body for
3207 GIMPLE_TRY GS. */
3209 static inline gimple_seq
3210 gimple_try_cleanup (gimple gs)
3212 return *gimple_try_cleanup_ptr (gs);
3216 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3218 static inline void
3219 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3221 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3222 if (catch_is_cleanup)
3223 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3224 else
3225 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3229 /* Set EVAL to be the sequence of statements to use as the body for
3230 GIMPLE_TRY GS. */
3232 static inline void
3233 gimple_try_set_eval (gimple gs, gimple_seq eval)
3235 GIMPLE_CHECK (gs, GIMPLE_TRY);
3236 gs->gimple_try.eval = eval;
3240 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3241 body for GIMPLE_TRY GS. */
3243 static inline void
3244 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3246 GIMPLE_CHECK (gs, GIMPLE_TRY);
3247 gs->gimple_try.cleanup = cleanup;
3251 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3253 static inline gimple_seq *
3254 gimple_wce_cleanup_ptr (gimple gs)
3256 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3257 return &gs->gimple_wce.cleanup;
3261 /* Return the cleanup sequence for cleanup statement GS. */
3263 static inline gimple_seq
3264 gimple_wce_cleanup (gimple gs)
3266 return *gimple_wce_cleanup_ptr (gs);
3270 /* Set CLEANUP to be the cleanup sequence for GS. */
3272 static inline void
3273 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3275 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3276 gs->gimple_wce.cleanup = cleanup;
3280 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3282 static inline bool
3283 gimple_wce_cleanup_eh_only (const_gimple gs)
3285 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3286 return gs->gsbase.subcode != 0;
3290 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3292 static inline void
3293 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3295 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3296 gs->gsbase.subcode = (unsigned int) eh_only_p;
3300 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3302 static inline unsigned
3303 gimple_phi_capacity (const_gimple gs)
3305 GIMPLE_CHECK (gs, GIMPLE_PHI);
3306 return gs->gimple_phi.capacity;
3310 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3311 be exactly the number of incoming edges for the basic block holding
3312 GS. */
3314 static inline unsigned
3315 gimple_phi_num_args (const_gimple gs)
3317 GIMPLE_CHECK (gs, GIMPLE_PHI);
3318 return gs->gimple_phi.nargs;
3322 /* Return the SSA name created by GIMPLE_PHI GS. */
3324 static inline tree
3325 gimple_phi_result (const_gimple gs)
3327 GIMPLE_CHECK (gs, GIMPLE_PHI);
3328 return gs->gimple_phi.result;
3331 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3333 static inline tree *
3334 gimple_phi_result_ptr (gimple gs)
3336 GIMPLE_CHECK (gs, GIMPLE_PHI);
3337 return &gs->gimple_phi.result;
3340 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3342 static inline void
3343 gimple_phi_set_result (gimple gs, tree result)
3345 GIMPLE_CHECK (gs, GIMPLE_PHI);
3346 gs->gimple_phi.result = result;
3347 if (result && TREE_CODE (result) == SSA_NAME)
3348 SSA_NAME_DEF_STMT (result) = gs;
3352 /* Return the PHI argument corresponding to incoming edge INDEX for
3353 GIMPLE_PHI GS. */
3355 static inline struct phi_arg_d *
3356 gimple_phi_arg (gimple gs, unsigned index)
3358 GIMPLE_CHECK (gs, GIMPLE_PHI);
3359 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3360 return &(gs->gimple_phi.args[index]);
3363 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3364 for GIMPLE_PHI GS. */
3366 static inline void
3367 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3369 GIMPLE_CHECK (gs, GIMPLE_PHI);
3370 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3371 gs->gimple_phi.args[index] = *phiarg;
3374 /* Return the PHI nodes for basic block BB, or NULL if there are no
3375 PHI nodes. */
3377 static inline gimple_seq
3378 phi_nodes (const_basic_block bb)
3380 gcc_checking_assert (!(bb->flags & BB_RTL));
3381 return bb->il.gimple.phi_nodes;
3384 /* Return a pointer to the PHI nodes for basic block BB. */
3386 static inline gimple_seq *
3387 phi_nodes_ptr (basic_block bb)
3389 gcc_checking_assert (!(bb->flags & BB_RTL));
3390 return &bb->il.gimple.phi_nodes;
3393 /* Return the tree operand for argument I of PHI node GS. */
3395 static inline tree
3396 gimple_phi_arg_def (gimple gs, size_t index)
3398 return gimple_phi_arg (gs, index)->def;
3402 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3404 static inline tree *
3405 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3407 return &gimple_phi_arg (gs, index)->def;
3410 /* Return the edge associated with argument I of phi node GS. */
3412 static inline edge
3413 gimple_phi_arg_edge (gimple gs, size_t i)
3415 return EDGE_PRED (gimple_bb (gs), i);
3418 /* Return the source location of gimple argument I of phi node GS. */
3420 static inline source_location
3421 gimple_phi_arg_location (gimple gs, size_t i)
3423 return gimple_phi_arg (gs, i)->locus;
3426 /* Return the source location of the argument on edge E of phi node GS. */
3428 static inline source_location
3429 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3431 return gimple_phi_arg (gs, e->dest_idx)->locus;
3434 /* Set the source location of gimple argument I of phi node GS to LOC. */
3436 static inline void
3437 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3439 gimple_phi_arg (gs, i)->locus = loc;
3442 /* Return TRUE if argument I of phi node GS has a location record. */
3444 static inline bool
3445 gimple_phi_arg_has_location (gimple gs, size_t i)
3447 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3451 /* Return the region number for GIMPLE_RESX GS. */
3453 static inline int
3454 gimple_resx_region (const_gimple gs)
3456 GIMPLE_CHECK (gs, GIMPLE_RESX);
3457 return gs->gimple_eh_ctrl.region;
3460 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3462 static inline void
3463 gimple_resx_set_region (gimple gs, int region)
3465 GIMPLE_CHECK (gs, GIMPLE_RESX);
3466 gs->gimple_eh_ctrl.region = region;
3469 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3471 static inline int
3472 gimple_eh_dispatch_region (const_gimple gs)
3474 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3475 return gs->gimple_eh_ctrl.region;
3478 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3480 static inline void
3481 gimple_eh_dispatch_set_region (gimple gs, int region)
3483 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3484 gs->gimple_eh_ctrl.region = region;
3487 /* Return the number of labels associated with the switch statement GS. */
3489 static inline unsigned
3490 gimple_switch_num_labels (const_gimple gs)
3492 unsigned num_ops;
3493 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3494 num_ops = gimple_num_ops (gs);
3495 gcc_gimple_checking_assert (num_ops > 1);
3496 return num_ops - 1;
3500 /* Set NLABELS to be the number of labels for the switch statement GS. */
3502 static inline void
3503 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3505 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3506 gimple_set_num_ops (g, nlabels + 1);
3510 /* Return the index variable used by the switch statement GS. */
3512 static inline tree
3513 gimple_switch_index (const_gimple gs)
3515 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3516 return gimple_op (gs, 0);
3520 /* Return a pointer to the index variable for the switch statement GS. */
3522 static inline tree *
3523 gimple_switch_index_ptr (const_gimple gs)
3525 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3526 return gimple_op_ptr (gs, 0);
3530 /* Set INDEX to be the index variable for switch statement GS. */
3532 static inline void
3533 gimple_switch_set_index (gimple gs, tree index)
3535 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3536 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3537 gimple_set_op (gs, 0, index);
3541 /* Return the label numbered INDEX. The default label is 0, followed by any
3542 labels in a switch statement. */
3544 static inline tree
3545 gimple_switch_label (const_gimple gs, unsigned index)
3547 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3548 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3549 return gimple_op (gs, index + 1);
3552 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3554 static inline void
3555 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3557 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3558 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3559 && (label == NULL_TREE
3560 || TREE_CODE (label) == CASE_LABEL_EXPR));
3561 gimple_set_op (gs, index + 1, label);
3564 /* Return the default label for a switch statement. */
3566 static inline tree
3567 gimple_switch_default_label (const_gimple gs)
3569 tree label = gimple_switch_label (gs, 0);
3570 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3571 return label;
3574 /* Set the default label for a switch statement. */
3576 static inline void
3577 gimple_switch_set_default_label (gimple gs, tree label)
3579 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3580 gimple_switch_set_label (gs, 0, label);
3583 /* Return true if GS is a GIMPLE_DEBUG statement. */
3585 static inline bool
3586 is_gimple_debug (const_gimple gs)
3588 return gimple_code (gs) == GIMPLE_DEBUG;
3591 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3593 static inline bool
3594 gimple_debug_bind_p (const_gimple s)
3596 if (is_gimple_debug (s))
3597 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3599 return false;
3602 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3604 static inline tree
3605 gimple_debug_bind_get_var (gimple dbg)
3607 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3608 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3609 return gimple_op (dbg, 0);
3612 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3613 statement. */
3615 static inline tree
3616 gimple_debug_bind_get_value (gimple dbg)
3618 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3619 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3620 return gimple_op (dbg, 1);
3623 /* Return a pointer to the value bound to the variable in a
3624 GIMPLE_DEBUG bind statement. */
3626 static inline tree *
3627 gimple_debug_bind_get_value_ptr (gimple dbg)
3629 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3630 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3631 return gimple_op_ptr (dbg, 1);
3634 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3636 static inline void
3637 gimple_debug_bind_set_var (gimple dbg, tree var)
3639 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3640 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3641 gimple_set_op (dbg, 0, var);
3644 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3645 statement. */
3647 static inline void
3648 gimple_debug_bind_set_value (gimple dbg, tree value)
3650 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3651 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3652 gimple_set_op (dbg, 1, value);
3655 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3656 optimized away. */
3657 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3659 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3660 statement. */
3662 static inline void
3663 gimple_debug_bind_reset_value (gimple dbg)
3665 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3666 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3667 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3670 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3671 value. */
3673 static inline bool
3674 gimple_debug_bind_has_value_p (gimple dbg)
3676 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3677 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3678 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3681 #undef GIMPLE_DEBUG_BIND_NOVALUE
3683 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3685 static inline bool
3686 gimple_debug_source_bind_p (const_gimple s)
3688 if (is_gimple_debug (s))
3689 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3691 return false;
3694 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3696 static inline tree
3697 gimple_debug_source_bind_get_var (gimple dbg)
3699 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3700 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3701 return gimple_op (dbg, 0);
3704 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3705 statement. */
3707 static inline tree
3708 gimple_debug_source_bind_get_value (gimple dbg)
3710 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3711 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3712 return gimple_op (dbg, 1);
3715 /* Return a pointer to the value bound to the variable in a
3716 GIMPLE_DEBUG source bind statement. */
3718 static inline tree *
3719 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3721 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3722 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3723 return gimple_op_ptr (dbg, 1);
3726 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3728 static inline void
3729 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3731 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3732 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3733 gimple_set_op (dbg, 0, var);
3736 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3737 statement. */
3739 static inline void
3740 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3742 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3743 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3744 gimple_set_op (dbg, 1, value);
3747 /* Return the line number for EXPR, or return -1 if we have no line
3748 number information for it. */
3749 static inline int
3750 get_lineno (const_gimple stmt)
3752 location_t loc;
3754 if (!stmt)
3755 return -1;
3757 loc = gimple_location (stmt);
3758 if (loc == UNKNOWN_LOCATION)
3759 return -1;
3761 return LOCATION_LINE (loc);
3764 /* Return a pointer to the body for the OMP statement GS. */
3766 static inline gimple_seq *
3767 gimple_omp_body_ptr (gimple gs)
3769 return &gs->omp.body;
3772 /* Return the body for the OMP statement GS. */
3774 static inline gimple_seq
3775 gimple_omp_body (gimple gs)
3777 return *gimple_omp_body_ptr (gs);
3780 /* Set BODY to be the body for the OMP statement GS. */
3782 static inline void
3783 gimple_omp_set_body (gimple gs, gimple_seq body)
3785 gs->omp.body = body;
3789 /* Return the name associated with OMP_CRITICAL statement GS. */
3791 static inline tree
3792 gimple_omp_critical_name (const_gimple gs)
3794 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3795 return gs->gimple_omp_critical.name;
3799 /* Return a pointer to the name associated with OMP critical statement GS. */
3801 static inline tree *
3802 gimple_omp_critical_name_ptr (gimple gs)
3804 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3805 return &gs->gimple_omp_critical.name;
3809 /* Set NAME to be the name associated with OMP critical statement GS. */
3811 static inline void
3812 gimple_omp_critical_set_name (gimple gs, tree name)
3814 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3815 gs->gimple_omp_critical.name = name;
3819 /* Return the kind of OMP for statemement. */
3821 static inline int
3822 gimple_omp_for_kind (const_gimple g)
3824 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3825 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
3829 /* Set the OMP for kind. */
3831 static inline void
3832 gimple_omp_for_set_kind (gimple g, int kind)
3834 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3835 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_FOR_KIND_MASK)
3836 | (kind & GF_OMP_FOR_KIND_MASK);
3840 /* Return true if OMP for statement G has the
3841 GF_OMP_FOR_COMBINED flag set. */
3843 static inline bool
3844 gimple_omp_for_combined_p (const_gimple g)
3846 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3847 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
3851 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
3852 value of COMBINED_P. */
3854 static inline void
3855 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
3857 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3858 if (combined_p)
3859 g->gsbase.subcode |= GF_OMP_FOR_COMBINED;
3860 else
3861 g->gsbase.subcode &= ~GF_OMP_FOR_COMBINED;
3865 /* Return true if OMP for statement G has the
3866 GF_OMP_FOR_COMBINED_INTO flag set. */
3868 static inline bool
3869 gimple_omp_for_combined_into_p (const_gimple g)
3871 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3872 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
3876 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
3877 value of COMBINED_P. */
3879 static inline void
3880 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
3882 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
3883 if (combined_p)
3884 g->gsbase.subcode |= GF_OMP_FOR_COMBINED_INTO;
3885 else
3886 g->gsbase.subcode &= ~GF_OMP_FOR_COMBINED_INTO;
3890 /* Return the clauses associated with OMP_FOR GS. */
3892 static inline tree
3893 gimple_omp_for_clauses (const_gimple gs)
3895 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3896 return gs->gimple_omp_for.clauses;
3900 /* Return a pointer to the OMP_FOR GS. */
3902 static inline tree *
3903 gimple_omp_for_clauses_ptr (gimple gs)
3905 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3906 return &gs->gimple_omp_for.clauses;
3910 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3912 static inline void
3913 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3915 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3916 gs->gimple_omp_for.clauses = clauses;
3920 /* Get the collapse count of OMP_FOR GS. */
3922 static inline size_t
3923 gimple_omp_for_collapse (gimple gs)
3925 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3926 return gs->gimple_omp_for.collapse;
3930 /* Return the index variable for OMP_FOR GS. */
3932 static inline tree
3933 gimple_omp_for_index (const_gimple gs, size_t i)
3935 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3936 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3937 return gs->gimple_omp_for.iter[i].index;
3941 /* Return a pointer to the index variable for OMP_FOR GS. */
3943 static inline tree *
3944 gimple_omp_for_index_ptr (gimple gs, size_t i)
3946 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3947 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3948 return &gs->gimple_omp_for.iter[i].index;
3952 /* Set INDEX to be the index variable for OMP_FOR GS. */
3954 static inline void
3955 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3957 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3958 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3959 gs->gimple_omp_for.iter[i].index = index;
3963 /* Return the initial value for OMP_FOR GS. */
3965 static inline tree
3966 gimple_omp_for_initial (const_gimple gs, size_t i)
3968 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3969 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3970 return gs->gimple_omp_for.iter[i].initial;
3974 /* Return a pointer to the initial value for OMP_FOR GS. */
3976 static inline tree *
3977 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3979 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3980 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3981 return &gs->gimple_omp_for.iter[i].initial;
3985 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3987 static inline void
3988 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3990 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3991 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3992 gs->gimple_omp_for.iter[i].initial = initial;
3996 /* Return the final value for OMP_FOR GS. */
3998 static inline tree
3999 gimple_omp_for_final (const_gimple gs, size_t i)
4001 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4002 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4003 return gs->gimple_omp_for.iter[i].final;
4007 /* Return a pointer to the final value for OMP_FOR GS. */
4009 static inline tree *
4010 gimple_omp_for_final_ptr (gimple gs, size_t i)
4012 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4013 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4014 return &gs->gimple_omp_for.iter[i].final;
4018 /* Set FINAL to be the final value for OMP_FOR GS. */
4020 static inline void
4021 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4023 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4024 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4025 gs->gimple_omp_for.iter[i].final = final;
4029 /* Return the increment value for OMP_FOR GS. */
4031 static inline tree
4032 gimple_omp_for_incr (const_gimple gs, size_t i)
4034 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4035 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4036 return gs->gimple_omp_for.iter[i].incr;
4040 /* Return a pointer to the increment value for OMP_FOR GS. */
4042 static inline tree *
4043 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4045 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4046 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4047 return &gs->gimple_omp_for.iter[i].incr;
4051 /* Set INCR to be the increment value for OMP_FOR GS. */
4053 static inline void
4054 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4056 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4057 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4058 gs->gimple_omp_for.iter[i].incr = incr;
4062 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4063 statement GS starts. */
4065 static inline gimple_seq *
4066 gimple_omp_for_pre_body_ptr (gimple gs)
4068 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4069 return &gs->gimple_omp_for.pre_body;
4073 /* Return the sequence of statements to execute before the OMP_FOR
4074 statement GS starts. */
4076 static inline gimple_seq
4077 gimple_omp_for_pre_body (gimple gs)
4079 return *gimple_omp_for_pre_body_ptr (gs);
4083 /* Set PRE_BODY to be the sequence of statements to execute before the
4084 OMP_FOR statement GS starts. */
4086 static inline void
4087 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4089 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4090 gs->gimple_omp_for.pre_body = pre_body;
4094 /* Return the clauses associated with OMP_PARALLEL GS. */
4096 static inline tree
4097 gimple_omp_parallel_clauses (const_gimple gs)
4099 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4100 return gs->gimple_omp_parallel.clauses;
4104 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4106 static inline tree *
4107 gimple_omp_parallel_clauses_ptr (gimple gs)
4109 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4110 return &gs->gimple_omp_parallel.clauses;
4114 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4115 GS. */
4117 static inline void
4118 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4120 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4121 gs->gimple_omp_parallel.clauses = clauses;
4125 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4127 static inline tree
4128 gimple_omp_parallel_child_fn (const_gimple gs)
4130 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4131 return gs->gimple_omp_parallel.child_fn;
4134 /* Return a pointer to the child function used to hold the body of
4135 OMP_PARALLEL GS. */
4137 static inline tree *
4138 gimple_omp_parallel_child_fn_ptr (gimple gs)
4140 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4141 return &gs->gimple_omp_parallel.child_fn;
4145 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4147 static inline void
4148 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4150 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4151 gs->gimple_omp_parallel.child_fn = child_fn;
4155 /* Return the artificial argument used to send variables and values
4156 from the parent to the children threads in OMP_PARALLEL GS. */
4158 static inline tree
4159 gimple_omp_parallel_data_arg (const_gimple gs)
4161 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4162 return gs->gimple_omp_parallel.data_arg;
4166 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4168 static inline tree *
4169 gimple_omp_parallel_data_arg_ptr (gimple gs)
4171 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4172 return &gs->gimple_omp_parallel.data_arg;
4176 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4178 static inline void
4179 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4181 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4182 gs->gimple_omp_parallel.data_arg = data_arg;
4186 /* Return the clauses associated with OMP_TASK GS. */
4188 static inline tree
4189 gimple_omp_task_clauses (const_gimple gs)
4191 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4192 return gs->gimple_omp_parallel.clauses;
4196 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4198 static inline tree *
4199 gimple_omp_task_clauses_ptr (gimple gs)
4201 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4202 return &gs->gimple_omp_parallel.clauses;
4206 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4207 GS. */
4209 static inline void
4210 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4212 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4213 gs->gimple_omp_parallel.clauses = clauses;
4217 /* Return the child function used to hold the body of OMP_TASK GS. */
4219 static inline tree
4220 gimple_omp_task_child_fn (const_gimple gs)
4222 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4223 return gs->gimple_omp_parallel.child_fn;
4226 /* Return a pointer to the child function used to hold the body of
4227 OMP_TASK GS. */
4229 static inline tree *
4230 gimple_omp_task_child_fn_ptr (gimple gs)
4232 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4233 return &gs->gimple_omp_parallel.child_fn;
4237 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4239 static inline void
4240 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4242 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4243 gs->gimple_omp_parallel.child_fn = child_fn;
4247 /* Return the artificial argument used to send variables and values
4248 from the parent to the children threads in OMP_TASK GS. */
4250 static inline tree
4251 gimple_omp_task_data_arg (const_gimple gs)
4253 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4254 return gs->gimple_omp_parallel.data_arg;
4258 /* Return a pointer to the data argument for OMP_TASK GS. */
4260 static inline tree *
4261 gimple_omp_task_data_arg_ptr (gimple gs)
4263 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4264 return &gs->gimple_omp_parallel.data_arg;
4268 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4270 static inline void
4271 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4273 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4274 gs->gimple_omp_parallel.data_arg = data_arg;
4278 /* Return the clauses associated with OMP_TASK GS. */
4280 static inline tree
4281 gimple_omp_taskreg_clauses (const_gimple gs)
4283 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4284 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4285 return gs->gimple_omp_parallel.clauses;
4289 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4291 static inline tree *
4292 gimple_omp_taskreg_clauses_ptr (gimple gs)
4294 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4295 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4296 return &gs->gimple_omp_parallel.clauses;
4300 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4301 GS. */
4303 static inline void
4304 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4306 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4307 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4308 gs->gimple_omp_parallel.clauses = clauses;
4312 /* Return the child function used to hold the body of OMP_TASK GS. */
4314 static inline tree
4315 gimple_omp_taskreg_child_fn (const_gimple gs)
4317 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4318 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4319 return gs->gimple_omp_parallel.child_fn;
4322 /* Return a pointer to the child function used to hold the body of
4323 OMP_TASK GS. */
4325 static inline tree *
4326 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4328 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4329 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4330 return &gs->gimple_omp_parallel.child_fn;
4334 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4336 static inline void
4337 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4339 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4340 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4341 gs->gimple_omp_parallel.child_fn = child_fn;
4345 /* Return the artificial argument used to send variables and values
4346 from the parent to the children threads in OMP_TASK GS. */
4348 static inline tree
4349 gimple_omp_taskreg_data_arg (const_gimple gs)
4351 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4352 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4353 return gs->gimple_omp_parallel.data_arg;
4357 /* Return a pointer to the data argument for OMP_TASK GS. */
4359 static inline tree *
4360 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4362 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4363 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4364 return &gs->gimple_omp_parallel.data_arg;
4368 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4370 static inline void
4371 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4373 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4374 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4375 gs->gimple_omp_parallel.data_arg = data_arg;
4379 /* Return the copy function used to hold the body of OMP_TASK GS. */
4381 static inline tree
4382 gimple_omp_task_copy_fn (const_gimple gs)
4384 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4385 return gs->gimple_omp_task.copy_fn;
4388 /* Return a pointer to the copy function used to hold the body of
4389 OMP_TASK GS. */
4391 static inline tree *
4392 gimple_omp_task_copy_fn_ptr (gimple gs)
4394 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4395 return &gs->gimple_omp_task.copy_fn;
4399 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4401 static inline void
4402 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4404 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4405 gs->gimple_omp_task.copy_fn = copy_fn;
4409 /* Return size of the data block in bytes in OMP_TASK GS. */
4411 static inline tree
4412 gimple_omp_task_arg_size (const_gimple gs)
4414 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4415 return gs->gimple_omp_task.arg_size;
4419 /* Return a pointer to the data block size for OMP_TASK GS. */
4421 static inline tree *
4422 gimple_omp_task_arg_size_ptr (gimple gs)
4424 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4425 return &gs->gimple_omp_task.arg_size;
4429 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4431 static inline void
4432 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4434 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4435 gs->gimple_omp_task.arg_size = arg_size;
4439 /* Return align of the data block in bytes in OMP_TASK GS. */
4441 static inline tree
4442 gimple_omp_task_arg_align (const_gimple gs)
4444 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4445 return gs->gimple_omp_task.arg_align;
4449 /* Return a pointer to the data block align for OMP_TASK GS. */
4451 static inline tree *
4452 gimple_omp_task_arg_align_ptr (gimple gs)
4454 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4455 return &gs->gimple_omp_task.arg_align;
4459 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4461 static inline void
4462 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4464 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4465 gs->gimple_omp_task.arg_align = arg_align;
4469 /* Return the clauses associated with OMP_SINGLE GS. */
4471 static inline tree
4472 gimple_omp_single_clauses (const_gimple gs)
4474 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4475 return gs->gimple_omp_single.clauses;
4479 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4481 static inline tree *
4482 gimple_omp_single_clauses_ptr (gimple gs)
4484 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4485 return &gs->gimple_omp_single.clauses;
4489 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4491 static inline void
4492 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4494 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4495 gs->gimple_omp_single.clauses = clauses;
4499 /* Return the clauses associated with OMP_TARGET GS. */
4501 static inline tree
4502 gimple_omp_target_clauses (const_gimple gs)
4504 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4505 return gs->gimple_omp_parallel.clauses;
4509 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
4511 static inline tree *
4512 gimple_omp_target_clauses_ptr (gimple gs)
4514 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4515 return &gs->gimple_omp_parallel.clauses;
4519 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
4521 static inline void
4522 gimple_omp_target_set_clauses (gimple gs, tree clauses)
4524 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4525 gs->gimple_omp_parallel.clauses = clauses;
4529 /* Return the kind of OMP target statemement. */
4531 static inline int
4532 gimple_omp_target_kind (const_gimple g)
4534 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
4535 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
4539 /* Set the OMP target kind. */
4541 static inline void
4542 gimple_omp_target_set_kind (gimple g, int kind)
4544 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
4545 g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_TARGET_KIND_MASK)
4546 | (kind & GF_OMP_TARGET_KIND_MASK);
4550 /* Return the child function used to hold the body of OMP_TARGET GS. */
4552 static inline tree
4553 gimple_omp_target_child_fn (const_gimple gs)
4555 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4556 return gs->gimple_omp_parallel.child_fn;
4559 /* Return a pointer to the child function used to hold the body of
4560 OMP_TARGET GS. */
4562 static inline tree *
4563 gimple_omp_target_child_fn_ptr (gimple gs)
4565 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4566 return &gs->gimple_omp_parallel.child_fn;
4570 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
4572 static inline void
4573 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
4575 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4576 gs->gimple_omp_parallel.child_fn = child_fn;
4580 /* Return the artificial argument used to send variables and values
4581 from the parent to the children threads in OMP_TARGET GS. */
4583 static inline tree
4584 gimple_omp_target_data_arg (const_gimple gs)
4586 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4587 return gs->gimple_omp_parallel.data_arg;
4591 /* Return a pointer to the data argument for OMP_TARGET GS. */
4593 static inline tree *
4594 gimple_omp_target_data_arg_ptr (gimple gs)
4596 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4597 return &gs->gimple_omp_parallel.data_arg;
4601 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
4603 static inline void
4604 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
4606 GIMPLE_CHECK (gs, GIMPLE_OMP_TARGET);
4607 gs->gimple_omp_parallel.data_arg = data_arg;
4611 /* Return the clauses associated with OMP_TEAMS GS. */
4613 static inline tree
4614 gimple_omp_teams_clauses (const_gimple gs)
4616 GIMPLE_CHECK (gs, GIMPLE_OMP_TEAMS);
4617 return gs->gimple_omp_single.clauses;
4621 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
4623 static inline tree *
4624 gimple_omp_teams_clauses_ptr (gimple gs)
4626 GIMPLE_CHECK (gs, GIMPLE_OMP_TEAMS);
4627 return &gs->gimple_omp_single.clauses;
4631 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
4633 static inline void
4634 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
4636 GIMPLE_CHECK (gs, GIMPLE_OMP_TEAMS);
4637 gs->gimple_omp_single.clauses = clauses;
4641 /* Return the clauses associated with OMP_SECTIONS GS. */
4643 static inline tree
4644 gimple_omp_sections_clauses (const_gimple gs)
4646 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4647 return gs->gimple_omp_sections.clauses;
4651 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4653 static inline tree *
4654 gimple_omp_sections_clauses_ptr (gimple gs)
4656 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4657 return &gs->gimple_omp_sections.clauses;
4661 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4662 GS. */
4664 static inline void
4665 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4667 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4668 gs->gimple_omp_sections.clauses = clauses;
4672 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4673 in GS. */
4675 static inline tree
4676 gimple_omp_sections_control (const_gimple gs)
4678 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4679 return gs->gimple_omp_sections.control;
4683 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4684 GS. */
4686 static inline tree *
4687 gimple_omp_sections_control_ptr (gimple gs)
4689 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4690 return &gs->gimple_omp_sections.control;
4694 /* Set CONTROL to be the set of clauses associated with the
4695 GIMPLE_OMP_SECTIONS in GS. */
4697 static inline void
4698 gimple_omp_sections_set_control (gimple gs, tree control)
4700 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4701 gs->gimple_omp_sections.control = control;
4705 /* Set COND to be the condition code for OMP_FOR GS. */
4707 static inline void
4708 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4710 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4711 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4712 && i < gs->gimple_omp_for.collapse);
4713 gs->gimple_omp_for.iter[i].cond = cond;
4717 /* Return the condition code associated with OMP_FOR GS. */
4719 static inline enum tree_code
4720 gimple_omp_for_cond (const_gimple gs, size_t i)
4722 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4723 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4724 return gs->gimple_omp_for.iter[i].cond;
4728 /* Set the value being stored in an atomic store. */
4730 static inline void
4731 gimple_omp_atomic_store_set_val (gimple g, tree val)
4733 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4734 g->gimple_omp_atomic_store.val = val;
4738 /* Return the value being stored in an atomic store. */
4740 static inline tree
4741 gimple_omp_atomic_store_val (const_gimple g)
4743 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4744 return g->gimple_omp_atomic_store.val;
4748 /* Return a pointer to the value being stored in an atomic store. */
4750 static inline tree *
4751 gimple_omp_atomic_store_val_ptr (gimple g)
4753 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4754 return &g->gimple_omp_atomic_store.val;
4758 /* Set the LHS of an atomic load. */
4760 static inline void
4761 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4763 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4764 g->gimple_omp_atomic_load.lhs = lhs;
4768 /* Get the LHS of an atomic load. */
4770 static inline tree
4771 gimple_omp_atomic_load_lhs (const_gimple g)
4773 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4774 return g->gimple_omp_atomic_load.lhs;
4778 /* Return a pointer to the LHS of an atomic load. */
4780 static inline tree *
4781 gimple_omp_atomic_load_lhs_ptr (gimple g)
4783 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4784 return &g->gimple_omp_atomic_load.lhs;
4788 /* Set the RHS of an atomic load. */
4790 static inline void
4791 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4793 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4794 g->gimple_omp_atomic_load.rhs = rhs;
4798 /* Get the RHS of an atomic load. */
4800 static inline tree
4801 gimple_omp_atomic_load_rhs (const_gimple g)
4803 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4804 return g->gimple_omp_atomic_load.rhs;
4808 /* Return a pointer to the RHS of an atomic load. */
4810 static inline tree *
4811 gimple_omp_atomic_load_rhs_ptr (gimple g)
4813 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4814 return &g->gimple_omp_atomic_load.rhs;
4818 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4820 static inline tree
4821 gimple_omp_continue_control_def (const_gimple g)
4823 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4824 return g->gimple_omp_continue.control_def;
4827 /* The same as above, but return the address. */
4829 static inline tree *
4830 gimple_omp_continue_control_def_ptr (gimple g)
4832 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4833 return &g->gimple_omp_continue.control_def;
4836 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4838 static inline void
4839 gimple_omp_continue_set_control_def (gimple g, tree def)
4841 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4842 g->gimple_omp_continue.control_def = def;
4846 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4848 static inline tree
4849 gimple_omp_continue_control_use (const_gimple g)
4851 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4852 return g->gimple_omp_continue.control_use;
4856 /* The same as above, but return the address. */
4858 static inline tree *
4859 gimple_omp_continue_control_use_ptr (gimple g)
4861 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4862 return &g->gimple_omp_continue.control_use;
4866 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4868 static inline void
4869 gimple_omp_continue_set_control_use (gimple g, tree use)
4871 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4872 g->gimple_omp_continue.control_use = use;
4875 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4877 static inline gimple_seq *
4878 gimple_transaction_body_ptr (gimple gs)
4880 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4881 return &gs->gimple_transaction.body;
4884 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4886 static inline gimple_seq
4887 gimple_transaction_body (gimple gs)
4889 return *gimple_transaction_body_ptr (gs);
4892 /* Return the label associated with a GIMPLE_TRANSACTION. */
4894 static inline tree
4895 gimple_transaction_label (const_gimple gs)
4897 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4898 return gs->gimple_transaction.label;
4901 static inline tree *
4902 gimple_transaction_label_ptr (gimple gs)
4904 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4905 return &gs->gimple_transaction.label;
4908 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4910 static inline unsigned int
4911 gimple_transaction_subcode (const_gimple gs)
4913 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4914 return gs->gsbase.subcode;
4917 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4919 static inline void
4920 gimple_transaction_set_body (gimple gs, gimple_seq body)
4922 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4923 gs->gimple_transaction.body = body;
4926 /* Set the label associated with a GIMPLE_TRANSACTION. */
4928 static inline void
4929 gimple_transaction_set_label (gimple gs, tree label)
4931 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4932 gs->gimple_transaction.label = label;
4935 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4937 static inline void
4938 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4940 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4941 gs->gsbase.subcode = subcode;
4945 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4947 static inline tree *
4948 gimple_return_retval_ptr (const_gimple gs)
4950 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4951 return gimple_op_ptr (gs, 0);
4954 /* Return the return value for GIMPLE_RETURN GS. */
4956 static inline tree
4957 gimple_return_retval (const_gimple gs)
4959 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4960 return gimple_op (gs, 0);
4964 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4966 static inline void
4967 gimple_return_set_retval (gimple gs, tree retval)
4969 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4970 gimple_set_op (gs, 0, retval);
4974 /* Return the return bounds for GIMPLE_RETURN GS. */
4976 static inline tree
4977 gimple_return_retbnd (const_gimple gs)
4979 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4980 return gimple_op (gs, 1);
4984 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
4986 static inline void
4987 gimple_return_set_retbnd (gimple gs, tree retval)
4989 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4990 gimple_set_op (gs, 1, retval);
4994 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4996 #define CASE_GIMPLE_OMP \
4997 case GIMPLE_OMP_PARALLEL: \
4998 case GIMPLE_OMP_TASK: \
4999 case GIMPLE_OMP_FOR: \
5000 case GIMPLE_OMP_SECTIONS: \
5001 case GIMPLE_OMP_SECTIONS_SWITCH: \
5002 case GIMPLE_OMP_SINGLE: \
5003 case GIMPLE_OMP_TARGET: \
5004 case GIMPLE_OMP_TEAMS: \
5005 case GIMPLE_OMP_SECTION: \
5006 case GIMPLE_OMP_MASTER: \
5007 case GIMPLE_OMP_TASKGROUP: \
5008 case GIMPLE_OMP_ORDERED: \
5009 case GIMPLE_OMP_CRITICAL: \
5010 case GIMPLE_OMP_RETURN: \
5011 case GIMPLE_OMP_ATOMIC_LOAD: \
5012 case GIMPLE_OMP_ATOMIC_STORE: \
5013 case GIMPLE_OMP_CONTINUE
5015 static inline bool
5016 is_gimple_omp (const_gimple stmt)
5018 switch (gimple_code (stmt))
5020 CASE_GIMPLE_OMP:
5021 return true;
5022 default:
5023 return false;
5028 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5030 static inline bool
5031 gimple_nop_p (const_gimple g)
5033 return gimple_code (g) == GIMPLE_NOP;
5037 /* Return true if GS is a GIMPLE_RESX. */
5039 static inline bool
5040 is_gimple_resx (const_gimple gs)
5042 return gimple_code (gs) == GIMPLE_RESX;
5045 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5047 static inline enum br_predictor
5048 gimple_predict_predictor (gimple gs)
5050 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5051 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
5055 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5057 static inline void
5058 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5060 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5061 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
5062 | (unsigned) predictor;
5066 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5068 static inline enum prediction
5069 gimple_predict_outcome (gimple gs)
5071 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5072 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5076 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5078 static inline void
5079 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5081 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5082 if (outcome == TAKEN)
5083 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
5084 else
5085 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
5089 /* Return the type of the main expression computed by STMT. Return
5090 void_type_node if the statement computes nothing. */
5092 static inline tree
5093 gimple_expr_type (const_gimple stmt)
5095 enum gimple_code code = gimple_code (stmt);
5097 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5099 tree type;
5100 /* In general we want to pass out a type that can be substituted
5101 for both the RHS and the LHS types if there is a possibly
5102 useless conversion involved. That means returning the
5103 original RHS type as far as we can reconstruct it. */
5104 if (code == GIMPLE_CALL)
5105 type = gimple_call_return_type (stmt);
5106 else
5107 switch (gimple_assign_rhs_code (stmt))
5109 case POINTER_PLUS_EXPR:
5110 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5111 break;
5113 default:
5114 /* As fallback use the type of the LHS. */
5115 type = TREE_TYPE (gimple_get_lhs (stmt));
5116 break;
5118 return type;
5120 else if (code == GIMPLE_COND)
5121 return boolean_type_node;
5122 else
5123 return void_type_node;
5126 gimple gimple_call_copy_skip_args (gimple, bitmap);
5128 /* Enum and arrays used for allocation stats. Keep in sync with
5129 gimple.c:gimple_alloc_kind_names. */
5130 enum gimple_alloc_kind
5132 gimple_alloc_kind_assign, /* Assignments. */
5133 gimple_alloc_kind_phi, /* PHI nodes. */
5134 gimple_alloc_kind_cond, /* Conditionals. */
5135 gimple_alloc_kind_rest, /* Everything else. */
5136 gimple_alloc_kind_all
5139 extern int gimple_alloc_counts[];
5140 extern int gimple_alloc_sizes[];
5142 /* Return the allocation kind for a given stmt CODE. */
5143 static inline enum gimple_alloc_kind
5144 gimple_alloc_kind (enum gimple_code code)
5146 switch (code)
5148 case GIMPLE_ASSIGN:
5149 return gimple_alloc_kind_assign;
5150 case GIMPLE_PHI:
5151 return gimple_alloc_kind_phi;
5152 case GIMPLE_COND:
5153 return gimple_alloc_kind_cond;
5154 default:
5155 return gimple_alloc_kind_rest;
5159 extern void dump_gimple_statistics (void);
5161 /* Return true if a location should not be emitted for this statement
5162 by annotate_all_with_location. */
5164 static inline bool
5165 gimple_do_not_emit_location_p (gimple g)
5167 return gimple_plf (g, GF_PLF_1);
5170 /* Mark statement G so a location will not be emitted by
5171 annotate_one_with_location. */
5173 static inline void
5174 gimple_set_do_not_emit_location (gimple g)
5176 /* The PLF flags are initialized to 0 when a new tuple is created,
5177 so no need to initialize it anywhere. */
5178 gimple_set_plf (g, GF_PLF_1, true);
5182 /* Macros for showing usage statistics. */
5183 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5184 ? (x) \
5185 : ((x) < 1024*1024*10 \
5186 ? (x) / 1024 \
5187 : (x) / (1024*1024))))
5189 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5191 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
5193 extern void sort_case_labels (vec<tree> );
5194 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
5195 extern void gimple_seq_set_location (gimple_seq , location_t);
5197 #endif /* GCC_GIMPLE_H */