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