OSDN Git Service

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