OSDN Git Service

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