OSDN Git Service

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