source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/tools/avr/lib/gcc/avr/4.8.1/plugin/include/gimple.h @ 46

Last change on this file since 46 was 46, checked in by jrpelegrina, 4 years ago

First release to Xenial

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