OSDN Git Service

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