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