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