OSDN Git Service

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