OSDN Git Service

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