OSDN Git Service

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