gimple-iterator.c (gsi_remove): Return whether EH edges need to be cleanup.
[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 /* Returns true iff T is a valid GIMPLE statement. */
965 extern bool is_gimple_stmt (tree);
966
967 /* Returns true iff T is a scalar register variable. */
968 extern bool is_gimple_reg (tree);
969 /* Returns true iff T is any sort of variable. */
970 extern bool is_gimple_variable (tree);
971 /* Returns true iff T is any sort of symbol. */
972 extern bool is_gimple_id (tree);
973 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
974 extern bool is_gimple_min_lval (tree);
975 /* Returns true iff T is something whose address can be taken. */
976 extern bool is_gimple_addressable (tree);
977 /* Returns true iff T is any valid GIMPLE lvalue. */
978 extern bool is_gimple_lvalue (tree);
979
980 /* Returns true iff T is a GIMPLE address. */
981 bool is_gimple_address (const_tree);
982 /* Returns true iff T is a GIMPLE invariant address. */
983 bool is_gimple_invariant_address (const_tree);
984 /* Returns true iff T is a GIMPLE invariant address at interprocedural
985 level. */
986 bool is_gimple_ip_invariant_address (const_tree);
987 /* Returns true iff T is a valid GIMPLE constant. */
988 bool is_gimple_constant (const_tree);
989 /* Returns true iff T is a GIMPLE restricted function invariant. */
990 extern bool is_gimple_min_invariant (const_tree);
991 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
992 extern bool is_gimple_ip_invariant (const_tree);
993 /* Returns true iff T is a GIMPLE rvalue. */
994 extern bool is_gimple_val (tree);
995 /* Returns true iff T is a GIMPLE asm statement input. */
996 extern bool is_gimple_asm_val (tree);
997 /* Returns true iff T is a valid address operand of a MEM_REF. */
998 bool is_gimple_mem_ref_addr (tree);
999 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
1000 GIMPLE temporary, a renamed user variable, or something else,
1001 respectively. */
1002 extern bool is_gimple_reg_rhs (tree);
1003 extern bool is_gimple_mem_rhs (tree);
1004
1005 /* Returns true iff T is a valid if-statement condition. */
1006 extern bool is_gimple_condexpr (tree);
1007
1008 /* Returns true iff T is a valid call address expression. */
1009 extern bool is_gimple_call_addr (tree);
1010
1011 extern void recalculate_side_effects (tree);
1012 extern bool gimple_compare_field_offset (tree, tree);
1013 extern tree gimple_register_type (tree);
1014 extern tree gimple_register_canonical_type (tree);
1015 extern void print_gimple_types_stats (void);
1016 extern void free_gimple_type_tables (void);
1017 extern tree gimple_unsigned_type (tree);
1018 extern tree gimple_signed_type (tree);
1019 extern alias_set_type gimple_get_alias_set (tree);
1020 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
1021 unsigned *);
1022 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
1023 bool (*)(gimple, tree, void *),
1024 bool (*)(gimple, tree, void *),
1025 bool (*)(gimple, tree, void *));
1026 extern bool walk_stmt_load_store_ops (gimple, void *,
1027 bool (*)(gimple, tree, void *),
1028 bool (*)(gimple, tree, void *));
1029 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1030 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1031 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1032
1033 /* In gimplify.c */
1034 extern tree create_tmp_var_raw (tree, const char *);
1035 extern tree create_tmp_var_name (const char *);
1036 extern tree create_tmp_var (tree, const char *);
1037 extern tree create_tmp_reg (tree, const char *);
1038 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
1039 extern tree get_formal_tmp_var (tree, gimple_seq *);
1040 extern void declare_vars (tree, gimple, bool);
1041 extern void annotate_all_with_location (gimple_seq, location_t);
1042
1043 /* Validation of GIMPLE expressions. Note that these predicates only check
1044 the basic form of the expression, they don't recurse to make sure that
1045 underlying nodes are also of the right form. */
1046 typedef bool (*gimple_predicate)(tree);
1047
1048
1049 /* FIXME we should deduce this from the predicate. */
1050 enum fallback {
1051 fb_none = 0, /* Do not generate a temporary. */
1052
1053 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1054 gimplified expression. */
1055
1056 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1057 gimplified expression. */
1058
1059 fb_mayfail = 4, /* Gimplification may fail. Error issued
1060 afterwards. */
1061 fb_either= fb_rvalue | fb_lvalue
1062 };
1063
1064 typedef int fallback_t;
1065
1066 enum gimplify_status {
1067 GS_ERROR = -2, /* Something Bad Seen. */
1068 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1069 GS_OK = 0, /* We did something, maybe more to do. */
1070 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1071 };
1072
1073 struct gimplify_ctx
1074 {
1075 struct gimplify_ctx *prev_context;
1076
1077 VEC(gimple,heap) *bind_expr_stack;
1078 tree temps;
1079 gimple_seq conditional_cleanups;
1080 tree exit_label;
1081 tree return_temp;
1082
1083 VEC(tree,heap) *case_labels;
1084 /* The formal temporary table. Should this be persistent? */
1085 htab_t temp_htab;
1086
1087 int conditions;
1088 bool save_stack;
1089 bool into_ssa;
1090 bool allow_rhs_cond_expr;
1091 bool in_cleanup_point_expr;
1092 };
1093
1094 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1095 bool (*) (tree), fallback_t);
1096 extern void gimplify_type_sizes (tree, gimple_seq *);
1097 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1098 extern bool gimplify_stmt (tree *, gimple_seq *);
1099 extern gimple gimplify_body (tree, bool);
1100 extern void push_gimplify_context (struct gimplify_ctx *);
1101 extern void pop_gimplify_context (gimple);
1102 extern void gimplify_and_add (tree, gimple_seq *);
1103
1104 /* Miscellaneous helpers. */
1105 extern void gimple_add_tmp_var (tree);
1106 extern gimple gimple_current_bind_expr (void);
1107 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1108 extern tree voidify_wrapper_expr (tree, tree);
1109 extern tree build_and_jump (tree *);
1110 extern tree force_labels_r (tree *, int *, void *);
1111 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1112 gimple_seq *);
1113 struct gimplify_omp_ctx;
1114 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1115 extern tree gimple_boolify (tree);
1116 extern gimple_predicate rhs_predicate_for (tree);
1117 extern tree canonicalize_cond_expr_cond (tree);
1118
1119 /* In omp-low.c. */
1120 extern tree omp_reduction_init (tree, tree);
1121
1122 /* In trans-mem.c. */
1123 extern void diagnose_tm_safe_errors (tree);
1124 extern void compute_transaction_bits (void);
1125
1126 /* In tree-nested.c. */
1127 extern void lower_nested_functions (tree);
1128 extern void insert_field_into_struct (tree, tree);
1129
1130 /* In gimplify.c. */
1131 extern void gimplify_function_tree (tree);
1132
1133 /* In cfgexpand.c. */
1134 extern tree gimple_assign_rhs_to_tree (gimple);
1135
1136 /* In builtins.c */
1137 extern bool validate_gimple_arglist (const_gimple, ...);
1138
1139 /* In tree-ssa.c */
1140 extern bool tree_ssa_useless_type_conversion (tree);
1141 extern tree tree_ssa_strip_useless_type_conversions (tree);
1142 extern bool useless_type_conversion_p (tree, tree);
1143 extern bool types_compatible_p (tree, tree);
1144
1145 /* Return the code for GIMPLE statement G. */
1146
1147 static inline enum gimple_code
1148 gimple_code (const_gimple g)
1149 {
1150 return g->gsbase.code;
1151 }
1152
1153
1154 /* Return the GSS code used by a GIMPLE code. */
1155
1156 static inline enum gimple_statement_structure_enum
1157 gss_for_code (enum gimple_code code)
1158 {
1159 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1160 return gss_for_code_[code];
1161 }
1162
1163
1164 /* Return which GSS code is used by GS. */
1165
1166 static inline enum gimple_statement_structure_enum
1167 gimple_statement_structure (gimple gs)
1168 {
1169 return gss_for_code (gimple_code (gs));
1170 }
1171
1172
1173 /* Return true if statement G has sub-statements. This is only true for
1174 High GIMPLE statements. */
1175
1176 static inline bool
1177 gimple_has_substatements (gimple g)
1178 {
1179 switch (gimple_code (g))
1180 {
1181 case GIMPLE_BIND:
1182 case GIMPLE_CATCH:
1183 case GIMPLE_EH_FILTER:
1184 case GIMPLE_EH_ELSE:
1185 case GIMPLE_TRY:
1186 case GIMPLE_OMP_FOR:
1187 case GIMPLE_OMP_MASTER:
1188 case GIMPLE_OMP_ORDERED:
1189 case GIMPLE_OMP_SECTION:
1190 case GIMPLE_OMP_PARALLEL:
1191 case GIMPLE_OMP_TASK:
1192 case GIMPLE_OMP_SECTIONS:
1193 case GIMPLE_OMP_SINGLE:
1194 case GIMPLE_OMP_CRITICAL:
1195 case GIMPLE_WITH_CLEANUP_EXPR:
1196 case GIMPLE_TRANSACTION:
1197 return true;
1198
1199 default:
1200 return false;
1201 }
1202 }
1203
1204
1205 /* Return the basic block holding statement G. */
1206
1207 static inline struct basic_block_def *
1208 gimple_bb (const_gimple g)
1209 {
1210 return g->gsbase.bb;
1211 }
1212
1213
1214 /* Return the lexical scope block holding statement G. */
1215
1216 static inline tree
1217 gimple_block (const_gimple g)
1218 {
1219 return g->gsbase.block;
1220 }
1221
1222
1223 /* Set BLOCK to be the lexical scope block holding statement G. */
1224
1225 static inline void
1226 gimple_set_block (gimple g, tree block)
1227 {
1228 g->gsbase.block = block;
1229 }
1230
1231
1232 /* Return location information for statement G. */
1233
1234 static inline location_t
1235 gimple_location (const_gimple g)
1236 {
1237 return g->gsbase.location;
1238 }
1239
1240 /* Return pointer to location information for statement G. */
1241
1242 static inline const location_t *
1243 gimple_location_ptr (const_gimple g)
1244 {
1245 return &g->gsbase.location;
1246 }
1247
1248
1249 /* Set location information for statement G. */
1250
1251 static inline void
1252 gimple_set_location (gimple g, location_t location)
1253 {
1254 g->gsbase.location = location;
1255 }
1256
1257
1258 /* Return true if G contains location information. */
1259
1260 static inline bool
1261 gimple_has_location (const_gimple g)
1262 {
1263 return gimple_location (g) != UNKNOWN_LOCATION;
1264 }
1265
1266
1267 /* Return the file name of the location of STMT. */
1268
1269 static inline const char *
1270 gimple_filename (const_gimple stmt)
1271 {
1272 return LOCATION_FILE (gimple_location (stmt));
1273 }
1274
1275
1276 /* Return the line number of the location of STMT. */
1277
1278 static inline int
1279 gimple_lineno (const_gimple stmt)
1280 {
1281 return LOCATION_LINE (gimple_location (stmt));
1282 }
1283
1284
1285 /* Determine whether SEQ is a singleton. */
1286
1287 static inline bool
1288 gimple_seq_singleton_p (gimple_seq seq)
1289 {
1290 return ((gimple_seq_first (seq) != NULL)
1291 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1292 }
1293
1294 /* Return true if no warnings should be emitted for statement STMT. */
1295
1296 static inline bool
1297 gimple_no_warning_p (const_gimple stmt)
1298 {
1299 return stmt->gsbase.no_warning;
1300 }
1301
1302 /* Set the no_warning flag of STMT to NO_WARNING. */
1303
1304 static inline void
1305 gimple_set_no_warning (gimple stmt, bool no_warning)
1306 {
1307 stmt->gsbase.no_warning = (unsigned) no_warning;
1308 }
1309
1310 /* Set the visited status on statement STMT to VISITED_P. */
1311
1312 static inline void
1313 gimple_set_visited (gimple stmt, bool visited_p)
1314 {
1315 stmt->gsbase.visited = (unsigned) visited_p;
1316 }
1317
1318
1319 /* Return the visited status for statement STMT. */
1320
1321 static inline bool
1322 gimple_visited_p (gimple stmt)
1323 {
1324 return stmt->gsbase.visited;
1325 }
1326
1327
1328 /* Set pass local flag PLF on statement STMT to VAL_P. */
1329
1330 static inline void
1331 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1332 {
1333 if (val_p)
1334 stmt->gsbase.plf |= (unsigned int) plf;
1335 else
1336 stmt->gsbase.plf &= ~((unsigned int) plf);
1337 }
1338
1339
1340 /* Return the value of pass local flag PLF on statement STMT. */
1341
1342 static inline unsigned int
1343 gimple_plf (gimple stmt, enum plf_mask plf)
1344 {
1345 return stmt->gsbase.plf & ((unsigned int) plf);
1346 }
1347
1348
1349 /* Set the UID of statement. */
1350
1351 static inline void
1352 gimple_set_uid (gimple g, unsigned uid)
1353 {
1354 g->gsbase.uid = uid;
1355 }
1356
1357
1358 /* Return the UID of statement. */
1359
1360 static inline unsigned
1361 gimple_uid (const_gimple g)
1362 {
1363 return g->gsbase.uid;
1364 }
1365
1366
1367 /* Return true if GIMPLE statement G has register or memory operands. */
1368
1369 static inline bool
1370 gimple_has_ops (const_gimple g)
1371 {
1372 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1373 }
1374
1375
1376 /* Return true if GIMPLE statement G has memory operands. */
1377
1378 static inline bool
1379 gimple_has_mem_ops (const_gimple g)
1380 {
1381 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1382 }
1383
1384
1385 /* Return the set of DEF operands for statement G. */
1386
1387 static inline struct def_optype_d *
1388 gimple_def_ops (const_gimple g)
1389 {
1390 if (!gimple_has_ops (g))
1391 return NULL;
1392 return g->gsops.opbase.def_ops;
1393 }
1394
1395
1396 /* Set DEF to be the set of DEF operands for statement G. */
1397
1398 static inline void
1399 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1400 {
1401 gcc_gimple_checking_assert (gimple_has_ops (g));
1402 g->gsops.opbase.def_ops = def;
1403 }
1404
1405
1406 /* Return the set of USE operands for statement G. */
1407
1408 static inline struct use_optype_d *
1409 gimple_use_ops (const_gimple g)
1410 {
1411 if (!gimple_has_ops (g))
1412 return NULL;
1413 return g->gsops.opbase.use_ops;
1414 }
1415
1416
1417 /* Set USE to be the set of USE operands for statement G. */
1418
1419 static inline void
1420 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1421 {
1422 gcc_gimple_checking_assert (gimple_has_ops (g));
1423 g->gsops.opbase.use_ops = use;
1424 }
1425
1426
1427 /* Return the set of VUSE operand for statement G. */
1428
1429 static inline use_operand_p
1430 gimple_vuse_op (const_gimple g)
1431 {
1432 struct use_optype_d *ops;
1433 if (!gimple_has_mem_ops (g))
1434 return NULL_USE_OPERAND_P;
1435 ops = g->gsops.opbase.use_ops;
1436 if (ops
1437 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1438 return USE_OP_PTR (ops);
1439 return NULL_USE_OPERAND_P;
1440 }
1441
1442 /* Return the set of VDEF operand for statement G. */
1443
1444 static inline def_operand_p
1445 gimple_vdef_op (const_gimple g)
1446 {
1447 struct def_optype_d *ops;
1448 if (!gimple_has_mem_ops (g))
1449 return NULL_DEF_OPERAND_P;
1450 ops = g->gsops.opbase.def_ops;
1451 if (ops
1452 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1453 return DEF_OP_PTR (ops);
1454 return NULL_DEF_OPERAND_P;
1455 }
1456
1457
1458 /* Return the single VUSE operand of the statement G. */
1459
1460 static inline tree
1461 gimple_vuse (const_gimple g)
1462 {
1463 if (!gimple_has_mem_ops (g))
1464 return NULL_TREE;
1465 return g->gsmembase.vuse;
1466 }
1467
1468 /* Return the single VDEF operand of the statement G. */
1469
1470 static inline tree
1471 gimple_vdef (const_gimple g)
1472 {
1473 if (!gimple_has_mem_ops (g))
1474 return NULL_TREE;
1475 return g->gsmembase.vdef;
1476 }
1477
1478 /* Return the single VUSE operand of the statement G. */
1479
1480 static inline tree *
1481 gimple_vuse_ptr (gimple g)
1482 {
1483 if (!gimple_has_mem_ops (g))
1484 return NULL;
1485 return &g->gsmembase.vuse;
1486 }
1487
1488 /* Return the single VDEF operand of the statement G. */
1489
1490 static inline tree *
1491 gimple_vdef_ptr (gimple g)
1492 {
1493 if (!gimple_has_mem_ops (g))
1494 return NULL;
1495 return &g->gsmembase.vdef;
1496 }
1497
1498 /* Set the single VUSE operand of the statement G. */
1499
1500 static inline void
1501 gimple_set_vuse (gimple g, tree vuse)
1502 {
1503 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1504 g->gsmembase.vuse = vuse;
1505 }
1506
1507 /* Set the single VDEF operand of the statement G. */
1508
1509 static inline void
1510 gimple_set_vdef (gimple g, tree vdef)
1511 {
1512 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1513 g->gsmembase.vdef = vdef;
1514 }
1515
1516
1517 /* Return true if statement G has operands and the modified field has
1518 been set. */
1519
1520 static inline bool
1521 gimple_modified_p (const_gimple g)
1522 {
1523 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1524 }
1525
1526
1527 /* Return the tree code for the expression computed by STMT. This is
1528 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1529 GIMPLE_CALL, return CALL_EXPR as the expression code for
1530 consistency. This is useful when the caller needs to deal with the
1531 three kinds of computation that GIMPLE supports. */
1532
1533 static inline enum tree_code
1534 gimple_expr_code (const_gimple stmt)
1535 {
1536 enum gimple_code code = gimple_code (stmt);
1537 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1538 return (enum tree_code) stmt->gsbase.subcode;
1539 else
1540 {
1541 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1542 return CALL_EXPR;
1543 }
1544 }
1545
1546
1547 /* Mark statement S as modified, and update it. */
1548
1549 static inline void
1550 update_stmt (gimple s)
1551 {
1552 if (gimple_has_ops (s))
1553 {
1554 gimple_set_modified (s, true);
1555 update_stmt_operands (s);
1556 }
1557 }
1558
1559 /* Update statement S if it has been optimized. */
1560
1561 static inline void
1562 update_stmt_if_modified (gimple s)
1563 {
1564 if (gimple_modified_p (s))
1565 update_stmt_operands (s);
1566 }
1567
1568 /* Return true if statement STMT contains volatile operands. */
1569
1570 static inline bool
1571 gimple_has_volatile_ops (const_gimple stmt)
1572 {
1573 if (gimple_has_mem_ops (stmt))
1574 return stmt->gsbase.has_volatile_ops;
1575 else
1576 return false;
1577 }
1578
1579
1580 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1581
1582 static inline void
1583 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1584 {
1585 if (gimple_has_mem_ops (stmt))
1586 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1587 }
1588
1589 /* Return true if STMT is in a transaction. */
1590
1591 static inline bool
1592 gimple_in_transaction (gimple stmt)
1593 {
1594 return stmt->gsbase.in_transaction;
1595 }
1596
1597 /* Set the IN_TRANSACTION flag to TRANSACTIONP. */
1598
1599 static inline void
1600 gimple_set_in_transaction (gimple stmt, bool transactionp)
1601 {
1602 stmt->gsbase.in_transaction = (unsigned) transactionp;
1603 }
1604
1605 /* Return true if statement STMT may access memory. */
1606
1607 static inline bool
1608 gimple_references_memory_p (gimple stmt)
1609 {
1610 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1611 }
1612
1613
1614 /* Return the subcode for OMP statement S. */
1615
1616 static inline unsigned
1617 gimple_omp_subcode (const_gimple s)
1618 {
1619 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1620 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1621 return s->gsbase.subcode;
1622 }
1623
1624 /* Set the subcode for OMP statement S to SUBCODE. */
1625
1626 static inline void
1627 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1628 {
1629 /* We only have 16 bits for the subcode. Assert that we are not
1630 overflowing it. */
1631 gcc_gimple_checking_assert (subcode < (1 << 16));
1632 s->gsbase.subcode = subcode;
1633 }
1634
1635 /* Set the nowait flag on OMP_RETURN statement S. */
1636
1637 static inline void
1638 gimple_omp_return_set_nowait (gimple s)
1639 {
1640 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1641 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1642 }
1643
1644
1645 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1646 flag set. */
1647
1648 static inline bool
1649 gimple_omp_return_nowait_p (const_gimple g)
1650 {
1651 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1652 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1653 }
1654
1655
1656 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1657 flag set. */
1658
1659 static inline bool
1660 gimple_omp_section_last_p (const_gimple g)
1661 {
1662 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1663 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1664 }
1665
1666
1667 /* Set the GF_OMP_SECTION_LAST flag on G. */
1668
1669 static inline void
1670 gimple_omp_section_set_last (gimple g)
1671 {
1672 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1673 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1674 }
1675
1676
1677 /* Return true if OMP parallel statement G has the
1678 GF_OMP_PARALLEL_COMBINED flag set. */
1679
1680 static inline bool
1681 gimple_omp_parallel_combined_p (const_gimple g)
1682 {
1683 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1684 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1685 }
1686
1687
1688 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1689 value of COMBINED_P. */
1690
1691 static inline void
1692 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1693 {
1694 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1695 if (combined_p)
1696 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1697 else
1698 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1699 }
1700
1701
1702 /* Return true if OMP atomic load/store statement G has the
1703 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1704
1705 static inline bool
1706 gimple_omp_atomic_need_value_p (const_gimple g)
1707 {
1708 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1709 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1710 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1711 }
1712
1713
1714 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1715
1716 static inline void
1717 gimple_omp_atomic_set_need_value (gimple g)
1718 {
1719 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1720 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1721 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1722 }
1723
1724
1725 /* Return the number of operands for statement GS. */
1726
1727 static inline unsigned
1728 gimple_num_ops (const_gimple gs)
1729 {
1730 return gs->gsbase.num_ops;
1731 }
1732
1733
1734 /* Set the number of operands for statement GS. */
1735
1736 static inline void
1737 gimple_set_num_ops (gimple gs, unsigned num_ops)
1738 {
1739 gs->gsbase.num_ops = num_ops;
1740 }
1741
1742
1743 /* Return the array of operands for statement GS. */
1744
1745 static inline tree *
1746 gimple_ops (gimple gs)
1747 {
1748 size_t off;
1749
1750 /* All the tuples have their operand vector at the very bottom
1751 of the structure. Note that those structures that do not
1752 have an operand vector have a zero offset. */
1753 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1754 gcc_gimple_checking_assert (off != 0);
1755
1756 return (tree *) ((char *) gs + off);
1757 }
1758
1759
1760 /* Return operand I for statement GS. */
1761
1762 static inline tree
1763 gimple_op (const_gimple gs, unsigned i)
1764 {
1765 if (gimple_has_ops (gs))
1766 {
1767 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1768 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1769 }
1770 else
1771 return NULL_TREE;
1772 }
1773
1774 /* Return a pointer to operand I for statement GS. */
1775
1776 static inline tree *
1777 gimple_op_ptr (const_gimple gs, unsigned i)
1778 {
1779 if (gimple_has_ops (gs))
1780 {
1781 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1782 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1783 }
1784 else
1785 return NULL;
1786 }
1787
1788 /* Set operand I of statement GS to OP. */
1789
1790 static inline void
1791 gimple_set_op (gimple gs, unsigned i, tree op)
1792 {
1793 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1794
1795 /* Note. It may be tempting to assert that OP matches
1796 is_gimple_operand, but that would be wrong. Different tuples
1797 accept slightly different sets of tree operands. Each caller
1798 should perform its own validation. */
1799 gimple_ops (gs)[i] = op;
1800 }
1801
1802 /* Return true if GS is a GIMPLE_ASSIGN. */
1803
1804 static inline bool
1805 is_gimple_assign (const_gimple gs)
1806 {
1807 return gimple_code (gs) == GIMPLE_ASSIGN;
1808 }
1809
1810 /* Determine if expression CODE is one of the valid expressions that can
1811 be used on the RHS of GIMPLE assignments. */
1812
1813 static inline enum gimple_rhs_class
1814 get_gimple_rhs_class (enum tree_code code)
1815 {
1816 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1817 }
1818
1819 /* Return the LHS of assignment statement GS. */
1820
1821 static inline tree
1822 gimple_assign_lhs (const_gimple gs)
1823 {
1824 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1825 return gimple_op (gs, 0);
1826 }
1827
1828
1829 /* Return a pointer to the LHS of assignment statement GS. */
1830
1831 static inline tree *
1832 gimple_assign_lhs_ptr (const_gimple gs)
1833 {
1834 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1835 return gimple_op_ptr (gs, 0);
1836 }
1837
1838
1839 /* Set LHS to be the LHS operand of assignment statement GS. */
1840
1841 static inline void
1842 gimple_assign_set_lhs (gimple gs, tree lhs)
1843 {
1844 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1845 gimple_set_op (gs, 0, lhs);
1846
1847 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1848 SSA_NAME_DEF_STMT (lhs) = gs;
1849 }
1850
1851
1852 /* Return the first operand on the RHS of assignment statement GS. */
1853
1854 static inline tree
1855 gimple_assign_rhs1 (const_gimple gs)
1856 {
1857 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1858 return gimple_op (gs, 1);
1859 }
1860
1861
1862 /* Return a pointer to the first operand on the RHS of assignment
1863 statement GS. */
1864
1865 static inline tree *
1866 gimple_assign_rhs1_ptr (const_gimple gs)
1867 {
1868 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1869 return gimple_op_ptr (gs, 1);
1870 }
1871
1872 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1873
1874 static inline void
1875 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1876 {
1877 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1878
1879 gimple_set_op (gs, 1, rhs);
1880 }
1881
1882
1883 /* Return the second operand on the RHS of assignment statement GS.
1884 If GS does not have two operands, NULL is returned instead. */
1885
1886 static inline tree
1887 gimple_assign_rhs2 (const_gimple gs)
1888 {
1889 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1890
1891 if (gimple_num_ops (gs) >= 3)
1892 return gimple_op (gs, 2);
1893 else
1894 return NULL_TREE;
1895 }
1896
1897
1898 /* Return a pointer to the second operand on the RHS of assignment
1899 statement GS. */
1900
1901 static inline tree *
1902 gimple_assign_rhs2_ptr (const_gimple gs)
1903 {
1904 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1905 return gimple_op_ptr (gs, 2);
1906 }
1907
1908
1909 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1910
1911 static inline void
1912 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1913 {
1914 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1915
1916 gimple_set_op (gs, 2, rhs);
1917 }
1918
1919 /* Return the third operand on the RHS of assignment statement GS.
1920 If GS does not have two operands, NULL is returned instead. */
1921
1922 static inline tree
1923 gimple_assign_rhs3 (const_gimple gs)
1924 {
1925 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1926
1927 if (gimple_num_ops (gs) >= 4)
1928 return gimple_op (gs, 3);
1929 else
1930 return NULL_TREE;
1931 }
1932
1933 /* Return a pointer to the third operand on the RHS of assignment
1934 statement GS. */
1935
1936 static inline tree *
1937 gimple_assign_rhs3_ptr (const_gimple gs)
1938 {
1939 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1940 return gimple_op_ptr (gs, 3);
1941 }
1942
1943
1944 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1945
1946 static inline void
1947 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1948 {
1949 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1950
1951 gimple_set_op (gs, 3, rhs);
1952 }
1953
1954 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1955 to see only a maximum of two operands. */
1956
1957 static inline void
1958 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1959 tree op1, tree op2)
1960 {
1961 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1962 }
1963
1964 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1965 to see only a maximum of two operands. */
1966
1967 static inline void
1968 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1969 tree *op1)
1970 {
1971 tree op2;
1972 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1973 gcc_assert (op2 == NULL_TREE);
1974 }
1975
1976 /* Returns true if GS is a nontemporal move. */
1977
1978 static inline bool
1979 gimple_assign_nontemporal_move_p (const_gimple gs)
1980 {
1981 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1982 return gs->gsbase.nontemporal_move;
1983 }
1984
1985 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1986
1987 static inline void
1988 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1989 {
1990 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1991 gs->gsbase.nontemporal_move = nontemporal;
1992 }
1993
1994
1995 /* Return the code of the expression computed on the rhs of assignment
1996 statement GS. In case that the RHS is a single object, returns the
1997 tree code of the object. */
1998
1999 static inline enum tree_code
2000 gimple_assign_rhs_code (const_gimple gs)
2001 {
2002 enum tree_code code;
2003 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2004
2005 code = (enum tree_code) gs->gsbase.subcode;
2006 /* While we initially set subcode to the TREE_CODE of the rhs for
2007 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2008 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2009 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2010 code = TREE_CODE (gimple_assign_rhs1 (gs));
2011
2012 return code;
2013 }
2014
2015
2016 /* Set CODE to be the code for the expression computed on the RHS of
2017 assignment S. */
2018
2019 static inline void
2020 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2021 {
2022 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2023 s->gsbase.subcode = code;
2024 }
2025
2026
2027 /* Return the gimple rhs class of the code of the expression computed on
2028 the rhs of assignment statement GS.
2029 This will never return GIMPLE_INVALID_RHS. */
2030
2031 static inline enum gimple_rhs_class
2032 gimple_assign_rhs_class (const_gimple gs)
2033 {
2034 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2035 }
2036
2037 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2038 there is no operator associated with the assignment itself.
2039 Unlike gimple_assign_copy_p, this predicate returns true for
2040 any RHS operand, including those that perform an operation
2041 and do not have the semantics of a copy, such as COND_EXPR. */
2042
2043 static inline bool
2044 gimple_assign_single_p (gimple gs)
2045 {
2046 return (is_gimple_assign (gs)
2047 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2048 }
2049
2050
2051 /* Return true if S is a type-cast assignment. */
2052
2053 static inline bool
2054 gimple_assign_cast_p (gimple s)
2055 {
2056 if (is_gimple_assign (s))
2057 {
2058 enum tree_code sc = gimple_assign_rhs_code (s);
2059 return CONVERT_EXPR_CODE_P (sc)
2060 || sc == VIEW_CONVERT_EXPR
2061 || sc == FIX_TRUNC_EXPR;
2062 }
2063
2064 return false;
2065 }
2066
2067 /* Return true if S is a clobber statement. */
2068
2069 static inline bool
2070 gimple_clobber_p (gimple s)
2071 {
2072 return gimple_assign_single_p (s)
2073 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2074 }
2075
2076 /* Return true if GS is a GIMPLE_CALL. */
2077
2078 static inline bool
2079 is_gimple_call (const_gimple gs)
2080 {
2081 return gimple_code (gs) == GIMPLE_CALL;
2082 }
2083
2084 /* Return the LHS of call statement GS. */
2085
2086 static inline tree
2087 gimple_call_lhs (const_gimple gs)
2088 {
2089 GIMPLE_CHECK (gs, GIMPLE_CALL);
2090 return gimple_op (gs, 0);
2091 }
2092
2093
2094 /* Return a pointer to the LHS of call statement GS. */
2095
2096 static inline tree *
2097 gimple_call_lhs_ptr (const_gimple gs)
2098 {
2099 GIMPLE_CHECK (gs, GIMPLE_CALL);
2100 return gimple_op_ptr (gs, 0);
2101 }
2102
2103
2104 /* Set LHS to be the LHS operand of call statement GS. */
2105
2106 static inline void
2107 gimple_call_set_lhs (gimple gs, tree lhs)
2108 {
2109 GIMPLE_CHECK (gs, GIMPLE_CALL);
2110 gimple_set_op (gs, 0, lhs);
2111 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2112 SSA_NAME_DEF_STMT (lhs) = gs;
2113 }
2114
2115
2116 /* Return true if call GS calls an internal-only function, as enumerated
2117 by internal_fn. */
2118
2119 static inline bool
2120 gimple_call_internal_p (const_gimple gs)
2121 {
2122 GIMPLE_CHECK (gs, GIMPLE_CALL);
2123 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2124 }
2125
2126
2127 /* Return the target of internal call GS. */
2128
2129 static inline enum internal_fn
2130 gimple_call_internal_fn (const_gimple gs)
2131 {
2132 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2133 return gs->gimple_call.u.internal_fn;
2134 }
2135
2136
2137 /* Return the function type of the function called by GS. */
2138
2139 static inline tree
2140 gimple_call_fntype (const_gimple gs)
2141 {
2142 GIMPLE_CHECK (gs, GIMPLE_CALL);
2143 if (gimple_call_internal_p (gs))
2144 return NULL_TREE;
2145 return gs->gimple_call.u.fntype;
2146 }
2147
2148 /* Set the type of the function called by GS to FNTYPE. */
2149
2150 static inline void
2151 gimple_call_set_fntype (gimple gs, tree fntype)
2152 {
2153 GIMPLE_CHECK (gs, GIMPLE_CALL);
2154 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2155 gs->gimple_call.u.fntype = fntype;
2156 }
2157
2158
2159 /* Return the tree node representing the function called by call
2160 statement GS. */
2161
2162 static inline tree
2163 gimple_call_fn (const_gimple gs)
2164 {
2165 GIMPLE_CHECK (gs, GIMPLE_CALL);
2166 return gimple_op (gs, 1);
2167 }
2168
2169 /* Return a pointer to the tree node representing the function called by call
2170 statement GS. */
2171
2172 static inline tree *
2173 gimple_call_fn_ptr (const_gimple gs)
2174 {
2175 GIMPLE_CHECK (gs, GIMPLE_CALL);
2176 return gimple_op_ptr (gs, 1);
2177 }
2178
2179
2180 /* Set FN to be the function called by call statement GS. */
2181
2182 static inline void
2183 gimple_call_set_fn (gimple gs, tree fn)
2184 {
2185 GIMPLE_CHECK (gs, GIMPLE_CALL);
2186 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2187 gimple_set_op (gs, 1, fn);
2188 }
2189
2190
2191 /* Set FNDECL to be the function called by call statement GS. */
2192
2193 static inline void
2194 gimple_call_set_fndecl (gimple gs, tree decl)
2195 {
2196 GIMPLE_CHECK (gs, GIMPLE_CALL);
2197 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2198 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2199 }
2200
2201
2202 /* Set internal function FN to be the function called by call statement GS. */
2203
2204 static inline void
2205 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2206 {
2207 GIMPLE_CHECK (gs, GIMPLE_CALL);
2208 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2209 gs->gimple_call.u.internal_fn = fn;
2210 }
2211
2212
2213 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2214 associated with the callee if known. Otherwise return NULL_TREE. */
2215
2216 static inline tree
2217 gimple_call_addr_fndecl (const_tree fn)
2218 {
2219 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2220 {
2221 tree fndecl = TREE_OPERAND (fn, 0);
2222 if (TREE_CODE (fndecl) == MEM_REF
2223 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2224 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2225 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2226 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2227 return fndecl;
2228 }
2229 return NULL_TREE;
2230 }
2231
2232 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2233 Otherwise return NULL. This function is analogous to
2234 get_callee_fndecl in tree land. */
2235
2236 static inline tree
2237 gimple_call_fndecl (const_gimple gs)
2238 {
2239 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2240 }
2241
2242
2243 /* Return the type returned by call statement GS. */
2244
2245 static inline tree
2246 gimple_call_return_type (const_gimple gs)
2247 {
2248 tree type = gimple_call_fntype (gs);
2249
2250 if (type == NULL_TREE)
2251 return TREE_TYPE (gimple_call_lhs (gs));
2252
2253 /* The type returned by a function is the type of its
2254 function type. */
2255 return TREE_TYPE (type);
2256 }
2257
2258
2259 /* Return the static chain for call statement GS. */
2260
2261 static inline tree
2262 gimple_call_chain (const_gimple gs)
2263 {
2264 GIMPLE_CHECK (gs, GIMPLE_CALL);
2265 return gimple_op (gs, 2);
2266 }
2267
2268
2269 /* Return a pointer to the static chain for call statement GS. */
2270
2271 static inline tree *
2272 gimple_call_chain_ptr (const_gimple gs)
2273 {
2274 GIMPLE_CHECK (gs, GIMPLE_CALL);
2275 return gimple_op_ptr (gs, 2);
2276 }
2277
2278 /* Set CHAIN to be the static chain for call statement GS. */
2279
2280 static inline void
2281 gimple_call_set_chain (gimple gs, tree chain)
2282 {
2283 GIMPLE_CHECK (gs, GIMPLE_CALL);
2284
2285 gimple_set_op (gs, 2, chain);
2286 }
2287
2288
2289 /* Return the number of arguments used by call statement GS. */
2290
2291 static inline unsigned
2292 gimple_call_num_args (const_gimple gs)
2293 {
2294 unsigned num_ops;
2295 GIMPLE_CHECK (gs, GIMPLE_CALL);
2296 num_ops = gimple_num_ops (gs);
2297 return num_ops - 3;
2298 }
2299
2300
2301 /* Return the argument at position INDEX for call statement GS. */
2302
2303 static inline tree
2304 gimple_call_arg (const_gimple gs, unsigned index)
2305 {
2306 GIMPLE_CHECK (gs, GIMPLE_CALL);
2307 return gimple_op (gs, index + 3);
2308 }
2309
2310
2311 /* Return a pointer to the argument at position INDEX for call
2312 statement GS. */
2313
2314 static inline tree *
2315 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2316 {
2317 GIMPLE_CHECK (gs, GIMPLE_CALL);
2318 return gimple_op_ptr (gs, index + 3);
2319 }
2320
2321
2322 /* Set ARG to be the argument at position INDEX for call statement GS. */
2323
2324 static inline void
2325 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2326 {
2327 GIMPLE_CHECK (gs, GIMPLE_CALL);
2328 gimple_set_op (gs, index + 3, arg);
2329 }
2330
2331
2332 /* If TAIL_P is true, mark call statement S as being a tail call
2333 (i.e., a call just before the exit of a function). These calls are
2334 candidate for tail call optimization. */
2335
2336 static inline void
2337 gimple_call_set_tail (gimple s, bool tail_p)
2338 {
2339 GIMPLE_CHECK (s, GIMPLE_CALL);
2340 if (tail_p)
2341 s->gsbase.subcode |= GF_CALL_TAILCALL;
2342 else
2343 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2344 }
2345
2346
2347 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2348
2349 static inline bool
2350 gimple_call_tail_p (gimple s)
2351 {
2352 GIMPLE_CHECK (s, GIMPLE_CALL);
2353 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2354 }
2355
2356
2357 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2358 slot optimization. This transformation uses the target of the call
2359 expansion as the return slot for calls that return in memory. */
2360
2361 static inline void
2362 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2363 {
2364 GIMPLE_CHECK (s, GIMPLE_CALL);
2365 if (return_slot_opt_p)
2366 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2367 else
2368 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2369 }
2370
2371
2372 /* Return true if S is marked for return slot optimization. */
2373
2374 static inline bool
2375 gimple_call_return_slot_opt_p (gimple s)
2376 {
2377 GIMPLE_CHECK (s, GIMPLE_CALL);
2378 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2379 }
2380
2381
2382 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2383 thunk to the thunked-to function. */
2384
2385 static inline void
2386 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2387 {
2388 GIMPLE_CHECK (s, GIMPLE_CALL);
2389 if (from_thunk_p)
2390 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2391 else
2392 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2393 }
2394
2395
2396 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2397
2398 static inline bool
2399 gimple_call_from_thunk_p (gimple s)
2400 {
2401 GIMPLE_CHECK (s, GIMPLE_CALL);
2402 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2403 }
2404
2405
2406 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2407 argument pack in its argument list. */
2408
2409 static inline void
2410 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2411 {
2412 GIMPLE_CHECK (s, GIMPLE_CALL);
2413 if (pass_arg_pack_p)
2414 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2415 else
2416 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2417 }
2418
2419
2420 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2421 argument pack in its argument list. */
2422
2423 static inline bool
2424 gimple_call_va_arg_pack_p (gimple s)
2425 {
2426 GIMPLE_CHECK (s, GIMPLE_CALL);
2427 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2428 }
2429
2430
2431 /* Return true if S is a noreturn call. */
2432
2433 static inline bool
2434 gimple_call_noreturn_p (gimple s)
2435 {
2436 GIMPLE_CHECK (s, GIMPLE_CALL);
2437 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2438 }
2439
2440
2441 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2442 even if the called function can throw in other cases. */
2443
2444 static inline void
2445 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2446 {
2447 GIMPLE_CHECK (s, GIMPLE_CALL);
2448 if (nothrow_p)
2449 s->gsbase.subcode |= GF_CALL_NOTHROW;
2450 else
2451 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2452 }
2453
2454 /* Return true if S is a nothrow call. */
2455
2456 static inline bool
2457 gimple_call_nothrow_p (gimple s)
2458 {
2459 GIMPLE_CHECK (s, GIMPLE_CALL);
2460 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2461 }
2462
2463 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2464 is known to be emitted for VLA objects. Those are wrapped by
2465 stack_save/stack_restore calls and hence can't lead to unbounded
2466 stack growth even when they occur in loops. */
2467
2468 static inline void
2469 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2470 {
2471 GIMPLE_CHECK (s, GIMPLE_CALL);
2472 if (for_var)
2473 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2474 else
2475 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2476 }
2477
2478 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2479
2480 static inline bool
2481 gimple_call_alloca_for_var_p (gimple s)
2482 {
2483 GIMPLE_CHECK (s, GIMPLE_CALL);
2484 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2485 }
2486
2487 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2488
2489 static inline void
2490 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2491 {
2492 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2493 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2494 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2495 }
2496
2497
2498 /* Return a pointer to the points-to solution for the set of call-used
2499 variables of the call CALL. */
2500
2501 static inline struct pt_solution *
2502 gimple_call_use_set (gimple call)
2503 {
2504 GIMPLE_CHECK (call, GIMPLE_CALL);
2505 return &call->gimple_call.call_used;
2506 }
2507
2508
2509 /* Return a pointer to the points-to solution for the set of call-used
2510 variables of the call CALL. */
2511
2512 static inline struct pt_solution *
2513 gimple_call_clobber_set (gimple call)
2514 {
2515 GIMPLE_CHECK (call, GIMPLE_CALL);
2516 return &call->gimple_call.call_clobbered;
2517 }
2518
2519
2520 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2521 non-NULL lhs. */
2522
2523 static inline bool
2524 gimple_has_lhs (gimple stmt)
2525 {
2526 return (is_gimple_assign (stmt)
2527 || (is_gimple_call (stmt)
2528 && gimple_call_lhs (stmt) != NULL_TREE));
2529 }
2530
2531
2532 /* Return the code of the predicate computed by conditional statement GS. */
2533
2534 static inline enum tree_code
2535 gimple_cond_code (const_gimple gs)
2536 {
2537 GIMPLE_CHECK (gs, GIMPLE_COND);
2538 return (enum tree_code) gs->gsbase.subcode;
2539 }
2540
2541
2542 /* Set CODE to be the predicate code for the conditional statement GS. */
2543
2544 static inline void
2545 gimple_cond_set_code (gimple gs, enum tree_code code)
2546 {
2547 GIMPLE_CHECK (gs, GIMPLE_COND);
2548 gs->gsbase.subcode = code;
2549 }
2550
2551
2552 /* Return the LHS of the predicate computed by conditional statement GS. */
2553
2554 static inline tree
2555 gimple_cond_lhs (const_gimple gs)
2556 {
2557 GIMPLE_CHECK (gs, GIMPLE_COND);
2558 return gimple_op (gs, 0);
2559 }
2560
2561 /* Return the pointer to the LHS of the predicate computed by conditional
2562 statement GS. */
2563
2564 static inline tree *
2565 gimple_cond_lhs_ptr (const_gimple gs)
2566 {
2567 GIMPLE_CHECK (gs, GIMPLE_COND);
2568 return gimple_op_ptr (gs, 0);
2569 }
2570
2571 /* Set LHS to be the LHS operand of the predicate computed by
2572 conditional statement GS. */
2573
2574 static inline void
2575 gimple_cond_set_lhs (gimple gs, tree lhs)
2576 {
2577 GIMPLE_CHECK (gs, GIMPLE_COND);
2578 gimple_set_op (gs, 0, lhs);
2579 }
2580
2581
2582 /* Return the RHS operand of the predicate computed by conditional GS. */
2583
2584 static inline tree
2585 gimple_cond_rhs (const_gimple gs)
2586 {
2587 GIMPLE_CHECK (gs, GIMPLE_COND);
2588 return gimple_op (gs, 1);
2589 }
2590
2591 /* Return the pointer to the RHS operand of the predicate computed by
2592 conditional GS. */
2593
2594 static inline tree *
2595 gimple_cond_rhs_ptr (const_gimple gs)
2596 {
2597 GIMPLE_CHECK (gs, GIMPLE_COND);
2598 return gimple_op_ptr (gs, 1);
2599 }
2600
2601
2602 /* Set RHS to be the RHS operand of the predicate computed by
2603 conditional statement GS. */
2604
2605 static inline void
2606 gimple_cond_set_rhs (gimple gs, tree rhs)
2607 {
2608 GIMPLE_CHECK (gs, GIMPLE_COND);
2609 gimple_set_op (gs, 1, rhs);
2610 }
2611
2612
2613 /* Return the label used by conditional statement GS when its
2614 predicate evaluates to true. */
2615
2616 static inline tree
2617 gimple_cond_true_label (const_gimple gs)
2618 {
2619 GIMPLE_CHECK (gs, GIMPLE_COND);
2620 return gimple_op (gs, 2);
2621 }
2622
2623
2624 /* Set LABEL to be the label used by conditional statement GS when its
2625 predicate evaluates to true. */
2626
2627 static inline void
2628 gimple_cond_set_true_label (gimple gs, tree label)
2629 {
2630 GIMPLE_CHECK (gs, GIMPLE_COND);
2631 gimple_set_op (gs, 2, label);
2632 }
2633
2634
2635 /* Set LABEL to be the label used by conditional statement GS when its
2636 predicate evaluates to false. */
2637
2638 static inline void
2639 gimple_cond_set_false_label (gimple gs, tree label)
2640 {
2641 GIMPLE_CHECK (gs, GIMPLE_COND);
2642 gimple_set_op (gs, 3, label);
2643 }
2644
2645
2646 /* Return the label used by conditional statement GS when its
2647 predicate evaluates to false. */
2648
2649 static inline tree
2650 gimple_cond_false_label (const_gimple gs)
2651 {
2652 GIMPLE_CHECK (gs, GIMPLE_COND);
2653 return gimple_op (gs, 3);
2654 }
2655
2656
2657 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2658
2659 static inline void
2660 gimple_cond_make_false (gimple gs)
2661 {
2662 gimple_cond_set_lhs (gs, boolean_true_node);
2663 gimple_cond_set_rhs (gs, boolean_false_node);
2664 gs->gsbase.subcode = EQ_EXPR;
2665 }
2666
2667
2668 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2669
2670 static inline void
2671 gimple_cond_make_true (gimple gs)
2672 {
2673 gimple_cond_set_lhs (gs, boolean_true_node);
2674 gimple_cond_set_rhs (gs, boolean_true_node);
2675 gs->gsbase.subcode = EQ_EXPR;
2676 }
2677
2678 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2679 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2680
2681 static inline bool
2682 gimple_cond_true_p (const_gimple gs)
2683 {
2684 tree lhs = gimple_cond_lhs (gs);
2685 tree rhs = gimple_cond_rhs (gs);
2686 enum tree_code code = gimple_cond_code (gs);
2687
2688 if (lhs != boolean_true_node && lhs != boolean_false_node)
2689 return false;
2690
2691 if (rhs != boolean_true_node && rhs != boolean_false_node)
2692 return false;
2693
2694 if (code == NE_EXPR && lhs != rhs)
2695 return true;
2696
2697 if (code == EQ_EXPR && lhs == rhs)
2698 return true;
2699
2700 return false;
2701 }
2702
2703 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2704 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2705
2706 static inline bool
2707 gimple_cond_false_p (const_gimple gs)
2708 {
2709 tree lhs = gimple_cond_lhs (gs);
2710 tree rhs = gimple_cond_rhs (gs);
2711 enum tree_code code = gimple_cond_code (gs);
2712
2713 if (lhs != boolean_true_node && lhs != boolean_false_node)
2714 return false;
2715
2716 if (rhs != boolean_true_node && rhs != boolean_false_node)
2717 return false;
2718
2719 if (code == NE_EXPR && lhs == rhs)
2720 return true;
2721
2722 if (code == EQ_EXPR && lhs != rhs)
2723 return true;
2724
2725 return false;
2726 }
2727
2728 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2729 'if (var == 1)' */
2730
2731 static inline bool
2732 gimple_cond_single_var_p (gimple gs)
2733 {
2734 if (gimple_cond_code (gs) == NE_EXPR
2735 && gimple_cond_rhs (gs) == boolean_false_node)
2736 return true;
2737
2738 if (gimple_cond_code (gs) == EQ_EXPR
2739 && gimple_cond_rhs (gs) == boolean_true_node)
2740 return true;
2741
2742 return false;
2743 }
2744
2745 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2746
2747 static inline void
2748 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2749 {
2750 gimple_cond_set_code (stmt, code);
2751 gimple_cond_set_lhs (stmt, lhs);
2752 gimple_cond_set_rhs (stmt, rhs);
2753 }
2754
2755 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2756
2757 static inline tree
2758 gimple_label_label (const_gimple gs)
2759 {
2760 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2761 return gimple_op (gs, 0);
2762 }
2763
2764
2765 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2766 GS. */
2767
2768 static inline void
2769 gimple_label_set_label (gimple gs, tree label)
2770 {
2771 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2772 gimple_set_op (gs, 0, label);
2773 }
2774
2775
2776 /* Return the destination of the unconditional jump GS. */
2777
2778 static inline tree
2779 gimple_goto_dest (const_gimple gs)
2780 {
2781 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2782 return gimple_op (gs, 0);
2783 }
2784
2785
2786 /* Set DEST to be the destination of the unconditonal jump GS. */
2787
2788 static inline void
2789 gimple_goto_set_dest (gimple gs, tree dest)
2790 {
2791 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2792 gimple_set_op (gs, 0, dest);
2793 }
2794
2795
2796 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2797
2798 static inline tree
2799 gimple_bind_vars (const_gimple gs)
2800 {
2801 GIMPLE_CHECK (gs, GIMPLE_BIND);
2802 return gs->gimple_bind.vars;
2803 }
2804
2805
2806 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2807 statement GS. */
2808
2809 static inline void
2810 gimple_bind_set_vars (gimple gs, tree vars)
2811 {
2812 GIMPLE_CHECK (gs, GIMPLE_BIND);
2813 gs->gimple_bind.vars = vars;
2814 }
2815
2816
2817 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2818 statement GS. */
2819
2820 static inline void
2821 gimple_bind_append_vars (gimple gs, tree vars)
2822 {
2823 GIMPLE_CHECK (gs, GIMPLE_BIND);
2824 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2825 }
2826
2827
2828 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2829
2830 static inline gimple_seq
2831 gimple_bind_body (gimple gs)
2832 {
2833 GIMPLE_CHECK (gs, GIMPLE_BIND);
2834 return gs->gimple_bind.body;
2835 }
2836
2837
2838 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2839 statement GS. */
2840
2841 static inline void
2842 gimple_bind_set_body (gimple gs, gimple_seq seq)
2843 {
2844 GIMPLE_CHECK (gs, GIMPLE_BIND);
2845 gs->gimple_bind.body = seq;
2846 }
2847
2848
2849 /* Append a statement to the end of a GIMPLE_BIND's body. */
2850
2851 static inline void
2852 gimple_bind_add_stmt (gimple gs, gimple stmt)
2853 {
2854 GIMPLE_CHECK (gs, GIMPLE_BIND);
2855 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2856 }
2857
2858
2859 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2860
2861 static inline void
2862 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2863 {
2864 GIMPLE_CHECK (gs, GIMPLE_BIND);
2865 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2866 }
2867
2868
2869 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2870 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2871
2872 static inline tree
2873 gimple_bind_block (const_gimple gs)
2874 {
2875 GIMPLE_CHECK (gs, GIMPLE_BIND);
2876 return gs->gimple_bind.block;
2877 }
2878
2879
2880 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2881 statement GS. */
2882
2883 static inline void
2884 gimple_bind_set_block (gimple gs, tree block)
2885 {
2886 GIMPLE_CHECK (gs, GIMPLE_BIND);
2887 gcc_gimple_checking_assert (block == NULL_TREE
2888 || TREE_CODE (block) == BLOCK);
2889 gs->gimple_bind.block = block;
2890 }
2891
2892
2893 /* Return the number of input operands for GIMPLE_ASM GS. */
2894
2895 static inline unsigned
2896 gimple_asm_ninputs (const_gimple gs)
2897 {
2898 GIMPLE_CHECK (gs, GIMPLE_ASM);
2899 return gs->gimple_asm.ni;
2900 }
2901
2902
2903 /* Return the number of output operands for GIMPLE_ASM GS. */
2904
2905 static inline unsigned
2906 gimple_asm_noutputs (const_gimple gs)
2907 {
2908 GIMPLE_CHECK (gs, GIMPLE_ASM);
2909 return gs->gimple_asm.no;
2910 }
2911
2912
2913 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2914
2915 static inline unsigned
2916 gimple_asm_nclobbers (const_gimple gs)
2917 {
2918 GIMPLE_CHECK (gs, GIMPLE_ASM);
2919 return gs->gimple_asm.nc;
2920 }
2921
2922 /* Return the number of label operands for GIMPLE_ASM GS. */
2923
2924 static inline unsigned
2925 gimple_asm_nlabels (const_gimple gs)
2926 {
2927 GIMPLE_CHECK (gs, GIMPLE_ASM);
2928 return gs->gimple_asm.nl;
2929 }
2930
2931 /* Return input operand INDEX of GIMPLE_ASM GS. */
2932
2933 static inline tree
2934 gimple_asm_input_op (const_gimple gs, unsigned index)
2935 {
2936 GIMPLE_CHECK (gs, GIMPLE_ASM);
2937 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2938 return gimple_op (gs, index);
2939 }
2940
2941 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2942
2943 static inline tree *
2944 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2945 {
2946 GIMPLE_CHECK (gs, GIMPLE_ASM);
2947 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2948 return gimple_op_ptr (gs, index);
2949 }
2950
2951
2952 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2953
2954 static inline void
2955 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2956 {
2957 GIMPLE_CHECK (gs, GIMPLE_ASM);
2958 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2959 && TREE_CODE (in_op) == TREE_LIST);
2960 gimple_set_op (gs, index, in_op);
2961 }
2962
2963
2964 /* Return output operand INDEX of GIMPLE_ASM GS. */
2965
2966 static inline tree
2967 gimple_asm_output_op (const_gimple gs, unsigned index)
2968 {
2969 GIMPLE_CHECK (gs, GIMPLE_ASM);
2970 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2971 return gimple_op (gs, index + gs->gimple_asm.ni);
2972 }
2973
2974 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2975
2976 static inline tree *
2977 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2978 {
2979 GIMPLE_CHECK (gs, GIMPLE_ASM);
2980 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2981 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2982 }
2983
2984
2985 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2986
2987 static inline void
2988 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2989 {
2990 GIMPLE_CHECK (gs, GIMPLE_ASM);
2991 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2992 && TREE_CODE (out_op) == TREE_LIST);
2993 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2994 }
2995
2996
2997 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2998
2999 static inline tree
3000 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3001 {
3002 GIMPLE_CHECK (gs, GIMPLE_ASM);
3003 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
3004 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3005 }
3006
3007
3008 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3009
3010 static inline void
3011 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3012 {
3013 GIMPLE_CHECK (gs, GIMPLE_ASM);
3014 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
3015 && TREE_CODE (clobber_op) == TREE_LIST);
3016 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3017 }
3018
3019 /* Return label operand INDEX of GIMPLE_ASM GS. */
3020
3021 static inline tree
3022 gimple_asm_label_op (const_gimple gs, unsigned index)
3023 {
3024 GIMPLE_CHECK (gs, GIMPLE_ASM);
3025 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
3026 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3027 }
3028
3029 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3030
3031 static inline void
3032 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3033 {
3034 GIMPLE_CHECK (gs, GIMPLE_ASM);
3035 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
3036 && TREE_CODE (label_op) == TREE_LIST);
3037 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3038 }
3039
3040 /* Return the string representing the assembly instruction in
3041 GIMPLE_ASM GS. */
3042
3043 static inline const char *
3044 gimple_asm_string (const_gimple gs)
3045 {
3046 GIMPLE_CHECK (gs, GIMPLE_ASM);
3047 return gs->gimple_asm.string;
3048 }
3049
3050
3051 /* Return true if GS is an asm statement marked volatile. */
3052
3053 static inline bool
3054 gimple_asm_volatile_p (const_gimple gs)
3055 {
3056 GIMPLE_CHECK (gs, GIMPLE_ASM);
3057 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3058 }
3059
3060
3061 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3062
3063 static inline void
3064 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3065 {
3066 GIMPLE_CHECK (gs, GIMPLE_ASM);
3067 if (volatile_p)
3068 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3069 else
3070 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3071 }
3072
3073
3074 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3075
3076 static inline void
3077 gimple_asm_set_input (gimple gs, bool input_p)
3078 {
3079 GIMPLE_CHECK (gs, GIMPLE_ASM);
3080 if (input_p)
3081 gs->gsbase.subcode |= GF_ASM_INPUT;
3082 else
3083 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3084 }
3085
3086
3087 /* Return true if asm GS is an ASM_INPUT. */
3088
3089 static inline bool
3090 gimple_asm_input_p (const_gimple gs)
3091 {
3092 GIMPLE_CHECK (gs, GIMPLE_ASM);
3093 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3094 }
3095
3096
3097 /* Return the types handled by GIMPLE_CATCH statement GS. */
3098
3099 static inline tree
3100 gimple_catch_types (const_gimple gs)
3101 {
3102 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3103 return gs->gimple_catch.types;
3104 }
3105
3106
3107 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3108
3109 static inline tree *
3110 gimple_catch_types_ptr (gimple gs)
3111 {
3112 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3113 return &gs->gimple_catch.types;
3114 }
3115
3116
3117 /* Return the GIMPLE sequence representing the body of the handler of
3118 GIMPLE_CATCH statement GS. */
3119
3120 static inline gimple_seq
3121 gimple_catch_handler (gimple gs)
3122 {
3123 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3124 return gs->gimple_catch.handler;
3125 }
3126
3127
3128 /* Return a pointer to the GIMPLE sequence representing the body of
3129 the handler of GIMPLE_CATCH statement GS. */
3130
3131 static inline gimple_seq *
3132 gimple_catch_handler_ptr (gimple gs)
3133 {
3134 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3135 return &gs->gimple_catch.handler;
3136 }
3137
3138
3139 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3140
3141 static inline void
3142 gimple_catch_set_types (gimple gs, tree t)
3143 {
3144 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3145 gs->gimple_catch.types = t;
3146 }
3147
3148
3149 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3150
3151 static inline void
3152 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3153 {
3154 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3155 gs->gimple_catch.handler = handler;
3156 }
3157
3158
3159 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3160
3161 static inline tree
3162 gimple_eh_filter_types (const_gimple gs)
3163 {
3164 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3165 return gs->gimple_eh_filter.types;
3166 }
3167
3168
3169 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3170 GS. */
3171
3172 static inline tree *
3173 gimple_eh_filter_types_ptr (gimple gs)
3174 {
3175 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3176 return &gs->gimple_eh_filter.types;
3177 }
3178
3179
3180 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3181 statement fails. */
3182
3183 static inline gimple_seq
3184 gimple_eh_filter_failure (gimple gs)
3185 {
3186 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3187 return gs->gimple_eh_filter.failure;
3188 }
3189
3190
3191 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3192
3193 static inline void
3194 gimple_eh_filter_set_types (gimple gs, tree types)
3195 {
3196 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3197 gs->gimple_eh_filter.types = types;
3198 }
3199
3200
3201 /* Set FAILURE to be the sequence of statements to execute on failure
3202 for GIMPLE_EH_FILTER GS. */
3203
3204 static inline void
3205 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3206 {
3207 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3208 gs->gimple_eh_filter.failure = failure;
3209 }
3210
3211 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3212
3213 static inline tree
3214 gimple_eh_must_not_throw_fndecl (gimple gs)
3215 {
3216 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3217 return gs->gimple_eh_mnt.fndecl;
3218 }
3219
3220 /* Set the function decl to be called by GS to DECL. */
3221
3222 static inline void
3223 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3224 {
3225 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3226 gs->gimple_eh_mnt.fndecl = decl;
3227 }
3228
3229 /* GIMPLE_EH_ELSE accessors. */
3230
3231 static inline gimple_seq
3232 gimple_eh_else_n_body (gimple gs)
3233 {
3234 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3235 return gs->gimple_eh_else.n_body;
3236 }
3237
3238 static inline gimple_seq
3239 gimple_eh_else_e_body (gimple gs)
3240 {
3241 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3242 return gs->gimple_eh_else.e_body;
3243 }
3244
3245 static inline void
3246 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3247 {
3248 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3249 gs->gimple_eh_else.n_body = seq;
3250 }
3251
3252 static inline void
3253 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3254 {
3255 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3256 gs->gimple_eh_else.e_body = seq;
3257 }
3258
3259 /* GIMPLE_TRY accessors. */
3260
3261 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3262 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3263
3264 static inline enum gimple_try_flags
3265 gimple_try_kind (const_gimple gs)
3266 {
3267 GIMPLE_CHECK (gs, GIMPLE_TRY);
3268 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3269 }
3270
3271
3272 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3273
3274 static inline void
3275 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3276 {
3277 GIMPLE_CHECK (gs, GIMPLE_TRY);
3278 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3279 || kind == GIMPLE_TRY_FINALLY);
3280 if (gimple_try_kind (gs) != kind)
3281 gs->gsbase.subcode = (unsigned int) kind;
3282 }
3283
3284
3285 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3286
3287 static inline bool
3288 gimple_try_catch_is_cleanup (const_gimple gs)
3289 {
3290 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3291 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3292 }
3293
3294
3295 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3296
3297 static inline gimple_seq
3298 gimple_try_eval (gimple gs)
3299 {
3300 GIMPLE_CHECK (gs, GIMPLE_TRY);
3301 return gs->gimple_try.eval;
3302 }
3303
3304
3305 /* Return the sequence of statements used as the cleanup body for
3306 GIMPLE_TRY GS. */
3307
3308 static inline gimple_seq
3309 gimple_try_cleanup (gimple gs)
3310 {
3311 GIMPLE_CHECK (gs, GIMPLE_TRY);
3312 return gs->gimple_try.cleanup;
3313 }
3314
3315
3316 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3317
3318 static inline void
3319 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3320 {
3321 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3322 if (catch_is_cleanup)
3323 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3324 else
3325 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3326 }
3327
3328
3329 /* Set EVAL to be the sequence of statements to use as the body for
3330 GIMPLE_TRY GS. */
3331
3332 static inline void
3333 gimple_try_set_eval (gimple gs, gimple_seq eval)
3334 {
3335 GIMPLE_CHECK (gs, GIMPLE_TRY);
3336 gs->gimple_try.eval = eval;
3337 }
3338
3339
3340 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3341 body for GIMPLE_TRY GS. */
3342
3343 static inline void
3344 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3345 {
3346 GIMPLE_CHECK (gs, GIMPLE_TRY);
3347 gs->gimple_try.cleanup = cleanup;
3348 }
3349
3350
3351 /* Return the cleanup sequence for cleanup statement GS. */
3352
3353 static inline gimple_seq
3354 gimple_wce_cleanup (gimple gs)
3355 {
3356 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3357 return gs->gimple_wce.cleanup;
3358 }
3359
3360
3361 /* Set CLEANUP to be the cleanup sequence for GS. */
3362
3363 static inline void
3364 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3365 {
3366 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3367 gs->gimple_wce.cleanup = cleanup;
3368 }
3369
3370
3371 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3372
3373 static inline bool
3374 gimple_wce_cleanup_eh_only (const_gimple gs)
3375 {
3376 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3377 return gs->gsbase.subcode != 0;
3378 }
3379
3380
3381 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3382
3383 static inline void
3384 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3385 {
3386 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3387 gs->gsbase.subcode = (unsigned int) eh_only_p;
3388 }
3389
3390
3391 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3392
3393 static inline unsigned
3394 gimple_phi_capacity (const_gimple gs)
3395 {
3396 GIMPLE_CHECK (gs, GIMPLE_PHI);
3397 return gs->gimple_phi.capacity;
3398 }
3399
3400
3401 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3402 be exactly the number of incoming edges for the basic block holding
3403 GS. */
3404
3405 static inline unsigned
3406 gimple_phi_num_args (const_gimple gs)
3407 {
3408 GIMPLE_CHECK (gs, GIMPLE_PHI);
3409 return gs->gimple_phi.nargs;
3410 }
3411
3412
3413 /* Return the SSA name created by GIMPLE_PHI GS. */
3414
3415 static inline tree
3416 gimple_phi_result (const_gimple gs)
3417 {
3418 GIMPLE_CHECK (gs, GIMPLE_PHI);
3419 return gs->gimple_phi.result;
3420 }
3421
3422 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3423
3424 static inline tree *
3425 gimple_phi_result_ptr (gimple gs)
3426 {
3427 GIMPLE_CHECK (gs, GIMPLE_PHI);
3428 return &gs->gimple_phi.result;
3429 }
3430
3431 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3432
3433 static inline void
3434 gimple_phi_set_result (gimple gs, tree result)
3435 {
3436 GIMPLE_CHECK (gs, GIMPLE_PHI);
3437 gs->gimple_phi.result = result;
3438 }
3439
3440
3441 /* Return the PHI argument corresponding to incoming edge INDEX for
3442 GIMPLE_PHI GS. */
3443
3444 static inline struct phi_arg_d *
3445 gimple_phi_arg (gimple gs, unsigned index)
3446 {
3447 GIMPLE_CHECK (gs, GIMPLE_PHI);
3448 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3449 return &(gs->gimple_phi.args[index]);
3450 }
3451
3452 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3453 for GIMPLE_PHI GS. */
3454
3455 static inline void
3456 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3457 {
3458 GIMPLE_CHECK (gs, GIMPLE_PHI);
3459 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3460 gs->gimple_phi.args[index] = *phiarg;
3461 }
3462
3463 /* Return the region number for GIMPLE_RESX GS. */
3464
3465 static inline int
3466 gimple_resx_region (const_gimple gs)
3467 {
3468 GIMPLE_CHECK (gs, GIMPLE_RESX);
3469 return gs->gimple_eh_ctrl.region;
3470 }
3471
3472 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3473
3474 static inline void
3475 gimple_resx_set_region (gimple gs, int region)
3476 {
3477 GIMPLE_CHECK (gs, GIMPLE_RESX);
3478 gs->gimple_eh_ctrl.region = region;
3479 }
3480
3481 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3482
3483 static inline int
3484 gimple_eh_dispatch_region (const_gimple gs)
3485 {
3486 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3487 return gs->gimple_eh_ctrl.region;
3488 }
3489
3490 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3491
3492 static inline void
3493 gimple_eh_dispatch_set_region (gimple gs, int region)
3494 {
3495 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3496 gs->gimple_eh_ctrl.region = region;
3497 }
3498
3499 /* Return the number of labels associated with the switch statement GS. */
3500
3501 static inline unsigned
3502 gimple_switch_num_labels (const_gimple gs)
3503 {
3504 unsigned num_ops;
3505 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3506 num_ops = gimple_num_ops (gs);
3507 gcc_gimple_checking_assert (num_ops > 1);
3508 return num_ops - 1;
3509 }
3510
3511
3512 /* Set NLABELS to be the number of labels for the switch statement GS. */
3513
3514 static inline void
3515 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3516 {
3517 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3518 gimple_set_num_ops (g, nlabels + 1);
3519 }
3520
3521
3522 /* Return the index variable used by the switch statement GS. */
3523
3524 static inline tree
3525 gimple_switch_index (const_gimple gs)
3526 {
3527 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3528 return gimple_op (gs, 0);
3529 }
3530
3531
3532 /* Return a pointer to the index variable for the switch statement GS. */
3533
3534 static inline tree *
3535 gimple_switch_index_ptr (const_gimple gs)
3536 {
3537 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3538 return gimple_op_ptr (gs, 0);
3539 }
3540
3541
3542 /* Set INDEX to be the index variable for switch statement GS. */
3543
3544 static inline void
3545 gimple_switch_set_index (gimple gs, tree index)
3546 {
3547 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3548 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3549 gimple_set_op (gs, 0, index);
3550 }
3551
3552
3553 /* Return the label numbered INDEX. The default label is 0, followed by any
3554 labels in a switch statement. */
3555
3556 static inline tree
3557 gimple_switch_label (const_gimple gs, unsigned index)
3558 {
3559 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3560 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3561 return gimple_op (gs, index + 1);
3562 }
3563
3564 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3565
3566 static inline void
3567 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3568 {
3569 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3570 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3571 && (label == NULL_TREE
3572 || TREE_CODE (label) == CASE_LABEL_EXPR));
3573 gimple_set_op (gs, index + 1, label);
3574 }
3575
3576 /* Return the default label for a switch statement. */
3577
3578 static inline tree
3579 gimple_switch_default_label (const_gimple gs)
3580 {
3581 return gimple_switch_label (gs, 0);
3582 }
3583
3584 /* Set the default label for a switch statement. */
3585
3586 static inline void
3587 gimple_switch_set_default_label (gimple gs, tree label)
3588 {
3589 gimple_switch_set_label (gs, 0, label);
3590 }
3591
3592 /* Return true if GS is a GIMPLE_DEBUG statement. */
3593
3594 static inline bool
3595 is_gimple_debug (const_gimple gs)
3596 {
3597 return gimple_code (gs) == GIMPLE_DEBUG;
3598 }
3599
3600 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3601
3602 static inline bool
3603 gimple_debug_bind_p (const_gimple s)
3604 {
3605 if (is_gimple_debug (s))
3606 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3607
3608 return false;
3609 }
3610
3611 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3612
3613 static inline tree
3614 gimple_debug_bind_get_var (gimple dbg)
3615 {
3616 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3617 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3618 return gimple_op (dbg, 0);
3619 }
3620
3621 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3622 statement. */
3623
3624 static inline tree
3625 gimple_debug_bind_get_value (gimple dbg)
3626 {
3627 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3628 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3629 return gimple_op (dbg, 1);
3630 }
3631
3632 /* Return a pointer to the value bound to the variable in a
3633 GIMPLE_DEBUG bind statement. */
3634
3635 static inline tree *
3636 gimple_debug_bind_get_value_ptr (gimple dbg)
3637 {
3638 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3639 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3640 return gimple_op_ptr (dbg, 1);
3641 }
3642
3643 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3644
3645 static inline void
3646 gimple_debug_bind_set_var (gimple dbg, tree var)
3647 {
3648 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3649 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3650 gimple_set_op (dbg, 0, var);
3651 }
3652
3653 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3654 statement. */
3655
3656 static inline void
3657 gimple_debug_bind_set_value (gimple dbg, tree value)
3658 {
3659 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3660 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3661 gimple_set_op (dbg, 1, value);
3662 }
3663
3664 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3665 optimized away. */
3666 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3667
3668 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3669 statement. */
3670
3671 static inline void
3672 gimple_debug_bind_reset_value (gimple dbg)
3673 {
3674 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3675 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3676 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3677 }
3678
3679 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3680 value. */
3681
3682 static inline bool
3683 gimple_debug_bind_has_value_p (gimple dbg)
3684 {
3685 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3686 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3687 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3688 }
3689
3690 #undef GIMPLE_DEBUG_BIND_NOVALUE
3691
3692 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3693
3694 static inline bool
3695 gimple_debug_source_bind_p (const_gimple s)
3696 {
3697 if (is_gimple_debug (s))
3698 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3699
3700 return false;
3701 }
3702
3703 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3704
3705 static inline tree
3706 gimple_debug_source_bind_get_var (gimple dbg)
3707 {
3708 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3709 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3710 return gimple_op (dbg, 0);
3711 }
3712
3713 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3714 statement. */
3715
3716 static inline tree
3717 gimple_debug_source_bind_get_value (gimple dbg)
3718 {
3719 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3720 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3721 return gimple_op (dbg, 1);
3722 }
3723
3724 /* Return a pointer to the value bound to the variable in a
3725 GIMPLE_DEBUG source bind statement. */
3726
3727 static inline tree *
3728 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3729 {
3730 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3731 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3732 return gimple_op_ptr (dbg, 1);
3733 }
3734
3735 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3736
3737 static inline void
3738 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3739 {
3740 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3741 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3742 gimple_set_op (dbg, 0, var);
3743 }
3744
3745 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3746 statement. */
3747
3748 static inline void
3749 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3750 {
3751 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3752 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3753 gimple_set_op (dbg, 1, value);
3754 }
3755
3756 /* Return the body for the OMP statement GS. */
3757
3758 static inline gimple_seq
3759 gimple_omp_body (gimple gs)
3760 {
3761 return gs->omp.body;
3762 }
3763
3764 /* Set BODY to be the body for the OMP statement GS. */
3765
3766 static inline void
3767 gimple_omp_set_body (gimple gs, gimple_seq body)
3768 {
3769 gs->omp.body = body;
3770 }
3771
3772
3773 /* Return the name associated with OMP_CRITICAL statement GS. */
3774
3775 static inline tree
3776 gimple_omp_critical_name (const_gimple gs)
3777 {
3778 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3779 return gs->gimple_omp_critical.name;
3780 }
3781
3782
3783 /* Return a pointer to the name associated with OMP critical statement GS. */
3784
3785 static inline tree *
3786 gimple_omp_critical_name_ptr (gimple gs)
3787 {
3788 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3789 return &gs->gimple_omp_critical.name;
3790 }
3791
3792
3793 /* Set NAME to be the name associated with OMP critical statement GS. */
3794
3795 static inline void
3796 gimple_omp_critical_set_name (gimple gs, tree name)
3797 {
3798 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3799 gs->gimple_omp_critical.name = name;
3800 }
3801
3802
3803 /* Return the clauses associated with OMP_FOR GS. */
3804
3805 static inline tree
3806 gimple_omp_for_clauses (const_gimple gs)
3807 {
3808 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3809 return gs->gimple_omp_for.clauses;
3810 }
3811
3812
3813 /* Return a pointer to the OMP_FOR GS. */
3814
3815 static inline tree *
3816 gimple_omp_for_clauses_ptr (gimple gs)
3817 {
3818 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3819 return &gs->gimple_omp_for.clauses;
3820 }
3821
3822
3823 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3824
3825 static inline void
3826 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3827 {
3828 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3829 gs->gimple_omp_for.clauses = clauses;
3830 }
3831
3832
3833 /* Get the collapse count of OMP_FOR GS. */
3834
3835 static inline size_t
3836 gimple_omp_for_collapse (gimple gs)
3837 {
3838 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3839 return gs->gimple_omp_for.collapse;
3840 }
3841
3842
3843 /* Return the index variable for OMP_FOR GS. */
3844
3845 static inline tree
3846 gimple_omp_for_index (const_gimple gs, size_t i)
3847 {
3848 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3849 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3850 return gs->gimple_omp_for.iter[i].index;
3851 }
3852
3853
3854 /* Return a pointer to the index variable for OMP_FOR GS. */
3855
3856 static inline tree *
3857 gimple_omp_for_index_ptr (gimple gs, size_t i)
3858 {
3859 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3860 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3861 return &gs->gimple_omp_for.iter[i].index;
3862 }
3863
3864
3865 /* Set INDEX to be the index variable for OMP_FOR GS. */
3866
3867 static inline void
3868 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3869 {
3870 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3871 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3872 gs->gimple_omp_for.iter[i].index = index;
3873 }
3874
3875
3876 /* Return the initial value for OMP_FOR GS. */
3877
3878 static inline tree
3879 gimple_omp_for_initial (const_gimple gs, size_t i)
3880 {
3881 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3882 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3883 return gs->gimple_omp_for.iter[i].initial;
3884 }
3885
3886
3887 /* Return a pointer to the initial value for OMP_FOR GS. */
3888
3889 static inline tree *
3890 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3891 {
3892 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3893 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3894 return &gs->gimple_omp_for.iter[i].initial;
3895 }
3896
3897
3898 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3899
3900 static inline void
3901 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3902 {
3903 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3904 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3905 gs->gimple_omp_for.iter[i].initial = initial;
3906 }
3907
3908
3909 /* Return the final value for OMP_FOR GS. */
3910
3911 static inline tree
3912 gimple_omp_for_final (const_gimple gs, size_t i)
3913 {
3914 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3915 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3916 return gs->gimple_omp_for.iter[i].final;
3917 }
3918
3919
3920 /* Return a pointer to the final value for OMP_FOR GS. */
3921
3922 static inline tree *
3923 gimple_omp_for_final_ptr (gimple gs, size_t i)
3924 {
3925 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3926 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3927 return &gs->gimple_omp_for.iter[i].final;
3928 }
3929
3930
3931 /* Set FINAL to be the final value for OMP_FOR GS. */
3932
3933 static inline void
3934 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3935 {
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3937 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3938 gs->gimple_omp_for.iter[i].final = final;
3939 }
3940
3941
3942 /* Return the increment value for OMP_FOR GS. */
3943
3944 static inline tree
3945 gimple_omp_for_incr (const_gimple gs, size_t i)
3946 {
3947 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3948 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3949 return gs->gimple_omp_for.iter[i].incr;
3950 }
3951
3952
3953 /* Return a pointer to the increment value for OMP_FOR GS. */
3954
3955 static inline tree *
3956 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3957 {
3958 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3959 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3960 return &gs->gimple_omp_for.iter[i].incr;
3961 }
3962
3963
3964 /* Set INCR to be the increment value for OMP_FOR GS. */
3965
3966 static inline void
3967 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3968 {
3969 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3970 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3971 gs->gimple_omp_for.iter[i].incr = incr;
3972 }
3973
3974
3975 /* Return the sequence of statements to execute before the OMP_FOR
3976 statement GS starts. */
3977
3978 static inline gimple_seq
3979 gimple_omp_for_pre_body (gimple gs)
3980 {
3981 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3982 return gs->gimple_omp_for.pre_body;
3983 }
3984
3985
3986 /* Set PRE_BODY to be the sequence of statements to execute before the
3987 OMP_FOR statement GS starts. */
3988
3989 static inline void
3990 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3991 {
3992 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3993 gs->gimple_omp_for.pre_body = pre_body;
3994 }
3995
3996
3997 /* Return the clauses associated with OMP_PARALLEL GS. */
3998
3999 static inline tree
4000 gimple_omp_parallel_clauses (const_gimple gs)
4001 {
4002 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4003 return gs->gimple_omp_parallel.clauses;
4004 }
4005
4006
4007 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4008
4009 static inline tree *
4010 gimple_omp_parallel_clauses_ptr (gimple gs)
4011 {
4012 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4013 return &gs->gimple_omp_parallel.clauses;
4014 }
4015
4016
4017 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4018 GS. */
4019
4020 static inline void
4021 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4022 {
4023 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4024 gs->gimple_omp_parallel.clauses = clauses;
4025 }
4026
4027
4028 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4029
4030 static inline tree
4031 gimple_omp_parallel_child_fn (const_gimple gs)
4032 {
4033 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4034 return gs->gimple_omp_parallel.child_fn;
4035 }
4036
4037 /* Return a pointer to the child function used to hold the body of
4038 OMP_PARALLEL GS. */
4039
4040 static inline tree *
4041 gimple_omp_parallel_child_fn_ptr (gimple gs)
4042 {
4043 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4044 return &gs->gimple_omp_parallel.child_fn;
4045 }
4046
4047
4048 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4049
4050 static inline void
4051 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4052 {
4053 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4054 gs->gimple_omp_parallel.child_fn = child_fn;
4055 }
4056
4057
4058 /* Return the artificial argument used to send variables and values
4059 from the parent to the children threads in OMP_PARALLEL GS. */
4060
4061 static inline tree
4062 gimple_omp_parallel_data_arg (const_gimple gs)
4063 {
4064 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4065 return gs->gimple_omp_parallel.data_arg;
4066 }
4067
4068
4069 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4070
4071 static inline tree *
4072 gimple_omp_parallel_data_arg_ptr (gimple gs)
4073 {
4074 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4075 return &gs->gimple_omp_parallel.data_arg;
4076 }
4077
4078
4079 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4080
4081 static inline void
4082 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4083 {
4084 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4085 gs->gimple_omp_parallel.data_arg = data_arg;
4086 }
4087
4088
4089 /* Return the clauses associated with OMP_TASK GS. */
4090
4091 static inline tree
4092 gimple_omp_task_clauses (const_gimple gs)
4093 {
4094 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4095 return gs->gimple_omp_parallel.clauses;
4096 }
4097
4098
4099 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4100
4101 static inline tree *
4102 gimple_omp_task_clauses_ptr (gimple gs)
4103 {
4104 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4105 return &gs->gimple_omp_parallel.clauses;
4106 }
4107
4108
4109 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4110 GS. */
4111
4112 static inline void
4113 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4114 {
4115 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4116 gs->gimple_omp_parallel.clauses = clauses;
4117 }
4118
4119
4120 /* Return the child function used to hold the body of OMP_TASK GS. */
4121
4122 static inline tree
4123 gimple_omp_task_child_fn (const_gimple gs)
4124 {
4125 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4126 return gs->gimple_omp_parallel.child_fn;
4127 }
4128
4129 /* Return a pointer to the child function used to hold the body of
4130 OMP_TASK GS. */
4131
4132 static inline tree *
4133 gimple_omp_task_child_fn_ptr (gimple gs)
4134 {
4135 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4136 return &gs->gimple_omp_parallel.child_fn;
4137 }
4138
4139
4140 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4141
4142 static inline void
4143 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4144 {
4145 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4146 gs->gimple_omp_parallel.child_fn = child_fn;
4147 }
4148
4149
4150 /* Return the artificial argument used to send variables and values
4151 from the parent to the children threads in OMP_TASK GS. */
4152
4153 static inline tree
4154 gimple_omp_task_data_arg (const_gimple gs)
4155 {
4156 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4157 return gs->gimple_omp_parallel.data_arg;
4158 }
4159
4160
4161 /* Return a pointer to the data argument for OMP_TASK GS. */
4162
4163 static inline tree *
4164 gimple_omp_task_data_arg_ptr (gimple gs)
4165 {
4166 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4167 return &gs->gimple_omp_parallel.data_arg;
4168 }
4169
4170
4171 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4172
4173 static inline void
4174 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4175 {
4176 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4177 gs->gimple_omp_parallel.data_arg = data_arg;
4178 }
4179
4180
4181 /* Return the clauses associated with OMP_TASK GS. */
4182
4183 static inline tree
4184 gimple_omp_taskreg_clauses (const_gimple gs)
4185 {
4186 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4187 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4188 return gs->gimple_omp_parallel.clauses;
4189 }
4190
4191
4192 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4193
4194 static inline tree *
4195 gimple_omp_taskreg_clauses_ptr (gimple gs)
4196 {
4197 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4198 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4199 return &gs->gimple_omp_parallel.clauses;
4200 }
4201
4202
4203 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4204 GS. */
4205
4206 static inline void
4207 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4208 {
4209 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4210 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4211 gs->gimple_omp_parallel.clauses = clauses;
4212 }
4213
4214
4215 /* Return the child function used to hold the body of OMP_TASK GS. */
4216
4217 static inline tree
4218 gimple_omp_taskreg_child_fn (const_gimple gs)
4219 {
4220 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4221 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4222 return gs->gimple_omp_parallel.child_fn;
4223 }
4224
4225 /* Return a pointer to the child function used to hold the body of
4226 OMP_TASK GS. */
4227
4228 static inline tree *
4229 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4230 {
4231 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4232 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4233 return &gs->gimple_omp_parallel.child_fn;
4234 }
4235
4236
4237 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4238
4239 static inline void
4240 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4241 {
4242 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4243 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4244 gs->gimple_omp_parallel.child_fn = child_fn;
4245 }
4246
4247
4248 /* Return the artificial argument used to send variables and values
4249 from the parent to the children threads in OMP_TASK GS. */
4250
4251 static inline tree
4252 gimple_omp_taskreg_data_arg (const_gimple gs)
4253 {
4254 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4255 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4256 return gs->gimple_omp_parallel.data_arg;
4257 }
4258
4259
4260 /* Return a pointer to the data argument for OMP_TASK GS. */
4261
4262 static inline tree *
4263 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4264 {
4265 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4266 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4267 return &gs->gimple_omp_parallel.data_arg;
4268 }
4269
4270
4271 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4272
4273 static inline void
4274 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4275 {
4276 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4277 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4278 gs->gimple_omp_parallel.data_arg = data_arg;
4279 }
4280
4281
4282 /* Return the copy function used to hold the body of OMP_TASK GS. */
4283
4284 static inline tree
4285 gimple_omp_task_copy_fn (const_gimple gs)
4286 {
4287 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4288 return gs->gimple_omp_task.copy_fn;
4289 }
4290
4291 /* Return a pointer to the copy function used to hold the body of
4292 OMP_TASK GS. */
4293
4294 static inline tree *
4295 gimple_omp_task_copy_fn_ptr (gimple gs)
4296 {
4297 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4298 return &gs->gimple_omp_task.copy_fn;
4299 }
4300
4301
4302 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4303
4304 static inline void
4305 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4306 {
4307 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4308 gs->gimple_omp_task.copy_fn = copy_fn;
4309 }
4310
4311
4312 /* Return size of the data block in bytes in OMP_TASK GS. */
4313
4314 static inline tree
4315 gimple_omp_task_arg_size (const_gimple gs)
4316 {
4317 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4318 return gs->gimple_omp_task.arg_size;
4319 }
4320
4321
4322 /* Return a pointer to the data block size for OMP_TASK GS. */
4323
4324 static inline tree *
4325 gimple_omp_task_arg_size_ptr (gimple gs)
4326 {
4327 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4328 return &gs->gimple_omp_task.arg_size;
4329 }
4330
4331
4332 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4333
4334 static inline void
4335 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4336 {
4337 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4338 gs->gimple_omp_task.arg_size = arg_size;
4339 }
4340
4341
4342 /* Return align of the data block in bytes in OMP_TASK GS. */
4343
4344 static inline tree
4345 gimple_omp_task_arg_align (const_gimple gs)
4346 {
4347 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4348 return gs->gimple_omp_task.arg_align;
4349 }
4350
4351
4352 /* Return a pointer to the data block align for OMP_TASK GS. */
4353
4354 static inline tree *
4355 gimple_omp_task_arg_align_ptr (gimple gs)
4356 {
4357 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4358 return &gs->gimple_omp_task.arg_align;
4359 }
4360
4361
4362 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4363
4364 static inline void
4365 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4366 {
4367 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4368 gs->gimple_omp_task.arg_align = arg_align;
4369 }
4370
4371
4372 /* Return the clauses associated with OMP_SINGLE GS. */
4373
4374 static inline tree
4375 gimple_omp_single_clauses (const_gimple gs)
4376 {
4377 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4378 return gs->gimple_omp_single.clauses;
4379 }
4380
4381
4382 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4383
4384 static inline tree *
4385 gimple_omp_single_clauses_ptr (gimple gs)
4386 {
4387 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4388 return &gs->gimple_omp_single.clauses;
4389 }
4390
4391
4392 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4393
4394 static inline void
4395 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4396 {
4397 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4398 gs->gimple_omp_single.clauses = clauses;
4399 }
4400
4401
4402 /* Return the clauses associated with OMP_SECTIONS GS. */
4403
4404 static inline tree
4405 gimple_omp_sections_clauses (const_gimple gs)
4406 {
4407 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4408 return gs->gimple_omp_sections.clauses;
4409 }
4410
4411
4412 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4413
4414 static inline tree *
4415 gimple_omp_sections_clauses_ptr (gimple gs)
4416 {
4417 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4418 return &gs->gimple_omp_sections.clauses;
4419 }
4420
4421
4422 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4423 GS. */
4424
4425 static inline void
4426 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4427 {
4428 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4429 gs->gimple_omp_sections.clauses = clauses;
4430 }
4431
4432
4433 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4434 in GS. */
4435
4436 static inline tree
4437 gimple_omp_sections_control (const_gimple gs)
4438 {
4439 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4440 return gs->gimple_omp_sections.control;
4441 }
4442
4443
4444 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4445 GS. */
4446
4447 static inline tree *
4448 gimple_omp_sections_control_ptr (gimple gs)
4449 {
4450 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4451 return &gs->gimple_omp_sections.control;
4452 }
4453
4454
4455 /* Set CONTROL to be the set of clauses associated with the
4456 GIMPLE_OMP_SECTIONS in GS. */
4457
4458 static inline void
4459 gimple_omp_sections_set_control (gimple gs, tree control)
4460 {
4461 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4462 gs->gimple_omp_sections.control = control;
4463 }
4464
4465
4466 /* Set COND to be the condition code for OMP_FOR GS. */
4467
4468 static inline void
4469 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4470 {
4471 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4472 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4473 && i < gs->gimple_omp_for.collapse);
4474 gs->gimple_omp_for.iter[i].cond = cond;
4475 }
4476
4477
4478 /* Return the condition code associated with OMP_FOR GS. */
4479
4480 static inline enum tree_code
4481 gimple_omp_for_cond (const_gimple gs, size_t i)
4482 {
4483 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4484 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4485 return gs->gimple_omp_for.iter[i].cond;
4486 }
4487
4488
4489 /* Set the value being stored in an atomic store. */
4490
4491 static inline void
4492 gimple_omp_atomic_store_set_val (gimple g, tree val)
4493 {
4494 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4495 g->gimple_omp_atomic_store.val = val;
4496 }
4497
4498
4499 /* Return the value being stored in an atomic store. */
4500
4501 static inline tree
4502 gimple_omp_atomic_store_val (const_gimple g)
4503 {
4504 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4505 return g->gimple_omp_atomic_store.val;
4506 }
4507
4508
4509 /* Return a pointer to the value being stored in an atomic store. */
4510
4511 static inline tree *
4512 gimple_omp_atomic_store_val_ptr (gimple g)
4513 {
4514 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4515 return &g->gimple_omp_atomic_store.val;
4516 }
4517
4518
4519 /* Set the LHS of an atomic load. */
4520
4521 static inline void
4522 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4523 {
4524 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4525 g->gimple_omp_atomic_load.lhs = lhs;
4526 }
4527
4528
4529 /* Get the LHS of an atomic load. */
4530
4531 static inline tree
4532 gimple_omp_atomic_load_lhs (const_gimple g)
4533 {
4534 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4535 return g->gimple_omp_atomic_load.lhs;
4536 }
4537
4538
4539 /* Return a pointer to the LHS of an atomic load. */
4540
4541 static inline tree *
4542 gimple_omp_atomic_load_lhs_ptr (gimple g)
4543 {
4544 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4545 return &g->gimple_omp_atomic_load.lhs;
4546 }
4547
4548
4549 /* Set the RHS of an atomic load. */
4550
4551 static inline void
4552 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4553 {
4554 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4555 g->gimple_omp_atomic_load.rhs = rhs;
4556 }
4557
4558
4559 /* Get the RHS of an atomic load. */
4560
4561 static inline tree
4562 gimple_omp_atomic_load_rhs (const_gimple g)
4563 {
4564 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4565 return g->gimple_omp_atomic_load.rhs;
4566 }
4567
4568
4569 /* Return a pointer to the RHS of an atomic load. */
4570
4571 static inline tree *
4572 gimple_omp_atomic_load_rhs_ptr (gimple g)
4573 {
4574 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4575 return &g->gimple_omp_atomic_load.rhs;
4576 }
4577
4578
4579 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4580
4581 static inline tree
4582 gimple_omp_continue_control_def (const_gimple g)
4583 {
4584 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4585 return g->gimple_omp_continue.control_def;
4586 }
4587
4588 /* The same as above, but return the address. */
4589
4590 static inline tree *
4591 gimple_omp_continue_control_def_ptr (gimple g)
4592 {
4593 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4594 return &g->gimple_omp_continue.control_def;
4595 }
4596
4597 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4598
4599 static inline void
4600 gimple_omp_continue_set_control_def (gimple g, tree def)
4601 {
4602 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4603 g->gimple_omp_continue.control_def = def;
4604 }
4605
4606
4607 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4608
4609 static inline tree
4610 gimple_omp_continue_control_use (const_gimple g)
4611 {
4612 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4613 return g->gimple_omp_continue.control_use;
4614 }
4615
4616
4617 /* The same as above, but return the address. */
4618
4619 static inline tree *
4620 gimple_omp_continue_control_use_ptr (gimple g)
4621 {
4622 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4623 return &g->gimple_omp_continue.control_use;
4624 }
4625
4626
4627 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4628
4629 static inline void
4630 gimple_omp_continue_set_control_use (gimple g, tree use)
4631 {
4632 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4633 g->gimple_omp_continue.control_use = use;
4634 }
4635
4636 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4637
4638 static inline gimple_seq
4639 gimple_transaction_body (gimple gs)
4640 {
4641 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4642 return gs->gimple_transaction.body;
4643 }
4644
4645 /* Return the label associated with a GIMPLE_TRANSACTION. */
4646
4647 static inline tree
4648 gimple_transaction_label (const_gimple gs)
4649 {
4650 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4651 return gs->gimple_transaction.label;
4652 }
4653
4654 static inline tree *
4655 gimple_transaction_label_ptr (gimple gs)
4656 {
4657 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4658 return &gs->gimple_transaction.label;
4659 }
4660
4661 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4662
4663 static inline unsigned int
4664 gimple_transaction_subcode (const_gimple gs)
4665 {
4666 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4667 return gs->gsbase.subcode;
4668 }
4669
4670 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4671
4672 static inline void
4673 gimple_transaction_set_body (gimple gs, gimple_seq body)
4674 {
4675 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4676 gs->gimple_transaction.body = body;
4677 }
4678
4679 /* Set the label associated with a GIMPLE_TRANSACTION. */
4680
4681 static inline void
4682 gimple_transaction_set_label (gimple gs, tree label)
4683 {
4684 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4685 gs->gimple_transaction.label = label;
4686 }
4687
4688 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4689
4690 static inline void
4691 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4692 {
4693 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4694 gs->gsbase.subcode = subcode;
4695 }
4696
4697
4698 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4699
4700 static inline tree *
4701 gimple_return_retval_ptr (const_gimple gs)
4702 {
4703 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4704 return gimple_op_ptr (gs, 0);
4705 }
4706
4707 /* Return the return value for GIMPLE_RETURN GS. */
4708
4709 static inline tree
4710 gimple_return_retval (const_gimple gs)
4711 {
4712 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4713 return gimple_op (gs, 0);
4714 }
4715
4716
4717 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4718
4719 static inline void
4720 gimple_return_set_retval (gimple gs, tree retval)
4721 {
4722 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4723 gimple_set_op (gs, 0, retval);
4724 }
4725
4726
4727 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4728
4729 #define CASE_GIMPLE_OMP \
4730 case GIMPLE_OMP_PARALLEL: \
4731 case GIMPLE_OMP_TASK: \
4732 case GIMPLE_OMP_FOR: \
4733 case GIMPLE_OMP_SECTIONS: \
4734 case GIMPLE_OMP_SECTIONS_SWITCH: \
4735 case GIMPLE_OMP_SINGLE: \
4736 case GIMPLE_OMP_SECTION: \
4737 case GIMPLE_OMP_MASTER: \
4738 case GIMPLE_OMP_ORDERED: \
4739 case GIMPLE_OMP_CRITICAL: \
4740 case GIMPLE_OMP_RETURN: \
4741 case GIMPLE_OMP_ATOMIC_LOAD: \
4742 case GIMPLE_OMP_ATOMIC_STORE: \
4743 case GIMPLE_OMP_CONTINUE
4744
4745 static inline bool
4746 is_gimple_omp (const_gimple stmt)
4747 {
4748 switch (gimple_code (stmt))
4749 {
4750 CASE_GIMPLE_OMP:
4751 return true;
4752 default:
4753 return false;
4754 }
4755 }
4756
4757
4758 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4759
4760 static inline bool
4761 gimple_nop_p (const_gimple g)
4762 {
4763 return gimple_code (g) == GIMPLE_NOP;
4764 }
4765
4766
4767 /* Return true if GS is a GIMPLE_RESX. */
4768
4769 static inline bool
4770 is_gimple_resx (const_gimple gs)
4771 {
4772 return gimple_code (gs) == GIMPLE_RESX;
4773 }
4774
4775 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4776
4777 static inline enum br_predictor
4778 gimple_predict_predictor (gimple gs)
4779 {
4780 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4781 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4782 }
4783
4784
4785 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4786
4787 static inline void
4788 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4789 {
4790 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4791 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4792 | (unsigned) predictor;
4793 }
4794
4795
4796 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4797
4798 static inline enum prediction
4799 gimple_predict_outcome (gimple gs)
4800 {
4801 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4802 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4803 }
4804
4805
4806 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4807
4808 static inline void
4809 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4810 {
4811 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4812 if (outcome == TAKEN)
4813 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4814 else
4815 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4816 }
4817
4818
4819 /* Return the type of the main expression computed by STMT. Return
4820 void_type_node if the statement computes nothing. */
4821
4822 static inline tree
4823 gimple_expr_type (const_gimple stmt)
4824 {
4825 enum gimple_code code = gimple_code (stmt);
4826
4827 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4828 {
4829 tree type;
4830 /* In general we want to pass out a type that can be substituted
4831 for both the RHS and the LHS types if there is a possibly
4832 useless conversion involved. That means returning the
4833 original RHS type as far as we can reconstruct it. */
4834 if (code == GIMPLE_CALL)
4835 type = gimple_call_return_type (stmt);
4836 else
4837 switch (gimple_assign_rhs_code (stmt))
4838 {
4839 case POINTER_PLUS_EXPR:
4840 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4841 break;
4842
4843 default:
4844 /* As fallback use the type of the LHS. */
4845 type = TREE_TYPE (gimple_get_lhs (stmt));
4846 break;
4847 }
4848 return type;
4849 }
4850 else if (code == GIMPLE_COND)
4851 return boolean_type_node;
4852 else
4853 return void_type_node;
4854 }
4855
4856 /* Return true if TYPE is a suitable type for a scalar register variable. */
4857
4858 static inline bool
4859 is_gimple_reg_type (tree type)
4860 {
4861 return !AGGREGATE_TYPE_P (type);
4862 }
4863
4864 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4865
4866 static inline gimple_stmt_iterator
4867 gsi_start (gimple_seq seq)
4868 {
4869 gimple_stmt_iterator i;
4870
4871 i.ptr = gimple_seq_first (seq);
4872 i.seq = seq;
4873 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4874
4875 return i;
4876 }
4877
4878
4879 /* Return a new iterator pointing to the first statement in basic block BB. */
4880
4881 static inline gimple_stmt_iterator
4882 gsi_start_bb (basic_block bb)
4883 {
4884 gimple_stmt_iterator i;
4885 gimple_seq seq;
4886
4887 seq = bb_seq (bb);
4888 i.ptr = gimple_seq_first (seq);
4889 i.seq = seq;
4890 i.bb = bb;
4891
4892 return i;
4893 }
4894
4895
4896 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4897
4898 static inline gimple_stmt_iterator
4899 gsi_last (gimple_seq seq)
4900 {
4901 gimple_stmt_iterator i;
4902
4903 i.ptr = gimple_seq_last (seq);
4904 i.seq = seq;
4905 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4906
4907 return i;
4908 }
4909
4910
4911 /* Return a new iterator pointing to the last statement in basic block BB. */
4912
4913 static inline gimple_stmt_iterator
4914 gsi_last_bb (basic_block bb)
4915 {
4916 gimple_stmt_iterator i;
4917 gimple_seq seq;
4918
4919 seq = bb_seq (bb);
4920 i.ptr = gimple_seq_last (seq);
4921 i.seq = seq;
4922 i.bb = bb;
4923
4924 return i;
4925 }
4926
4927
4928 /* Return true if I is at the end of its sequence. */
4929
4930 static inline bool
4931 gsi_end_p (gimple_stmt_iterator i)
4932 {
4933 return i.ptr == NULL;
4934 }
4935
4936
4937 /* Return true if I is one statement before the end of its sequence. */
4938
4939 static inline bool
4940 gsi_one_before_end_p (gimple_stmt_iterator i)
4941 {
4942 return i.ptr != NULL && i.ptr->next == NULL;
4943 }
4944
4945
4946 /* Advance the iterator to the next gimple statement. */
4947
4948 static inline void
4949 gsi_next (gimple_stmt_iterator *i)
4950 {
4951 i->ptr = i->ptr->next;
4952 }
4953
4954 /* Advance the iterator to the previous gimple statement. */
4955
4956 static inline void
4957 gsi_prev (gimple_stmt_iterator *i)
4958 {
4959 i->ptr = i->ptr->prev;
4960 }
4961
4962 /* Return the current stmt. */
4963
4964 static inline gimple
4965 gsi_stmt (gimple_stmt_iterator i)
4966 {
4967 return i.ptr->stmt;
4968 }
4969
4970 /* Return a block statement iterator that points to the first non-label
4971 statement in block BB. */
4972
4973 static inline gimple_stmt_iterator
4974 gsi_after_labels (basic_block bb)
4975 {
4976 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4977
4978 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4979 gsi_next (&gsi);
4980
4981 return gsi;
4982 }
4983
4984 /* Advance the iterator to the next non-debug gimple statement. */
4985
4986 static inline void
4987 gsi_next_nondebug (gimple_stmt_iterator *i)
4988 {
4989 do
4990 {
4991 gsi_next (i);
4992 }
4993 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4994 }
4995
4996 /* Advance the iterator to the next non-debug gimple statement. */
4997
4998 static inline void
4999 gsi_prev_nondebug (gimple_stmt_iterator *i)
5000 {
5001 do
5002 {
5003 gsi_prev (i);
5004 }
5005 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5006 }
5007
5008 /* Return a new iterator pointing to the first non-debug statement in
5009 basic block BB. */
5010
5011 static inline gimple_stmt_iterator
5012 gsi_start_nondebug_bb (basic_block bb)
5013 {
5014 gimple_stmt_iterator i = gsi_start_bb (bb);
5015
5016 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5017 gsi_next_nondebug (&i);
5018
5019 return i;
5020 }
5021
5022 /* Return a new iterator pointing to the last non-debug statement in
5023 basic block BB. */
5024
5025 static inline gimple_stmt_iterator
5026 gsi_last_nondebug_bb (basic_block bb)
5027 {
5028 gimple_stmt_iterator i = gsi_last_bb (bb);
5029
5030 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5031 gsi_prev_nondebug (&i);
5032
5033 return i;
5034 }
5035
5036 /* Return a pointer to the current stmt.
5037
5038 NOTE: You may want to use gsi_replace on the iterator itself,
5039 as this performs additional bookkeeping that will not be done
5040 if you simply assign through a pointer returned by gsi_stmt_ptr. */
5041
5042 static inline gimple *
5043 gsi_stmt_ptr (gimple_stmt_iterator *i)
5044 {
5045 return &i->ptr->stmt;
5046 }
5047
5048
5049 /* Return the basic block associated with this iterator. */
5050
5051 static inline basic_block
5052 gsi_bb (gimple_stmt_iterator i)
5053 {
5054 return i.bb;
5055 }
5056
5057
5058 /* Return the sequence associated with this iterator. */
5059
5060 static inline gimple_seq
5061 gsi_seq (gimple_stmt_iterator i)
5062 {
5063 return i.seq;
5064 }
5065
5066
5067 enum gsi_iterator_update
5068 {
5069 GSI_NEW_STMT, /* Only valid when single statement is added, move
5070 iterator to it. */
5071 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5072 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5073 for linking other statements in the same
5074 direction. */
5075 };
5076
5077 /* In gimple-iterator.c */
5078 gimple_stmt_iterator gsi_start_phis (basic_block);
5079 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5080 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
5081 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5082 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5083 enum gsi_iterator_update);
5084 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5085 enum gsi_iterator_update);
5086 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5087 enum gsi_iterator_update);
5088 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5089 enum gsi_iterator_update);
5090 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5091 enum gsi_iterator_update);
5092 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5093 enum gsi_iterator_update);
5094 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5095 enum gsi_iterator_update);
5096 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5097 enum gsi_iterator_update);
5098 bool gsi_remove (gimple_stmt_iterator *, bool);
5099 gimple_stmt_iterator gsi_for_stmt (gimple);
5100 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5101 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5102 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
5103 void gsi_insert_on_edge (edge, gimple);
5104 void gsi_insert_seq_on_edge (edge, gimple_seq);
5105 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5106 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5107 void gsi_commit_one_edge_insert (edge, basic_block *);
5108 void gsi_commit_edge_inserts (void);
5109 gimple gimple_call_copy_skip_args (gimple, bitmap);
5110
5111
5112 /* Convenience routines to walk all statements of a gimple function.
5113 Note that this is useful exclusively before the code is converted
5114 into SSA form. Once the program is in SSA form, the standard
5115 operand interface should be used to analyze/modify statements. */
5116 struct walk_stmt_info
5117 {
5118 /* Points to the current statement being walked. */
5119 gimple_stmt_iterator gsi;
5120
5121 /* Additional data that the callback functions may want to carry
5122 through the recursion. */
5123 void *info;
5124
5125 /* Pointer map used to mark visited tree nodes when calling
5126 walk_tree on each operand. If set to NULL, duplicate tree nodes
5127 will be visited more than once. */
5128 struct pointer_set_t *pset;
5129
5130 /* Operand returned by the callbacks. This is set when calling
5131 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5132 returns non-NULL, this field will contain the tree returned by
5133 the last callback. */
5134 tree callback_result;
5135
5136 /* Indicates whether the operand being examined may be replaced
5137 with something that matches is_gimple_val (if true) or something
5138 slightly more complicated (if false). "Something" technically
5139 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5140 but we never try to form anything more complicated than that, so
5141 we don't bother checking.
5142
5143 Also note that CALLBACK should update this flag while walking the
5144 sub-expressions of a statement. For instance, when walking the
5145 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5146 to true, however, when walking &var, the operand of that
5147 ADDR_EXPR does not need to be a GIMPLE value. */
5148 BOOL_BITFIELD val_only : 1;
5149
5150 /* True if we are currently walking the LHS of an assignment. */
5151 BOOL_BITFIELD is_lhs : 1;
5152
5153 /* Optional. Set to true by the callback functions if they made any
5154 changes. */
5155 BOOL_BITFIELD changed : 1;
5156
5157 /* True if we're interested in location information. */
5158 BOOL_BITFIELD want_locations : 1;
5159
5160 /* True if we've removed the statement that was processed. */
5161 BOOL_BITFIELD removed_stmt : 1;
5162 };
5163
5164 /* Callback for walk_gimple_stmt. Called for every statement found
5165 during traversal. The first argument points to the statement to
5166 walk. The second argument is a flag that the callback sets to
5167 'true' if it the callback handled all the operands and
5168 sub-statements of the statement (the default value of this flag is
5169 'false'). The third argument is an anonymous pointer to data
5170 to be used by the callback. */
5171 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5172 struct walk_stmt_info *);
5173
5174 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5175 struct walk_stmt_info *);
5176 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5177 struct walk_stmt_info *);
5178 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5179
5180 #ifdef GATHER_STATISTICS
5181 /* Enum and arrays used for allocation stats. Keep in sync with
5182 gimple.c:gimple_alloc_kind_names. */
5183 enum gimple_alloc_kind
5184 {
5185 gimple_alloc_kind_assign, /* Assignments. */
5186 gimple_alloc_kind_phi, /* PHI nodes. */
5187 gimple_alloc_kind_cond, /* Conditionals. */
5188 gimple_alloc_kind_seq, /* Sequences. */
5189 gimple_alloc_kind_rest, /* Everything else. */
5190 gimple_alloc_kind_all
5191 };
5192
5193 extern int gimple_alloc_counts[];
5194 extern int gimple_alloc_sizes[];
5195
5196 /* Return the allocation kind for a given stmt CODE. */
5197 static inline enum gimple_alloc_kind
5198 gimple_alloc_kind (enum gimple_code code)
5199 {
5200 switch (code)
5201 {
5202 case GIMPLE_ASSIGN:
5203 return gimple_alloc_kind_assign;
5204 case GIMPLE_PHI:
5205 return gimple_alloc_kind_phi;
5206 case GIMPLE_COND:
5207 return gimple_alloc_kind_cond;
5208 default:
5209 return gimple_alloc_kind_rest;
5210 }
5211 }
5212 #endif /* GATHER_STATISTICS */
5213
5214 extern void dump_gimple_statistics (void);
5215
5216 /* In gimple-fold.c. */
5217 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5218 tree gimple_fold_builtin (gimple);
5219 bool fold_stmt (gimple_stmt_iterator *);
5220 bool fold_stmt_inplace (gimple_stmt_iterator *);
5221 tree get_symbol_constant_value (tree);
5222 tree canonicalize_constructor_val (tree);
5223 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5224 enum tree_code, tree, tree);
5225 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5226 enum tree_code, tree, tree);
5227
5228 bool gimple_val_nonnegative_real_p (tree);
5229 #endif /* GCC_GIMPLE_H */