OSDN Git Service

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