OSDN Git Service

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