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