OSDN Git Service

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