OSDN Git Service

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