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