gengtype.c (main): Make uintptr_t a known type.
[gcc.git] / gcc / gimple.h
1 /* Gimple IR definitions.
2
3 Copyright 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
5
6 This file is part of GCC.
7
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.
12
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.
17
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/>. */
21
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
24
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
33 #include "internal-fn.h"
34
35 struct gimple_seq_node_d;
36 typedef struct gimple_seq_node_d *gimple_seq_node;
37 typedef const struct gimple_seq_node_d *const_gimple_seq_node;
38
39 /* For each block, the PHI nodes that need to be rewritten are stored into
40 these vectors. */
41 typedef VEC(gimple, heap) *gimple_vec;
42 DEF_VEC_P (gimple_vec);
43 DEF_VEC_ALLOC_P (gimple_vec, heap);
44
45 enum gimple_code {
46 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
47 #include "gimple.def"
48 #undef DEFGSCODE
49 LAST_AND_UNUSED_GIMPLE_CODE
50 };
51
52 extern const char *const gimple_code_name[];
53 extern const unsigned char gimple_rhs_class_table[];
54
55 /* Error out if a gimple tuple is addressed incorrectly. */
56 #if defined ENABLE_GIMPLE_CHECKING
57 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
58 extern void gimple_check_failed (const_gimple, const char *, int, \
59 const char *, enum gimple_code, \
60 enum tree_code) ATTRIBUTE_NORETURN;
61
62 #define GIMPLE_CHECK(GS, CODE) \
63 do { \
64 const_gimple __gs = (GS); \
65 if (gimple_code (__gs) != (CODE)) \
66 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
67 (CODE), ERROR_MARK); \
68 } while (0)
69 #else /* not ENABLE_GIMPLE_CHECKING */
70 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
71 #define GIMPLE_CHECK(GS, CODE) (void)0
72 #endif
73
74 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
75 get_gimple_rhs_class. */
76 enum gimple_rhs_class
77 {
78 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
79 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
80 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
81 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
82 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
83 name, a _DECL, a _REF, etc. */
84 };
85
86 /* Specific flags for individual GIMPLE statements. These flags are
87 always stored in gimple_statement_base.subcode and they may only be
88 defined for statement codes that do not use sub-codes.
89
90 Values for the masks can overlap as long as the overlapping values
91 are never used in the same statement class.
92
93 The maximum mask value that can be defined is 1 << 15 (i.e., each
94 statement code can hold up to 16 bitflags).
95
96 Keep this list sorted. */
97 enum gf_mask {
98 GF_ASM_INPUT = 1 << 0,
99 GF_ASM_VOLATILE = 1 << 1,
100 GF_CALL_FROM_THUNK = 1 << 0,
101 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
102 GF_CALL_TAILCALL = 1 << 2,
103 GF_CALL_VA_ARG_PACK = 1 << 3,
104 GF_CALL_NOTHROW = 1 << 4,
105 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
106 GF_CALL_INTERNAL = 1 << 6,
107 GF_OMP_PARALLEL_COMBINED = 1 << 0,
108
109 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
110 a thread synchronization via some sort of barrier. The exact barrier
111 that would otherwise be emitted is dependent on the OMP statement with
112 which this return is associated. */
113 GF_OMP_RETURN_NOWAIT = 1 << 0,
114
115 GF_OMP_SECTION_LAST = 1 << 0,
116 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
117 GF_PREDICT_TAKEN = 1 << 15
118 };
119
120 /* Currently, there are only two types of gimple debug stmt. Others are
121 envisioned, for example, to enable the generation of is_stmt notes
122 in line number information, to mark sequence points, etc. This
123 subcode is to be used to tell them apart. */
124 enum gimple_debug_subcode {
125 GIMPLE_DEBUG_BIND = 0,
126 GIMPLE_DEBUG_SOURCE_BIND = 1
127 };
128
129 /* Masks for selecting a pass local flag (PLF) to work on. These
130 masks are used by gimple_set_plf and gimple_plf. */
131 enum plf_mask {
132 GF_PLF_1 = 1 << 0,
133 GF_PLF_2 = 1 << 1
134 };
135
136 /* A node in a gimple_seq_d. */
137 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
138 gimple stmt;
139 struct gimple_seq_node_d *prev;
140 struct gimple_seq_node_d *next;
141 };
142
143 /* A double-linked sequence of gimple statements. */
144 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
145 /* First and last statements in the sequence. */
146 gimple_seq_node first;
147 gimple_seq_node last;
148
149 /* Sequences are created/destroyed frequently. To minimize
150 allocation activity, deallocated sequences are kept in a pool of
151 available sequences. This is the pointer to the next free
152 sequence in the pool. */
153 gimple_seq next_free;
154 };
155
156
157 /* Return the first node in GIMPLE sequence S. */
158
159 static inline gimple_seq_node
160 gimple_seq_first (const_gimple_seq s)
161 {
162 return s ? s->first : NULL;
163 }
164
165
166 /* Return the first statement in GIMPLE sequence S. */
167
168 static inline gimple
169 gimple_seq_first_stmt (const_gimple_seq s)
170 {
171 gimple_seq_node n = gimple_seq_first (s);
172 return (n) ? n->stmt : NULL;
173 }
174
175
176 /* Return the last node in GIMPLE sequence S. */
177
178 static inline gimple_seq_node
179 gimple_seq_last (const_gimple_seq s)
180 {
181 return s ? s->last : NULL;
182 }
183
184
185 /* Return the last statement in GIMPLE sequence S. */
186
187 static inline gimple
188 gimple_seq_last_stmt (const_gimple_seq s)
189 {
190 gimple_seq_node n = gimple_seq_last (s);
191 return (n) ? n->stmt : NULL;
192 }
193
194
195 /* Set the last node in GIMPLE sequence S to LAST. */
196
197 static inline void
198 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
199 {
200 s->last = last;
201 }
202
203
204 /* Set the first node in GIMPLE sequence S to FIRST. */
205
206 static inline void
207 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
208 {
209 s->first = first;
210 }
211
212
213 /* Return true if GIMPLE sequence S is empty. */
214
215 static inline bool
216 gimple_seq_empty_p (const_gimple_seq s)
217 {
218 return s == NULL || s->first == NULL;
219 }
220
221
222 void gimple_seq_add_stmt (gimple_seq *, gimple);
223
224 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
225 *SEQ_P is NULL, a new sequence is allocated. This function is
226 similar to gimple_seq_add_stmt, but does not scan the operands.
227 During gimplification, we need to manipulate statement sequences
228 before the def/use vectors have been constructed. */
229 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
230
231 /* Allocate a new sequence and initialize its first element with STMT. */
232
233 static inline gimple_seq
234 gimple_seq_alloc_with_stmt (gimple stmt)
235 {
236 gimple_seq seq = NULL;
237 gimple_seq_add_stmt (&seq, stmt);
238 return seq;
239 }
240
241
242 /* Returns the sequence of statements in BB. */
243
244 static inline gimple_seq
245 bb_seq (const_basic_block bb)
246 {
247 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
248 }
249
250
251 /* Sets the sequence of statements in BB to SEQ. */
252
253 static inline void
254 set_bb_seq (basic_block bb, gimple_seq seq)
255 {
256 gcc_checking_assert (!(bb->flags & BB_RTL));
257 bb->il.gimple->seq = seq;
258 }
259
260 /* Iterator object for GIMPLE statement sequences. */
261
262 typedef struct
263 {
264 /* Sequence node holding the current statement. */
265 gimple_seq_node ptr;
266
267 /* Sequence and basic block holding the statement. These fields
268 are necessary to handle edge cases such as when statement is
269 added to an empty basic block or when the last statement of a
270 block/sequence is removed. */
271 gimple_seq seq;
272 basic_block bb;
273 } gimple_stmt_iterator;
274
275
276 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
277 are for 64 bit hosts. */
278
279 struct GTY(()) gimple_statement_base {
280 /* [ WORD 1 ]
281 Main identifying code for a tuple. */
282 ENUM_BITFIELD(gimple_code) code : 8;
283
284 /* Nonzero if a warning should not be emitted on this tuple. */
285 unsigned int no_warning : 1;
286
287 /* Nonzero if this tuple has been visited. Passes are responsible
288 for clearing this bit before using it. */
289 unsigned int visited : 1;
290
291 /* Nonzero if this tuple represents a non-temporal move. */
292 unsigned int nontemporal_move : 1;
293
294 /* Pass local flags. These flags are free for any pass to use as
295 they see fit. Passes should not assume that these flags contain
296 any useful value when the pass starts. Any initial state that
297 the pass requires should be set on entry to the pass. See
298 gimple_set_plf and gimple_plf for usage. */
299 unsigned int plf : 2;
300
301 /* Nonzero if this statement has been modified and needs to have its
302 operands rescanned. */
303 unsigned modified : 1;
304
305 /* Nonzero if this statement contains volatile operands. */
306 unsigned has_volatile_ops : 1;
307
308 /* Nonzero if this statement appears inside a transaction. This bit
309 is calculated on de-mand and has relevant information only after
310 it has been calculated with compute_transaction_bits. */
311 unsigned in_transaction : 1;
312
313 /* The SUBCODE field can be used for tuple-specific flags for tuples
314 that do not require subcodes. Note that SUBCODE should be at
315 least as wide as tree codes, as several tuples store tree codes
316 in there. */
317 unsigned int subcode : 16;
318
319 /* UID of this statement. This is used by passes that want to
320 assign IDs to statements. It must be assigned and used by each
321 pass. By default it should be assumed to contain garbage. */
322 unsigned uid;
323
324 /* [ WORD 2 ]
325 Locus information for debug info. */
326 location_t location;
327
328 /* Number of operands in this tuple. */
329 unsigned num_ops;
330
331 /* [ WORD 3 ]
332 Basic block holding this statement. */
333 struct basic_block_def *bb;
334
335 /* [ WORD 4 ]
336 Lexical block holding this statement. */
337 tree block;
338 };
339
340
341 /* Base structure for tuples with operands. */
342
343 struct GTY(()) gimple_statement_with_ops_base
344 {
345 /* [ WORD 1-4 ] */
346 struct gimple_statement_base gsbase;
347
348 /* [ WORD 5-6 ]
349 SSA operand vectors. NOTE: It should be possible to
350 amalgamate these vectors with the operand vector OP. However,
351 the SSA operand vectors are organized differently and contain
352 more information (like immediate use chaining). */
353 struct def_optype_d GTY((skip (""))) *def_ops;
354 struct use_optype_d GTY((skip (""))) *use_ops;
355 };
356
357
358 /* Statements that take register operands. */
359
360 struct GTY(()) gimple_statement_with_ops
361 {
362 /* [ WORD 1-6 ] */
363 struct gimple_statement_with_ops_base opbase;
364
365 /* [ WORD 7 ]
366 Operand vector. NOTE! This must always be the last field
367 of this structure. In particular, this means that this
368 structure cannot be embedded inside another one. */
369 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
370 };
371
372
373 /* Base for statements that take both memory and register operands. */
374
375 struct GTY(()) gimple_statement_with_memory_ops_base
376 {
377 /* [ WORD 1-6 ] */
378 struct gimple_statement_with_ops_base opbase;
379
380 /* [ WORD 7-8 ]
381 Virtual operands for this statement. The GC will pick them
382 up via the ssa_names array. */
383 tree GTY((skip (""))) vdef;
384 tree GTY((skip (""))) vuse;
385 };
386
387
388 /* Statements that take both memory and register operands. */
389
390 struct GTY(()) gimple_statement_with_memory_ops
391 {
392 /* [ WORD 1-8 ] */
393 struct gimple_statement_with_memory_ops_base membase;
394
395 /* [ WORD 9 ]
396 Operand vector. NOTE! This must always be the last field
397 of this structure. In particular, this means that this
398 structure cannot be embedded inside another one. */
399 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
400 };
401
402
403 /* Call statements that take both memory and register operands. */
404
405 struct GTY(()) gimple_statement_call
406 {
407 /* [ WORD 1-8 ] */
408 struct gimple_statement_with_memory_ops_base membase;
409
410 /* [ WORD 9-12 ] */
411 struct pt_solution call_used;
412 struct pt_solution call_clobbered;
413
414 /* [ WORD 13 ] */
415 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
416 tree GTY ((tag ("0"))) fntype;
417 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
418 } u;
419
420 /* [ WORD 14 ]
421 Operand vector. NOTE! This must always be the last field
422 of this structure. In particular, this means that this
423 structure cannot be embedded inside another one. */
424 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
425 };
426
427
428 /* OpenMP statements (#pragma omp). */
429
430 struct GTY(()) gimple_statement_omp {
431 /* [ WORD 1-4 ] */
432 struct gimple_statement_base gsbase;
433
434 /* [ WORD 5 ] */
435 gimple_seq body;
436 };
437
438
439 /* GIMPLE_BIND */
440
441 struct GTY(()) gimple_statement_bind {
442 /* [ WORD 1-4 ] */
443 struct gimple_statement_base gsbase;
444
445 /* [ WORD 5 ]
446 Variables declared in this scope. */
447 tree vars;
448
449 /* [ WORD 6 ]
450 This is different than the BLOCK field in gimple_statement_base,
451 which is analogous to TREE_BLOCK (i.e., the lexical block holding
452 this statement). This field is the equivalent of BIND_EXPR_BLOCK
453 in tree land (i.e., the lexical scope defined by this bind). See
454 gimple-low.c. */
455 tree block;
456
457 /* [ WORD 7 ] */
458 gimple_seq body;
459 };
460
461
462 /* GIMPLE_CATCH */
463
464 struct GTY(()) gimple_statement_catch {
465 /* [ WORD 1-4 ] */
466 struct gimple_statement_base gsbase;
467
468 /* [ WORD 5 ] */
469 tree types;
470
471 /* [ WORD 6 ] */
472 gimple_seq handler;
473 };
474
475
476 /* GIMPLE_EH_FILTER */
477
478 struct GTY(()) gimple_statement_eh_filter {
479 /* [ WORD 1-4 ] */
480 struct gimple_statement_base gsbase;
481
482 /* [ WORD 5 ]
483 Filter types. */
484 tree types;
485
486 /* [ WORD 6 ]
487 Failure actions. */
488 gimple_seq failure;
489 };
490
491 /* GIMPLE_EH_ELSE */
492
493 struct GTY(()) gimple_statement_eh_else {
494 /* [ WORD 1-4 ] */
495 struct gimple_statement_base gsbase;
496
497 /* [ WORD 5,6 ] */
498 gimple_seq n_body, e_body;
499 };
500
501 /* GIMPLE_EH_MUST_NOT_THROW */
502
503 struct GTY(()) gimple_statement_eh_mnt {
504 /* [ WORD 1-4 ] */
505 struct gimple_statement_base gsbase;
506
507 /* [ WORD 5 ] Abort function decl. */
508 tree fndecl;
509 };
510
511 /* GIMPLE_PHI */
512
513 struct GTY(()) gimple_statement_phi {
514 /* [ WORD 1-4 ] */
515 struct gimple_statement_base gsbase;
516
517 /* [ WORD 5 ] */
518 unsigned capacity;
519 unsigned nargs;
520
521 /* [ WORD 6 ] */
522 tree result;
523
524 /* [ WORD 7 ] */
525 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
526 };
527
528
529 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
530
531 struct GTY(()) gimple_statement_eh_ctrl
532 {
533 /* [ WORD 1-4 ] */
534 struct gimple_statement_base gsbase;
535
536 /* [ WORD 5 ]
537 Exception region number. */
538 int region;
539 };
540
541
542 /* GIMPLE_TRY */
543
544 struct GTY(()) gimple_statement_try {
545 /* [ WORD 1-4 ] */
546 struct gimple_statement_base gsbase;
547
548 /* [ WORD 5 ]
549 Expression to evaluate. */
550 gimple_seq eval;
551
552 /* [ WORD 6 ]
553 Cleanup expression. */
554 gimple_seq cleanup;
555 };
556
557 /* Kind of GIMPLE_TRY statements. */
558 enum gimple_try_flags
559 {
560 /* A try/catch. */
561 GIMPLE_TRY_CATCH = 1 << 0,
562
563 /* A try/finally. */
564 GIMPLE_TRY_FINALLY = 1 << 1,
565 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
566
567 /* Analogous to TRY_CATCH_IS_CLEANUP. */
568 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
569 };
570
571 /* GIMPLE_WITH_CLEANUP_EXPR */
572
573 struct GTY(()) gimple_statement_wce {
574 /* [ WORD 1-4 ] */
575 struct gimple_statement_base gsbase;
576
577 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
578 executed if an exception is thrown, not on normal exit of its
579 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
580 in TARGET_EXPRs. */
581
582 /* [ WORD 5 ]
583 Cleanup expression. */
584 gimple_seq cleanup;
585 };
586
587
588 /* GIMPLE_ASM */
589
590 struct GTY(()) gimple_statement_asm
591 {
592 /* [ WORD 1-8 ] */
593 struct gimple_statement_with_memory_ops_base membase;
594
595 /* [ WORD 9 ]
596 __asm__ statement. */
597 const char *string;
598
599 /* [ WORD 10 ]
600 Number of inputs, outputs, clobbers, labels. */
601 unsigned char ni;
602 unsigned char no;
603 unsigned char nc;
604 unsigned char nl;
605
606 /* [ WORD 11 ]
607 Operand vector. NOTE! This must always be the last field
608 of this structure. In particular, this means that this
609 structure cannot be embedded inside another one. */
610 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
611 };
612
613 /* GIMPLE_OMP_CRITICAL */
614
615 struct GTY(()) gimple_statement_omp_critical {
616 /* [ WORD 1-5 ] */
617 struct gimple_statement_omp omp;
618
619 /* [ WORD 6 ]
620 Critical section name. */
621 tree name;
622 };
623
624
625 struct GTY(()) gimple_omp_for_iter {
626 /* Condition code. */
627 enum tree_code cond;
628
629 /* Index variable. */
630 tree index;
631
632 /* Initial value. */
633 tree initial;
634
635 /* Final value. */
636 tree final;
637
638 /* Increment. */
639 tree incr;
640 };
641
642 /* GIMPLE_OMP_FOR */
643
644 struct GTY(()) gimple_statement_omp_for {
645 /* [ WORD 1-5 ] */
646 struct gimple_statement_omp omp;
647
648 /* [ WORD 6 ] */
649 tree clauses;
650
651 /* [ WORD 7 ]
652 Number of elements in iter array. */
653 size_t collapse;
654
655 /* [ WORD 8 ] */
656 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
657
658 /* [ WORD 9 ]
659 Pre-body evaluated before the loop body begins. */
660 gimple_seq pre_body;
661 };
662
663
664 /* GIMPLE_OMP_PARALLEL */
665
666 struct GTY(()) gimple_statement_omp_parallel {
667 /* [ WORD 1-5 ] */
668 struct gimple_statement_omp omp;
669
670 /* [ WORD 6 ]
671 Clauses. */
672 tree clauses;
673
674 /* [ WORD 7 ]
675 Child function holding the body of the parallel region. */
676 tree child_fn;
677
678 /* [ WORD 8 ]
679 Shared data argument. */
680 tree data_arg;
681 };
682
683
684 /* GIMPLE_OMP_TASK */
685
686 struct GTY(()) gimple_statement_omp_task {
687 /* [ WORD 1-8 ] */
688 struct gimple_statement_omp_parallel par;
689
690 /* [ WORD 9 ]
691 Child function holding firstprivate initialization if needed. */
692 tree copy_fn;
693
694 /* [ WORD 10-11 ]
695 Size and alignment in bytes of the argument data block. */
696 tree arg_size;
697 tree arg_align;
698 };
699
700
701 /* GIMPLE_OMP_SECTION */
702 /* Uses struct gimple_statement_omp. */
703
704
705 /* GIMPLE_OMP_SECTIONS */
706
707 struct GTY(()) gimple_statement_omp_sections {
708 /* [ WORD 1-5 ] */
709 struct gimple_statement_omp omp;
710
711 /* [ WORD 6 ] */
712 tree clauses;
713
714 /* [ WORD 7 ]
715 The control variable used for deciding which of the sections to
716 execute. */
717 tree control;
718 };
719
720 /* GIMPLE_OMP_CONTINUE.
721
722 Note: This does not inherit from gimple_statement_omp, because we
723 do not need the body field. */
724
725 struct GTY(()) gimple_statement_omp_continue {
726 /* [ WORD 1-4 ] */
727 struct gimple_statement_base gsbase;
728
729 /* [ WORD 5 ] */
730 tree control_def;
731
732 /* [ WORD 6 ] */
733 tree control_use;
734 };
735
736 /* GIMPLE_OMP_SINGLE */
737
738 struct GTY(()) gimple_statement_omp_single {
739 /* [ WORD 1-5 ] */
740 struct gimple_statement_omp omp;
741
742 /* [ WORD 6 ] */
743 tree clauses;
744 };
745
746
747 /* GIMPLE_OMP_ATOMIC_LOAD.
748 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
749 contains a sequence, which we don't need here. */
750
751 struct GTY(()) gimple_statement_omp_atomic_load {
752 /* [ WORD 1-4 ] */
753 struct gimple_statement_base gsbase;
754
755 /* [ WORD 5-6 ] */
756 tree rhs, lhs;
757 };
758
759 /* GIMPLE_OMP_ATOMIC_STORE.
760 See note on GIMPLE_OMP_ATOMIC_LOAD. */
761
762 struct GTY(()) gimple_statement_omp_atomic_store {
763 /* [ WORD 1-4 ] */
764 struct gimple_statement_base gsbase;
765
766 /* [ WORD 5 ] */
767 tree val;
768 };
769
770 /* GIMPLE_TRANSACTION. */
771
772 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
773
774 /* The __transaction_atomic was declared [[outer]] or it is
775 __transaction_relaxed. */
776 #define GTMA_IS_OUTER (1u << 0)
777 #define GTMA_IS_RELAXED (1u << 1)
778 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
779
780 /* The transaction is seen to not have an abort. */
781 #define GTMA_HAVE_ABORT (1u << 2)
782 /* The transaction is seen to have loads or stores. */
783 #define GTMA_HAVE_LOAD (1u << 3)
784 #define GTMA_HAVE_STORE (1u << 4)
785 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
786 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
787 /* The transaction WILL enter serial irrevocable mode.
788 An irrevocable block post-dominates the entire transaction, such
789 that all invocations of the transaction will go serial-irrevocable.
790 In such case, we don't bother instrumenting the transaction, and
791 tell the runtime that it should begin the transaction in
792 serial-irrevocable mode. */
793 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
794
795 struct GTY(()) gimple_statement_transaction
796 {
797 /* [ WORD 1-10 ] */
798 struct gimple_statement_with_memory_ops_base gsbase;
799
800 /* [ WORD 11 ] */
801 gimple_seq body;
802
803 /* [ WORD 12 ] */
804 tree label;
805 };
806
807 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
808 enum gimple_statement_structure_enum {
809 #include "gsstruct.def"
810 LAST_GSS_ENUM
811 };
812 #undef DEFGSSTRUCT
813
814
815 /* Define the overall contents of a gimple tuple. It may be any of the
816 structures declared above for various types of tuples. */
817
818 union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
819 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
820 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
821 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
822 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
823 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
824 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
825 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
826 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
827 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
828 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
829 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
830 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
831 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
832 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
833 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
834 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
835 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
836 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
837 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
838 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
839 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
840 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
841 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
842 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
843 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
844 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
845 };
846
847 /* In gimple.c. */
848
849 /* Offset in bytes to the location of the operand vector.
850 Zero if there is no operand vector for this tuple structure. */
851 extern size_t const gimple_ops_offset_[];
852
853 /* Map GIMPLE codes to GSS codes. */
854 extern enum gimple_statement_structure_enum const gss_for_code_[];
855
856 /* This variable holds the currently expanded gimple statement for purposes
857 of comminucating the profile info to the builtin expanders. */
858 extern gimple currently_expanding_gimple_stmt;
859
860 gimple gimple_build_return (tree);
861
862 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
863 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
864
865 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
866
867 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
868 tree, tree MEM_STAT_DECL);
869 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
870 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
871 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
872 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
873
874 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
875 #define gimple_build_debug_bind(var,val,stmt) \
876 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
877 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
878 #define gimple_build_debug_source_bind(var,val,stmt) \
879 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
880
881 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
882 gimple gimple_build_call (tree, unsigned, ...);
883 gimple gimple_build_call_valist (tree, unsigned, va_list);
884 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
885 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
886 gimple gimple_build_call_from_tree (tree);
887 gimple gimplify_assign (tree, tree, gimple_seq *);
888 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
889 gimple gimple_build_label (tree label);
890 gimple gimple_build_goto (tree dest);
891 gimple gimple_build_nop (void);
892 gimple gimple_build_bind (tree, gimple_seq, tree);
893 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
894 VEC(tree,gc) *, VEC(tree,gc) *);
895 gimple gimple_build_catch (tree, gimple_seq);
896 gimple gimple_build_eh_filter (tree, gimple_seq);
897 gimple gimple_build_eh_must_not_throw (tree);
898 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
899 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
900 gimple gimple_build_wce (gimple_seq);
901 gimple gimple_build_resx (int);
902 gimple gimple_build_eh_dispatch (int);
903 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
904 gimple gimple_build_switch (unsigned, tree, tree, ...);
905 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
906 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
907 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
908 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
909 gimple gimple_build_omp_critical (gimple_seq, tree);
910 gimple gimple_build_omp_section (gimple_seq);
911 gimple gimple_build_omp_continue (tree, tree);
912 gimple gimple_build_omp_master (gimple_seq);
913 gimple gimple_build_omp_return (bool);
914 gimple gimple_build_omp_ordered (gimple_seq);
915 gimple gimple_build_omp_sections (gimple_seq, tree);
916 gimple gimple_build_omp_sections_switch (void);
917 gimple gimple_build_omp_single (gimple_seq, tree);
918 gimple gimple_build_cdt (tree, tree);
919 gimple gimple_build_omp_atomic_load (tree, tree);
920 gimple gimple_build_omp_atomic_store (tree);
921 gimple gimple_build_transaction (gimple_seq, tree);
922 gimple gimple_build_predict (enum br_predictor, enum prediction);
923 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
924 void sort_case_labels (VEC(tree,heap) *);
925 void gimple_set_body (tree, gimple_seq);
926 gimple_seq gimple_body (tree);
927 bool gimple_has_body_p (tree);
928 gimple_seq gimple_seq_alloc (void);
929 void gimple_seq_free (gimple_seq);
930 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
931 gimple_seq gimple_seq_copy (gimple_seq);
932 bool gimple_call_same_target_p (const_gimple, const_gimple);
933 int gimple_call_flags (const_gimple);
934 int gimple_call_return_flags (const_gimple);
935 int gimple_call_arg_flags (const_gimple, unsigned);
936 void gimple_call_reset_alias_info (gimple);
937 bool gimple_assign_copy_p (gimple);
938 bool gimple_assign_ssa_name_copy_p (gimple);
939 bool gimple_assign_unary_nop_p (gimple);
940 void gimple_set_bb (gimple, struct basic_block_def *);
941 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
942 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
943 tree, tree, tree);
944 tree gimple_get_lhs (const_gimple);
945 void gimple_set_lhs (gimple, tree);
946 void gimple_replace_lhs (gimple, tree);
947 gimple gimple_copy (gimple);
948 void gimple_set_modified (gimple, bool);
949 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
950 gimple gimple_build_cond_from_tree (tree, tree, tree);
951 void gimple_cond_set_condition_from_tree (gimple, tree);
952 bool gimple_has_side_effects (const_gimple);
953 bool gimple_could_trap_p (gimple);
954 bool gimple_could_trap_p_1 (gimple, bool, bool);
955 bool gimple_assign_rhs_could_trap_p (gimple);
956 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
957 bool empty_body_p (gimple_seq);
958 unsigned get_gimple_rhs_num_ops (enum tree_code);
959 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
960 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
961 const char *gimple_decl_printable_name (tree, int);
962 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
963 tree gimple_extract_devirt_binfo_from_cst (tree);
964
965 /* Returns true iff T is a scalar register variable. */
966 extern bool is_gimple_reg (tree);
967 /* Returns true iff T is any sort of variable. */
968 extern bool is_gimple_variable (tree);
969 /* Returns true iff T is any sort of symbol. */
970 extern bool is_gimple_id (tree);
971 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
972 extern bool is_gimple_min_lval (tree);
973 /* Returns true iff T is something whose address can be taken. */
974 extern bool is_gimple_addressable (tree);
975 /* Returns true iff T is any valid GIMPLE lvalue. */
976 extern bool is_gimple_lvalue (tree);
977
978 /* Returns true iff T is a GIMPLE address. */
979 bool is_gimple_address (const_tree);
980 /* Returns true iff T is a GIMPLE invariant address. */
981 bool is_gimple_invariant_address (const_tree);
982 /* Returns true iff T is a GIMPLE invariant address at interprocedural
983 level. */
984 bool is_gimple_ip_invariant_address (const_tree);
985 /* Returns true iff T is a valid GIMPLE constant. */
986 bool is_gimple_constant (const_tree);
987 /* Returns true iff T is a GIMPLE restricted function invariant. */
988 extern bool is_gimple_min_invariant (const_tree);
989 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
990 extern bool is_gimple_ip_invariant (const_tree);
991 /* Returns true iff T is a GIMPLE rvalue. */
992 extern bool is_gimple_val (tree);
993 /* Returns true iff T is a GIMPLE asm statement input. */
994 extern bool is_gimple_asm_val (tree);
995 /* Returns true iff T is a valid address operand of a MEM_REF. */
996 bool is_gimple_mem_ref_addr (tree);
997
998 /* Returns true iff T is a valid if-statement condition. */
999 extern bool is_gimple_condexpr (tree);
1000
1001 /* Returns true iff T is a valid call address expression. */
1002 extern bool is_gimple_call_addr (tree);
1003
1004 extern void recalculate_side_effects (tree);
1005 extern bool gimple_compare_field_offset (tree, tree);
1006 extern tree gimple_register_type (tree);
1007 extern tree gimple_register_canonical_type (tree);
1008 extern void print_gimple_types_stats (void);
1009 extern void free_gimple_type_tables (void);
1010 extern tree gimple_unsigned_type (tree);
1011 extern tree gimple_signed_type (tree);
1012 extern alias_set_type gimple_get_alias_set (tree);
1013 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
1014 unsigned *);
1015 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
1016 bool (*)(gimple, tree, void *),
1017 bool (*)(gimple, tree, void *),
1018 bool (*)(gimple, tree, void *));
1019 extern bool walk_stmt_load_store_ops (gimple, void *,
1020 bool (*)(gimple, tree, void *),
1021 bool (*)(gimple, tree, void *));
1022 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1023 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1024 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1025
1026 /* In gimplify.c */
1027 extern tree create_tmp_var_raw (tree, const char *);
1028 extern tree create_tmp_var_name (const char *);
1029 extern tree create_tmp_var (tree, const char *);
1030 extern tree create_tmp_reg (tree, const char *);
1031 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
1032 extern tree get_formal_tmp_var (tree, gimple_seq *);
1033 extern void declare_vars (tree, gimple, bool);
1034 extern void annotate_all_with_location (gimple_seq, location_t);
1035
1036 /* Validation of GIMPLE expressions. Note that these predicates only check
1037 the basic form of the expression, they don't recurse to make sure that
1038 underlying nodes are also of the right form. */
1039 typedef bool (*gimple_predicate)(tree);
1040
1041
1042 /* FIXME we should deduce this from the predicate. */
1043 enum fallback {
1044 fb_none = 0, /* Do not generate a temporary. */
1045
1046 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1047 gimplified expression. */
1048
1049 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1050 gimplified expression. */
1051
1052 fb_mayfail = 4, /* Gimplification may fail. Error issued
1053 afterwards. */
1054 fb_either= fb_rvalue | fb_lvalue
1055 };
1056
1057 typedef int fallback_t;
1058
1059 enum gimplify_status {
1060 GS_ERROR = -2, /* Something Bad Seen. */
1061 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1062 GS_OK = 0, /* We did something, maybe more to do. */
1063 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1064 };
1065
1066 struct gimplify_ctx
1067 {
1068 struct gimplify_ctx *prev_context;
1069
1070 VEC(gimple,heap) *bind_expr_stack;
1071 tree temps;
1072 gimple_seq conditional_cleanups;
1073 tree exit_label;
1074 tree return_temp;
1075
1076 VEC(tree,heap) *case_labels;
1077 /* The formal temporary table. Should this be persistent? */
1078 htab_t temp_htab;
1079
1080 int conditions;
1081 bool save_stack;
1082 bool into_ssa;
1083 bool allow_rhs_cond_expr;
1084 bool in_cleanup_point_expr;
1085 };
1086
1087 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1088 bool (*) (tree), fallback_t);
1089 extern void gimplify_type_sizes (tree, gimple_seq *);
1090 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1091 extern bool gimplify_stmt (tree *, gimple_seq *);
1092 extern gimple gimplify_body (tree, bool);
1093 extern void push_gimplify_context (struct gimplify_ctx *);
1094 extern void pop_gimplify_context (gimple);
1095 extern void gimplify_and_add (tree, gimple_seq *);
1096
1097 /* Miscellaneous helpers. */
1098 extern void gimple_add_tmp_var (tree);
1099 extern gimple gimple_current_bind_expr (void);
1100 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1101 extern tree voidify_wrapper_expr (tree, tree);
1102 extern tree build_and_jump (tree *);
1103 extern tree force_labels_r (tree *, int *, void *);
1104 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1105 gimple_seq *);
1106 struct gimplify_omp_ctx;
1107 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1108 extern tree gimple_boolify (tree);
1109 extern gimple_predicate rhs_predicate_for (tree);
1110 extern tree canonicalize_cond_expr_cond (tree);
1111
1112 /* In omp-low.c. */
1113 extern tree omp_reduction_init (tree, tree);
1114
1115 /* In trans-mem.c. */
1116 extern void diagnose_tm_safe_errors (tree);
1117 extern void compute_transaction_bits (void);
1118
1119 /* In tree-nested.c. */
1120 extern void lower_nested_functions (tree);
1121 extern void insert_field_into_struct (tree, tree);
1122
1123 /* In gimplify.c. */
1124 extern void gimplify_function_tree (tree);
1125
1126 /* In cfgexpand.c. */
1127 extern tree gimple_assign_rhs_to_tree (gimple);
1128
1129 /* In builtins.c */
1130 extern bool validate_gimple_arglist (const_gimple, ...);
1131
1132 /* In tree-ssa.c */
1133 extern bool tree_ssa_useless_type_conversion (tree);
1134 extern tree tree_ssa_strip_useless_type_conversions (tree);
1135 extern bool useless_type_conversion_p (tree, tree);
1136 extern bool types_compatible_p (tree, tree);
1137
1138 /* Return the code for GIMPLE statement G. */
1139
1140 static inline enum gimple_code
1141 gimple_code (const_gimple g)
1142 {
1143 return g->gsbase.code;
1144 }
1145
1146
1147 /* Return the GSS code used by a GIMPLE code. */
1148
1149 static inline enum gimple_statement_structure_enum
1150 gss_for_code (enum gimple_code code)
1151 {
1152 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1153 return gss_for_code_[code];
1154 }
1155
1156
1157 /* Return which GSS code is used by GS. */
1158
1159 static inline enum gimple_statement_structure_enum
1160 gimple_statement_structure (gimple gs)
1161 {
1162 return gss_for_code (gimple_code (gs));
1163 }
1164
1165
1166 /* Return true if statement G has sub-statements. This is only true for
1167 High GIMPLE statements. */
1168
1169 static inline bool
1170 gimple_has_substatements (gimple g)
1171 {
1172 switch (gimple_code (g))
1173 {
1174 case GIMPLE_BIND:
1175 case GIMPLE_CATCH:
1176 case GIMPLE_EH_FILTER:
1177 case GIMPLE_EH_ELSE:
1178 case GIMPLE_TRY:
1179 case GIMPLE_OMP_FOR:
1180 case GIMPLE_OMP_MASTER:
1181 case GIMPLE_OMP_ORDERED:
1182 case GIMPLE_OMP_SECTION:
1183 case GIMPLE_OMP_PARALLEL:
1184 case GIMPLE_OMP_TASK:
1185 case GIMPLE_OMP_SECTIONS:
1186 case GIMPLE_OMP_SINGLE:
1187 case GIMPLE_OMP_CRITICAL:
1188 case GIMPLE_WITH_CLEANUP_EXPR:
1189 case GIMPLE_TRANSACTION:
1190 return true;
1191
1192 default:
1193 return false;
1194 }
1195 }
1196
1197
1198 /* Return the basic block holding statement G. */
1199
1200 static inline struct basic_block_def *
1201 gimple_bb (const_gimple g)
1202 {
1203 return g->gsbase.bb;
1204 }
1205
1206
1207 /* Return the lexical scope block holding statement G. */
1208
1209 static inline tree
1210 gimple_block (const_gimple g)
1211 {
1212 return g->gsbase.block;
1213 }
1214
1215
1216 /* Set BLOCK to be the lexical scope block holding statement G. */
1217
1218 static inline void
1219 gimple_set_block (gimple g, tree block)
1220 {
1221 g->gsbase.block = block;
1222 }
1223
1224
1225 /* Return location information for statement G. */
1226
1227 static inline location_t
1228 gimple_location (const_gimple g)
1229 {
1230 return g->gsbase.location;
1231 }
1232
1233 /* Return pointer to location information for statement G. */
1234
1235 static inline const location_t *
1236 gimple_location_ptr (const_gimple g)
1237 {
1238 return &g->gsbase.location;
1239 }
1240
1241
1242 /* Set location information for statement G. */
1243
1244 static inline void
1245 gimple_set_location (gimple g, location_t location)
1246 {
1247 g->gsbase.location = location;
1248 }
1249
1250
1251 /* Return true if G contains location information. */
1252
1253 static inline bool
1254 gimple_has_location (const_gimple g)
1255 {
1256 return gimple_location (g) != UNKNOWN_LOCATION;
1257 }
1258
1259
1260 /* Return the file name of the location of STMT. */
1261
1262 static inline const char *
1263 gimple_filename (const_gimple stmt)
1264 {
1265 return LOCATION_FILE (gimple_location (stmt));
1266 }
1267
1268
1269 /* Return the line number of the location of STMT. */
1270
1271 static inline int
1272 gimple_lineno (const_gimple stmt)
1273 {
1274 return LOCATION_LINE (gimple_location (stmt));
1275 }
1276
1277
1278 /* Determine whether SEQ is a singleton. */
1279
1280 static inline bool
1281 gimple_seq_singleton_p (gimple_seq seq)
1282 {
1283 return ((gimple_seq_first (seq) != NULL)
1284 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1285 }
1286
1287 /* Return true if no warnings should be emitted for statement STMT. */
1288
1289 static inline bool
1290 gimple_no_warning_p (const_gimple stmt)
1291 {
1292 return stmt->gsbase.no_warning;
1293 }
1294
1295 /* Set the no_warning flag of STMT to NO_WARNING. */
1296
1297 static inline void
1298 gimple_set_no_warning (gimple stmt, bool no_warning)
1299 {
1300 stmt->gsbase.no_warning = (unsigned) no_warning;
1301 }
1302
1303 /* Set the visited status on statement STMT to VISITED_P. */
1304
1305 static inline void
1306 gimple_set_visited (gimple stmt, bool visited_p)
1307 {
1308 stmt->gsbase.visited = (unsigned) visited_p;
1309 }
1310
1311
1312 /* Return the visited status for statement STMT. */
1313
1314 static inline bool
1315 gimple_visited_p (gimple stmt)
1316 {
1317 return stmt->gsbase.visited;
1318 }
1319
1320
1321 /* Set pass local flag PLF on statement STMT to VAL_P. */
1322
1323 static inline void
1324 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1325 {
1326 if (val_p)
1327 stmt->gsbase.plf |= (unsigned int) plf;
1328 else
1329 stmt->gsbase.plf &= ~((unsigned int) plf);
1330 }
1331
1332
1333 /* Return the value of pass local flag PLF on statement STMT. */
1334
1335 static inline unsigned int
1336 gimple_plf (gimple stmt, enum plf_mask plf)
1337 {
1338 return stmt->gsbase.plf & ((unsigned int) plf);
1339 }
1340
1341
1342 /* Set the UID of statement. */
1343
1344 static inline void
1345 gimple_set_uid (gimple g, unsigned uid)
1346 {
1347 g->gsbase.uid = uid;
1348 }
1349
1350
1351 /* Return the UID of statement. */
1352
1353 static inline unsigned
1354 gimple_uid (const_gimple g)
1355 {
1356 return g->gsbase.uid;
1357 }
1358
1359
1360 /* Return true if GIMPLE statement G has register or memory operands. */
1361
1362 static inline bool
1363 gimple_has_ops (const_gimple g)
1364 {
1365 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1366 }
1367
1368
1369 /* Return true if GIMPLE statement G has memory operands. */
1370
1371 static inline bool
1372 gimple_has_mem_ops (const_gimple g)
1373 {
1374 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1375 }
1376
1377
1378 /* Return the set of DEF operands for statement G. */
1379
1380 static inline struct def_optype_d *
1381 gimple_def_ops (const_gimple g)
1382 {
1383 if (!gimple_has_ops (g))
1384 return NULL;
1385 return g->gsops.opbase.def_ops;
1386 }
1387
1388
1389 /* Set DEF to be the set of DEF operands for statement G. */
1390
1391 static inline void
1392 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1393 {
1394 gcc_gimple_checking_assert (gimple_has_ops (g));
1395 g->gsops.opbase.def_ops = def;
1396 }
1397
1398
1399 /* Return the set of USE operands for statement G. */
1400
1401 static inline struct use_optype_d *
1402 gimple_use_ops (const_gimple g)
1403 {
1404 if (!gimple_has_ops (g))
1405 return NULL;
1406 return g->gsops.opbase.use_ops;
1407 }
1408
1409
1410 /* Set USE to be the set of USE operands for statement G. */
1411
1412 static inline void
1413 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1414 {
1415 gcc_gimple_checking_assert (gimple_has_ops (g));
1416 g->gsops.opbase.use_ops = use;
1417 }
1418
1419
1420 /* Return the set of VUSE operand for statement G. */
1421
1422 static inline use_operand_p
1423 gimple_vuse_op (const_gimple g)
1424 {
1425 struct use_optype_d *ops;
1426 if (!gimple_has_mem_ops (g))
1427 return NULL_USE_OPERAND_P;
1428 ops = g->gsops.opbase.use_ops;
1429 if (ops
1430 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1431 return USE_OP_PTR (ops);
1432 return NULL_USE_OPERAND_P;
1433 }
1434
1435 /* Return the set of VDEF operand for statement G. */
1436
1437 static inline def_operand_p
1438 gimple_vdef_op (const_gimple g)
1439 {
1440 struct def_optype_d *ops;
1441 if (!gimple_has_mem_ops (g))
1442 return NULL_DEF_OPERAND_P;
1443 ops = g->gsops.opbase.def_ops;
1444 if (ops
1445 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1446 return DEF_OP_PTR (ops);
1447 return NULL_DEF_OPERAND_P;
1448 }
1449
1450
1451 /* Return the single VUSE operand of the statement G. */
1452
1453 static inline tree
1454 gimple_vuse (const_gimple g)
1455 {
1456 if (!gimple_has_mem_ops (g))
1457 return NULL_TREE;
1458 return g->gsmembase.vuse;
1459 }
1460
1461 /* Return the single VDEF operand of the statement G. */
1462
1463 static inline tree
1464 gimple_vdef (const_gimple g)
1465 {
1466 if (!gimple_has_mem_ops (g))
1467 return NULL_TREE;
1468 return g->gsmembase.vdef;
1469 }
1470
1471 /* Return the single VUSE operand of the statement G. */
1472
1473 static inline tree *
1474 gimple_vuse_ptr (gimple g)
1475 {
1476 if (!gimple_has_mem_ops (g))
1477 return NULL;
1478 return &g->gsmembase.vuse;
1479 }
1480
1481 /* Return the single VDEF operand of the statement G. */
1482
1483 static inline tree *
1484 gimple_vdef_ptr (gimple g)
1485 {
1486 if (!gimple_has_mem_ops (g))
1487 return NULL;
1488 return &g->gsmembase.vdef;
1489 }
1490
1491 /* Set the single VUSE operand of the statement G. */
1492
1493 static inline void
1494 gimple_set_vuse (gimple g, tree vuse)
1495 {
1496 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1497 g->gsmembase.vuse = vuse;
1498 }
1499
1500 /* Set the single VDEF operand of the statement G. */
1501
1502 static inline void
1503 gimple_set_vdef (gimple g, tree vdef)
1504 {
1505 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1506 g->gsmembase.vdef = vdef;
1507 }
1508
1509
1510 /* Return true if statement G has operands and the modified field has
1511 been set. */
1512
1513 static inline bool
1514 gimple_modified_p (const_gimple g)
1515 {
1516 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1517 }
1518
1519
1520 /* Return the tree code for the expression computed by STMT. This is
1521 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1522 GIMPLE_CALL, return CALL_EXPR as the expression code for
1523 consistency. This is useful when the caller needs to deal with the
1524 three kinds of computation that GIMPLE supports. */
1525
1526 static inline enum tree_code
1527 gimple_expr_code (const_gimple stmt)
1528 {
1529 enum gimple_code code = gimple_code (stmt);
1530 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1531 return (enum tree_code) stmt->gsbase.subcode;
1532 else
1533 {
1534 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1535 return CALL_EXPR;
1536 }
1537 }
1538
1539
1540 /* Mark statement S as modified, and update it. */
1541
1542 static inline void
1543 update_stmt (gimple s)
1544 {
1545 if (gimple_has_ops (s))
1546 {
1547 gimple_set_modified (s, true);
1548 update_stmt_operands (s);
1549 }
1550 }
1551
1552 /* Update statement S if it has been optimized. */
1553
1554 static inline void
1555 update_stmt_if_modified (gimple s)
1556 {
1557 if (gimple_modified_p (s))
1558 update_stmt_operands (s);
1559 }
1560
1561 /* Return true if statement STMT contains volatile operands. */
1562
1563 static inline bool
1564 gimple_has_volatile_ops (const_gimple stmt)
1565 {
1566 if (gimple_has_mem_ops (stmt))
1567 return stmt->gsbase.has_volatile_ops;
1568 else
1569 return false;
1570 }
1571
1572
1573 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1574
1575 static inline void
1576 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1577 {
1578 if (gimple_has_mem_ops (stmt))
1579 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1580 }
1581
1582 /* Return true if STMT is in a transaction. */
1583
1584 static inline bool
1585 gimple_in_transaction (gimple stmt)
1586 {
1587 return stmt->gsbase.in_transaction;
1588 }
1589
1590 /* Set the IN_TRANSACTION flag to TRANSACTIONP. */
1591
1592 static inline void
1593 gimple_set_in_transaction (gimple stmt, bool transactionp)
1594 {
1595 stmt->gsbase.in_transaction = (unsigned) transactionp;
1596 }
1597
1598 /* Return true if statement STMT may access memory. */
1599
1600 static inline bool
1601 gimple_references_memory_p (gimple stmt)
1602 {
1603 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1604 }
1605
1606
1607 /* Return the subcode for OMP statement S. */
1608
1609 static inline unsigned
1610 gimple_omp_subcode (const_gimple s)
1611 {
1612 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1613 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1614 return s->gsbase.subcode;
1615 }
1616
1617 /* Set the subcode for OMP statement S to SUBCODE. */
1618
1619 static inline void
1620 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1621 {
1622 /* We only have 16 bits for the subcode. Assert that we are not
1623 overflowing it. */
1624 gcc_gimple_checking_assert (subcode < (1 << 16));
1625 s->gsbase.subcode = subcode;
1626 }
1627
1628 /* Set the nowait flag on OMP_RETURN statement S. */
1629
1630 static inline void
1631 gimple_omp_return_set_nowait (gimple s)
1632 {
1633 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1634 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1635 }
1636
1637
1638 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1639 flag set. */
1640
1641 static inline bool
1642 gimple_omp_return_nowait_p (const_gimple g)
1643 {
1644 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1645 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1646 }
1647
1648
1649 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1650 flag set. */
1651
1652 static inline bool
1653 gimple_omp_section_last_p (const_gimple g)
1654 {
1655 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1656 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1657 }
1658
1659
1660 /* Set the GF_OMP_SECTION_LAST flag on G. */
1661
1662 static inline void
1663 gimple_omp_section_set_last (gimple g)
1664 {
1665 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1666 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1667 }
1668
1669
1670 /* Return true if OMP parallel statement G has the
1671 GF_OMP_PARALLEL_COMBINED flag set. */
1672
1673 static inline bool
1674 gimple_omp_parallel_combined_p (const_gimple g)
1675 {
1676 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1677 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1678 }
1679
1680
1681 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1682 value of COMBINED_P. */
1683
1684 static inline void
1685 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1686 {
1687 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1688 if (combined_p)
1689 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1690 else
1691 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1692 }
1693
1694
1695 /* Return true if OMP atomic load/store statement G has the
1696 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1697
1698 static inline bool
1699 gimple_omp_atomic_need_value_p (const_gimple g)
1700 {
1701 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1702 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1703 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1704 }
1705
1706
1707 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1708
1709 static inline void
1710 gimple_omp_atomic_set_need_value (gimple g)
1711 {
1712 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1713 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1714 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1715 }
1716
1717
1718 /* Return the number of operands for statement GS. */
1719
1720 static inline unsigned
1721 gimple_num_ops (const_gimple gs)
1722 {
1723 return gs->gsbase.num_ops;
1724 }
1725
1726
1727 /* Set the number of operands for statement GS. */
1728
1729 static inline void
1730 gimple_set_num_ops (gimple gs, unsigned num_ops)
1731 {
1732 gs->gsbase.num_ops = num_ops;
1733 }
1734
1735
1736 /* Return the array of operands for statement GS. */
1737
1738 static inline tree *
1739 gimple_ops (gimple gs)
1740 {
1741 size_t off;
1742
1743 /* All the tuples have their operand vector at the very bottom
1744 of the structure. Note that those structures that do not
1745 have an operand vector have a zero offset. */
1746 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1747 gcc_gimple_checking_assert (off != 0);
1748
1749 return (tree *) ((char *) gs + off);
1750 }
1751
1752
1753 /* Return operand I for statement GS. */
1754
1755 static inline tree
1756 gimple_op (const_gimple gs, unsigned i)
1757 {
1758 if (gimple_has_ops (gs))
1759 {
1760 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1761 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1762 }
1763 else
1764 return NULL_TREE;
1765 }
1766
1767 /* Return a pointer to operand I for statement GS. */
1768
1769 static inline tree *
1770 gimple_op_ptr (const_gimple gs, unsigned i)
1771 {
1772 if (gimple_has_ops (gs))
1773 {
1774 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1775 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1776 }
1777 else
1778 return NULL;
1779 }
1780
1781 /* Set operand I of statement GS to OP. */
1782
1783 static inline void
1784 gimple_set_op (gimple gs, unsigned i, tree op)
1785 {
1786 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1787
1788 /* Note. It may be tempting to assert that OP matches
1789 is_gimple_operand, but that would be wrong. Different tuples
1790 accept slightly different sets of tree operands. Each caller
1791 should perform its own validation. */
1792 gimple_ops (gs)[i] = op;
1793 }
1794
1795 /* Return true if GS is a GIMPLE_ASSIGN. */
1796
1797 static inline bool
1798 is_gimple_assign (const_gimple gs)
1799 {
1800 return gimple_code (gs) == GIMPLE_ASSIGN;
1801 }
1802
1803 /* Determine if expression CODE is one of the valid expressions that can
1804 be used on the RHS of GIMPLE assignments. */
1805
1806 static inline enum gimple_rhs_class
1807 get_gimple_rhs_class (enum tree_code code)
1808 {
1809 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1810 }
1811
1812 /* Return the LHS of assignment statement GS. */
1813
1814 static inline tree
1815 gimple_assign_lhs (const_gimple gs)
1816 {
1817 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1818 return gimple_op (gs, 0);
1819 }
1820
1821
1822 /* Return a pointer to the LHS of assignment statement GS. */
1823
1824 static inline tree *
1825 gimple_assign_lhs_ptr (const_gimple gs)
1826 {
1827 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1828 return gimple_op_ptr (gs, 0);
1829 }
1830
1831
1832 /* Set LHS to be the LHS operand of assignment statement GS. */
1833
1834 static inline void
1835 gimple_assign_set_lhs (gimple gs, tree lhs)
1836 {
1837 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1838 gimple_set_op (gs, 0, lhs);
1839
1840 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1841 SSA_NAME_DEF_STMT (lhs) = gs;
1842 }
1843
1844
1845 /* Return the first operand on the RHS of assignment statement GS. */
1846
1847 static inline tree
1848 gimple_assign_rhs1 (const_gimple gs)
1849 {
1850 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1851 return gimple_op (gs, 1);
1852 }
1853
1854
1855 /* Return a pointer to the first operand on the RHS of assignment
1856 statement GS. */
1857
1858 static inline tree *
1859 gimple_assign_rhs1_ptr (const_gimple gs)
1860 {
1861 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1862 return gimple_op_ptr (gs, 1);
1863 }
1864
1865 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1866
1867 static inline void
1868 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1869 {
1870 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1871
1872 gimple_set_op (gs, 1, rhs);
1873 }
1874
1875
1876 /* Return the second operand on the RHS of assignment statement GS.
1877 If GS does not have two operands, NULL is returned instead. */
1878
1879 static inline tree
1880 gimple_assign_rhs2 (const_gimple gs)
1881 {
1882 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1883
1884 if (gimple_num_ops (gs) >= 3)
1885 return gimple_op (gs, 2);
1886 else
1887 return NULL_TREE;
1888 }
1889
1890
1891 /* Return a pointer to the second operand on the RHS of assignment
1892 statement GS. */
1893
1894 static inline tree *
1895 gimple_assign_rhs2_ptr (const_gimple gs)
1896 {
1897 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1898 return gimple_op_ptr (gs, 2);
1899 }
1900
1901
1902 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1903
1904 static inline void
1905 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1906 {
1907 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1908
1909 gimple_set_op (gs, 2, rhs);
1910 }
1911
1912 /* Return the third operand on the RHS of assignment statement GS.
1913 If GS does not have two operands, NULL is returned instead. */
1914
1915 static inline tree
1916 gimple_assign_rhs3 (const_gimple gs)
1917 {
1918 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1919
1920 if (gimple_num_ops (gs) >= 4)
1921 return gimple_op (gs, 3);
1922 else
1923 return NULL_TREE;
1924 }
1925
1926 /* Return a pointer to the third operand on the RHS of assignment
1927 statement GS. */
1928
1929 static inline tree *
1930 gimple_assign_rhs3_ptr (const_gimple gs)
1931 {
1932 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1933 return gimple_op_ptr (gs, 3);
1934 }
1935
1936
1937 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1938
1939 static inline void
1940 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1941 {
1942 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1943
1944 gimple_set_op (gs, 3, rhs);
1945 }
1946
1947 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1948 to see only a maximum of two operands. */
1949
1950 static inline void
1951 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1952 tree op1, tree op2)
1953 {
1954 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1955 }
1956
1957 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1958 to see only a maximum of two operands. */
1959
1960 static inline void
1961 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1962 tree *op1)
1963 {
1964 tree op2;
1965 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1966 gcc_assert (op2 == NULL_TREE);
1967 }
1968
1969 /* Returns true if GS is a nontemporal move. */
1970
1971 static inline bool
1972 gimple_assign_nontemporal_move_p (const_gimple gs)
1973 {
1974 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1975 return gs->gsbase.nontemporal_move;
1976 }
1977
1978 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1979
1980 static inline void
1981 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1982 {
1983 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1984 gs->gsbase.nontemporal_move = nontemporal;
1985 }
1986
1987
1988 /* Return the code of the expression computed on the rhs of assignment
1989 statement GS. In case that the RHS is a single object, returns the
1990 tree code of the object. */
1991
1992 static inline enum tree_code
1993 gimple_assign_rhs_code (const_gimple gs)
1994 {
1995 enum tree_code code;
1996 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1997
1998 code = (enum tree_code) gs->gsbase.subcode;
1999 /* While we initially set subcode to the TREE_CODE of the rhs for
2000 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2001 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2002 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2003 code = TREE_CODE (gimple_assign_rhs1 (gs));
2004
2005 return code;
2006 }
2007
2008
2009 /* Set CODE to be the code for the expression computed on the RHS of
2010 assignment S. */
2011
2012 static inline void
2013 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2014 {
2015 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2016 s->gsbase.subcode = code;
2017 }
2018
2019
2020 /* Return the gimple rhs class of the code of the expression computed on
2021 the rhs of assignment statement GS.
2022 This will never return GIMPLE_INVALID_RHS. */
2023
2024 static inline enum gimple_rhs_class
2025 gimple_assign_rhs_class (const_gimple gs)
2026 {
2027 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2028 }
2029
2030 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2031 there is no operator associated with the assignment itself.
2032 Unlike gimple_assign_copy_p, this predicate returns true for
2033 any RHS operand, including those that perform an operation
2034 and do not have the semantics of a copy, such as COND_EXPR. */
2035
2036 static inline bool
2037 gimple_assign_single_p (gimple gs)
2038 {
2039 return (is_gimple_assign (gs)
2040 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2041 }
2042
2043
2044 /* Return true if S is a type-cast assignment. */
2045
2046 static inline bool
2047 gimple_assign_cast_p (gimple s)
2048 {
2049 if (is_gimple_assign (s))
2050 {
2051 enum tree_code sc = gimple_assign_rhs_code (s);
2052 return CONVERT_EXPR_CODE_P (sc)
2053 || sc == VIEW_CONVERT_EXPR
2054 || sc == FIX_TRUNC_EXPR;
2055 }
2056
2057 return false;
2058 }
2059
2060 /* Return true if S is a clobber statement. */
2061
2062 static inline bool
2063 gimple_clobber_p (gimple s)
2064 {
2065 return gimple_assign_single_p (s)
2066 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2067 }
2068
2069 /* Return true if GS is a GIMPLE_CALL. */
2070
2071 static inline bool
2072 is_gimple_call (const_gimple gs)
2073 {
2074 return gimple_code (gs) == GIMPLE_CALL;
2075 }
2076
2077 /* Return the LHS of call statement GS. */
2078
2079 static inline tree
2080 gimple_call_lhs (const_gimple gs)
2081 {
2082 GIMPLE_CHECK (gs, GIMPLE_CALL);
2083 return gimple_op (gs, 0);
2084 }
2085
2086
2087 /* Return a pointer to the LHS of call statement GS. */
2088
2089 static inline tree *
2090 gimple_call_lhs_ptr (const_gimple gs)
2091 {
2092 GIMPLE_CHECK (gs, GIMPLE_CALL);
2093 return gimple_op_ptr (gs, 0);
2094 }
2095
2096
2097 /* Set LHS to be the LHS operand of call statement GS. */
2098
2099 static inline void
2100 gimple_call_set_lhs (gimple gs, tree lhs)
2101 {
2102 GIMPLE_CHECK (gs, GIMPLE_CALL);
2103 gimple_set_op (gs, 0, lhs);
2104 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2105 SSA_NAME_DEF_STMT (lhs) = gs;
2106 }
2107
2108
2109 /* Return true if call GS calls an internal-only function, as enumerated
2110 by internal_fn. */
2111
2112 static inline bool
2113 gimple_call_internal_p (const_gimple gs)
2114 {
2115 GIMPLE_CHECK (gs, GIMPLE_CALL);
2116 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2117 }
2118
2119
2120 /* Return the target of internal call GS. */
2121
2122 static inline enum internal_fn
2123 gimple_call_internal_fn (const_gimple gs)
2124 {
2125 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2126 return gs->gimple_call.u.internal_fn;
2127 }
2128
2129
2130 /* Return the function type of the function called by GS. */
2131
2132 static inline tree
2133 gimple_call_fntype (const_gimple gs)
2134 {
2135 GIMPLE_CHECK (gs, GIMPLE_CALL);
2136 if (gimple_call_internal_p (gs))
2137 return NULL_TREE;
2138 return gs->gimple_call.u.fntype;
2139 }
2140
2141 /* Set the type of the function called by GS to FNTYPE. */
2142
2143 static inline void
2144 gimple_call_set_fntype (gimple gs, tree fntype)
2145 {
2146 GIMPLE_CHECK (gs, GIMPLE_CALL);
2147 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2148 gs->gimple_call.u.fntype = fntype;
2149 }
2150
2151
2152 /* Return the tree node representing the function called by call
2153 statement GS. */
2154
2155 static inline tree
2156 gimple_call_fn (const_gimple gs)
2157 {
2158 GIMPLE_CHECK (gs, GIMPLE_CALL);
2159 return gimple_op (gs, 1);
2160 }
2161
2162 /* Return a pointer to the tree node representing the function called by call
2163 statement GS. */
2164
2165 static inline tree *
2166 gimple_call_fn_ptr (const_gimple gs)
2167 {
2168 GIMPLE_CHECK (gs, GIMPLE_CALL);
2169 return gimple_op_ptr (gs, 1);
2170 }
2171
2172
2173 /* Set FN to be the function called by call statement GS. */
2174
2175 static inline void
2176 gimple_call_set_fn (gimple gs, tree fn)
2177 {
2178 GIMPLE_CHECK (gs, GIMPLE_CALL);
2179 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2180 gimple_set_op (gs, 1, fn);
2181 }
2182
2183
2184 /* Set FNDECL to be the function called by call statement GS. */
2185
2186 static inline void
2187 gimple_call_set_fndecl (gimple gs, tree decl)
2188 {
2189 GIMPLE_CHECK (gs, GIMPLE_CALL);
2190 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2191 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2192 }
2193
2194
2195 /* Set internal function FN to be the function called by call statement GS. */
2196
2197 static inline void
2198 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2199 {
2200 GIMPLE_CHECK (gs, GIMPLE_CALL);
2201 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2202 gs->gimple_call.u.internal_fn = fn;
2203 }
2204
2205
2206 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2207 associated with the callee if known. Otherwise return NULL_TREE. */
2208
2209 static inline tree
2210 gimple_call_addr_fndecl (const_tree fn)
2211 {
2212 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2213 {
2214 tree fndecl = TREE_OPERAND (fn, 0);
2215 if (TREE_CODE (fndecl) == MEM_REF
2216 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2217 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2218 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2219 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2220 return fndecl;
2221 }
2222 return NULL_TREE;
2223 }
2224
2225 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2226 Otherwise return NULL. This function is analogous to
2227 get_callee_fndecl in tree land. */
2228
2229 static inline tree
2230 gimple_call_fndecl (const_gimple gs)
2231 {
2232 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2233 }
2234
2235
2236 /* Return the type returned by call statement GS. */
2237
2238 static inline tree
2239 gimple_call_return_type (const_gimple gs)
2240 {
2241 tree type = gimple_call_fntype (gs);
2242
2243 if (type == NULL_TREE)
2244 return TREE_TYPE (gimple_call_lhs (gs));
2245
2246 /* The type returned by a function is the type of its
2247 function type. */
2248 return TREE_TYPE (type);
2249 }
2250
2251
2252 /* Return the static chain for call statement GS. */
2253
2254 static inline tree
2255 gimple_call_chain (const_gimple gs)
2256 {
2257 GIMPLE_CHECK (gs, GIMPLE_CALL);
2258 return gimple_op (gs, 2);
2259 }
2260
2261
2262 /* Return a pointer to the static chain for call statement GS. */
2263
2264 static inline tree *
2265 gimple_call_chain_ptr (const_gimple gs)
2266 {
2267 GIMPLE_CHECK (gs, GIMPLE_CALL);
2268 return gimple_op_ptr (gs, 2);
2269 }
2270
2271 /* Set CHAIN to be the static chain for call statement GS. */
2272
2273 static inline void
2274 gimple_call_set_chain (gimple gs, tree chain)
2275 {
2276 GIMPLE_CHECK (gs, GIMPLE_CALL);
2277
2278 gimple_set_op (gs, 2, chain);
2279 }
2280
2281
2282 /* Return the number of arguments used by call statement GS. */
2283
2284 static inline unsigned
2285 gimple_call_num_args (const_gimple gs)
2286 {
2287 unsigned num_ops;
2288 GIMPLE_CHECK (gs, GIMPLE_CALL);
2289 num_ops = gimple_num_ops (gs);
2290 return num_ops - 3;
2291 }
2292
2293
2294 /* Return the argument at position INDEX for call statement GS. */
2295
2296 static inline tree
2297 gimple_call_arg (const_gimple gs, unsigned index)
2298 {
2299 GIMPLE_CHECK (gs, GIMPLE_CALL);
2300 return gimple_op (gs, index + 3);
2301 }
2302
2303
2304 /* Return a pointer to the argument at position INDEX for call
2305 statement GS. */
2306
2307 static inline tree *
2308 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2309 {
2310 GIMPLE_CHECK (gs, GIMPLE_CALL);
2311 return gimple_op_ptr (gs, index + 3);
2312 }
2313
2314
2315 /* Set ARG to be the argument at position INDEX for call statement GS. */
2316
2317 static inline void
2318 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2319 {
2320 GIMPLE_CHECK (gs, GIMPLE_CALL);
2321 gimple_set_op (gs, index + 3, arg);
2322 }
2323
2324
2325 /* If TAIL_P is true, mark call statement S as being a tail call
2326 (i.e., a call just before the exit of a function). These calls are
2327 candidate for tail call optimization. */
2328
2329 static inline void
2330 gimple_call_set_tail (gimple s, bool tail_p)
2331 {
2332 GIMPLE_CHECK (s, GIMPLE_CALL);
2333 if (tail_p)
2334 s->gsbase.subcode |= GF_CALL_TAILCALL;
2335 else
2336 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2337 }
2338
2339
2340 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2341
2342 static inline bool
2343 gimple_call_tail_p (gimple s)
2344 {
2345 GIMPLE_CHECK (s, GIMPLE_CALL);
2346 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2347 }
2348
2349
2350 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2351 slot optimization. This transformation uses the target of the call
2352 expansion as the return slot for calls that return in memory. */
2353
2354 static inline void
2355 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2356 {
2357 GIMPLE_CHECK (s, GIMPLE_CALL);
2358 if (return_slot_opt_p)
2359 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2360 else
2361 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2362 }
2363
2364
2365 /* Return true if S is marked for return slot optimization. */
2366
2367 static inline bool
2368 gimple_call_return_slot_opt_p (gimple s)
2369 {
2370 GIMPLE_CHECK (s, GIMPLE_CALL);
2371 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2372 }
2373
2374
2375 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2376 thunk to the thunked-to function. */
2377
2378 static inline void
2379 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2380 {
2381 GIMPLE_CHECK (s, GIMPLE_CALL);
2382 if (from_thunk_p)
2383 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2384 else
2385 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2386 }
2387
2388
2389 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2390
2391 static inline bool
2392 gimple_call_from_thunk_p (gimple s)
2393 {
2394 GIMPLE_CHECK (s, GIMPLE_CALL);
2395 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2396 }
2397
2398
2399 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2400 argument pack in its argument list. */
2401
2402 static inline void
2403 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2404 {
2405 GIMPLE_CHECK (s, GIMPLE_CALL);
2406 if (pass_arg_pack_p)
2407 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2408 else
2409 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2410 }
2411
2412
2413 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2414 argument pack in its argument list. */
2415
2416 static inline bool
2417 gimple_call_va_arg_pack_p (gimple s)
2418 {
2419 GIMPLE_CHECK (s, GIMPLE_CALL);
2420 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2421 }
2422
2423
2424 /* Return true if S is a noreturn call. */
2425
2426 static inline bool
2427 gimple_call_noreturn_p (gimple s)
2428 {
2429 GIMPLE_CHECK (s, GIMPLE_CALL);
2430 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2431 }
2432
2433
2434 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2435 even if the called function can throw in other cases. */
2436
2437 static inline void
2438 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2439 {
2440 GIMPLE_CHECK (s, GIMPLE_CALL);
2441 if (nothrow_p)
2442 s->gsbase.subcode |= GF_CALL_NOTHROW;
2443 else
2444 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2445 }
2446
2447 /* Return true if S is a nothrow call. */
2448
2449 static inline bool
2450 gimple_call_nothrow_p (gimple s)
2451 {
2452 GIMPLE_CHECK (s, GIMPLE_CALL);
2453 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2454 }
2455
2456 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2457 is known to be emitted for VLA objects. Those are wrapped by
2458 stack_save/stack_restore calls and hence can't lead to unbounded
2459 stack growth even when they occur in loops. */
2460
2461 static inline void
2462 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2463 {
2464 GIMPLE_CHECK (s, GIMPLE_CALL);
2465 if (for_var)
2466 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2467 else
2468 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2469 }
2470
2471 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2472
2473 static inline bool
2474 gimple_call_alloca_for_var_p (gimple s)
2475 {
2476 GIMPLE_CHECK (s, GIMPLE_CALL);
2477 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2478 }
2479
2480 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2481
2482 static inline void
2483 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2484 {
2485 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2486 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2487 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2488 }
2489
2490
2491 /* Return a pointer to the points-to solution for the set of call-used
2492 variables of the call CALL. */
2493
2494 static inline struct pt_solution *
2495 gimple_call_use_set (gimple call)
2496 {
2497 GIMPLE_CHECK (call, GIMPLE_CALL);
2498 return &call->gimple_call.call_used;
2499 }
2500
2501
2502 /* Return a pointer to the points-to solution for the set of call-used
2503 variables of the call CALL. */
2504
2505 static inline struct pt_solution *
2506 gimple_call_clobber_set (gimple call)
2507 {
2508 GIMPLE_CHECK (call, GIMPLE_CALL);
2509 return &call->gimple_call.call_clobbered;
2510 }
2511
2512
2513 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2514 non-NULL lhs. */
2515
2516 static inline bool
2517 gimple_has_lhs (gimple stmt)
2518 {
2519 return (is_gimple_assign (stmt)
2520 || (is_gimple_call (stmt)
2521 && gimple_call_lhs (stmt) != NULL_TREE));
2522 }
2523
2524
2525 /* Return the code of the predicate computed by conditional statement GS. */
2526
2527 static inline enum tree_code
2528 gimple_cond_code (const_gimple gs)
2529 {
2530 GIMPLE_CHECK (gs, GIMPLE_COND);
2531 return (enum tree_code) gs->gsbase.subcode;
2532 }
2533
2534
2535 /* Set CODE to be the predicate code for the conditional statement GS. */
2536
2537 static inline void
2538 gimple_cond_set_code (gimple gs, enum tree_code code)
2539 {
2540 GIMPLE_CHECK (gs, GIMPLE_COND);
2541 gs->gsbase.subcode = code;
2542 }
2543
2544
2545 /* Return the LHS of the predicate computed by conditional statement GS. */
2546
2547 static inline tree
2548 gimple_cond_lhs (const_gimple gs)
2549 {
2550 GIMPLE_CHECK (gs, GIMPLE_COND);
2551 return gimple_op (gs, 0);
2552 }
2553
2554 /* Return the pointer to the LHS of the predicate computed by conditional
2555 statement GS. */
2556
2557 static inline tree *
2558 gimple_cond_lhs_ptr (const_gimple gs)
2559 {
2560 GIMPLE_CHECK (gs, GIMPLE_COND);
2561 return gimple_op_ptr (gs, 0);
2562 }
2563
2564 /* Set LHS to be the LHS operand of the predicate computed by
2565 conditional statement GS. */
2566
2567 static inline void
2568 gimple_cond_set_lhs (gimple gs, tree lhs)
2569 {
2570 GIMPLE_CHECK (gs, GIMPLE_COND);
2571 gimple_set_op (gs, 0, lhs);
2572 }
2573
2574
2575 /* Return the RHS operand of the predicate computed by conditional GS. */
2576
2577 static inline tree
2578 gimple_cond_rhs (const_gimple gs)
2579 {
2580 GIMPLE_CHECK (gs, GIMPLE_COND);
2581 return gimple_op (gs, 1);
2582 }
2583
2584 /* Return the pointer to the RHS operand of the predicate computed by
2585 conditional GS. */
2586
2587 static inline tree *
2588 gimple_cond_rhs_ptr (const_gimple gs)
2589 {
2590 GIMPLE_CHECK (gs, GIMPLE_COND);
2591 return gimple_op_ptr (gs, 1);
2592 }
2593
2594
2595 /* Set RHS to be the RHS operand of the predicate computed by
2596 conditional statement GS. */
2597
2598 static inline void
2599 gimple_cond_set_rhs (gimple gs, tree rhs)
2600 {
2601 GIMPLE_CHECK (gs, GIMPLE_COND);
2602 gimple_set_op (gs, 1, rhs);
2603 }
2604
2605
2606 /* Return the label used by conditional statement GS when its
2607 predicate evaluates to true. */
2608
2609 static inline tree
2610 gimple_cond_true_label (const_gimple gs)
2611 {
2612 GIMPLE_CHECK (gs, GIMPLE_COND);
2613 return gimple_op (gs, 2);
2614 }
2615
2616
2617 /* Set LABEL to be the label used by conditional statement GS when its
2618 predicate evaluates to true. */
2619
2620 static inline void
2621 gimple_cond_set_true_label (gimple gs, tree label)
2622 {
2623 GIMPLE_CHECK (gs, GIMPLE_COND);
2624 gimple_set_op (gs, 2, label);
2625 }
2626
2627
2628 /* Set LABEL to be the label used by conditional statement GS when its
2629 predicate evaluates to false. */
2630
2631 static inline void
2632 gimple_cond_set_false_label (gimple gs, tree label)
2633 {
2634 GIMPLE_CHECK (gs, GIMPLE_COND);
2635 gimple_set_op (gs, 3, label);
2636 }
2637
2638
2639 /* Return the label used by conditional statement GS when its
2640 predicate evaluates to false. */
2641
2642 static inline tree
2643 gimple_cond_false_label (const_gimple gs)
2644 {
2645 GIMPLE_CHECK (gs, GIMPLE_COND);
2646 return gimple_op (gs, 3);
2647 }
2648
2649
2650 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2651
2652 static inline void
2653 gimple_cond_make_false (gimple gs)
2654 {
2655 gimple_cond_set_lhs (gs, boolean_true_node);
2656 gimple_cond_set_rhs (gs, boolean_false_node);
2657 gs->gsbase.subcode = EQ_EXPR;
2658 }
2659
2660
2661 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2662
2663 static inline void
2664 gimple_cond_make_true (gimple gs)
2665 {
2666 gimple_cond_set_lhs (gs, boolean_true_node);
2667 gimple_cond_set_rhs (gs, boolean_true_node);
2668 gs->gsbase.subcode = EQ_EXPR;
2669 }
2670
2671 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2672 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2673
2674 static inline bool
2675 gimple_cond_true_p (const_gimple gs)
2676 {
2677 tree lhs = gimple_cond_lhs (gs);
2678 tree rhs = gimple_cond_rhs (gs);
2679 enum tree_code code = gimple_cond_code (gs);
2680
2681 if (lhs != boolean_true_node && lhs != boolean_false_node)
2682 return false;
2683
2684 if (rhs != boolean_true_node && rhs != boolean_false_node)
2685 return false;
2686
2687 if (code == NE_EXPR && lhs != rhs)
2688 return true;
2689
2690 if (code == EQ_EXPR && lhs == rhs)
2691 return true;
2692
2693 return false;
2694 }
2695
2696 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2697 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2698
2699 static inline bool
2700 gimple_cond_false_p (const_gimple gs)
2701 {
2702 tree lhs = gimple_cond_lhs (gs);
2703 tree rhs = gimple_cond_rhs (gs);
2704 enum tree_code code = gimple_cond_code (gs);
2705
2706 if (lhs != boolean_true_node && lhs != boolean_false_node)
2707 return false;
2708
2709 if (rhs != boolean_true_node && rhs != boolean_false_node)
2710 return false;
2711
2712 if (code == NE_EXPR && lhs == rhs)
2713 return true;
2714
2715 if (code == EQ_EXPR && lhs != rhs)
2716 return true;
2717
2718 return false;
2719 }
2720
2721 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2722 'if (var == 1)' */
2723
2724 static inline bool
2725 gimple_cond_single_var_p (gimple gs)
2726 {
2727 if (gimple_cond_code (gs) == NE_EXPR
2728 && gimple_cond_rhs (gs) == boolean_false_node)
2729 return true;
2730
2731 if (gimple_cond_code (gs) == EQ_EXPR
2732 && gimple_cond_rhs (gs) == boolean_true_node)
2733 return true;
2734
2735 return false;
2736 }
2737
2738 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2739
2740 static inline void
2741 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2742 {
2743 gimple_cond_set_code (stmt, code);
2744 gimple_cond_set_lhs (stmt, lhs);
2745 gimple_cond_set_rhs (stmt, rhs);
2746 }
2747
2748 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2749
2750 static inline tree
2751 gimple_label_label (const_gimple gs)
2752 {
2753 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2754 return gimple_op (gs, 0);
2755 }
2756
2757
2758 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2759 GS. */
2760
2761 static inline void
2762 gimple_label_set_label (gimple gs, tree label)
2763 {
2764 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2765 gimple_set_op (gs, 0, label);
2766 }
2767
2768
2769 /* Return the destination of the unconditional jump GS. */
2770
2771 static inline tree
2772 gimple_goto_dest (const_gimple gs)
2773 {
2774 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2775 return gimple_op (gs, 0);
2776 }
2777
2778
2779 /* Set DEST to be the destination of the unconditonal jump GS. */
2780
2781 static inline void
2782 gimple_goto_set_dest (gimple gs, tree dest)
2783 {
2784 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2785 gimple_set_op (gs, 0, dest);
2786 }
2787
2788
2789 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2790
2791 static inline tree
2792 gimple_bind_vars (const_gimple gs)
2793 {
2794 GIMPLE_CHECK (gs, GIMPLE_BIND);
2795 return gs->gimple_bind.vars;
2796 }
2797
2798
2799 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2800 statement GS. */
2801
2802 static inline void
2803 gimple_bind_set_vars (gimple gs, tree vars)
2804 {
2805 GIMPLE_CHECK (gs, GIMPLE_BIND);
2806 gs->gimple_bind.vars = vars;
2807 }
2808
2809
2810 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2811 statement GS. */
2812
2813 static inline void
2814 gimple_bind_append_vars (gimple gs, tree vars)
2815 {
2816 GIMPLE_CHECK (gs, GIMPLE_BIND);
2817 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2818 }
2819
2820
2821 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2822
2823 static inline gimple_seq
2824 gimple_bind_body (gimple gs)
2825 {
2826 GIMPLE_CHECK (gs, GIMPLE_BIND);
2827 return gs->gimple_bind.body;
2828 }
2829
2830
2831 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2832 statement GS. */
2833
2834 static inline void
2835 gimple_bind_set_body (gimple gs, gimple_seq seq)
2836 {
2837 GIMPLE_CHECK (gs, GIMPLE_BIND);
2838 gs->gimple_bind.body = seq;
2839 }
2840
2841
2842 /* Append a statement to the end of a GIMPLE_BIND's body. */
2843
2844 static inline void
2845 gimple_bind_add_stmt (gimple gs, gimple stmt)
2846 {
2847 GIMPLE_CHECK (gs, GIMPLE_BIND);
2848 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2849 }
2850
2851
2852 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2853
2854 static inline void
2855 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2856 {
2857 GIMPLE_CHECK (gs, GIMPLE_BIND);
2858 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2859 }
2860
2861
2862 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2863 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2864
2865 static inline tree
2866 gimple_bind_block (const_gimple gs)
2867 {
2868 GIMPLE_CHECK (gs, GIMPLE_BIND);
2869 return gs->gimple_bind.block;
2870 }
2871
2872
2873 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2874 statement GS. */
2875
2876 static inline void
2877 gimple_bind_set_block (gimple gs, tree block)
2878 {
2879 GIMPLE_CHECK (gs, GIMPLE_BIND);
2880 gcc_gimple_checking_assert (block == NULL_TREE
2881 || TREE_CODE (block) == BLOCK);
2882 gs->gimple_bind.block = block;
2883 }
2884
2885
2886 /* Return the number of input operands for GIMPLE_ASM GS. */
2887
2888 static inline unsigned
2889 gimple_asm_ninputs (const_gimple gs)
2890 {
2891 GIMPLE_CHECK (gs, GIMPLE_ASM);
2892 return gs->gimple_asm.ni;
2893 }
2894
2895
2896 /* Return the number of output operands for GIMPLE_ASM GS. */
2897
2898 static inline unsigned
2899 gimple_asm_noutputs (const_gimple gs)
2900 {
2901 GIMPLE_CHECK (gs, GIMPLE_ASM);
2902 return gs->gimple_asm.no;
2903 }
2904
2905
2906 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2907
2908 static inline unsigned
2909 gimple_asm_nclobbers (const_gimple gs)
2910 {
2911 GIMPLE_CHECK (gs, GIMPLE_ASM);
2912 return gs->gimple_asm.nc;
2913 }
2914
2915 /* Return the number of label operands for GIMPLE_ASM GS. */
2916
2917 static inline unsigned
2918 gimple_asm_nlabels (const_gimple gs)
2919 {
2920 GIMPLE_CHECK (gs, GIMPLE_ASM);
2921 return gs->gimple_asm.nl;
2922 }
2923
2924 /* Return input operand INDEX of GIMPLE_ASM GS. */
2925
2926 static inline tree
2927 gimple_asm_input_op (const_gimple gs, unsigned index)
2928 {
2929 GIMPLE_CHECK (gs, GIMPLE_ASM);
2930 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2931 return gimple_op (gs, index);
2932 }
2933
2934 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2935
2936 static inline tree *
2937 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2938 {
2939 GIMPLE_CHECK (gs, GIMPLE_ASM);
2940 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2941 return gimple_op_ptr (gs, index);
2942 }
2943
2944
2945 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2946
2947 static inline void
2948 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2949 {
2950 GIMPLE_CHECK (gs, GIMPLE_ASM);
2951 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2952 && TREE_CODE (in_op) == TREE_LIST);
2953 gimple_set_op (gs, index, in_op);
2954 }
2955
2956
2957 /* Return output operand INDEX of GIMPLE_ASM GS. */
2958
2959 static inline tree
2960 gimple_asm_output_op (const_gimple gs, unsigned index)
2961 {
2962 GIMPLE_CHECK (gs, GIMPLE_ASM);
2963 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2964 return gimple_op (gs, index + gs->gimple_asm.ni);
2965 }
2966
2967 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2968
2969 static inline tree *
2970 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2971 {
2972 GIMPLE_CHECK (gs, GIMPLE_ASM);
2973 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2974 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2975 }
2976
2977
2978 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2979
2980 static inline void
2981 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2982 {
2983 GIMPLE_CHECK (gs, GIMPLE_ASM);
2984 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2985 && TREE_CODE (out_op) == TREE_LIST);
2986 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2987 }
2988
2989
2990 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2991
2992 static inline tree
2993 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2994 {
2995 GIMPLE_CHECK (gs, GIMPLE_ASM);
2996 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2997 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2998 }
2999
3000
3001 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3002
3003 static inline void
3004 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3005 {
3006 GIMPLE_CHECK (gs, GIMPLE_ASM);
3007 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
3008 && TREE_CODE (clobber_op) == TREE_LIST);
3009 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3010 }
3011
3012 /* Return label operand INDEX of GIMPLE_ASM GS. */
3013
3014 static inline tree
3015 gimple_asm_label_op (const_gimple gs, unsigned index)
3016 {
3017 GIMPLE_CHECK (gs, GIMPLE_ASM);
3018 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
3019 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3020 }
3021
3022 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3023
3024 static inline void
3025 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3026 {
3027 GIMPLE_CHECK (gs, GIMPLE_ASM);
3028 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
3029 && TREE_CODE (label_op) == TREE_LIST);
3030 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3031 }
3032
3033 /* Return the string representing the assembly instruction in
3034 GIMPLE_ASM GS. */
3035
3036 static inline const char *
3037 gimple_asm_string (const_gimple gs)
3038 {
3039 GIMPLE_CHECK (gs, GIMPLE_ASM);
3040 return gs->gimple_asm.string;
3041 }
3042
3043
3044 /* Return true if GS is an asm statement marked volatile. */
3045
3046 static inline bool
3047 gimple_asm_volatile_p (const_gimple gs)
3048 {
3049 GIMPLE_CHECK (gs, GIMPLE_ASM);
3050 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3051 }
3052
3053
3054 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3055
3056 static inline void
3057 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3058 {
3059 GIMPLE_CHECK (gs, GIMPLE_ASM);
3060 if (volatile_p)
3061 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3062 else
3063 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3064 }
3065
3066
3067 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3068
3069 static inline void
3070 gimple_asm_set_input (gimple gs, bool input_p)
3071 {
3072 GIMPLE_CHECK (gs, GIMPLE_ASM);
3073 if (input_p)
3074 gs->gsbase.subcode |= GF_ASM_INPUT;
3075 else
3076 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3077 }
3078
3079
3080 /* Return true if asm GS is an ASM_INPUT. */
3081
3082 static inline bool
3083 gimple_asm_input_p (const_gimple gs)
3084 {
3085 GIMPLE_CHECK (gs, GIMPLE_ASM);
3086 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3087 }
3088
3089
3090 /* Return the types handled by GIMPLE_CATCH statement GS. */
3091
3092 static inline tree
3093 gimple_catch_types (const_gimple gs)
3094 {
3095 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3096 return gs->gimple_catch.types;
3097 }
3098
3099
3100 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3101
3102 static inline tree *
3103 gimple_catch_types_ptr (gimple gs)
3104 {
3105 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3106 return &gs->gimple_catch.types;
3107 }
3108
3109
3110 /* Return the GIMPLE sequence representing the body of the handler of
3111 GIMPLE_CATCH statement GS. */
3112
3113 static inline gimple_seq
3114 gimple_catch_handler (gimple gs)
3115 {
3116 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3117 return gs->gimple_catch.handler;
3118 }
3119
3120
3121 /* Return a pointer to the GIMPLE sequence representing the body of
3122 the handler of GIMPLE_CATCH statement GS. */
3123
3124 static inline gimple_seq *
3125 gimple_catch_handler_ptr (gimple gs)
3126 {
3127 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3128 return &gs->gimple_catch.handler;
3129 }
3130
3131
3132 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3133
3134 static inline void
3135 gimple_catch_set_types (gimple gs, tree t)
3136 {
3137 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3138 gs->gimple_catch.types = t;
3139 }
3140
3141
3142 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3143
3144 static inline void
3145 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3146 {
3147 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3148 gs->gimple_catch.handler = handler;
3149 }
3150
3151
3152 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3153
3154 static inline tree
3155 gimple_eh_filter_types (const_gimple gs)
3156 {
3157 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3158 return gs->gimple_eh_filter.types;
3159 }
3160
3161
3162 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3163 GS. */
3164
3165 static inline tree *
3166 gimple_eh_filter_types_ptr (gimple gs)
3167 {
3168 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3169 return &gs->gimple_eh_filter.types;
3170 }
3171
3172
3173 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3174 statement fails. */
3175
3176 static inline gimple_seq
3177 gimple_eh_filter_failure (gimple gs)
3178 {
3179 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3180 return gs->gimple_eh_filter.failure;
3181 }
3182
3183
3184 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3185
3186 static inline void
3187 gimple_eh_filter_set_types (gimple gs, tree types)
3188 {
3189 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3190 gs->gimple_eh_filter.types = types;
3191 }
3192
3193
3194 /* Set FAILURE to be the sequence of statements to execute on failure
3195 for GIMPLE_EH_FILTER GS. */
3196
3197 static inline void
3198 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3199 {
3200 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3201 gs->gimple_eh_filter.failure = failure;
3202 }
3203
3204 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3205
3206 static inline tree
3207 gimple_eh_must_not_throw_fndecl (gimple gs)
3208 {
3209 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3210 return gs->gimple_eh_mnt.fndecl;
3211 }
3212
3213 /* Set the function decl to be called by GS to DECL. */
3214
3215 static inline void
3216 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3217 {
3218 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3219 gs->gimple_eh_mnt.fndecl = decl;
3220 }
3221
3222 /* GIMPLE_EH_ELSE accessors. */
3223
3224 static inline gimple_seq
3225 gimple_eh_else_n_body (gimple gs)
3226 {
3227 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3228 return gs->gimple_eh_else.n_body;
3229 }
3230
3231 static inline gimple_seq
3232 gimple_eh_else_e_body (gimple gs)
3233 {
3234 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3235 return gs->gimple_eh_else.e_body;
3236 }
3237
3238 static inline void
3239 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3240 {
3241 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3242 gs->gimple_eh_else.n_body = seq;
3243 }
3244
3245 static inline void
3246 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3247 {
3248 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3249 gs->gimple_eh_else.e_body = seq;
3250 }
3251
3252 /* GIMPLE_TRY accessors. */
3253
3254 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3255 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3256
3257 static inline enum gimple_try_flags
3258 gimple_try_kind (const_gimple gs)
3259 {
3260 GIMPLE_CHECK (gs, GIMPLE_TRY);
3261 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3262 }
3263
3264
3265 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3266
3267 static inline void
3268 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3269 {
3270 GIMPLE_CHECK (gs, GIMPLE_TRY);
3271 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3272 || kind == GIMPLE_TRY_FINALLY);
3273 if (gimple_try_kind (gs) != kind)
3274 gs->gsbase.subcode = (unsigned int) kind;
3275 }
3276
3277
3278 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3279
3280 static inline bool
3281 gimple_try_catch_is_cleanup (const_gimple gs)
3282 {
3283 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3284 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3285 }
3286
3287
3288 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3289
3290 static inline gimple_seq
3291 gimple_try_eval (gimple gs)
3292 {
3293 GIMPLE_CHECK (gs, GIMPLE_TRY);
3294 return gs->gimple_try.eval;
3295 }
3296
3297
3298 /* Return the sequence of statements used as the cleanup body for
3299 GIMPLE_TRY GS. */
3300
3301 static inline gimple_seq
3302 gimple_try_cleanup (gimple gs)
3303 {
3304 GIMPLE_CHECK (gs, GIMPLE_TRY);
3305 return gs->gimple_try.cleanup;
3306 }
3307
3308
3309 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3310
3311 static inline void
3312 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3313 {
3314 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3315 if (catch_is_cleanup)
3316 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3317 else
3318 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3319 }
3320
3321
3322 /* Set EVAL to be the sequence of statements to use as the body for
3323 GIMPLE_TRY GS. */
3324
3325 static inline void
3326 gimple_try_set_eval (gimple gs, gimple_seq eval)
3327 {
3328 GIMPLE_CHECK (gs, GIMPLE_TRY);
3329 gs->gimple_try.eval = eval;
3330 }
3331
3332
3333 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3334 body for GIMPLE_TRY GS. */
3335
3336 static inline void
3337 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3338 {
3339 GIMPLE_CHECK (gs, GIMPLE_TRY);
3340 gs->gimple_try.cleanup = cleanup;
3341 }
3342
3343
3344 /* Return the cleanup sequence for cleanup statement GS. */
3345
3346 static inline gimple_seq
3347 gimple_wce_cleanup (gimple gs)
3348 {
3349 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3350 return gs->gimple_wce.cleanup;
3351 }
3352
3353
3354 /* Set CLEANUP to be the cleanup sequence for GS. */
3355
3356 static inline void
3357 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3358 {
3359 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3360 gs->gimple_wce.cleanup = cleanup;
3361 }
3362
3363
3364 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3365
3366 static inline bool
3367 gimple_wce_cleanup_eh_only (const_gimple gs)
3368 {
3369 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3370 return gs->gsbase.subcode != 0;
3371 }
3372
3373
3374 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3375
3376 static inline void
3377 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3378 {
3379 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3380 gs->gsbase.subcode = (unsigned int) eh_only_p;
3381 }
3382
3383
3384 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3385
3386 static inline unsigned
3387 gimple_phi_capacity (const_gimple gs)
3388 {
3389 GIMPLE_CHECK (gs, GIMPLE_PHI);
3390 return gs->gimple_phi.capacity;
3391 }
3392
3393
3394 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3395 be exactly the number of incoming edges for the basic block holding
3396 GS. */
3397
3398 static inline unsigned
3399 gimple_phi_num_args (const_gimple gs)
3400 {
3401 GIMPLE_CHECK (gs, GIMPLE_PHI);
3402 return gs->gimple_phi.nargs;
3403 }
3404
3405
3406 /* Return the SSA name created by GIMPLE_PHI GS. */
3407
3408 static inline tree
3409 gimple_phi_result (const_gimple gs)
3410 {
3411 GIMPLE_CHECK (gs, GIMPLE_PHI);
3412 return gs->gimple_phi.result;
3413 }
3414
3415 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3416
3417 static inline tree *
3418 gimple_phi_result_ptr (gimple gs)
3419 {
3420 GIMPLE_CHECK (gs, GIMPLE_PHI);
3421 return &gs->gimple_phi.result;
3422 }
3423
3424 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3425
3426 static inline void
3427 gimple_phi_set_result (gimple gs, tree result)
3428 {
3429 GIMPLE_CHECK (gs, GIMPLE_PHI);
3430 gs->gimple_phi.result = result;
3431 }
3432
3433
3434 /* Return the PHI argument corresponding to incoming edge INDEX for
3435 GIMPLE_PHI GS. */
3436
3437 static inline struct phi_arg_d *
3438 gimple_phi_arg (gimple gs, unsigned index)
3439 {
3440 GIMPLE_CHECK (gs, GIMPLE_PHI);
3441 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3442 return &(gs->gimple_phi.args[index]);
3443 }
3444
3445 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3446 for GIMPLE_PHI GS. */
3447
3448 static inline void
3449 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3450 {
3451 GIMPLE_CHECK (gs, GIMPLE_PHI);
3452 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3453 gs->gimple_phi.args[index] = *phiarg;
3454 }
3455
3456 /* Return the region number for GIMPLE_RESX GS. */
3457
3458 static inline int
3459 gimple_resx_region (const_gimple gs)
3460 {
3461 GIMPLE_CHECK (gs, GIMPLE_RESX);
3462 return gs->gimple_eh_ctrl.region;
3463 }
3464
3465 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3466
3467 static inline void
3468 gimple_resx_set_region (gimple gs, int region)
3469 {
3470 GIMPLE_CHECK (gs, GIMPLE_RESX);
3471 gs->gimple_eh_ctrl.region = region;
3472 }
3473
3474 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3475
3476 static inline int
3477 gimple_eh_dispatch_region (const_gimple gs)
3478 {
3479 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3480 return gs->gimple_eh_ctrl.region;
3481 }
3482
3483 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3484
3485 static inline void
3486 gimple_eh_dispatch_set_region (gimple gs, int region)
3487 {
3488 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3489 gs->gimple_eh_ctrl.region = region;
3490 }
3491
3492 /* Return the number of labels associated with the switch statement GS. */
3493
3494 static inline unsigned
3495 gimple_switch_num_labels (const_gimple gs)
3496 {
3497 unsigned num_ops;
3498 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3499 num_ops = gimple_num_ops (gs);
3500 gcc_gimple_checking_assert (num_ops > 1);
3501 return num_ops - 1;
3502 }
3503
3504
3505 /* Set NLABELS to be the number of labels for the switch statement GS. */
3506
3507 static inline void
3508 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3509 {
3510 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3511 gimple_set_num_ops (g, nlabels + 1);
3512 }
3513
3514
3515 /* Return the index variable used by the switch statement GS. */
3516
3517 static inline tree
3518 gimple_switch_index (const_gimple gs)
3519 {
3520 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3521 return gimple_op (gs, 0);
3522 }
3523
3524
3525 /* Return a pointer to the index variable for the switch statement GS. */
3526
3527 static inline tree *
3528 gimple_switch_index_ptr (const_gimple gs)
3529 {
3530 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3531 return gimple_op_ptr (gs, 0);
3532 }
3533
3534
3535 /* Set INDEX to be the index variable for switch statement GS. */
3536
3537 static inline void
3538 gimple_switch_set_index (gimple gs, tree index)
3539 {
3540 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3541 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3542 gimple_set_op (gs, 0, index);
3543 }
3544
3545
3546 /* Return the label numbered INDEX. The default label is 0, followed by any
3547 labels in a switch statement. */
3548
3549 static inline tree
3550 gimple_switch_label (const_gimple gs, unsigned index)
3551 {
3552 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3553 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3554 return gimple_op (gs, index + 1);
3555 }
3556
3557 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3558
3559 static inline void
3560 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3561 {
3562 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3563 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3564 && (label == NULL_TREE
3565 || TREE_CODE (label) == CASE_LABEL_EXPR));
3566 gimple_set_op (gs, index + 1, label);
3567 }
3568
3569 /* Return the default label for a switch statement. */
3570
3571 static inline tree
3572 gimple_switch_default_label (const_gimple gs)
3573 {
3574 return gimple_switch_label (gs, 0);
3575 }
3576
3577 /* Set the default label for a switch statement. */
3578
3579 static inline void
3580 gimple_switch_set_default_label (gimple gs, tree label)
3581 {
3582 gimple_switch_set_label (gs, 0, label);
3583 }
3584
3585 /* Return true if GS is a GIMPLE_DEBUG statement. */
3586
3587 static inline bool
3588 is_gimple_debug (const_gimple gs)
3589 {
3590 return gimple_code (gs) == GIMPLE_DEBUG;
3591 }
3592
3593 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3594
3595 static inline bool
3596 gimple_debug_bind_p (const_gimple s)
3597 {
3598 if (is_gimple_debug (s))
3599 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3600
3601 return false;
3602 }
3603
3604 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3605
3606 static inline tree
3607 gimple_debug_bind_get_var (gimple dbg)
3608 {
3609 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3610 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3611 return gimple_op (dbg, 0);
3612 }
3613
3614 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3615 statement. */
3616
3617 static inline tree
3618 gimple_debug_bind_get_value (gimple dbg)
3619 {
3620 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3621 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3622 return gimple_op (dbg, 1);
3623 }
3624
3625 /* Return a pointer to the value bound to the variable in a
3626 GIMPLE_DEBUG bind statement. */
3627
3628 static inline tree *
3629 gimple_debug_bind_get_value_ptr (gimple dbg)
3630 {
3631 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3632 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3633 return gimple_op_ptr (dbg, 1);
3634 }
3635
3636 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3637
3638 static inline void
3639 gimple_debug_bind_set_var (gimple dbg, tree var)
3640 {
3641 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3642 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3643 gimple_set_op (dbg, 0, var);
3644 }
3645
3646 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3647 statement. */
3648
3649 static inline void
3650 gimple_debug_bind_set_value (gimple dbg, tree value)
3651 {
3652 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3653 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3654 gimple_set_op (dbg, 1, value);
3655 }
3656
3657 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3658 optimized away. */
3659 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3660
3661 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3662 statement. */
3663
3664 static inline void
3665 gimple_debug_bind_reset_value (gimple dbg)
3666 {
3667 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3668 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3669 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3670 }
3671
3672 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3673 value. */
3674
3675 static inline bool
3676 gimple_debug_bind_has_value_p (gimple dbg)
3677 {
3678 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3679 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3680 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3681 }
3682
3683 #undef GIMPLE_DEBUG_BIND_NOVALUE
3684
3685 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3686
3687 static inline bool
3688 gimple_debug_source_bind_p (const_gimple s)
3689 {
3690 if (is_gimple_debug (s))
3691 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3692
3693 return false;
3694 }
3695
3696 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3697
3698 static inline tree
3699 gimple_debug_source_bind_get_var (gimple dbg)
3700 {
3701 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3702 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3703 return gimple_op (dbg, 0);
3704 }
3705
3706 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3707 statement. */
3708
3709 static inline tree
3710 gimple_debug_source_bind_get_value (gimple dbg)
3711 {
3712 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3713 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3714 return gimple_op (dbg, 1);
3715 }
3716
3717 /* Return a pointer to the value bound to the variable in a
3718 GIMPLE_DEBUG source bind statement. */
3719
3720 static inline tree *
3721 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3722 {
3723 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3724 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3725 return gimple_op_ptr (dbg, 1);
3726 }
3727
3728 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3729
3730 static inline void
3731 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3732 {
3733 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3734 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3735 gimple_set_op (dbg, 0, var);
3736 }
3737
3738 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3739 statement. */
3740
3741 static inline void
3742 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3743 {
3744 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3745 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3746 gimple_set_op (dbg, 1, value);
3747 }
3748
3749 /* Return the body for the OMP statement GS. */
3750
3751 static inline gimple_seq
3752 gimple_omp_body (gimple gs)
3753 {
3754 return gs->omp.body;
3755 }
3756
3757 /* Set BODY to be the body for the OMP statement GS. */
3758
3759 static inline void
3760 gimple_omp_set_body (gimple gs, gimple_seq body)
3761 {
3762 gs->omp.body = body;
3763 }
3764
3765
3766 /* Return the name associated with OMP_CRITICAL statement GS. */
3767
3768 static inline tree
3769 gimple_omp_critical_name (const_gimple gs)
3770 {
3771 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3772 return gs->gimple_omp_critical.name;
3773 }
3774
3775
3776 /* Return a pointer to the name associated with OMP critical statement GS. */
3777
3778 static inline tree *
3779 gimple_omp_critical_name_ptr (gimple gs)
3780 {
3781 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3782 return &gs->gimple_omp_critical.name;
3783 }
3784
3785
3786 /* Set NAME to be the name associated with OMP critical statement GS. */
3787
3788 static inline void
3789 gimple_omp_critical_set_name (gimple gs, tree name)
3790 {
3791 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3792 gs->gimple_omp_critical.name = name;
3793 }
3794
3795
3796 /* Return the clauses associated with OMP_FOR GS. */
3797
3798 static inline tree
3799 gimple_omp_for_clauses (const_gimple gs)
3800 {
3801 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3802 return gs->gimple_omp_for.clauses;
3803 }
3804
3805
3806 /* Return a pointer to the OMP_FOR GS. */
3807
3808 static inline tree *
3809 gimple_omp_for_clauses_ptr (gimple gs)
3810 {
3811 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3812 return &gs->gimple_omp_for.clauses;
3813 }
3814
3815
3816 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3817
3818 static inline void
3819 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3820 {
3821 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3822 gs->gimple_omp_for.clauses = clauses;
3823 }
3824
3825
3826 /* Get the collapse count of OMP_FOR GS. */
3827
3828 static inline size_t
3829 gimple_omp_for_collapse (gimple gs)
3830 {
3831 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3832 return gs->gimple_omp_for.collapse;
3833 }
3834
3835
3836 /* Return the index variable for OMP_FOR GS. */
3837
3838 static inline tree
3839 gimple_omp_for_index (const_gimple gs, size_t i)
3840 {
3841 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3842 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3843 return gs->gimple_omp_for.iter[i].index;
3844 }
3845
3846
3847 /* Return a pointer to the index variable for OMP_FOR GS. */
3848
3849 static inline tree *
3850 gimple_omp_for_index_ptr (gimple gs, size_t i)
3851 {
3852 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3853 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3854 return &gs->gimple_omp_for.iter[i].index;
3855 }
3856
3857
3858 /* Set INDEX to be the index variable for OMP_FOR GS. */
3859
3860 static inline void
3861 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3862 {
3863 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3864 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3865 gs->gimple_omp_for.iter[i].index = index;
3866 }
3867
3868
3869 /* Return the initial value for OMP_FOR GS. */
3870
3871 static inline tree
3872 gimple_omp_for_initial (const_gimple gs, size_t i)
3873 {
3874 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3875 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3876 return gs->gimple_omp_for.iter[i].initial;
3877 }
3878
3879
3880 /* Return a pointer to the initial value for OMP_FOR GS. */
3881
3882 static inline tree *
3883 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3884 {
3885 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3886 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3887 return &gs->gimple_omp_for.iter[i].initial;
3888 }
3889
3890
3891 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3892
3893 static inline void
3894 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3895 {
3896 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3897 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3898 gs->gimple_omp_for.iter[i].initial = initial;
3899 }
3900
3901
3902 /* Return the final value for OMP_FOR GS. */
3903
3904 static inline tree
3905 gimple_omp_for_final (const_gimple gs, size_t i)
3906 {
3907 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3908 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3909 return gs->gimple_omp_for.iter[i].final;
3910 }
3911
3912
3913 /* Return a pointer to the final value for OMP_FOR GS. */
3914
3915 static inline tree *
3916 gimple_omp_for_final_ptr (gimple gs, size_t i)
3917 {
3918 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3919 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3920 return &gs->gimple_omp_for.iter[i].final;
3921 }
3922
3923
3924 /* Set FINAL to be the final value for OMP_FOR GS. */
3925
3926 static inline void
3927 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3928 {
3929 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3930 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3931 gs->gimple_omp_for.iter[i].final = final;
3932 }
3933
3934
3935 /* Return the increment value for OMP_FOR GS. */
3936
3937 static inline tree
3938 gimple_omp_for_incr (const_gimple gs, size_t i)
3939 {
3940 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3941 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3942 return gs->gimple_omp_for.iter[i].incr;
3943 }
3944
3945
3946 /* Return a pointer to the increment value for OMP_FOR GS. */
3947
3948 static inline tree *
3949 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3950 {
3951 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3952 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3953 return &gs->gimple_omp_for.iter[i].incr;
3954 }
3955
3956
3957 /* Set INCR to be the increment value for OMP_FOR GS. */
3958
3959 static inline void
3960 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3961 {
3962 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3963 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3964 gs->gimple_omp_for.iter[i].incr = incr;
3965 }
3966
3967
3968 /* Return the sequence of statements to execute before the OMP_FOR
3969 statement GS starts. */
3970
3971 static inline gimple_seq
3972 gimple_omp_for_pre_body (gimple gs)
3973 {
3974 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3975 return gs->gimple_omp_for.pre_body;
3976 }
3977
3978
3979 /* Set PRE_BODY to be the sequence of statements to execute before the
3980 OMP_FOR statement GS starts. */
3981
3982 static inline void
3983 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3984 {
3985 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3986 gs->gimple_omp_for.pre_body = pre_body;
3987 }
3988
3989
3990 /* Return the clauses associated with OMP_PARALLEL GS. */
3991
3992 static inline tree
3993 gimple_omp_parallel_clauses (const_gimple gs)
3994 {
3995 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3996 return gs->gimple_omp_parallel.clauses;
3997 }
3998
3999
4000 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4001
4002 static inline tree *
4003 gimple_omp_parallel_clauses_ptr (gimple gs)
4004 {
4005 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4006 return &gs->gimple_omp_parallel.clauses;
4007 }
4008
4009
4010 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4011 GS. */
4012
4013 static inline void
4014 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4015 {
4016 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4017 gs->gimple_omp_parallel.clauses = clauses;
4018 }
4019
4020
4021 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4022
4023 static inline tree
4024 gimple_omp_parallel_child_fn (const_gimple gs)
4025 {
4026 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4027 return gs->gimple_omp_parallel.child_fn;
4028 }
4029
4030 /* Return a pointer to the child function used to hold the body of
4031 OMP_PARALLEL GS. */
4032
4033 static inline tree *
4034 gimple_omp_parallel_child_fn_ptr (gimple gs)
4035 {
4036 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4037 return &gs->gimple_omp_parallel.child_fn;
4038 }
4039
4040
4041 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4042
4043 static inline void
4044 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4045 {
4046 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4047 gs->gimple_omp_parallel.child_fn = child_fn;
4048 }
4049
4050
4051 /* Return the artificial argument used to send variables and values
4052 from the parent to the children threads in OMP_PARALLEL GS. */
4053
4054 static inline tree
4055 gimple_omp_parallel_data_arg (const_gimple gs)
4056 {
4057 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4058 return gs->gimple_omp_parallel.data_arg;
4059 }
4060
4061
4062 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4063
4064 static inline tree *
4065 gimple_omp_parallel_data_arg_ptr (gimple gs)
4066 {
4067 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4068 return &gs->gimple_omp_parallel.data_arg;
4069 }
4070
4071
4072 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4073
4074 static inline void
4075 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4076 {
4077 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4078 gs->gimple_omp_parallel.data_arg = data_arg;
4079 }
4080
4081
4082 /* Return the clauses associated with OMP_TASK GS. */
4083
4084 static inline tree
4085 gimple_omp_task_clauses (const_gimple gs)
4086 {
4087 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4088 return gs->gimple_omp_parallel.clauses;
4089 }
4090
4091
4092 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4093
4094 static inline tree *
4095 gimple_omp_task_clauses_ptr (gimple gs)
4096 {
4097 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4098 return &gs->gimple_omp_parallel.clauses;
4099 }
4100
4101
4102 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4103 GS. */
4104
4105 static inline void
4106 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4107 {
4108 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4109 gs->gimple_omp_parallel.clauses = clauses;
4110 }
4111
4112
4113 /* Return the child function used to hold the body of OMP_TASK GS. */
4114
4115 static inline tree
4116 gimple_omp_task_child_fn (const_gimple gs)
4117 {
4118 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4119 return gs->gimple_omp_parallel.child_fn;
4120 }
4121
4122 /* Return a pointer to the child function used to hold the body of
4123 OMP_TASK GS. */
4124
4125 static inline tree *
4126 gimple_omp_task_child_fn_ptr (gimple gs)
4127 {
4128 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4129 return &gs->gimple_omp_parallel.child_fn;
4130 }
4131
4132
4133 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4134
4135 static inline void
4136 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4137 {
4138 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4139 gs->gimple_omp_parallel.child_fn = child_fn;
4140 }
4141
4142
4143 /* Return the artificial argument used to send variables and values
4144 from the parent to the children threads in OMP_TASK GS. */
4145
4146 static inline tree
4147 gimple_omp_task_data_arg (const_gimple gs)
4148 {
4149 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4150 return gs->gimple_omp_parallel.data_arg;
4151 }
4152
4153
4154 /* Return a pointer to the data argument for OMP_TASK GS. */
4155
4156 static inline tree *
4157 gimple_omp_task_data_arg_ptr (gimple gs)
4158 {
4159 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4160 return &gs->gimple_omp_parallel.data_arg;
4161 }
4162
4163
4164 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4165
4166 static inline void
4167 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4168 {
4169 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4170 gs->gimple_omp_parallel.data_arg = data_arg;
4171 }
4172
4173
4174 /* Return the clauses associated with OMP_TASK GS. */
4175
4176 static inline tree
4177 gimple_omp_taskreg_clauses (const_gimple gs)
4178 {
4179 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4180 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4181 return gs->gimple_omp_parallel.clauses;
4182 }
4183
4184
4185 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4186
4187 static inline tree *
4188 gimple_omp_taskreg_clauses_ptr (gimple gs)
4189 {
4190 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4191 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4192 return &gs->gimple_omp_parallel.clauses;
4193 }
4194
4195
4196 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4197 GS. */
4198
4199 static inline void
4200 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4201 {
4202 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4203 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4204 gs->gimple_omp_parallel.clauses = clauses;
4205 }
4206
4207
4208 /* Return the child function used to hold the body of OMP_TASK GS. */
4209
4210 static inline tree
4211 gimple_omp_taskreg_child_fn (const_gimple gs)
4212 {
4213 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4214 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4215 return gs->gimple_omp_parallel.child_fn;
4216 }
4217
4218 /* Return a pointer to the child function used to hold the body of
4219 OMP_TASK GS. */
4220
4221 static inline tree *
4222 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4223 {
4224 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4225 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4226 return &gs->gimple_omp_parallel.child_fn;
4227 }
4228
4229
4230 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4231
4232 static inline void
4233 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4234 {
4235 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4236 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4237 gs->gimple_omp_parallel.child_fn = child_fn;
4238 }
4239
4240
4241 /* Return the artificial argument used to send variables and values
4242 from the parent to the children threads in OMP_TASK GS. */
4243
4244 static inline tree
4245 gimple_omp_taskreg_data_arg (const_gimple gs)
4246 {
4247 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4248 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4249 return gs->gimple_omp_parallel.data_arg;
4250 }
4251
4252
4253 /* Return a pointer to the data argument for OMP_TASK GS. */
4254
4255 static inline tree *
4256 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4257 {
4258 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4259 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4260 return &gs->gimple_omp_parallel.data_arg;
4261 }
4262
4263
4264 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4265
4266 static inline void
4267 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4268 {
4269 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4270 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4271 gs->gimple_omp_parallel.data_arg = data_arg;
4272 }
4273
4274
4275 /* Return the copy function used to hold the body of OMP_TASK GS. */
4276
4277 static inline tree
4278 gimple_omp_task_copy_fn (const_gimple gs)
4279 {
4280 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4281 return gs->gimple_omp_task.copy_fn;
4282 }
4283
4284 /* Return a pointer to the copy function used to hold the body of
4285 OMP_TASK GS. */
4286
4287 static inline tree *
4288 gimple_omp_task_copy_fn_ptr (gimple gs)
4289 {
4290 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4291 return &gs->gimple_omp_task.copy_fn;
4292 }
4293
4294
4295 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4296
4297 static inline void
4298 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4299 {
4300 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4301 gs->gimple_omp_task.copy_fn = copy_fn;
4302 }
4303
4304
4305 /* Return size of the data block in bytes in OMP_TASK GS. */
4306
4307 static inline tree
4308 gimple_omp_task_arg_size (const_gimple gs)
4309 {
4310 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4311 return gs->gimple_omp_task.arg_size;
4312 }
4313
4314
4315 /* Return a pointer to the data block size for OMP_TASK GS. */
4316
4317 static inline tree *
4318 gimple_omp_task_arg_size_ptr (gimple gs)
4319 {
4320 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4321 return &gs->gimple_omp_task.arg_size;
4322 }
4323
4324
4325 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4326
4327 static inline void
4328 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4329 {
4330 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4331 gs->gimple_omp_task.arg_size = arg_size;
4332 }
4333
4334
4335 /* Return align of the data block in bytes in OMP_TASK GS. */
4336
4337 static inline tree
4338 gimple_omp_task_arg_align (const_gimple gs)
4339 {
4340 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4341 return gs->gimple_omp_task.arg_align;
4342 }
4343
4344
4345 /* Return a pointer to the data block align for OMP_TASK GS. */
4346
4347 static inline tree *
4348 gimple_omp_task_arg_align_ptr (gimple gs)
4349 {
4350 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4351 return &gs->gimple_omp_task.arg_align;
4352 }
4353
4354
4355 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4356
4357 static inline void
4358 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4359 {
4360 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4361 gs->gimple_omp_task.arg_align = arg_align;
4362 }
4363
4364
4365 /* Return the clauses associated with OMP_SINGLE GS. */
4366
4367 static inline tree
4368 gimple_omp_single_clauses (const_gimple gs)
4369 {
4370 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4371 return gs->gimple_omp_single.clauses;
4372 }
4373
4374
4375 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4376
4377 static inline tree *
4378 gimple_omp_single_clauses_ptr (gimple gs)
4379 {
4380 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4381 return &gs->gimple_omp_single.clauses;
4382 }
4383
4384
4385 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4386
4387 static inline void
4388 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4389 {
4390 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4391 gs->gimple_omp_single.clauses = clauses;
4392 }
4393
4394
4395 /* Return the clauses associated with OMP_SECTIONS GS. */
4396
4397 static inline tree
4398 gimple_omp_sections_clauses (const_gimple gs)
4399 {
4400 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4401 return gs->gimple_omp_sections.clauses;
4402 }
4403
4404
4405 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4406
4407 static inline tree *
4408 gimple_omp_sections_clauses_ptr (gimple gs)
4409 {
4410 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4411 return &gs->gimple_omp_sections.clauses;
4412 }
4413
4414
4415 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4416 GS. */
4417
4418 static inline void
4419 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4420 {
4421 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4422 gs->gimple_omp_sections.clauses = clauses;
4423 }
4424
4425
4426 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4427 in GS. */
4428
4429 static inline tree
4430 gimple_omp_sections_control (const_gimple gs)
4431 {
4432 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4433 return gs->gimple_omp_sections.control;
4434 }
4435
4436
4437 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4438 GS. */
4439
4440 static inline tree *
4441 gimple_omp_sections_control_ptr (gimple gs)
4442 {
4443 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4444 return &gs->gimple_omp_sections.control;
4445 }
4446
4447
4448 /* Set CONTROL to be the set of clauses associated with the
4449 GIMPLE_OMP_SECTIONS in GS. */
4450
4451 static inline void
4452 gimple_omp_sections_set_control (gimple gs, tree control)
4453 {
4454 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4455 gs->gimple_omp_sections.control = control;
4456 }
4457
4458
4459 /* Set COND to be the condition code for OMP_FOR GS. */
4460
4461 static inline void
4462 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4463 {
4464 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4465 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4466 && i < gs->gimple_omp_for.collapse);
4467 gs->gimple_omp_for.iter[i].cond = cond;
4468 }
4469
4470
4471 /* Return the condition code associated with OMP_FOR GS. */
4472
4473 static inline enum tree_code
4474 gimple_omp_for_cond (const_gimple gs, size_t i)
4475 {
4476 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4477 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4478 return gs->gimple_omp_for.iter[i].cond;
4479 }
4480
4481
4482 /* Set the value being stored in an atomic store. */
4483
4484 static inline void
4485 gimple_omp_atomic_store_set_val (gimple g, tree val)
4486 {
4487 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4488 g->gimple_omp_atomic_store.val = val;
4489 }
4490
4491
4492 /* Return the value being stored in an atomic store. */
4493
4494 static inline tree
4495 gimple_omp_atomic_store_val (const_gimple g)
4496 {
4497 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4498 return g->gimple_omp_atomic_store.val;
4499 }
4500
4501
4502 /* Return a pointer to the value being stored in an atomic store. */
4503
4504 static inline tree *
4505 gimple_omp_atomic_store_val_ptr (gimple g)
4506 {
4507 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4508 return &g->gimple_omp_atomic_store.val;
4509 }
4510
4511
4512 /* Set the LHS of an atomic load. */
4513
4514 static inline void
4515 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4516 {
4517 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4518 g->gimple_omp_atomic_load.lhs = lhs;
4519 }
4520
4521
4522 /* Get the LHS of an atomic load. */
4523
4524 static inline tree
4525 gimple_omp_atomic_load_lhs (const_gimple g)
4526 {
4527 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4528 return g->gimple_omp_atomic_load.lhs;
4529 }
4530
4531
4532 /* Return a pointer to the LHS of an atomic load. */
4533
4534 static inline tree *
4535 gimple_omp_atomic_load_lhs_ptr (gimple g)
4536 {
4537 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4538 return &g->gimple_omp_atomic_load.lhs;
4539 }
4540
4541
4542 /* Set the RHS of an atomic load. */
4543
4544 static inline void
4545 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4546 {
4547 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4548 g->gimple_omp_atomic_load.rhs = rhs;
4549 }
4550
4551
4552 /* Get the RHS of an atomic load. */
4553
4554 static inline tree
4555 gimple_omp_atomic_load_rhs (const_gimple g)
4556 {
4557 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4558 return g->gimple_omp_atomic_load.rhs;
4559 }
4560
4561
4562 /* Return a pointer to the RHS of an atomic load. */
4563
4564 static inline tree *
4565 gimple_omp_atomic_load_rhs_ptr (gimple g)
4566 {
4567 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4568 return &g->gimple_omp_atomic_load.rhs;
4569 }
4570
4571
4572 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4573
4574 static inline tree
4575 gimple_omp_continue_control_def (const_gimple g)
4576 {
4577 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4578 return g->gimple_omp_continue.control_def;
4579 }
4580
4581 /* The same as above, but return the address. */
4582
4583 static inline tree *
4584 gimple_omp_continue_control_def_ptr (gimple g)
4585 {
4586 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4587 return &g->gimple_omp_continue.control_def;
4588 }
4589
4590 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4591
4592 static inline void
4593 gimple_omp_continue_set_control_def (gimple g, tree def)
4594 {
4595 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4596 g->gimple_omp_continue.control_def = def;
4597 }
4598
4599
4600 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4601
4602 static inline tree
4603 gimple_omp_continue_control_use (const_gimple g)
4604 {
4605 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4606 return g->gimple_omp_continue.control_use;
4607 }
4608
4609
4610 /* The same as above, but return the address. */
4611
4612 static inline tree *
4613 gimple_omp_continue_control_use_ptr (gimple g)
4614 {
4615 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4616 return &g->gimple_omp_continue.control_use;
4617 }
4618
4619
4620 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4621
4622 static inline void
4623 gimple_omp_continue_set_control_use (gimple g, tree use)
4624 {
4625 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4626 g->gimple_omp_continue.control_use = use;
4627 }
4628
4629 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4630
4631 static inline gimple_seq
4632 gimple_transaction_body (gimple gs)
4633 {
4634 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4635 return gs->gimple_transaction.body;
4636 }
4637
4638 /* Return the label associated with a GIMPLE_TRANSACTION. */
4639
4640 static inline tree
4641 gimple_transaction_label (const_gimple gs)
4642 {
4643 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4644 return gs->gimple_transaction.label;
4645 }
4646
4647 static inline tree *
4648 gimple_transaction_label_ptr (gimple gs)
4649 {
4650 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4651 return &gs->gimple_transaction.label;
4652 }
4653
4654 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4655
4656 static inline unsigned int
4657 gimple_transaction_subcode (const_gimple gs)
4658 {
4659 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4660 return gs->gsbase.subcode;
4661 }
4662
4663 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4664
4665 static inline void
4666 gimple_transaction_set_body (gimple gs, gimple_seq body)
4667 {
4668 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4669 gs->gimple_transaction.body = body;
4670 }
4671
4672 /* Set the label associated with a GIMPLE_TRANSACTION. */
4673
4674 static inline void
4675 gimple_transaction_set_label (gimple gs, tree label)
4676 {
4677 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4678 gs->gimple_transaction.label = label;
4679 }
4680
4681 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4682
4683 static inline void
4684 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4685 {
4686 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4687 gs->gsbase.subcode = subcode;
4688 }
4689
4690
4691 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4692
4693 static inline tree *
4694 gimple_return_retval_ptr (const_gimple gs)
4695 {
4696 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4697 return gimple_op_ptr (gs, 0);
4698 }
4699
4700 /* Return the return value for GIMPLE_RETURN GS. */
4701
4702 static inline tree
4703 gimple_return_retval (const_gimple gs)
4704 {
4705 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4706 return gimple_op (gs, 0);
4707 }
4708
4709
4710 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4711
4712 static inline void
4713 gimple_return_set_retval (gimple gs, tree retval)
4714 {
4715 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4716 gimple_set_op (gs, 0, retval);
4717 }
4718
4719
4720 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4721
4722 #define CASE_GIMPLE_OMP \
4723 case GIMPLE_OMP_PARALLEL: \
4724 case GIMPLE_OMP_TASK: \
4725 case GIMPLE_OMP_FOR: \
4726 case GIMPLE_OMP_SECTIONS: \
4727 case GIMPLE_OMP_SECTIONS_SWITCH: \
4728 case GIMPLE_OMP_SINGLE: \
4729 case GIMPLE_OMP_SECTION: \
4730 case GIMPLE_OMP_MASTER: \
4731 case GIMPLE_OMP_ORDERED: \
4732 case GIMPLE_OMP_CRITICAL: \
4733 case GIMPLE_OMP_RETURN: \
4734 case GIMPLE_OMP_ATOMIC_LOAD: \
4735 case GIMPLE_OMP_ATOMIC_STORE: \
4736 case GIMPLE_OMP_CONTINUE
4737
4738 static inline bool
4739 is_gimple_omp (const_gimple stmt)
4740 {
4741 switch (gimple_code (stmt))
4742 {
4743 CASE_GIMPLE_OMP:
4744 return true;
4745 default:
4746 return false;
4747 }
4748 }
4749
4750
4751 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4752
4753 static inline bool
4754 gimple_nop_p (const_gimple g)
4755 {
4756 return gimple_code (g) == GIMPLE_NOP;
4757 }
4758
4759
4760 /* Return true if GS is a GIMPLE_RESX. */
4761
4762 static inline bool
4763 is_gimple_resx (const_gimple gs)
4764 {
4765 return gimple_code (gs) == GIMPLE_RESX;
4766 }
4767
4768 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4769
4770 static inline enum br_predictor
4771 gimple_predict_predictor (gimple gs)
4772 {
4773 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4774 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4775 }
4776
4777
4778 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4779
4780 static inline void
4781 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4782 {
4783 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4784 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4785 | (unsigned) predictor;
4786 }
4787
4788
4789 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4790
4791 static inline enum prediction
4792 gimple_predict_outcome (gimple gs)
4793 {
4794 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4795 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4796 }
4797
4798
4799 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4800
4801 static inline void
4802 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4803 {
4804 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4805 if (outcome == TAKEN)
4806 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4807 else
4808 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4809 }
4810
4811
4812 /* Return the type of the main expression computed by STMT. Return
4813 void_type_node if the statement computes nothing. */
4814
4815 static inline tree
4816 gimple_expr_type (const_gimple stmt)
4817 {
4818 enum gimple_code code = gimple_code (stmt);
4819
4820 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4821 {
4822 tree type;
4823 /* In general we want to pass out a type that can be substituted
4824 for both the RHS and the LHS types if there is a possibly
4825 useless conversion involved. That means returning the
4826 original RHS type as far as we can reconstruct it. */
4827 if (code == GIMPLE_CALL)
4828 type = gimple_call_return_type (stmt);
4829 else
4830 switch (gimple_assign_rhs_code (stmt))
4831 {
4832 case POINTER_PLUS_EXPR:
4833 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4834 break;
4835
4836 default:
4837 /* As fallback use the type of the LHS. */
4838 type = TREE_TYPE (gimple_get_lhs (stmt));
4839 break;
4840 }
4841 return type;
4842 }
4843 else if (code == GIMPLE_COND)
4844 return boolean_type_node;
4845 else
4846 return void_type_node;
4847 }
4848
4849 /* Return true if TYPE is a suitable type for a scalar register variable. */
4850
4851 static inline bool
4852 is_gimple_reg_type (tree type)
4853 {
4854 return !AGGREGATE_TYPE_P (type);
4855 }
4856
4857 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4858
4859 static inline gimple_stmt_iterator
4860 gsi_start (gimple_seq seq)
4861 {
4862 gimple_stmt_iterator i;
4863
4864 i.ptr = gimple_seq_first (seq);
4865 i.seq = seq;
4866 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4867
4868 return i;
4869 }
4870
4871
4872 /* Return a new iterator pointing to the first statement in basic block BB. */
4873
4874 static inline gimple_stmt_iterator
4875 gsi_start_bb (basic_block bb)
4876 {
4877 gimple_stmt_iterator i;
4878 gimple_seq seq;
4879
4880 seq = bb_seq (bb);
4881 i.ptr = gimple_seq_first (seq);
4882 i.seq = seq;
4883 i.bb = bb;
4884
4885 return i;
4886 }
4887
4888
4889 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4890
4891 static inline gimple_stmt_iterator
4892 gsi_last (gimple_seq seq)
4893 {
4894 gimple_stmt_iterator i;
4895
4896 i.ptr = gimple_seq_last (seq);
4897 i.seq = seq;
4898 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4899
4900 return i;
4901 }
4902
4903
4904 /* Return a new iterator pointing to the last statement in basic block BB. */
4905
4906 static inline gimple_stmt_iterator
4907 gsi_last_bb (basic_block bb)
4908 {
4909 gimple_stmt_iterator i;
4910 gimple_seq seq;
4911
4912 seq = bb_seq (bb);
4913 i.ptr = gimple_seq_last (seq);
4914 i.seq = seq;
4915 i.bb = bb;
4916
4917 return i;
4918 }
4919
4920
4921 /* Return true if I is at the end of its sequence. */
4922
4923 static inline bool
4924 gsi_end_p (gimple_stmt_iterator i)
4925 {
4926 return i.ptr == NULL;
4927 }
4928
4929
4930 /* Return true if I is one statement before the end of its sequence. */
4931
4932 static inline bool
4933 gsi_one_before_end_p (gimple_stmt_iterator i)
4934 {
4935 return i.ptr != NULL && i.ptr->next == NULL;
4936 }
4937
4938
4939 /* Advance the iterator to the next gimple statement. */
4940
4941 static inline void
4942 gsi_next (gimple_stmt_iterator *i)
4943 {
4944 i->ptr = i->ptr->next;
4945 }
4946
4947 /* Advance the iterator to the previous gimple statement. */
4948
4949 static inline void
4950 gsi_prev (gimple_stmt_iterator *i)
4951 {
4952 i->ptr = i->ptr->prev;
4953 }
4954
4955 /* Return the current stmt. */
4956
4957 static inline gimple
4958 gsi_stmt (gimple_stmt_iterator i)
4959 {
4960 return i.ptr->stmt;
4961 }
4962
4963 /* Return a block statement iterator that points to the first non-label
4964 statement in block BB. */
4965
4966 static inline gimple_stmt_iterator
4967 gsi_after_labels (basic_block bb)
4968 {
4969 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4970
4971 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4972 gsi_next (&gsi);
4973
4974 return gsi;
4975 }
4976
4977 /* Advance the iterator to the next non-debug gimple statement. */
4978
4979 static inline void
4980 gsi_next_nondebug (gimple_stmt_iterator *i)
4981 {
4982 do
4983 {
4984 gsi_next (i);
4985 }
4986 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4987 }
4988
4989 /* Advance the iterator to the next non-debug gimple statement. */
4990
4991 static inline void
4992 gsi_prev_nondebug (gimple_stmt_iterator *i)
4993 {
4994 do
4995 {
4996 gsi_prev (i);
4997 }
4998 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4999 }
5000
5001 /* Return a new iterator pointing to the first non-debug statement in
5002 basic block BB. */
5003
5004 static inline gimple_stmt_iterator
5005 gsi_start_nondebug_bb (basic_block bb)
5006 {
5007 gimple_stmt_iterator i = gsi_start_bb (bb);
5008
5009 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5010 gsi_next_nondebug (&i);
5011
5012 return i;
5013 }
5014
5015 /* Return a new iterator pointing to the last non-debug statement in
5016 basic block BB. */
5017
5018 static inline gimple_stmt_iterator
5019 gsi_last_nondebug_bb (basic_block bb)
5020 {
5021 gimple_stmt_iterator i = gsi_last_bb (bb);
5022
5023 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5024 gsi_prev_nondebug (&i);
5025
5026 return i;
5027 }
5028
5029 /* Return a pointer to the current stmt.
5030
5031 NOTE: You may want to use gsi_replace on the iterator itself,
5032 as this performs additional bookkeeping that will not be done
5033 if you simply assign through a pointer returned by gsi_stmt_ptr. */
5034
5035 static inline gimple *
5036 gsi_stmt_ptr (gimple_stmt_iterator *i)
5037 {
5038 return &i->ptr->stmt;
5039 }
5040
5041
5042 /* Return the basic block associated with this iterator. */
5043
5044 static inline basic_block
5045 gsi_bb (gimple_stmt_iterator i)
5046 {
5047 return i.bb;
5048 }
5049
5050
5051 /* Return the sequence associated with this iterator. */
5052
5053 static inline gimple_seq
5054 gsi_seq (gimple_stmt_iterator i)
5055 {
5056 return i.seq;
5057 }
5058
5059
5060 enum gsi_iterator_update
5061 {
5062 GSI_NEW_STMT, /* Only valid when single statement is added, move
5063 iterator to it. */
5064 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5065 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5066 for linking other statements in the same
5067 direction. */
5068 };
5069
5070 /* In gimple-iterator.c */
5071 gimple_stmt_iterator gsi_start_phis (basic_block);
5072 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5073 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
5074 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5075 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5076 enum gsi_iterator_update);
5077 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5078 enum gsi_iterator_update);
5079 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5080 enum gsi_iterator_update);
5081 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5082 enum gsi_iterator_update);
5083 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5084 enum gsi_iterator_update);
5085 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5086 enum gsi_iterator_update);
5087 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5088 enum gsi_iterator_update);
5089 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5090 enum gsi_iterator_update);
5091 bool gsi_remove (gimple_stmt_iterator *, bool);
5092 gimple_stmt_iterator gsi_for_stmt (gimple);
5093 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5094 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5095 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
5096 void gsi_insert_on_edge (edge, gimple);
5097 void gsi_insert_seq_on_edge (edge, gimple_seq);
5098 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5099 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5100 void gsi_commit_one_edge_insert (edge, basic_block *);
5101 void gsi_commit_edge_inserts (void);
5102 gimple gimple_call_copy_skip_args (gimple, bitmap);
5103
5104
5105 /* Convenience routines to walk all statements of a gimple function.
5106 Note that this is useful exclusively before the code is converted
5107 into SSA form. Once the program is in SSA form, the standard
5108 operand interface should be used to analyze/modify statements. */
5109 struct walk_stmt_info
5110 {
5111 /* Points to the current statement being walked. */
5112 gimple_stmt_iterator gsi;
5113
5114 /* Additional data that the callback functions may want to carry
5115 through the recursion. */
5116 void *info;
5117
5118 /* Pointer map used to mark visited tree nodes when calling
5119 walk_tree on each operand. If set to NULL, duplicate tree nodes
5120 will be visited more than once. */
5121 struct pointer_set_t *pset;
5122
5123 /* Operand returned by the callbacks. This is set when calling
5124 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5125 returns non-NULL, this field will contain the tree returned by
5126 the last callback. */
5127 tree callback_result;
5128
5129 /* Indicates whether the operand being examined may be replaced
5130 with something that matches is_gimple_val (if true) or something
5131 slightly more complicated (if false). "Something" technically
5132 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5133 but we never try to form anything more complicated than that, so
5134 we don't bother checking.
5135
5136 Also note that CALLBACK should update this flag while walking the
5137 sub-expressions of a statement. For instance, when walking the
5138 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5139 to true, however, when walking &var, the operand of that
5140 ADDR_EXPR does not need to be a GIMPLE value. */
5141 BOOL_BITFIELD val_only : 1;
5142
5143 /* True if we are currently walking the LHS of an assignment. */
5144 BOOL_BITFIELD is_lhs : 1;
5145
5146 /* Optional. Set to true by the callback functions if they made any
5147 changes. */
5148 BOOL_BITFIELD changed : 1;
5149
5150 /* True if we're interested in location information. */
5151 BOOL_BITFIELD want_locations : 1;
5152
5153 /* True if we've removed the statement that was processed. */
5154 BOOL_BITFIELD removed_stmt : 1;
5155 };
5156
5157 /* Callback for walk_gimple_stmt. Called for every statement found
5158 during traversal. The first argument points to the statement to
5159 walk. The second argument is a flag that the callback sets to
5160 'true' if it the callback handled all the operands and
5161 sub-statements of the statement (the default value of this flag is
5162 'false'). The third argument is an anonymous pointer to data
5163 to be used by the callback. */
5164 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5165 struct walk_stmt_info *);
5166
5167 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5168 struct walk_stmt_info *);
5169 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5170 struct walk_stmt_info *);
5171 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5172
5173 #ifdef GATHER_STATISTICS
5174 /* Enum and arrays used for allocation stats. Keep in sync with
5175 gimple.c:gimple_alloc_kind_names. */
5176 enum gimple_alloc_kind
5177 {
5178 gimple_alloc_kind_assign, /* Assignments. */
5179 gimple_alloc_kind_phi, /* PHI nodes. */
5180 gimple_alloc_kind_cond, /* Conditionals. */
5181 gimple_alloc_kind_seq, /* Sequences. */
5182 gimple_alloc_kind_rest, /* Everything else. */
5183 gimple_alloc_kind_all
5184 };
5185
5186 extern int gimple_alloc_counts[];
5187 extern int gimple_alloc_sizes[];
5188
5189 /* Return the allocation kind for a given stmt CODE. */
5190 static inline enum gimple_alloc_kind
5191 gimple_alloc_kind (enum gimple_code code)
5192 {
5193 switch (code)
5194 {
5195 case GIMPLE_ASSIGN:
5196 return gimple_alloc_kind_assign;
5197 case GIMPLE_PHI:
5198 return gimple_alloc_kind_phi;
5199 case GIMPLE_COND:
5200 return gimple_alloc_kind_cond;
5201 default:
5202 return gimple_alloc_kind_rest;
5203 }
5204 }
5205 #endif /* GATHER_STATISTICS */
5206
5207 extern void dump_gimple_statistics (void);
5208
5209 /* In gimple-fold.c. */
5210 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5211 tree gimple_fold_builtin (gimple);
5212 bool fold_stmt (gimple_stmt_iterator *);
5213 bool fold_stmt_inplace (gimple_stmt_iterator *);
5214 tree get_symbol_constant_value (tree);
5215 tree canonicalize_constructor_val (tree);
5216 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5217 enum tree_code, tree, tree);
5218 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5219 enum tree_code, tree, tree);
5220
5221 bool gimple_val_nonnegative_real_p (tree);
5222 #endif /* GCC_GIMPLE_H */