2014-04-14 Martin Jambor <mjambor@suse.cz>
[official-gcc.git] / gcc / gimple.h
blob11959a82e62e3a0f3b304dc3925d8d806585ac89
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2014 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 typedef gimple gimple_seq_node;
27 /* For each block, the PHI nodes that need to be rewritten are stored into
28 these vectors. */
29 typedef vec<gimple> gimple_vec;
31 enum gimple_code {
32 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
33 #include "gimple.def"
34 #undef DEFGSCODE
35 LAST_AND_UNUSED_GIMPLE_CODE
38 extern const char *const gimple_code_name[];
39 extern const unsigned char gimple_rhs_class_table[];
41 /* Error out if a gimple tuple is addressed incorrectly. */
42 #if defined ENABLE_GIMPLE_CHECKING
43 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
44 extern void gimple_check_failed (const_gimple, const char *, int, \
45 const char *, enum gimple_code, \
46 enum tree_code) ATTRIBUTE_NORETURN;
48 #define GIMPLE_CHECK(GS, CODE) \
49 do { \
50 const_gimple __gs = (GS); \
51 if (gimple_code (__gs) != (CODE)) \
52 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
53 (CODE), ERROR_MARK); \
54 } while (0)
55 #else /* not ENABLE_GIMPLE_CHECKING */
56 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
57 #define GIMPLE_CHECK(GS, CODE) (void)0
58 #endif
60 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
61 get_gimple_rhs_class. */
62 enum gimple_rhs_class
64 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
65 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
66 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
67 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
68 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
69 name, a _DECL, a _REF, etc. */
72 /* Specific flags for individual GIMPLE statements. These flags are
73 always stored in gimple_statement_base.subcode and they may only be
74 defined for statement codes that do not use subcodes.
76 Values for the masks can overlap as long as the overlapping values
77 are never used in the same statement class.
79 The maximum mask value that can be defined is 1 << 15 (i.e., each
80 statement code can hold up to 16 bitflags).
82 Keep this list sorted. */
83 enum gf_mask {
84 GF_ASM_INPUT = 1 << 0,
85 GF_ASM_VOLATILE = 1 << 1,
86 GF_CALL_FROM_THUNK = 1 << 0,
87 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
88 GF_CALL_TAILCALL = 1 << 2,
89 GF_CALL_VA_ARG_PACK = 1 << 3,
90 GF_CALL_NOTHROW = 1 << 4,
91 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
92 GF_CALL_INTERNAL = 1 << 6,
93 GF_OMP_PARALLEL_COMBINED = 1 << 0,
94 GF_OMP_FOR_KIND_MASK = 3 << 0,
95 GF_OMP_FOR_KIND_FOR = 0 << 0,
96 GF_OMP_FOR_KIND_DISTRIBUTE = 1 << 0,
97 GF_OMP_FOR_KIND_SIMD = 2 << 0,
98 GF_OMP_FOR_KIND_CILKSIMD = 3 << 0,
99 GF_OMP_FOR_COMBINED = 1 << 2,
100 GF_OMP_FOR_COMBINED_INTO = 1 << 3,
101 GF_OMP_TARGET_KIND_MASK = 3 << 0,
102 GF_OMP_TARGET_KIND_REGION = 0 << 0,
103 GF_OMP_TARGET_KIND_DATA = 1 << 0,
104 GF_OMP_TARGET_KIND_UPDATE = 2 << 0,
106 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
107 a thread synchronization via some sort of barrier. The exact barrier
108 that would otherwise be emitted is dependent on the OMP statement with
109 which this return is associated. */
110 GF_OMP_RETURN_NOWAIT = 1 << 0,
112 GF_OMP_SECTION_LAST = 1 << 0,
113 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
114 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
115 GF_PREDICT_TAKEN = 1 << 15
118 /* Currently, there are only two types of gimple debug stmt. Others are
119 envisioned, for example, to enable the generation of is_stmt notes
120 in line number information, to mark sequence points, etc. This
121 subcode is to be used to tell them apart. */
122 enum gimple_debug_subcode {
123 GIMPLE_DEBUG_BIND = 0,
124 GIMPLE_DEBUG_SOURCE_BIND = 1
127 /* Masks for selecting a pass local flag (PLF) to work on. These
128 masks are used by gimple_set_plf and gimple_plf. */
129 enum plf_mask {
130 GF_PLF_1 = 1 << 0,
131 GF_PLF_2 = 1 << 1
134 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
135 are for 64 bit hosts. */
137 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
138 chain_next ("%h.next"), variable_size))
139 gimple_statement_base
141 /* [ WORD 1 ]
142 Main identifying code for a tuple. */
143 ENUM_BITFIELD(gimple_code) code : 8;
145 /* Nonzero if a warning should not be emitted on this tuple. */
146 unsigned int no_warning : 1;
148 /* Nonzero if this tuple has been visited. Passes are responsible
149 for clearing this bit before using it. */
150 unsigned int visited : 1;
152 /* Nonzero if this tuple represents a non-temporal move. */
153 unsigned int nontemporal_move : 1;
155 /* Pass local flags. These flags are free for any pass to use as
156 they see fit. Passes should not assume that these flags contain
157 any useful value when the pass starts. Any initial state that
158 the pass requires should be set on entry to the pass. See
159 gimple_set_plf and gimple_plf for usage. */
160 unsigned int plf : 2;
162 /* Nonzero if this statement has been modified and needs to have its
163 operands rescanned. */
164 unsigned modified : 1;
166 /* Nonzero if this statement contains volatile operands. */
167 unsigned has_volatile_ops : 1;
169 /* Padding to get subcode to 16 bit alignment. */
170 unsigned pad : 1;
172 /* The SUBCODE field can be used for tuple-specific flags for tuples
173 that do not require subcodes. Note that SUBCODE should be at
174 least as wide as tree codes, as several tuples store tree codes
175 in there. */
176 unsigned int subcode : 16;
178 /* UID of this statement. This is used by passes that want to
179 assign IDs to statements. It must be assigned and used by each
180 pass. By default it should be assumed to contain garbage. */
181 unsigned uid;
183 /* [ WORD 2 ]
184 Locus information for debug info. */
185 location_t location;
187 /* Number of operands in this tuple. */
188 unsigned num_ops;
190 /* [ WORD 3 ]
191 Basic block holding this statement. */
192 basic_block bb;
194 /* [ WORD 4-5 ]
195 Linked lists of gimple statements. The next pointers form
196 a NULL terminated list, the prev pointers are a cyclic list.
197 A gimple statement is hence also a double-ended list of
198 statements, with the pointer itself being the first element,
199 and the prev pointer being the last. */
200 gimple next;
201 gimple GTY((skip)) prev;
205 /* Base structure for tuples with operands. */
207 /* This gimple subclass has no tag value. */
208 struct GTY(())
209 gimple_statement_with_ops_base : public gimple_statement_base
211 /* [ WORD 1-6 ] : base class */
213 /* [ WORD 7 ]
214 SSA operand vectors. NOTE: It should be possible to
215 amalgamate these vectors with the operand vector OP. However,
216 the SSA operand vectors are organized differently and contain
217 more information (like immediate use chaining). */
218 struct use_optype_d GTY((skip (""))) *use_ops;
222 /* Statements that take register operands. */
224 struct GTY((tag("GSS_WITH_OPS")))
225 gimple_statement_with_ops : public gimple_statement_with_ops_base
227 /* [ WORD 1-7 ] : base class */
229 /* [ WORD 8 ]
230 Operand vector. NOTE! This must always be the last field
231 of this structure. In particular, this means that this
232 structure cannot be embedded inside another one. */
233 tree GTY((length ("%h.num_ops"))) op[1];
237 /* Base for statements that take both memory and register operands. */
239 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
240 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
242 /* [ WORD 1-7 ] : base class */
244 /* [ WORD 8-9 ]
245 Virtual operands for this statement. The GC will pick them
246 up via the ssa_names array. */
247 tree GTY((skip (""))) vdef;
248 tree GTY((skip (""))) vuse;
252 /* Statements that take both memory and register operands. */
254 struct GTY((tag("GSS_WITH_MEM_OPS")))
255 gimple_statement_with_memory_ops :
256 public gimple_statement_with_memory_ops_base
258 /* [ WORD 1-9 ] : base class */
260 /* [ WORD 10 ]
261 Operand vector. NOTE! This must always be the last field
262 of this structure. In particular, this means that this
263 structure cannot be embedded inside another one. */
264 tree GTY((length ("%h.num_ops"))) op[1];
268 /* Call statements that take both memory and register operands. */
270 struct GTY((tag("GSS_CALL")))
271 gimple_statement_call : public gimple_statement_with_memory_ops_base
273 /* [ WORD 1-9 ] : base class */
275 /* [ WORD 10-13 ] */
276 struct pt_solution call_used;
277 struct pt_solution call_clobbered;
279 /* [ WORD 14 ] */
280 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
281 tree GTY ((tag ("0"))) fntype;
282 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
283 } u;
285 /* [ WORD 15 ]
286 Operand vector. NOTE! This must always be the last field
287 of this structure. In particular, this means that this
288 structure cannot be embedded inside another one. */
289 tree GTY((length ("%h.num_ops"))) op[1];
293 /* OpenMP statements (#pragma omp). */
295 struct GTY((tag("GSS_OMP")))
296 gimple_statement_omp : public gimple_statement_base
298 /* [ WORD 1-6 ] : base class */
300 /* [ WORD 7 ] */
301 gimple_seq body;
305 /* GIMPLE_BIND */
307 struct GTY((tag("GSS_BIND")))
308 gimple_statement_bind : public gimple_statement_base
310 /* [ WORD 1-6 ] : base class */
312 /* [ WORD 7 ]
313 Variables declared in this scope. */
314 tree vars;
316 /* [ WORD 8 ]
317 This is different than the BLOCK field in gimple_statement_base,
318 which is analogous to TREE_BLOCK (i.e., the lexical block holding
319 this statement). This field is the equivalent of BIND_EXPR_BLOCK
320 in tree land (i.e., the lexical scope defined by this bind). See
321 gimple-low.c. */
322 tree block;
324 /* [ WORD 9 ] */
325 gimple_seq body;
329 /* GIMPLE_CATCH */
331 struct GTY((tag("GSS_CATCH")))
332 gimple_statement_catch : public gimple_statement_base
334 /* [ WORD 1-6 ] : base class */
336 /* [ WORD 7 ] */
337 tree types;
339 /* [ WORD 8 ] */
340 gimple_seq handler;
344 /* GIMPLE_EH_FILTER */
346 struct GTY((tag("GSS_EH_FILTER")))
347 gimple_statement_eh_filter : public gimple_statement_base
349 /* [ WORD 1-6 ] : base class */
351 /* [ WORD 7 ]
352 Filter types. */
353 tree types;
355 /* [ WORD 8 ]
356 Failure actions. */
357 gimple_seq failure;
360 /* GIMPLE_EH_ELSE */
362 struct GTY((tag("GSS_EH_ELSE")))
363 gimple_statement_eh_else : public gimple_statement_base
365 /* [ WORD 1-6 ] : base class */
367 /* [ WORD 7,8 ] */
368 gimple_seq n_body, e_body;
371 /* GIMPLE_EH_MUST_NOT_THROW */
373 struct GTY((tag("GSS_EH_MNT")))
374 gimple_statement_eh_mnt : public gimple_statement_base
376 /* [ WORD 1-6 ] : base class */
378 /* [ WORD 7 ] Abort function decl. */
379 tree fndecl;
382 /* GIMPLE_PHI */
384 struct GTY((tag("GSS_PHI")))
385 gimple_statement_phi : public gimple_statement_base
387 /* [ WORD 1-6 ] : base class */
389 /* [ WORD 7 ] */
390 unsigned capacity;
391 unsigned nargs;
393 /* [ WORD 8 ] */
394 tree result;
396 /* [ WORD 9 ] */
397 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
401 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
403 struct GTY((tag("GSS_EH_CTRL")))
404 gimple_statement_eh_ctrl : public gimple_statement_base
406 /* [ WORD 1-6 ] : base class */
408 /* [ WORD 7 ]
409 Exception region number. */
410 int region;
413 struct GTY((tag("GSS_EH_CTRL")))
414 gimple_statement_resx : public gimple_statement_eh_ctrl
416 /* No extra fields; adds invariant:
417 stmt->code == GIMPLE_RESX. */
420 struct GTY((tag("GSS_EH_CTRL")))
421 gimple_statement_eh_dispatch : public gimple_statement_eh_ctrl
423 /* No extra fields; adds invariant:
424 stmt->code == GIMPLE_EH_DISPATH. */
428 /* GIMPLE_TRY */
430 struct GTY((tag("GSS_TRY")))
431 gimple_statement_try : public gimple_statement_base
433 /* [ WORD 1-6 ] : base class */
435 /* [ WORD 7 ]
436 Expression to evaluate. */
437 gimple_seq eval;
439 /* [ WORD 8 ]
440 Cleanup expression. */
441 gimple_seq cleanup;
444 /* Kind of GIMPLE_TRY statements. */
445 enum gimple_try_flags
447 /* A try/catch. */
448 GIMPLE_TRY_CATCH = 1 << 0,
450 /* A try/finally. */
451 GIMPLE_TRY_FINALLY = 1 << 1,
452 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
454 /* Analogous to TRY_CATCH_IS_CLEANUP. */
455 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
458 /* GIMPLE_WITH_CLEANUP_EXPR */
460 struct GTY((tag("GSS_WCE")))
461 gimple_statement_wce : public gimple_statement_base
463 /* [ WORD 1-6 ] : base class */
465 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
466 executed if an exception is thrown, not on normal exit of its
467 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
468 in TARGET_EXPRs. */
470 /* [ WORD 7 ]
471 Cleanup expression. */
472 gimple_seq cleanup;
476 /* GIMPLE_ASM */
478 struct GTY((tag("GSS_ASM")))
479 gimple_statement_asm : public gimple_statement_with_memory_ops_base
481 /* [ WORD 1-9 ] : base class */
483 /* [ WORD 10 ]
484 __asm__ statement. */
485 const char *string;
487 /* [ WORD 11 ]
488 Number of inputs, outputs, clobbers, labels. */
489 unsigned char ni;
490 unsigned char no;
491 unsigned char nc;
492 unsigned char nl;
494 /* [ WORD 12 ]
495 Operand vector. NOTE! This must always be the last field
496 of this structure. In particular, this means that this
497 structure cannot be embedded inside another one. */
498 tree GTY((length ("%h.num_ops"))) op[1];
501 /* GIMPLE_OMP_CRITICAL */
503 struct GTY((tag("GSS_OMP_CRITICAL")))
504 gimple_statement_omp_critical : public gimple_statement_omp
506 /* [ WORD 1-7 ] : base class */
508 /* [ WORD 8 ]
509 Critical section name. */
510 tree name;
514 struct GTY(()) gimple_omp_for_iter {
515 /* Condition code. */
516 enum tree_code cond;
518 /* Index variable. */
519 tree index;
521 /* Initial value. */
522 tree initial;
524 /* Final value. */
525 tree final;
527 /* Increment. */
528 tree incr;
531 /* GIMPLE_OMP_FOR */
533 struct GTY((tag("GSS_OMP_FOR")))
534 gimple_statement_omp_for : public gimple_statement_omp
536 /* [ WORD 1-7 ] : base class */
538 /* [ WORD 8 ] */
539 tree clauses;
541 /* [ WORD 9 ]
542 Number of elements in iter array. */
543 size_t collapse;
545 /* [ WORD 10 ] */
546 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
548 /* [ WORD 11 ]
549 Pre-body evaluated before the loop body begins. */
550 gimple_seq pre_body;
554 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
555 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
556 gimple_statement_omp_parallel_layout : public gimple_statement_omp
558 /* [ WORD 1-7 ] : base class */
560 /* [ WORD 8 ]
561 Clauses. */
562 tree clauses;
564 /* [ WORD 9 ]
565 Child function holding the body of the parallel region. */
566 tree child_fn;
568 /* [ WORD 10 ]
569 Shared data argument. */
570 tree data_arg;
573 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
574 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
575 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
577 /* No extra fields; adds invariant:
578 stmt->code == GIMPLE_OMP_PARALLEL
579 || stmt->code == GIMPLE_OMP_TASK. */
583 /* GIMPLE_OMP_PARALLEL */
584 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
585 gimple_statement_omp_parallel : public gimple_statement_omp_taskreg
587 /* No extra fields; adds invariant:
588 stmt->code == GIMPLE_OMP_PARALLEL. */
591 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
592 gimple_statement_omp_target : public gimple_statement_omp_parallel_layout
594 /* No extra fields; adds invariant:
595 stmt->code == GIMPLE_OMP_TARGET. */
598 /* GIMPLE_OMP_TASK */
600 struct GTY((tag("GSS_OMP_TASK")))
601 gimple_statement_omp_task : public gimple_statement_omp_taskreg
603 /* [ WORD 1-10 ] : base class */
605 /* [ WORD 11 ]
606 Child function holding firstprivate initialization if needed. */
607 tree copy_fn;
609 /* [ WORD 12-13 ]
610 Size and alignment in bytes of the argument data block. */
611 tree arg_size;
612 tree arg_align;
616 /* GIMPLE_OMP_SECTION */
617 /* Uses struct gimple_statement_omp. */
620 /* GIMPLE_OMP_SECTIONS */
622 struct GTY((tag("GSS_OMP_SECTIONS")))
623 gimple_statement_omp_sections : public gimple_statement_omp
625 /* [ WORD 1-7 ] : base class */
627 /* [ WORD 8 ] */
628 tree clauses;
630 /* [ WORD 9 ]
631 The control variable used for deciding which of the sections to
632 execute. */
633 tree control;
636 /* GIMPLE_OMP_CONTINUE.
638 Note: This does not inherit from gimple_statement_omp, because we
639 do not need the body field. */
641 struct GTY((tag("GSS_OMP_CONTINUE")))
642 gimple_statement_omp_continue : public gimple_statement_base
644 /* [ WORD 1-6 ] : base class */
646 /* [ WORD 7 ] */
647 tree control_def;
649 /* [ WORD 8 ] */
650 tree control_use;
653 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
655 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
656 gimple_statement_omp_single_layout : public gimple_statement_omp
658 /* [ WORD 1-7 ] : base class */
660 /* [ WORD 7 ] */
661 tree clauses;
664 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
665 gimple_statement_omp_single : public gimple_statement_omp_single_layout
667 /* No extra fields; adds invariant:
668 stmt->code == GIMPLE_OMP_SINGLE. */
671 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
672 gimple_statement_omp_teams : public gimple_statement_omp_single_layout
674 /* No extra fields; adds invariant:
675 stmt->code == GIMPLE_OMP_TEAMS. */
679 /* GIMPLE_OMP_ATOMIC_LOAD.
680 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
681 contains a sequence, which we don't need here. */
683 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
684 gimple_statement_omp_atomic_load : public gimple_statement_base
686 /* [ WORD 1-6 ] : base class */
688 /* [ WORD 7-8 ] */
689 tree rhs, lhs;
692 /* GIMPLE_OMP_ATOMIC_STORE.
693 See note on GIMPLE_OMP_ATOMIC_LOAD. */
695 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
696 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
698 /* [ WORD 1-6 ] : base class */
700 /* [ WORD 7 ] */
701 tree val;
704 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
705 gimple_statement_omp_atomic_store :
706 public gimple_statement_omp_atomic_store_layout
708 /* No extra fields; adds invariant:
709 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
712 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
713 gimple_statement_omp_return :
714 public gimple_statement_omp_atomic_store_layout
716 /* No extra fields; adds invariant:
717 stmt->code == GIMPLE_OMP_RETURN. */
720 /* GIMPLE_TRANSACTION. */
722 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
724 /* The __transaction_atomic was declared [[outer]] or it is
725 __transaction_relaxed. */
726 #define GTMA_IS_OUTER (1u << 0)
727 #define GTMA_IS_RELAXED (1u << 1)
728 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
730 /* The transaction is seen to not have an abort. */
731 #define GTMA_HAVE_ABORT (1u << 2)
732 /* The transaction is seen to have loads or stores. */
733 #define GTMA_HAVE_LOAD (1u << 3)
734 #define GTMA_HAVE_STORE (1u << 4)
735 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
736 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
737 /* The transaction WILL enter serial irrevocable mode.
738 An irrevocable block post-dominates the entire transaction, such
739 that all invocations of the transaction will go serial-irrevocable.
740 In such case, we don't bother instrumenting the transaction, and
741 tell the runtime that it should begin the transaction in
742 serial-irrevocable mode. */
743 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
744 /* The transaction contains no instrumentation code whatsover, most
745 likely because it is guaranteed to go irrevocable upon entry. */
746 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
748 struct GTY((tag("GSS_TRANSACTION")))
749 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
751 /* [ WORD 1-9 ] : base class */
753 /* [ WORD 10 ] */
754 gimple_seq body;
756 /* [ WORD 11 ] */
757 tree label;
760 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
761 enum gimple_statement_structure_enum {
762 #include "gsstruct.def"
763 LAST_GSS_ENUM
765 #undef DEFGSSTRUCT
767 template <>
768 template <>
769 inline bool
770 is_a_helper <gimple_statement_asm>::test (gimple gs)
772 return gs->code == GIMPLE_ASM;
775 template <>
776 template <>
777 inline bool
778 is_a_helper <gimple_statement_bind>::test (gimple gs)
780 return gs->code == GIMPLE_BIND;
783 template <>
784 template <>
785 inline bool
786 is_a_helper <gimple_statement_call>::test (gimple gs)
788 return gs->code == GIMPLE_CALL;
791 template <>
792 template <>
793 inline bool
794 is_a_helper <gimple_statement_catch>::test (gimple gs)
796 return gs->code == GIMPLE_CATCH;
799 template <>
800 template <>
801 inline bool
802 is_a_helper <gimple_statement_resx>::test (gimple gs)
804 return gs->code == GIMPLE_RESX;
807 template <>
808 template <>
809 inline bool
810 is_a_helper <gimple_statement_eh_dispatch>::test (gimple gs)
812 return gs->code == GIMPLE_EH_DISPATCH;
815 template <>
816 template <>
817 inline bool
818 is_a_helper <gimple_statement_eh_else>::test (gimple gs)
820 return gs->code == GIMPLE_EH_ELSE;
823 template <>
824 template <>
825 inline bool
826 is_a_helper <gimple_statement_eh_filter>::test (gimple gs)
828 return gs->code == GIMPLE_EH_FILTER;
831 template <>
832 template <>
833 inline bool
834 is_a_helper <gimple_statement_eh_mnt>::test (gimple gs)
836 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
839 template <>
840 template <>
841 inline bool
842 is_a_helper <gimple_statement_omp_atomic_load>::test (gimple gs)
844 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
847 template <>
848 template <>
849 inline bool
850 is_a_helper <gimple_statement_omp_atomic_store>::test (gimple gs)
852 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
855 template <>
856 template <>
857 inline bool
858 is_a_helper <gimple_statement_omp_return>::test (gimple gs)
860 return gs->code == GIMPLE_OMP_RETURN;
863 template <>
864 template <>
865 inline bool
866 is_a_helper <gimple_statement_omp_continue>::test (gimple gs)
868 return gs->code == GIMPLE_OMP_CONTINUE;
871 template <>
872 template <>
873 inline bool
874 is_a_helper <gimple_statement_omp_critical>::test (gimple gs)
876 return gs->code == GIMPLE_OMP_CRITICAL;
879 template <>
880 template <>
881 inline bool
882 is_a_helper <gimple_statement_omp_for>::test (gimple gs)
884 return gs->code == GIMPLE_OMP_FOR;
887 template <>
888 template <>
889 inline bool
890 is_a_helper <gimple_statement_omp_taskreg>::test (gimple gs)
892 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
895 template <>
896 template <>
897 inline bool
898 is_a_helper <gimple_statement_omp_parallel>::test (gimple gs)
900 return gs->code == GIMPLE_OMP_PARALLEL;
903 template <>
904 template <>
905 inline bool
906 is_a_helper <gimple_statement_omp_target>::test (gimple gs)
908 return gs->code == GIMPLE_OMP_TARGET;
911 template <>
912 template <>
913 inline bool
914 is_a_helper <gimple_statement_omp_sections>::test (gimple gs)
916 return gs->code == GIMPLE_OMP_SECTIONS;
919 template <>
920 template <>
921 inline bool
922 is_a_helper <gimple_statement_omp_single>::test (gimple gs)
924 return gs->code == GIMPLE_OMP_SINGLE;
927 template <>
928 template <>
929 inline bool
930 is_a_helper <gimple_statement_omp_teams>::test (gimple gs)
932 return gs->code == GIMPLE_OMP_TEAMS;
935 template <>
936 template <>
937 inline bool
938 is_a_helper <gimple_statement_omp_task>::test (gimple gs)
940 return gs->code == GIMPLE_OMP_TASK;
943 template <>
944 template <>
945 inline bool
946 is_a_helper <gimple_statement_phi>::test (gimple gs)
948 return gs->code == GIMPLE_PHI;
951 template <>
952 template <>
953 inline bool
954 is_a_helper <gimple_statement_transaction>::test (gimple gs)
956 return gs->code == GIMPLE_TRANSACTION;
959 template <>
960 template <>
961 inline bool
962 is_a_helper <gimple_statement_try>::test (gimple gs)
964 return gs->code == GIMPLE_TRY;
967 template <>
968 template <>
969 inline bool
970 is_a_helper <gimple_statement_wce>::test (gimple gs)
972 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
975 template <>
976 template <>
977 inline bool
978 is_a_helper <const gimple_statement_asm>::test (const_gimple gs)
980 return gs->code == GIMPLE_ASM;
983 template <>
984 template <>
985 inline bool
986 is_a_helper <const gimple_statement_bind>::test (const_gimple gs)
988 return gs->code == GIMPLE_BIND;
991 template <>
992 template <>
993 inline bool
994 is_a_helper <const gimple_statement_call>::test (const_gimple gs)
996 return gs->code == GIMPLE_CALL;
999 template <>
1000 template <>
1001 inline bool
1002 is_a_helper <const gimple_statement_catch>::test (const_gimple gs)
1004 return gs->code == GIMPLE_CATCH;
1007 template <>
1008 template <>
1009 inline bool
1010 is_a_helper <const gimple_statement_resx>::test (const_gimple gs)
1012 return gs->code == GIMPLE_RESX;
1015 template <>
1016 template <>
1017 inline bool
1018 is_a_helper <const gimple_statement_eh_dispatch>::test (const_gimple gs)
1020 return gs->code == GIMPLE_EH_DISPATCH;
1023 template <>
1024 template <>
1025 inline bool
1026 is_a_helper <const gimple_statement_eh_filter>::test (const_gimple gs)
1028 return gs->code == GIMPLE_EH_FILTER;
1031 template <>
1032 template <>
1033 inline bool
1034 is_a_helper <const gimple_statement_omp_atomic_load>::test (const_gimple gs)
1036 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1039 template <>
1040 template <>
1041 inline bool
1042 is_a_helper <const gimple_statement_omp_atomic_store>::test (const_gimple gs)
1044 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1047 template <>
1048 template <>
1049 inline bool
1050 is_a_helper <const gimple_statement_omp_return>::test (const_gimple gs)
1052 return gs->code == GIMPLE_OMP_RETURN;
1055 template <>
1056 template <>
1057 inline bool
1058 is_a_helper <const gimple_statement_omp_continue>::test (const_gimple gs)
1060 return gs->code == GIMPLE_OMP_CONTINUE;
1063 template <>
1064 template <>
1065 inline bool
1066 is_a_helper <const gimple_statement_omp_critical>::test (const_gimple gs)
1068 return gs->code == GIMPLE_OMP_CRITICAL;
1071 template <>
1072 template <>
1073 inline bool
1074 is_a_helper <const gimple_statement_omp_for>::test (const_gimple gs)
1076 return gs->code == GIMPLE_OMP_FOR;
1079 template <>
1080 template <>
1081 inline bool
1082 is_a_helper <const gimple_statement_omp_taskreg>::test (const_gimple gs)
1084 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1087 template <>
1088 template <>
1089 inline bool
1090 is_a_helper <const gimple_statement_omp_parallel>::test (const_gimple gs)
1092 return gs->code == GIMPLE_OMP_PARALLEL;
1095 template <>
1096 template <>
1097 inline bool
1098 is_a_helper <const gimple_statement_omp_target>::test (const_gimple gs)
1100 return gs->code == GIMPLE_OMP_TARGET;
1103 template <>
1104 template <>
1105 inline bool
1106 is_a_helper <const gimple_statement_omp_sections>::test (const_gimple gs)
1108 return gs->code == GIMPLE_OMP_SECTIONS;
1111 template <>
1112 template <>
1113 inline bool
1114 is_a_helper <const gimple_statement_omp_single>::test (const_gimple gs)
1116 return gs->code == GIMPLE_OMP_SINGLE;
1119 template <>
1120 template <>
1121 inline bool
1122 is_a_helper <const gimple_statement_omp_teams>::test (const_gimple gs)
1124 return gs->code == GIMPLE_OMP_TEAMS;
1127 template <>
1128 template <>
1129 inline bool
1130 is_a_helper <const gimple_statement_omp_task>::test (const_gimple gs)
1132 return gs->code == GIMPLE_OMP_TASK;
1135 template <>
1136 template <>
1137 inline bool
1138 is_a_helper <const gimple_statement_phi>::test (const_gimple gs)
1140 return gs->code == GIMPLE_PHI;
1143 template <>
1144 template <>
1145 inline bool
1146 is_a_helper <const gimple_statement_transaction>::test (const_gimple gs)
1148 return gs->code == GIMPLE_TRANSACTION;
1151 /* Offset in bytes to the location of the operand vector.
1152 Zero if there is no operand vector for this tuple structure. */
1153 extern size_t const gimple_ops_offset_[];
1155 /* Map GIMPLE codes to GSS codes. */
1156 extern enum gimple_statement_structure_enum const gss_for_code_[];
1158 /* This variable holds the currently expanded gimple statement for purposes
1159 of comminucating the profile info to the builtin expanders. */
1160 extern gimple currently_expanding_gimple_stmt;
1162 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1163 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1164 gimple gimple_build_return (tree);
1165 void gimple_call_reset_alias_info (gimple);
1166 gimple gimple_build_call_vec (tree, vec<tree> );
1167 gimple gimple_build_call (tree, unsigned, ...);
1168 gimple gimple_build_call_valist (tree, unsigned, va_list);
1169 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1170 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1171 gimple gimple_build_call_from_tree (tree);
1172 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1173 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1174 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1175 tree, tree, tree CXX_MEM_STAT_INFO);
1176 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1177 tree, tree CXX_MEM_STAT_INFO);
1178 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1179 gimple gimple_build_cond_from_tree (tree, tree, tree);
1180 void gimple_cond_set_condition_from_tree (gimple, tree);
1181 gimple gimple_build_label (tree label);
1182 gimple gimple_build_goto (tree dest);
1183 gimple gimple_build_nop (void);
1184 gimple gimple_build_bind (tree, gimple_seq, tree);
1185 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1186 vec<tree, va_gc> *, vec<tree, va_gc> *,
1187 vec<tree, va_gc> *);
1188 gimple gimple_build_catch (tree, gimple_seq);
1189 gimple gimple_build_eh_filter (tree, gimple_seq);
1190 gimple gimple_build_eh_must_not_throw (tree);
1191 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1192 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1193 enum gimple_try_flags);
1194 gimple gimple_build_wce (gimple_seq);
1195 gimple gimple_build_resx (int);
1196 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1197 gimple gimple_build_switch (tree, tree, vec<tree> );
1198 gimple gimple_build_eh_dispatch (int);
1199 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1200 #define gimple_build_debug_bind(var,val,stmt) \
1201 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1202 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1203 #define gimple_build_debug_source_bind(var,val,stmt) \
1204 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1205 gimple gimple_build_omp_critical (gimple_seq, tree);
1206 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1207 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1208 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1209 gimple gimple_build_omp_section (gimple_seq);
1210 gimple gimple_build_omp_master (gimple_seq);
1211 gimple gimple_build_omp_taskgroup (gimple_seq);
1212 gimple gimple_build_omp_continue (tree, tree);
1213 gimple gimple_build_omp_ordered (gimple_seq);
1214 gimple gimple_build_omp_return (bool);
1215 gimple gimple_build_omp_sections (gimple_seq, tree);
1216 gimple gimple_build_omp_sections_switch (void);
1217 gimple gimple_build_omp_single (gimple_seq, tree);
1218 gimple gimple_build_omp_target (gimple_seq, int, tree);
1219 gimple gimple_build_omp_teams (gimple_seq, tree);
1220 gimple gimple_build_omp_atomic_load (tree, tree);
1221 gimple gimple_build_omp_atomic_store (tree);
1222 gimple gimple_build_transaction (gimple_seq, tree);
1223 gimple gimple_build_predict (enum br_predictor, enum prediction);
1224 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1225 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1226 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1227 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1228 location_t);
1229 extern void annotate_all_with_location (gimple_seq, location_t);
1230 bool empty_body_p (gimple_seq);
1231 gimple_seq gimple_seq_copy (gimple_seq);
1232 bool gimple_call_same_target_p (const_gimple, const_gimple);
1233 int gimple_call_flags (const_gimple);
1234 int gimple_call_arg_flags (const_gimple, unsigned);
1235 int gimple_call_return_flags (const_gimple);
1236 bool gimple_assign_copy_p (gimple);
1237 bool gimple_assign_ssa_name_copy_p (gimple);
1238 bool gimple_assign_unary_nop_p (gimple);
1239 void gimple_set_bb (gimple, basic_block);
1240 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1241 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1242 tree, tree, tree);
1243 tree gimple_get_lhs (const_gimple);
1244 void gimple_set_lhs (gimple, tree);
1245 gimple gimple_copy (gimple);
1246 bool gimple_has_side_effects (const_gimple);
1247 bool gimple_could_trap_p_1 (gimple, bool, bool);
1248 bool gimple_could_trap_p (gimple);
1249 bool gimple_assign_rhs_could_trap_p (gimple);
1250 extern void dump_gimple_statistics (void);
1251 unsigned get_gimple_rhs_num_ops (enum tree_code);
1252 extern tree canonicalize_cond_expr_cond (tree);
1253 gimple gimple_call_copy_skip_args (gimple, bitmap);
1254 extern bool gimple_compare_field_offset (tree, tree);
1255 extern tree gimple_unsigned_type (tree);
1256 extern tree gimple_signed_type (tree);
1257 extern alias_set_type gimple_get_alias_set (tree);
1258 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1259 extern bool gimple_builtin_call_types_compatible_p (gimple, tree);
1260 extern bool gimple_call_builtin_p (gimple);
1261 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
1262 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1263 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1264 extern void dump_decl_set (FILE *, bitmap);
1265 extern bool nonfreeing_call_p (gimple);
1266 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1267 extern void sort_case_labels (vec<tree> );
1268 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1269 extern void gimple_seq_set_location (gimple_seq , location_t);
1271 /* Formal (expression) temporary table handling: multiple occurrences of
1272 the same scalar expression are evaluated into the same temporary. */
1274 typedef struct gimple_temp_hash_elt
1276 tree val; /* Key */
1277 tree temp; /* Value */
1278 } elt_t;
1280 /* Get the number of the next statement uid to be allocated. */
1281 static inline unsigned int
1282 gimple_stmt_max_uid (struct function *fn)
1284 return fn->last_stmt_uid;
1287 /* Set the number of the next statement uid to be allocated. */
1288 static inline void
1289 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1291 fn->last_stmt_uid = maxid;
1294 /* Set the number of the next statement uid to be allocated. */
1295 static inline unsigned int
1296 inc_gimple_stmt_max_uid (struct function *fn)
1298 return fn->last_stmt_uid++;
1301 /* Return the first node in GIMPLE sequence S. */
1303 static inline gimple_seq_node
1304 gimple_seq_first (gimple_seq s)
1306 return s;
1310 /* Return the first statement in GIMPLE sequence S. */
1312 static inline gimple
1313 gimple_seq_first_stmt (gimple_seq s)
1315 gimple_seq_node n = gimple_seq_first (s);
1316 return n;
1320 /* Return the last node in GIMPLE sequence S. */
1322 static inline gimple_seq_node
1323 gimple_seq_last (gimple_seq s)
1325 return s ? s->prev : NULL;
1329 /* Return the last statement in GIMPLE sequence S. */
1331 static inline gimple
1332 gimple_seq_last_stmt (gimple_seq s)
1334 gimple_seq_node n = gimple_seq_last (s);
1335 return n;
1339 /* Set the last node in GIMPLE sequence *PS to LAST. */
1341 static inline void
1342 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1344 (*ps)->prev = last;
1348 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1350 static inline void
1351 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1353 *ps = first;
1357 /* Return true if GIMPLE sequence S is empty. */
1359 static inline bool
1360 gimple_seq_empty_p (gimple_seq s)
1362 return s == NULL;
1365 /* Allocate a new sequence and initialize its first element with STMT. */
1367 static inline gimple_seq
1368 gimple_seq_alloc_with_stmt (gimple stmt)
1370 gimple_seq seq = NULL;
1371 gimple_seq_add_stmt (&seq, stmt);
1372 return seq;
1376 /* Returns the sequence of statements in BB. */
1378 static inline gimple_seq
1379 bb_seq (const_basic_block bb)
1381 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1384 static inline gimple_seq *
1385 bb_seq_addr (basic_block bb)
1387 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1390 /* Sets the sequence of statements in BB to SEQ. */
1392 static inline void
1393 set_bb_seq (basic_block bb, gimple_seq seq)
1395 gcc_checking_assert (!(bb->flags & BB_RTL));
1396 bb->il.gimple.seq = seq;
1400 /* Return the code for GIMPLE statement G. */
1402 static inline enum gimple_code
1403 gimple_code (const_gimple g)
1405 return g->code;
1409 /* Return the GSS code used by a GIMPLE code. */
1411 static inline enum gimple_statement_structure_enum
1412 gss_for_code (enum gimple_code code)
1414 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1415 return gss_for_code_[code];
1419 /* Return which GSS code is used by GS. */
1421 static inline enum gimple_statement_structure_enum
1422 gimple_statement_structure (gimple gs)
1424 return gss_for_code (gimple_code (gs));
1428 /* Return true if statement G has sub-statements. This is only true for
1429 High GIMPLE statements. */
1431 static inline bool
1432 gimple_has_substatements (gimple g)
1434 switch (gimple_code (g))
1436 case GIMPLE_BIND:
1437 case GIMPLE_CATCH:
1438 case GIMPLE_EH_FILTER:
1439 case GIMPLE_EH_ELSE:
1440 case GIMPLE_TRY:
1441 case GIMPLE_OMP_FOR:
1442 case GIMPLE_OMP_MASTER:
1443 case GIMPLE_OMP_TASKGROUP:
1444 case GIMPLE_OMP_ORDERED:
1445 case GIMPLE_OMP_SECTION:
1446 case GIMPLE_OMP_PARALLEL:
1447 case GIMPLE_OMP_TASK:
1448 case GIMPLE_OMP_SECTIONS:
1449 case GIMPLE_OMP_SINGLE:
1450 case GIMPLE_OMP_TARGET:
1451 case GIMPLE_OMP_TEAMS:
1452 case GIMPLE_OMP_CRITICAL:
1453 case GIMPLE_WITH_CLEANUP_EXPR:
1454 case GIMPLE_TRANSACTION:
1455 return true;
1457 default:
1458 return false;
1463 /* Return the basic block holding statement G. */
1465 static inline basic_block
1466 gimple_bb (const_gimple g)
1468 return g->bb;
1472 /* Return the lexical scope block holding statement G. */
1474 static inline tree
1475 gimple_block (const_gimple g)
1477 return LOCATION_BLOCK (g->location);
1481 /* Set BLOCK to be the lexical scope block holding statement G. */
1483 static inline void
1484 gimple_set_block (gimple g, tree block)
1486 if (block)
1487 g->location =
1488 COMBINE_LOCATION_DATA (line_table, g->location, block);
1489 else
1490 g->location = LOCATION_LOCUS (g->location);
1494 /* Return location information for statement G. */
1496 static inline location_t
1497 gimple_location (const_gimple g)
1499 return g->location;
1502 /* Return pointer to location information for statement G. */
1504 static inline const location_t *
1505 gimple_location_ptr (const_gimple g)
1507 return &g->location;
1511 /* Set location information for statement G. */
1513 static inline void
1514 gimple_set_location (gimple g, location_t location)
1516 g->location = location;
1520 /* Return true if G contains location information. */
1522 static inline bool
1523 gimple_has_location (const_gimple g)
1525 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1529 /* Return the file name of the location of STMT. */
1531 static inline const char *
1532 gimple_filename (const_gimple stmt)
1534 return LOCATION_FILE (gimple_location (stmt));
1538 /* Return the line number of the location of STMT. */
1540 static inline int
1541 gimple_lineno (const_gimple stmt)
1543 return LOCATION_LINE (gimple_location (stmt));
1547 /* Determine whether SEQ is a singleton. */
1549 static inline bool
1550 gimple_seq_singleton_p (gimple_seq seq)
1552 return ((gimple_seq_first (seq) != NULL)
1553 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1556 /* Return true if no warnings should be emitted for statement STMT. */
1558 static inline bool
1559 gimple_no_warning_p (const_gimple stmt)
1561 return stmt->no_warning;
1564 /* Set the no_warning flag of STMT to NO_WARNING. */
1566 static inline void
1567 gimple_set_no_warning (gimple stmt, bool no_warning)
1569 stmt->no_warning = (unsigned) no_warning;
1572 /* Set the visited status on statement STMT to VISITED_P. */
1574 static inline void
1575 gimple_set_visited (gimple stmt, bool visited_p)
1577 stmt->visited = (unsigned) visited_p;
1581 /* Return the visited status for statement STMT. */
1583 static inline bool
1584 gimple_visited_p (gimple stmt)
1586 return stmt->visited;
1590 /* Set pass local flag PLF on statement STMT to VAL_P. */
1592 static inline void
1593 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1595 if (val_p)
1596 stmt->plf |= (unsigned int) plf;
1597 else
1598 stmt->plf &= ~((unsigned int) plf);
1602 /* Return the value of pass local flag PLF on statement STMT. */
1604 static inline unsigned int
1605 gimple_plf (gimple stmt, enum plf_mask plf)
1607 return stmt->plf & ((unsigned int) plf);
1611 /* Set the UID of statement. */
1613 static inline void
1614 gimple_set_uid (gimple g, unsigned uid)
1616 g->uid = uid;
1620 /* Return the UID of statement. */
1622 static inline unsigned
1623 gimple_uid (const_gimple g)
1625 return g->uid;
1629 /* Make statement G a singleton sequence. */
1631 static inline void
1632 gimple_init_singleton (gimple g)
1634 g->next = NULL;
1635 g->prev = g;
1639 /* Return true if GIMPLE statement G has register or memory operands. */
1641 static inline bool
1642 gimple_has_ops (const_gimple g)
1644 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1647 template <>
1648 template <>
1649 inline bool
1650 is_a_helper <const gimple_statement_with_ops>::test (const_gimple gs)
1652 return gimple_has_ops (gs);
1655 template <>
1656 template <>
1657 inline bool
1658 is_a_helper <gimple_statement_with_ops>::test (gimple gs)
1660 return gimple_has_ops (gs);
1663 /* Return true if GIMPLE statement G has memory operands. */
1665 static inline bool
1666 gimple_has_mem_ops (const_gimple g)
1668 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1671 template <>
1672 template <>
1673 inline bool
1674 is_a_helper <const gimple_statement_with_memory_ops>::test (const_gimple gs)
1676 return gimple_has_mem_ops (gs);
1679 template <>
1680 template <>
1681 inline bool
1682 is_a_helper <gimple_statement_with_memory_ops>::test (gimple gs)
1684 return gimple_has_mem_ops (gs);
1687 /* Return the set of USE operands for statement G. */
1689 static inline struct use_optype_d *
1690 gimple_use_ops (const_gimple g)
1692 const gimple_statement_with_ops *ops_stmt =
1693 dyn_cast <const gimple_statement_with_ops> (g);
1694 if (!ops_stmt)
1695 return NULL;
1696 return ops_stmt->use_ops;
1700 /* Set USE to be the set of USE operands for statement G. */
1702 static inline void
1703 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1705 gimple_statement_with_ops *ops_stmt =
1706 as_a <gimple_statement_with_ops> (g);
1707 ops_stmt->use_ops = use;
1711 /* Return the single VUSE operand of the statement G. */
1713 static inline tree
1714 gimple_vuse (const_gimple g)
1716 const gimple_statement_with_memory_ops *mem_ops_stmt =
1717 dyn_cast <const gimple_statement_with_memory_ops> (g);
1718 if (!mem_ops_stmt)
1719 return NULL_TREE;
1720 return mem_ops_stmt->vuse;
1723 /* Return the single VDEF operand of the statement G. */
1725 static inline tree
1726 gimple_vdef (const_gimple g)
1728 const gimple_statement_with_memory_ops *mem_ops_stmt =
1729 dyn_cast <const gimple_statement_with_memory_ops> (g);
1730 if (!mem_ops_stmt)
1731 return NULL_TREE;
1732 return mem_ops_stmt->vdef;
1735 /* Return the single VUSE operand of the statement G. */
1737 static inline tree *
1738 gimple_vuse_ptr (gimple g)
1740 gimple_statement_with_memory_ops *mem_ops_stmt =
1741 dyn_cast <gimple_statement_with_memory_ops> (g);
1742 if (!mem_ops_stmt)
1743 return NULL;
1744 return &mem_ops_stmt->vuse;
1747 /* Return the single VDEF operand of the statement G. */
1749 static inline tree *
1750 gimple_vdef_ptr (gimple g)
1752 gimple_statement_with_memory_ops *mem_ops_stmt =
1753 dyn_cast <gimple_statement_with_memory_ops> (g);
1754 if (!mem_ops_stmt)
1755 return NULL;
1756 return &mem_ops_stmt->vdef;
1759 /* Set the single VUSE operand of the statement G. */
1761 static inline void
1762 gimple_set_vuse (gimple g, tree vuse)
1764 gimple_statement_with_memory_ops *mem_ops_stmt =
1765 as_a <gimple_statement_with_memory_ops> (g);
1766 mem_ops_stmt->vuse = vuse;
1769 /* Set the single VDEF operand of the statement G. */
1771 static inline void
1772 gimple_set_vdef (gimple g, tree vdef)
1774 gimple_statement_with_memory_ops *mem_ops_stmt =
1775 as_a <gimple_statement_with_memory_ops> (g);
1776 mem_ops_stmt->vdef = vdef;
1780 /* Return true if statement G has operands and the modified field has
1781 been set. */
1783 static inline bool
1784 gimple_modified_p (const_gimple g)
1786 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1790 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1791 a MODIFIED field. */
1793 static inline void
1794 gimple_set_modified (gimple s, bool modifiedp)
1796 if (gimple_has_ops (s))
1797 s->modified = (unsigned) modifiedp;
1801 /* Return the tree code for the expression computed by STMT. This is
1802 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1803 GIMPLE_CALL, return CALL_EXPR as the expression code for
1804 consistency. This is useful when the caller needs to deal with the
1805 three kinds of computation that GIMPLE supports. */
1807 static inline enum tree_code
1808 gimple_expr_code (const_gimple stmt)
1810 enum gimple_code code = gimple_code (stmt);
1811 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1812 return (enum tree_code) stmt->subcode;
1813 else
1815 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1816 return CALL_EXPR;
1821 /* Return true if statement STMT contains volatile operands. */
1823 static inline bool
1824 gimple_has_volatile_ops (const_gimple stmt)
1826 if (gimple_has_mem_ops (stmt))
1827 return stmt->has_volatile_ops;
1828 else
1829 return false;
1833 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1835 static inline void
1836 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1838 if (gimple_has_mem_ops (stmt))
1839 stmt->has_volatile_ops = (unsigned) volatilep;
1842 /* Return true if STMT is in a transaction. */
1844 static inline bool
1845 gimple_in_transaction (gimple stmt)
1847 return bb_in_transaction (gimple_bb (stmt));
1850 /* Return true if statement STMT may access memory. */
1852 static inline bool
1853 gimple_references_memory_p (gimple stmt)
1855 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1859 /* Return the subcode for OMP statement S. */
1861 static inline unsigned
1862 gimple_omp_subcode (const_gimple s)
1864 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1865 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1866 return s->subcode;
1869 /* Set the subcode for OMP statement S to SUBCODE. */
1871 static inline void
1872 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1874 /* We only have 16 bits for the subcode. Assert that we are not
1875 overflowing it. */
1876 gcc_gimple_checking_assert (subcode < (1 << 16));
1877 s->subcode = subcode;
1880 /* Set the nowait flag on OMP_RETURN statement S. */
1882 static inline void
1883 gimple_omp_return_set_nowait (gimple s)
1885 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1886 s->subcode |= GF_OMP_RETURN_NOWAIT;
1890 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1891 flag set. */
1893 static inline bool
1894 gimple_omp_return_nowait_p (const_gimple g)
1896 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1897 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1901 /* Set the LHS of OMP return. */
1903 static inline void
1904 gimple_omp_return_set_lhs (gimple g, tree lhs)
1906 gimple_statement_omp_return *omp_return_stmt =
1907 as_a <gimple_statement_omp_return> (g);
1908 omp_return_stmt->val = lhs;
1912 /* Get the LHS of OMP return. */
1914 static inline tree
1915 gimple_omp_return_lhs (const_gimple g)
1917 const gimple_statement_omp_return *omp_return_stmt =
1918 as_a <const gimple_statement_omp_return> (g);
1919 return omp_return_stmt->val;
1923 /* Return a pointer to the LHS of OMP return. */
1925 static inline tree *
1926 gimple_omp_return_lhs_ptr (gimple g)
1928 gimple_statement_omp_return *omp_return_stmt =
1929 as_a <gimple_statement_omp_return> (g);
1930 return &omp_return_stmt->val;
1934 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1935 flag set. */
1937 static inline bool
1938 gimple_omp_section_last_p (const_gimple g)
1940 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1941 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1945 /* Set the GF_OMP_SECTION_LAST flag on G. */
1947 static inline void
1948 gimple_omp_section_set_last (gimple g)
1950 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1951 g->subcode |= GF_OMP_SECTION_LAST;
1955 /* Return true if OMP parallel statement G has the
1956 GF_OMP_PARALLEL_COMBINED flag set. */
1958 static inline bool
1959 gimple_omp_parallel_combined_p (const_gimple g)
1961 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1962 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1966 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1967 value of COMBINED_P. */
1969 static inline void
1970 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1972 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1973 if (combined_p)
1974 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1975 else
1976 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1980 /* Return true if OMP atomic load/store statement G has the
1981 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1983 static inline bool
1984 gimple_omp_atomic_need_value_p (const_gimple g)
1986 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1987 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1988 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1992 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1994 static inline void
1995 gimple_omp_atomic_set_need_value (gimple g)
1997 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1998 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1999 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2003 /* Return true if OMP atomic load/store statement G has the
2004 GF_OMP_ATOMIC_SEQ_CST flag set. */
2006 static inline bool
2007 gimple_omp_atomic_seq_cst_p (const_gimple g)
2009 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2010 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2011 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2015 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2017 static inline void
2018 gimple_omp_atomic_set_seq_cst (gimple g)
2020 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2021 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2022 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2026 /* Return the number of operands for statement GS. */
2028 static inline unsigned
2029 gimple_num_ops (const_gimple gs)
2031 return gs->num_ops;
2035 /* Set the number of operands for statement GS. */
2037 static inline void
2038 gimple_set_num_ops (gimple gs, unsigned num_ops)
2040 gs->num_ops = num_ops;
2044 /* Return the array of operands for statement GS. */
2046 static inline tree *
2047 gimple_ops (gimple gs)
2049 size_t off;
2051 /* All the tuples have their operand vector at the very bottom
2052 of the structure. Note that those structures that do not
2053 have an operand vector have a zero offset. */
2054 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2055 gcc_gimple_checking_assert (off != 0);
2057 return (tree *) ((char *) gs + off);
2061 /* Return operand I for statement GS. */
2063 static inline tree
2064 gimple_op (const_gimple gs, unsigned i)
2066 if (gimple_has_ops (gs))
2068 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2069 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2071 else
2072 return NULL_TREE;
2075 /* Return a pointer to operand I for statement GS. */
2077 static inline tree *
2078 gimple_op_ptr (const_gimple gs, unsigned i)
2080 if (gimple_has_ops (gs))
2082 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2083 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2085 else
2086 return NULL;
2089 /* Set operand I of statement GS to OP. */
2091 static inline void
2092 gimple_set_op (gimple gs, unsigned i, tree op)
2094 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2096 /* Note. It may be tempting to assert that OP matches
2097 is_gimple_operand, but that would be wrong. Different tuples
2098 accept slightly different sets of tree operands. Each caller
2099 should perform its own validation. */
2100 gimple_ops (gs)[i] = op;
2103 /* Return true if GS is a GIMPLE_ASSIGN. */
2105 static inline bool
2106 is_gimple_assign (const_gimple gs)
2108 return gimple_code (gs) == GIMPLE_ASSIGN;
2111 /* Determine if expression CODE is one of the valid expressions that can
2112 be used on the RHS of GIMPLE assignments. */
2114 static inline enum gimple_rhs_class
2115 get_gimple_rhs_class (enum tree_code code)
2117 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2120 /* Return the LHS of assignment statement GS. */
2122 static inline tree
2123 gimple_assign_lhs (const_gimple gs)
2125 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2126 return gimple_op (gs, 0);
2130 /* Return a pointer to the LHS of assignment statement GS. */
2132 static inline tree *
2133 gimple_assign_lhs_ptr (const_gimple gs)
2135 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2136 return gimple_op_ptr (gs, 0);
2140 /* Set LHS to be the LHS operand of assignment statement GS. */
2142 static inline void
2143 gimple_assign_set_lhs (gimple gs, tree lhs)
2145 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2146 gimple_set_op (gs, 0, lhs);
2148 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2149 SSA_NAME_DEF_STMT (lhs) = gs;
2153 /* Return the first operand on the RHS of assignment statement GS. */
2155 static inline tree
2156 gimple_assign_rhs1 (const_gimple gs)
2158 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2159 return gimple_op (gs, 1);
2163 /* Return a pointer to the first operand on the RHS of assignment
2164 statement GS. */
2166 static inline tree *
2167 gimple_assign_rhs1_ptr (const_gimple gs)
2169 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2170 return gimple_op_ptr (gs, 1);
2173 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2175 static inline void
2176 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2178 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2180 gimple_set_op (gs, 1, rhs);
2184 /* Return the second operand on the RHS of assignment statement GS.
2185 If GS does not have two operands, NULL is returned instead. */
2187 static inline tree
2188 gimple_assign_rhs2 (const_gimple gs)
2190 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2192 if (gimple_num_ops (gs) >= 3)
2193 return gimple_op (gs, 2);
2194 else
2195 return NULL_TREE;
2199 /* Return a pointer to the second operand on the RHS of assignment
2200 statement GS. */
2202 static inline tree *
2203 gimple_assign_rhs2_ptr (const_gimple gs)
2205 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2206 return gimple_op_ptr (gs, 2);
2210 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2212 static inline void
2213 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2215 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2217 gimple_set_op (gs, 2, rhs);
2220 /* Return the third operand on the RHS of assignment statement GS.
2221 If GS does not have two operands, NULL is returned instead. */
2223 static inline tree
2224 gimple_assign_rhs3 (const_gimple gs)
2226 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2228 if (gimple_num_ops (gs) >= 4)
2229 return gimple_op (gs, 3);
2230 else
2231 return NULL_TREE;
2234 /* Return a pointer to the third operand on the RHS of assignment
2235 statement GS. */
2237 static inline tree *
2238 gimple_assign_rhs3_ptr (const_gimple gs)
2240 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2241 return gimple_op_ptr (gs, 3);
2245 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2247 static inline void
2248 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2250 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2252 gimple_set_op (gs, 3, rhs);
2255 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2256 to see only a maximum of two operands. */
2258 static inline void
2259 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2260 tree op1, tree op2)
2262 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2265 /* Returns true if GS is a nontemporal move. */
2267 static inline bool
2268 gimple_assign_nontemporal_move_p (const_gimple gs)
2270 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2271 return gs->nontemporal_move;
2274 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2276 static inline void
2277 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2279 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2280 gs->nontemporal_move = nontemporal;
2284 /* Return the code of the expression computed on the rhs of assignment
2285 statement GS. In case that the RHS is a single object, returns the
2286 tree code of the object. */
2288 static inline enum tree_code
2289 gimple_assign_rhs_code (const_gimple gs)
2291 enum tree_code code;
2292 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2294 code = (enum tree_code) gs->subcode;
2295 /* While we initially set subcode to the TREE_CODE of the rhs for
2296 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2297 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2298 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2299 code = TREE_CODE (gimple_assign_rhs1 (gs));
2301 return code;
2305 /* Set CODE to be the code for the expression computed on the RHS of
2306 assignment S. */
2308 static inline void
2309 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2311 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2312 s->subcode = code;
2316 /* Return the gimple rhs class of the code of the expression computed on
2317 the rhs of assignment statement GS.
2318 This will never return GIMPLE_INVALID_RHS. */
2320 static inline enum gimple_rhs_class
2321 gimple_assign_rhs_class (const_gimple gs)
2323 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2326 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2327 there is no operator associated with the assignment itself.
2328 Unlike gimple_assign_copy_p, this predicate returns true for
2329 any RHS operand, including those that perform an operation
2330 and do not have the semantics of a copy, such as COND_EXPR. */
2332 static inline bool
2333 gimple_assign_single_p (gimple gs)
2335 return (is_gimple_assign (gs)
2336 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2339 /* Return true if GS performs a store to its lhs. */
2341 static inline bool
2342 gimple_store_p (gimple gs)
2344 tree lhs = gimple_get_lhs (gs);
2345 return lhs && !is_gimple_reg (lhs);
2348 /* Return true if GS is an assignment that loads from its rhs1. */
2350 static inline bool
2351 gimple_assign_load_p (gimple gs)
2353 tree rhs;
2354 if (!gimple_assign_single_p (gs))
2355 return false;
2356 rhs = gimple_assign_rhs1 (gs);
2357 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2358 return true;
2359 rhs = get_base_address (rhs);
2360 return (DECL_P (rhs)
2361 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2365 /* Return true if S is a type-cast assignment. */
2367 static inline bool
2368 gimple_assign_cast_p (gimple s)
2370 if (is_gimple_assign (s))
2372 enum tree_code sc = gimple_assign_rhs_code (s);
2373 return CONVERT_EXPR_CODE_P (sc)
2374 || sc == VIEW_CONVERT_EXPR
2375 || sc == FIX_TRUNC_EXPR;
2378 return false;
2381 /* Return true if S is a clobber statement. */
2383 static inline bool
2384 gimple_clobber_p (gimple s)
2386 return gimple_assign_single_p (s)
2387 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2390 /* Return true if GS is a GIMPLE_CALL. */
2392 static inline bool
2393 is_gimple_call (const_gimple gs)
2395 return gimple_code (gs) == GIMPLE_CALL;
2398 /* Return the LHS of call statement GS. */
2400 static inline tree
2401 gimple_call_lhs (const_gimple gs)
2403 GIMPLE_CHECK (gs, GIMPLE_CALL);
2404 return gimple_op (gs, 0);
2408 /* Return a pointer to the LHS of call statement GS. */
2410 static inline tree *
2411 gimple_call_lhs_ptr (const_gimple gs)
2413 GIMPLE_CHECK (gs, GIMPLE_CALL);
2414 return gimple_op_ptr (gs, 0);
2418 /* Set LHS to be the LHS operand of call statement GS. */
2420 static inline void
2421 gimple_call_set_lhs (gimple gs, tree lhs)
2423 GIMPLE_CHECK (gs, GIMPLE_CALL);
2424 gimple_set_op (gs, 0, lhs);
2425 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2426 SSA_NAME_DEF_STMT (lhs) = gs;
2430 /* Return true if call GS calls an internal-only function, as enumerated
2431 by internal_fn. */
2433 static inline bool
2434 gimple_call_internal_p (const_gimple gs)
2436 GIMPLE_CHECK (gs, GIMPLE_CALL);
2437 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2441 /* Return the target of internal call GS. */
2443 static inline enum internal_fn
2444 gimple_call_internal_fn (const_gimple gs)
2446 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2447 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2451 /* Return the function type of the function called by GS. */
2453 static inline tree
2454 gimple_call_fntype (const_gimple gs)
2456 const gimple_statement_call *call_stmt =
2457 as_a <const gimple_statement_call> (gs);
2458 if (gimple_call_internal_p (gs))
2459 return NULL_TREE;
2460 return call_stmt->u.fntype;
2463 /* Set the type of the function called by GS to FNTYPE. */
2465 static inline void
2466 gimple_call_set_fntype (gimple gs, tree fntype)
2468 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2469 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2470 call_stmt->u.fntype = fntype;
2474 /* Return the tree node representing the function called by call
2475 statement GS. */
2477 static inline tree
2478 gimple_call_fn (const_gimple gs)
2480 GIMPLE_CHECK (gs, GIMPLE_CALL);
2481 return gimple_op (gs, 1);
2484 /* Return a pointer to the tree node representing the function called by call
2485 statement GS. */
2487 static inline tree *
2488 gimple_call_fn_ptr (const_gimple gs)
2490 GIMPLE_CHECK (gs, GIMPLE_CALL);
2491 return gimple_op_ptr (gs, 1);
2495 /* Set FN to be the function called by call statement GS. */
2497 static inline void
2498 gimple_call_set_fn (gimple gs, tree fn)
2500 GIMPLE_CHECK (gs, GIMPLE_CALL);
2501 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2502 gimple_set_op (gs, 1, fn);
2506 /* Set FNDECL to be the function called by call statement GS. */
2508 static inline void
2509 gimple_call_set_fndecl (gimple gs, tree decl)
2511 GIMPLE_CHECK (gs, GIMPLE_CALL);
2512 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2513 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2517 /* Set internal function FN to be the function called by call statement GS. */
2519 static inline void
2520 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2522 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2523 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2524 call_stmt->u.internal_fn = fn;
2528 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2529 Otherwise return NULL. This function is analogous to
2530 get_callee_fndecl in tree land. */
2532 static inline tree
2533 gimple_call_fndecl (const_gimple gs)
2535 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2539 /* Return the type returned by call statement GS. */
2541 static inline tree
2542 gimple_call_return_type (const_gimple gs)
2544 tree type = gimple_call_fntype (gs);
2546 if (type == NULL_TREE)
2547 return TREE_TYPE (gimple_call_lhs (gs));
2549 /* The type returned by a function is the type of its
2550 function type. */
2551 return TREE_TYPE (type);
2555 /* Return the static chain for call statement GS. */
2557 static inline tree
2558 gimple_call_chain (const_gimple gs)
2560 GIMPLE_CHECK (gs, GIMPLE_CALL);
2561 return gimple_op (gs, 2);
2565 /* Return a pointer to the static chain for call statement GS. */
2567 static inline tree *
2568 gimple_call_chain_ptr (const_gimple gs)
2570 GIMPLE_CHECK (gs, GIMPLE_CALL);
2571 return gimple_op_ptr (gs, 2);
2574 /* Set CHAIN to be the static chain for call statement GS. */
2576 static inline void
2577 gimple_call_set_chain (gimple gs, tree chain)
2579 GIMPLE_CHECK (gs, GIMPLE_CALL);
2581 gimple_set_op (gs, 2, chain);
2585 /* Return the number of arguments used by call statement GS. */
2587 static inline unsigned
2588 gimple_call_num_args (const_gimple gs)
2590 unsigned num_ops;
2591 GIMPLE_CHECK (gs, GIMPLE_CALL);
2592 num_ops = gimple_num_ops (gs);
2593 return num_ops - 3;
2597 /* Return the argument at position INDEX for call statement GS. */
2599 static inline tree
2600 gimple_call_arg (const_gimple gs, unsigned index)
2602 GIMPLE_CHECK (gs, GIMPLE_CALL);
2603 return gimple_op (gs, index + 3);
2607 /* Return a pointer to the argument at position INDEX for call
2608 statement GS. */
2610 static inline tree *
2611 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2613 GIMPLE_CHECK (gs, GIMPLE_CALL);
2614 return gimple_op_ptr (gs, index + 3);
2618 /* Set ARG to be the argument at position INDEX for call statement GS. */
2620 static inline void
2621 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2623 GIMPLE_CHECK (gs, GIMPLE_CALL);
2624 gimple_set_op (gs, index + 3, arg);
2628 /* If TAIL_P is true, mark call statement S as being a tail call
2629 (i.e., a call just before the exit of a function). These calls are
2630 candidate for tail call optimization. */
2632 static inline void
2633 gimple_call_set_tail (gimple s, bool tail_p)
2635 GIMPLE_CHECK (s, GIMPLE_CALL);
2636 if (tail_p)
2637 s->subcode |= GF_CALL_TAILCALL;
2638 else
2639 s->subcode &= ~GF_CALL_TAILCALL;
2643 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2645 static inline bool
2646 gimple_call_tail_p (gimple s)
2648 GIMPLE_CHECK (s, GIMPLE_CALL);
2649 return (s->subcode & GF_CALL_TAILCALL) != 0;
2653 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2654 slot optimization. This transformation uses the target of the call
2655 expansion as the return slot for calls that return in memory. */
2657 static inline void
2658 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2660 GIMPLE_CHECK (s, GIMPLE_CALL);
2661 if (return_slot_opt_p)
2662 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2663 else
2664 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2668 /* Return true if S is marked for return slot optimization. */
2670 static inline bool
2671 gimple_call_return_slot_opt_p (gimple s)
2673 GIMPLE_CHECK (s, GIMPLE_CALL);
2674 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2678 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2679 thunk to the thunked-to function. */
2681 static inline void
2682 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2684 GIMPLE_CHECK (s, GIMPLE_CALL);
2685 if (from_thunk_p)
2686 s->subcode |= GF_CALL_FROM_THUNK;
2687 else
2688 s->subcode &= ~GF_CALL_FROM_THUNK;
2692 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2694 static inline bool
2695 gimple_call_from_thunk_p (gimple s)
2697 GIMPLE_CHECK (s, GIMPLE_CALL);
2698 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2702 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2703 argument pack in its argument list. */
2705 static inline void
2706 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2708 GIMPLE_CHECK (s, GIMPLE_CALL);
2709 if (pass_arg_pack_p)
2710 s->subcode |= GF_CALL_VA_ARG_PACK;
2711 else
2712 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2716 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2717 argument pack in its argument list. */
2719 static inline bool
2720 gimple_call_va_arg_pack_p (gimple s)
2722 GIMPLE_CHECK (s, GIMPLE_CALL);
2723 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2727 /* Return true if S is a noreturn call. */
2729 static inline bool
2730 gimple_call_noreturn_p (gimple s)
2732 GIMPLE_CHECK (s, GIMPLE_CALL);
2733 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2737 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2738 even if the called function can throw in other cases. */
2740 static inline void
2741 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2743 GIMPLE_CHECK (s, GIMPLE_CALL);
2744 if (nothrow_p)
2745 s->subcode |= GF_CALL_NOTHROW;
2746 else
2747 s->subcode &= ~GF_CALL_NOTHROW;
2750 /* Return true if S is a nothrow call. */
2752 static inline bool
2753 gimple_call_nothrow_p (gimple s)
2755 GIMPLE_CHECK (s, GIMPLE_CALL);
2756 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2759 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2760 is known to be emitted for VLA objects. Those are wrapped by
2761 stack_save/stack_restore calls and hence can't lead to unbounded
2762 stack growth even when they occur in loops. */
2764 static inline void
2765 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2767 GIMPLE_CHECK (s, GIMPLE_CALL);
2768 if (for_var)
2769 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2770 else
2771 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2774 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2776 static inline bool
2777 gimple_call_alloca_for_var_p (gimple s)
2779 GIMPLE_CHECK (s, GIMPLE_CALL);
2780 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2783 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2785 static inline void
2786 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2788 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2789 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2790 dest_call->subcode = orig_call->subcode;
2794 /* Return a pointer to the points-to solution for the set of call-used
2795 variables of the call CALL. */
2797 static inline struct pt_solution *
2798 gimple_call_use_set (gimple call)
2800 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2801 return &call_stmt->call_used;
2805 /* Return a pointer to the points-to solution for the set of call-used
2806 variables of the call CALL. */
2808 static inline struct pt_solution *
2809 gimple_call_clobber_set (gimple call)
2811 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2812 return &call_stmt->call_clobbered;
2816 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2817 non-NULL lhs. */
2819 static inline bool
2820 gimple_has_lhs (gimple stmt)
2822 return (is_gimple_assign (stmt)
2823 || (is_gimple_call (stmt)
2824 && gimple_call_lhs (stmt) != NULL_TREE));
2828 /* Return the code of the predicate computed by conditional statement GS. */
2830 static inline enum tree_code
2831 gimple_cond_code (const_gimple gs)
2833 GIMPLE_CHECK (gs, GIMPLE_COND);
2834 return (enum tree_code) gs->subcode;
2838 /* Set CODE to be the predicate code for the conditional statement GS. */
2840 static inline void
2841 gimple_cond_set_code (gimple gs, enum tree_code code)
2843 GIMPLE_CHECK (gs, GIMPLE_COND);
2844 gs->subcode = code;
2848 /* Return the LHS of the predicate computed by conditional statement GS. */
2850 static inline tree
2851 gimple_cond_lhs (const_gimple gs)
2853 GIMPLE_CHECK (gs, GIMPLE_COND);
2854 return gimple_op (gs, 0);
2857 /* Return the pointer to the LHS of the predicate computed by conditional
2858 statement GS. */
2860 static inline tree *
2861 gimple_cond_lhs_ptr (const_gimple gs)
2863 GIMPLE_CHECK (gs, GIMPLE_COND);
2864 return gimple_op_ptr (gs, 0);
2867 /* Set LHS to be the LHS operand of the predicate computed by
2868 conditional statement GS. */
2870 static inline void
2871 gimple_cond_set_lhs (gimple gs, tree lhs)
2873 GIMPLE_CHECK (gs, GIMPLE_COND);
2874 gimple_set_op (gs, 0, lhs);
2878 /* Return the RHS operand of the predicate computed by conditional GS. */
2880 static inline tree
2881 gimple_cond_rhs (const_gimple gs)
2883 GIMPLE_CHECK (gs, GIMPLE_COND);
2884 return gimple_op (gs, 1);
2887 /* Return the pointer to the RHS operand of the predicate computed by
2888 conditional GS. */
2890 static inline tree *
2891 gimple_cond_rhs_ptr (const_gimple gs)
2893 GIMPLE_CHECK (gs, GIMPLE_COND);
2894 return gimple_op_ptr (gs, 1);
2898 /* Set RHS to be the RHS operand of the predicate computed by
2899 conditional statement GS. */
2901 static inline void
2902 gimple_cond_set_rhs (gimple gs, tree rhs)
2904 GIMPLE_CHECK (gs, GIMPLE_COND);
2905 gimple_set_op (gs, 1, rhs);
2909 /* Return the label used by conditional statement GS when its
2910 predicate evaluates to true. */
2912 static inline tree
2913 gimple_cond_true_label (const_gimple gs)
2915 GIMPLE_CHECK (gs, GIMPLE_COND);
2916 return gimple_op (gs, 2);
2920 /* Set LABEL to be the label used by conditional statement GS when its
2921 predicate evaluates to true. */
2923 static inline void
2924 gimple_cond_set_true_label (gimple gs, tree label)
2926 GIMPLE_CHECK (gs, GIMPLE_COND);
2927 gimple_set_op (gs, 2, label);
2931 /* Set LABEL to be the label used by conditional statement GS when its
2932 predicate evaluates to false. */
2934 static inline void
2935 gimple_cond_set_false_label (gimple gs, tree label)
2937 GIMPLE_CHECK (gs, GIMPLE_COND);
2938 gimple_set_op (gs, 3, label);
2942 /* Return the label used by conditional statement GS when its
2943 predicate evaluates to false. */
2945 static inline tree
2946 gimple_cond_false_label (const_gimple gs)
2948 GIMPLE_CHECK (gs, GIMPLE_COND);
2949 return gimple_op (gs, 3);
2953 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2955 static inline void
2956 gimple_cond_make_false (gimple gs)
2958 gimple_cond_set_lhs (gs, boolean_true_node);
2959 gimple_cond_set_rhs (gs, boolean_false_node);
2960 gs->subcode = EQ_EXPR;
2964 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2966 static inline void
2967 gimple_cond_make_true (gimple gs)
2969 gimple_cond_set_lhs (gs, boolean_true_node);
2970 gimple_cond_set_rhs (gs, boolean_true_node);
2971 gs->subcode = EQ_EXPR;
2974 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2975 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2977 static inline bool
2978 gimple_cond_true_p (const_gimple gs)
2980 tree lhs = gimple_cond_lhs (gs);
2981 tree rhs = gimple_cond_rhs (gs);
2982 enum tree_code code = gimple_cond_code (gs);
2984 if (lhs != boolean_true_node && lhs != boolean_false_node)
2985 return false;
2987 if (rhs != boolean_true_node && rhs != boolean_false_node)
2988 return false;
2990 if (code == NE_EXPR && lhs != rhs)
2991 return true;
2993 if (code == EQ_EXPR && lhs == rhs)
2994 return true;
2996 return false;
2999 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3000 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3002 static inline bool
3003 gimple_cond_false_p (const_gimple gs)
3005 tree lhs = gimple_cond_lhs (gs);
3006 tree rhs = gimple_cond_rhs (gs);
3007 enum tree_code code = gimple_cond_code (gs);
3009 if (lhs != boolean_true_node && lhs != boolean_false_node)
3010 return false;
3012 if (rhs != boolean_true_node && rhs != boolean_false_node)
3013 return false;
3015 if (code == NE_EXPR && lhs == rhs)
3016 return true;
3018 if (code == EQ_EXPR && lhs != rhs)
3019 return true;
3021 return false;
3024 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3026 static inline void
3027 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3029 gimple_cond_set_code (stmt, code);
3030 gimple_cond_set_lhs (stmt, lhs);
3031 gimple_cond_set_rhs (stmt, rhs);
3034 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3036 static inline tree
3037 gimple_label_label (const_gimple gs)
3039 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3040 return gimple_op (gs, 0);
3044 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3045 GS. */
3047 static inline void
3048 gimple_label_set_label (gimple gs, tree label)
3050 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3051 gimple_set_op (gs, 0, label);
3055 /* Return the destination of the unconditional jump GS. */
3057 static inline tree
3058 gimple_goto_dest (const_gimple gs)
3060 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3061 return gimple_op (gs, 0);
3065 /* Set DEST to be the destination of the unconditonal jump GS. */
3067 static inline void
3068 gimple_goto_set_dest (gimple gs, tree dest)
3070 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3071 gimple_set_op (gs, 0, dest);
3075 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3077 static inline tree
3078 gimple_bind_vars (const_gimple gs)
3080 const gimple_statement_bind *bind_stmt =
3081 as_a <const gimple_statement_bind> (gs);
3082 return bind_stmt->vars;
3086 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3087 statement GS. */
3089 static inline void
3090 gimple_bind_set_vars (gimple gs, tree vars)
3092 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3093 bind_stmt->vars = vars;
3097 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3098 statement GS. */
3100 static inline void
3101 gimple_bind_append_vars (gimple gs, tree vars)
3103 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3104 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3108 static inline gimple_seq *
3109 gimple_bind_body_ptr (gimple gs)
3111 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3112 return &bind_stmt->body;
3115 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3117 static inline gimple_seq
3118 gimple_bind_body (gimple gs)
3120 return *gimple_bind_body_ptr (gs);
3124 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3125 statement GS. */
3127 static inline void
3128 gimple_bind_set_body (gimple gs, gimple_seq seq)
3130 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3131 bind_stmt->body = seq;
3135 /* Append a statement to the end of a GIMPLE_BIND's body. */
3137 static inline void
3138 gimple_bind_add_stmt (gimple gs, gimple stmt)
3140 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3141 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3145 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3147 static inline void
3148 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3150 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3151 gimple_seq_add_seq (&bind_stmt->body, seq);
3155 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3156 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3158 static inline tree
3159 gimple_bind_block (const_gimple gs)
3161 const gimple_statement_bind *bind_stmt =
3162 as_a <const gimple_statement_bind> (gs);
3163 return bind_stmt->block;
3167 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3168 statement GS. */
3170 static inline void
3171 gimple_bind_set_block (gimple gs, tree block)
3173 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3174 gcc_gimple_checking_assert (block == NULL_TREE
3175 || TREE_CODE (block) == BLOCK);
3176 bind_stmt->block = block;
3180 /* Return the number of input operands for GIMPLE_ASM GS. */
3182 static inline unsigned
3183 gimple_asm_ninputs (const_gimple gs)
3185 const gimple_statement_asm *asm_stmt =
3186 as_a <const gimple_statement_asm> (gs);
3187 return asm_stmt->ni;
3191 /* Return the number of output operands for GIMPLE_ASM GS. */
3193 static inline unsigned
3194 gimple_asm_noutputs (const_gimple gs)
3196 const gimple_statement_asm *asm_stmt =
3197 as_a <const gimple_statement_asm> (gs);
3198 return asm_stmt->no;
3202 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3204 static inline unsigned
3205 gimple_asm_nclobbers (const_gimple gs)
3207 const gimple_statement_asm *asm_stmt =
3208 as_a <const gimple_statement_asm> (gs);
3209 return asm_stmt->nc;
3212 /* Return the number of label operands for GIMPLE_ASM GS. */
3214 static inline unsigned
3215 gimple_asm_nlabels (const_gimple gs)
3217 const gimple_statement_asm *asm_stmt =
3218 as_a <const gimple_statement_asm> (gs);
3219 return asm_stmt->nl;
3222 /* Return input operand INDEX of GIMPLE_ASM GS. */
3224 static inline tree
3225 gimple_asm_input_op (const_gimple gs, unsigned index)
3227 const gimple_statement_asm *asm_stmt =
3228 as_a <const gimple_statement_asm> (gs);
3229 gcc_gimple_checking_assert (index < asm_stmt->ni);
3230 return gimple_op (gs, index + asm_stmt->no);
3233 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3235 static inline tree *
3236 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3238 const gimple_statement_asm *asm_stmt =
3239 as_a <const gimple_statement_asm> (gs);
3240 gcc_gimple_checking_assert (index < asm_stmt->ni);
3241 return gimple_op_ptr (gs, index + asm_stmt->no);
3245 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3247 static inline void
3248 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3250 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3251 gcc_gimple_checking_assert (index < asm_stmt->ni
3252 && TREE_CODE (in_op) == TREE_LIST);
3253 gimple_set_op (gs, index + asm_stmt->no, in_op);
3257 /* Return output operand INDEX of GIMPLE_ASM GS. */
3259 static inline tree
3260 gimple_asm_output_op (const_gimple gs, unsigned index)
3262 const gimple_statement_asm *asm_stmt =
3263 as_a <const gimple_statement_asm> (gs);
3264 gcc_gimple_checking_assert (index < asm_stmt->no);
3265 return gimple_op (gs, index);
3268 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3270 static inline tree *
3271 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3273 const gimple_statement_asm *asm_stmt =
3274 as_a <const gimple_statement_asm> (gs);
3275 gcc_gimple_checking_assert (index < asm_stmt->no);
3276 return gimple_op_ptr (gs, index);
3280 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3282 static inline void
3283 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3285 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3286 gcc_gimple_checking_assert (index < asm_stmt->no
3287 && TREE_CODE (out_op) == TREE_LIST);
3288 gimple_set_op (gs, index, out_op);
3292 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3294 static inline tree
3295 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3297 const gimple_statement_asm *asm_stmt =
3298 as_a <const gimple_statement_asm> (gs);
3299 gcc_gimple_checking_assert (index < asm_stmt->nc);
3300 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3304 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3306 static inline void
3307 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3309 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3310 gcc_gimple_checking_assert (index < asm_stmt->nc
3311 && TREE_CODE (clobber_op) == TREE_LIST);
3312 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3315 /* Return label operand INDEX of GIMPLE_ASM GS. */
3317 static inline tree
3318 gimple_asm_label_op (const_gimple gs, unsigned index)
3320 const gimple_statement_asm *asm_stmt =
3321 as_a <const gimple_statement_asm> (gs);
3322 gcc_gimple_checking_assert (index < asm_stmt->nl);
3323 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3326 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3328 static inline void
3329 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3331 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3332 gcc_gimple_checking_assert (index < asm_stmt->nl
3333 && TREE_CODE (label_op) == TREE_LIST);
3334 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3337 /* Return the string representing the assembly instruction in
3338 GIMPLE_ASM GS. */
3340 static inline const char *
3341 gimple_asm_string (const_gimple gs)
3343 const gimple_statement_asm *asm_stmt =
3344 as_a <const gimple_statement_asm> (gs);
3345 return asm_stmt->string;
3349 /* Return true if GS is an asm statement marked volatile. */
3351 static inline bool
3352 gimple_asm_volatile_p (const_gimple gs)
3354 GIMPLE_CHECK (gs, GIMPLE_ASM);
3355 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3359 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3361 static inline void
3362 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3364 GIMPLE_CHECK (gs, GIMPLE_ASM);
3365 if (volatile_p)
3366 gs->subcode |= GF_ASM_VOLATILE;
3367 else
3368 gs->subcode &= ~GF_ASM_VOLATILE;
3372 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3374 static inline void
3375 gimple_asm_set_input (gimple gs, bool input_p)
3377 GIMPLE_CHECK (gs, GIMPLE_ASM);
3378 if (input_p)
3379 gs->subcode |= GF_ASM_INPUT;
3380 else
3381 gs->subcode &= ~GF_ASM_INPUT;
3385 /* Return true if asm GS is an ASM_INPUT. */
3387 static inline bool
3388 gimple_asm_input_p (const_gimple gs)
3390 GIMPLE_CHECK (gs, GIMPLE_ASM);
3391 return (gs->subcode & GF_ASM_INPUT) != 0;
3395 /* Return the types handled by GIMPLE_CATCH statement GS. */
3397 static inline tree
3398 gimple_catch_types (const_gimple gs)
3400 const gimple_statement_catch *catch_stmt =
3401 as_a <const gimple_statement_catch> (gs);
3402 return catch_stmt->types;
3406 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3408 static inline tree *
3409 gimple_catch_types_ptr (gimple gs)
3411 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3412 return &catch_stmt->types;
3416 /* Return a pointer to the GIMPLE sequence representing the body of
3417 the handler of GIMPLE_CATCH statement GS. */
3419 static inline gimple_seq *
3420 gimple_catch_handler_ptr (gimple gs)
3422 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3423 return &catch_stmt->handler;
3427 /* Return the GIMPLE sequence representing the body of the handler of
3428 GIMPLE_CATCH statement GS. */
3430 static inline gimple_seq
3431 gimple_catch_handler (gimple gs)
3433 return *gimple_catch_handler_ptr (gs);
3437 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3439 static inline void
3440 gimple_catch_set_types (gimple gs, tree t)
3442 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3443 catch_stmt->types = t;
3447 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3449 static inline void
3450 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3452 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3453 catch_stmt->handler = handler;
3457 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3459 static inline tree
3460 gimple_eh_filter_types (const_gimple gs)
3462 const gimple_statement_eh_filter *eh_filter_stmt =
3463 as_a <const gimple_statement_eh_filter> (gs);
3464 return eh_filter_stmt->types;
3468 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3469 GS. */
3471 static inline tree *
3472 gimple_eh_filter_types_ptr (gimple gs)
3474 gimple_statement_eh_filter *eh_filter_stmt =
3475 as_a <gimple_statement_eh_filter> (gs);
3476 return &eh_filter_stmt->types;
3480 /* Return a pointer to the sequence of statement to execute when
3481 GIMPLE_EH_FILTER statement fails. */
3483 static inline gimple_seq *
3484 gimple_eh_filter_failure_ptr (gimple gs)
3486 gimple_statement_eh_filter *eh_filter_stmt =
3487 as_a <gimple_statement_eh_filter> (gs);
3488 return &eh_filter_stmt->failure;
3492 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3493 statement fails. */
3495 static inline gimple_seq
3496 gimple_eh_filter_failure (gimple gs)
3498 return *gimple_eh_filter_failure_ptr (gs);
3502 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3504 static inline void
3505 gimple_eh_filter_set_types (gimple gs, tree types)
3507 gimple_statement_eh_filter *eh_filter_stmt =
3508 as_a <gimple_statement_eh_filter> (gs);
3509 eh_filter_stmt->types = types;
3513 /* Set FAILURE to be the sequence of statements to execute on failure
3514 for GIMPLE_EH_FILTER GS. */
3516 static inline void
3517 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3519 gimple_statement_eh_filter *eh_filter_stmt =
3520 as_a <gimple_statement_eh_filter> (gs);
3521 eh_filter_stmt->failure = failure;
3524 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3526 static inline tree
3527 gimple_eh_must_not_throw_fndecl (gimple gs)
3529 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3530 return eh_mnt_stmt->fndecl;
3533 /* Set the function decl to be called by GS to DECL. */
3535 static inline void
3536 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3538 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3539 eh_mnt_stmt->fndecl = decl;
3542 /* GIMPLE_EH_ELSE accessors. */
3544 static inline gimple_seq *
3545 gimple_eh_else_n_body_ptr (gimple gs)
3547 gimple_statement_eh_else *eh_else_stmt =
3548 as_a <gimple_statement_eh_else> (gs);
3549 return &eh_else_stmt->n_body;
3552 static inline gimple_seq
3553 gimple_eh_else_n_body (gimple gs)
3555 return *gimple_eh_else_n_body_ptr (gs);
3558 static inline gimple_seq *
3559 gimple_eh_else_e_body_ptr (gimple gs)
3561 gimple_statement_eh_else *eh_else_stmt =
3562 as_a <gimple_statement_eh_else> (gs);
3563 return &eh_else_stmt->e_body;
3566 static inline gimple_seq
3567 gimple_eh_else_e_body (gimple gs)
3569 return *gimple_eh_else_e_body_ptr (gs);
3572 static inline void
3573 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3575 gimple_statement_eh_else *eh_else_stmt =
3576 as_a <gimple_statement_eh_else> (gs);
3577 eh_else_stmt->n_body = seq;
3580 static inline void
3581 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3583 gimple_statement_eh_else *eh_else_stmt =
3584 as_a <gimple_statement_eh_else> (gs);
3585 eh_else_stmt->e_body = seq;
3588 /* GIMPLE_TRY accessors. */
3590 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3591 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3593 static inline enum gimple_try_flags
3594 gimple_try_kind (const_gimple gs)
3596 GIMPLE_CHECK (gs, GIMPLE_TRY);
3597 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3601 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3603 static inline void
3604 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3606 GIMPLE_CHECK (gs, GIMPLE_TRY);
3607 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3608 || kind == GIMPLE_TRY_FINALLY);
3609 if (gimple_try_kind (gs) != kind)
3610 gs->subcode = (unsigned int) kind;
3614 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3616 static inline bool
3617 gimple_try_catch_is_cleanup (const_gimple gs)
3619 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3620 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3624 /* Return a pointer to the sequence of statements used as the
3625 body for GIMPLE_TRY GS. */
3627 static inline gimple_seq *
3628 gimple_try_eval_ptr (gimple gs)
3630 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3631 return &try_stmt->eval;
3635 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3637 static inline gimple_seq
3638 gimple_try_eval (gimple gs)
3640 return *gimple_try_eval_ptr (gs);
3644 /* Return a pointer to the sequence of statements used as the cleanup body for
3645 GIMPLE_TRY GS. */
3647 static inline gimple_seq *
3648 gimple_try_cleanup_ptr (gimple gs)
3650 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3651 return &try_stmt->cleanup;
3655 /* Return the sequence of statements used as the cleanup body for
3656 GIMPLE_TRY GS. */
3658 static inline gimple_seq
3659 gimple_try_cleanup (gimple gs)
3661 return *gimple_try_cleanup_ptr (gs);
3665 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3667 static inline void
3668 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3670 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3671 if (catch_is_cleanup)
3672 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3673 else
3674 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3678 /* Set EVAL to be the sequence of statements to use as the body for
3679 GIMPLE_TRY GS. */
3681 static inline void
3682 gimple_try_set_eval (gimple gs, gimple_seq eval)
3684 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3685 try_stmt->eval = eval;
3689 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3690 body for GIMPLE_TRY GS. */
3692 static inline void
3693 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3695 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3696 try_stmt->cleanup = cleanup;
3700 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3702 static inline gimple_seq *
3703 gimple_wce_cleanup_ptr (gimple gs)
3705 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3706 return &wce_stmt->cleanup;
3710 /* Return the cleanup sequence for cleanup statement GS. */
3712 static inline gimple_seq
3713 gimple_wce_cleanup (gimple gs)
3715 return *gimple_wce_cleanup_ptr (gs);
3719 /* Set CLEANUP to be the cleanup sequence for GS. */
3721 static inline void
3722 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3724 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3725 wce_stmt->cleanup = cleanup;
3729 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3731 static inline bool
3732 gimple_wce_cleanup_eh_only (const_gimple gs)
3734 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3735 return gs->subcode != 0;
3739 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3741 static inline void
3742 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3744 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3745 gs->subcode = (unsigned int) eh_only_p;
3749 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3751 static inline unsigned
3752 gimple_phi_capacity (const_gimple gs)
3754 const gimple_statement_phi *phi_stmt =
3755 as_a <const gimple_statement_phi> (gs);
3756 return phi_stmt->capacity;
3760 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3761 be exactly the number of incoming edges for the basic block holding
3762 GS. */
3764 static inline unsigned
3765 gimple_phi_num_args (const_gimple gs)
3767 const gimple_statement_phi *phi_stmt =
3768 as_a <const gimple_statement_phi> (gs);
3769 return phi_stmt->nargs;
3773 /* Return the SSA name created by GIMPLE_PHI GS. */
3775 static inline tree
3776 gimple_phi_result (const_gimple gs)
3778 const gimple_statement_phi *phi_stmt =
3779 as_a <const gimple_statement_phi> (gs);
3780 return phi_stmt->result;
3783 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3785 static inline tree *
3786 gimple_phi_result_ptr (gimple gs)
3788 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3789 return &phi_stmt->result;
3792 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3794 static inline void
3795 gimple_phi_set_result (gimple gs, tree result)
3797 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3798 phi_stmt->result = result;
3799 if (result && TREE_CODE (result) == SSA_NAME)
3800 SSA_NAME_DEF_STMT (result) = gs;
3804 /* Return the PHI argument corresponding to incoming edge INDEX for
3805 GIMPLE_PHI GS. */
3807 static inline struct phi_arg_d *
3808 gimple_phi_arg (gimple gs, unsigned index)
3810 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3811 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3812 return &(phi_stmt->args[index]);
3815 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3816 for GIMPLE_PHI GS. */
3818 static inline void
3819 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3821 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3822 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3823 phi_stmt->args[index] = *phiarg;
3826 /* Return the PHI nodes for basic block BB, or NULL if there are no
3827 PHI nodes. */
3829 static inline gimple_seq
3830 phi_nodes (const_basic_block bb)
3832 gcc_checking_assert (!(bb->flags & BB_RTL));
3833 return bb->il.gimple.phi_nodes;
3836 /* Return a pointer to the PHI nodes for basic block BB. */
3838 static inline gimple_seq *
3839 phi_nodes_ptr (basic_block bb)
3841 gcc_checking_assert (!(bb->flags & BB_RTL));
3842 return &bb->il.gimple.phi_nodes;
3845 /* Return the tree operand for argument I of PHI node GS. */
3847 static inline tree
3848 gimple_phi_arg_def (gimple gs, size_t index)
3850 return gimple_phi_arg (gs, index)->def;
3854 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3856 static inline tree *
3857 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3859 return &gimple_phi_arg (gs, index)->def;
3862 /* Return the edge associated with argument I of phi node GS. */
3864 static inline edge
3865 gimple_phi_arg_edge (gimple gs, size_t i)
3867 return EDGE_PRED (gimple_bb (gs), i);
3870 /* Return the source location of gimple argument I of phi node GS. */
3872 static inline source_location
3873 gimple_phi_arg_location (gimple gs, size_t i)
3875 return gimple_phi_arg (gs, i)->locus;
3878 /* Return the source location of the argument on edge E of phi node GS. */
3880 static inline source_location
3881 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3883 return gimple_phi_arg (gs, e->dest_idx)->locus;
3886 /* Set the source location of gimple argument I of phi node GS to LOC. */
3888 static inline void
3889 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3891 gimple_phi_arg (gs, i)->locus = loc;
3894 /* Return TRUE if argument I of phi node GS has a location record. */
3896 static inline bool
3897 gimple_phi_arg_has_location (gimple gs, size_t i)
3899 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3903 /* Return the region number for GIMPLE_RESX GS. */
3905 static inline int
3906 gimple_resx_region (const_gimple gs)
3908 const gimple_statement_resx *resx_stmt =
3909 as_a <const gimple_statement_resx> (gs);
3910 return resx_stmt->region;
3913 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3915 static inline void
3916 gimple_resx_set_region (gimple gs, int region)
3918 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx> (gs);
3919 resx_stmt->region = region;
3922 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3924 static inline int
3925 gimple_eh_dispatch_region (const_gimple gs)
3927 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3928 as_a <const gimple_statement_eh_dispatch> (gs);
3929 return eh_dispatch_stmt->region;
3932 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3934 static inline void
3935 gimple_eh_dispatch_set_region (gimple gs, int region)
3937 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3938 as_a <gimple_statement_eh_dispatch> (gs);
3939 eh_dispatch_stmt->region = region;
3942 /* Return the number of labels associated with the switch statement GS. */
3944 static inline unsigned
3945 gimple_switch_num_labels (const_gimple gs)
3947 unsigned num_ops;
3948 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3949 num_ops = gimple_num_ops (gs);
3950 gcc_gimple_checking_assert (num_ops > 1);
3951 return num_ops - 1;
3955 /* Set NLABELS to be the number of labels for the switch statement GS. */
3957 static inline void
3958 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3960 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3961 gimple_set_num_ops (g, nlabels + 1);
3965 /* Return the index variable used by the switch statement GS. */
3967 static inline tree
3968 gimple_switch_index (const_gimple gs)
3970 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3971 return gimple_op (gs, 0);
3975 /* Return a pointer to the index variable for the switch statement GS. */
3977 static inline tree *
3978 gimple_switch_index_ptr (const_gimple gs)
3980 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3981 return gimple_op_ptr (gs, 0);
3985 /* Set INDEX to be the index variable for switch statement GS. */
3987 static inline void
3988 gimple_switch_set_index (gimple gs, tree index)
3990 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3991 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3992 gimple_set_op (gs, 0, index);
3996 /* Return the label numbered INDEX. The default label is 0, followed by any
3997 labels in a switch statement. */
3999 static inline tree
4000 gimple_switch_label (const_gimple gs, unsigned index)
4002 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4003 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4004 return gimple_op (gs, index + 1);
4007 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4009 static inline void
4010 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4012 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4013 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4014 && (label == NULL_TREE
4015 || TREE_CODE (label) == CASE_LABEL_EXPR));
4016 gimple_set_op (gs, index + 1, label);
4019 /* Return the default label for a switch statement. */
4021 static inline tree
4022 gimple_switch_default_label (const_gimple gs)
4024 tree label = gimple_switch_label (gs, 0);
4025 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4026 return label;
4029 /* Set the default label for a switch statement. */
4031 static inline void
4032 gimple_switch_set_default_label (gimple gs, tree label)
4034 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4035 gimple_switch_set_label (gs, 0, label);
4038 /* Return true if GS is a GIMPLE_DEBUG statement. */
4040 static inline bool
4041 is_gimple_debug (const_gimple gs)
4043 return gimple_code (gs) == GIMPLE_DEBUG;
4046 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4048 static inline bool
4049 gimple_debug_bind_p (const_gimple s)
4051 if (is_gimple_debug (s))
4052 return s->subcode == GIMPLE_DEBUG_BIND;
4054 return false;
4057 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4059 static inline tree
4060 gimple_debug_bind_get_var (gimple dbg)
4062 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4063 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4064 return gimple_op (dbg, 0);
4067 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4068 statement. */
4070 static inline tree
4071 gimple_debug_bind_get_value (gimple dbg)
4073 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4074 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4075 return gimple_op (dbg, 1);
4078 /* Return a pointer to the value bound to the variable in a
4079 GIMPLE_DEBUG bind statement. */
4081 static inline tree *
4082 gimple_debug_bind_get_value_ptr (gimple dbg)
4084 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4085 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4086 return gimple_op_ptr (dbg, 1);
4089 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4091 static inline void
4092 gimple_debug_bind_set_var (gimple dbg, tree var)
4094 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4095 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4096 gimple_set_op (dbg, 0, var);
4099 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4100 statement. */
4102 static inline void
4103 gimple_debug_bind_set_value (gimple dbg, tree value)
4105 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4106 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4107 gimple_set_op (dbg, 1, value);
4110 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4111 optimized away. */
4112 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4114 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4115 statement. */
4117 static inline void
4118 gimple_debug_bind_reset_value (gimple dbg)
4120 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4121 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4122 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4125 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4126 value. */
4128 static inline bool
4129 gimple_debug_bind_has_value_p (gimple dbg)
4131 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4132 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4133 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4136 #undef GIMPLE_DEBUG_BIND_NOVALUE
4138 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4140 static inline bool
4141 gimple_debug_source_bind_p (const_gimple s)
4143 if (is_gimple_debug (s))
4144 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4146 return false;
4149 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4151 static inline tree
4152 gimple_debug_source_bind_get_var (gimple dbg)
4154 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4155 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4156 return gimple_op (dbg, 0);
4159 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4160 statement. */
4162 static inline tree
4163 gimple_debug_source_bind_get_value (gimple dbg)
4165 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4166 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4167 return gimple_op (dbg, 1);
4170 /* Return a pointer to the value bound to the variable in a
4171 GIMPLE_DEBUG source bind statement. */
4173 static inline tree *
4174 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4176 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4177 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4178 return gimple_op_ptr (dbg, 1);
4181 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4183 static inline void
4184 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4186 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4187 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4188 gimple_set_op (dbg, 0, var);
4191 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4192 statement. */
4194 static inline void
4195 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4197 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4198 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4199 gimple_set_op (dbg, 1, value);
4202 /* Return the line number for EXPR, or return -1 if we have no line
4203 number information for it. */
4204 static inline int
4205 get_lineno (const_gimple stmt)
4207 location_t loc;
4209 if (!stmt)
4210 return -1;
4212 loc = gimple_location (stmt);
4213 if (loc == UNKNOWN_LOCATION)
4214 return -1;
4216 return LOCATION_LINE (loc);
4219 /* Return a pointer to the body for the OMP statement GS. */
4221 static inline gimple_seq *
4222 gimple_omp_body_ptr (gimple gs)
4224 return &static_cast <gimple_statement_omp *> (gs)->body;
4227 /* Return the body for the OMP statement GS. */
4229 static inline gimple_seq
4230 gimple_omp_body (gimple gs)
4232 return *gimple_omp_body_ptr (gs);
4235 /* Set BODY to be the body for the OMP statement GS. */
4237 static inline void
4238 gimple_omp_set_body (gimple gs, gimple_seq body)
4240 static_cast <gimple_statement_omp *> (gs)->body = body;
4244 /* Return the name associated with OMP_CRITICAL statement GS. */
4246 static inline tree
4247 gimple_omp_critical_name (const_gimple gs)
4249 const gimple_statement_omp_critical *omp_critical_stmt =
4250 as_a <const gimple_statement_omp_critical> (gs);
4251 return omp_critical_stmt->name;
4255 /* Return a pointer to the name associated with OMP critical statement GS. */
4257 static inline tree *
4258 gimple_omp_critical_name_ptr (gimple gs)
4260 gimple_statement_omp_critical *omp_critical_stmt =
4261 as_a <gimple_statement_omp_critical> (gs);
4262 return &omp_critical_stmt->name;
4266 /* Set NAME to be the name associated with OMP critical statement GS. */
4268 static inline void
4269 gimple_omp_critical_set_name (gimple gs, tree name)
4271 gimple_statement_omp_critical *omp_critical_stmt =
4272 as_a <gimple_statement_omp_critical> (gs);
4273 omp_critical_stmt->name = name;
4277 /* Return the kind of OMP for statemement. */
4279 static inline int
4280 gimple_omp_for_kind (const_gimple g)
4282 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4283 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4287 /* Set the OMP for kind. */
4289 static inline void
4290 gimple_omp_for_set_kind (gimple g, int kind)
4292 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4293 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4294 | (kind & GF_OMP_FOR_KIND_MASK);
4298 /* Return true if OMP for statement G has the
4299 GF_OMP_FOR_COMBINED flag set. */
4301 static inline bool
4302 gimple_omp_for_combined_p (const_gimple g)
4304 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4305 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4309 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4310 value of COMBINED_P. */
4312 static inline void
4313 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4315 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4316 if (combined_p)
4317 g->subcode |= GF_OMP_FOR_COMBINED;
4318 else
4319 g->subcode &= ~GF_OMP_FOR_COMBINED;
4323 /* Return true if OMP for statement G has the
4324 GF_OMP_FOR_COMBINED_INTO flag set. */
4326 static inline bool
4327 gimple_omp_for_combined_into_p (const_gimple g)
4329 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4330 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4334 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4335 value of COMBINED_P. */
4337 static inline void
4338 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4340 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4341 if (combined_p)
4342 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4343 else
4344 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4348 /* Return the clauses associated with OMP_FOR GS. */
4350 static inline tree
4351 gimple_omp_for_clauses (const_gimple gs)
4353 const gimple_statement_omp_for *omp_for_stmt =
4354 as_a <const gimple_statement_omp_for> (gs);
4355 return omp_for_stmt->clauses;
4359 /* Return a pointer to the OMP_FOR GS. */
4361 static inline tree *
4362 gimple_omp_for_clauses_ptr (gimple gs)
4364 gimple_statement_omp_for *omp_for_stmt =
4365 as_a <gimple_statement_omp_for> (gs);
4366 return &omp_for_stmt->clauses;
4370 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4372 static inline void
4373 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4375 gimple_statement_omp_for *omp_for_stmt =
4376 as_a <gimple_statement_omp_for> (gs);
4377 omp_for_stmt->clauses = clauses;
4381 /* Get the collapse count of OMP_FOR GS. */
4383 static inline size_t
4384 gimple_omp_for_collapse (gimple gs)
4386 gimple_statement_omp_for *omp_for_stmt =
4387 as_a <gimple_statement_omp_for> (gs);
4388 return omp_for_stmt->collapse;
4392 /* Return the index variable for OMP_FOR GS. */
4394 static inline tree
4395 gimple_omp_for_index (const_gimple gs, size_t i)
4397 const gimple_statement_omp_for *omp_for_stmt =
4398 as_a <const gimple_statement_omp_for> (gs);
4399 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4400 return omp_for_stmt->iter[i].index;
4404 /* Return a pointer to the index variable for OMP_FOR GS. */
4406 static inline tree *
4407 gimple_omp_for_index_ptr (gimple gs, size_t i)
4409 gimple_statement_omp_for *omp_for_stmt =
4410 as_a <gimple_statement_omp_for> (gs);
4411 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4412 return &omp_for_stmt->iter[i].index;
4416 /* Set INDEX to be the index variable for OMP_FOR GS. */
4418 static inline void
4419 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4421 gimple_statement_omp_for *omp_for_stmt =
4422 as_a <gimple_statement_omp_for> (gs);
4423 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4424 omp_for_stmt->iter[i].index = index;
4428 /* Return the initial value for OMP_FOR GS. */
4430 static inline tree
4431 gimple_omp_for_initial (const_gimple gs, size_t i)
4433 const gimple_statement_omp_for *omp_for_stmt =
4434 as_a <const gimple_statement_omp_for> (gs);
4435 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4436 return omp_for_stmt->iter[i].initial;
4440 /* Return a pointer to the initial value for OMP_FOR GS. */
4442 static inline tree *
4443 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4445 gimple_statement_omp_for *omp_for_stmt =
4446 as_a <gimple_statement_omp_for> (gs);
4447 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4448 return &omp_for_stmt->iter[i].initial;
4452 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4454 static inline void
4455 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4457 gimple_statement_omp_for *omp_for_stmt =
4458 as_a <gimple_statement_omp_for> (gs);
4459 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4460 omp_for_stmt->iter[i].initial = initial;
4464 /* Return the final value for OMP_FOR GS. */
4466 static inline tree
4467 gimple_omp_for_final (const_gimple gs, size_t i)
4469 const gimple_statement_omp_for *omp_for_stmt =
4470 as_a <const gimple_statement_omp_for> (gs);
4471 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4472 return omp_for_stmt->iter[i].final;
4476 /* Return a pointer to the final value for OMP_FOR GS. */
4478 static inline tree *
4479 gimple_omp_for_final_ptr (gimple gs, size_t i)
4481 gimple_statement_omp_for *omp_for_stmt =
4482 as_a <gimple_statement_omp_for> (gs);
4483 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4484 return &omp_for_stmt->iter[i].final;
4488 /* Set FINAL to be the final value for OMP_FOR GS. */
4490 static inline void
4491 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4493 gimple_statement_omp_for *omp_for_stmt =
4494 as_a <gimple_statement_omp_for> (gs);
4495 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4496 omp_for_stmt->iter[i].final = final;
4500 /* Return the increment value for OMP_FOR GS. */
4502 static inline tree
4503 gimple_omp_for_incr (const_gimple gs, size_t i)
4505 const gimple_statement_omp_for *omp_for_stmt =
4506 as_a <const gimple_statement_omp_for> (gs);
4507 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4508 return omp_for_stmt->iter[i].incr;
4512 /* Return a pointer to the increment value for OMP_FOR GS. */
4514 static inline tree *
4515 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4517 gimple_statement_omp_for *omp_for_stmt =
4518 as_a <gimple_statement_omp_for> (gs);
4519 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4520 return &omp_for_stmt->iter[i].incr;
4524 /* Set INCR to be the increment value for OMP_FOR GS. */
4526 static inline void
4527 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4529 gimple_statement_omp_for *omp_for_stmt =
4530 as_a <gimple_statement_omp_for> (gs);
4531 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4532 omp_for_stmt->iter[i].incr = incr;
4536 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4537 statement GS starts. */
4539 static inline gimple_seq *
4540 gimple_omp_for_pre_body_ptr (gimple gs)
4542 gimple_statement_omp_for *omp_for_stmt =
4543 as_a <gimple_statement_omp_for> (gs);
4544 return &omp_for_stmt->pre_body;
4548 /* Return the sequence of statements to execute before the OMP_FOR
4549 statement GS starts. */
4551 static inline gimple_seq
4552 gimple_omp_for_pre_body (gimple gs)
4554 return *gimple_omp_for_pre_body_ptr (gs);
4558 /* Set PRE_BODY to be the sequence of statements to execute before the
4559 OMP_FOR statement GS starts. */
4561 static inline void
4562 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4564 gimple_statement_omp_for *omp_for_stmt =
4565 as_a <gimple_statement_omp_for> (gs);
4566 omp_for_stmt->pre_body = pre_body;
4570 /* Return the clauses associated with OMP_PARALLEL GS. */
4572 static inline tree
4573 gimple_omp_parallel_clauses (const_gimple gs)
4575 const gimple_statement_omp_parallel *omp_parallel_stmt =
4576 as_a <const gimple_statement_omp_parallel> (gs);
4577 return omp_parallel_stmt->clauses;
4581 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4583 static inline tree *
4584 gimple_omp_parallel_clauses_ptr (gimple gs)
4586 gimple_statement_omp_parallel *omp_parallel_stmt =
4587 as_a <gimple_statement_omp_parallel> (gs);
4588 return &omp_parallel_stmt->clauses;
4592 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4593 GS. */
4595 static inline void
4596 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4598 gimple_statement_omp_parallel *omp_parallel_stmt =
4599 as_a <gimple_statement_omp_parallel> (gs);
4600 omp_parallel_stmt->clauses = clauses;
4604 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4606 static inline tree
4607 gimple_omp_parallel_child_fn (const_gimple gs)
4609 const gimple_statement_omp_parallel *omp_parallel_stmt =
4610 as_a <const gimple_statement_omp_parallel> (gs);
4611 return omp_parallel_stmt->child_fn;
4614 /* Return a pointer to the child function used to hold the body of
4615 OMP_PARALLEL GS. */
4617 static inline tree *
4618 gimple_omp_parallel_child_fn_ptr (gimple gs)
4620 gimple_statement_omp_parallel *omp_parallel_stmt =
4621 as_a <gimple_statement_omp_parallel> (gs);
4622 return &omp_parallel_stmt->child_fn;
4626 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4628 static inline void
4629 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4631 gimple_statement_omp_parallel *omp_parallel_stmt =
4632 as_a <gimple_statement_omp_parallel> (gs);
4633 omp_parallel_stmt->child_fn = child_fn;
4637 /* Return the artificial argument used to send variables and values
4638 from the parent to the children threads in OMP_PARALLEL GS. */
4640 static inline tree
4641 gimple_omp_parallel_data_arg (const_gimple gs)
4643 const gimple_statement_omp_parallel *omp_parallel_stmt =
4644 as_a <const gimple_statement_omp_parallel> (gs);
4645 return omp_parallel_stmt->data_arg;
4649 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4651 static inline tree *
4652 gimple_omp_parallel_data_arg_ptr (gimple gs)
4654 gimple_statement_omp_parallel *omp_parallel_stmt =
4655 as_a <gimple_statement_omp_parallel> (gs);
4656 return &omp_parallel_stmt->data_arg;
4660 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4662 static inline void
4663 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4665 gimple_statement_omp_parallel *omp_parallel_stmt =
4666 as_a <gimple_statement_omp_parallel> (gs);
4667 omp_parallel_stmt->data_arg = data_arg;
4671 /* Return the clauses associated with OMP_TASK GS. */
4673 static inline tree
4674 gimple_omp_task_clauses (const_gimple gs)
4676 const gimple_statement_omp_task *omp_task_stmt =
4677 as_a <const gimple_statement_omp_task> (gs);
4678 return omp_task_stmt->clauses;
4682 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4684 static inline tree *
4685 gimple_omp_task_clauses_ptr (gimple gs)
4687 gimple_statement_omp_task *omp_task_stmt =
4688 as_a <gimple_statement_omp_task> (gs);
4689 return &omp_task_stmt->clauses;
4693 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4694 GS. */
4696 static inline void
4697 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4699 gimple_statement_omp_task *omp_task_stmt =
4700 as_a <gimple_statement_omp_task> (gs);
4701 omp_task_stmt->clauses = clauses;
4705 /* Return the child function used to hold the body of OMP_TASK GS. */
4707 static inline tree
4708 gimple_omp_task_child_fn (const_gimple gs)
4710 const gimple_statement_omp_task *omp_task_stmt =
4711 as_a <const gimple_statement_omp_task> (gs);
4712 return omp_task_stmt->child_fn;
4715 /* Return a pointer to the child function used to hold the body of
4716 OMP_TASK GS. */
4718 static inline tree *
4719 gimple_omp_task_child_fn_ptr (gimple gs)
4721 gimple_statement_omp_task *omp_task_stmt =
4722 as_a <gimple_statement_omp_task> (gs);
4723 return &omp_task_stmt->child_fn;
4727 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4729 static inline void
4730 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4732 gimple_statement_omp_task *omp_task_stmt =
4733 as_a <gimple_statement_omp_task> (gs);
4734 omp_task_stmt->child_fn = child_fn;
4738 /* Return the artificial argument used to send variables and values
4739 from the parent to the children threads in OMP_TASK GS. */
4741 static inline tree
4742 gimple_omp_task_data_arg (const_gimple gs)
4744 const gimple_statement_omp_task *omp_task_stmt =
4745 as_a <const gimple_statement_omp_task> (gs);
4746 return omp_task_stmt->data_arg;
4750 /* Return a pointer to the data argument for OMP_TASK GS. */
4752 static inline tree *
4753 gimple_omp_task_data_arg_ptr (gimple gs)
4755 gimple_statement_omp_task *omp_task_stmt =
4756 as_a <gimple_statement_omp_task> (gs);
4757 return &omp_task_stmt->data_arg;
4761 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4763 static inline void
4764 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4766 gimple_statement_omp_task *omp_task_stmt =
4767 as_a <gimple_statement_omp_task> (gs);
4768 omp_task_stmt->data_arg = data_arg;
4772 /* Return the clauses associated with OMP_TASK GS. */
4774 static inline tree
4775 gimple_omp_taskreg_clauses (const_gimple gs)
4777 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4778 as_a <const gimple_statement_omp_taskreg> (gs);
4779 return omp_taskreg_stmt->clauses;
4783 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4785 static inline tree *
4786 gimple_omp_taskreg_clauses_ptr (gimple gs)
4788 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4789 as_a <gimple_statement_omp_taskreg> (gs);
4790 return &omp_taskreg_stmt->clauses;
4794 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4795 GS. */
4797 static inline void
4798 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4800 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4801 as_a <gimple_statement_omp_taskreg> (gs);
4802 omp_taskreg_stmt->clauses = clauses;
4806 /* Return the child function used to hold the body of OMP_TASK GS. */
4808 static inline tree
4809 gimple_omp_taskreg_child_fn (const_gimple gs)
4811 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4812 as_a <const gimple_statement_omp_taskreg> (gs);
4813 return omp_taskreg_stmt->child_fn;
4816 /* Return a pointer to the child function used to hold the body of
4817 OMP_TASK GS. */
4819 static inline tree *
4820 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4822 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4823 as_a <gimple_statement_omp_taskreg> (gs);
4824 return &omp_taskreg_stmt->child_fn;
4828 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4830 static inline void
4831 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4833 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4834 as_a <gimple_statement_omp_taskreg> (gs);
4835 omp_taskreg_stmt->child_fn = child_fn;
4839 /* Return the artificial argument used to send variables and values
4840 from the parent to the children threads in OMP_TASK GS. */
4842 static inline tree
4843 gimple_omp_taskreg_data_arg (const_gimple gs)
4845 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4846 as_a <const gimple_statement_omp_taskreg> (gs);
4847 return omp_taskreg_stmt->data_arg;
4851 /* Return a pointer to the data argument for OMP_TASK GS. */
4853 static inline tree *
4854 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4856 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4857 as_a <gimple_statement_omp_taskreg> (gs);
4858 return &omp_taskreg_stmt->data_arg;
4862 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4864 static inline void
4865 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4867 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4868 as_a <gimple_statement_omp_taskreg> (gs);
4869 omp_taskreg_stmt->data_arg = data_arg;
4873 /* Return the copy function used to hold the body of OMP_TASK GS. */
4875 static inline tree
4876 gimple_omp_task_copy_fn (const_gimple gs)
4878 const gimple_statement_omp_task *omp_task_stmt =
4879 as_a <const gimple_statement_omp_task> (gs);
4880 return omp_task_stmt->copy_fn;
4883 /* Return a pointer to the copy function used to hold the body of
4884 OMP_TASK GS. */
4886 static inline tree *
4887 gimple_omp_task_copy_fn_ptr (gimple gs)
4889 gimple_statement_omp_task *omp_task_stmt =
4890 as_a <gimple_statement_omp_task> (gs);
4891 return &omp_task_stmt->copy_fn;
4895 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4897 static inline void
4898 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4900 gimple_statement_omp_task *omp_task_stmt =
4901 as_a <gimple_statement_omp_task> (gs);
4902 omp_task_stmt->copy_fn = copy_fn;
4906 /* Return size of the data block in bytes in OMP_TASK GS. */
4908 static inline tree
4909 gimple_omp_task_arg_size (const_gimple gs)
4911 const gimple_statement_omp_task *omp_task_stmt =
4912 as_a <const gimple_statement_omp_task> (gs);
4913 return omp_task_stmt->arg_size;
4917 /* Return a pointer to the data block size for OMP_TASK GS. */
4919 static inline tree *
4920 gimple_omp_task_arg_size_ptr (gimple gs)
4922 gimple_statement_omp_task *omp_task_stmt =
4923 as_a <gimple_statement_omp_task> (gs);
4924 return &omp_task_stmt->arg_size;
4928 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4930 static inline void
4931 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4933 gimple_statement_omp_task *omp_task_stmt =
4934 as_a <gimple_statement_omp_task> (gs);
4935 omp_task_stmt->arg_size = arg_size;
4939 /* Return align of the data block in bytes in OMP_TASK GS. */
4941 static inline tree
4942 gimple_omp_task_arg_align (const_gimple gs)
4944 const gimple_statement_omp_task *omp_task_stmt =
4945 as_a <const gimple_statement_omp_task> (gs);
4946 return omp_task_stmt->arg_align;
4950 /* Return a pointer to the data block align for OMP_TASK GS. */
4952 static inline tree *
4953 gimple_omp_task_arg_align_ptr (gimple gs)
4955 gimple_statement_omp_task *omp_task_stmt =
4956 as_a <gimple_statement_omp_task> (gs);
4957 return &omp_task_stmt->arg_align;
4961 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4963 static inline void
4964 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4966 gimple_statement_omp_task *omp_task_stmt =
4967 as_a <gimple_statement_omp_task> (gs);
4968 omp_task_stmt->arg_align = arg_align;
4972 /* Return the clauses associated with OMP_SINGLE GS. */
4974 static inline tree
4975 gimple_omp_single_clauses (const_gimple gs)
4977 const gimple_statement_omp_single *omp_single_stmt =
4978 as_a <const gimple_statement_omp_single> (gs);
4979 return omp_single_stmt->clauses;
4983 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4985 static inline tree *
4986 gimple_omp_single_clauses_ptr (gimple gs)
4988 gimple_statement_omp_single *omp_single_stmt =
4989 as_a <gimple_statement_omp_single> (gs);
4990 return &omp_single_stmt->clauses;
4994 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4996 static inline void
4997 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4999 gimple_statement_omp_single *omp_single_stmt =
5000 as_a <gimple_statement_omp_single> (gs);
5001 omp_single_stmt->clauses = clauses;
5005 /* Return the clauses associated with OMP_TARGET GS. */
5007 static inline tree
5008 gimple_omp_target_clauses (const_gimple gs)
5010 const gimple_statement_omp_target *omp_target_stmt =
5011 as_a <const gimple_statement_omp_target> (gs);
5012 return omp_target_stmt->clauses;
5016 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5018 static inline tree *
5019 gimple_omp_target_clauses_ptr (gimple gs)
5021 gimple_statement_omp_target *omp_target_stmt =
5022 as_a <gimple_statement_omp_target> (gs);
5023 return &omp_target_stmt->clauses;
5027 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5029 static inline void
5030 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5032 gimple_statement_omp_target *omp_target_stmt =
5033 as_a <gimple_statement_omp_target> (gs);
5034 omp_target_stmt->clauses = clauses;
5038 /* Return the kind of OMP target statemement. */
5040 static inline int
5041 gimple_omp_target_kind (const_gimple g)
5043 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5044 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5048 /* Set the OMP target kind. */
5050 static inline void
5051 gimple_omp_target_set_kind (gimple g, int kind)
5053 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5054 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5055 | (kind & GF_OMP_TARGET_KIND_MASK);
5059 /* Return the child function used to hold the body of OMP_TARGET GS. */
5061 static inline tree
5062 gimple_omp_target_child_fn (const_gimple gs)
5064 const gimple_statement_omp_target *omp_target_stmt =
5065 as_a <const gimple_statement_omp_target> (gs);
5066 return omp_target_stmt->child_fn;
5069 /* Return a pointer to the child function used to hold the body of
5070 OMP_TARGET GS. */
5072 static inline tree *
5073 gimple_omp_target_child_fn_ptr (gimple gs)
5075 gimple_statement_omp_target *omp_target_stmt =
5076 as_a <gimple_statement_omp_target> (gs);
5077 return &omp_target_stmt->child_fn;
5081 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5083 static inline void
5084 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5086 gimple_statement_omp_target *omp_target_stmt =
5087 as_a <gimple_statement_omp_target> (gs);
5088 omp_target_stmt->child_fn = child_fn;
5092 /* Return the artificial argument used to send variables and values
5093 from the parent to the children threads in OMP_TARGET GS. */
5095 static inline tree
5096 gimple_omp_target_data_arg (const_gimple gs)
5098 const gimple_statement_omp_target *omp_target_stmt =
5099 as_a <const gimple_statement_omp_target> (gs);
5100 return omp_target_stmt->data_arg;
5104 /* Return a pointer to the data argument for OMP_TARGET GS. */
5106 static inline tree *
5107 gimple_omp_target_data_arg_ptr (gimple gs)
5109 gimple_statement_omp_target *omp_target_stmt =
5110 as_a <gimple_statement_omp_target> (gs);
5111 return &omp_target_stmt->data_arg;
5115 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5117 static inline void
5118 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5120 gimple_statement_omp_target *omp_target_stmt =
5121 as_a <gimple_statement_omp_target> (gs);
5122 omp_target_stmt->data_arg = data_arg;
5126 /* Return the clauses associated with OMP_TEAMS GS. */
5128 static inline tree
5129 gimple_omp_teams_clauses (const_gimple gs)
5131 const gimple_statement_omp_teams *omp_teams_stmt =
5132 as_a <const gimple_statement_omp_teams> (gs);
5133 return omp_teams_stmt->clauses;
5137 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5139 static inline tree *
5140 gimple_omp_teams_clauses_ptr (gimple gs)
5142 gimple_statement_omp_teams *omp_teams_stmt =
5143 as_a <gimple_statement_omp_teams> (gs);
5144 return &omp_teams_stmt->clauses;
5148 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5150 static inline void
5151 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5153 gimple_statement_omp_teams *omp_teams_stmt =
5154 as_a <gimple_statement_omp_teams> (gs);
5155 omp_teams_stmt->clauses = clauses;
5159 /* Return the clauses associated with OMP_SECTIONS GS. */
5161 static inline tree
5162 gimple_omp_sections_clauses (const_gimple gs)
5164 const gimple_statement_omp_sections *omp_sections_stmt =
5165 as_a <const gimple_statement_omp_sections> (gs);
5166 return omp_sections_stmt->clauses;
5170 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5172 static inline tree *
5173 gimple_omp_sections_clauses_ptr (gimple gs)
5175 gimple_statement_omp_sections *omp_sections_stmt =
5176 as_a <gimple_statement_omp_sections> (gs);
5177 return &omp_sections_stmt->clauses;
5181 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5182 GS. */
5184 static inline void
5185 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5187 gimple_statement_omp_sections *omp_sections_stmt =
5188 as_a <gimple_statement_omp_sections> (gs);
5189 omp_sections_stmt->clauses = clauses;
5193 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5194 in GS. */
5196 static inline tree
5197 gimple_omp_sections_control (const_gimple gs)
5199 const gimple_statement_omp_sections *omp_sections_stmt =
5200 as_a <const gimple_statement_omp_sections> (gs);
5201 return omp_sections_stmt->control;
5205 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5206 GS. */
5208 static inline tree *
5209 gimple_omp_sections_control_ptr (gimple gs)
5211 gimple_statement_omp_sections *omp_sections_stmt =
5212 as_a <gimple_statement_omp_sections> (gs);
5213 return &omp_sections_stmt->control;
5217 /* Set CONTROL to be the set of clauses associated with the
5218 GIMPLE_OMP_SECTIONS in GS. */
5220 static inline void
5221 gimple_omp_sections_set_control (gimple gs, tree control)
5223 gimple_statement_omp_sections *omp_sections_stmt =
5224 as_a <gimple_statement_omp_sections> (gs);
5225 omp_sections_stmt->control = control;
5229 /* Set COND to be the condition code for OMP_FOR GS. */
5231 static inline void
5232 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5234 gimple_statement_omp_for *omp_for_stmt =
5235 as_a <gimple_statement_omp_for> (gs);
5236 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5237 && i < omp_for_stmt->collapse);
5238 omp_for_stmt->iter[i].cond = cond;
5242 /* Return the condition code associated with OMP_FOR GS. */
5244 static inline enum tree_code
5245 gimple_omp_for_cond (const_gimple gs, size_t i)
5247 const gimple_statement_omp_for *omp_for_stmt =
5248 as_a <const gimple_statement_omp_for> (gs);
5249 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5250 return omp_for_stmt->iter[i].cond;
5254 /* Set the value being stored in an atomic store. */
5256 static inline void
5257 gimple_omp_atomic_store_set_val (gimple g, tree val)
5259 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5260 as_a <gimple_statement_omp_atomic_store> (g);
5261 omp_atomic_store_stmt->val = val;
5265 /* Return the value being stored in an atomic store. */
5267 static inline tree
5268 gimple_omp_atomic_store_val (const_gimple g)
5270 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5271 as_a <const gimple_statement_omp_atomic_store> (g);
5272 return omp_atomic_store_stmt->val;
5276 /* Return a pointer to the value being stored in an atomic store. */
5278 static inline tree *
5279 gimple_omp_atomic_store_val_ptr (gimple g)
5281 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5282 as_a <gimple_statement_omp_atomic_store> (g);
5283 return &omp_atomic_store_stmt->val;
5287 /* Set the LHS of an atomic load. */
5289 static inline void
5290 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5292 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5293 as_a <gimple_statement_omp_atomic_load> (g);
5294 omp_atomic_load_stmt->lhs = lhs;
5298 /* Get the LHS of an atomic load. */
5300 static inline tree
5301 gimple_omp_atomic_load_lhs (const_gimple g)
5303 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5304 as_a <const gimple_statement_omp_atomic_load> (g);
5305 return omp_atomic_load_stmt->lhs;
5309 /* Return a pointer to the LHS of an atomic load. */
5311 static inline tree *
5312 gimple_omp_atomic_load_lhs_ptr (gimple g)
5314 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5315 as_a <gimple_statement_omp_atomic_load> (g);
5316 return &omp_atomic_load_stmt->lhs;
5320 /* Set the RHS of an atomic load. */
5322 static inline void
5323 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5325 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5326 as_a <gimple_statement_omp_atomic_load> (g);
5327 omp_atomic_load_stmt->rhs = rhs;
5331 /* Get the RHS of an atomic load. */
5333 static inline tree
5334 gimple_omp_atomic_load_rhs (const_gimple g)
5336 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5337 as_a <const gimple_statement_omp_atomic_load> (g);
5338 return omp_atomic_load_stmt->rhs;
5342 /* Return a pointer to the RHS of an atomic load. */
5344 static inline tree *
5345 gimple_omp_atomic_load_rhs_ptr (gimple g)
5347 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5348 as_a <gimple_statement_omp_atomic_load> (g);
5349 return &omp_atomic_load_stmt->rhs;
5353 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5355 static inline tree
5356 gimple_omp_continue_control_def (const_gimple g)
5358 const gimple_statement_omp_continue *omp_continue_stmt =
5359 as_a <const gimple_statement_omp_continue> (g);
5360 return omp_continue_stmt->control_def;
5363 /* The same as above, but return the address. */
5365 static inline tree *
5366 gimple_omp_continue_control_def_ptr (gimple g)
5368 gimple_statement_omp_continue *omp_continue_stmt =
5369 as_a <gimple_statement_omp_continue> (g);
5370 return &omp_continue_stmt->control_def;
5373 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5375 static inline void
5376 gimple_omp_continue_set_control_def (gimple g, tree def)
5378 gimple_statement_omp_continue *omp_continue_stmt =
5379 as_a <gimple_statement_omp_continue> (g);
5380 omp_continue_stmt->control_def = def;
5384 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5386 static inline tree
5387 gimple_omp_continue_control_use (const_gimple g)
5389 const gimple_statement_omp_continue *omp_continue_stmt =
5390 as_a <const gimple_statement_omp_continue> (g);
5391 return omp_continue_stmt->control_use;
5395 /* The same as above, but return the address. */
5397 static inline tree *
5398 gimple_omp_continue_control_use_ptr (gimple g)
5400 gimple_statement_omp_continue *omp_continue_stmt =
5401 as_a <gimple_statement_omp_continue> (g);
5402 return &omp_continue_stmt->control_use;
5406 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5408 static inline void
5409 gimple_omp_continue_set_control_use (gimple g, tree use)
5411 gimple_statement_omp_continue *omp_continue_stmt =
5412 as_a <gimple_statement_omp_continue> (g);
5413 omp_continue_stmt->control_use = use;
5416 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5418 static inline gimple_seq *
5419 gimple_transaction_body_ptr (gimple gs)
5421 gimple_statement_transaction *transaction_stmt =
5422 as_a <gimple_statement_transaction> (gs);
5423 return &transaction_stmt->body;
5426 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5428 static inline gimple_seq
5429 gimple_transaction_body (gimple gs)
5431 return *gimple_transaction_body_ptr (gs);
5434 /* Return the label associated with a GIMPLE_TRANSACTION. */
5436 static inline tree
5437 gimple_transaction_label (const_gimple gs)
5439 const gimple_statement_transaction *transaction_stmt =
5440 as_a <const gimple_statement_transaction> (gs);
5441 return transaction_stmt->label;
5444 static inline tree *
5445 gimple_transaction_label_ptr (gimple gs)
5447 gimple_statement_transaction *transaction_stmt =
5448 as_a <gimple_statement_transaction> (gs);
5449 return &transaction_stmt->label;
5452 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5454 static inline unsigned int
5455 gimple_transaction_subcode (const_gimple gs)
5457 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5458 return gs->subcode;
5461 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5463 static inline void
5464 gimple_transaction_set_body (gimple gs, gimple_seq body)
5466 gimple_statement_transaction *transaction_stmt =
5467 as_a <gimple_statement_transaction> (gs);
5468 transaction_stmt->body = body;
5471 /* Set the label associated with a GIMPLE_TRANSACTION. */
5473 static inline void
5474 gimple_transaction_set_label (gimple gs, tree label)
5476 gimple_statement_transaction *transaction_stmt =
5477 as_a <gimple_statement_transaction> (gs);
5478 transaction_stmt->label = label;
5481 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5483 static inline void
5484 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5486 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5487 gs->subcode = subcode;
5491 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5493 static inline tree *
5494 gimple_return_retval_ptr (const_gimple gs)
5496 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5497 return gimple_op_ptr (gs, 0);
5500 /* Return the return value for GIMPLE_RETURN GS. */
5502 static inline tree
5503 gimple_return_retval (const_gimple gs)
5505 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5506 return gimple_op (gs, 0);
5510 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5512 static inline void
5513 gimple_return_set_retval (gimple gs, tree retval)
5515 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5516 gimple_set_op (gs, 0, retval);
5520 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5522 #define CASE_GIMPLE_OMP \
5523 case GIMPLE_OMP_PARALLEL: \
5524 case GIMPLE_OMP_TASK: \
5525 case GIMPLE_OMP_FOR: \
5526 case GIMPLE_OMP_SECTIONS: \
5527 case GIMPLE_OMP_SECTIONS_SWITCH: \
5528 case GIMPLE_OMP_SINGLE: \
5529 case GIMPLE_OMP_TARGET: \
5530 case GIMPLE_OMP_TEAMS: \
5531 case GIMPLE_OMP_SECTION: \
5532 case GIMPLE_OMP_MASTER: \
5533 case GIMPLE_OMP_TASKGROUP: \
5534 case GIMPLE_OMP_ORDERED: \
5535 case GIMPLE_OMP_CRITICAL: \
5536 case GIMPLE_OMP_RETURN: \
5537 case GIMPLE_OMP_ATOMIC_LOAD: \
5538 case GIMPLE_OMP_ATOMIC_STORE: \
5539 case GIMPLE_OMP_CONTINUE
5541 static inline bool
5542 is_gimple_omp (const_gimple stmt)
5544 switch (gimple_code (stmt))
5546 CASE_GIMPLE_OMP:
5547 return true;
5548 default:
5549 return false;
5554 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5556 static inline bool
5557 gimple_nop_p (const_gimple g)
5559 return gimple_code (g) == GIMPLE_NOP;
5563 /* Return true if GS is a GIMPLE_RESX. */
5565 static inline bool
5566 is_gimple_resx (const_gimple gs)
5568 return gimple_code (gs) == GIMPLE_RESX;
5571 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5573 static inline enum br_predictor
5574 gimple_predict_predictor (gimple gs)
5576 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5577 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5581 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5583 static inline void
5584 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5586 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5587 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5588 | (unsigned) predictor;
5592 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5594 static inline enum prediction
5595 gimple_predict_outcome (gimple gs)
5597 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5598 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5602 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5604 static inline void
5605 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5607 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5608 if (outcome == TAKEN)
5609 gs->subcode |= GF_PREDICT_TAKEN;
5610 else
5611 gs->subcode &= ~GF_PREDICT_TAKEN;
5615 /* Return the type of the main expression computed by STMT. Return
5616 void_type_node if the statement computes nothing. */
5618 static inline tree
5619 gimple_expr_type (const_gimple stmt)
5621 enum gimple_code code = gimple_code (stmt);
5623 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5625 tree type;
5626 /* In general we want to pass out a type that can be substituted
5627 for both the RHS and the LHS types if there is a possibly
5628 useless conversion involved. That means returning the
5629 original RHS type as far as we can reconstruct it. */
5630 if (code == GIMPLE_CALL)
5632 if (gimple_call_internal_p (stmt)
5633 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5634 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5635 else
5636 type = gimple_call_return_type (stmt);
5638 else
5639 switch (gimple_assign_rhs_code (stmt))
5641 case POINTER_PLUS_EXPR:
5642 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5643 break;
5645 default:
5646 /* As fallback use the type of the LHS. */
5647 type = TREE_TYPE (gimple_get_lhs (stmt));
5648 break;
5650 return type;
5652 else if (code == GIMPLE_COND)
5653 return boolean_type_node;
5654 else
5655 return void_type_node;
5658 /* Enum and arrays used for allocation stats. Keep in sync with
5659 gimple.c:gimple_alloc_kind_names. */
5660 enum gimple_alloc_kind
5662 gimple_alloc_kind_assign, /* Assignments. */
5663 gimple_alloc_kind_phi, /* PHI nodes. */
5664 gimple_alloc_kind_cond, /* Conditionals. */
5665 gimple_alloc_kind_rest, /* Everything else. */
5666 gimple_alloc_kind_all
5669 extern int gimple_alloc_counts[];
5670 extern int gimple_alloc_sizes[];
5672 /* Return the allocation kind for a given stmt CODE. */
5673 static inline enum gimple_alloc_kind
5674 gimple_alloc_kind (enum gimple_code code)
5676 switch (code)
5678 case GIMPLE_ASSIGN:
5679 return gimple_alloc_kind_assign;
5680 case GIMPLE_PHI:
5681 return gimple_alloc_kind_phi;
5682 case GIMPLE_COND:
5683 return gimple_alloc_kind_cond;
5684 default:
5685 return gimple_alloc_kind_rest;
5689 /* Return true if a location should not be emitted for this statement
5690 by annotate_all_with_location. */
5692 static inline bool
5693 gimple_do_not_emit_location_p (gimple g)
5695 return gimple_plf (g, GF_PLF_1);
5698 /* Mark statement G so a location will not be emitted by
5699 annotate_one_with_location. */
5701 static inline void
5702 gimple_set_do_not_emit_location (gimple g)
5704 /* The PLF flags are initialized to 0 when a new tuple is created,
5705 so no need to initialize it anywhere. */
5706 gimple_set_plf (g, GF_PLF_1, true);
5710 /* Macros for showing usage statistics. */
5711 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5712 ? (x) \
5713 : ((x) < 1024*1024*10 \
5714 ? (x) / 1024 \
5715 : (x) / (1024*1024))))
5717 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5719 #endif /* GCC_GIMPLE_H */