OSDN Git Service

Fix paths
[pf3gnuchains/gcc-fork.git] / gcc / gimple.h
1 /* Gimple IR definitions.
2
3    Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
4    Contributed by Aldy Hernandez <aldyh@redhat.com>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
24
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "ggc.h"
28 #include "tm.h"
29 #include "hard-reg-set.h"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
32
33 DEF_VEC_P(gimple);
34 DEF_VEC_ALLOC_P(gimple,heap);
35 DEF_VEC_ALLOC_P(gimple,gc);
36
37 typedef gimple *gimple_p;
38 DEF_VEC_P(gimple_p);
39 DEF_VEC_ALLOC_P(gimple_p,heap);
40
41 DEF_VEC_P(gimple_seq);
42 DEF_VEC_ALLOC_P(gimple_seq,gc);
43 DEF_VEC_ALLOC_P(gimple_seq,heap);
44
45 /* For each block, the PHI nodes that need to be rewritten are stored into
46    these vectors.  */
47 typedef VEC(gimple, heap) *gimple_vec;
48 DEF_VEC_P (gimple_vec);
49 DEF_VEC_ALLOC_P (gimple_vec, heap);
50
51 enum gimple_code {
52 #define DEFGSCODE(SYM, STRING, STRUCT)  SYM,
53 #include "gimple.def"
54 #undef DEFGSCODE
55     LAST_AND_UNUSED_GIMPLE_CODE
56 };
57
58 extern const char *const gimple_code_name[];
59 extern const unsigned char gimple_rhs_class_table[];
60
61 /* Error out if a gimple tuple is addressed incorrectly.  */
62 #if defined ENABLE_GIMPLE_CHECKING
63 extern void gimple_check_failed (const_gimple, const char *, int,          \
64                                  const char *, enum gimple_code,           \
65                                  enum tree_code) ATTRIBUTE_NORETURN;
66
67 #define GIMPLE_CHECK(GS, CODE)                                          \
68   do {                                                                  \
69     const_gimple __gs = (GS);                                           \
70     if (gimple_code (__gs) != (CODE))                                   \
71       gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__,      \
72                            (CODE), ERROR_MARK);                         \
73   } while (0)
74 #else  /* not ENABLE_GIMPLE_CHECKING  */
75 #define GIMPLE_CHECK(GS, CODE)                  (void)0
76 #endif
77
78 /* Class of GIMPLE expressions suitable for the RHS of assignments.  See
79    get_gimple_rhs_class.  */
80 enum gimple_rhs_class
81 {
82   GIMPLE_INVALID_RHS,   /* The expression cannot be used on the RHS.  */
83   GIMPLE_BINARY_RHS,    /* The expression is a binary operation.  */
84   GIMPLE_UNARY_RHS,     /* The expression is a unary operation.  */
85   GIMPLE_SINGLE_RHS     /* The expression is a single object (an SSA
86                            name, a _DECL, a _REF, etc.  */
87 };
88
89 /* Specific flags for individual GIMPLE statements.  These flags are
90    always stored in gimple_statement_base.subcode and they may only be
91    defined for statement codes that do not use sub-codes.
92
93    Values for the masks can overlap as long as the overlapping values
94    are never used in the same statement class.
95
96    The maximum mask value that can be defined is 1 << 15 (i.e., each
97    statement code can hold up to 16 bitflags).
98
99    Keep this list sorted.  */
100 enum gf_mask {
101     GF_ASM_INPUT                = 1 << 0,
102     GF_ASM_VOLATILE             = 1 << 1,
103     GF_CALL_CANNOT_INLINE       = 1 << 0,
104     GF_CALL_FROM_THUNK          = 1 << 1,
105     GF_CALL_RETURN_SLOT_OPT     = 1 << 2,
106     GF_CALL_TAILCALL            = 1 << 3,
107     GF_CALL_VA_ARG_PACK         = 1 << 4,
108     GF_OMP_PARALLEL_COMBINED    = 1 << 0,
109
110     /* True on an GIMPLE_OMP_RETURN statement if the return does not require
111        a thread synchronization via some sort of barrier.  The exact barrier
112        that would otherwise be emitted is dependent on the OMP statement with
113        which this return is associated.  */
114     GF_OMP_RETURN_NOWAIT        = 1 << 0,
115
116     GF_OMP_SECTION_LAST         = 1 << 0,
117     GF_PREDICT_TAKEN            = 1 << 15
118 };
119
120 /* Masks for selecting a pass local flag (PLF) to work on.  These
121    masks are used by gimple_set_plf and gimple_plf.  */
122 enum plf_mask {
123     GF_PLF_1    = 1 << 0,
124     GF_PLF_2    = 1 << 1
125 };
126
127 /* A node in a gimple_seq_d.  */
128 struct 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 enum fallback {
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 };
946
947 typedef int fallback_t;
948
949 enum gimplify_status {
950   GS_ERROR      = -2,   /* Something Bad Seen.  */
951   GS_UNHANDLED  = -1,   /* A langhook result for "I dunno".  */
952   GS_OK         = 0,    /* We did something, maybe more to do.  */
953   GS_ALL_DONE   = 1     /* The expression is fully gimplified.  */
954 };
955
956 struct gimplify_ctx
957 {
958   struct gimplify_ctx *prev_context;
959
960   VEC(gimple,heap) *bind_expr_stack;
961   tree temps;
962   gimple_seq conditional_cleanups;
963   tree exit_label;
964   tree return_temp;
965   
966   VEC(tree,heap) *case_labels;
967   /* The formal temporary table.  Should this be persistent?  */
968   htab_t temp_htab;
969
970   int conditions;
971   bool save_stack;
972   bool into_ssa;
973   bool allow_rhs_cond_expr;
974 };
975
976 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
977                                            bool (*) (tree), fallback_t);
978 extern void gimplify_type_sizes (tree, gimple_seq *);
979 extern void gimplify_one_sizepos (tree *, gimple_seq *);
980 extern bool gimplify_stmt (tree *, gimple_seq *);
981 extern gimple gimplify_body (tree *, tree, bool);
982 extern void push_gimplify_context (struct gimplify_ctx *);
983 extern void pop_gimplify_context (gimple);
984 extern void gimplify_and_add (tree, gimple_seq *);
985
986 /* Miscellaneous helpers.  */
987 extern void gimple_add_tmp_var (tree);
988 extern gimple gimple_current_bind_expr (void);
989 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
990 extern tree voidify_wrapper_expr (tree, tree);
991 extern tree build_and_jump (tree *);
992 extern tree alloc_stmt_list (void);
993 extern void free_stmt_list (tree);
994 extern tree force_labels_r (tree *, int *, void *);
995 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
996                                                   gimple_seq *);
997 struct gimplify_omp_ctx;
998 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
999 extern tree gimple_boolify (tree);
1000 extern gimple_predicate rhs_predicate_for (tree);
1001 extern tree canonicalize_cond_expr_cond (tree);
1002
1003 /* In omp-low.c.  */
1004 extern void diagnose_omp_structured_block_errors (tree);
1005 extern tree omp_reduction_init (tree, tree);
1006
1007 /* In tree-nested.c.  */
1008 extern void lower_nested_functions (tree);
1009 extern void insert_field_into_struct (tree, tree);
1010
1011 /* In gimplify.c.  */
1012 extern void gimplify_function_tree (tree);
1013
1014 /* In cfgexpand.c.  */
1015 extern tree gimple_assign_rhs_to_tree (gimple);
1016
1017 /* In builtins.c  */
1018 extern bool validate_gimple_arglist (const_gimple, ...);
1019
1020 /* In tree-ssa.c  */
1021 extern bool tree_ssa_useless_type_conversion (tree);
1022 extern bool useless_type_conversion_p (tree, tree);
1023 extern bool types_compatible_p (tree, tree);
1024
1025 /* Return the code for GIMPLE statement G.  */
1026
1027 static inline enum gimple_code
1028 gimple_code (const_gimple g)
1029 {
1030   return g->gsbase.code;
1031 }
1032
1033
1034 /* Return true if statement G has sub-statements.  This is only true for
1035    High GIMPLE statements.  */
1036
1037 static inline bool
1038 gimple_has_substatements (gimple g)
1039 {
1040   switch (gimple_code (g))
1041     {
1042     case GIMPLE_BIND:
1043     case GIMPLE_CATCH:
1044     case GIMPLE_EH_FILTER:
1045     case GIMPLE_TRY:
1046     case GIMPLE_OMP_FOR:
1047     case GIMPLE_OMP_MASTER:
1048     case GIMPLE_OMP_ORDERED:
1049     case GIMPLE_OMP_SECTION:
1050     case GIMPLE_OMP_PARALLEL:
1051     case GIMPLE_OMP_TASK:
1052     case GIMPLE_OMP_SECTIONS:
1053     case GIMPLE_OMP_SINGLE:
1054     case GIMPLE_OMP_CRITICAL:
1055     case GIMPLE_WITH_CLEANUP_EXPR:
1056       return true;
1057
1058     default:
1059       return false;
1060     }
1061 }
1062           
1063
1064 /* Return the basic block holding statement G.  */
1065
1066 static inline struct basic_block_def *
1067 gimple_bb (const_gimple g)
1068 {
1069   return g->gsbase.bb;
1070 }
1071
1072
1073 /* Return the lexical scope block holding statement G.  */
1074
1075 static inline tree
1076 gimple_block (const_gimple g)
1077 {
1078   return g->gsbase.block;
1079 }
1080
1081
1082 /* Set BLOCK to be the lexical scope block holding statement G.  */
1083
1084 static inline void
1085 gimple_set_block (gimple g, tree block)
1086 {
1087   g->gsbase.block = block;
1088 }
1089
1090
1091 /* Return location information for statement G.  */
1092
1093 static inline location_t
1094 gimple_location (const_gimple g)
1095 {
1096   return g->gsbase.location;
1097 }
1098
1099 /* Return pointer to location information for statement G.  */
1100
1101 static inline const location_t *
1102 gimple_location_ptr (const_gimple g)
1103 {
1104   return &g->gsbase.location;
1105 }
1106
1107
1108 /* Set location information for statement G.  */
1109
1110 static inline void
1111 gimple_set_location (gimple g, location_t location)
1112 {
1113   g->gsbase.location = location;
1114 }
1115
1116
1117 /* Return true if G contains location information.  */
1118
1119 static inline bool
1120 gimple_has_location (const_gimple g)
1121 {
1122   return gimple_location (g) != UNKNOWN_LOCATION;
1123 }
1124
1125
1126 /* Return the file name of the location of STMT.  */
1127
1128 static inline const char *
1129 gimple_filename (const_gimple stmt)
1130 {
1131   return LOCATION_FILE (gimple_location (stmt));
1132 }
1133
1134
1135 /* Return the line number of the location of STMT.  */
1136
1137 static inline int
1138 gimple_lineno (const_gimple stmt)
1139 {
1140   return LOCATION_LINE (gimple_location (stmt));
1141 }
1142
1143
1144 /* Determine whether SEQ is a singleton. */
1145
1146 static inline bool
1147 gimple_seq_singleton_p (gimple_seq seq)
1148 {
1149   return ((gimple_seq_first (seq) != NULL)
1150           && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1151 }
1152
1153 /* Return true if no warnings should be emitted for statement STMT.  */
1154
1155 static inline bool
1156 gimple_no_warning_p (const_gimple stmt)
1157 {
1158   return stmt->gsbase.no_warning;
1159 }
1160
1161 /* Set the no_warning flag of STMT to NO_WARNING.  */
1162
1163 static inline void
1164 gimple_set_no_warning (gimple stmt, bool no_warning)
1165 {
1166   stmt->gsbase.no_warning = (unsigned) no_warning;
1167 }
1168
1169 /* Set the visited status on statement STMT to VISITED_P.  */
1170
1171 static inline void
1172 gimple_set_visited (gimple stmt, bool visited_p)
1173 {
1174   stmt->gsbase.visited = (unsigned) visited_p;
1175 }
1176
1177
1178 /* Return the visited status for statement STMT.  */
1179
1180 static inline bool
1181 gimple_visited_p (gimple stmt)
1182 {
1183   return stmt->gsbase.visited;
1184 }
1185
1186
1187 /* Set pass local flag PLF on statement STMT to VAL_P.  */
1188
1189 static inline void
1190 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1191 {
1192   if (val_p)
1193     stmt->gsbase.plf |= (unsigned int) plf;
1194   else
1195     stmt->gsbase.plf &= ~((unsigned int) plf);
1196 }
1197
1198
1199 /* Return the value of pass local flag PLF on statement STMT.  */
1200
1201 static inline unsigned int
1202 gimple_plf (gimple stmt, enum plf_mask plf)
1203 {
1204   return stmt->gsbase.plf & ((unsigned int) plf);
1205 }
1206
1207
1208 /* Set the UID of statement.  */
1209
1210 static inline void
1211 gimple_set_uid (gimple g, unsigned uid)
1212 {
1213   g->gsbase.uid = uid;
1214 }
1215
1216
1217 /* Return the UID of statement.  */
1218
1219 static inline unsigned
1220 gimple_uid (const_gimple g)
1221 {
1222   return g->gsbase.uid;
1223 }
1224
1225
1226 /* Return true if GIMPLE statement G has register or memory operands.  */
1227
1228 static inline bool
1229 gimple_has_ops (const_gimple g)
1230 {
1231   return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1232 }
1233
1234
1235 /* Return true if GIMPLE statement G has memory operands.  */
1236
1237 static inline bool
1238 gimple_has_mem_ops (const_gimple g)
1239 {
1240   return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1241 }
1242
1243
1244 /* Return the set of DEF operands for statement G.  */
1245
1246 static inline struct def_optype_d *
1247 gimple_def_ops (const_gimple g)
1248 {
1249   if (!gimple_has_ops (g))
1250     return NULL;
1251   return g->gsops.opbase.def_ops;
1252 }
1253
1254
1255 /* Set DEF to be the set of DEF operands for statement G.  */
1256
1257 static inline void
1258 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1259 {
1260   gcc_assert (gimple_has_ops (g));
1261   g->gsops.opbase.def_ops = def;
1262 }
1263
1264
1265 /* Return the set of USE operands for statement G.  */
1266
1267 static inline struct use_optype_d *
1268 gimple_use_ops (const_gimple g)
1269 {
1270   if (!gimple_has_ops (g))
1271     return NULL;
1272   return g->gsops.opbase.use_ops;
1273 }
1274
1275
1276 /* Set USE to be the set of USE operands for statement G.  */
1277
1278 static inline void
1279 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1280 {
1281   gcc_assert (gimple_has_ops (g));
1282   g->gsops.opbase.use_ops = use;
1283 }
1284
1285
1286 /* Return the set of VUSE operand for statement G.  */
1287
1288 static inline use_operand_p
1289 gimple_vuse_op (const_gimple g)
1290 {
1291   struct use_optype_d *ops;
1292   if (!gimple_has_mem_ops (g))
1293     return NULL_USE_OPERAND_P;
1294   ops = g->gsops.opbase.use_ops;
1295   if (ops
1296       && USE_OP_PTR (ops)->use == &g->gsmem.membase.vuse)
1297     return USE_OP_PTR (ops);
1298   return NULL_USE_OPERAND_P;
1299 }
1300
1301 /* Return the set of VDEF operand for statement G.  */
1302
1303 static inline def_operand_p
1304 gimple_vdef_op (const_gimple g)
1305 {
1306   struct def_optype_d *ops;
1307   if (!gimple_has_mem_ops (g))
1308     return NULL_DEF_OPERAND_P;
1309   ops = g->gsops.opbase.def_ops;
1310   if (ops
1311       && DEF_OP_PTR (ops) == &g->gsmem.membase.vdef)
1312     return DEF_OP_PTR (ops);
1313   return NULL_DEF_OPERAND_P;
1314 }
1315
1316
1317 /* Return the single VUSE operand of the statement G.  */
1318
1319 static inline tree
1320 gimple_vuse (const_gimple g)
1321 {
1322   if (!gimple_has_mem_ops (g))
1323     return NULL_TREE;
1324   return g->gsmem.membase.vuse;
1325 }
1326
1327 /* Return the single VDEF operand of the statement G.  */
1328
1329 static inline tree
1330 gimple_vdef (const_gimple g)
1331 {
1332   if (!gimple_has_mem_ops (g))
1333     return NULL_TREE;
1334   return g->gsmem.membase.vdef;
1335 }
1336
1337 /* Return the single VUSE operand of the statement G.  */
1338
1339 static inline tree *
1340 gimple_vuse_ptr (gimple g)
1341 {
1342   if (!gimple_has_mem_ops (g))
1343     return NULL;
1344   return &g->gsmem.membase.vuse;
1345 }
1346
1347 /* Return the single VDEF operand of the statement G.  */
1348
1349 static inline tree *
1350 gimple_vdef_ptr (gimple g)
1351 {
1352   if (!gimple_has_mem_ops (g))
1353     return NULL;
1354   return &g->gsmem.membase.vdef;
1355 }
1356
1357 /* Set the single VUSE operand of the statement G.  */
1358
1359 static inline void
1360 gimple_set_vuse (gimple g, tree vuse)
1361 {
1362   gcc_assert (gimple_has_mem_ops (g));
1363   g->gsmem.membase.vuse = vuse;
1364 }
1365
1366 /* Set the single VDEF operand of the statement G.  */
1367
1368 static inline void
1369 gimple_set_vdef (gimple g, tree vdef)
1370 {
1371   gcc_assert (gimple_has_mem_ops (g));
1372   g->gsmem.membase.vdef = vdef;
1373 }
1374
1375
1376 /* Return true if statement G has operands and the modified field has
1377    been set.  */
1378
1379 static inline bool
1380 gimple_modified_p (const_gimple g)
1381 {
1382   return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1383 }
1384
1385 /* Return the type of the main expression computed by STMT.  Return
1386    void_type_node if the statement computes nothing.  */
1387
1388 static inline tree
1389 gimple_expr_type (const_gimple stmt)
1390 {
1391   enum gimple_code code = gimple_code (stmt);
1392
1393   if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
1394     {
1395       tree type = TREE_TYPE (gimple_get_lhs (stmt));
1396       /* Integral sub-types are never the type of the expression,
1397          but they still can be the type of the result as the base
1398          type (in which expressions are computed) is trivially
1399          convertible to one of its sub-types.  So always return
1400          the base type here.  */
1401       if (INTEGRAL_TYPE_P (type)
1402           && TREE_TYPE (type)
1403           /* But only if they are trivially convertible.  */
1404           && useless_type_conversion_p (type, TREE_TYPE (type)))
1405         type = TREE_TYPE (type);
1406       return type;
1407     }
1408   else if (code == GIMPLE_COND)
1409     return boolean_type_node;
1410   else
1411     return void_type_node;
1412 }
1413
1414
1415 /* Return the tree code for the expression computed by STMT.  This is
1416    only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN.  For
1417    GIMPLE_CALL, return CALL_EXPR as the expression code for
1418    consistency.  This is useful when the caller needs to deal with the
1419    three kinds of computation that GIMPLE supports.  */
1420
1421 static inline enum tree_code
1422 gimple_expr_code (const_gimple stmt)
1423 {
1424   enum gimple_code code = gimple_code (stmt);
1425   if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1426     return (enum tree_code) stmt->gsbase.subcode;
1427   else if (code == GIMPLE_CALL)
1428     return CALL_EXPR;
1429   else
1430     gcc_unreachable ();
1431 }
1432
1433
1434 /* Mark statement S as modified, and update it.  */
1435
1436 static inline void
1437 update_stmt (gimple s)
1438 {
1439   if (gimple_has_ops (s))
1440     {
1441       gimple_set_modified (s, true);
1442       update_stmt_operands (s);
1443     }
1444 }
1445
1446 /* Update statement S if it has been optimized.  */
1447
1448 static inline void
1449 update_stmt_if_modified (gimple s)
1450 {
1451   if (gimple_modified_p (s))
1452     update_stmt_operands (s);
1453 }
1454
1455 /* Return true if statement STMT contains volatile operands.  */
1456
1457 static inline bool
1458 gimple_has_volatile_ops (const_gimple stmt)
1459 {
1460   if (gimple_has_mem_ops (stmt))
1461     return stmt->gsbase.has_volatile_ops;
1462   else
1463     return false;
1464 }
1465
1466
1467 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP.  */
1468
1469 static inline void
1470 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1471 {
1472   if (gimple_has_mem_ops (stmt))
1473     stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1474 }
1475
1476
1477 /* Return true if statement STMT may access memory.  */
1478
1479 static inline bool
1480 gimple_references_memory_p (gimple stmt)
1481 {
1482   return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1483 }
1484
1485
1486 /* Return the subcode for OMP statement S.  */
1487
1488 static inline unsigned
1489 gimple_omp_subcode (const_gimple s)
1490 {
1491   gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1492               && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1493   return s->gsbase.subcode;
1494 }
1495
1496 /* Set the subcode for OMP statement S to SUBCODE.  */
1497
1498 static inline void
1499 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1500 {
1501   /* We only have 16 bits for the subcode.  Assert that we are not
1502      overflowing it.  */
1503   gcc_assert (subcode < (1 << 16));
1504   s->gsbase.subcode = subcode;
1505 }
1506
1507 /* Set the nowait flag on OMP_RETURN statement S.  */
1508
1509 static inline void
1510 gimple_omp_return_set_nowait (gimple s)
1511 {
1512   GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1513   s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1514 }
1515
1516
1517 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1518    flag set.  */
1519
1520 static inline bool
1521 gimple_omp_return_nowait_p (const_gimple g)
1522 {
1523   GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1524   return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1525 }
1526
1527
1528 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1529    flag set.  */
1530
1531 static inline bool
1532 gimple_omp_section_last_p (const_gimple g)
1533 {
1534   GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1535   return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1536 }
1537
1538
1539 /* Set the GF_OMP_SECTION_LAST flag on G.  */
1540
1541 static inline void
1542 gimple_omp_section_set_last (gimple g)
1543 {
1544   GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1545   g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1546 }
1547
1548
1549 /* Return true if OMP parallel statement G has the
1550    GF_OMP_PARALLEL_COMBINED flag set.  */
1551
1552 static inline bool
1553 gimple_omp_parallel_combined_p (const_gimple g)
1554 {
1555   GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1556   return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1557 }
1558
1559
1560 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1561    value of COMBINED_P.  */
1562
1563 static inline void
1564 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1565 {
1566   GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1567   if (combined_p)
1568     g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1569   else
1570     g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1571 }
1572
1573
1574 /* Return the number of operands for statement GS.  */
1575
1576 static inline unsigned
1577 gimple_num_ops (const_gimple gs)
1578 {
1579   return gs->gsbase.num_ops;
1580 }
1581
1582
1583 /* Set the number of operands for statement GS.  */
1584
1585 static inline void
1586 gimple_set_num_ops (gimple gs, unsigned num_ops)
1587 {
1588   gs->gsbase.num_ops = num_ops;
1589 }
1590
1591
1592 /* Return the array of operands for statement GS.  */
1593
1594 static inline tree *
1595 gimple_ops (gimple gs)
1596 {
1597   /* Offset in bytes to the location of the operand vector in every
1598      tuple structure.  Defined in gimple.c  */
1599   extern size_t const gimple_ops_offset_[];
1600
1601   if (!gimple_has_ops (gs))
1602     return NULL;
1603
1604   /* All the tuples have their operand vector at the very bottom
1605      of the structure.  */
1606   return ((tree *) ((char *) gs + gimple_ops_offset_[gimple_code (gs)]));
1607 }
1608
1609
1610 /* Return operand I for statement GS.  */
1611
1612 static inline tree
1613 gimple_op (const_gimple gs, unsigned i)
1614 {
1615   if (gimple_has_ops (gs))
1616     {
1617       gcc_assert (i < gimple_num_ops (gs));
1618       return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1619     }
1620   else
1621     return NULL_TREE;
1622 }
1623
1624 /* Return a pointer to operand I for statement GS.  */
1625
1626 static inline tree *
1627 gimple_op_ptr (const_gimple gs, unsigned i)
1628 {
1629   if (gimple_has_ops (gs))
1630     {
1631       gcc_assert (i < gimple_num_ops (gs));
1632       return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1633     }
1634   else
1635     return NULL;
1636 }
1637
1638 /* Set operand I of statement GS to OP.  */
1639
1640 static inline void
1641 gimple_set_op (gimple gs, unsigned i, tree op)
1642 {
1643   gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1644
1645   /* Note.  It may be tempting to assert that OP matches
1646      is_gimple_operand, but that would be wrong.  Different tuples
1647      accept slightly different sets of tree operands.  Each caller
1648      should perform its own validation.  */
1649   gimple_ops (gs)[i] = op;
1650 }
1651
1652 /* Return true if GS is a GIMPLE_ASSIGN.  */
1653
1654 static inline bool
1655 is_gimple_assign (const_gimple gs)
1656 {
1657   return gimple_code (gs) == GIMPLE_ASSIGN;
1658 }
1659
1660 /* Determine if expression CODE is one of the valid expressions that can
1661    be used on the RHS of GIMPLE assignments.  */
1662
1663 static inline enum gimple_rhs_class
1664 get_gimple_rhs_class (enum tree_code code)
1665 {
1666   return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1667 }
1668
1669 /* Return the LHS of assignment statement GS.  */
1670
1671 static inline tree
1672 gimple_assign_lhs (const_gimple gs)
1673 {
1674   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1675   return gimple_op (gs, 0);
1676 }
1677
1678
1679 /* Return a pointer to the LHS of assignment statement GS.  */
1680
1681 static inline tree *
1682 gimple_assign_lhs_ptr (const_gimple gs)
1683 {
1684   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1685   return gimple_op_ptr (gs, 0);
1686 }
1687
1688
1689 /* Set LHS to be the LHS operand of assignment statement GS.  */
1690
1691 static inline void
1692 gimple_assign_set_lhs (gimple gs, tree lhs)
1693 {
1694   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1695   gcc_assert (is_gimple_operand (lhs));
1696   gimple_set_op (gs, 0, lhs);
1697
1698   if (lhs && TREE_CODE (lhs) == SSA_NAME)
1699     SSA_NAME_DEF_STMT (lhs) = gs;
1700 }
1701
1702
1703 /* Return the first operand on the RHS of assignment statement GS.  */
1704
1705 static inline tree
1706 gimple_assign_rhs1 (const_gimple gs)
1707 {
1708   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1709   return gimple_op (gs, 1);
1710 }
1711
1712
1713 /* Return a pointer to the first operand on the RHS of assignment
1714    statement GS.  */
1715
1716 static inline tree *
1717 gimple_assign_rhs1_ptr (const_gimple gs)
1718 {
1719   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1720   return gimple_op_ptr (gs, 1);
1721 }
1722
1723 /* Set RHS to be the first operand on the RHS of assignment statement GS.  */
1724
1725 static inline void
1726 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1727 {
1728   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1729
1730   /* If there are 3 or more operands, the 2 operands on the RHS must be
1731      GIMPLE values.  */
1732   if (gimple_num_ops (gs) >= 3)
1733     gcc_assert (is_gimple_val (rhs));
1734   else
1735     gcc_assert (is_gimple_operand (rhs));
1736
1737   gimple_set_op (gs, 1, rhs);
1738 }
1739
1740
1741 /* Return the second operand on the RHS of assignment statement GS.
1742    If GS does not have two operands, NULL is returned instead.  */
1743
1744 static inline tree
1745 gimple_assign_rhs2 (const_gimple gs)
1746 {
1747   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1748
1749   if (gimple_num_ops (gs) >= 3)
1750     return gimple_op (gs, 2);
1751   else
1752     return NULL_TREE;
1753 }
1754
1755
1756 /* Return a pointer to the second operand on the RHS of assignment
1757    statement GS.  */
1758
1759 static inline tree *
1760 gimple_assign_rhs2_ptr (const_gimple gs)
1761 {
1762   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1763   return gimple_op_ptr (gs, 2);
1764 }
1765
1766
1767 /* Set RHS to be the second operand on the RHS of assignment statement GS.  */
1768
1769 static inline void
1770 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1771 {
1772   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1773
1774   /* The 2 operands on the RHS must be GIMPLE values.  */
1775   gcc_assert (is_gimple_val (rhs));
1776
1777   gimple_set_op (gs, 2, rhs);
1778 }
1779
1780 /* Returns true if GS is a nontemporal move.  */
1781
1782 static inline bool
1783 gimple_assign_nontemporal_move_p (const_gimple gs)
1784 {
1785   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1786   return gs->gsbase.nontemporal_move;
1787 }
1788
1789 /* Sets nontemporal move flag of GS to NONTEMPORAL.  */
1790
1791 static inline void
1792 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1793 {
1794   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1795   gs->gsbase.nontemporal_move = nontemporal;
1796 }
1797
1798
1799 /* Return the code of the expression computed on the rhs of assignment
1800    statement GS.  In case that the RHS is a single object, returns the
1801    tree code of the object.  */
1802
1803 static inline enum tree_code
1804 gimple_assign_rhs_code (const_gimple gs)
1805 {
1806   enum tree_code code;
1807   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1808
1809   code = gimple_expr_code (gs);
1810   if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1811     code = TREE_CODE (gimple_assign_rhs1 (gs));
1812
1813   return code;
1814 }
1815
1816
1817 /* Set CODE to be the code for the expression computed on the RHS of
1818    assignment S.  */
1819
1820 static inline void
1821 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1822 {
1823   GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1824   s->gsbase.subcode = code;
1825 }
1826
1827
1828 /* Return the gimple rhs class of the code of the expression computed on
1829    the rhs of assignment statement GS.
1830    This will never return GIMPLE_INVALID_RHS.  */
1831
1832 static inline enum gimple_rhs_class
1833 gimple_assign_rhs_class (const_gimple gs)
1834 {
1835   return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1836 }
1837
1838
1839 /* Return true if S is a type-cast assignment.  */
1840
1841 static inline bool
1842 gimple_assign_cast_p (gimple s)
1843 {
1844   if (is_gimple_assign (s))
1845     {
1846       enum tree_code sc = gimple_assign_rhs_code (s);
1847       return CONVERT_EXPR_CODE_P (sc)
1848              || sc == VIEW_CONVERT_EXPR
1849              || sc == FIX_TRUNC_EXPR;
1850     }
1851
1852   return false;
1853 }
1854
1855
1856 /* Return true if GS is a GIMPLE_CALL.  */
1857
1858 static inline bool
1859 is_gimple_call (const_gimple gs)
1860 {
1861   return gimple_code (gs) == GIMPLE_CALL;
1862 }
1863
1864 /* Return the LHS of call statement GS.  */
1865
1866 static inline tree
1867 gimple_call_lhs (const_gimple gs)
1868 {
1869   GIMPLE_CHECK (gs, GIMPLE_CALL);
1870   return gimple_op (gs, 0);
1871 }
1872
1873
1874 /* Return a pointer to the LHS of call statement GS.  */
1875
1876 static inline tree *
1877 gimple_call_lhs_ptr (const_gimple gs)
1878 {
1879   GIMPLE_CHECK (gs, GIMPLE_CALL);
1880   return gimple_op_ptr (gs, 0);
1881 }
1882
1883
1884 /* Set LHS to be the LHS operand of call statement GS.  */
1885
1886 static inline void
1887 gimple_call_set_lhs (gimple gs, tree lhs)
1888 {
1889   GIMPLE_CHECK (gs, GIMPLE_CALL);
1890   gcc_assert (!lhs || is_gimple_operand (lhs));
1891   gimple_set_op (gs, 0, lhs);
1892   if (lhs && TREE_CODE (lhs) == SSA_NAME)
1893     SSA_NAME_DEF_STMT (lhs) = gs;
1894 }
1895
1896
1897 /* Return the tree node representing the function called by call
1898    statement GS.  */
1899
1900 static inline tree
1901 gimple_call_fn (const_gimple gs)
1902 {
1903   GIMPLE_CHECK (gs, GIMPLE_CALL);
1904   return gimple_op (gs, 1);
1905 }
1906
1907
1908 /* Return a pointer to the tree node representing the function called by call
1909    statement GS.  */
1910
1911 static inline tree *
1912 gimple_call_fn_ptr (const_gimple gs)
1913 {
1914   GIMPLE_CHECK (gs, GIMPLE_CALL);
1915   return gimple_op_ptr (gs, 1);
1916 }
1917
1918
1919 /* Set FN to be the function called by call statement GS.  */
1920
1921 static inline void
1922 gimple_call_set_fn (gimple gs, tree fn)
1923 {
1924   GIMPLE_CHECK (gs, GIMPLE_CALL);
1925   gcc_assert (is_gimple_operand (fn));
1926   gimple_set_op (gs, 1, fn);
1927 }
1928
1929
1930 /* Set FNDECL to be the function called by call statement GS.  */
1931
1932 static inline void
1933 gimple_call_set_fndecl (gimple gs, tree decl)
1934 {
1935   GIMPLE_CHECK (gs, GIMPLE_CALL);
1936   gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
1937   gimple_set_op (gs, 1, build_fold_addr_expr (decl));
1938 }
1939
1940
1941 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1942    Otherwise return NULL.  This function is analogous to
1943    get_callee_fndecl in tree land.  */
1944
1945 static inline tree
1946 gimple_call_fndecl (const_gimple gs)
1947 {
1948   tree addr = gimple_call_fn (gs);
1949   if (TREE_CODE (addr) == ADDR_EXPR)
1950     {
1951       gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL);
1952       return TREE_OPERAND (addr, 0);
1953     }
1954   return NULL_TREE;
1955 }
1956
1957
1958 /* Return the type returned by call statement GS.  */
1959
1960 static inline tree
1961 gimple_call_return_type (const_gimple gs)
1962 {
1963   tree fn = gimple_call_fn (gs);
1964   tree type = TREE_TYPE (fn);
1965
1966   /* See through the pointer.  */
1967   gcc_assert (POINTER_TYPE_P (type));
1968   type = TREE_TYPE (type);
1969
1970   gcc_assert (TREE_CODE (type) == FUNCTION_TYPE
1971               || TREE_CODE (type) == METHOD_TYPE);
1972
1973   /* The type returned by a FUNCTION_DECL is the type of its
1974      function type.  */
1975   return TREE_TYPE (type);
1976 }
1977
1978
1979 /* Return the static chain for call statement GS.  */
1980
1981 static inline tree
1982 gimple_call_chain (const_gimple gs)
1983 {
1984   GIMPLE_CHECK (gs, GIMPLE_CALL);
1985   return gimple_op (gs, 2);
1986 }
1987
1988
1989 /* Return a pointer to the static chain for call statement GS.  */
1990
1991 static inline tree *
1992 gimple_call_chain_ptr (const_gimple gs)
1993 {
1994   GIMPLE_CHECK (gs, GIMPLE_CALL);
1995   return gimple_op_ptr (gs, 2);
1996 }
1997
1998 /* Set CHAIN to be the static chain for call statement GS.  */
1999
2000 static inline void
2001 gimple_call_set_chain (gimple gs, tree chain)
2002 {
2003   GIMPLE_CHECK (gs, GIMPLE_CALL);
2004   gcc_assert (chain == NULL
2005               || TREE_CODE (chain) == ADDR_EXPR
2006               || SSA_VAR_P (chain));
2007   gimple_set_op (gs, 2, chain);
2008 }
2009
2010
2011 /* Return the number of arguments used by call statement GS.  */
2012
2013 static inline unsigned
2014 gimple_call_num_args (const_gimple gs)
2015 {
2016   unsigned num_ops;
2017   GIMPLE_CHECK (gs, GIMPLE_CALL);
2018   num_ops = gimple_num_ops (gs);
2019   gcc_assert (num_ops >= 3);
2020   return num_ops - 3;
2021 }
2022
2023
2024 /* Return the argument at position INDEX for call statement GS.  */
2025
2026 static inline tree
2027 gimple_call_arg (const_gimple gs, unsigned index)
2028 {
2029   GIMPLE_CHECK (gs, GIMPLE_CALL);
2030   return gimple_op (gs, index + 3);
2031 }
2032
2033
2034 /* Return a pointer to the argument at position INDEX for call
2035    statement GS.  */
2036
2037 static inline tree *
2038 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2039 {
2040   GIMPLE_CHECK (gs, GIMPLE_CALL);
2041   return gimple_op_ptr (gs, index + 3);
2042 }
2043
2044
2045 /* Set ARG to be the argument at position INDEX for call statement GS.  */
2046
2047 static inline void
2048 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2049 {
2050   GIMPLE_CHECK (gs, GIMPLE_CALL);
2051   gcc_assert (is_gimple_operand (arg));
2052   gimple_set_op (gs, index + 3, arg);
2053 }
2054
2055
2056 /* If TAIL_P is true, mark call statement S as being a tail call
2057    (i.e., a call just before the exit of a function).  These calls are
2058    candidate for tail call optimization.  */
2059
2060 static inline void
2061 gimple_call_set_tail (gimple s, bool tail_p)
2062 {
2063   GIMPLE_CHECK (s, GIMPLE_CALL);
2064   if (tail_p)
2065     s->gsbase.subcode |= GF_CALL_TAILCALL;
2066   else
2067     s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2068 }
2069
2070
2071 /* Return true if GIMPLE_CALL S is marked as a tail call.  */
2072
2073 static inline bool
2074 gimple_call_tail_p (gimple s)
2075 {
2076   GIMPLE_CHECK (s, GIMPLE_CALL);
2077   return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2078 }
2079
2080
2081 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P.  */
2082
2083 static inline void
2084 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2085 {
2086   GIMPLE_CHECK (s, GIMPLE_CALL);
2087   if (inlinable_p)
2088     s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2089   else
2090     s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2091 }
2092
2093
2094 /* Return true if GIMPLE_CALL S cannot be inlined.  */
2095
2096 static inline bool
2097 gimple_call_cannot_inline_p (gimple s)
2098 {
2099   GIMPLE_CHECK (s, GIMPLE_CALL);
2100   return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2101 }
2102
2103
2104 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2105    slot optimization.  This transformation uses the target of the call
2106    expansion as the return slot for calls that return in memory.  */
2107
2108 static inline void
2109 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2110 {
2111   GIMPLE_CHECK (s, GIMPLE_CALL);
2112   if (return_slot_opt_p)
2113     s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2114   else
2115     s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2116 }
2117
2118
2119 /* Return true if S is marked for return slot optimization.  */
2120
2121 static inline bool
2122 gimple_call_return_slot_opt_p (gimple s)
2123 {
2124   GIMPLE_CHECK (s, GIMPLE_CALL);
2125   return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2126 }
2127
2128
2129 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2130    thunk to the thunked-to function.  */
2131
2132 static inline void
2133 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2134 {
2135   GIMPLE_CHECK (s, GIMPLE_CALL);
2136   if (from_thunk_p)
2137     s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2138   else
2139     s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2140 }
2141
2142
2143 /* Return true if GIMPLE_CALL S is a jump from a thunk.  */
2144
2145 static inline bool
2146 gimple_call_from_thunk_p (gimple s)
2147 {
2148   GIMPLE_CHECK (s, GIMPLE_CALL);
2149   return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2150 }
2151
2152
2153 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2154    argument pack in its argument list.  */
2155
2156 static inline void
2157 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2158 {
2159   GIMPLE_CHECK (s, GIMPLE_CALL);
2160   if (pass_arg_pack_p)
2161     s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2162   else
2163     s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2164 }
2165
2166
2167 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2168    argument pack in its argument list.  */
2169
2170 static inline bool
2171 gimple_call_va_arg_pack_p (gimple s)
2172 {
2173   GIMPLE_CHECK (s, GIMPLE_CALL);
2174   return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2175 }
2176
2177
2178 /* Return true if S is a noreturn call.  */
2179
2180 static inline bool
2181 gimple_call_noreturn_p (gimple s)
2182 {
2183   GIMPLE_CHECK (s, GIMPLE_CALL);
2184   return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2185 }
2186
2187
2188 /* Return true if S is a nothrow call.  */
2189
2190 static inline bool
2191 gimple_call_nothrow_p (gimple s)
2192 {
2193   GIMPLE_CHECK (s, GIMPLE_CALL);
2194   return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2195 }
2196
2197
2198 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL.  */
2199
2200 static inline void
2201 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2202 {
2203   GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2204   GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2205   dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2206 }
2207
2208
2209 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2210    non-NULL lhs.  */
2211
2212 static inline bool
2213 gimple_has_lhs (gimple stmt)
2214 {
2215   return (is_gimple_assign (stmt)
2216           || (is_gimple_call (stmt)
2217               && gimple_call_lhs (stmt) != NULL_TREE));
2218 }
2219
2220
2221 /* Return the code of the predicate computed by conditional statement GS.  */
2222
2223 static inline enum tree_code
2224 gimple_cond_code (const_gimple gs)
2225 {
2226   GIMPLE_CHECK (gs, GIMPLE_COND);
2227   return gs->gsbase.subcode;
2228 }
2229
2230
2231 /* Set CODE to be the predicate code for the conditional statement GS.  */
2232
2233 static inline void
2234 gimple_cond_set_code (gimple gs, enum tree_code code)
2235 {
2236   GIMPLE_CHECK (gs, GIMPLE_COND);
2237   gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison);
2238   gs->gsbase.subcode = code;
2239 }
2240
2241
2242 /* Return the LHS of the predicate computed by conditional statement GS.  */
2243
2244 static inline tree
2245 gimple_cond_lhs (const_gimple gs)
2246 {
2247   GIMPLE_CHECK (gs, GIMPLE_COND);
2248   return gimple_op (gs, 0);
2249 }
2250
2251 /* Return the pointer to the LHS of the predicate computed by conditional
2252    statement GS.  */
2253
2254 static inline tree *
2255 gimple_cond_lhs_ptr (const_gimple gs)
2256 {
2257   GIMPLE_CHECK (gs, GIMPLE_COND);
2258   return gimple_op_ptr (gs, 0);
2259 }
2260
2261 /* Set LHS to be the LHS operand of the predicate computed by
2262    conditional statement GS.  */
2263
2264 static inline void
2265 gimple_cond_set_lhs (gimple gs, tree lhs)
2266 {
2267   GIMPLE_CHECK (gs, GIMPLE_COND);
2268   gcc_assert (is_gimple_operand (lhs));
2269   gimple_set_op (gs, 0, lhs);
2270 }
2271
2272
2273 /* Return the RHS operand of the predicate computed by conditional GS.  */
2274
2275 static inline tree
2276 gimple_cond_rhs (const_gimple gs)
2277 {
2278   GIMPLE_CHECK (gs, GIMPLE_COND);
2279   return gimple_op (gs, 1);
2280 }
2281
2282 /* Return the pointer to the RHS operand of the predicate computed by
2283    conditional GS.  */
2284
2285 static inline tree *
2286 gimple_cond_rhs_ptr (const_gimple gs)
2287 {
2288   GIMPLE_CHECK (gs, GIMPLE_COND);
2289   return gimple_op_ptr (gs, 1);
2290 }
2291
2292
2293 /* Set RHS to be the RHS operand of the predicate computed by
2294    conditional statement GS.  */
2295
2296 static inline void
2297 gimple_cond_set_rhs (gimple gs, tree rhs)
2298 {
2299   GIMPLE_CHECK (gs, GIMPLE_COND);
2300   gcc_assert (is_gimple_operand (rhs));
2301   gimple_set_op (gs, 1, rhs);
2302 }
2303
2304
2305 /* Return the label used by conditional statement GS when its
2306    predicate evaluates to true.  */
2307
2308 static inline tree
2309 gimple_cond_true_label (const_gimple gs)
2310 {
2311   GIMPLE_CHECK (gs, GIMPLE_COND);
2312   return gimple_op (gs, 2);
2313 }
2314
2315
2316 /* Set LABEL to be the label used by conditional statement GS when its
2317    predicate evaluates to true.  */
2318
2319 static inline void
2320 gimple_cond_set_true_label (gimple gs, tree label)
2321 {
2322   GIMPLE_CHECK (gs, GIMPLE_COND);
2323   gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2324   gimple_set_op (gs, 2, label);
2325 }
2326
2327
2328 /* Set LABEL to be the label used by conditional statement GS when its
2329    predicate evaluates to false.  */
2330
2331 static inline void
2332 gimple_cond_set_false_label (gimple gs, tree label)
2333 {
2334   GIMPLE_CHECK (gs, GIMPLE_COND);
2335   gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2336   gimple_set_op (gs, 3, label);
2337 }
2338
2339
2340 /* Return the label used by conditional statement GS when its
2341    predicate evaluates to false.  */
2342
2343 static inline tree
2344 gimple_cond_false_label (const_gimple gs)
2345 {
2346   GIMPLE_CHECK (gs, GIMPLE_COND);
2347   return gimple_op (gs, 3);
2348 }
2349
2350
2351 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'.  */
2352
2353 static inline void
2354 gimple_cond_make_false (gimple gs)
2355 {
2356   gimple_cond_set_lhs (gs, boolean_true_node);
2357   gimple_cond_set_rhs (gs, boolean_false_node);
2358   gs->gsbase.subcode = EQ_EXPR;
2359 }
2360
2361
2362 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'.  */
2363
2364 static inline void
2365 gimple_cond_make_true (gimple gs)
2366 {
2367   gimple_cond_set_lhs (gs, boolean_true_node);
2368   gimple_cond_set_rhs (gs, boolean_true_node);
2369   gs->gsbase.subcode = EQ_EXPR;
2370 }
2371
2372 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2373   'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2374
2375 static inline bool
2376 gimple_cond_true_p (const_gimple gs)
2377 {
2378   tree lhs = gimple_cond_lhs (gs);
2379   tree rhs = gimple_cond_rhs (gs);
2380   enum tree_code code = gimple_cond_code (gs);
2381
2382   if (lhs != boolean_true_node && lhs != boolean_false_node)
2383     return false;
2384
2385   if (rhs != boolean_true_node && rhs != boolean_false_node)
2386     return false;
2387
2388   if (code == NE_EXPR && lhs != rhs)
2389     return true;
2390
2391   if (code == EQ_EXPR && lhs == rhs)
2392       return true;
2393
2394   return false;
2395 }
2396
2397 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2398    'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2399
2400 static inline bool
2401 gimple_cond_false_p (const_gimple gs)
2402 {
2403   tree lhs = gimple_cond_lhs (gs);
2404   tree rhs = gimple_cond_rhs (gs);
2405   enum tree_code code = gimple_cond_code (gs);
2406
2407   if (lhs != boolean_true_node && lhs != boolean_false_node)
2408     return false;
2409
2410   if (rhs != boolean_true_node && rhs != boolean_false_node)
2411     return false;
2412
2413   if (code == NE_EXPR && lhs == rhs)
2414     return true;
2415
2416   if (code == EQ_EXPR && lhs != rhs)
2417       return true;
2418
2419   return false;
2420 }
2421
2422 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2423    'if (var == 1)' */
2424
2425 static inline bool
2426 gimple_cond_single_var_p (gimple gs)
2427 {
2428   if (gimple_cond_code (gs) == NE_EXPR
2429       && gimple_cond_rhs (gs) == boolean_false_node)
2430     return true;
2431
2432   if (gimple_cond_code (gs) == EQ_EXPR
2433       && gimple_cond_rhs (gs) == boolean_true_node)
2434     return true;
2435
2436   return false;
2437 }
2438
2439 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS.  */
2440
2441 static inline void
2442 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2443 {
2444   gimple_cond_set_code (stmt, code);
2445   gimple_cond_set_lhs (stmt, lhs);
2446   gimple_cond_set_rhs (stmt, rhs);
2447 }
2448
2449 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS.  */
2450
2451 static inline tree
2452 gimple_label_label (const_gimple gs)
2453 {
2454   GIMPLE_CHECK (gs, GIMPLE_LABEL);
2455   return gimple_op (gs, 0);
2456 }
2457
2458
2459 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2460    GS.  */
2461
2462 static inline void
2463 gimple_label_set_label (gimple gs, tree label)
2464 {
2465   GIMPLE_CHECK (gs, GIMPLE_LABEL);
2466   gcc_assert (TREE_CODE (label) == LABEL_DECL);
2467   gimple_set_op (gs, 0, label);
2468 }
2469
2470
2471 /* Return the destination of the unconditional jump GS.  */
2472
2473 static inline tree
2474 gimple_goto_dest (const_gimple gs)
2475 {
2476   GIMPLE_CHECK (gs, GIMPLE_GOTO);
2477   return gimple_op (gs, 0);
2478 }
2479
2480
2481 /* Set DEST to be the destination of the unconditonal jump GS.  */
2482
2483 static inline void 
2484 gimple_goto_set_dest (gimple gs, tree dest)
2485 {
2486   GIMPLE_CHECK (gs, GIMPLE_GOTO);
2487   gcc_assert (is_gimple_operand (dest));
2488   gimple_set_op (gs, 0, dest);
2489 }
2490
2491
2492 /* Return the variables declared in the GIMPLE_BIND statement GS.  */
2493
2494 static inline tree
2495 gimple_bind_vars (const_gimple gs)
2496 {
2497   GIMPLE_CHECK (gs, GIMPLE_BIND);
2498   return gs->gimple_bind.vars;
2499 }
2500
2501
2502 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2503    statement GS.  */
2504
2505 static inline void
2506 gimple_bind_set_vars (gimple gs, tree vars)
2507 {
2508   GIMPLE_CHECK (gs, GIMPLE_BIND);
2509   gs->gimple_bind.vars = vars;
2510 }
2511
2512
2513 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2514    statement GS.  */
2515
2516 static inline void
2517 gimple_bind_append_vars (gimple gs, tree vars)
2518 {
2519   GIMPLE_CHECK (gs, GIMPLE_BIND);
2520   gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2521 }
2522
2523
2524 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS.  */
2525
2526 static inline gimple_seq
2527 gimple_bind_body (gimple gs)
2528 {
2529   GIMPLE_CHECK (gs, GIMPLE_BIND);
2530   return gs->gimple_bind.body;
2531 }
2532
2533
2534 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2535    statement GS.  */
2536
2537 static inline void
2538 gimple_bind_set_body (gimple gs, gimple_seq seq)
2539 {
2540   GIMPLE_CHECK (gs, GIMPLE_BIND);
2541   gs->gimple_bind.body = seq;
2542 }
2543
2544
2545 /* Append a statement to the end of a GIMPLE_BIND's body.  */
2546
2547 static inline void
2548 gimple_bind_add_stmt (gimple gs, gimple stmt)
2549 {
2550   GIMPLE_CHECK (gs, GIMPLE_BIND);
2551   gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2552 }
2553
2554
2555 /* Append a sequence of statements to the end of a GIMPLE_BIND's body.  */
2556
2557 static inline void
2558 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2559 {
2560   GIMPLE_CHECK (gs, GIMPLE_BIND);
2561   gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2562 }
2563
2564
2565 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2566    GS.  This is analogous to the BIND_EXPR_BLOCK field in trees.  */
2567
2568 static inline tree
2569 gimple_bind_block (const_gimple gs)
2570 {
2571   GIMPLE_CHECK (gs, GIMPLE_BIND);
2572   return gs->gimple_bind.block;
2573 }
2574
2575
2576 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2577    statement GS.  */
2578
2579 static inline void
2580 gimple_bind_set_block (gimple gs, tree block)
2581 {
2582   GIMPLE_CHECK (gs, GIMPLE_BIND);
2583   gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
2584   gs->gimple_bind.block = block;
2585 }
2586
2587
2588 /* Return the number of input operands for GIMPLE_ASM GS.  */
2589
2590 static inline unsigned
2591 gimple_asm_ninputs (const_gimple gs)
2592 {
2593   GIMPLE_CHECK (gs, GIMPLE_ASM);
2594   return gs->gimple_asm.ni;
2595 }
2596
2597
2598 /* Return the number of output operands for GIMPLE_ASM GS.  */
2599
2600 static inline unsigned
2601 gimple_asm_noutputs (const_gimple gs)
2602 {
2603   GIMPLE_CHECK (gs, GIMPLE_ASM);
2604   return gs->gimple_asm.no;
2605 }
2606
2607
2608 /* Return the number of clobber operands for GIMPLE_ASM GS.  */
2609
2610 static inline unsigned
2611 gimple_asm_nclobbers (const_gimple gs)
2612 {
2613   GIMPLE_CHECK (gs, GIMPLE_ASM);
2614   return gs->gimple_asm.nc;
2615 }
2616
2617
2618 /* Return input operand INDEX of GIMPLE_ASM GS.  */
2619
2620 static inline tree
2621 gimple_asm_input_op (const_gimple gs, unsigned index)
2622 {
2623   GIMPLE_CHECK (gs, GIMPLE_ASM);
2624   gcc_assert (index <= gs->gimple_asm.ni);
2625   return gimple_op (gs, index);
2626 }
2627
2628 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS.  */
2629
2630 static inline tree *
2631 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2632 {
2633   GIMPLE_CHECK (gs, GIMPLE_ASM);
2634   gcc_assert (index <= gs->gimple_asm.ni);
2635   return gimple_op_ptr (gs, index);
2636 }
2637
2638
2639 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS.  */
2640
2641 static inline void
2642 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2643 {
2644   GIMPLE_CHECK (gs, GIMPLE_ASM);
2645   gcc_assert (index <= gs->gimple_asm.ni);
2646   gcc_assert (TREE_CODE (in_op) == TREE_LIST);
2647   gimple_set_op (gs, index, in_op);
2648 }
2649
2650
2651 /* Return output operand INDEX of GIMPLE_ASM GS.  */
2652
2653 static inline tree
2654 gimple_asm_output_op (const_gimple gs, unsigned index)
2655 {
2656   GIMPLE_CHECK (gs, GIMPLE_ASM);
2657   gcc_assert (index <= gs->gimple_asm.no);
2658   return gimple_op (gs, index + gs->gimple_asm.ni);
2659 }
2660
2661 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS.  */
2662
2663 static inline tree *
2664 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2665 {
2666   GIMPLE_CHECK (gs, GIMPLE_ASM);
2667   gcc_assert (index <= gs->gimple_asm.no);
2668   return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2669 }
2670
2671
2672 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS.  */
2673
2674 static inline void
2675 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2676 {
2677   GIMPLE_CHECK (gs, GIMPLE_ASM);
2678   gcc_assert (index <= gs->gimple_asm.no);
2679   gcc_assert (TREE_CODE (out_op) == TREE_LIST);
2680   gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2681 }
2682
2683
2684 /* Return clobber operand INDEX of GIMPLE_ASM GS.  */
2685
2686 static inline tree
2687 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2688 {
2689   GIMPLE_CHECK (gs, GIMPLE_ASM);
2690   gcc_assert (index <= gs->gimple_asm.nc);
2691   return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2692 }
2693
2694
2695 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS.  */
2696
2697 static inline void
2698 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2699 {
2700   GIMPLE_CHECK (gs, GIMPLE_ASM);
2701   gcc_assert (index <= gs->gimple_asm.nc);
2702   gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
2703   gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2704 }
2705
2706
2707 /* Return the string representing the assembly instruction in
2708    GIMPLE_ASM GS.  */
2709
2710 static inline const char *
2711 gimple_asm_string (const_gimple gs)
2712 {
2713   GIMPLE_CHECK (gs, GIMPLE_ASM);
2714   return gs->gimple_asm.string;
2715 }
2716
2717
2718 /* Return true if GS is an asm statement marked volatile.  */
2719
2720 static inline bool
2721 gimple_asm_volatile_p (const_gimple gs)
2722 {
2723   GIMPLE_CHECK (gs, GIMPLE_ASM);
2724   return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2725 }
2726
2727
2728 /* If VOLATLE_P is true, mark asm statement GS as volatile.  */
2729
2730 static inline void
2731 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2732 {
2733   GIMPLE_CHECK (gs, GIMPLE_ASM);
2734   if (volatile_p)
2735     gs->gsbase.subcode |= GF_ASM_VOLATILE;
2736   else
2737     gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2738 }
2739
2740
2741 /* If INPUT_P is true, mark asm GS as an ASM_INPUT.  */
2742
2743 static inline void
2744 gimple_asm_set_input (gimple gs, bool input_p)
2745 {
2746   GIMPLE_CHECK (gs, GIMPLE_ASM);
2747   if (input_p)
2748     gs->gsbase.subcode |= GF_ASM_INPUT;
2749   else
2750     gs->gsbase.subcode &= ~GF_ASM_INPUT;
2751 }
2752
2753
2754 /* Return true if asm GS is an ASM_INPUT.  */
2755
2756 static inline bool
2757 gimple_asm_input_p (const_gimple gs)
2758 {
2759   GIMPLE_CHECK (gs, GIMPLE_ASM);
2760   return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2761 }
2762
2763
2764 /* Return the types handled by GIMPLE_CATCH statement GS.  */
2765
2766 static inline tree
2767 gimple_catch_types (const_gimple gs)
2768 {
2769   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2770   return gs->gimple_catch.types;
2771 }
2772
2773
2774 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS.  */
2775
2776 static inline tree *
2777 gimple_catch_types_ptr (gimple gs)
2778 {
2779   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2780   return &gs->gimple_catch.types;
2781 }
2782
2783
2784 /* Return the GIMPLE sequence representing the body of the handler of
2785    GIMPLE_CATCH statement GS.  */
2786
2787 static inline gimple_seq
2788 gimple_catch_handler (gimple gs)
2789 {
2790   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2791   return gs->gimple_catch.handler;
2792 }
2793
2794
2795 /* Return a pointer to the GIMPLE sequence representing the body of
2796    the handler of GIMPLE_CATCH statement GS.  */
2797
2798 static inline gimple_seq *
2799 gimple_catch_handler_ptr (gimple gs)
2800 {
2801   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2802   return &gs->gimple_catch.handler;
2803 }
2804
2805
2806 /* Set T to be the set of types handled by GIMPLE_CATCH GS.  */
2807
2808 static inline void
2809 gimple_catch_set_types (gimple gs, tree t)
2810 {
2811   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2812   gs->gimple_catch.types = t;
2813 }
2814
2815
2816 /* Set HANDLER to be the body of GIMPLE_CATCH GS.  */
2817
2818 static inline void
2819 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2820 {
2821   GIMPLE_CHECK (gs, GIMPLE_CATCH);
2822   gs->gimple_catch.handler = handler;
2823 }
2824
2825
2826 /* Return the types handled by GIMPLE_EH_FILTER statement GS.  */
2827
2828 static inline tree
2829 gimple_eh_filter_types (const_gimple gs)
2830 {
2831   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2832   return gs->gimple_eh_filter.types;
2833 }
2834
2835
2836 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2837    GS.  */
2838
2839 static inline tree *
2840 gimple_eh_filter_types_ptr (gimple gs)
2841 {
2842   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2843   return &gs->gimple_eh_filter.types;
2844 }
2845
2846
2847 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2848    statement fails.  */
2849
2850 static inline gimple_seq
2851 gimple_eh_filter_failure (gimple gs)
2852 {
2853   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2854   return gs->gimple_eh_filter.failure;
2855 }
2856
2857
2858 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS.  */
2859
2860 static inline void
2861 gimple_eh_filter_set_types (gimple gs, tree types)
2862 {
2863   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2864   gs->gimple_eh_filter.types = types;
2865 }
2866
2867
2868 /* Set FAILURE to be the sequence of statements to execute on failure
2869    for GIMPLE_EH_FILTER GS.  */
2870
2871 static inline void
2872 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2873 {
2874   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2875   gs->gimple_eh_filter.failure = failure;
2876 }
2877
2878 /* Return the EH_FILTER_MUST_NOT_THROW flag.  */
2879
2880 static inline bool
2881
2882 gimple_eh_filter_must_not_throw (gimple gs)
2883 {
2884   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2885   return gs->gsbase.subcode != 0;
2886 }
2887
2888 /* Set the EH_FILTER_MUST_NOT_THROW flag to the value MNTP.  */
2889
2890 static inline void
2891 gimple_eh_filter_set_must_not_throw (gimple gs, bool mntp)
2892 {
2893   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2894   gs->gsbase.subcode = (unsigned int) mntp;
2895 }
2896
2897
2898 /* GIMPLE_TRY accessors. */
2899
2900 /* Return the kind of try block represented by GIMPLE_TRY GS.  This is
2901    either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY.  */
2902
2903 static inline enum gimple_try_flags
2904 gimple_try_kind (const_gimple gs)
2905 {
2906   GIMPLE_CHECK (gs, GIMPLE_TRY);
2907   return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2908 }
2909
2910
2911 /* Set the kind of try block represented by GIMPLE_TRY GS.  */
2912
2913 static inline void
2914 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2915 {
2916   GIMPLE_CHECK (gs, GIMPLE_TRY);
2917   gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
2918   if (gimple_try_kind (gs) != kind)
2919     gs->gsbase.subcode = (unsigned int) kind;
2920 }
2921
2922
2923 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag.  */
2924
2925 static inline bool
2926 gimple_try_catch_is_cleanup (const_gimple gs)
2927 {
2928   gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
2929   return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
2930 }
2931
2932
2933 /* Return the sequence of statements used as the body for GIMPLE_TRY GS.  */
2934
2935 static inline gimple_seq
2936 gimple_try_eval (gimple gs)
2937 {
2938   GIMPLE_CHECK (gs, GIMPLE_TRY);
2939   return gs->gimple_try.eval;
2940 }
2941
2942
2943 /* Return the sequence of statements used as the cleanup body for
2944    GIMPLE_TRY GS.  */
2945
2946 static inline gimple_seq
2947 gimple_try_cleanup (gimple gs)
2948 {
2949   GIMPLE_CHECK (gs, GIMPLE_TRY);
2950   return gs->gimple_try.cleanup;
2951 }
2952
2953
2954 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag.  */
2955
2956 static inline void
2957 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
2958 {
2959   gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
2960   if (catch_is_cleanup)
2961     g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
2962   else
2963     g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
2964 }
2965
2966
2967 /* Set EVAL to be the sequence of statements to use as the body for
2968    GIMPLE_TRY GS.  */
2969
2970 static inline void
2971 gimple_try_set_eval (gimple gs, gimple_seq eval)
2972 {
2973   GIMPLE_CHECK (gs, GIMPLE_TRY);
2974   gs->gimple_try.eval = eval;
2975 }
2976
2977
2978 /* Set CLEANUP to be the sequence of statements to use as the cleanup
2979    body for GIMPLE_TRY GS.  */
2980
2981 static inline void
2982 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
2983 {
2984   GIMPLE_CHECK (gs, GIMPLE_TRY);
2985   gs->gimple_try.cleanup = cleanup;
2986 }
2987
2988
2989 /* Return the cleanup sequence for cleanup statement GS.  */
2990
2991 static inline gimple_seq
2992 gimple_wce_cleanup (gimple gs)
2993 {
2994   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
2995   return gs->gimple_wce.cleanup;
2996 }
2997
2998
2999 /* Set CLEANUP to be the cleanup sequence for GS.  */
3000
3001 static inline void
3002 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3003 {
3004   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3005   gs->gimple_wce.cleanup = cleanup;
3006 }
3007
3008
3009 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple.  */
3010
3011 static inline bool
3012 gimple_wce_cleanup_eh_only (const_gimple gs)
3013 {
3014   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3015   return gs->gsbase.subcode != 0;
3016 }
3017
3018
3019 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple.  */
3020
3021 static inline void
3022 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3023 {
3024   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3025   gs->gsbase.subcode = (unsigned int) eh_only_p;
3026 }
3027
3028
3029 /* Return the maximum number of arguments supported by GIMPLE_PHI GS.  */
3030
3031 static inline unsigned
3032 gimple_phi_capacity (const_gimple gs)
3033 {
3034   GIMPLE_CHECK (gs, GIMPLE_PHI);
3035   return gs->gimple_phi.capacity;
3036 }
3037
3038
3039 /* Return the number of arguments in GIMPLE_PHI GS.  This must always
3040    be exactly the number of incoming edges for the basic block holding
3041    GS.  */
3042
3043 static inline unsigned
3044 gimple_phi_num_args (const_gimple gs)
3045 {
3046   GIMPLE_CHECK (gs, GIMPLE_PHI);
3047   return gs->gimple_phi.nargs;
3048 }
3049
3050
3051 /* Return the SSA name created by GIMPLE_PHI GS.  */
3052
3053 static inline tree
3054 gimple_phi_result (const_gimple gs)
3055 {
3056   GIMPLE_CHECK (gs, GIMPLE_PHI);
3057   return gs->gimple_phi.result;
3058 }
3059
3060 /* Return a pointer to the SSA name created by GIMPLE_PHI GS.  */
3061
3062 static inline tree *
3063 gimple_phi_result_ptr (gimple gs)
3064 {
3065   GIMPLE_CHECK (gs, GIMPLE_PHI);
3066   return &gs->gimple_phi.result;
3067 }
3068
3069 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS.  */
3070
3071 static inline void
3072 gimple_phi_set_result (gimple gs, tree result)
3073 {
3074   GIMPLE_CHECK (gs, GIMPLE_PHI);
3075   gs->gimple_phi.result = result;
3076 }
3077
3078
3079 /* Return the PHI argument corresponding to incoming edge INDEX for
3080    GIMPLE_PHI GS.  */
3081
3082 static inline struct phi_arg_d *
3083 gimple_phi_arg (gimple gs, unsigned index)
3084 {
3085   GIMPLE_CHECK (gs, GIMPLE_PHI);
3086   gcc_assert (index <= gs->gimple_phi.capacity);
3087   return &(gs->gimple_phi.args[index]);
3088 }
3089
3090 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3091    for GIMPLE_PHI GS.  */
3092
3093 static inline void
3094 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3095 {
3096   GIMPLE_CHECK (gs, GIMPLE_PHI);
3097   gcc_assert (index <= gs->gimple_phi.nargs);
3098   memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
3099 }
3100
3101 /* Return the region number for GIMPLE_RESX GS.  */
3102
3103 static inline int
3104 gimple_resx_region (const_gimple gs)
3105 {
3106   GIMPLE_CHECK (gs, GIMPLE_RESX);
3107   return gs->gimple_resx.region;
3108 }
3109
3110 /* Set REGION to be the region number for GIMPLE_RESX GS.  */
3111
3112 static inline void
3113 gimple_resx_set_region (gimple gs, int region)
3114 {
3115   GIMPLE_CHECK (gs, GIMPLE_RESX);
3116   gs->gimple_resx.region = region;
3117 }
3118
3119
3120 /* Return the number of labels associated with the switch statement GS.  */
3121
3122 static inline unsigned
3123 gimple_switch_num_labels (const_gimple gs)
3124 {
3125   unsigned num_ops;
3126   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3127   num_ops = gimple_num_ops (gs);
3128   gcc_assert (num_ops > 1);
3129   return num_ops - 1;
3130 }
3131
3132
3133 /* Set NLABELS to be the number of labels for the switch statement GS.  */
3134
3135 static inline void
3136 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3137 {
3138   GIMPLE_CHECK (g, GIMPLE_SWITCH);
3139   gimple_set_num_ops (g, nlabels + 1);
3140 }
3141
3142
3143 /* Return the index variable used by the switch statement GS.  */
3144
3145 static inline tree
3146 gimple_switch_index (const_gimple gs)
3147 {
3148   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3149   return gimple_op (gs, 0);
3150 }
3151
3152
3153 /* Return a pointer to the index variable for the switch statement GS.  */
3154
3155 static inline tree *
3156 gimple_switch_index_ptr (const_gimple gs)
3157 {
3158   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3159   return gimple_op_ptr (gs, 0);
3160 }
3161
3162
3163 /* Set INDEX to be the index variable for switch statement GS.  */
3164
3165 static inline void
3166 gimple_switch_set_index (gimple gs, tree index)
3167 {
3168   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3169   gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3170   gimple_set_op (gs, 0, index);
3171 }
3172
3173
3174 /* Return the label numbered INDEX.  The default label is 0, followed by any
3175    labels in a switch statement.  */
3176
3177 static inline tree
3178 gimple_switch_label (const_gimple gs, unsigned index)
3179 {
3180   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3181   gcc_assert (gimple_num_ops (gs) > index + 1);
3182   return gimple_op (gs, index + 1);
3183 }
3184
3185 /* Set the label number INDEX to LABEL.  0 is always the default label.  */
3186
3187 static inline void
3188 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3189 {
3190   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3191   gcc_assert (gimple_num_ops (gs) > index + 1);
3192   gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
3193   gimple_set_op (gs, index + 1, label);
3194 }
3195
3196 /* Return the default label for a switch statement.  */
3197
3198 static inline tree
3199 gimple_switch_default_label (const_gimple gs)
3200 {
3201   return gimple_switch_label (gs, 0);
3202 }
3203
3204 /* Set the default label for a switch statement.  */
3205
3206 static inline void
3207 gimple_switch_set_default_label (gimple gs, tree label)
3208 {
3209   gimple_switch_set_label (gs, 0, label);
3210 }
3211
3212
3213 /* Return the body for the OMP statement GS.  */
3214
3215 static inline gimple_seq 
3216 gimple_omp_body (gimple gs)
3217 {
3218   return gs->omp.body;
3219 }
3220
3221 /* Set BODY to be the body for the OMP statement GS.  */
3222
3223 static inline void
3224 gimple_omp_set_body (gimple gs, gimple_seq body)
3225 {
3226   gs->omp.body = body;
3227 }
3228
3229
3230 /* Return the name associated with OMP_CRITICAL statement GS.  */
3231
3232 static inline tree
3233 gimple_omp_critical_name (const_gimple gs)
3234 {
3235   GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3236   return gs->gimple_omp_critical.name;
3237 }
3238
3239
3240 /* Return a pointer to the name associated with OMP critical statement GS.  */
3241
3242 static inline tree *
3243 gimple_omp_critical_name_ptr (gimple gs)
3244 {
3245   GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3246   return &gs->gimple_omp_critical.name;
3247 }
3248
3249
3250 /* Set NAME to be the name associated with OMP critical statement GS.  */
3251
3252 static inline void
3253 gimple_omp_critical_set_name (gimple gs, tree name)
3254 {
3255   GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3256   gs->gimple_omp_critical.name = name;
3257 }
3258
3259
3260 /* Return the clauses associated with OMP_FOR GS.  */
3261
3262 static inline tree
3263 gimple_omp_for_clauses (const_gimple gs)
3264 {
3265   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3266   return gs->gimple_omp_for.clauses;
3267 }
3268
3269
3270 /* Return a pointer to the OMP_FOR GS.  */
3271
3272 static inline tree *
3273 gimple_omp_for_clauses_ptr (gimple gs)
3274 {
3275   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3276   return &gs->gimple_omp_for.clauses;
3277 }
3278
3279
3280 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS.  */
3281
3282 static inline void
3283 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3284 {
3285   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3286   gs->gimple_omp_for.clauses = clauses;
3287 }
3288
3289
3290 /* Get the collapse count of OMP_FOR GS.  */
3291
3292 static inline size_t
3293 gimple_omp_for_collapse (gimple gs)
3294 {
3295   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3296   return gs->gimple_omp_for.collapse;
3297 }
3298
3299
3300 /* Return the index variable for OMP_FOR GS.  */
3301
3302 static inline tree
3303 gimple_omp_for_index (const_gimple gs, size_t i)
3304 {
3305   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3306   gcc_assert (i < gs->gimple_omp_for.collapse);
3307   return gs->gimple_omp_for.iter[i].index;
3308 }
3309
3310
3311 /* Return a pointer to the index variable for OMP_FOR GS.  */
3312
3313 static inline tree *
3314 gimple_omp_for_index_ptr (gimple gs, size_t i)
3315 {
3316   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3317   gcc_assert (i < gs->gimple_omp_for.collapse);
3318   return &gs->gimple_omp_for.iter[i].index;
3319 }
3320
3321
3322 /* Set INDEX to be the index variable for OMP_FOR GS.  */
3323
3324 static inline void
3325 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3326 {
3327   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3328   gcc_assert (i < gs->gimple_omp_for.collapse);
3329   gs->gimple_omp_for.iter[i].index = index;
3330 }
3331
3332
3333 /* Return the initial value for OMP_FOR GS.  */
3334
3335 static inline tree
3336 gimple_omp_for_initial (const_gimple gs, size_t i)
3337 {
3338   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3339   gcc_assert (i < gs->gimple_omp_for.collapse);
3340   return gs->gimple_omp_for.iter[i].initial;
3341 }
3342
3343
3344 /* Return a pointer to the initial value for OMP_FOR GS.  */
3345
3346 static inline tree *
3347 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3348 {
3349   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3350   gcc_assert (i < gs->gimple_omp_for.collapse);
3351   return &gs->gimple_omp_for.iter[i].initial;
3352 }
3353
3354
3355 /* Set INITIAL to be the initial value for OMP_FOR GS.  */
3356
3357 static inline void
3358 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3359 {
3360   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3361   gcc_assert (i < gs->gimple_omp_for.collapse);
3362   gs->gimple_omp_for.iter[i].initial = initial;
3363 }
3364
3365
3366 /* Return the final value for OMP_FOR GS.  */
3367
3368 static inline tree
3369 gimple_omp_for_final (const_gimple gs, size_t i)
3370 {
3371   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3372   gcc_assert (i < gs->gimple_omp_for.collapse);
3373   return gs->gimple_omp_for.iter[i].final;
3374 }
3375
3376
3377 /* Return a pointer to the final value for OMP_FOR GS.  */
3378
3379 static inline tree *
3380 gimple_omp_for_final_ptr (gimple gs, size_t i)
3381 {
3382   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3383   gcc_assert (i < gs->gimple_omp_for.collapse);
3384   return &gs->gimple_omp_for.iter[i].final;
3385 }
3386
3387
3388 /* Set FINAL to be the final value for OMP_FOR GS.  */
3389
3390 static inline void
3391 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3392 {
3393   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3394   gcc_assert (i < gs->gimple_omp_for.collapse);
3395   gs->gimple_omp_for.iter[i].final = final;
3396 }
3397
3398
3399 /* Return the increment value for OMP_FOR GS.  */
3400
3401 static inline tree
3402 gimple_omp_for_incr (const_gimple gs, size_t i)
3403 {
3404   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3405   gcc_assert (i < gs->gimple_omp_for.collapse);
3406   return gs->gimple_omp_for.iter[i].incr;
3407 }
3408
3409
3410 /* Return a pointer to the increment value for OMP_FOR GS.  */
3411
3412 static inline tree *
3413 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3414 {
3415   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3416   gcc_assert (i < gs->gimple_omp_for.collapse);
3417   return &gs->gimple_omp_for.iter[i].incr;
3418 }
3419
3420
3421 /* Set INCR to be the increment value for OMP_FOR GS.  */
3422
3423 static inline void
3424 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3425 {
3426   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3427   gcc_assert (i < gs->gimple_omp_for.collapse);
3428   gs->gimple_omp_for.iter[i].incr = incr;
3429 }
3430
3431
3432 /* Return the sequence of statements to execute before the OMP_FOR
3433    statement GS starts.  */
3434
3435 static inline gimple_seq
3436 gimple_omp_for_pre_body (gimple gs)
3437 {
3438   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3439   return gs->gimple_omp_for.pre_body;
3440 }
3441
3442
3443 /* Set PRE_BODY to be the sequence of statements to execute before the
3444    OMP_FOR statement GS starts.  */
3445
3446 static inline void
3447 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3448 {
3449   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3450   gs->gimple_omp_for.pre_body = pre_body;
3451 }
3452
3453
3454 /* Return the clauses associated with OMP_PARALLEL GS.  */
3455
3456 static inline tree
3457 gimple_omp_parallel_clauses (const_gimple gs)
3458 {
3459   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3460   return gs->gimple_omp_parallel.clauses;
3461 }
3462
3463
3464 /* Return a pointer to the clauses associated with OMP_PARALLEL GS.  */
3465
3466 static inline tree *
3467 gimple_omp_parallel_clauses_ptr (gimple gs)
3468 {
3469   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3470   return &gs->gimple_omp_parallel.clauses;
3471 }
3472
3473
3474 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3475    GS.  */
3476
3477 static inline void
3478 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3479 {
3480   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3481   gs->gimple_omp_parallel.clauses = clauses;
3482 }
3483
3484
3485 /* Return the child function used to hold the body of OMP_PARALLEL GS.  */
3486
3487 static inline tree
3488 gimple_omp_parallel_child_fn (const_gimple gs)
3489 {
3490   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3491   return gs->gimple_omp_parallel.child_fn;
3492 }
3493
3494 /* Return a pointer to the child function used to hold the body of
3495    OMP_PARALLEL GS.  */
3496
3497 static inline tree *
3498 gimple_omp_parallel_child_fn_ptr (gimple gs)
3499 {
3500   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3501   return &gs->gimple_omp_parallel.child_fn;
3502 }
3503
3504
3505 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS.  */
3506
3507 static inline void
3508 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3509 {
3510   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3511   gs->gimple_omp_parallel.child_fn = child_fn;
3512 }
3513
3514
3515 /* Return the artificial argument used to send variables and values
3516    from the parent to the children threads in OMP_PARALLEL GS.  */
3517
3518 static inline tree
3519 gimple_omp_parallel_data_arg (const_gimple gs)
3520 {
3521   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3522   return gs->gimple_omp_parallel.data_arg;
3523 }
3524
3525
3526 /* Return a pointer to the data argument for OMP_PARALLEL GS.  */
3527
3528 static inline tree *
3529 gimple_omp_parallel_data_arg_ptr (gimple gs)
3530 {
3531   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3532   return &gs->gimple_omp_parallel.data_arg;
3533 }
3534
3535
3536 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS.  */
3537
3538 static inline void
3539 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3540 {
3541   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3542   gs->gimple_omp_parallel.data_arg = data_arg;
3543 }
3544
3545
3546 /* Return the clauses associated with OMP_TASK GS.  */
3547
3548 static inline tree
3549 gimple_omp_task_clauses (const_gimple gs)
3550 {
3551   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3552   return gs->gimple_omp_parallel.clauses;
3553 }
3554
3555
3556 /* Return a pointer to the clauses associated with OMP_TASK GS.  */
3557
3558 static inline tree *
3559 gimple_omp_task_clauses_ptr (gimple gs)
3560 {
3561   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3562   return &gs->gimple_omp_parallel.clauses;
3563 }
3564
3565
3566 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3567    GS.  */
3568
3569 static inline void
3570 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3571 {
3572   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3573   gs->gimple_omp_parallel.clauses = clauses;
3574 }
3575
3576
3577 /* Return the child function used to hold the body of OMP_TASK GS.  */
3578
3579 static inline tree
3580 gimple_omp_task_child_fn (const_gimple gs)
3581 {
3582   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3583   return gs->gimple_omp_parallel.child_fn;
3584 }
3585
3586 /* Return a pointer to the child function used to hold the body of
3587    OMP_TASK GS.  */
3588
3589 static inline tree *
3590 gimple_omp_task_child_fn_ptr (gimple gs)
3591 {
3592   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3593   return &gs->gimple_omp_parallel.child_fn;
3594 }
3595
3596
3597 /* Set CHILD_FN to be the child function for OMP_TASK GS.  */
3598
3599 static inline void
3600 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3601 {
3602   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3603   gs->gimple_omp_parallel.child_fn = child_fn;
3604 }
3605
3606
3607 /* Return the artificial argument used to send variables and values
3608    from the parent to the children threads in OMP_TASK GS.  */
3609
3610 static inline tree
3611 gimple_omp_task_data_arg (const_gimple gs)
3612 {
3613   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3614   return gs->gimple_omp_parallel.data_arg;
3615 }
3616
3617
3618 /* Return a pointer to the data argument for OMP_TASK GS.  */
3619
3620 static inline tree *
3621 gimple_omp_task_data_arg_ptr (gimple gs)
3622 {
3623   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3624   return &gs->gimple_omp_parallel.data_arg;
3625 }
3626
3627
3628 /* Set DATA_ARG to be the data argument for OMP_TASK GS.  */
3629
3630 static inline void
3631 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3632 {
3633   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3634   gs->gimple_omp_parallel.data_arg = data_arg;
3635 }
3636
3637
3638 /* Return the clauses associated with OMP_TASK GS.  */
3639
3640 static inline tree
3641 gimple_omp_taskreg_clauses (const_gimple gs)
3642 {
3643   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3644     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3645   return gs->gimple_omp_parallel.clauses;
3646 }
3647
3648
3649 /* Return a pointer to the clauses associated with OMP_TASK GS.  */
3650
3651 static inline tree *
3652 gimple_omp_taskreg_clauses_ptr (gimple gs)
3653 {
3654   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3655     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3656   return &gs->gimple_omp_parallel.clauses;
3657 }
3658
3659
3660 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3661    GS.  */
3662
3663 static inline void
3664 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3665 {
3666   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3667     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3668   gs->gimple_omp_parallel.clauses = clauses;
3669 }
3670
3671
3672 /* Return the child function used to hold the body of OMP_TASK GS.  */
3673
3674 static inline tree
3675 gimple_omp_taskreg_child_fn (const_gimple gs)
3676 {
3677   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3678     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3679   return gs->gimple_omp_parallel.child_fn;
3680 }
3681
3682 /* Return a pointer to the child function used to hold the body of
3683    OMP_TASK GS.  */
3684
3685 static inline tree *
3686 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3687 {
3688   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3689     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3690   return &gs->gimple_omp_parallel.child_fn;
3691 }
3692
3693
3694 /* Set CHILD_FN to be the child function for OMP_TASK GS.  */
3695
3696 static inline void
3697 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3698 {
3699   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3700     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3701   gs->gimple_omp_parallel.child_fn = child_fn;
3702 }
3703
3704
3705 /* Return the artificial argument used to send variables and values
3706    from the parent to the children threads in OMP_TASK GS.  */
3707
3708 static inline tree
3709 gimple_omp_taskreg_data_arg (const_gimple gs)
3710 {
3711   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3712     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3713   return gs->gimple_omp_parallel.data_arg;
3714 }
3715
3716
3717 /* Return a pointer to the data argument for OMP_TASK GS.  */
3718
3719 static inline tree *
3720 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3721 {
3722   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3723     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3724   return &gs->gimple_omp_parallel.data_arg;
3725 }
3726
3727
3728 /* Set DATA_ARG to be the data argument for OMP_TASK GS.  */
3729
3730 static inline void
3731 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
3732 {
3733   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3734     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3735   gs->gimple_omp_parallel.data_arg = data_arg;
3736 }
3737
3738
3739 /* Return the copy function used to hold the body of OMP_TASK GS.  */
3740
3741 static inline tree
3742 gimple_omp_task_copy_fn (const_gimple gs)
3743 {
3744   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3745   return gs->gimple_omp_task.copy_fn;
3746 }
3747
3748 /* Return a pointer to the copy function used to hold the body of
3749    OMP_TASK GS.  */
3750
3751 static inline tree *
3752 gimple_omp_task_copy_fn_ptr (gimple gs)
3753 {
3754   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3755   return &gs->gimple_omp_task.copy_fn;
3756 }
3757
3758
3759 /* Set CHILD_FN to be the copy function for OMP_TASK GS.  */
3760
3761 static inline void
3762 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
3763 {
3764   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3765   gs->gimple_omp_task.copy_fn = copy_fn;
3766 }
3767
3768
3769 /* Return size of the data block in bytes in OMP_TASK GS.  */
3770
3771 static inline tree
3772 gimple_omp_task_arg_size (const_gimple gs)
3773 {
3774   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3775   return gs->gimple_omp_task.arg_size;
3776 }
3777
3778
3779 /* Return a pointer to the data block size for OMP_TASK GS.  */
3780
3781 static inline tree *
3782 gimple_omp_task_arg_size_ptr (gimple gs)
3783 {
3784   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3785   return &gs->gimple_omp_task.arg_size;
3786 }
3787
3788
3789 /* Set ARG_SIZE to be the data block size for OMP_TASK GS.  */
3790
3791 static inline void
3792 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
3793 {
3794   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3795   gs->gimple_omp_task.arg_size = arg_size;
3796 }
3797
3798
3799 /* Return align of the data block in bytes in OMP_TASK GS.  */
3800
3801 static inline tree
3802 gimple_omp_task_arg_align (const_gimple gs)
3803 {
3804   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3805   return gs->gimple_omp_task.arg_align;
3806 }
3807
3808
3809 /* Return a pointer to the data block align for OMP_TASK GS.  */
3810
3811 static inline tree *
3812 gimple_omp_task_arg_align_ptr (gimple gs)
3813 {
3814   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3815   return &gs->gimple_omp_task.arg_align;
3816 }
3817
3818
3819 /* Set ARG_SIZE to be the data block align for OMP_TASK GS.  */
3820
3821 static inline void
3822 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
3823 {
3824   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3825   gs->gimple_omp_task.arg_align = arg_align;
3826 }
3827
3828
3829 /* Return the clauses associated with OMP_SINGLE GS.  */
3830
3831 static inline tree
3832 gimple_omp_single_clauses (const_gimple gs)
3833 {
3834   GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3835   return gs->gimple_omp_single.clauses;
3836 }
3837
3838
3839 /* Return a pointer to the clauses associated with OMP_SINGLE GS.  */
3840
3841 static inline tree *
3842 gimple_omp_single_clauses_ptr (gimple gs)
3843 {
3844   GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3845   return &gs->gimple_omp_single.clauses;
3846 }
3847
3848
3849 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS.  */
3850
3851 static inline void
3852 gimple_omp_single_set_clauses (gimple gs, tree clauses)
3853 {
3854   GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3855   gs->gimple_omp_single.clauses = clauses;
3856 }
3857
3858
3859 /* Return the clauses associated with OMP_SECTIONS GS.  */
3860
3861 static inline tree
3862 gimple_omp_sections_clauses (const_gimple gs)
3863 {
3864   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3865   return gs->gimple_omp_sections.clauses;
3866 }
3867
3868
3869 /* Return a pointer to the clauses associated with OMP_SECTIONS GS.  */
3870
3871 static inline tree *
3872 gimple_omp_sections_clauses_ptr (gimple gs)
3873 {
3874   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3875   return &gs->gimple_omp_sections.clauses;
3876 }
3877
3878
3879 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
3880    GS.  */
3881
3882 static inline void
3883 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
3884 {
3885   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3886   gs->gimple_omp_sections.clauses = clauses;
3887 }
3888
3889
3890 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
3891    in GS.  */
3892
3893 static inline tree
3894 gimple_omp_sections_control (const_gimple gs)
3895 {
3896   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3897   return gs->gimple_omp_sections.control;
3898 }
3899
3900
3901 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
3902    GS.  */
3903
3904 static inline tree *
3905 gimple_omp_sections_control_ptr (gimple gs)
3906 {
3907   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3908   return &gs->gimple_omp_sections.control;
3909 }
3910
3911
3912 /* Set CONTROL to be the set of clauses associated with the
3913    GIMPLE_OMP_SECTIONS in GS.  */
3914
3915 static inline void
3916 gimple_omp_sections_set_control (gimple gs, tree control)
3917 {
3918   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3919   gs->gimple_omp_sections.control = control;
3920 }
3921
3922
3923 /* Set COND to be the condition code for OMP_FOR GS.  */
3924
3925 static inline void
3926 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
3927 {
3928   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3929   gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
3930   gcc_assert (i < gs->gimple_omp_for.collapse);
3931   gs->gimple_omp_for.iter[i].cond = cond;
3932 }
3933
3934
3935 /* Return the condition code associated with OMP_FOR GS.  */
3936
3937 static inline enum tree_code
3938 gimple_omp_for_cond (const_gimple gs, size_t i)
3939 {
3940   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3941   gcc_assert (i < gs->gimple_omp_for.collapse);
3942   return gs->gimple_omp_for.iter[i].cond;
3943 }
3944
3945
3946 /* Set the value being stored in an atomic store.  */
3947
3948 static inline void
3949 gimple_omp_atomic_store_set_val (gimple g, tree val)
3950 {
3951   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3952   g->gimple_omp_atomic_store.val = val;
3953 }
3954
3955
3956 /* Return the value being stored in an atomic store.  */
3957
3958 static inline tree
3959 gimple_omp_atomic_store_val (const_gimple g)
3960 {
3961   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3962   return g->gimple_omp_atomic_store.val;
3963 }
3964
3965
3966 /* Return a pointer to the value being stored in an atomic store.  */
3967
3968 static inline tree *
3969 gimple_omp_atomic_store_val_ptr (gimple g)
3970 {
3971   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3972   return &g->gimple_omp_atomic_store.val;
3973 }
3974
3975
3976 /* Set the LHS of an atomic load.  */
3977
3978 static inline void
3979 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
3980 {
3981   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
3982   g->gimple_omp_atomic_load.lhs = lhs;
3983 }
3984
3985
3986 /* Get the LHS of an atomic load.  */
3987
3988 static inline tree
3989 gimple_omp_atomic_load_lhs (const_gimple g)
3990 {
3991   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
3992   return g->gimple_omp_atomic_load.lhs;
3993 }
3994
3995
3996 /* Return a pointer to the LHS of an atomic load.  */
3997
3998 static inline tree *
3999 gimple_omp_atomic_load_lhs_ptr (gimple g)
4000 {
4001   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4002   return &g->gimple_omp_atomic_load.lhs;
4003 }
4004
4005
4006 /* Set the RHS of an atomic load.  */
4007
4008 static inline void
4009 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4010 {
4011   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4012   g->gimple_omp_atomic_load.rhs = rhs;
4013 }
4014
4015
4016 /* Get the RHS of an atomic load.  */
4017
4018 static inline tree
4019 gimple_omp_atomic_load_rhs (const_gimple g)
4020 {
4021   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4022   return g->gimple_omp_atomic_load.rhs;
4023 }
4024
4025
4026 /* Return a pointer to the RHS of an atomic load.  */
4027
4028 static inline tree *
4029 gimple_omp_atomic_load_rhs_ptr (gimple g)
4030 {
4031   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4032   return &g->gimple_omp_atomic_load.rhs;
4033 }
4034
4035
4036 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE.  */
4037
4038 static inline tree
4039 gimple_omp_continue_control_def (const_gimple g)
4040 {
4041   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4042   return g->gimple_omp_continue.control_def;
4043 }
4044
4045 /* The same as above, but return the address.  */
4046
4047 static inline tree *
4048 gimple_omp_continue_control_def_ptr (gimple g)
4049 {
4050   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4051   return &g->gimple_omp_continue.control_def;
4052 }
4053
4054 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE.  */
4055
4056 static inline void
4057 gimple_omp_continue_set_control_def (gimple g, tree def)
4058 {
4059   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4060   g->gimple_omp_continue.control_def = def;
4061 }
4062
4063
4064 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE.  */
4065
4066 static inline tree
4067 gimple_omp_continue_control_use (const_gimple g)
4068 {
4069   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4070   return g->gimple_omp_continue.control_use;
4071 }
4072
4073
4074 /* The same as above, but return the address.  */
4075
4076 static inline tree *
4077 gimple_omp_continue_control_use_ptr (gimple g)
4078 {
4079   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4080   return &g->gimple_omp_continue.control_use;
4081 }
4082
4083
4084 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE.  */
4085
4086 static inline void
4087 gimple_omp_continue_set_control_use (gimple g, tree use)
4088 {
4089   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4090   g->gimple_omp_continue.control_use = use;
4091 }
4092
4093
4094 /* Return a pointer to the return value for GIMPLE_RETURN GS.  */
4095
4096 static inline tree *
4097 gimple_return_retval_ptr (const_gimple gs)
4098 {
4099   GIMPLE_CHECK (gs, GIMPLE_RETURN);
4100   gcc_assert (gimple_num_ops (gs) == 1);
4101   return gimple_op_ptr (gs, 0);
4102 }
4103
4104 /* Return the return value for GIMPLE_RETURN GS.  */
4105
4106 static inline tree
4107 gimple_return_retval (const_gimple gs)
4108 {
4109   GIMPLE_CHECK (gs, GIMPLE_RETURN);
4110   gcc_assert (gimple_num_ops (gs) == 1);
4111   return gimple_op (gs, 0);
4112 }
4113
4114
4115 /* Set RETVAL to be the return value for GIMPLE_RETURN GS.  */
4116
4117 static inline void
4118 gimple_return_set_retval (gimple gs, tree retval)
4119 {
4120   GIMPLE_CHECK (gs, GIMPLE_RETURN);
4121   gcc_assert (gimple_num_ops (gs) == 1);
4122   gcc_assert (retval == NULL_TREE
4123               || TREE_CODE (retval) == RESULT_DECL
4124               || is_gimple_val (retval));
4125   gimple_set_op (gs, 0, retval);
4126 }
4127
4128
4129 /* Returns true when the gimple statment STMT is any of the OpenMP types.  */
4130
4131 static inline bool
4132 is_gimple_omp (const_gimple stmt)
4133 {
4134   return (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
4135           || gimple_code (stmt) == GIMPLE_OMP_TASK
4136           || gimple_code (stmt) == GIMPLE_OMP_FOR
4137           || gimple_code (stmt) == GIMPLE_OMP_SECTIONS
4138           || gimple_code (stmt) == GIMPLE_OMP_SECTIONS_SWITCH
4139           || gimple_code (stmt) == GIMPLE_OMP_SINGLE
4140           || gimple_code (stmt) == GIMPLE_OMP_SECTION
4141           || gimple_code (stmt) == GIMPLE_OMP_MASTER
4142           || gimple_code (stmt) == GIMPLE_OMP_ORDERED
4143           || gimple_code (stmt) == GIMPLE_OMP_CRITICAL
4144           || gimple_code (stmt) == GIMPLE_OMP_RETURN
4145           || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD
4146           || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE
4147           || gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
4148 }
4149
4150
4151 /* Returns TRUE if statement G is a GIMPLE_NOP.  */
4152
4153 static inline bool
4154 gimple_nop_p (const_gimple g)
4155 {
4156   return gimple_code (g) == GIMPLE_NOP;
4157 }
4158
4159
4160 /* Return the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS.  */
4161
4162 static inline tree
4163 gimple_cdt_new_type (gimple gs)
4164 {
4165   GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4166   return gimple_op (gs, 1);
4167 }
4168
4169 /* Return a pointer to the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE
4170    statement GS.  */
4171
4172 static inline tree *
4173 gimple_cdt_new_type_ptr (gimple gs)
4174 {
4175   GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4176   return gimple_op_ptr (gs, 1);
4177 }
4178
4179 /* Set NEW_TYPE to be the type returned by GIMPLE_CHANGE_DYNAMIC_TYPE
4180    statement GS.  */
4181
4182 static inline void
4183 gimple_cdt_set_new_type (gimple gs, tree new_type)
4184 {
4185   GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4186   gcc_assert (TREE_CODE_CLASS (TREE_CODE (new_type)) == tcc_type);
4187   gimple_set_op (gs, 1, new_type);
4188 }
4189
4190
4191 /* Return the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS.  */
4192
4193 static inline tree
4194 gimple_cdt_location (gimple gs)
4195 {
4196   GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4197   return gimple_op (gs, 0);
4198 }
4199
4200
4201 /* Return a pointer to the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
4202    statement GS.  */
4203
4204 static inline tree *
4205 gimple_cdt_location_ptr (gimple gs)
4206 {
4207   GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4208   return gimple_op_ptr (gs, 0);
4209 }
4210
4211
4212 /* Set PTR to be the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
4213    statement GS.  */
4214
4215 static inline void
4216 gimple_cdt_set_location (gimple gs, tree ptr)
4217 {
4218   GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4219   gimple_set_op (gs, 0, ptr);
4220 }
4221
4222
4223 /* Return the predictor of GIMPLE_PREDICT statement GS.  */
4224
4225 static inline enum br_predictor
4226 gimple_predict_predictor (gimple gs)
4227 {
4228   GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4229   return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4230 }
4231
4232
4233 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT.  */
4234
4235 static inline void
4236 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4237 {
4238   GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4239   gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4240                        | (unsigned) predictor;
4241 }
4242
4243
4244 /* Return the outcome of GIMPLE_PREDICT statement GS.  */
4245
4246 static inline enum prediction
4247 gimple_predict_outcome (gimple gs)
4248 {
4249   GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4250   return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4251 }
4252
4253
4254 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME.  */
4255
4256 static inline void
4257 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4258 {
4259   GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4260   if (outcome == TAKEN)
4261     gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4262   else
4263     gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4264 }
4265
4266
4267 /* Return a new iterator pointing to GIMPLE_SEQ's first statement.  */
4268
4269 static inline gimple_stmt_iterator
4270 gsi_start (gimple_seq seq)
4271 {
4272   gimple_stmt_iterator i;
4273
4274   i.ptr = gimple_seq_first (seq);
4275   i.seq = seq;
4276   i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4277
4278   return i;
4279 }
4280
4281
4282 /* Return a new iterator pointing to the first statement in basic block BB.  */
4283
4284 static inline gimple_stmt_iterator
4285 gsi_start_bb (basic_block bb)
4286 {
4287   gimple_stmt_iterator i;
4288   gimple_seq seq;
4289   
4290   seq = bb_seq (bb);
4291   i.ptr = gimple_seq_first (seq);
4292   i.seq = seq;
4293   i.bb = bb;
4294
4295   return i;
4296 }
4297
4298
4299 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement.  */
4300
4301 static inline gimple_stmt_iterator
4302 gsi_last (gimple_seq seq)
4303 {
4304   gimple_stmt_iterator i;
4305
4306   i.ptr = gimple_seq_last (seq);
4307   i.seq = seq;
4308   i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4309
4310   return i;
4311 }
4312
4313
4314 /* Return a new iterator pointing to the last statement in basic block BB.  */
4315
4316 static inline gimple_stmt_iterator
4317 gsi_last_bb (basic_block bb)
4318 {
4319   gimple_stmt_iterator i;
4320   gimple_seq seq;
4321
4322   seq = bb_seq (bb);
4323   i.ptr = gimple_seq_last (seq);
4324   i.seq = seq;
4325   i.bb = bb;
4326
4327   return i;
4328 }
4329
4330
4331 /* Return true if I is at the end of its sequence.  */
4332
4333 static inline bool
4334 gsi_end_p (gimple_stmt_iterator i)
4335 {
4336   return i.ptr == NULL;
4337 }
4338
4339
4340 /* Return true if I is one statement before the end of its sequence.  */
4341
4342 static inline bool
4343 gsi_one_before_end_p (gimple_stmt_iterator i)
4344 {
4345   return i.ptr != NULL && i.ptr->next == NULL;
4346 }
4347
4348
4349 /* Advance the iterator to the next gimple statement.  */
4350
4351 static inline void
4352 gsi_next (gimple_stmt_iterator *i)
4353 {
4354   i->ptr = i->ptr->next;
4355 }
4356
4357 /* Advance the iterator to the previous gimple statement.  */
4358
4359 static inline void
4360 gsi_prev (gimple_stmt_iterator *i)
4361 {
4362   i->ptr = i->ptr->prev;
4363 }
4364
4365 /* Return the current stmt.  */
4366
4367 static inline gimple
4368 gsi_stmt (gimple_stmt_iterator i)
4369 {
4370   return i.ptr->stmt;
4371 }
4372
4373 /* Return a block statement iterator that points to the first non-label
4374    statement in block BB.  */
4375
4376 static inline gimple_stmt_iterator
4377 gsi_after_labels (basic_block bb)
4378 {
4379   gimple_stmt_iterator gsi = gsi_start_bb (bb);
4380
4381   while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4382     gsi_next (&gsi);
4383
4384   return gsi;
4385 }
4386
4387 /* Return a pointer to the current stmt.
4388    
4389   NOTE: You may want to use gsi_replace on the iterator itself,
4390   as this performs additional bookkeeping that will not be done
4391   if you simply assign through a pointer returned by gsi_stmt_ptr.  */
4392
4393 static inline gimple *
4394 gsi_stmt_ptr (gimple_stmt_iterator *i)
4395 {
4396   return &i->ptr->stmt;
4397 }
4398
4399
4400 /* Return the basic block associated with this iterator.  */
4401
4402 static inline basic_block
4403 gsi_bb (gimple_stmt_iterator i)
4404 {
4405   return i.bb;
4406 }
4407
4408
4409 /* Return the sequence associated with this iterator.  */
4410
4411 static inline gimple_seq
4412 gsi_seq (gimple_stmt_iterator i)
4413 {
4414   return i.seq;
4415 }
4416
4417
4418 enum gsi_iterator_update
4419 {
4420   GSI_NEW_STMT,         /* Only valid when single statement is added, move
4421                            iterator to it.  */
4422   GSI_SAME_STMT,        /* Leave the iterator at the same statement.  */
4423   GSI_CONTINUE_LINKING  /* Move iterator to whatever position is suitable
4424                            for linking other statements in the same
4425                            direction.  */
4426 };
4427
4428 /* In gimple-iterator.c  */
4429 gimple_stmt_iterator gsi_start_phis (basic_block);
4430 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4431 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4432 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4433 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4434                         enum gsi_iterator_update);
4435 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4436                                        enum gsi_iterator_update);
4437 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4438                             enum gsi_iterator_update);
4439 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4440                                            enum gsi_iterator_update);
4441 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4442                        enum gsi_iterator_update);
4443 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4444                                       enum gsi_iterator_update);
4445 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4446                            enum gsi_iterator_update);
4447 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4448                                           enum gsi_iterator_update);
4449 void gsi_remove (gimple_stmt_iterator *, bool);
4450 gimple_stmt_iterator gsi_for_stmt (gimple);
4451 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4452 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4453 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4454 void gsi_insert_on_edge (edge, gimple);
4455 void gsi_insert_seq_on_edge (edge, gimple_seq);
4456 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4457 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4458 void gsi_commit_one_edge_insert (edge, basic_block *);
4459 void gsi_commit_edge_inserts (void);
4460 gimple gimple_call_copy_skip_args (gimple, bitmap);
4461
4462
4463 /* Convenience routines to walk all statements of a gimple function.
4464    Note that this is useful exclusively before the code is converted
4465    into SSA form.  Once the program is in SSA form, the standard
4466    operand interface should be used to analyze/modify statements.  */
4467 struct walk_stmt_info
4468 {
4469   /* Points to the current statement being walked.  */
4470   gimple_stmt_iterator gsi;
4471
4472   /* Additional data that the callback functions may want to carry
4473      through the recursion.  */
4474   void *info;
4475
4476   /* Pointer map used to mark visited tree nodes when calling
4477      walk_tree on each operand.  If set to NULL, duplicate tree nodes
4478      will be visited more than once.  */
4479   struct pointer_set_t *pset;
4480
4481   /* Indicates whether the operand being examined may be replaced
4482      with something that matches is_gimple_val (if true) or something
4483      slightly more complicated (if false).  "Something" technically
4484      means the common subset of is_gimple_lvalue and is_gimple_rhs,
4485      but we never try to form anything more complicated than that, so
4486      we don't bother checking.
4487
4488      Also note that CALLBACK should update this flag while walking the
4489      sub-expressions of a statement.  For instance, when walking the
4490      statement 'foo (&var)', the flag VAL_ONLY will initially be set
4491      to true, however, when walking &var, the operand of that
4492      ADDR_EXPR does not need to be a GIMPLE value.  */
4493   bool val_only;
4494
4495   /* True if we are currently walking the LHS of an assignment.  */
4496   bool is_lhs;
4497
4498   /* Optional.  Set to true by the callback functions if they made any
4499      changes.  */
4500   bool changed;
4501
4502   /* True if we're interested in location information.  */
4503   bool want_locations;
4504
4505   /* Operand returned by the callbacks.  This is set when calling
4506      walk_gimple_seq.  If the walk_stmt_fn or walk_tree_fn callback
4507      returns non-NULL, this field will contain the tree returned by
4508      the last callback.  */
4509   tree callback_result;
4510 };
4511
4512 /* Callback for walk_gimple_stmt.  Called for every statement found
4513    during traversal.  The first argument points to the statement to
4514    walk.  The second argument is a flag that the callback sets to
4515    'true' if it the callback handled all the operands and
4516    sub-statements of the statement (the default value of this flag is
4517    'false').  The third argument is an anonymous pointer to data
4518    to be used by the callback.  */
4519 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4520                               struct walk_stmt_info *);
4521
4522 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4523                         struct walk_stmt_info *);
4524 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4525                        struct walk_stmt_info *);
4526 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4527
4528 #ifdef GATHER_STATISTICS
4529 /* Enum and arrays used for allocation stats.  Keep in sync with
4530    gimple.c:gimple_alloc_kind_names.  */
4531 enum gimple_alloc_kind
4532 {
4533   gimple_alloc_kind_assign,     /* Assignments.  */
4534   gimple_alloc_kind_phi,        /* PHI nodes.  */
4535   gimple_alloc_kind_cond,       /* Conditionals.  */
4536   gimple_alloc_kind_seq,        /* Sequences.  */
4537   gimple_alloc_kind_rest,       /* Everything else.  */
4538   gimple_alloc_kind_all
4539 };
4540
4541 extern int gimple_alloc_counts[];
4542 extern int gimple_alloc_sizes[];
4543
4544 /* Return the allocation kind for a given stmt CODE.  */
4545 static inline enum gimple_alloc_kind
4546 gimple_alloc_kind (enum gimple_code code)
4547 {
4548   switch (code)
4549     {
4550       case GIMPLE_ASSIGN:
4551         return gimple_alloc_kind_assign;
4552       case GIMPLE_PHI:
4553         return gimple_alloc_kind_phi;
4554       case GIMPLE_COND:
4555         return gimple_alloc_kind_cond;
4556       default:
4557         return gimple_alloc_kind_rest;
4558     }
4559 }
4560 #endif /* GATHER_STATISTICS */
4561
4562 extern void dump_gimple_statistics (void);
4563
4564 #endif  /* GCC_GIMPLE_H */