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