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