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