* gimple.h (gimple_expr_code): Do checking on when gimple checking is enabled.
[platform/upstream/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 "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "tm.h"
31 #include "hard-reg-set.h"
32 #include "basic-block.h"
33 #include "tree-ssa-operands.h"
34 #include "tree-ssa-alias.h"
35
36 /* For each block, the PHI nodes that need to be rewritten are stored into
37    these vectors.  */
38 typedef VEC(gimple, heap) *gimple_vec;
39 DEF_VEC_P (gimple_vec);
40 DEF_VEC_ALLOC_P (gimple_vec, heap);
41
42 enum gimple_code {
43 #define DEFGSCODE(SYM, STRING, STRUCT)  SYM,
44 #include "gimple.def"
45 #undef DEFGSCODE
46     LAST_AND_UNUSED_GIMPLE_CODE
47 };
48
49 extern const char *const gimple_code_name[];
50 extern const unsigned char gimple_rhs_class_table[];
51
52 /* Error out if a gimple tuple is addressed incorrectly.  */
53 #if defined ENABLE_GIMPLE_CHECKING
54 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
55 extern void gimple_check_failed (const_gimple, const char *, int,          \
56                                  const char *, enum gimple_code,           \
57                                  enum tree_code) ATTRIBUTE_NORETURN;
58
59 #define GIMPLE_CHECK(GS, CODE)                                          \
60   do {                                                                  \
61     const_gimple __gs = (GS);                                           \
62     if (gimple_code (__gs) != (CODE))                                   \
63       gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__,      \
64                            (CODE), ERROR_MARK);                         \
65   } while (0)
66 #else  /* not ENABLE_GIMPLE_CHECKING  */
67 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
68 #define GIMPLE_CHECK(GS, CODE)                  (void)0
69 #endif
70
71 /* Class of GIMPLE expressions suitable for the RHS of assignments.  See
72    get_gimple_rhs_class.  */
73 enum gimple_rhs_class
74 {
75   GIMPLE_INVALID_RHS,   /* The expression cannot be used on the RHS.  */
76   GIMPLE_BINARY_RHS,    /* The expression is a binary operation.  */
77   GIMPLE_UNARY_RHS,     /* The expression is a unary operation.  */
78   GIMPLE_SINGLE_RHS     /* The expression is a single object (an SSA
79                            name, a _DECL, a _REF, etc.  */
80 };
81
82 /* Specific flags for individual GIMPLE statements.  These flags are
83    always stored in gimple_statement_base.subcode and they may only be
84    defined for statement codes that do not use sub-codes.
85
86    Values for the masks can overlap as long as the overlapping values
87    are never used in the same statement class.
88
89    The maximum mask value that can be defined is 1 << 15 (i.e., each
90    statement code can hold up to 16 bitflags).
91
92    Keep this list sorted.  */
93 enum gf_mask {
94     GF_ASM_INPUT                = 1 << 0,
95     GF_ASM_VOLATILE             = 1 << 1,
96     GF_CALL_CANNOT_INLINE       = 1 << 0,
97     GF_CALL_FROM_THUNK          = 1 << 1,
98     GF_CALL_RETURN_SLOT_OPT     = 1 << 2,
99     GF_CALL_TAILCALL            = 1 << 3,
100     GF_CALL_VA_ARG_PACK         = 1 << 4,
101     GF_CALL_NOTHROW             = 1 << 5,
102     GF_OMP_PARALLEL_COMBINED    = 1 << 0,
103
104     /* True on an GIMPLE_OMP_RETURN statement if the return does not require
105        a thread synchronization via some sort of barrier.  The exact barrier
106        that would otherwise be emitted is dependent on the OMP statement with
107        which this return is associated.  */
108     GF_OMP_RETURN_NOWAIT        = 1 << 0,
109
110     GF_OMP_SECTION_LAST         = 1 << 0,
111     GF_PREDICT_TAKEN            = 1 << 15
112 };
113
114 /* Currently, there's only one type of gimple debug stmt.  Others are
115    envisioned, for example, to enable the generation of is_stmt notes
116    in line number information, to mark sequence points, etc.  This
117    subcode is to be used to tell them apart.  */
118 enum gimple_debug_subcode {
119   GIMPLE_DEBUG_BIND = 0
120 };
121
122 /* Masks for selecting a pass local flag (PLF) to work on.  These
123    masks are used by gimple_set_plf and gimple_plf.  */
124 enum plf_mask {
125     GF_PLF_1    = 1 << 0,
126     GF_PLF_2    = 1 << 1
127 };
128
129 /* A node in a gimple_seq_d.  */
130 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
131   gimple stmt;
132   struct gimple_seq_node_d *prev;
133   struct gimple_seq_node_d *next;
134 };
135
136 /* A double-linked sequence of gimple statements.  */
137 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
138   /* First and last statements in the sequence.  */
139   gimple_seq_node first;
140   gimple_seq_node last;
141
142   /* Sequences are created/destroyed frequently.  To minimize
143      allocation activity, deallocated sequences are kept in a pool of
144      available sequences.  This is the pointer to the next free
145      sequence in the pool.  */
146   gimple_seq next_free;
147 };
148
149
150 /* Return the first node in GIMPLE sequence S.  */
151
152 static inline gimple_seq_node
153 gimple_seq_first (const_gimple_seq s)
154 {
155   return s ? s->first : NULL;
156 }
157
158
159 /* Return the first statement in GIMPLE sequence S.  */
160
161 static inline gimple
162 gimple_seq_first_stmt (const_gimple_seq s)
163 {
164   gimple_seq_node n = gimple_seq_first (s);
165   return (n) ? n->stmt : NULL;
166 }
167
168
169 /* Return the last node in GIMPLE sequence S.  */
170
171 static inline gimple_seq_node
172 gimple_seq_last (const_gimple_seq s)
173 {
174   return s ? s->last : NULL;
175 }
176
177
178 /* Return the last statement in GIMPLE sequence S.  */
179
180 static inline gimple
181 gimple_seq_last_stmt (const_gimple_seq s)
182 {
183   gimple_seq_node n = gimple_seq_last (s);
184   return (n) ? n->stmt : NULL;
185 }
186
187
188 /* Set the last node in GIMPLE sequence S to LAST.  */
189
190 static inline void
191 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
192 {
193   s->last = last;
194 }
195
196
197 /* Set the first node in GIMPLE sequence S to FIRST.  */
198
199 static inline void
200 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
201 {
202   s->first = first;
203 }
204
205
206 /* Return true if GIMPLE sequence S is empty.  */
207
208 static inline bool
209 gimple_seq_empty_p (const_gimple_seq s)
210 {
211   return s == NULL || s->first == NULL;
212 }
213
214
215 void gimple_seq_add_stmt (gimple_seq *, gimple);
216
217 /* Link gimple statement GS to the end of the sequence *SEQ_P.  If
218    *SEQ_P is NULL, a new sequence is allocated.  This function is
219    similar to gimple_seq_add_stmt, but does not scan the operands.
220    During gimplification, we need to manipulate statement sequences
221    before the def/use vectors have been constructed.  */
222 void gimplify_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_checking_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)"), variable_size)) 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 int gimple_call_return_flags (const_gimple);
861 int gimple_call_arg_flags (const_gimple, unsigned);
862 void gimple_call_reset_alias_info (gimple);
863 bool gimple_assign_copy_p (gimple);
864 bool gimple_assign_ssa_name_copy_p (gimple);
865 bool gimple_assign_single_p (gimple);
866 bool gimple_assign_unary_nop_p (gimple);
867 void gimple_set_bb (gimple, struct basic_block_def *);
868 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
869 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
870                                      tree, tree);
871 tree gimple_get_lhs (const_gimple);
872 void gimple_set_lhs (gimple, tree);
873 void gimple_replace_lhs (gimple, tree);
874 gimple gimple_copy (gimple);
875 bool is_gimple_operand (const_tree);
876 void gimple_set_modified (gimple, bool);
877 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
878 gimple gimple_build_cond_from_tree (tree, tree, tree);
879 void gimple_cond_set_condition_from_tree (gimple, tree);
880 bool gimple_has_side_effects (const_gimple);
881 bool gimple_rhs_has_side_effects (const_gimple);
882 bool gimple_could_trap_p (gimple);
883 bool gimple_assign_rhs_could_trap_p (gimple);
884 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
885 bool empty_body_p (gimple_seq);
886 unsigned get_gimple_rhs_num_ops (enum tree_code);
887 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
888 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
889 const char *gimple_decl_printable_name (tree, int);
890 tree gimple_fold_obj_type_ref (tree, tree);
891 tree gimple_get_relevant_ref_binfo (tree ref, tree known_binfo);
892 tree gimple_fold_obj_type_ref_known_binfo (HOST_WIDE_INT, tree);
893
894 /* Returns true iff T is a valid GIMPLE statement.  */
895 extern bool is_gimple_stmt (tree);
896
897 /* Returns true iff TYPE is a valid type for a scalar register variable.  */
898 extern bool is_gimple_reg_type (tree);
899 /* Returns true iff T is a scalar register variable.  */
900 extern bool is_gimple_reg (tree);
901 /* Returns true iff T is any sort of variable.  */
902 extern bool is_gimple_variable (tree);
903 /* Returns true iff T is any sort of symbol.  */
904 extern bool is_gimple_id (tree);
905 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable).  */
906 extern bool is_gimple_min_lval (tree);
907 /* Returns true iff T is something whose address can be taken.  */
908 extern bool is_gimple_addressable (tree);
909 /* Returns true iff T is any valid GIMPLE lvalue.  */
910 extern bool is_gimple_lvalue (tree);
911
912 /* Returns true iff T is a GIMPLE address.  */
913 bool is_gimple_address (const_tree);
914 /* Returns true iff T is a GIMPLE invariant address.  */
915 bool is_gimple_invariant_address (const_tree);
916 /* Returns true iff T is a GIMPLE invariant address at interprocedural
917    level.  */
918 bool is_gimple_ip_invariant_address (const_tree);
919 /* Returns true iff T is a valid GIMPLE constant.  */
920 bool is_gimple_constant (const_tree);
921 /* Returns true iff T is a GIMPLE restricted function invariant.  */
922 extern bool is_gimple_min_invariant (const_tree);
923 /* Returns true iff T is a GIMPLE restricted interprecodural invariant.  */
924 extern bool is_gimple_ip_invariant (const_tree);
925 /* Returns true iff T is a GIMPLE rvalue.  */
926 extern bool is_gimple_val (tree);
927 /* Returns true iff T is a GIMPLE asm statement input.  */
928 extern bool is_gimple_asm_val (tree);
929 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
930    GIMPLE temporary, a renamed user variable, or something else,
931    respectively.  */
932 extern bool is_gimple_reg_rhs (tree);
933 extern bool is_gimple_mem_rhs (tree);
934
935 /* Returns true iff T is a valid if-statement condition.  */
936 extern bool is_gimple_condexpr (tree);
937
938 /* Returns true iff T is a type conversion.  */
939 extern bool is_gimple_cast (tree);
940 /* Returns true iff T is a variable that does not need to live in memory.  */
941 extern bool is_gimple_non_addressable (tree t);
942
943 /* Returns true iff T is a valid call address expression.  */
944 extern bool is_gimple_call_addr (tree);
945 /* If T makes a function call, returns the CALL_EXPR operand.  */
946 extern tree get_call_expr_in (tree t);
947
948 extern void recalculate_side_effects (tree);
949 extern bool gimple_compare_field_offset (tree, tree);
950 extern tree gimple_register_type (tree);
951 extern void print_gimple_types_stats (void);
952 extern void free_gimple_type_tables (void);
953 extern tree gimple_unsigned_type (tree);
954 extern tree gimple_signed_type (tree);
955 extern alias_set_type gimple_get_alias_set (tree);
956 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
957                                    unsigned *);
958 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
959                                            bool (*)(gimple, tree, void *),
960                                            bool (*)(gimple, tree, void *),
961                                            bool (*)(gimple, tree, void *));
962 extern bool walk_stmt_load_store_ops (gimple, void *,
963                                       bool (*)(gimple, tree, void *),
964                                       bool (*)(gimple, tree, void *));
965 extern bool gimple_ior_addresses_taken (bitmap, gimple);
966 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
967
968 /* In gimplify.c  */
969 extern tree create_tmp_var_raw (tree, const char *);
970 extern tree create_tmp_var_name (const char *);
971 extern tree create_tmp_var (tree, const char *);
972 extern tree create_tmp_reg (tree, const char *);
973 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
974 extern tree get_formal_tmp_var (tree, gimple_seq *);
975 extern void declare_vars (tree, gimple, bool);
976 extern void annotate_all_with_location (gimple_seq, location_t);
977
978 /* Validation of GIMPLE expressions.  Note that these predicates only check
979    the basic form of the expression, they don't recurse to make sure that
980    underlying nodes are also of the right form.  */
981 typedef bool (*gimple_predicate)(tree);
982
983
984 /* FIXME we should deduce this from the predicate.  */
985 enum fallback {
986   fb_none = 0,          /* Do not generate a temporary.  */
987
988   fb_rvalue = 1,        /* Generate an rvalue to hold the result of a
989                            gimplified expression.  */
990
991   fb_lvalue = 2,        /* Generate an lvalue to hold the result of a
992                            gimplified expression.  */
993
994   fb_mayfail = 4,       /* Gimplification may fail.  Error issued
995                            afterwards.  */
996   fb_either= fb_rvalue | fb_lvalue
997 };
998
999 typedef int fallback_t;
1000
1001 enum gimplify_status {
1002   GS_ERROR      = -2,   /* Something Bad Seen.  */
1003   GS_UNHANDLED  = -1,   /* A langhook result for "I dunno".  */
1004   GS_OK         = 0,    /* We did something, maybe more to do.  */
1005   GS_ALL_DONE   = 1     /* The expression is fully gimplified.  */
1006 };
1007
1008 struct gimplify_ctx
1009 {
1010   struct gimplify_ctx *prev_context;
1011
1012   VEC(gimple,heap) *bind_expr_stack;
1013   tree temps;
1014   gimple_seq conditional_cleanups;
1015   tree exit_label;
1016   tree return_temp;
1017
1018   VEC(tree,heap) *case_labels;
1019   /* The formal temporary table.  Should this be persistent?  */
1020   htab_t temp_htab;
1021
1022   int conditions;
1023   bool save_stack;
1024   bool into_ssa;
1025   bool allow_rhs_cond_expr;
1026 };
1027
1028 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1029                                            bool (*) (tree), fallback_t);
1030 extern void gimplify_type_sizes (tree, gimple_seq *);
1031 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1032 extern bool gimplify_stmt (tree *, gimple_seq *);
1033 extern gimple gimplify_body (tree *, tree, bool);
1034 extern void push_gimplify_context (struct gimplify_ctx *);
1035 extern void pop_gimplify_context (gimple);
1036 extern void gimplify_and_add (tree, gimple_seq *);
1037
1038 /* Miscellaneous helpers.  */
1039 extern void gimple_add_tmp_var (tree);
1040 extern gimple gimple_current_bind_expr (void);
1041 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1042 extern tree voidify_wrapper_expr (tree, tree);
1043 extern tree build_and_jump (tree *);
1044 extern tree force_labels_r (tree *, int *, void *);
1045 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1046                                                   gimple_seq *);
1047 struct gimplify_omp_ctx;
1048 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1049 extern tree gimple_boolify (tree);
1050 extern gimple_predicate rhs_predicate_for (tree);
1051 extern tree canonicalize_cond_expr_cond (tree);
1052
1053 /* In omp-low.c.  */
1054 extern tree omp_reduction_init (tree, tree);
1055
1056 /* In tree-nested.c.  */
1057 extern void lower_nested_functions (tree);
1058 extern void insert_field_into_struct (tree, tree);
1059
1060 /* In gimplify.c.  */
1061 extern void gimplify_function_tree (tree);
1062
1063 /* In cfgexpand.c.  */
1064 extern tree gimple_assign_rhs_to_tree (gimple);
1065
1066 /* In builtins.c  */
1067 extern bool validate_gimple_arglist (const_gimple, ...);
1068
1069 /* In tree-ssa.c  */
1070 extern bool tree_ssa_useless_type_conversion (tree);
1071 extern tree tree_ssa_strip_useless_type_conversions (tree);
1072 extern bool useless_type_conversion_p (tree, tree);
1073 extern bool types_compatible_p (tree, tree);
1074
1075 /* Return the code for GIMPLE statement G.  */
1076
1077 static inline enum gimple_code
1078 gimple_code (const_gimple g)
1079 {
1080   return g->gsbase.code;
1081 }
1082
1083
1084 /* Return the GSS code used by a GIMPLE code.  */
1085
1086 static inline enum gimple_statement_structure_enum
1087 gss_for_code (enum gimple_code code)
1088 {
1089   gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1090   return gss_for_code_[code];
1091 }
1092
1093
1094 /* Return which GSS code is used by GS.  */
1095
1096 static inline enum gimple_statement_structure_enum
1097 gimple_statement_structure (gimple gs)
1098 {
1099   return gss_for_code (gimple_code (gs));
1100 }
1101
1102
1103 /* Return true if statement G has sub-statements.  This is only true for
1104    High GIMPLE statements.  */
1105
1106 static inline bool
1107 gimple_has_substatements (gimple g)
1108 {
1109   switch (gimple_code (g))
1110     {
1111     case GIMPLE_BIND:
1112     case GIMPLE_CATCH:
1113     case GIMPLE_EH_FILTER:
1114     case GIMPLE_TRY:
1115     case GIMPLE_OMP_FOR:
1116     case GIMPLE_OMP_MASTER:
1117     case GIMPLE_OMP_ORDERED:
1118     case GIMPLE_OMP_SECTION:
1119     case GIMPLE_OMP_PARALLEL:
1120     case GIMPLE_OMP_TASK:
1121     case GIMPLE_OMP_SECTIONS:
1122     case GIMPLE_OMP_SINGLE:
1123     case GIMPLE_OMP_CRITICAL:
1124     case GIMPLE_WITH_CLEANUP_EXPR:
1125       return true;
1126
1127     default:
1128       return false;
1129     }
1130 }
1131
1132
1133 /* Return the basic block holding statement G.  */
1134
1135 static inline struct basic_block_def *
1136 gimple_bb (const_gimple g)
1137 {
1138   return g->gsbase.bb;
1139 }
1140
1141
1142 /* Return the lexical scope block holding statement G.  */
1143
1144 static inline tree
1145 gimple_block (const_gimple g)
1146 {
1147   return g->gsbase.block;
1148 }
1149
1150
1151 /* Set BLOCK to be the lexical scope block holding statement G.  */
1152
1153 static inline void
1154 gimple_set_block (gimple g, tree block)
1155 {
1156   g->gsbase.block = block;
1157 }
1158
1159
1160 /* Return location information for statement G.  */
1161
1162 static inline location_t
1163 gimple_location (const_gimple g)
1164 {
1165   return g->gsbase.location;
1166 }
1167
1168 /* Return pointer to location information for statement G.  */
1169
1170 static inline const location_t *
1171 gimple_location_ptr (const_gimple g)
1172 {
1173   return &g->gsbase.location;
1174 }
1175
1176
1177 /* Set location information for statement G.  */
1178
1179 static inline void
1180 gimple_set_location (gimple g, location_t location)
1181 {
1182   g->gsbase.location = location;
1183 }
1184
1185
1186 /* Return true if G contains location information.  */
1187
1188 static inline bool
1189 gimple_has_location (const_gimple g)
1190 {
1191   return gimple_location (g) != UNKNOWN_LOCATION;
1192 }
1193
1194
1195 /* Return the file name of the location of STMT.  */
1196
1197 static inline const char *
1198 gimple_filename (const_gimple stmt)
1199 {
1200   return LOCATION_FILE (gimple_location (stmt));
1201 }
1202
1203
1204 /* Return the line number of the location of STMT.  */
1205
1206 static inline int
1207 gimple_lineno (const_gimple stmt)
1208 {
1209   return LOCATION_LINE (gimple_location (stmt));
1210 }
1211
1212
1213 /* Determine whether SEQ is a singleton. */
1214
1215 static inline bool
1216 gimple_seq_singleton_p (gimple_seq seq)
1217 {
1218   return ((gimple_seq_first (seq) != NULL)
1219           && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1220 }
1221
1222 /* Return true if no warnings should be emitted for statement STMT.  */
1223
1224 static inline bool
1225 gimple_no_warning_p (const_gimple stmt)
1226 {
1227   return stmt->gsbase.no_warning;
1228 }
1229
1230 /* Set the no_warning flag of STMT to NO_WARNING.  */
1231
1232 static inline void
1233 gimple_set_no_warning (gimple stmt, bool no_warning)
1234 {
1235   stmt->gsbase.no_warning = (unsigned) no_warning;
1236 }
1237
1238 /* Set the visited status on statement STMT to VISITED_P.  */
1239
1240 static inline void
1241 gimple_set_visited (gimple stmt, bool visited_p)
1242 {
1243   stmt->gsbase.visited = (unsigned) visited_p;
1244 }
1245
1246
1247 /* Return the visited status for statement STMT.  */
1248
1249 static inline bool
1250 gimple_visited_p (gimple stmt)
1251 {
1252   return stmt->gsbase.visited;
1253 }
1254
1255
1256 /* Set pass local flag PLF on statement STMT to VAL_P.  */
1257
1258 static inline void
1259 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1260 {
1261   if (val_p)
1262     stmt->gsbase.plf |= (unsigned int) plf;
1263   else
1264     stmt->gsbase.plf &= ~((unsigned int) plf);
1265 }
1266
1267
1268 /* Return the value of pass local flag PLF on statement STMT.  */
1269
1270 static inline unsigned int
1271 gimple_plf (gimple stmt, enum plf_mask plf)
1272 {
1273   return stmt->gsbase.plf & ((unsigned int) plf);
1274 }
1275
1276
1277 /* Set the UID of statement.  */
1278
1279 static inline void
1280 gimple_set_uid (gimple g, unsigned uid)
1281 {
1282   g->gsbase.uid = uid;
1283 }
1284
1285
1286 /* Return the UID of statement.  */
1287
1288 static inline unsigned
1289 gimple_uid (const_gimple g)
1290 {
1291   return g->gsbase.uid;
1292 }
1293
1294
1295 /* Return true if GIMPLE statement G has register or memory operands.  */
1296
1297 static inline bool
1298 gimple_has_ops (const_gimple g)
1299 {
1300   return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1301 }
1302
1303
1304 /* Return true if GIMPLE statement G has memory operands.  */
1305
1306 static inline bool
1307 gimple_has_mem_ops (const_gimple g)
1308 {
1309   return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1310 }
1311
1312
1313 /* Return the set of DEF operands for statement G.  */
1314
1315 static inline struct def_optype_d *
1316 gimple_def_ops (const_gimple g)
1317 {
1318   if (!gimple_has_ops (g))
1319     return NULL;
1320   return g->gsops.opbase.def_ops;
1321 }
1322
1323
1324 /* Set DEF to be the set of DEF operands for statement G.  */
1325
1326 static inline void
1327 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1328 {
1329   gcc_gimple_checking_assert (gimple_has_ops (g));
1330   g->gsops.opbase.def_ops = def;
1331 }
1332
1333
1334 /* Return the set of USE operands for statement G.  */
1335
1336 static inline struct use_optype_d *
1337 gimple_use_ops (const_gimple g)
1338 {
1339   if (!gimple_has_ops (g))
1340     return NULL;
1341   return g->gsops.opbase.use_ops;
1342 }
1343
1344
1345 /* Set USE to be the set of USE operands for statement G.  */
1346
1347 static inline void
1348 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1349 {
1350   gcc_gimple_checking_assert (gimple_has_ops (g));
1351   g->gsops.opbase.use_ops = use;
1352 }
1353
1354
1355 /* Return the set of VUSE operand for statement G.  */
1356
1357 static inline use_operand_p
1358 gimple_vuse_op (const_gimple g)
1359 {
1360   struct use_optype_d *ops;
1361   if (!gimple_has_mem_ops (g))
1362     return NULL_USE_OPERAND_P;
1363   ops = g->gsops.opbase.use_ops;
1364   if (ops
1365       && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1366     return USE_OP_PTR (ops);
1367   return NULL_USE_OPERAND_P;
1368 }
1369
1370 /* Return the set of VDEF operand for statement G.  */
1371
1372 static inline def_operand_p
1373 gimple_vdef_op (const_gimple g)
1374 {
1375   struct def_optype_d *ops;
1376   if (!gimple_has_mem_ops (g))
1377     return NULL_DEF_OPERAND_P;
1378   ops = g->gsops.opbase.def_ops;
1379   if (ops
1380       && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1381     return DEF_OP_PTR (ops);
1382   return NULL_DEF_OPERAND_P;
1383 }
1384
1385
1386 /* Return the single VUSE operand of the statement G.  */
1387
1388 static inline tree
1389 gimple_vuse (const_gimple g)
1390 {
1391   if (!gimple_has_mem_ops (g))
1392     return NULL_TREE;
1393   return g->gsmembase.vuse;
1394 }
1395
1396 /* Return the single VDEF operand of the statement G.  */
1397
1398 static inline tree
1399 gimple_vdef (const_gimple g)
1400 {
1401   if (!gimple_has_mem_ops (g))
1402     return NULL_TREE;
1403   return g->gsmembase.vdef;
1404 }
1405
1406 /* Return the single VUSE operand of the statement G.  */
1407
1408 static inline tree *
1409 gimple_vuse_ptr (gimple g)
1410 {
1411   if (!gimple_has_mem_ops (g))
1412     return NULL;
1413   return &g->gsmembase.vuse;
1414 }
1415
1416 /* Return the single VDEF operand of the statement G.  */
1417
1418 static inline tree *
1419 gimple_vdef_ptr (gimple g)
1420 {
1421   if (!gimple_has_mem_ops (g))
1422     return NULL;
1423   return &g->gsmembase.vdef;
1424 }
1425
1426 /* Set the single VUSE operand of the statement G.  */
1427
1428 static inline void
1429 gimple_set_vuse (gimple g, tree vuse)
1430 {
1431   gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1432   g->gsmembase.vuse = vuse;
1433 }
1434
1435 /* Set the single VDEF operand of the statement G.  */
1436
1437 static inline void
1438 gimple_set_vdef (gimple g, tree vdef)
1439 {
1440   gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1441   g->gsmembase.vdef = vdef;
1442 }
1443
1444
1445 /* Return true if statement G has operands and the modified field has
1446    been set.  */
1447
1448 static inline bool
1449 gimple_modified_p (const_gimple g)
1450 {
1451   return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1452 }
1453
1454
1455 /* Return the tree code for the expression computed by STMT.  This is
1456    only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN.  For
1457    GIMPLE_CALL, return CALL_EXPR as the expression code for
1458    consistency.  This is useful when the caller needs to deal with the
1459    three kinds of computation that GIMPLE supports.  */
1460
1461 static inline enum tree_code
1462 gimple_expr_code (const_gimple stmt)
1463 {
1464   enum gimple_code code = gimple_code (stmt);
1465   if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1466     return (enum tree_code) stmt->gsbase.subcode;
1467   else
1468     {
1469       gcc_gimple_checking_assert (code == GIMPLE_CALL);
1470       return CALL_EXPR;
1471     }
1472 }
1473
1474
1475 /* Mark statement S as modified, and update it.  */
1476
1477 static inline void
1478 update_stmt (gimple s)
1479 {
1480   if (gimple_has_ops (s))
1481     {
1482       gimple_set_modified (s, true);
1483       update_stmt_operands (s);
1484     }
1485 }
1486
1487 /* Update statement S if it has been optimized.  */
1488
1489 static inline void
1490 update_stmt_if_modified (gimple s)
1491 {
1492   if (gimple_modified_p (s))
1493     update_stmt_operands (s);
1494 }
1495
1496 /* Return true if statement STMT contains volatile operands.  */
1497
1498 static inline bool
1499 gimple_has_volatile_ops (const_gimple stmt)
1500 {
1501   if (gimple_has_mem_ops (stmt))
1502     return stmt->gsbase.has_volatile_ops;
1503   else
1504     return false;
1505 }
1506
1507
1508 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP.  */
1509
1510 static inline void
1511 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1512 {
1513   if (gimple_has_mem_ops (stmt))
1514     stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1515 }
1516
1517
1518 /* Return true if statement STMT may access memory.  */
1519
1520 static inline bool
1521 gimple_references_memory_p (gimple stmt)
1522 {
1523   return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1524 }
1525
1526
1527 /* Return the subcode for OMP statement S.  */
1528
1529 static inline unsigned
1530 gimple_omp_subcode (const_gimple s)
1531 {
1532   gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1533               && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1534   return s->gsbase.subcode;
1535 }
1536
1537 /* Set the subcode for OMP statement S to SUBCODE.  */
1538
1539 static inline void
1540 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1541 {
1542   /* We only have 16 bits for the subcode.  Assert that we are not
1543      overflowing it.  */
1544   gcc_gimple_checking_assert (subcode < (1 << 16));
1545   s->gsbase.subcode = subcode;
1546 }
1547
1548 /* Set the nowait flag on OMP_RETURN statement S.  */
1549
1550 static inline void
1551 gimple_omp_return_set_nowait (gimple s)
1552 {
1553   GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1554   s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1555 }
1556
1557
1558 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1559    flag set.  */
1560
1561 static inline bool
1562 gimple_omp_return_nowait_p (const_gimple g)
1563 {
1564   GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1565   return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1566 }
1567
1568
1569 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1570    flag set.  */
1571
1572 static inline bool
1573 gimple_omp_section_last_p (const_gimple g)
1574 {
1575   GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1576   return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1577 }
1578
1579
1580 /* Set the GF_OMP_SECTION_LAST flag on G.  */
1581
1582 static inline void
1583 gimple_omp_section_set_last (gimple g)
1584 {
1585   GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1586   g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1587 }
1588
1589
1590 /* Return true if OMP parallel statement G has the
1591    GF_OMP_PARALLEL_COMBINED flag set.  */
1592
1593 static inline bool
1594 gimple_omp_parallel_combined_p (const_gimple g)
1595 {
1596   GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1597   return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1598 }
1599
1600
1601 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1602    value of COMBINED_P.  */
1603
1604 static inline void
1605 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1606 {
1607   GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1608   if (combined_p)
1609     g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1610   else
1611     g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1612 }
1613
1614
1615 /* Return the number of operands for statement GS.  */
1616
1617 static inline unsigned
1618 gimple_num_ops (const_gimple gs)
1619 {
1620   return gs->gsbase.num_ops;
1621 }
1622
1623
1624 /* Set the number of operands for statement GS.  */
1625
1626 static inline void
1627 gimple_set_num_ops (gimple gs, unsigned num_ops)
1628 {
1629   gs->gsbase.num_ops = num_ops;
1630 }
1631
1632
1633 /* Return the array of operands for statement GS.  */
1634
1635 static inline tree *
1636 gimple_ops (gimple gs)
1637 {
1638   size_t off;
1639
1640   /* All the tuples have their operand vector at the very bottom
1641      of the structure.  Note that those structures that do not
1642      have an operand vector have a zero offset.  */
1643   off = gimple_ops_offset_[gimple_statement_structure (gs)];
1644   gcc_gimple_checking_assert (off != 0);
1645
1646   return (tree *) ((char *) gs + off);
1647 }
1648
1649
1650 /* Return operand I for statement GS.  */
1651
1652 static inline tree
1653 gimple_op (const_gimple gs, unsigned i)
1654 {
1655   if (gimple_has_ops (gs))
1656     {
1657       gcc_gimple_checking_assert (i < gimple_num_ops (gs));
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       gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1672       return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1673     }
1674   else
1675     return NULL;
1676 }
1677
1678 /* Set operand I of statement GS to OP.  */
1679
1680 static inline void
1681 gimple_set_op (gimple gs, unsigned i, tree op)
1682 {
1683   gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1684
1685   /* Note.  It may be tempting to assert that OP matches
1686      is_gimple_operand, but that would be wrong.  Different tuples
1687      accept slightly different sets of tree operands.  Each caller
1688      should perform its own validation.  */
1689   gimple_ops (gs)[i] = op;
1690 }
1691
1692 /* Return true if GS is a GIMPLE_ASSIGN.  */
1693
1694 static inline bool
1695 is_gimple_assign (const_gimple gs)
1696 {
1697   return gimple_code (gs) == GIMPLE_ASSIGN;
1698 }
1699
1700 /* Determine if expression CODE is one of the valid expressions that can
1701    be used on the RHS of GIMPLE assignments.  */
1702
1703 static inline enum gimple_rhs_class
1704 get_gimple_rhs_class (enum tree_code code)
1705 {
1706   return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1707 }
1708
1709 /* Return the LHS of assignment statement GS.  */
1710
1711 static inline tree
1712 gimple_assign_lhs (const_gimple gs)
1713 {
1714   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1715   return gimple_op (gs, 0);
1716 }
1717
1718
1719 /* Return a pointer to the LHS of assignment statement GS.  */
1720
1721 static inline tree *
1722 gimple_assign_lhs_ptr (const_gimple gs)
1723 {
1724   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1725   return gimple_op_ptr (gs, 0);
1726 }
1727
1728
1729 /* Set LHS to be the LHS operand of assignment statement GS.  */
1730
1731 static inline void
1732 gimple_assign_set_lhs (gimple gs, tree lhs)
1733 {
1734   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1735   gimple_set_op (gs, 0, lhs);
1736
1737   if (lhs && TREE_CODE (lhs) == SSA_NAME)
1738     SSA_NAME_DEF_STMT (lhs) = gs;
1739 }
1740
1741
1742 /* Return the first operand on the RHS of assignment statement GS.  */
1743
1744 static inline tree
1745 gimple_assign_rhs1 (const_gimple gs)
1746 {
1747   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1748   return gimple_op (gs, 1);
1749 }
1750
1751
1752 /* Return a pointer to the first operand on the RHS of assignment
1753    statement GS.  */
1754
1755 static inline tree *
1756 gimple_assign_rhs1_ptr (const_gimple gs)
1757 {
1758   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1759   return gimple_op_ptr (gs, 1);
1760 }
1761
1762 /* Set RHS to be the first operand on the RHS of assignment statement GS.  */
1763
1764 static inline void
1765 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1766 {
1767   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1768
1769   gimple_set_op (gs, 1, rhs);
1770 }
1771
1772
1773 /* Return the second operand on the RHS of assignment statement GS.
1774    If GS does not have two operands, NULL is returned instead.  */
1775
1776 static inline tree
1777 gimple_assign_rhs2 (const_gimple gs)
1778 {
1779   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1780
1781   if (gimple_num_ops (gs) >= 3)
1782     return gimple_op (gs, 2);
1783   else
1784     return NULL_TREE;
1785 }
1786
1787
1788 /* Return a pointer to the second operand on the RHS of assignment
1789    statement GS.  */
1790
1791 static inline tree *
1792 gimple_assign_rhs2_ptr (const_gimple gs)
1793 {
1794   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1795   return gimple_op_ptr (gs, 2);
1796 }
1797
1798
1799 /* Set RHS to be the second operand on the RHS of assignment statement GS.  */
1800
1801 static inline void
1802 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1803 {
1804   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1805
1806   gimple_set_op (gs, 2, rhs);
1807 }
1808
1809 /* Returns true if GS is a nontemporal move.  */
1810
1811 static inline bool
1812 gimple_assign_nontemporal_move_p (const_gimple gs)
1813 {
1814   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1815   return gs->gsbase.nontemporal_move;
1816 }
1817
1818 /* Sets nontemporal move flag of GS to NONTEMPORAL.  */
1819
1820 static inline void
1821 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1822 {
1823   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1824   gs->gsbase.nontemporal_move = nontemporal;
1825 }
1826
1827
1828 /* Return the code of the expression computed on the rhs of assignment
1829    statement GS.  In case that the RHS is a single object, returns the
1830    tree code of the object.  */
1831
1832 static inline enum tree_code
1833 gimple_assign_rhs_code (const_gimple gs)
1834 {
1835   enum tree_code code;
1836   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1837
1838   code = gimple_expr_code (gs);
1839   if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1840     code = TREE_CODE (gimple_assign_rhs1 (gs));
1841
1842   return code;
1843 }
1844
1845
1846 /* Set CODE to be the code for the expression computed on the RHS of
1847    assignment S.  */
1848
1849 static inline void
1850 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1851 {
1852   GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1853   s->gsbase.subcode = code;
1854 }
1855
1856
1857 /* Return the gimple rhs class of the code of the expression computed on
1858    the rhs of assignment statement GS.
1859    This will never return GIMPLE_INVALID_RHS.  */
1860
1861 static inline enum gimple_rhs_class
1862 gimple_assign_rhs_class (const_gimple gs)
1863 {
1864   return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1865 }
1866
1867
1868 /* Return true if S is a type-cast assignment.  */
1869
1870 static inline bool
1871 gimple_assign_cast_p (gimple s)
1872 {
1873   if (is_gimple_assign (s))
1874     {
1875       enum tree_code sc = gimple_assign_rhs_code (s);
1876       return CONVERT_EXPR_CODE_P (sc)
1877              || sc == VIEW_CONVERT_EXPR
1878              || sc == FIX_TRUNC_EXPR;
1879     }
1880
1881   return false;
1882 }
1883
1884
1885 /* Return true if GS is a GIMPLE_CALL.  */
1886
1887 static inline bool
1888 is_gimple_call (const_gimple gs)
1889 {
1890   return gimple_code (gs) == GIMPLE_CALL;
1891 }
1892
1893 /* Return the LHS of call statement GS.  */
1894
1895 static inline tree
1896 gimple_call_lhs (const_gimple gs)
1897 {
1898   GIMPLE_CHECK (gs, GIMPLE_CALL);
1899   return gimple_op (gs, 0);
1900 }
1901
1902
1903 /* Return a pointer to the LHS of call statement GS.  */
1904
1905 static inline tree *
1906 gimple_call_lhs_ptr (const_gimple gs)
1907 {
1908   GIMPLE_CHECK (gs, GIMPLE_CALL);
1909   return gimple_op_ptr (gs, 0);
1910 }
1911
1912
1913 /* Set LHS to be the LHS operand of call statement GS.  */
1914
1915 static inline void
1916 gimple_call_set_lhs (gimple gs, tree lhs)
1917 {
1918   GIMPLE_CHECK (gs, GIMPLE_CALL);
1919   gimple_set_op (gs, 0, lhs);
1920   if (lhs && TREE_CODE (lhs) == SSA_NAME)
1921     SSA_NAME_DEF_STMT (lhs) = gs;
1922 }
1923
1924
1925 /* Return the tree node representing the function called by call
1926    statement GS.  */
1927
1928 static inline tree
1929 gimple_call_fn (const_gimple gs)
1930 {
1931   GIMPLE_CHECK (gs, GIMPLE_CALL);
1932   return gimple_op (gs, 1);
1933 }
1934
1935
1936 /* Return a pointer to the tree node representing the function called by call
1937    statement GS.  */
1938
1939 static inline tree *
1940 gimple_call_fn_ptr (const_gimple gs)
1941 {
1942   GIMPLE_CHECK (gs, GIMPLE_CALL);
1943   return gimple_op_ptr (gs, 1);
1944 }
1945
1946
1947 /* Set FN to be the function called by call statement GS.  */
1948
1949 static inline void
1950 gimple_call_set_fn (gimple gs, tree fn)
1951 {
1952   GIMPLE_CHECK (gs, GIMPLE_CALL);
1953   gimple_set_op (gs, 1, fn);
1954 }
1955
1956
1957 /* Set FNDECL to be the function called by call statement GS.  */
1958
1959 static inline void
1960 gimple_call_set_fndecl (gimple gs, tree decl)
1961 {
1962   GIMPLE_CHECK (gs, GIMPLE_CALL);
1963   gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
1964 }
1965
1966
1967 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1968    Otherwise return NULL.  This function is analogous to
1969    get_callee_fndecl in tree land.  */
1970
1971 static inline tree
1972 gimple_call_fndecl (const_gimple gs)
1973 {
1974   tree addr = gimple_call_fn (gs);
1975   if (TREE_CODE (addr) == ADDR_EXPR)
1976     return TREE_OPERAND (addr, 0);
1977   return NULL_TREE;
1978 }
1979
1980
1981 /* Return the type returned by call statement GS.  */
1982
1983 static inline tree
1984 gimple_call_return_type (const_gimple gs)
1985 {
1986   tree fn = gimple_call_fn (gs);
1987   tree type = TREE_TYPE (fn);
1988
1989   /* See through the pointer.  */
1990   type = TREE_TYPE (type);
1991
1992   /* The type returned by a FUNCTION_DECL is the type of its
1993      function type.  */
1994   return TREE_TYPE (type);
1995 }
1996
1997
1998 /* Return the static chain for call statement GS.  */
1999
2000 static inline tree
2001 gimple_call_chain (const_gimple gs)
2002 {
2003   GIMPLE_CHECK (gs, GIMPLE_CALL);
2004   return gimple_op (gs, 2);
2005 }
2006
2007
2008 /* Return a pointer to the static chain for call statement GS.  */
2009
2010 static inline tree *
2011 gimple_call_chain_ptr (const_gimple gs)
2012 {
2013   GIMPLE_CHECK (gs, GIMPLE_CALL);
2014   return gimple_op_ptr (gs, 2);
2015 }
2016
2017 /* Set CHAIN to be the static chain for call statement GS.  */
2018
2019 static inline void
2020 gimple_call_set_chain (gimple gs, tree chain)
2021 {
2022   GIMPLE_CHECK (gs, GIMPLE_CALL);
2023
2024   gimple_set_op (gs, 2, chain);
2025 }
2026
2027
2028 /* Return the number of arguments used by call statement GS.  */
2029
2030 static inline unsigned
2031 gimple_call_num_args (const_gimple gs)
2032 {
2033   unsigned num_ops;
2034   GIMPLE_CHECK (gs, GIMPLE_CALL);
2035   num_ops = gimple_num_ops (gs);
2036   return num_ops - 3;
2037 }
2038
2039
2040 /* Return the argument at position INDEX for call statement GS.  */
2041
2042 static inline tree
2043 gimple_call_arg (const_gimple gs, unsigned index)
2044 {
2045   GIMPLE_CHECK (gs, GIMPLE_CALL);
2046   return gimple_op (gs, index + 3);
2047 }
2048
2049
2050 /* Return a pointer to the argument at position INDEX for call
2051    statement GS.  */
2052
2053 static inline tree *
2054 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2055 {
2056   GIMPLE_CHECK (gs, GIMPLE_CALL);
2057   return gimple_op_ptr (gs, index + 3);
2058 }
2059
2060
2061 /* Set ARG to be the argument at position INDEX for call statement GS.  */
2062
2063 static inline void
2064 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2065 {
2066   GIMPLE_CHECK (gs, GIMPLE_CALL);
2067   gimple_set_op (gs, index + 3, arg);
2068 }
2069
2070
2071 /* If TAIL_P is true, mark call statement S as being a tail call
2072    (i.e., a call just before the exit of a function).  These calls are
2073    candidate for tail call optimization.  */
2074
2075 static inline void
2076 gimple_call_set_tail (gimple s, bool tail_p)
2077 {
2078   GIMPLE_CHECK (s, GIMPLE_CALL);
2079   if (tail_p)
2080     s->gsbase.subcode |= GF_CALL_TAILCALL;
2081   else
2082     s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2083 }
2084
2085
2086 /* Return true if GIMPLE_CALL S is marked as a tail call.  */
2087
2088 static inline bool
2089 gimple_call_tail_p (gimple s)
2090 {
2091   GIMPLE_CHECK (s, GIMPLE_CALL);
2092   return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2093 }
2094
2095
2096 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P.  */
2097
2098 static inline void
2099 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2100 {
2101   GIMPLE_CHECK (s, GIMPLE_CALL);
2102   if (inlinable_p)
2103     s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2104   else
2105     s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2106 }
2107
2108
2109 /* Return true if GIMPLE_CALL S cannot be inlined.  */
2110
2111 static inline bool
2112 gimple_call_cannot_inline_p (gimple s)
2113 {
2114   GIMPLE_CHECK (s, GIMPLE_CALL);
2115   return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2116 }
2117
2118
2119 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2120    slot optimization.  This transformation uses the target of the call
2121    expansion as the return slot for calls that return in memory.  */
2122
2123 static inline void
2124 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2125 {
2126   GIMPLE_CHECK (s, GIMPLE_CALL);
2127   if (return_slot_opt_p)
2128     s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2129   else
2130     s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2131 }
2132
2133
2134 /* Return true if S is marked for return slot optimization.  */
2135
2136 static inline bool
2137 gimple_call_return_slot_opt_p (gimple s)
2138 {
2139   GIMPLE_CHECK (s, GIMPLE_CALL);
2140   return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2141 }
2142
2143
2144 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2145    thunk to the thunked-to function.  */
2146
2147 static inline void
2148 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2149 {
2150   GIMPLE_CHECK (s, GIMPLE_CALL);
2151   if (from_thunk_p)
2152     s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2153   else
2154     s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2155 }
2156
2157
2158 /* Return true if GIMPLE_CALL S is a jump from a thunk.  */
2159
2160 static inline bool
2161 gimple_call_from_thunk_p (gimple s)
2162 {
2163   GIMPLE_CHECK (s, GIMPLE_CALL);
2164   return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2165 }
2166
2167
2168 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2169    argument pack in its argument list.  */
2170
2171 static inline void
2172 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2173 {
2174   GIMPLE_CHECK (s, GIMPLE_CALL);
2175   if (pass_arg_pack_p)
2176     s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2177   else
2178     s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2179 }
2180
2181
2182 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2183    argument pack in its argument list.  */
2184
2185 static inline bool
2186 gimple_call_va_arg_pack_p (gimple s)
2187 {
2188   GIMPLE_CHECK (s, GIMPLE_CALL);
2189   return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2190 }
2191
2192
2193 /* Return true if S is a noreturn call.  */
2194
2195 static inline bool
2196 gimple_call_noreturn_p (gimple s)
2197 {
2198   GIMPLE_CHECK (s, GIMPLE_CALL);
2199   return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2200 }
2201
2202
2203 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2204    even if the called function can throw in other cases.  */
2205
2206 static inline void
2207 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2208 {
2209   GIMPLE_CHECK (s, GIMPLE_CALL);
2210   if (nothrow_p)
2211     s->gsbase.subcode |= GF_CALL_NOTHROW;
2212   else
2213     s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2214 }
2215
2216 /* Return true if S is a nothrow call.  */
2217
2218 static inline bool
2219 gimple_call_nothrow_p (gimple s)
2220 {
2221   GIMPLE_CHECK (s, GIMPLE_CALL);
2222   return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2223 }
2224
2225
2226 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL.  */
2227
2228 static inline void
2229 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2230 {
2231   GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2232   GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2233   dest_call->gsbase.subcode = orig_call->gsbase.subcode;
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_use_set (gimple call)
2242 {
2243   GIMPLE_CHECK (call, GIMPLE_CALL);
2244   return &call->gimple_call.call_used;
2245 }
2246
2247
2248 /* Return a pointer to the points-to solution for the set of call-used
2249    variables of the call CALL.  */
2250
2251 static inline struct pt_solution *
2252 gimple_call_clobber_set (gimple call)
2253 {
2254   GIMPLE_CHECK (call, GIMPLE_CALL);
2255   return &call->gimple_call.call_clobbered;
2256 }
2257
2258
2259 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2260    non-NULL lhs.  */
2261
2262 static inline bool
2263 gimple_has_lhs (gimple stmt)
2264 {
2265   return (is_gimple_assign (stmt)
2266           || (is_gimple_call (stmt)
2267               && gimple_call_lhs (stmt) != NULL_TREE));
2268 }
2269
2270
2271 /* Return the code of the predicate computed by conditional statement GS.  */
2272
2273 static inline enum tree_code
2274 gimple_cond_code (const_gimple gs)
2275 {
2276   GIMPLE_CHECK (gs, GIMPLE_COND);
2277   return (enum tree_code) gs->gsbase.subcode;
2278 }
2279
2280
2281 /* Set CODE to be the predicate code for the conditional statement GS.  */
2282
2283 static inline void
2284 gimple_cond_set_code (gimple gs, enum tree_code code)
2285 {
2286   GIMPLE_CHECK (gs, GIMPLE_COND);
2287   gs->gsbase.subcode = code;
2288 }
2289
2290
2291 /* Return the LHS of the predicate computed by conditional statement GS.  */
2292
2293 static inline tree
2294 gimple_cond_lhs (const_gimple gs)
2295 {
2296   GIMPLE_CHECK (gs, GIMPLE_COND);
2297   return gimple_op (gs, 0);
2298 }
2299
2300 /* Return the pointer to the LHS of the predicate computed by conditional
2301    statement GS.  */
2302
2303 static inline tree *
2304 gimple_cond_lhs_ptr (const_gimple gs)
2305 {
2306   GIMPLE_CHECK (gs, GIMPLE_COND);
2307   return gimple_op_ptr (gs, 0);
2308 }
2309
2310 /* Set LHS to be the LHS operand of the predicate computed by
2311    conditional statement GS.  */
2312
2313 static inline void
2314 gimple_cond_set_lhs (gimple gs, tree lhs)
2315 {
2316   GIMPLE_CHECK (gs, GIMPLE_COND);
2317   gimple_set_op (gs, 0, lhs);
2318 }
2319
2320
2321 /* Return the RHS operand of the predicate computed by conditional GS.  */
2322
2323 static inline tree
2324 gimple_cond_rhs (const_gimple gs)
2325 {
2326   GIMPLE_CHECK (gs, GIMPLE_COND);
2327   return gimple_op (gs, 1);
2328 }
2329
2330 /* Return the pointer to the RHS operand of the predicate computed by
2331    conditional GS.  */
2332
2333 static inline tree *
2334 gimple_cond_rhs_ptr (const_gimple gs)
2335 {
2336   GIMPLE_CHECK (gs, GIMPLE_COND);
2337   return gimple_op_ptr (gs, 1);
2338 }
2339
2340
2341 /* Set RHS to be the RHS operand of the predicate computed by
2342    conditional statement GS.  */
2343
2344 static inline void
2345 gimple_cond_set_rhs (gimple gs, tree rhs)
2346 {
2347   GIMPLE_CHECK (gs, GIMPLE_COND);
2348   gimple_set_op (gs, 1, rhs);
2349 }
2350
2351
2352 /* Return the label used by conditional statement GS when its
2353    predicate evaluates to true.  */
2354
2355 static inline tree
2356 gimple_cond_true_label (const_gimple gs)
2357 {
2358   GIMPLE_CHECK (gs, GIMPLE_COND);
2359   return gimple_op (gs, 2);
2360 }
2361
2362
2363 /* Set LABEL to be the label used by conditional statement GS when its
2364    predicate evaluates to true.  */
2365
2366 static inline void
2367 gimple_cond_set_true_label (gimple gs, tree label)
2368 {
2369   GIMPLE_CHECK (gs, GIMPLE_COND);
2370   gimple_set_op (gs, 2, label);
2371 }
2372
2373
2374 /* Set LABEL to be the label used by conditional statement GS when its
2375    predicate evaluates to false.  */
2376
2377 static inline void
2378 gimple_cond_set_false_label (gimple gs, tree label)
2379 {
2380   GIMPLE_CHECK (gs, GIMPLE_COND);
2381   gimple_set_op (gs, 3, label);
2382 }
2383
2384
2385 /* Return the label used by conditional statement GS when its
2386    predicate evaluates to false.  */
2387
2388 static inline tree
2389 gimple_cond_false_label (const_gimple gs)
2390 {
2391   GIMPLE_CHECK (gs, GIMPLE_COND);
2392   return gimple_op (gs, 3);
2393 }
2394
2395
2396 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'.  */
2397
2398 static inline void
2399 gimple_cond_make_false (gimple gs)
2400 {
2401   gimple_cond_set_lhs (gs, boolean_true_node);
2402   gimple_cond_set_rhs (gs, boolean_false_node);
2403   gs->gsbase.subcode = EQ_EXPR;
2404 }
2405
2406
2407 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'.  */
2408
2409 static inline void
2410 gimple_cond_make_true (gimple gs)
2411 {
2412   gimple_cond_set_lhs (gs, boolean_true_node);
2413   gimple_cond_set_rhs (gs, boolean_true_node);
2414   gs->gsbase.subcode = EQ_EXPR;
2415 }
2416
2417 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2418   'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2419
2420 static inline bool
2421 gimple_cond_true_p (const_gimple gs)
2422 {
2423   tree lhs = gimple_cond_lhs (gs);
2424   tree rhs = gimple_cond_rhs (gs);
2425   enum tree_code code = gimple_cond_code (gs);
2426
2427   if (lhs != boolean_true_node && lhs != boolean_false_node)
2428     return false;
2429
2430   if (rhs != boolean_true_node && rhs != boolean_false_node)
2431     return false;
2432
2433   if (code == NE_EXPR && lhs != rhs)
2434     return true;
2435
2436   if (code == EQ_EXPR && lhs == rhs)
2437       return true;
2438
2439   return false;
2440 }
2441
2442 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2443    'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2444
2445 static inline bool
2446 gimple_cond_false_p (const_gimple gs)
2447 {
2448   tree lhs = gimple_cond_lhs (gs);
2449   tree rhs = gimple_cond_rhs (gs);
2450   enum tree_code code = gimple_cond_code (gs);
2451
2452   if (lhs != boolean_true_node && lhs != boolean_false_node)
2453     return false;
2454
2455   if (rhs != boolean_true_node && rhs != boolean_false_node)
2456     return false;
2457
2458   if (code == NE_EXPR && lhs == rhs)
2459     return true;
2460
2461   if (code == EQ_EXPR && lhs != rhs)
2462       return true;
2463
2464   return false;
2465 }
2466
2467 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2468    'if (var == 1)' */
2469
2470 static inline bool
2471 gimple_cond_single_var_p (gimple gs)
2472 {
2473   if (gimple_cond_code (gs) == NE_EXPR
2474       && gimple_cond_rhs (gs) == boolean_false_node)
2475     return true;
2476
2477   if (gimple_cond_code (gs) == EQ_EXPR
2478       && gimple_cond_rhs (gs) == boolean_true_node)
2479     return true;
2480
2481   return false;
2482 }
2483
2484 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS.  */
2485
2486 static inline void
2487 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2488 {
2489   gimple_cond_set_code (stmt, code);
2490   gimple_cond_set_lhs (stmt, lhs);
2491   gimple_cond_set_rhs (stmt, rhs);
2492 }
2493
2494 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS.  */
2495
2496 static inline tree
2497 gimple_label_label (const_gimple gs)
2498 {
2499   GIMPLE_CHECK (gs, GIMPLE_LABEL);
2500   return gimple_op (gs, 0);
2501 }
2502
2503
2504 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2505    GS.  */
2506
2507 static inline void
2508 gimple_label_set_label (gimple gs, tree label)
2509 {
2510   GIMPLE_CHECK (gs, GIMPLE_LABEL);
2511   gimple_set_op (gs, 0, label);
2512 }
2513
2514
2515 /* Return the destination of the unconditional jump GS.  */
2516
2517 static inline tree
2518 gimple_goto_dest (const_gimple gs)
2519 {
2520   GIMPLE_CHECK (gs, GIMPLE_GOTO);
2521   return gimple_op (gs, 0);
2522 }
2523
2524
2525 /* Set DEST to be the destination of the unconditonal jump GS.  */
2526
2527 static inline void
2528 gimple_goto_set_dest (gimple gs, tree dest)
2529 {
2530   GIMPLE_CHECK (gs, GIMPLE_GOTO);
2531   gimple_set_op (gs, 0, dest);
2532 }
2533
2534
2535 /* Return the variables declared in the GIMPLE_BIND statement GS.  */
2536
2537 static inline tree
2538 gimple_bind_vars (const_gimple gs)
2539 {
2540   GIMPLE_CHECK (gs, GIMPLE_BIND);
2541   return gs->gimple_bind.vars;
2542 }
2543
2544
2545 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2546    statement GS.  */
2547
2548 static inline void
2549 gimple_bind_set_vars (gimple gs, tree vars)
2550 {
2551   GIMPLE_CHECK (gs, GIMPLE_BIND);
2552   gs->gimple_bind.vars = vars;
2553 }
2554
2555
2556 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2557    statement GS.  */
2558
2559 static inline void
2560 gimple_bind_append_vars (gimple gs, tree vars)
2561 {
2562   GIMPLE_CHECK (gs, GIMPLE_BIND);
2563   gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2564 }
2565
2566
2567 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS.  */
2568
2569 static inline gimple_seq
2570 gimple_bind_body (gimple gs)
2571 {
2572   GIMPLE_CHECK (gs, GIMPLE_BIND);
2573   return gs->gimple_bind.body;
2574 }
2575
2576
2577 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2578    statement GS.  */
2579
2580 static inline void
2581 gimple_bind_set_body (gimple gs, gimple_seq seq)
2582 {
2583   GIMPLE_CHECK (gs, GIMPLE_BIND);
2584   gs->gimple_bind.body = seq;
2585 }
2586
2587
2588 /* Append a statement to the end of a GIMPLE_BIND's body.  */
2589
2590 static inline void
2591 gimple_bind_add_stmt (gimple gs, gimple stmt)
2592 {
2593   GIMPLE_CHECK (gs, GIMPLE_BIND);
2594   gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2595 }
2596
2597
2598 /* Append a sequence of statements to the end of a GIMPLE_BIND's body.  */
2599
2600 static inline void
2601 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2602 {
2603   GIMPLE_CHECK (gs, GIMPLE_BIND);
2604   gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2605 }
2606
2607
2608 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2609    GS.  This is analogous to the BIND_EXPR_BLOCK field in trees.  */
2610
2611 static inline tree
2612 gimple_bind_block (const_gimple gs)
2613 {
2614   GIMPLE_CHECK (gs, GIMPLE_BIND);
2615   return gs->gimple_bind.block;
2616 }
2617
2618
2619 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2620    statement GS.  */
2621
2622 static inline void
2623 gimple_bind_set_block (gimple gs, tree block)
2624 {
2625   GIMPLE_CHECK (gs, GIMPLE_BIND);
2626   gcc_gimple_checking_assert (block == NULL_TREE
2627                               || TREE_CODE (block) == BLOCK);
2628   gs->gimple_bind.block = block;
2629 }
2630
2631
2632 /* Return the number of input operands for GIMPLE_ASM GS.  */
2633
2634 static inline unsigned
2635 gimple_asm_ninputs (const_gimple gs)
2636 {
2637   GIMPLE_CHECK (gs, GIMPLE_ASM);
2638   return gs->gimple_asm.ni;
2639 }
2640
2641
2642 /* Return the number of output operands for GIMPLE_ASM GS.  */
2643
2644 static inline unsigned
2645 gimple_asm_noutputs (const_gimple gs)
2646 {
2647   GIMPLE_CHECK (gs, GIMPLE_ASM);
2648   return gs->gimple_asm.no;
2649 }
2650
2651
2652 /* Return the number of clobber operands for GIMPLE_ASM GS.  */
2653
2654 static inline unsigned
2655 gimple_asm_nclobbers (const_gimple gs)
2656 {
2657   GIMPLE_CHECK (gs, GIMPLE_ASM);
2658   return gs->gimple_asm.nc;
2659 }
2660
2661 /* Return the number of label operands for GIMPLE_ASM GS.  */
2662
2663 static inline unsigned
2664 gimple_asm_nlabels (const_gimple gs)
2665 {
2666   GIMPLE_CHECK (gs, GIMPLE_ASM);
2667   return gs->gimple_asm.nl;
2668 }
2669
2670 /* Return input operand INDEX of GIMPLE_ASM GS.  */
2671
2672 static inline tree
2673 gimple_asm_input_op (const_gimple gs, unsigned index)
2674 {
2675   GIMPLE_CHECK (gs, GIMPLE_ASM);
2676   gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2677   return gimple_op (gs, index);
2678 }
2679
2680 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS.  */
2681
2682 static inline tree *
2683 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2684 {
2685   GIMPLE_CHECK (gs, GIMPLE_ASM);
2686   gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2687   return gimple_op_ptr (gs, index);
2688 }
2689
2690
2691 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS.  */
2692
2693 static inline void
2694 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2695 {
2696   GIMPLE_CHECK (gs, GIMPLE_ASM);
2697   gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2698                               && TREE_CODE (in_op) == TREE_LIST);
2699   gimple_set_op (gs, index, in_op);
2700 }
2701
2702
2703 /* Return output operand INDEX of GIMPLE_ASM GS.  */
2704
2705 static inline tree
2706 gimple_asm_output_op (const_gimple gs, unsigned index)
2707 {
2708   GIMPLE_CHECK (gs, GIMPLE_ASM);
2709   gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2710   return gimple_op (gs, index + gs->gimple_asm.ni);
2711 }
2712
2713 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS.  */
2714
2715 static inline tree *
2716 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2717 {
2718   GIMPLE_CHECK (gs, GIMPLE_ASM);
2719   gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2720   return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2721 }
2722
2723
2724 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS.  */
2725
2726 static inline void
2727 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2728 {
2729   GIMPLE_CHECK (gs, GIMPLE_ASM);
2730   gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2731                               && TREE_CODE (out_op) == TREE_LIST);
2732   gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2733 }
2734
2735
2736 /* Return clobber operand INDEX of GIMPLE_ASM GS.  */
2737
2738 static inline tree
2739 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2740 {
2741   GIMPLE_CHECK (gs, GIMPLE_ASM);
2742   gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2743   return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2744 }
2745
2746
2747 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS.  */
2748
2749 static inline void
2750 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2751 {
2752   GIMPLE_CHECK (gs, GIMPLE_ASM);
2753   gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
2754                               && TREE_CODE (clobber_op) == TREE_LIST);
2755   gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2756 }
2757
2758 /* Return label operand INDEX of GIMPLE_ASM GS.  */
2759
2760 static inline tree
2761 gimple_asm_label_op (const_gimple gs, unsigned index)
2762 {
2763   GIMPLE_CHECK (gs, GIMPLE_ASM);
2764   gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
2765   return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2766 }
2767
2768 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS.  */
2769
2770 static inline void
2771 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2772 {
2773   GIMPLE_CHECK (gs, GIMPLE_ASM);
2774   gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
2775                               && TREE_CODE (label_op) == TREE_LIST);
2776   gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2777 }
2778
2779 /* Return the string representing the assembly instruction in
2780    GIMPLE_ASM GS.  */
2781
2782 static inline const char *
2783 gimple_asm_string (const_gimple gs)
2784 {
2785   GIMPLE_CHECK (gs, GIMPLE_ASM);
2786   return gs->gimple_asm.string;
2787 }
2788
2789
2790 /* Return true if GS is an asm statement marked volatile.  */
2791
2792 static inline bool
2793 gimple_asm_volatile_p (const_gimple gs)
2794 {
2795   GIMPLE_CHECK (gs, GIMPLE_ASM);
2796   return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2797 }
2798
2799
2800 /* If VOLATLE_P is true, mark asm statement GS as volatile.  */
2801
2802 static inline void
2803 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2804 {
2805   GIMPLE_CHECK (gs, GIMPLE_ASM);
2806   if (volatile_p)
2807     gs->gsbase.subcode |= GF_ASM_VOLATILE;
2808   else
2809     gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2810 }
2811
2812
2813 /* If INPUT_P is true, mark asm GS as an ASM_INPUT.  */
2814
2815 static inline void
2816 gimple_asm_set_input (gimple gs, bool input_p)
2817 {
2818   GIMPLE_CHECK (gs, GIMPLE_ASM);
2819   if (input_p)
2820     gs->gsbase.subcode |= GF_ASM_INPUT;
2821   else
2822     gs->gsbase.subcode &= ~GF_ASM_INPUT;
2823 }
2824
2825
2826 /* Return true if asm GS is an ASM_INPUT.  */
2827
2828 static inline bool
2829 gimple_asm_input_p (const_gimple gs)
2830 {
2831   GIMPLE_CHECK (gs, GIMPLE_ASM);
2832   return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2833 }
2834
2835
2836 /* Return the types handled by GIMPLE_CATCH statement GS.  */
2837
2838 static inline tree
2839 gimple_catch_types (const_gimple gs)
2840 {
2841   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2842   return gs->gimple_catch.types;
2843 }
2844
2845
2846 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS.  */
2847
2848 static inline tree *
2849 gimple_catch_types_ptr (gimple gs)
2850 {
2851   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2852   return &gs->gimple_catch.types;
2853 }
2854
2855
2856 /* Return the GIMPLE sequence representing the body of the handler of
2857    GIMPLE_CATCH statement GS.  */
2858
2859 static inline gimple_seq
2860 gimple_catch_handler (gimple gs)
2861 {
2862   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2863   return gs->gimple_catch.handler;
2864 }
2865
2866
2867 /* Return a pointer to the GIMPLE sequence representing the body of
2868    the handler of GIMPLE_CATCH statement GS.  */
2869
2870 static inline gimple_seq *
2871 gimple_catch_handler_ptr (gimple gs)
2872 {
2873   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2874   return &gs->gimple_catch.handler;
2875 }
2876
2877
2878 /* Set T to be the set of types handled by GIMPLE_CATCH GS.  */
2879
2880 static inline void
2881 gimple_catch_set_types (gimple gs, tree t)
2882 {
2883   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2884   gs->gimple_catch.types = t;
2885 }
2886
2887
2888 /* Set HANDLER to be the body of GIMPLE_CATCH GS.  */
2889
2890 static inline void
2891 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2892 {
2893   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2894   gs->gimple_catch.handler = handler;
2895 }
2896
2897
2898 /* Return the types handled by GIMPLE_EH_FILTER statement GS.  */
2899
2900 static inline tree
2901 gimple_eh_filter_types (const_gimple gs)
2902 {
2903   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2904   return gs->gimple_eh_filter.types;
2905 }
2906
2907
2908 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2909    GS.  */
2910
2911 static inline tree *
2912 gimple_eh_filter_types_ptr (gimple gs)
2913 {
2914   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2915   return &gs->gimple_eh_filter.types;
2916 }
2917
2918
2919 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2920    statement fails.  */
2921
2922 static inline gimple_seq
2923 gimple_eh_filter_failure (gimple gs)
2924 {
2925   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2926   return gs->gimple_eh_filter.failure;
2927 }
2928
2929
2930 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS.  */
2931
2932 static inline void
2933 gimple_eh_filter_set_types (gimple gs, tree types)
2934 {
2935   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2936   gs->gimple_eh_filter.types = types;
2937 }
2938
2939
2940 /* Set FAILURE to be the sequence of statements to execute on failure
2941    for GIMPLE_EH_FILTER GS.  */
2942
2943 static inline void
2944 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2945 {
2946   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2947   gs->gimple_eh_filter.failure = failure;
2948 }
2949
2950 /* Get the function decl to be called by the MUST_NOT_THROW region.  */
2951
2952 static inline tree
2953 gimple_eh_must_not_throw_fndecl (gimple gs)
2954 {
2955   GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2956   return gs->gimple_eh_mnt.fndecl;
2957 }
2958
2959 /* Set the function decl to be called by GS to DECL.  */
2960
2961 static inline void
2962 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
2963 {
2964   GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2965   gs->gimple_eh_mnt.fndecl = decl;
2966 }
2967
2968
2969 /* GIMPLE_TRY accessors. */
2970
2971 /* Return the kind of try block represented by GIMPLE_TRY GS.  This is
2972    either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY.  */
2973
2974 static inline enum gimple_try_flags
2975 gimple_try_kind (const_gimple gs)
2976 {
2977   GIMPLE_CHECK (gs, GIMPLE_TRY);
2978   return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2979 }
2980
2981
2982 /* Set the kind of try block represented by GIMPLE_TRY GS.  */
2983
2984 static inline void
2985 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2986 {
2987   GIMPLE_CHECK (gs, GIMPLE_TRY);
2988   gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
2989                               || kind == GIMPLE_TRY_FINALLY);
2990   if (gimple_try_kind (gs) != kind)
2991     gs->gsbase.subcode = (unsigned int) kind;
2992 }
2993
2994
2995 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag.  */
2996
2997 static inline bool
2998 gimple_try_catch_is_cleanup (const_gimple gs)
2999 {
3000   gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3001   return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3002 }
3003
3004
3005 /* Return the sequence of statements used as the body for GIMPLE_TRY GS.  */
3006
3007 static inline gimple_seq
3008 gimple_try_eval (gimple gs)
3009 {
3010   GIMPLE_CHECK (gs, GIMPLE_TRY);
3011   return gs->gimple_try.eval;
3012 }
3013
3014
3015 /* Return the sequence of statements used as the cleanup body for
3016    GIMPLE_TRY GS.  */
3017
3018 static inline gimple_seq
3019 gimple_try_cleanup (gimple gs)
3020 {
3021   GIMPLE_CHECK (gs, GIMPLE_TRY);
3022   return gs->gimple_try.cleanup;
3023 }
3024
3025
3026 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag.  */
3027
3028 static inline void
3029 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3030 {
3031   gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3032   if (catch_is_cleanup)
3033     g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3034   else
3035     g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3036 }
3037
3038
3039 /* Set EVAL to be the sequence of statements to use as the body for
3040    GIMPLE_TRY GS.  */
3041
3042 static inline void
3043 gimple_try_set_eval (gimple gs, gimple_seq eval)
3044 {
3045   GIMPLE_CHECK (gs, GIMPLE_TRY);
3046   gs->gimple_try.eval = eval;
3047 }
3048
3049
3050 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3051    body for GIMPLE_TRY GS.  */
3052
3053 static inline void
3054 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3055 {
3056   GIMPLE_CHECK (gs, GIMPLE_TRY);
3057   gs->gimple_try.cleanup = cleanup;
3058 }
3059
3060
3061 /* Return the cleanup sequence for cleanup statement GS.  */
3062
3063 static inline gimple_seq
3064 gimple_wce_cleanup (gimple gs)
3065 {
3066   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3067   return gs->gimple_wce.cleanup;
3068 }
3069
3070
3071 /* Set CLEANUP to be the cleanup sequence for GS.  */
3072
3073 static inline void
3074 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3075 {
3076   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3077   gs->gimple_wce.cleanup = cleanup;
3078 }
3079
3080
3081 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple.  */
3082
3083 static inline bool
3084 gimple_wce_cleanup_eh_only (const_gimple gs)
3085 {
3086   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3087   return gs->gsbase.subcode != 0;
3088 }
3089
3090
3091 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple.  */
3092
3093 static inline void
3094 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3095 {
3096   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3097   gs->gsbase.subcode = (unsigned int) eh_only_p;
3098 }
3099
3100
3101 /* Return the maximum number of arguments supported by GIMPLE_PHI GS.  */
3102
3103 static inline unsigned
3104 gimple_phi_capacity (const_gimple gs)
3105 {
3106   GIMPLE_CHECK (gs, GIMPLE_PHI);
3107   return gs->gimple_phi.capacity;
3108 }
3109
3110
3111 /* Return the number of arguments in GIMPLE_PHI GS.  This must always
3112    be exactly the number of incoming edges for the basic block holding
3113    GS.  */
3114
3115 static inline unsigned
3116 gimple_phi_num_args (const_gimple gs)
3117 {
3118   GIMPLE_CHECK (gs, GIMPLE_PHI);
3119   return gs->gimple_phi.nargs;
3120 }
3121
3122
3123 /* Return the SSA name created by GIMPLE_PHI GS.  */
3124
3125 static inline tree
3126 gimple_phi_result (const_gimple gs)
3127 {
3128   GIMPLE_CHECK (gs, GIMPLE_PHI);
3129   return gs->gimple_phi.result;
3130 }
3131
3132 /* Return a pointer to the SSA name created by GIMPLE_PHI GS.  */
3133
3134 static inline tree *
3135 gimple_phi_result_ptr (gimple gs)
3136 {
3137   GIMPLE_CHECK (gs, GIMPLE_PHI);
3138   return &gs->gimple_phi.result;
3139 }
3140
3141 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS.  */
3142
3143 static inline void
3144 gimple_phi_set_result (gimple gs, tree result)
3145 {
3146   GIMPLE_CHECK (gs, GIMPLE_PHI);
3147   gs->gimple_phi.result = result;
3148 }
3149
3150
3151 /* Return the PHI argument corresponding to incoming edge INDEX for
3152    GIMPLE_PHI GS.  */
3153
3154 static inline struct phi_arg_d *
3155 gimple_phi_arg (gimple gs, unsigned index)
3156 {
3157   GIMPLE_CHECK (gs, GIMPLE_PHI);
3158   gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3159   return &(gs->gimple_phi.args[index]);
3160 }
3161
3162 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3163    for GIMPLE_PHI GS.  */
3164
3165 static inline void
3166 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3167 {
3168   GIMPLE_CHECK (gs, GIMPLE_PHI);
3169   gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3170   gs->gimple_phi.args[index] = *phiarg;
3171 }
3172
3173 /* Return the region number for GIMPLE_RESX GS.  */
3174
3175 static inline int
3176 gimple_resx_region (const_gimple gs)
3177 {
3178   GIMPLE_CHECK (gs, GIMPLE_RESX);
3179   return gs->gimple_eh_ctrl.region;
3180 }
3181
3182 /* Set REGION to be the region number for GIMPLE_RESX GS.  */
3183
3184 static inline void
3185 gimple_resx_set_region (gimple gs, int region)
3186 {
3187   GIMPLE_CHECK (gs, GIMPLE_RESX);
3188   gs->gimple_eh_ctrl.region = region;
3189 }
3190
3191 /* Return the region number for GIMPLE_EH_DISPATCH GS.  */
3192
3193 static inline int
3194 gimple_eh_dispatch_region (const_gimple gs)
3195 {
3196   GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3197   return gs->gimple_eh_ctrl.region;
3198 }
3199
3200 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS.  */
3201
3202 static inline void
3203 gimple_eh_dispatch_set_region (gimple gs, int region)
3204 {
3205   GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3206   gs->gimple_eh_ctrl.region = region;
3207 }
3208
3209 /* Return the number of labels associated with the switch statement GS.  */
3210
3211 static inline unsigned
3212 gimple_switch_num_labels (const_gimple gs)
3213 {
3214   unsigned num_ops;
3215   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3216   num_ops = gimple_num_ops (gs);
3217   gcc_gimple_checking_assert (num_ops > 1);
3218   return num_ops - 1;
3219 }
3220
3221
3222 /* Set NLABELS to be the number of labels for the switch statement GS.  */
3223
3224 static inline void
3225 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3226 {
3227   GIMPLE_CHECK (g, GIMPLE_SWITCH);
3228   gimple_set_num_ops (g, nlabels + 1);
3229 }
3230
3231
3232 /* Return the index variable used by the switch statement GS.  */
3233
3234 static inline tree
3235 gimple_switch_index (const_gimple gs)
3236 {
3237   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3238   return gimple_op (gs, 0);
3239 }
3240
3241
3242 /* Return a pointer to the index variable for the switch statement GS.  */
3243
3244 static inline tree *
3245 gimple_switch_index_ptr (const_gimple gs)
3246 {
3247   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3248   return gimple_op_ptr (gs, 0);
3249 }
3250
3251
3252 /* Set INDEX to be the index variable for switch statement GS.  */
3253
3254 static inline void
3255 gimple_switch_set_index (gimple gs, tree index)
3256 {
3257   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3258   gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3259   gimple_set_op (gs, 0, index);
3260 }
3261
3262
3263 /* Return the label numbered INDEX.  The default label is 0, followed by any
3264    labels in a switch statement.  */
3265
3266 static inline tree
3267 gimple_switch_label (const_gimple gs, unsigned index)
3268 {
3269   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3270   gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3271   return gimple_op (gs, index + 1);
3272 }
3273
3274 /* Set the label number INDEX to LABEL.  0 is always the default label.  */
3275
3276 static inline void
3277 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3278 {
3279   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3280   gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3281                               && (label == NULL_TREE
3282                                   || TREE_CODE (label) == CASE_LABEL_EXPR));
3283   gimple_set_op (gs, index + 1, label);
3284 }
3285
3286 /* Return the default label for a switch statement.  */
3287
3288 static inline tree
3289 gimple_switch_default_label (const_gimple gs)
3290 {
3291   return gimple_switch_label (gs, 0);
3292 }
3293
3294 /* Set the default label for a switch statement.  */
3295
3296 static inline void
3297 gimple_switch_set_default_label (gimple gs, tree label)
3298 {
3299   gimple_switch_set_label (gs, 0, label);
3300 }
3301
3302 /* Return true if GS is a GIMPLE_DEBUG statement.  */
3303
3304 static inline bool
3305 is_gimple_debug (const_gimple gs)
3306 {
3307   return gimple_code (gs) == GIMPLE_DEBUG;
3308 }
3309
3310 /* Return true if S is a GIMPLE_DEBUG BIND statement.  */
3311
3312 static inline bool
3313 gimple_debug_bind_p (const_gimple s)
3314 {
3315   if (is_gimple_debug (s))
3316     return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3317
3318   return false;
3319 }
3320
3321 /* Return the variable bound in a GIMPLE_DEBUG bind statement.  */
3322
3323 static inline tree
3324 gimple_debug_bind_get_var (gimple dbg)
3325 {
3326   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3327   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3328   return gimple_op (dbg, 0);
3329 }
3330
3331 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3332    statement.  */
3333
3334 static inline tree
3335 gimple_debug_bind_get_value (gimple dbg)
3336 {
3337   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3338   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3339   return gimple_op (dbg, 1);
3340 }
3341
3342 /* Return a pointer to the value bound to the variable in a
3343    GIMPLE_DEBUG bind statement.  */
3344
3345 static inline tree *
3346 gimple_debug_bind_get_value_ptr (gimple dbg)
3347 {
3348   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3349   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3350   return gimple_op_ptr (dbg, 1);
3351 }
3352
3353 /* Set the variable bound in a GIMPLE_DEBUG bind statement.  */
3354
3355 static inline void
3356 gimple_debug_bind_set_var (gimple dbg, tree var)
3357 {
3358   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3359   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3360   gimple_set_op (dbg, 0, var);
3361 }
3362
3363 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3364    statement.  */
3365
3366 static inline void
3367 gimple_debug_bind_set_value (gimple dbg, tree value)
3368 {
3369   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3370   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3371   gimple_set_op (dbg, 1, value);
3372 }
3373
3374 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3375    optimized away.  */
3376 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3377
3378 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3379    statement.  */
3380
3381 static inline void
3382 gimple_debug_bind_reset_value (gimple dbg)
3383 {
3384   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3385   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3386   gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3387 }
3388
3389 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3390    value.  */
3391
3392 static inline bool
3393 gimple_debug_bind_has_value_p (gimple dbg)
3394 {
3395   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3396   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_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_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4119                               && 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_gimple_checking_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 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, 
4802                                         enum tree_code, tree, tree);
4803 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
4804                                        enum tree_code, tree, tree);
4805
4806 #endif  /* GCC_GIMPLE_H */