OSDN Git Service

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