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