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