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