OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [gimple.h] - Blame information for rev 791

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.