OSDN Git Service

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