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