OSDN Git Service

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