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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [gimple.h] - Blame information for rev 318

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

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

powered by: WebSVN 2.1.0

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