Merge branch 'vendor/GCC47'
[dragonfly.git] / contrib / gcc-4.7 / gcc / gimple.h
CommitLineData
e4b17023
JM
1/* Gimple IR definitions.
2
3 Copyright 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
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"
27#include "vecprim.h"
28#include "vecir.h"
29#include "ggc.h"
30#include "basic-block.h"
31#include "tree-ssa-operands.h"
32#include "tree-ssa-alias.h"
33#include "internal-fn.h"
34
35struct gimple_seq_node_d;
36typedef struct gimple_seq_node_d *gimple_seq_node;
37typedef const struct gimple_seq_node_d *const_gimple_seq_node;
38
39/* For each block, the PHI nodes that need to be rewritten are stored into
40 these vectors. */
41typedef VEC(gimple, heap) *gimple_vec;
42DEF_VEC_P (gimple_vec);
43DEF_VEC_ALLOC_P (gimple_vec, heap);
44
45enum gimple_code {
46#define DEFGSCODE(SYM, STRING, STRUCT) SYM,
47#include "gimple.def"
48#undef DEFGSCODE
49 LAST_AND_UNUSED_GIMPLE_CODE
50};
51
52extern const char *const gimple_code_name[];
53extern const unsigned char gimple_rhs_class_table[];
54
55/* Error out if a gimple tuple is addressed incorrectly. */
56#if defined ENABLE_GIMPLE_CHECKING
57#define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
58extern void gimple_check_failed (const_gimple, const char *, int, \
59 const char *, enum gimple_code, \
60 enum tree_code) ATTRIBUTE_NORETURN;
61
62#define GIMPLE_CHECK(GS, CODE) \
63 do { \
64 const_gimple __gs = (GS); \
65 if (gimple_code (__gs) != (CODE)) \
66 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
67 (CODE), ERROR_MARK); \
68 } while (0)
69#else /* not ENABLE_GIMPLE_CHECKING */
70#define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
71#define GIMPLE_CHECK(GS, CODE) (void)0
72#endif
73
74/* Class of GIMPLE expressions suitable for the RHS of assignments. See
75 get_gimple_rhs_class. */
76enum gimple_rhs_class
77{
78 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
79 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
80 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
81 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
82 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
83 name, a _DECL, a _REF, etc. */
84};
85
86/* Specific flags for individual GIMPLE statements. These flags are
87 always stored in gimple_statement_base.subcode and they may only be
88 defined for statement codes that do not use sub-codes.
89
90 Values for the masks can overlap as long as the overlapping values
91 are never used in the same statement class.
92
93 The maximum mask value that can be defined is 1 << 15 (i.e., each
94 statement code can hold up to 16 bitflags).
95
96 Keep this list sorted. */
97enum gf_mask {
98 GF_ASM_INPUT = 1 << 0,
99 GF_ASM_VOLATILE = 1 << 1,
100 GF_CALL_FROM_THUNK = 1 << 0,
101 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
102 GF_CALL_TAILCALL = 1 << 2,
103 GF_CALL_VA_ARG_PACK = 1 << 3,
104 GF_CALL_NOTHROW = 1 << 4,
105 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
106 GF_CALL_INTERNAL = 1 << 6,
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_OMP_ATOMIC_NEED_VALUE = 1 << 0,
117 GF_PREDICT_TAKEN = 1 << 15
118};
119
120/* Currently, there are only two types of gimple debug stmt. Others are
121 envisioned, for example, to enable the generation of is_stmt notes
122 in line number information, to mark sequence points, etc. This
123 subcode is to be used to tell them apart. */
124enum gimple_debug_subcode {
125 GIMPLE_DEBUG_BIND = 0,
126 GIMPLE_DEBUG_SOURCE_BIND = 1
127};
128
129/* Masks for selecting a pass local flag (PLF) to work on. These
130 masks are used by gimple_set_plf and gimple_plf. */
131enum plf_mask {
132 GF_PLF_1 = 1 << 0,
133 GF_PLF_2 = 1 << 1
134};
135
136/* A node in a gimple_seq_d. */
137struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
138 gimple stmt;
139 struct gimple_seq_node_d *prev;
140 struct gimple_seq_node_d *next;
141};
142
143/* A double-linked sequence of gimple statements. */
144struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
145 /* First and last statements in the sequence. */
146 gimple_seq_node first;
147 gimple_seq_node last;
148
149 /* Sequences are created/destroyed frequently. To minimize
150 allocation activity, deallocated sequences are kept in a pool of
151 available sequences. This is the pointer to the next free
152 sequence in the pool. */
153 gimple_seq next_free;
154};
155
156
157/* Return the first node in GIMPLE sequence S. */
158
159static inline gimple_seq_node
160gimple_seq_first (const_gimple_seq s)
161{
162 return s ? s->first : NULL;
163}
164
165
166/* Return the first statement in GIMPLE sequence S. */
167
168static inline gimple
169gimple_seq_first_stmt (const_gimple_seq s)
170{
171 gimple_seq_node n = gimple_seq_first (s);
172 return (n) ? n->stmt : NULL;
173}
174
175
176/* Return the last node in GIMPLE sequence S. */
177
178static inline gimple_seq_node
179gimple_seq_last (const_gimple_seq s)
180{
181 return s ? s->last : NULL;
182}
183
184
185/* Return the last statement in GIMPLE sequence S. */
186
187static inline gimple
188gimple_seq_last_stmt (const_gimple_seq s)
189{
190 gimple_seq_node n = gimple_seq_last (s);
191 return (n) ? n->stmt : NULL;
192}
193
194
195/* Set the last node in GIMPLE sequence S to LAST. */
196
197static inline void
198gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
199{
200 s->last = last;
201}
202
203
204/* Set the first node in GIMPLE sequence S to FIRST. */
205
206static inline void
207gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
208{
209 s->first = first;
210}
211
212
213/* Return true if GIMPLE sequence S is empty. */
214
215static inline bool
216gimple_seq_empty_p (const_gimple_seq s)
217{
218 return s == NULL || s->first == NULL;
219}
220
221
222void gimple_seq_add_stmt (gimple_seq *, gimple);
223
224/* Link gimple statement GS to the end of the sequence *SEQ_P. If
225 *SEQ_P is NULL, a new sequence is allocated. This function is
226 similar to gimple_seq_add_stmt, but does not scan the operands.
227 During gimplification, we need to manipulate statement sequences
228 before the def/use vectors have been constructed. */
229void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
230
231/* Allocate a new sequence and initialize its first element with STMT. */
232
233static inline gimple_seq
234gimple_seq_alloc_with_stmt (gimple stmt)
235{
236 gimple_seq seq = NULL;
237 gimple_seq_add_stmt (&seq, stmt);
238 return seq;
239}
240
241
242/* Returns the sequence of statements in BB. */
243
244static inline gimple_seq
245bb_seq (const_basic_block bb)
246{
247 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
248}
249
250
251/* Sets the sequence of statements in BB to SEQ. */
252
253static inline void
254set_bb_seq (basic_block bb, gimple_seq seq)
255{
256 gcc_checking_assert (!(bb->flags & BB_RTL));
257 bb->il.gimple->seq = seq;
258}
259
260/* Iterator object for GIMPLE statement sequences. */
261
262typedef struct
263{
264 /* Sequence node holding the current statement. */
265 gimple_seq_node ptr;
266
267 /* Sequence and basic block holding the statement. These fields
268 are necessary to handle edge cases such as when statement is
269 added to an empty basic block or when the last statement of a
270 block/sequence is removed. */
271 gimple_seq seq;
272 basic_block bb;
273} gimple_stmt_iterator;
274
275
276/* Data structure definitions for GIMPLE tuples. NOTE: word markers
277 are for 64 bit hosts. */
278
279struct GTY(()) gimple_statement_base {
280 /* [ WORD 1 ]
281 Main identifying code for a tuple. */
282 ENUM_BITFIELD(gimple_code) code : 8;
283
284 /* Nonzero if a warning should not be emitted on this tuple. */
285 unsigned int no_warning : 1;
286
287 /* Nonzero if this tuple has been visited. Passes are responsible
288 for clearing this bit before using it. */
289 unsigned int visited : 1;
290
291 /* Nonzero if this tuple represents a non-temporal move. */
292 unsigned int nontemporal_move : 1;
293
294 /* Pass local flags. These flags are free for any pass to use as
295 they see fit. Passes should not assume that these flags contain
296 any useful value when the pass starts. Any initial state that
297 the pass requires should be set on entry to the pass. See
298 gimple_set_plf and gimple_plf for usage. */
299 unsigned int plf : 2;
300
301 /* Nonzero if this statement has been modified and needs to have its
302 operands rescanned. */
303 unsigned modified : 1;
304
305 /* Nonzero if this statement contains volatile operands. */
306 unsigned has_volatile_ops : 1;
307
95d28233
JM
308 /* Padding to get subcode to 16 bit alignment. */
309 unsigned pad : 1;
310
e4b17023
JM
311 /* The SUBCODE field can be used for tuple-specific flags for tuples
312 that do not require subcodes. Note that SUBCODE should be at
313 least as wide as tree codes, as several tuples store tree codes
314 in there. */
315 unsigned int subcode : 16;
316
317 /* UID of this statement. This is used by passes that want to
318 assign IDs to statements. It must be assigned and used by each
319 pass. By default it should be assumed to contain garbage. */
320 unsigned uid;
321
322 /* [ WORD 2 ]
323 Locus information for debug info. */
324 location_t location;
325
326 /* Number of operands in this tuple. */
327 unsigned num_ops;
328
329 /* [ WORD 3 ]
330 Basic block holding this statement. */
331 struct basic_block_def *bb;
332
333 /* [ WORD 4 ]
334 Lexical block holding this statement. */
335 tree block;
336};
337
338
339/* Base structure for tuples with operands. */
340
341struct GTY(()) gimple_statement_with_ops_base
342{
343 /* [ WORD 1-4 ] */
344 struct gimple_statement_base gsbase;
345
346 /* [ WORD 5-6 ]
347 SSA operand vectors. NOTE: It should be possible to
348 amalgamate these vectors with the operand vector OP. However,
349 the SSA operand vectors are organized differently and contain
350 more information (like immediate use chaining). */
351 struct def_optype_d GTY((skip (""))) *def_ops;
352 struct use_optype_d GTY((skip (""))) *use_ops;
353};
354
355
356/* Statements that take register operands. */
357
358struct GTY(()) gimple_statement_with_ops
359{
360 /* [ WORD 1-6 ] */
361 struct gimple_statement_with_ops_base opbase;
362
363 /* [ WORD 7 ]
364 Operand vector. NOTE! This must always be the last field
365 of this structure. In particular, this means that this
366 structure cannot be embedded inside another one. */
367 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
368};
369
370
371/* Base for statements that take both memory and register operands. */
372
373struct GTY(()) gimple_statement_with_memory_ops_base
374{
375 /* [ WORD 1-6 ] */
376 struct gimple_statement_with_ops_base opbase;
377
378 /* [ WORD 7-8 ]
379 Virtual operands for this statement. The GC will pick them
380 up via the ssa_names array. */
381 tree GTY((skip (""))) vdef;
382 tree GTY((skip (""))) vuse;
383};
384
385
386/* Statements that take both memory and register operands. */
387
388struct GTY(()) gimple_statement_with_memory_ops
389{
390 /* [ WORD 1-8 ] */
391 struct gimple_statement_with_memory_ops_base membase;
392
393 /* [ WORD 9 ]
394 Operand vector. NOTE! This must always be the last field
395 of this structure. In particular, this means that this
396 structure cannot be embedded inside another one. */
397 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
398};
399
400
401/* Call statements that take both memory and register operands. */
402
403struct GTY(()) gimple_statement_call
404{
405 /* [ WORD 1-8 ] */
406 struct gimple_statement_with_memory_ops_base membase;
407
408 /* [ WORD 9-12 ] */
409 struct pt_solution call_used;
410 struct pt_solution call_clobbered;
411
412 /* [ WORD 13 ] */
413 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
414 tree GTY ((tag ("0"))) fntype;
415 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
416 } u;
417
418 /* [ WORD 14 ]
419 Operand vector. NOTE! This must always be the last field
420 of this structure. In particular, this means that this
421 structure cannot be embedded inside another one. */
422 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
423};
424
425
426/* OpenMP statements (#pragma omp). */
427
428struct GTY(()) gimple_statement_omp {
429 /* [ WORD 1-4 ] */
430 struct gimple_statement_base gsbase;
431
432 /* [ WORD 5 ] */
433 gimple_seq body;
434};
435
436
437/* GIMPLE_BIND */
438
439struct GTY(()) gimple_statement_bind {
440 /* [ WORD 1-4 ] */
441 struct gimple_statement_base gsbase;
442
443 /* [ WORD 5 ]
444 Variables declared in this scope. */
445 tree vars;
446
447 /* [ WORD 6 ]
448 This is different than the BLOCK field in gimple_statement_base,
449 which is analogous to TREE_BLOCK (i.e., the lexical block holding
450 this statement). This field is the equivalent of BIND_EXPR_BLOCK
451 in tree land (i.e., the lexical scope defined by this bind). See
452 gimple-low.c. */
453 tree block;
454
455 /* [ WORD 7 ] */
456 gimple_seq body;
457};
458
459
460/* GIMPLE_CATCH */
461
462struct GTY(()) gimple_statement_catch {
463 /* [ WORD 1-4 ] */
464 struct gimple_statement_base gsbase;
465
466 /* [ WORD 5 ] */
467 tree types;
468
469 /* [ WORD 6 ] */
470 gimple_seq handler;
471};
472
473
474/* GIMPLE_EH_FILTER */
475
476struct GTY(()) gimple_statement_eh_filter {
477 /* [ WORD 1-4 ] */
478 struct gimple_statement_base gsbase;
479
480 /* [ WORD 5 ]
481 Filter types. */
482 tree types;
483
484 /* [ WORD 6 ]
485 Failure actions. */
486 gimple_seq failure;
487};
488
489/* GIMPLE_EH_ELSE */
490
491struct GTY(()) gimple_statement_eh_else {
492 /* [ WORD 1-4 ] */
493 struct gimple_statement_base gsbase;
494
495 /* [ WORD 5,6 ] */
496 gimple_seq n_body, e_body;
497};
498
499/* GIMPLE_EH_MUST_NOT_THROW */
500
501struct GTY(()) gimple_statement_eh_mnt {
502 /* [ WORD 1-4 ] */
503 struct gimple_statement_base gsbase;
504
505 /* [ WORD 5 ] Abort function decl. */
506 tree fndecl;
507};
508
509/* GIMPLE_PHI */
510
511struct GTY(()) gimple_statement_phi {
512 /* [ WORD 1-4 ] */
513 struct gimple_statement_base gsbase;
514
515 /* [ WORD 5 ] */
516 unsigned capacity;
517 unsigned nargs;
518
519 /* [ WORD 6 ] */
520 tree result;
521
522 /* [ WORD 7 ] */
523 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
524};
525
526
527/* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
528
529struct GTY(()) gimple_statement_eh_ctrl
530{
531 /* [ WORD 1-4 ] */
532 struct gimple_statement_base gsbase;
533
534 /* [ WORD 5 ]
535 Exception region number. */
536 int region;
537};
538
539
540/* GIMPLE_TRY */
541
542struct GTY(()) gimple_statement_try {
543 /* [ WORD 1-4 ] */
544 struct gimple_statement_base gsbase;
545
546 /* [ WORD 5 ]
547 Expression to evaluate. */
548 gimple_seq eval;
549
550 /* [ WORD 6 ]
551 Cleanup expression. */
552 gimple_seq cleanup;
553};
554
555/* Kind of GIMPLE_TRY statements. */
556enum gimple_try_flags
557{
558 /* A try/catch. */
559 GIMPLE_TRY_CATCH = 1 << 0,
560
561 /* A try/finally. */
562 GIMPLE_TRY_FINALLY = 1 << 1,
563 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
564
565 /* Analogous to TRY_CATCH_IS_CLEANUP. */
566 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
567};
568
569/* GIMPLE_WITH_CLEANUP_EXPR */
570
571struct GTY(()) gimple_statement_wce {
572 /* [ WORD 1-4 ] */
573 struct gimple_statement_base gsbase;
574
575 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
576 executed if an exception is thrown, not on normal exit of its
577 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
578 in TARGET_EXPRs. */
579
580 /* [ WORD 5 ]
581 Cleanup expression. */
582 gimple_seq cleanup;
583};
584
585
586/* GIMPLE_ASM */
587
588struct GTY(()) gimple_statement_asm
589{
590 /* [ WORD 1-8 ] */
591 struct gimple_statement_with_memory_ops_base membase;
592
593 /* [ WORD 9 ]
594 __asm__ statement. */
595 const char *string;
596
597 /* [ WORD 10 ]
598 Number of inputs, outputs, clobbers, labels. */
599 unsigned char ni;
600 unsigned char no;
601 unsigned char nc;
602 unsigned char nl;
603
604 /* [ WORD 11 ]
605 Operand vector. NOTE! This must always be the last field
606 of this structure. In particular, this means that this
607 structure cannot be embedded inside another one. */
608 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
609};
610
611/* GIMPLE_OMP_CRITICAL */
612
613struct GTY(()) gimple_statement_omp_critical {
614 /* [ WORD 1-5 ] */
615 struct gimple_statement_omp omp;
616
617 /* [ WORD 6 ]
618 Critical section name. */
619 tree name;
620};
621
622
623struct GTY(()) gimple_omp_for_iter {
624 /* Condition code. */
625 enum tree_code cond;
626
627 /* Index variable. */
628 tree index;
629
630 /* Initial value. */
631 tree initial;
632
633 /* Final value. */
634 tree final;
635
636 /* Increment. */
637 tree incr;
638};
639
640/* GIMPLE_OMP_FOR */
641
642struct GTY(()) gimple_statement_omp_for {
643 /* [ WORD 1-5 ] */
644 struct gimple_statement_omp omp;
645
646 /* [ WORD 6 ] */
647 tree clauses;
648
649 /* [ WORD 7 ]
650 Number of elements in iter array. */
651 size_t collapse;
652
653 /* [ WORD 8 ] */
654 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
655
656 /* [ WORD 9 ]
657 Pre-body evaluated before the loop body begins. */
658 gimple_seq pre_body;
659};
660
661
662/* GIMPLE_OMP_PARALLEL */
663
664struct GTY(()) gimple_statement_omp_parallel {
665 /* [ WORD 1-5 ] */
666 struct gimple_statement_omp omp;
667
668 /* [ WORD 6 ]
669 Clauses. */
670 tree clauses;
671
672 /* [ WORD 7 ]
673 Child function holding the body of the parallel region. */
674 tree child_fn;
675
676 /* [ WORD 8 ]
677 Shared data argument. */
678 tree data_arg;
679};
680
681
682/* GIMPLE_OMP_TASK */
683
684struct GTY(()) gimple_statement_omp_task {
685 /* [ WORD 1-8 ] */
686 struct gimple_statement_omp_parallel par;
687
688 /* [ WORD 9 ]
689 Child function holding firstprivate initialization if needed. */
690 tree copy_fn;
691
692 /* [ WORD 10-11 ]
693 Size and alignment in bytes of the argument data block. */
694 tree arg_size;
695 tree arg_align;
696};
697
698
699/* GIMPLE_OMP_SECTION */
700/* Uses struct gimple_statement_omp. */
701
702
703/* GIMPLE_OMP_SECTIONS */
704
705struct GTY(()) gimple_statement_omp_sections {
706 /* [ WORD 1-5 ] */
707 struct gimple_statement_omp omp;
708
709 /* [ WORD 6 ] */
710 tree clauses;
711
712 /* [ WORD 7 ]
713 The control variable used for deciding which of the sections to
714 execute. */
715 tree control;
716};
717
718/* GIMPLE_OMP_CONTINUE.
719
720 Note: This does not inherit from gimple_statement_omp, because we
721 do not need the body field. */
722
723struct GTY(()) gimple_statement_omp_continue {
724 /* [ WORD 1-4 ] */
725 struct gimple_statement_base gsbase;
726
727 /* [ WORD 5 ] */
728 tree control_def;
729
730 /* [ WORD 6 ] */
731 tree control_use;
732};
733
734/* GIMPLE_OMP_SINGLE */
735
736struct GTY(()) gimple_statement_omp_single {
737 /* [ WORD 1-5 ] */
738 struct gimple_statement_omp omp;
739
740 /* [ WORD 6 ] */
741 tree clauses;
742};
743
744
745/* GIMPLE_OMP_ATOMIC_LOAD.
746 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
747 contains a sequence, which we don't need here. */
748
749struct GTY(()) gimple_statement_omp_atomic_load {
750 /* [ WORD 1-4 ] */
751 struct gimple_statement_base gsbase;
752
753 /* [ WORD 5-6 ] */
754 tree rhs, lhs;
755};
756
757/* GIMPLE_OMP_ATOMIC_STORE.
758 See note on GIMPLE_OMP_ATOMIC_LOAD. */
759
760struct GTY(()) gimple_statement_omp_atomic_store {
761 /* [ WORD 1-4 ] */
762 struct gimple_statement_base gsbase;
763
764 /* [ WORD 5 ] */
765 tree val;
766};
767
768/* GIMPLE_TRANSACTION. */
769
770/* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
771
772/* The __transaction_atomic was declared [[outer]] or it is
773 __transaction_relaxed. */
774#define GTMA_IS_OUTER (1u << 0)
775#define GTMA_IS_RELAXED (1u << 1)
776#define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
777
778/* The transaction is seen to not have an abort. */
779#define GTMA_HAVE_ABORT (1u << 2)
780/* The transaction is seen to have loads or stores. */
781#define GTMA_HAVE_LOAD (1u << 3)
782#define GTMA_HAVE_STORE (1u << 4)
783/* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
784#define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
785/* The transaction WILL enter serial irrevocable mode.
786 An irrevocable block post-dominates the entire transaction, such
787 that all invocations of the transaction will go serial-irrevocable.
788 In such case, we don't bother instrumenting the transaction, and
789 tell the runtime that it should begin the transaction in
790 serial-irrevocable mode. */
791#define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
792
793struct GTY(()) gimple_statement_transaction
794{
795 /* [ WORD 1-10 ] */
796 struct gimple_statement_with_memory_ops_base gsbase;
797
798 /* [ WORD 11 ] */
799 gimple_seq body;
800
801 /* [ WORD 12 ] */
802 tree label;
803};
804
805#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
806enum gimple_statement_structure_enum {
807#include "gsstruct.def"
808 LAST_GSS_ENUM
809};
810#undef DEFGSSTRUCT
811
812
813/* Define the overall contents of a gimple tuple. It may be any of the
814 structures declared above for various types of tuples. */
815
816union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
817 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
818 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
819 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
820 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
821 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
822 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
823 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
824 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
825 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
826 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
827 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
828 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
829 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
830 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
831 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
832 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
833 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
834 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
835 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
836 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
837 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
838 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
839 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
840 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
841 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
842 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
843};
844
845/* In gimple.c. */
846
847/* Offset in bytes to the location of the operand vector.
848 Zero if there is no operand vector for this tuple structure. */
849extern size_t const gimple_ops_offset_[];
850
851/* Map GIMPLE codes to GSS codes. */
852extern enum gimple_statement_structure_enum const gss_for_code_[];
853
854/* This variable holds the currently expanded gimple statement for purposes
855 of comminucating the profile info to the builtin expanders. */
856extern gimple currently_expanding_gimple_stmt;
857
858gimple gimple_build_return (tree);
859
860gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
861#define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
862
863void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
864
865gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
866 tree, tree MEM_STAT_DECL);
867#define gimple_build_assign_with_ops(c,o1,o2,o3) \
868 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
869#define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
870 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
871
872gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
873#define gimple_build_debug_bind(var,val,stmt) \
874 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
875gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
876#define gimple_build_debug_source_bind(var,val,stmt) \
877 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
878
879gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
880gimple gimple_build_call (tree, unsigned, ...);
881gimple gimple_build_call_valist (tree, unsigned, va_list);
882gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
883gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
884gimple gimple_build_call_from_tree (tree);
885gimple gimplify_assign (tree, tree, gimple_seq *);
886gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
887gimple gimple_build_label (tree label);
888gimple gimple_build_goto (tree dest);
889gimple gimple_build_nop (void);
890gimple gimple_build_bind (tree, gimple_seq, tree);
891gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
892 VEC(tree,gc) *, VEC(tree,gc) *);
893gimple gimple_build_catch (tree, gimple_seq);
894gimple gimple_build_eh_filter (tree, gimple_seq);
895gimple gimple_build_eh_must_not_throw (tree);
896gimple gimple_build_eh_else (gimple_seq, gimple_seq);
897gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
898gimple gimple_build_wce (gimple_seq);
899gimple gimple_build_resx (int);
900gimple gimple_build_eh_dispatch (int);
901gimple gimple_build_switch_nlabels (unsigned, tree, tree);
902gimple gimple_build_switch (unsigned, tree, tree, ...);
903gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
904gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
905gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
906gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
907gimple gimple_build_omp_critical (gimple_seq, tree);
908gimple gimple_build_omp_section (gimple_seq);
909gimple gimple_build_omp_continue (tree, tree);
910gimple gimple_build_omp_master (gimple_seq);
911gimple gimple_build_omp_return (bool);
912gimple gimple_build_omp_ordered (gimple_seq);
913gimple gimple_build_omp_sections (gimple_seq, tree);
914gimple gimple_build_omp_sections_switch (void);
915gimple gimple_build_omp_single (gimple_seq, tree);
916gimple gimple_build_cdt (tree, tree);
917gimple gimple_build_omp_atomic_load (tree, tree);
918gimple gimple_build_omp_atomic_store (tree);
919gimple gimple_build_transaction (gimple_seq, tree);
920gimple gimple_build_predict (enum br_predictor, enum prediction);
921enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
922void sort_case_labels (VEC(tree,heap) *);
923void gimple_set_body (tree, gimple_seq);
924gimple_seq gimple_body (tree);
925bool gimple_has_body_p (tree);
926gimple_seq gimple_seq_alloc (void);
927void gimple_seq_free (gimple_seq);
928void gimple_seq_add_seq (gimple_seq *, gimple_seq);
929gimple_seq gimple_seq_copy (gimple_seq);
930bool gimple_call_same_target_p (const_gimple, const_gimple);
931int gimple_call_flags (const_gimple);
932int gimple_call_return_flags (const_gimple);
933int gimple_call_arg_flags (const_gimple, unsigned);
934void gimple_call_reset_alias_info (gimple);
935bool gimple_assign_copy_p (gimple);
936bool gimple_assign_ssa_name_copy_p (gimple);
937bool gimple_assign_unary_nop_p (gimple);
938void gimple_set_bb (gimple, struct basic_block_def *);
939void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
940void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
941 tree, tree, tree);
942tree gimple_get_lhs (const_gimple);
943void gimple_set_lhs (gimple, tree);
944void gimple_replace_lhs (gimple, tree);
945gimple gimple_copy (gimple);
946void gimple_set_modified (gimple, bool);
947void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
948gimple gimple_build_cond_from_tree (tree, tree, tree);
949void gimple_cond_set_condition_from_tree (gimple, tree);
950bool gimple_has_side_effects (const_gimple);
951bool gimple_could_trap_p (gimple);
952bool gimple_could_trap_p_1 (gimple, bool, bool);
953bool gimple_assign_rhs_could_trap_p (gimple);
954void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
955bool empty_body_p (gimple_seq);
956unsigned get_gimple_rhs_num_ops (enum tree_code);
957#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
958gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
959const char *gimple_decl_printable_name (tree, int);
960tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
961void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
962tree gimple_extract_devirt_binfo_from_cst (tree);
963/* Returns true iff T is a valid GIMPLE statement. */
964extern bool is_gimple_stmt (tree);
965
966/* Returns true iff T is a scalar register variable. */
967extern bool is_gimple_reg (tree);
968/* Returns true iff T is any sort of variable. */
969extern bool is_gimple_variable (tree);
970/* Returns true iff T is any sort of symbol. */
971extern bool is_gimple_id (tree);
972/* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
973extern bool is_gimple_min_lval (tree);
974/* Returns true iff T is something whose address can be taken. */
975extern bool is_gimple_addressable (tree);
976/* Returns true iff T is any valid GIMPLE lvalue. */
977extern bool is_gimple_lvalue (tree);
978
979/* Returns true iff T is a GIMPLE address. */
980bool is_gimple_address (const_tree);
981/* Returns true iff T is a GIMPLE invariant address. */
982bool is_gimple_invariant_address (const_tree);
983/* Returns true iff T is a GIMPLE invariant address at interprocedural
984 level. */
985bool is_gimple_ip_invariant_address (const_tree);
986/* Returns true iff T is a valid GIMPLE constant. */
987bool is_gimple_constant (const_tree);
988/* Returns true iff T is a GIMPLE restricted function invariant. */
989extern bool is_gimple_min_invariant (const_tree);
990/* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
991extern bool is_gimple_ip_invariant (const_tree);
992/* Returns true iff T is a GIMPLE rvalue. */
993extern bool is_gimple_val (tree);
994/* Returns true iff T is a GIMPLE asm statement input. */
995extern bool is_gimple_asm_val (tree);
996/* Returns true iff T is a valid address operand of a MEM_REF. */
997bool is_gimple_mem_ref_addr (tree);
998/* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
999 GIMPLE temporary, a renamed user variable, or something else,
1000 respectively. */
1001extern bool is_gimple_reg_rhs (tree);
1002extern bool is_gimple_mem_rhs (tree);
1003
1004/* Returns true iff T is a valid if-statement condition. */
1005extern bool is_gimple_condexpr (tree);
1006
1007/* Returns true iff T is a valid call address expression. */
1008extern bool is_gimple_call_addr (tree);
1009
1010extern void recalculate_side_effects (tree);
1011extern bool gimple_compare_field_offset (tree, tree);
1012extern tree gimple_register_type (tree);
1013extern tree gimple_register_canonical_type (tree);
1014extern void print_gimple_types_stats (void);
1015extern void free_gimple_type_tables (void);
1016extern tree gimple_unsigned_type (tree);
1017extern tree gimple_signed_type (tree);
1018extern alias_set_type gimple_get_alias_set (tree);
1019extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
1020 unsigned *);
1021extern bool walk_stmt_load_store_addr_ops (gimple, void *,
1022 bool (*)(gimple, tree, void *),
1023 bool (*)(gimple, tree, void *),
1024 bool (*)(gimple, tree, void *));
1025extern bool walk_stmt_load_store_ops (gimple, void *,
1026 bool (*)(gimple, tree, void *),
1027 bool (*)(gimple, tree, void *));
1028extern bool gimple_ior_addresses_taken (bitmap, gimple);
5ce9237c 1029extern bool gimple_call_builtin_class_p (gimple, enum built_in_class);
e4b17023
JM
1030extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1031extern bool gimple_asm_clobbers_memory_p (const_gimple);
1032
1033/* In gimplify.c */
1034extern tree create_tmp_var_raw (tree, const char *);
1035extern tree create_tmp_var_name (const char *);
1036extern tree create_tmp_var (tree, const char *);
1037extern tree create_tmp_reg (tree, const char *);
1038extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
1039extern tree get_formal_tmp_var (tree, gimple_seq *);
1040extern void declare_vars (tree, gimple, bool);
1041extern void annotate_all_with_location (gimple_seq, location_t);
1042
1043/* Validation of GIMPLE expressions. Note that these predicates only check
1044 the basic form of the expression, they don't recurse to make sure that
1045 underlying nodes are also of the right form. */
1046typedef bool (*gimple_predicate)(tree);
1047
1048
1049/* FIXME we should deduce this from the predicate. */
1050enum fallback {
1051 fb_none = 0, /* Do not generate a temporary. */
1052
1053 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1054 gimplified expression. */
1055
1056 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1057 gimplified expression. */
1058
1059 fb_mayfail = 4, /* Gimplification may fail. Error issued
1060 afterwards. */
1061 fb_either= fb_rvalue | fb_lvalue
1062};
1063
1064typedef int fallback_t;
1065
1066enum gimplify_status {
1067 GS_ERROR = -2, /* Something Bad Seen. */
1068 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1069 GS_OK = 0, /* We did something, maybe more to do. */
1070 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1071};
1072
1073struct gimplify_ctx
1074{
1075 struct gimplify_ctx *prev_context;
1076
1077 VEC(gimple,heap) *bind_expr_stack;
1078 tree temps;
1079 gimple_seq conditional_cleanups;
1080 tree exit_label;
1081 tree return_temp;
1082
1083 VEC(tree,heap) *case_labels;
1084 /* The formal temporary table. Should this be persistent? */
1085 htab_t temp_htab;
1086
1087 int conditions;
1088 bool save_stack;
1089 bool into_ssa;
1090 bool allow_rhs_cond_expr;
1091 bool in_cleanup_point_expr;
1092};
1093
5ce9237c
JM
1094/* Return true if gimplify_one_sizepos doesn't need to gimplify
1095 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1096 fields). */
1097static inline bool
1098is_gimple_sizepos (tree expr)
1099{
1100 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1101 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1102 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1103 function, the gimplifier will want to replace it with a new variable,
1104 but that will cause problems if this type is from outside the function.
1105 It's OK to have that here. */
1106 return (expr == NULL_TREE
1107 || TREE_CONSTANT (expr)
1108 || TREE_CODE (expr) == VAR_DECL
1109 || CONTAINS_PLACEHOLDER_P (expr));
1110}
1111
e4b17023
JM
1112extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1113 bool (*) (tree), fallback_t);
1114extern void gimplify_type_sizes (tree, gimple_seq *);
1115extern void gimplify_one_sizepos (tree *, gimple_seq *);
1116extern bool gimplify_stmt (tree *, gimple_seq *);
1117extern gimple gimplify_body (tree, bool);
1118extern void push_gimplify_context (struct gimplify_ctx *);
1119extern void pop_gimplify_context (gimple);
1120extern void gimplify_and_add (tree, gimple_seq *);
1121
1122/* Miscellaneous helpers. */
1123extern void gimple_add_tmp_var (tree);
1124extern gimple gimple_current_bind_expr (void);
1125extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1126extern tree voidify_wrapper_expr (tree, tree);
1127extern tree build_and_jump (tree *);
1128extern tree force_labels_r (tree *, int *, void *);
1129extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1130 gimple_seq *);
1131struct gimplify_omp_ctx;
1132extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1133extern tree gimple_boolify (tree);
1134extern gimple_predicate rhs_predicate_for (tree);
1135extern tree canonicalize_cond_expr_cond (tree);
1136
1137/* In omp-low.c. */
1138extern tree omp_reduction_init (tree, tree);
1139
1140/* In trans-mem.c. */
1141extern void diagnose_tm_safe_errors (tree);
1142extern void compute_transaction_bits (void);
1143
1144/* In tree-nested.c. */
1145extern void lower_nested_functions (tree);
1146extern void insert_field_into_struct (tree, tree);
1147
1148/* In gimplify.c. */
1149extern void gimplify_function_tree (tree);
1150
1151/* In cfgexpand.c. */
1152extern tree gimple_assign_rhs_to_tree (gimple);
1153
1154/* In builtins.c */
1155extern bool validate_gimple_arglist (const_gimple, ...);
1156
1157/* In tree-ssa.c */
1158extern bool tree_ssa_useless_type_conversion (tree);
1159extern tree tree_ssa_strip_useless_type_conversions (tree);
1160extern bool useless_type_conversion_p (tree, tree);
1161extern bool types_compatible_p (tree, tree);
1162
1163/* Return the code for GIMPLE statement G. */
1164
1165static inline enum gimple_code
1166gimple_code (const_gimple g)
1167{
1168 return g->gsbase.code;
1169}
1170
1171
1172/* Return the GSS code used by a GIMPLE code. */
1173
1174static inline enum gimple_statement_structure_enum
1175gss_for_code (enum gimple_code code)
1176{
1177 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1178 return gss_for_code_[code];
1179}
1180
1181
1182/* Return which GSS code is used by GS. */
1183
1184static inline enum gimple_statement_structure_enum
1185gimple_statement_structure (gimple gs)
1186{
1187 return gss_for_code (gimple_code (gs));
1188}
1189
1190
1191/* Return true if statement G has sub-statements. This is only true for
1192 High GIMPLE statements. */
1193
1194static inline bool
1195gimple_has_substatements (gimple g)
1196{
1197 switch (gimple_code (g))
1198 {
1199 case GIMPLE_BIND:
1200 case GIMPLE_CATCH:
1201 case GIMPLE_EH_FILTER:
1202 case GIMPLE_EH_ELSE:
1203 case GIMPLE_TRY:
1204 case GIMPLE_OMP_FOR:
1205 case GIMPLE_OMP_MASTER:
1206 case GIMPLE_OMP_ORDERED:
1207 case GIMPLE_OMP_SECTION:
1208 case GIMPLE_OMP_PARALLEL:
1209 case GIMPLE_OMP_TASK:
1210 case GIMPLE_OMP_SECTIONS:
1211 case GIMPLE_OMP_SINGLE:
1212 case GIMPLE_OMP_CRITICAL:
1213 case GIMPLE_WITH_CLEANUP_EXPR:
1214 case GIMPLE_TRANSACTION:
1215 return true;
1216
1217 default:
1218 return false;
1219 }
1220}
1221
1222
1223/* Return the basic block holding statement G. */
1224
1225static inline struct basic_block_def *
1226gimple_bb (const_gimple g)
1227{
1228 return g->gsbase.bb;
1229}
1230
1231
1232/* Return the lexical scope block holding statement G. */
1233
1234static inline tree
1235gimple_block (const_gimple g)
1236{
1237 return g->gsbase.block;
1238}
1239
1240
1241/* Set BLOCK to be the lexical scope block holding statement G. */
1242
1243static inline void
1244gimple_set_block (gimple g, tree block)
1245{
1246 g->gsbase.block = block;
1247}
1248
1249
1250/* Return location information for statement G. */
1251
1252static inline location_t
1253gimple_location (const_gimple g)
1254{
1255 return g->gsbase.location;
1256}
1257
1258/* Return pointer to location information for statement G. */
1259
1260static inline const location_t *
1261gimple_location_ptr (const_gimple g)
1262{
1263 return &g->gsbase.location;
1264}
1265
1266
1267/* Set location information for statement G. */
1268
1269static inline void
1270gimple_set_location (gimple g, location_t location)
1271{
1272 g->gsbase.location = location;
1273}
1274
1275
1276/* Return true if G contains location information. */
1277
1278static inline bool
1279gimple_has_location (const_gimple g)
1280{
1281 return gimple_location (g) != UNKNOWN_LOCATION;
1282}
1283
1284
1285/* Return the file name of the location of STMT. */
1286
1287static inline const char *
1288gimple_filename (const_gimple stmt)
1289{
1290 return LOCATION_FILE (gimple_location (stmt));
1291}
1292
1293
1294/* Return the line number of the location of STMT. */
1295
1296static inline int
1297gimple_lineno (const_gimple stmt)
1298{
1299 return LOCATION_LINE (gimple_location (stmt));
1300}
1301
1302
1303/* Determine whether SEQ is a singleton. */
1304
1305static inline bool
1306gimple_seq_singleton_p (gimple_seq seq)
1307{
1308 return ((gimple_seq_first (seq) != NULL)
1309 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1310}
1311
1312/* Return true if no warnings should be emitted for statement STMT. */
1313
1314static inline bool
1315gimple_no_warning_p (const_gimple stmt)
1316{
1317 return stmt->gsbase.no_warning;
1318}
1319
1320/* Set the no_warning flag of STMT to NO_WARNING. */
1321
1322static inline void
1323gimple_set_no_warning (gimple stmt, bool no_warning)
1324{
1325 stmt->gsbase.no_warning = (unsigned) no_warning;
1326}
1327
1328/* Set the visited status on statement STMT to VISITED_P. */
1329
1330static inline void
1331gimple_set_visited (gimple stmt, bool visited_p)
1332{
1333 stmt->gsbase.visited = (unsigned) visited_p;
1334}
1335
1336
1337/* Return the visited status for statement STMT. */
1338
1339static inline bool
1340gimple_visited_p (gimple stmt)
1341{
1342 return stmt->gsbase.visited;
1343}
1344
1345
1346/* Set pass local flag PLF on statement STMT to VAL_P. */
1347
1348static inline void
1349gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1350{
1351 if (val_p)
1352 stmt->gsbase.plf |= (unsigned int) plf;
1353 else
1354 stmt->gsbase.plf &= ~((unsigned int) plf);
1355}
1356
1357
1358/* Return the value of pass local flag PLF on statement STMT. */
1359
1360static inline unsigned int
1361gimple_plf (gimple stmt, enum plf_mask plf)
1362{
1363 return stmt->gsbase.plf & ((unsigned int) plf);
1364}
1365
1366
1367/* Set the UID of statement. */
1368
1369static inline void
1370gimple_set_uid (gimple g, unsigned uid)
1371{
1372 g->gsbase.uid = uid;
1373}
1374
1375
1376/* Return the UID of statement. */
1377
1378static inline unsigned
1379gimple_uid (const_gimple g)
1380{
1381 return g->gsbase.uid;
1382}
1383
1384
1385/* Return true if GIMPLE statement G has register or memory operands. */
1386
1387static inline bool
1388gimple_has_ops (const_gimple g)
1389{
1390 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1391}
1392
1393
1394/* Return true if GIMPLE statement G has memory operands. */
1395
1396static inline bool
1397gimple_has_mem_ops (const_gimple g)
1398{
1399 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1400}
1401
1402
1403/* Return the set of DEF operands for statement G. */
1404
1405static inline struct def_optype_d *
1406gimple_def_ops (const_gimple g)
1407{
1408 if (!gimple_has_ops (g))
1409 return NULL;
1410 return g->gsops.opbase.def_ops;
1411}
1412
1413
1414/* Set DEF to be the set of DEF operands for statement G. */
1415
1416static inline void
1417gimple_set_def_ops (gimple g, struct def_optype_d *def)
1418{
1419 gcc_gimple_checking_assert (gimple_has_ops (g));
1420 g->gsops.opbase.def_ops = def;
1421}
1422
1423
1424/* Return the set of USE operands for statement G. */
1425
1426static inline struct use_optype_d *
1427gimple_use_ops (const_gimple g)
1428{
1429 if (!gimple_has_ops (g))
1430 return NULL;
1431 return g->gsops.opbase.use_ops;
1432}
1433
1434
1435/* Set USE to be the set of USE operands for statement G. */
1436
1437static inline void
1438gimple_set_use_ops (gimple g, struct use_optype_d *use)
1439{
1440 gcc_gimple_checking_assert (gimple_has_ops (g));
1441 g->gsops.opbase.use_ops = use;
1442}
1443
1444
1445/* Return the set of VUSE operand for statement G. */
1446
1447static inline use_operand_p
1448gimple_vuse_op (const_gimple g)
1449{
1450 struct use_optype_d *ops;
1451 if (!gimple_has_mem_ops (g))
1452 return NULL_USE_OPERAND_P;
1453 ops = g->gsops.opbase.use_ops;
1454 if (ops
1455 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1456 return USE_OP_PTR (ops);
1457 return NULL_USE_OPERAND_P;
1458}
1459
1460/* Return the set of VDEF operand for statement G. */
1461
1462static inline def_operand_p
1463gimple_vdef_op (const_gimple g)
1464{
1465 struct def_optype_d *ops;
1466 if (!gimple_has_mem_ops (g))
1467 return NULL_DEF_OPERAND_P;
1468 ops = g->gsops.opbase.def_ops;
1469 if (ops
1470 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1471 return DEF_OP_PTR (ops);
1472 return NULL_DEF_OPERAND_P;
1473}
1474
1475
1476/* Return the single VUSE operand of the statement G. */
1477
1478static inline tree
1479gimple_vuse (const_gimple g)
1480{
1481 if (!gimple_has_mem_ops (g))
1482 return NULL_TREE;
1483 return g->gsmembase.vuse;
1484}
1485
1486/* Return the single VDEF operand of the statement G. */
1487
1488static inline tree
1489gimple_vdef (const_gimple g)
1490{
1491 if (!gimple_has_mem_ops (g))
1492 return NULL_TREE;
1493 return g->gsmembase.vdef;
1494}
1495
1496/* Return the single VUSE operand of the statement G. */
1497
1498static inline tree *
1499gimple_vuse_ptr (gimple g)
1500{
1501 if (!gimple_has_mem_ops (g))
1502 return NULL;
1503 return &g->gsmembase.vuse;
1504}
1505
1506/* Return the single VDEF operand of the statement G. */
1507
1508static inline tree *
1509gimple_vdef_ptr (gimple g)
1510{
1511 if (!gimple_has_mem_ops (g))
1512 return NULL;
1513 return &g->gsmembase.vdef;
1514}
1515
1516/* Set the single VUSE operand of the statement G. */
1517
1518static inline void
1519gimple_set_vuse (gimple g, tree vuse)
1520{
1521 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1522 g->gsmembase.vuse = vuse;
1523}
1524
1525/* Set the single VDEF operand of the statement G. */
1526
1527static inline void
1528gimple_set_vdef (gimple g, tree vdef)
1529{
1530 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1531 g->gsmembase.vdef = vdef;
1532}
1533
1534
1535/* Return true if statement G has operands and the modified field has
1536 been set. */
1537
1538static inline bool
1539gimple_modified_p (const_gimple g)
1540{
1541 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1542}
1543
1544
1545/* Return the tree code for the expression computed by STMT. This is
1546 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1547 GIMPLE_CALL, return CALL_EXPR as the expression code for
1548 consistency. This is useful when the caller needs to deal with the
1549 three kinds of computation that GIMPLE supports. */
1550
1551static inline enum tree_code
1552gimple_expr_code (const_gimple stmt)
1553{
1554 enum gimple_code code = gimple_code (stmt);
1555 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1556 return (enum tree_code) stmt->gsbase.subcode;
1557 else
1558 {
1559 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1560 return CALL_EXPR;
1561 }
1562}
1563
1564
1565/* Mark statement S as modified, and update it. */
1566
1567static inline void
1568update_stmt (gimple s)
1569{
1570 if (gimple_has_ops (s))
1571 {
1572 gimple_set_modified (s, true);
1573 update_stmt_operands (s);
1574 }
1575}
1576
1577/* Update statement S if it has been optimized. */
1578
1579static inline void
1580update_stmt_if_modified (gimple s)
1581{
1582 if (gimple_modified_p (s))
1583 update_stmt_operands (s);
1584}
1585
1586/* Return true if statement STMT contains volatile operands. */
1587
1588static inline bool
1589gimple_has_volatile_ops (const_gimple stmt)
1590{
1591 if (gimple_has_mem_ops (stmt))
1592 return stmt->gsbase.has_volatile_ops;
1593 else
1594 return false;
1595}
1596
1597
1598/* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1599
1600static inline void
1601gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1602{
1603 if (gimple_has_mem_ops (stmt))
1604 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1605}
1606
1607/* Return true if BB is in a transaction. */
1608
1609static inline bool
1610block_in_transaction (basic_block bb)
1611{
1612 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1613}
1614
1615/* Return true if STMT is in a transaction. */
1616
1617static inline bool
1618gimple_in_transaction (gimple stmt)
1619{
1620 return block_in_transaction (gimple_bb (stmt));
1621}
1622
1623/* Return true if statement STMT may access memory. */
1624
1625static inline bool
1626gimple_references_memory_p (gimple stmt)
1627{
1628 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1629}
1630
1631
1632/* Return the subcode for OMP statement S. */
1633
1634static inline unsigned
1635gimple_omp_subcode (const_gimple s)
1636{
1637 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1638 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1639 return s->gsbase.subcode;
1640}
1641
1642/* Set the subcode for OMP statement S to SUBCODE. */
1643
1644static inline void
1645gimple_omp_set_subcode (gimple s, unsigned int subcode)
1646{
1647 /* We only have 16 bits for the subcode. Assert that we are not
1648 overflowing it. */
1649 gcc_gimple_checking_assert (subcode < (1 << 16));
1650 s->gsbase.subcode = subcode;
1651}
1652
1653/* Set the nowait flag on OMP_RETURN statement S. */
1654
1655static inline void
1656gimple_omp_return_set_nowait (gimple s)
1657{
1658 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1659 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1660}
1661
1662
1663/* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1664 flag set. */
1665
1666static inline bool
1667gimple_omp_return_nowait_p (const_gimple g)
1668{
1669 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1670 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1671}
1672
1673
1674/* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1675 flag set. */
1676
1677static inline bool
1678gimple_omp_section_last_p (const_gimple g)
1679{
1680 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1681 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1682}
1683
1684
1685/* Set the GF_OMP_SECTION_LAST flag on G. */
1686
1687static inline void
1688gimple_omp_section_set_last (gimple g)
1689{
1690 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1691 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1692}
1693
1694
1695/* Return true if OMP parallel statement G has the
1696 GF_OMP_PARALLEL_COMBINED flag set. */
1697
1698static inline bool
1699gimple_omp_parallel_combined_p (const_gimple g)
1700{
1701 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1702 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1703}
1704
1705
1706/* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1707 value of COMBINED_P. */
1708
1709static inline void
1710gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1711{
1712 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1713 if (combined_p)
1714 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1715 else
1716 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1717}
1718
1719
1720/* Return true if OMP atomic load/store statement G has the
1721 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1722
1723static inline bool
1724gimple_omp_atomic_need_value_p (const_gimple g)
1725{
1726 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1727 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1728 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1729}
1730
1731
1732/* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1733
1734static inline void
1735gimple_omp_atomic_set_need_value (gimple g)
1736{
1737 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1738 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1739 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1740}
1741
1742
1743/* Return the number of operands for statement GS. */
1744
1745static inline unsigned
1746gimple_num_ops (const_gimple gs)
1747{
1748 return gs->gsbase.num_ops;
1749}
1750
1751
1752/* Set the number of operands for statement GS. */
1753
1754static inline void
1755gimple_set_num_ops (gimple gs, unsigned num_ops)
1756{
1757 gs->gsbase.num_ops = num_ops;
1758}
1759
1760
1761/* Return the array of operands for statement GS. */
1762
1763static inline tree *
1764gimple_ops (gimple gs)
1765{
1766 size_t off;
1767
1768 /* All the tuples have their operand vector at the very bottom
1769 of the structure. Note that those structures that do not
1770 have an operand vector have a zero offset. */
1771 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1772 gcc_gimple_checking_assert (off != 0);
1773
1774 return (tree *) ((char *) gs + off);
1775}
1776
1777
1778/* Return operand I for statement GS. */
1779
1780static inline tree
1781gimple_op (const_gimple gs, unsigned i)
1782{
1783 if (gimple_has_ops (gs))
1784 {
1785 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1786 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1787 }
1788 else
1789 return NULL_TREE;
1790}
1791
1792/* Return a pointer to operand I for statement GS. */
1793
1794static inline tree *
1795gimple_op_ptr (const_gimple gs, unsigned i)
1796{
1797 if (gimple_has_ops (gs))
1798 {
1799 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1800 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1801 }
1802 else
1803 return NULL;
1804}
1805
1806/* Set operand I of statement GS to OP. */
1807
1808static inline void
1809gimple_set_op (gimple gs, unsigned i, tree op)
1810{
1811 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1812
1813 /* Note. It may be tempting to assert that OP matches
1814 is_gimple_operand, but that would be wrong. Different tuples
1815 accept slightly different sets of tree operands. Each caller
1816 should perform its own validation. */
1817 gimple_ops (gs)[i] = op;
1818}
1819
1820/* Return true if GS is a GIMPLE_ASSIGN. */
1821
1822static inline bool
1823is_gimple_assign (const_gimple gs)
1824{
1825 return gimple_code (gs) == GIMPLE_ASSIGN;
1826}
1827
1828/* Determine if expression CODE is one of the valid expressions that can
1829 be used on the RHS of GIMPLE assignments. */
1830
1831static inline enum gimple_rhs_class
1832get_gimple_rhs_class (enum tree_code code)
1833{
1834 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1835}
1836
1837/* Return the LHS of assignment statement GS. */
1838
1839static inline tree
1840gimple_assign_lhs (const_gimple gs)
1841{
1842 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1843 return gimple_op (gs, 0);
1844}
1845
1846
1847/* Return a pointer to the LHS of assignment statement GS. */
1848
1849static inline tree *
1850gimple_assign_lhs_ptr (const_gimple gs)
1851{
1852 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1853 return gimple_op_ptr (gs, 0);
1854}
1855
1856
1857/* Set LHS to be the LHS operand of assignment statement GS. */
1858
1859static inline void
1860gimple_assign_set_lhs (gimple gs, tree lhs)
1861{
1862 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1863 gimple_set_op (gs, 0, lhs);
1864
1865 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1866 SSA_NAME_DEF_STMT (lhs) = gs;
1867}
1868
1869
1870/* Return the first operand on the RHS of assignment statement GS. */
1871
1872static inline tree
1873gimple_assign_rhs1 (const_gimple gs)
1874{
1875 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1876 return gimple_op (gs, 1);
1877}
1878
1879
1880/* Return a pointer to the first operand on the RHS of assignment
1881 statement GS. */
1882
1883static inline tree *
1884gimple_assign_rhs1_ptr (const_gimple gs)
1885{
1886 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1887 return gimple_op_ptr (gs, 1);
1888}
1889
1890/* Set RHS to be the first operand on the RHS of assignment statement GS. */
1891
1892static inline void
1893gimple_assign_set_rhs1 (gimple gs, tree rhs)
1894{
1895 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1896
1897 gimple_set_op (gs, 1, rhs);
1898}
1899
1900
1901/* Return the second operand on the RHS of assignment statement GS.
1902 If GS does not have two operands, NULL is returned instead. */
1903
1904static inline tree
1905gimple_assign_rhs2 (const_gimple gs)
1906{
1907 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1908
1909 if (gimple_num_ops (gs) >= 3)
1910 return gimple_op (gs, 2);
1911 else
1912 return NULL_TREE;
1913}
1914
1915
1916/* Return a pointer to the second operand on the RHS of assignment
1917 statement GS. */
1918
1919static inline tree *
1920gimple_assign_rhs2_ptr (const_gimple gs)
1921{
1922 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1923 return gimple_op_ptr (gs, 2);
1924}
1925
1926
1927/* Set RHS to be the second operand on the RHS of assignment statement GS. */
1928
1929static inline void
1930gimple_assign_set_rhs2 (gimple gs, tree rhs)
1931{
1932 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1933
1934 gimple_set_op (gs, 2, rhs);
1935}
1936
1937/* Return the third operand on the RHS of assignment statement GS.
1938 If GS does not have two operands, NULL is returned instead. */
1939
1940static inline tree
1941gimple_assign_rhs3 (const_gimple gs)
1942{
1943 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1944
1945 if (gimple_num_ops (gs) >= 4)
1946 return gimple_op (gs, 3);
1947 else
1948 return NULL_TREE;
1949}
1950
1951/* Return a pointer to the third operand on the RHS of assignment
1952 statement GS. */
1953
1954static inline tree *
1955gimple_assign_rhs3_ptr (const_gimple gs)
1956{
1957 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1958 return gimple_op_ptr (gs, 3);
1959}
1960
1961
1962/* Set RHS to be the third operand on the RHS of assignment statement GS. */
1963
1964static inline void
1965gimple_assign_set_rhs3 (gimple gs, tree rhs)
1966{
1967 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1968
1969 gimple_set_op (gs, 3, rhs);
1970}
1971
1972/* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1973 to see only a maximum of two operands. */
1974
1975static inline void
1976gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1977 tree op1, tree op2)
1978{
1979 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1980}
1981
1982/* A wrapper around extract_ops_from_tree_1, for callers which expect
1983 to see only a maximum of two operands. */
1984
1985static inline void
1986extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1987 tree *op1)
1988{
1989 tree op2;
1990 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1991 gcc_assert (op2 == NULL_TREE);
1992}
1993
1994/* Returns true if GS is a nontemporal move. */
1995
1996static inline bool
1997gimple_assign_nontemporal_move_p (const_gimple gs)
1998{
1999 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2000 return gs->gsbase.nontemporal_move;
2001}
2002
2003/* Sets nontemporal move flag of GS to NONTEMPORAL. */
2004
2005static inline void
2006gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2007{
2008 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2009 gs->gsbase.nontemporal_move = nontemporal;
2010}
2011
2012
2013/* Return the code of the expression computed on the rhs of assignment
2014 statement GS. In case that the RHS is a single object, returns the
2015 tree code of the object. */
2016
2017static inline enum tree_code
2018gimple_assign_rhs_code (const_gimple gs)
2019{
2020 enum tree_code code;
2021 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2022
2023 code = (enum tree_code) gs->gsbase.subcode;
2024 /* While we initially set subcode to the TREE_CODE of the rhs for
2025 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2026 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2027 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2028 code = TREE_CODE (gimple_assign_rhs1 (gs));
2029
2030 return code;
2031}
2032
2033
2034/* Set CODE to be the code for the expression computed on the RHS of
2035 assignment S. */
2036
2037static inline void
2038gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2039{
2040 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2041 s->gsbase.subcode = code;
2042}
2043
2044
2045/* Return the gimple rhs class of the code of the expression computed on
2046 the rhs of assignment statement GS.
2047 This will never return GIMPLE_INVALID_RHS. */
2048
2049static inline enum gimple_rhs_class
2050gimple_assign_rhs_class (const_gimple gs)
2051{
2052 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2053}
2054
2055/* Return true if GS is an assignment with a singleton RHS, i.e.,
2056 there is no operator associated with the assignment itself.
2057 Unlike gimple_assign_copy_p, this predicate returns true for
2058 any RHS operand, including those that perform an operation
2059 and do not have the semantics of a copy, such as COND_EXPR. */
2060
2061static inline bool
2062gimple_assign_single_p (gimple gs)
2063{
2064 return (is_gimple_assign (gs)
2065 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2066}
2067
2068
2069/* Return true if S is a type-cast assignment. */
2070
2071static inline bool
2072gimple_assign_cast_p (gimple s)
2073{
2074 if (is_gimple_assign (s))
2075 {
2076 enum tree_code sc = gimple_assign_rhs_code (s);
2077 return CONVERT_EXPR_CODE_P (sc)
2078 || sc == VIEW_CONVERT_EXPR
2079 || sc == FIX_TRUNC_EXPR;
2080 }
2081
2082 return false;
2083}
2084
2085/* Return true if S is a clobber statement. */
2086
2087static inline bool
2088gimple_clobber_p (gimple s)
2089{
2090 return gimple_assign_single_p (s)
2091 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2092}
2093
2094/* Return true if GS is a GIMPLE_CALL. */
2095
2096static inline bool
2097is_gimple_call (const_gimple gs)
2098{
2099 return gimple_code (gs) == GIMPLE_CALL;
2100}
2101
2102/* Return the LHS of call statement GS. */
2103
2104static inline tree
2105gimple_call_lhs (const_gimple gs)
2106{
2107 GIMPLE_CHECK (gs, GIMPLE_CALL);
2108 return gimple_op (gs, 0);
2109}
2110
2111
2112/* Return a pointer to the LHS of call statement GS. */
2113
2114static inline tree *
2115gimple_call_lhs_ptr (const_gimple gs)
2116{
2117 GIMPLE_CHECK (gs, GIMPLE_CALL);
2118 return gimple_op_ptr (gs, 0);
2119}
2120
2121
2122/* Set LHS to be the LHS operand of call statement GS. */
2123
2124static inline void
2125gimple_call_set_lhs (gimple gs, tree lhs)
2126{
2127 GIMPLE_CHECK (gs, GIMPLE_CALL);
2128 gimple_set_op (gs, 0, lhs);
2129 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2130 SSA_NAME_DEF_STMT (lhs) = gs;
2131}
2132
2133
2134/* Return true if call GS calls an internal-only function, as enumerated
2135 by internal_fn. */
2136
2137static inline bool
2138gimple_call_internal_p (const_gimple gs)
2139{
2140 GIMPLE_CHECK (gs, GIMPLE_CALL);
2141 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2142}
2143
2144
2145/* Return the target of internal call GS. */
2146
2147static inline enum internal_fn
2148gimple_call_internal_fn (const_gimple gs)
2149{
2150 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2151 return gs->gimple_call.u.internal_fn;
2152}
2153
2154
2155/* Return the function type of the function called by GS. */
2156
2157static inline tree
2158gimple_call_fntype (const_gimple gs)
2159{
2160 GIMPLE_CHECK (gs, GIMPLE_CALL);
2161 if (gimple_call_internal_p (gs))
2162 return NULL_TREE;
2163 return gs->gimple_call.u.fntype;
2164}
2165
2166/* Set the type of the function called by GS to FNTYPE. */
2167
2168static inline void
2169gimple_call_set_fntype (gimple gs, tree fntype)
2170{
2171 GIMPLE_CHECK (gs, GIMPLE_CALL);
2172 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2173 gs->gimple_call.u.fntype = fntype;
2174}
2175
2176
2177/* Return the tree node representing the function called by call
2178 statement GS. */
2179
2180static inline tree
2181gimple_call_fn (const_gimple gs)
2182{
2183 GIMPLE_CHECK (gs, GIMPLE_CALL);
2184 return gimple_op (gs, 1);
2185}
2186
2187/* Return a pointer to the tree node representing the function called by call
2188 statement GS. */
2189
2190static inline tree *
2191gimple_call_fn_ptr (const_gimple gs)
2192{
2193 GIMPLE_CHECK (gs, GIMPLE_CALL);
2194 return gimple_op_ptr (gs, 1);
2195}
2196
2197
2198/* Set FN to be the function called by call statement GS. */
2199
2200static inline void
2201gimple_call_set_fn (gimple gs, tree fn)
2202{
2203 GIMPLE_CHECK (gs, GIMPLE_CALL);
2204 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2205 gimple_set_op (gs, 1, fn);
2206}
2207
2208
2209/* Set FNDECL to be the function called by call statement GS. */
2210
2211static inline void
2212gimple_call_set_fndecl (gimple gs, tree decl)
2213{
2214 GIMPLE_CHECK (gs, GIMPLE_CALL);
2215 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2216 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2217}
2218
2219
2220/* Set internal function FN to be the function called by call statement GS. */
2221
2222static inline void
2223gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2224{
2225 GIMPLE_CHECK (gs, GIMPLE_CALL);
2226 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2227 gs->gimple_call.u.internal_fn = fn;
2228}
2229
2230
2231/* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2232 associated with the callee if known. Otherwise return NULL_TREE. */
2233
2234static inline tree
2235gimple_call_addr_fndecl (const_tree fn)
2236{
2237 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2238 {
2239 tree fndecl = TREE_OPERAND (fn, 0);
2240 if (TREE_CODE (fndecl) == MEM_REF
2241 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2242 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2243 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2244 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2245 return fndecl;
2246 }
2247 return NULL_TREE;
2248}
2249
2250/* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2251 Otherwise return NULL. This function is analogous to
2252 get_callee_fndecl in tree land. */
2253
2254static inline tree
2255gimple_call_fndecl (const_gimple gs)
2256{
2257 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2258}
2259
2260
2261/* Return the type returned by call statement GS. */
2262
2263static inline tree
2264gimple_call_return_type (const_gimple gs)
2265{
2266 tree type = gimple_call_fntype (gs);
2267
2268 if (type == NULL_TREE)
2269 return TREE_TYPE (gimple_call_lhs (gs));
2270
2271 /* The type returned by a function is the type of its
2272 function type. */
2273 return TREE_TYPE (type);
2274}
2275
2276
2277/* Return the static chain for call statement GS. */
2278
2279static inline tree
2280gimple_call_chain (const_gimple gs)
2281{
2282 GIMPLE_CHECK (gs, GIMPLE_CALL);
2283 return gimple_op (gs, 2);
2284}
2285
2286
2287/* Return a pointer to the static chain for call statement GS. */
2288
2289static inline tree *
2290gimple_call_chain_ptr (const_gimple gs)
2291{
2292 GIMPLE_CHECK (gs, GIMPLE_CALL);
2293 return gimple_op_ptr (gs, 2);
2294}
2295
2296/* Set CHAIN to be the static chain for call statement GS. */
2297
2298static inline void
2299gimple_call_set_chain (gimple gs, tree chain)
2300{
2301 GIMPLE_CHECK (gs, GIMPLE_CALL);
2302
2303 gimple_set_op (gs, 2, chain);
2304}
2305
2306
2307/* Return the number of arguments used by call statement GS. */
2308
2309static inline unsigned
2310gimple_call_num_args (const_gimple gs)
2311{
2312 unsigned num_ops;
2313 GIMPLE_CHECK (gs, GIMPLE_CALL);
2314 num_ops = gimple_num_ops (gs);
2315 return num_ops - 3;
2316}
2317
2318
2319/* Return the argument at position INDEX for call statement GS. */
2320
2321static inline tree
2322gimple_call_arg (const_gimple gs, unsigned index)
2323{
2324 GIMPLE_CHECK (gs, GIMPLE_CALL);
2325 return gimple_op (gs, index + 3);
2326}
2327
2328
2329/* Return a pointer to the argument at position INDEX for call
2330 statement GS. */
2331
2332static inline tree *
2333gimple_call_arg_ptr (const_gimple gs, unsigned index)
2334{
2335 GIMPLE_CHECK (gs, GIMPLE_CALL);
2336 return gimple_op_ptr (gs, index + 3);
2337}
2338
2339
2340/* Set ARG to be the argument at position INDEX for call statement GS. */
2341
2342static inline void
2343gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2344{
2345 GIMPLE_CHECK (gs, GIMPLE_CALL);
2346 gimple_set_op (gs, index + 3, arg);
2347}
2348
2349
2350/* If TAIL_P is true, mark call statement S as being a tail call
2351 (i.e., a call just before the exit of a function). These calls are
2352 candidate for tail call optimization. */
2353
2354static inline void
2355gimple_call_set_tail (gimple s, bool tail_p)
2356{
2357 GIMPLE_CHECK (s, GIMPLE_CALL);
2358 if (tail_p)
2359 s->gsbase.subcode |= GF_CALL_TAILCALL;
2360 else
2361 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2362}
2363
2364
2365/* Return true if GIMPLE_CALL S is marked as a tail call. */
2366
2367static inline bool
2368gimple_call_tail_p (gimple s)
2369{
2370 GIMPLE_CHECK (s, GIMPLE_CALL);
2371 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2372}
2373
2374
2375/* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2376 slot optimization. This transformation uses the target of the call
2377 expansion as the return slot for calls that return in memory. */
2378
2379static inline void
2380gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2381{
2382 GIMPLE_CHECK (s, GIMPLE_CALL);
2383 if (return_slot_opt_p)
2384 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2385 else
2386 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2387}
2388
2389
2390/* Return true if S is marked for return slot optimization. */
2391
2392static inline bool
2393gimple_call_return_slot_opt_p (gimple s)
2394{
2395 GIMPLE_CHECK (s, GIMPLE_CALL);
2396 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2397}
2398
2399
2400/* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2401 thunk to the thunked-to function. */
2402
2403static inline void
2404gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2405{
2406 GIMPLE_CHECK (s, GIMPLE_CALL);
2407 if (from_thunk_p)
2408 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2409 else
2410 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2411}
2412
2413
2414/* Return true if GIMPLE_CALL S is a jump from a thunk. */
2415
2416static inline bool
2417gimple_call_from_thunk_p (gimple s)
2418{
2419 GIMPLE_CHECK (s, GIMPLE_CALL);
2420 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2421}
2422
2423
2424/* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2425 argument pack in its argument list. */
2426
2427static inline void
2428gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2429{
2430 GIMPLE_CHECK (s, GIMPLE_CALL);
2431 if (pass_arg_pack_p)
2432 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2433 else
2434 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2435}
2436
2437
2438/* Return true if GIMPLE_CALL S is a stdarg call that needs the
2439 argument pack in its argument list. */
2440
2441static inline bool
2442gimple_call_va_arg_pack_p (gimple s)
2443{
2444 GIMPLE_CHECK (s, GIMPLE_CALL);
2445 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2446}
2447
2448
2449/* Return true if S is a noreturn call. */
2450
2451static inline bool
2452gimple_call_noreturn_p (gimple s)
2453{
2454 GIMPLE_CHECK (s, GIMPLE_CALL);
2455 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2456}
2457
2458
2459/* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2460 even if the called function can throw in other cases. */
2461
2462static inline void
2463gimple_call_set_nothrow (gimple s, bool nothrow_p)
2464{
2465 GIMPLE_CHECK (s, GIMPLE_CALL);
2466 if (nothrow_p)
2467 s->gsbase.subcode |= GF_CALL_NOTHROW;
2468 else
2469 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2470}
2471
2472/* Return true if S is a nothrow call. */
2473
2474static inline bool
2475gimple_call_nothrow_p (gimple s)
2476{
2477 GIMPLE_CHECK (s, GIMPLE_CALL);
2478 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2479}
2480
2481/* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2482 is known to be emitted for VLA objects. Those are wrapped by
2483 stack_save/stack_restore calls and hence can't lead to unbounded
2484 stack growth even when they occur in loops. */
2485
2486static inline void
2487gimple_call_set_alloca_for_var (gimple s, bool for_var)
2488{
2489 GIMPLE_CHECK (s, GIMPLE_CALL);
2490 if (for_var)
2491 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2492 else
2493 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2494}
2495
2496/* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2497
2498static inline bool
2499gimple_call_alloca_for_var_p (gimple s)
2500{
2501 GIMPLE_CHECK (s, GIMPLE_CALL);
2502 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2503}
2504
2505/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2506
2507static inline void
2508gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2509{
2510 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2511 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2512 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2513}
2514
2515
2516/* Return a pointer to the points-to solution for the set of call-used
2517 variables of the call CALL. */
2518
2519static inline struct pt_solution *
2520gimple_call_use_set (gimple call)
2521{
2522 GIMPLE_CHECK (call, GIMPLE_CALL);
2523 return &call->gimple_call.call_used;
2524}
2525
2526
2527/* Return a pointer to the points-to solution for the set of call-used
2528 variables of the call CALL. */
2529
2530static inline struct pt_solution *
2531gimple_call_clobber_set (gimple call)
2532{
2533 GIMPLE_CHECK (call, GIMPLE_CALL);
2534 return &call->gimple_call.call_clobbered;
2535}
2536
2537
2538/* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2539 non-NULL lhs. */
2540
2541static inline bool
2542gimple_has_lhs (gimple stmt)
2543{
2544 return (is_gimple_assign (stmt)
2545 || (is_gimple_call (stmt)
2546 && gimple_call_lhs (stmt) != NULL_TREE));
2547}
2548
2549
2550/* Return the code of the predicate computed by conditional statement GS. */
2551
2552static inline enum tree_code
2553gimple_cond_code (const_gimple gs)
2554{
2555 GIMPLE_CHECK (gs, GIMPLE_COND);
2556 return (enum tree_code) gs->gsbase.subcode;
2557}
2558
2559
2560/* Set CODE to be the predicate code for the conditional statement GS. */
2561
2562static inline void
2563gimple_cond_set_code (gimple gs, enum tree_code code)
2564{
2565 GIMPLE_CHECK (gs, GIMPLE_COND);
2566 gs->gsbase.subcode = code;
2567}
2568
2569
2570/* Return the LHS of the predicate computed by conditional statement GS. */
2571
2572static inline tree
2573gimple_cond_lhs (const_gimple gs)
2574{
2575 GIMPLE_CHECK (gs, GIMPLE_COND);
2576 return gimple_op (gs, 0);
2577}
2578
2579/* Return the pointer to the LHS of the predicate computed by conditional
2580 statement GS. */
2581
2582static inline tree *
2583gimple_cond_lhs_ptr (const_gimple gs)
2584{
2585 GIMPLE_CHECK (gs, GIMPLE_COND);
2586 return gimple_op_ptr (gs, 0);
2587}
2588
2589/* Set LHS to be the LHS operand of the predicate computed by
2590 conditional statement GS. */
2591
2592static inline void
2593gimple_cond_set_lhs (gimple gs, tree lhs)
2594{
2595 GIMPLE_CHECK (gs, GIMPLE_COND);
2596 gimple_set_op (gs, 0, lhs);
2597}
2598
2599
2600/* Return the RHS operand of the predicate computed by conditional GS. */
2601
2602static inline tree
2603gimple_cond_rhs (const_gimple gs)
2604{
2605 GIMPLE_CHECK (gs, GIMPLE_COND);
2606 return gimple_op (gs, 1);
2607}
2608
2609/* Return the pointer to the RHS operand of the predicate computed by
2610 conditional GS. */
2611
2612static inline tree *
2613gimple_cond_rhs_ptr (const_gimple gs)
2614{
2615 GIMPLE_CHECK (gs, GIMPLE_COND);
2616 return gimple_op_ptr (gs, 1);
2617}
2618
2619
2620/* Set RHS to be the RHS operand of the predicate computed by
2621 conditional statement GS. */
2622
2623static inline void
2624gimple_cond_set_rhs (gimple gs, tree rhs)
2625{
2626 GIMPLE_CHECK (gs, GIMPLE_COND);
2627 gimple_set_op (gs, 1, rhs);
2628}
2629
2630
2631/* Return the label used by conditional statement GS when its
2632 predicate evaluates to true. */
2633
2634static inline tree
2635gimple_cond_true_label (const_gimple gs)
2636{
2637 GIMPLE_CHECK (gs, GIMPLE_COND);
2638 return gimple_op (gs, 2);
2639}
2640
2641
2642/* Set LABEL to be the label used by conditional statement GS when its
2643 predicate evaluates to true. */
2644
2645static inline void
2646gimple_cond_set_true_label (gimple gs, tree label)
2647{
2648 GIMPLE_CHECK (gs, GIMPLE_COND);
2649 gimple_set_op (gs, 2, label);
2650}
2651
2652
2653/* Set LABEL to be the label used by conditional statement GS when its
2654 predicate evaluates to false. */
2655
2656static inline void
2657gimple_cond_set_false_label (gimple gs, tree label)
2658{
2659 GIMPLE_CHECK (gs, GIMPLE_COND);
2660 gimple_set_op (gs, 3, label);
2661}
2662
2663
2664/* Return the label used by conditional statement GS when its
2665 predicate evaluates to false. */
2666
2667static inline tree
2668gimple_cond_false_label (const_gimple gs)
2669{
2670 GIMPLE_CHECK (gs, GIMPLE_COND);
2671 return gimple_op (gs, 3);
2672}
2673
2674
2675/* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2676
2677static inline void
2678gimple_cond_make_false (gimple gs)
2679{
2680 gimple_cond_set_lhs (gs, boolean_true_node);
2681 gimple_cond_set_rhs (gs, boolean_false_node);
2682 gs->gsbase.subcode = EQ_EXPR;
2683}
2684
2685
2686/* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2687
2688static inline void
2689gimple_cond_make_true (gimple gs)
2690{
2691 gimple_cond_set_lhs (gs, boolean_true_node);
2692 gimple_cond_set_rhs (gs, boolean_true_node);
2693 gs->gsbase.subcode = EQ_EXPR;
2694}
2695
2696/* Check if conditional statemente GS is of the form 'if (1 == 1)',
2697 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2698
2699static inline bool
2700gimple_cond_true_p (const_gimple gs)
2701{
2702 tree lhs = gimple_cond_lhs (gs);
2703 tree rhs = gimple_cond_rhs (gs);
2704 enum tree_code code = gimple_cond_code (gs);
2705
2706 if (lhs != boolean_true_node && lhs != boolean_false_node)
2707 return false;
2708
2709 if (rhs != boolean_true_node && rhs != boolean_false_node)
2710 return false;
2711
2712 if (code == NE_EXPR && lhs != rhs)
2713 return true;
2714
2715 if (code == EQ_EXPR && lhs == rhs)
2716 return true;
2717
2718 return false;
2719}
2720
2721/* Check if conditional statement GS is of the form 'if (1 != 1)',
2722 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2723
2724static inline bool
2725gimple_cond_false_p (const_gimple gs)
2726{
2727 tree lhs = gimple_cond_lhs (gs);
2728 tree rhs = gimple_cond_rhs (gs);
2729 enum tree_code code = gimple_cond_code (gs);
2730
2731 if (lhs != boolean_true_node && lhs != boolean_false_node)
2732 return false;
2733
2734 if (rhs != boolean_true_node && rhs != boolean_false_node)
2735 return false;
2736
2737 if (code == NE_EXPR && lhs == rhs)
2738 return true;
2739
2740 if (code == EQ_EXPR && lhs != rhs)
2741 return true;
2742
2743 return false;
2744}
2745
2746/* Check if conditional statement GS is of the form 'if (var != 0)' or
2747 'if (var == 1)' */
2748
2749static inline bool
2750gimple_cond_single_var_p (gimple gs)
2751{
2752 if (gimple_cond_code (gs) == NE_EXPR
2753 && gimple_cond_rhs (gs) == boolean_false_node)
2754 return true;
2755
2756 if (gimple_cond_code (gs) == EQ_EXPR
2757 && gimple_cond_rhs (gs) == boolean_true_node)
2758 return true;
2759
2760 return false;
2761}
2762
2763/* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2764
2765static inline void
2766gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2767{
2768 gimple_cond_set_code (stmt, code);
2769 gimple_cond_set_lhs (stmt, lhs);
2770 gimple_cond_set_rhs (stmt, rhs);
2771}
2772
2773/* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2774
2775static inline tree
2776gimple_label_label (const_gimple gs)
2777{
2778 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2779 return gimple_op (gs, 0);
2780}
2781
2782
2783/* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2784 GS. */
2785
2786static inline void
2787gimple_label_set_label (gimple gs, tree label)
2788{
2789 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2790 gimple_set_op (gs, 0, label);
2791}
2792
2793
2794/* Return the destination of the unconditional jump GS. */
2795
2796static inline tree
2797gimple_goto_dest (const_gimple gs)
2798{
2799 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2800 return gimple_op (gs, 0);
2801}
2802
2803
2804/* Set DEST to be the destination of the unconditonal jump GS. */
2805
2806static inline void
2807gimple_goto_set_dest (gimple gs, tree dest)
2808{
2809 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2810 gimple_set_op (gs, 0, dest);
2811}
2812
2813
2814/* Return the variables declared in the GIMPLE_BIND statement GS. */
2815
2816static inline tree
2817gimple_bind_vars (const_gimple gs)
2818{
2819 GIMPLE_CHECK (gs, GIMPLE_BIND);
2820 return gs->gimple_bind.vars;
2821}
2822
2823
2824/* Set VARS to be the set of variables declared in the GIMPLE_BIND
2825 statement GS. */
2826
2827static inline void
2828gimple_bind_set_vars (gimple gs, tree vars)
2829{
2830 GIMPLE_CHECK (gs, GIMPLE_BIND);
2831 gs->gimple_bind.vars = vars;
2832}
2833
2834
2835/* Append VARS to the set of variables declared in the GIMPLE_BIND
2836 statement GS. */
2837
2838static inline void
2839gimple_bind_append_vars (gimple gs, tree vars)
2840{
2841 GIMPLE_CHECK (gs, GIMPLE_BIND);
2842 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2843}
2844
2845
2846/* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2847
2848static inline gimple_seq
2849gimple_bind_body (gimple gs)
2850{
2851 GIMPLE_CHECK (gs, GIMPLE_BIND);
2852 return gs->gimple_bind.body;
2853}
2854
2855
2856/* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2857 statement GS. */
2858
2859static inline void
2860gimple_bind_set_body (gimple gs, gimple_seq seq)
2861{
2862 GIMPLE_CHECK (gs, GIMPLE_BIND);
2863 gs->gimple_bind.body = seq;
2864}
2865
2866
2867/* Append a statement to the end of a GIMPLE_BIND's body. */
2868
2869static inline void
2870gimple_bind_add_stmt (gimple gs, gimple stmt)
2871{
2872 GIMPLE_CHECK (gs, GIMPLE_BIND);
2873 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2874}
2875
2876
2877/* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2878
2879static inline void
2880gimple_bind_add_seq (gimple gs, gimple_seq seq)
2881{
2882 GIMPLE_CHECK (gs, GIMPLE_BIND);
2883 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2884}
2885
2886
2887/* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2888 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2889
2890static inline tree
2891gimple_bind_block (const_gimple gs)
2892{
2893 GIMPLE_CHECK (gs, GIMPLE_BIND);
2894 return gs->gimple_bind.block;
2895}
2896
2897
2898/* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2899 statement GS. */
2900
2901static inline void
2902gimple_bind_set_block (gimple gs, tree block)
2903{
2904 GIMPLE_CHECK (gs, GIMPLE_BIND);
2905 gcc_gimple_checking_assert (block == NULL_TREE
2906 || TREE_CODE (block) == BLOCK);
2907 gs->gimple_bind.block = block;
2908}
2909
2910
2911/* Return the number of input operands for GIMPLE_ASM GS. */
2912
2913static inline unsigned
2914gimple_asm_ninputs (const_gimple gs)
2915{
2916 GIMPLE_CHECK (gs, GIMPLE_ASM);
2917 return gs->gimple_asm.ni;
2918}
2919
2920
2921/* Return the number of output operands for GIMPLE_ASM GS. */
2922
2923static inline unsigned
2924gimple_asm_noutputs (const_gimple gs)
2925{
2926 GIMPLE_CHECK (gs, GIMPLE_ASM);
2927 return gs->gimple_asm.no;
2928}
2929
2930
2931/* Return the number of clobber operands for GIMPLE_ASM GS. */
2932
2933static inline unsigned
2934gimple_asm_nclobbers (const_gimple gs)
2935{
2936 GIMPLE_CHECK (gs, GIMPLE_ASM);
2937 return gs->gimple_asm.nc;
2938}
2939
2940/* Return the number of label operands for GIMPLE_ASM GS. */
2941
2942static inline unsigned
2943gimple_asm_nlabels (const_gimple gs)
2944{
2945 GIMPLE_CHECK (gs, GIMPLE_ASM);
2946 return gs->gimple_asm.nl;
2947}
2948
2949/* Return input operand INDEX of GIMPLE_ASM GS. */
2950
2951static inline tree
2952gimple_asm_input_op (const_gimple gs, unsigned index)
2953{
2954 GIMPLE_CHECK (gs, GIMPLE_ASM);
2955 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2956 return gimple_op (gs, index);
2957}
2958
2959/* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2960
2961static inline tree *
2962gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2963{
2964 GIMPLE_CHECK (gs, GIMPLE_ASM);
2965 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2966 return gimple_op_ptr (gs, index);
2967}
2968
2969
2970/* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2971
2972static inline void
2973gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2974{
2975 GIMPLE_CHECK (gs, GIMPLE_ASM);
2976 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2977 && TREE_CODE (in_op) == TREE_LIST);
2978 gimple_set_op (gs, index, in_op);
2979}
2980
2981
2982/* Return output operand INDEX of GIMPLE_ASM GS. */
2983
2984static inline tree
2985gimple_asm_output_op (const_gimple gs, unsigned index)
2986{
2987 GIMPLE_CHECK (gs, GIMPLE_ASM);
2988 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2989 return gimple_op (gs, index + gs->gimple_asm.ni);
2990}
2991
2992/* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2993
2994static inline tree *
2995gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2996{
2997 GIMPLE_CHECK (gs, GIMPLE_ASM);
2998 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2999 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
3000}
3001
3002
3003/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3004
3005static inline void
3006gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3007{
3008 GIMPLE_CHECK (gs, GIMPLE_ASM);
3009 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
3010 && TREE_CODE (out_op) == TREE_LIST);
3011 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
3012}
3013
3014
3015/* Return clobber operand INDEX of GIMPLE_ASM GS. */
3016
3017static inline tree
3018gimple_asm_clobber_op (const_gimple gs, unsigned index)
3019{
3020 GIMPLE_CHECK (gs, GIMPLE_ASM);
3021 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
3022 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3023}
3024
3025
3026/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3027
3028static inline void
3029gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3030{
3031 GIMPLE_CHECK (gs, GIMPLE_ASM);
3032 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
3033 && TREE_CODE (clobber_op) == TREE_LIST);
3034 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3035}
3036
3037/* Return label operand INDEX of GIMPLE_ASM GS. */
3038
3039static inline tree
3040gimple_asm_label_op (const_gimple gs, unsigned index)
3041{
3042 GIMPLE_CHECK (gs, GIMPLE_ASM);
3043 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
3044 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3045}
3046
3047/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3048
3049static inline void
3050gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3051{
3052 GIMPLE_CHECK (gs, GIMPLE_ASM);
3053 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
3054 && TREE_CODE (label_op) == TREE_LIST);
3055 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3056}
3057
3058/* Return the string representing the assembly instruction in
3059 GIMPLE_ASM GS. */
3060
3061static inline const char *
3062gimple_asm_string (const_gimple gs)
3063{
3064 GIMPLE_CHECK (gs, GIMPLE_ASM);
3065 return gs->gimple_asm.string;
3066}
3067
3068
3069/* Return true if GS is an asm statement marked volatile. */
3070
3071static inline bool
3072gimple_asm_volatile_p (const_gimple gs)
3073{
3074 GIMPLE_CHECK (gs, GIMPLE_ASM);
3075 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3076}
3077
3078
3079/* If VOLATLE_P is true, mark asm statement GS as volatile. */
3080
3081static inline void
3082gimple_asm_set_volatile (gimple gs, bool volatile_p)
3083{
3084 GIMPLE_CHECK (gs, GIMPLE_ASM);
3085 if (volatile_p)
3086 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3087 else
3088 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3089}
3090
3091
3092/* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3093
3094static inline void
3095gimple_asm_set_input (gimple gs, bool input_p)
3096{
3097 GIMPLE_CHECK (gs, GIMPLE_ASM);
3098 if (input_p)
3099 gs->gsbase.subcode |= GF_ASM_INPUT;
3100 else
3101 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3102}
3103
3104
3105/* Return true if asm GS is an ASM_INPUT. */
3106
3107static inline bool
3108gimple_asm_input_p (const_gimple gs)
3109{
3110 GIMPLE_CHECK (gs, GIMPLE_ASM);
3111 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3112}
3113
3114
3115/* Return the types handled by GIMPLE_CATCH statement GS. */
3116
3117static inline tree
3118gimple_catch_types (const_gimple gs)
3119{
3120 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3121 return gs->gimple_catch.types;
3122}
3123
3124
3125/* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3126
3127static inline tree *
3128gimple_catch_types_ptr (gimple gs)
3129{
3130 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3131 return &gs->gimple_catch.types;
3132}
3133
3134
3135/* Return the GIMPLE sequence representing the body of the handler of
3136 GIMPLE_CATCH statement GS. */
3137
3138static inline gimple_seq
3139gimple_catch_handler (gimple gs)
3140{
3141 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3142 return gs->gimple_catch.handler;
3143}
3144
3145
3146/* Return a pointer to the GIMPLE sequence representing the body of
3147 the handler of GIMPLE_CATCH statement GS. */
3148
3149static inline gimple_seq *
3150gimple_catch_handler_ptr (gimple gs)
3151{
3152 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3153 return &gs->gimple_catch.handler;
3154}
3155
3156
3157/* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3158
3159static inline void
3160gimple_catch_set_types (gimple gs, tree t)
3161{
3162 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3163 gs->gimple_catch.types = t;
3164}
3165
3166
3167/* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3168
3169static inline void
3170gimple_catch_set_handler (gimple gs, gimple_seq handler)
3171{
3172 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3173 gs->gimple_catch.handler = handler;
3174}
3175
3176
3177/* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3178
3179static inline tree
3180gimple_eh_filter_types (const_gimple gs)
3181{
3182 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3183 return gs->gimple_eh_filter.types;
3184}
3185
3186
3187/* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3188 GS. */
3189
3190static inline tree *
3191gimple_eh_filter_types_ptr (gimple gs)
3192{
3193 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3194 return &gs->gimple_eh_filter.types;
3195}
3196
3197
3198/* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3199 statement fails. */
3200
3201static inline gimple_seq
3202gimple_eh_filter_failure (gimple gs)
3203{
3204 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3205 return gs->gimple_eh_filter.failure;
3206}
3207
3208
3209/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3210
3211static inline void
3212gimple_eh_filter_set_types (gimple gs, tree types)
3213{
3214 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3215 gs->gimple_eh_filter.types = types;
3216}
3217
3218
3219/* Set FAILURE to be the sequence of statements to execute on failure
3220 for GIMPLE_EH_FILTER GS. */
3221
3222static inline void
3223gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3224{
3225 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3226 gs->gimple_eh_filter.failure = failure;
3227}
3228
3229/* Get the function decl to be called by the MUST_NOT_THROW region. */
3230
3231static inline tree
3232gimple_eh_must_not_throw_fndecl (gimple gs)
3233{
3234 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3235 return gs->gimple_eh_mnt.fndecl;
3236}
3237
3238/* Set the function decl to be called by GS to DECL. */
3239
3240static inline void
3241gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3242{
3243 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3244 gs->gimple_eh_mnt.fndecl = decl;
3245}
3246
3247/* GIMPLE_EH_ELSE accessors. */
3248
3249static inline gimple_seq
3250gimple_eh_else_n_body (gimple gs)
3251{
3252 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3253 return gs->gimple_eh_else.n_body;
3254}
3255
3256static inline gimple_seq
3257gimple_eh_else_e_body (gimple gs)
3258{
3259 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3260 return gs->gimple_eh_else.e_body;
3261}
3262
3263static inline void
3264gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3265{
3266 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3267 gs->gimple_eh_else.n_body = seq;
3268}
3269
3270static inline void
3271gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3272{
3273 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3274 gs->gimple_eh_else.e_body = seq;
3275}
3276
3277/* GIMPLE_TRY accessors. */
3278
3279/* Return the kind of try block represented by GIMPLE_TRY GS. This is
3280 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3281
3282static inline enum gimple_try_flags
3283gimple_try_kind (const_gimple gs)
3284{
3285 GIMPLE_CHECK (gs, GIMPLE_TRY);
3286 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3287}
3288
3289
3290/* Set the kind of try block represented by GIMPLE_TRY GS. */
3291
3292static inline void
3293gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3294{
3295 GIMPLE_CHECK (gs, GIMPLE_TRY);
3296 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3297 || kind == GIMPLE_TRY_FINALLY);
3298 if (gimple_try_kind (gs) != kind)
3299 gs->gsbase.subcode = (unsigned int) kind;
3300}
3301
3302
3303/* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3304
3305static inline bool
3306gimple_try_catch_is_cleanup (const_gimple gs)
3307{
3308 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3309 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3310}
3311
3312
3313/* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3314
3315static inline gimple_seq
3316gimple_try_eval (gimple gs)
3317{
3318 GIMPLE_CHECK (gs, GIMPLE_TRY);
3319 return gs->gimple_try.eval;
3320}
3321
3322
3323/* Return the sequence of statements used as the cleanup body for
3324 GIMPLE_TRY GS. */
3325
3326static inline gimple_seq
3327gimple_try_cleanup (gimple gs)
3328{
3329 GIMPLE_CHECK (gs, GIMPLE_TRY);
3330 return gs->gimple_try.cleanup;
3331}
3332
3333
3334/* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3335
3336static inline void
3337gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3338{
3339 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3340 if (catch_is_cleanup)
3341 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3342 else
3343 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3344}
3345
3346
3347/* Set EVAL to be the sequence of statements to use as the body for
3348 GIMPLE_TRY GS. */
3349
3350static inline void
3351gimple_try_set_eval (gimple gs, gimple_seq eval)
3352{
3353 GIMPLE_CHECK (gs, GIMPLE_TRY);
3354 gs->gimple_try.eval = eval;
3355}
3356
3357
3358/* Set CLEANUP to be the sequence of statements to use as the cleanup
3359 body for GIMPLE_TRY GS. */
3360
3361static inline void
3362gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3363{
3364 GIMPLE_CHECK (gs, GIMPLE_TRY);
3365 gs->gimple_try.cleanup = cleanup;
3366}
3367
3368
3369/* Return the cleanup sequence for cleanup statement GS. */
3370
3371static inline gimple_seq
3372gimple_wce_cleanup (gimple gs)
3373{
3374 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3375 return gs->gimple_wce.cleanup;
3376}
3377
3378
3379/* Set CLEANUP to be the cleanup sequence for GS. */
3380
3381static inline void
3382gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3383{
3384 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3385 gs->gimple_wce.cleanup = cleanup;
3386}
3387
3388
3389/* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3390
3391static inline bool
3392gimple_wce_cleanup_eh_only (const_gimple gs)
3393{
3394 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3395 return gs->gsbase.subcode != 0;
3396}
3397
3398
3399/* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3400
3401static inline void
3402gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3403{
3404 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3405 gs->gsbase.subcode = (unsigned int) eh_only_p;
3406}
3407
3408
3409/* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3410
3411static inline unsigned
3412gimple_phi_capacity (const_gimple gs)
3413{
3414 GIMPLE_CHECK (gs, GIMPLE_PHI);
3415 return gs->gimple_phi.capacity;
3416}
3417
3418
3419/* Return the number of arguments in GIMPLE_PHI GS. This must always
3420 be exactly the number of incoming edges for the basic block holding
3421 GS. */
3422
3423static inline unsigned
3424gimple_phi_num_args (const_gimple gs)
3425{
3426 GIMPLE_CHECK (gs, GIMPLE_PHI);
3427 return gs->gimple_phi.nargs;
3428}
3429
3430
3431/* Return the SSA name created by GIMPLE_PHI GS. */
3432
3433static inline tree
3434gimple_phi_result (const_gimple gs)
3435{
3436 GIMPLE_CHECK (gs, GIMPLE_PHI);
3437 return gs->gimple_phi.result;
3438}
3439
3440/* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3441
3442static inline tree *
3443gimple_phi_result_ptr (gimple gs)
3444{
3445 GIMPLE_CHECK (gs, GIMPLE_PHI);
3446 return &gs->gimple_phi.result;
3447}
3448
3449/* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3450
3451static inline void
3452gimple_phi_set_result (gimple gs, tree result)
3453{
3454 GIMPLE_CHECK (gs, GIMPLE_PHI);
3455 gs->gimple_phi.result = result;
3456}
3457
3458
3459/* Return the PHI argument corresponding to incoming edge INDEX for
3460 GIMPLE_PHI GS. */
3461
3462static inline struct phi_arg_d *
3463gimple_phi_arg (gimple gs, unsigned index)
3464{
3465 GIMPLE_CHECK (gs, GIMPLE_PHI);
3466 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3467 return &(gs->gimple_phi.args[index]);
3468}
3469
3470/* Set PHIARG to be the argument corresponding to incoming edge INDEX
3471 for GIMPLE_PHI GS. */
3472
3473static inline void
3474gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3475{
3476 GIMPLE_CHECK (gs, GIMPLE_PHI);
3477 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3478 gs->gimple_phi.args[index] = *phiarg;
3479}
3480
3481/* Return the region number for GIMPLE_RESX GS. */
3482
3483static inline int
3484gimple_resx_region (const_gimple gs)
3485{
3486 GIMPLE_CHECK (gs, GIMPLE_RESX);
3487 return gs->gimple_eh_ctrl.region;
3488}
3489
3490/* Set REGION to be the region number for GIMPLE_RESX GS. */
3491
3492static inline void
3493gimple_resx_set_region (gimple gs, int region)
3494{
3495 GIMPLE_CHECK (gs, GIMPLE_RESX);
3496 gs->gimple_eh_ctrl.region = region;
3497}
3498
3499/* Return the region number for GIMPLE_EH_DISPATCH GS. */
3500
3501static inline int
3502gimple_eh_dispatch_region (const_gimple gs)
3503{
3504 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3505 return gs->gimple_eh_ctrl.region;
3506}
3507
3508/* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3509
3510static inline void
3511gimple_eh_dispatch_set_region (gimple gs, int region)
3512{
3513 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3514 gs->gimple_eh_ctrl.region = region;
3515}
3516
3517/* Return the number of labels associated with the switch statement GS. */
3518
3519static inline unsigned
3520gimple_switch_num_labels (const_gimple gs)
3521{
3522 unsigned num_ops;
3523 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3524 num_ops = gimple_num_ops (gs);
3525 gcc_gimple_checking_assert (num_ops > 1);
3526 return num_ops - 1;
3527}
3528
3529
3530/* Set NLABELS to be the number of labels for the switch statement GS. */
3531
3532static inline void
3533gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3534{
3535 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3536 gimple_set_num_ops (g, nlabels + 1);
3537}
3538
3539
3540/* Return the index variable used by the switch statement GS. */
3541
3542static inline tree
3543gimple_switch_index (const_gimple gs)
3544{
3545 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3546 return gimple_op (gs, 0);
3547}
3548
3549
3550/* Return a pointer to the index variable for the switch statement GS. */
3551
3552static inline tree *
3553gimple_switch_index_ptr (const_gimple gs)
3554{
3555 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3556 return gimple_op_ptr (gs, 0);
3557}
3558
3559
3560/* Set INDEX to be the index variable for switch statement GS. */
3561
3562static inline void
3563gimple_switch_set_index (gimple gs, tree index)
3564{
3565 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3566 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3567 gimple_set_op (gs, 0, index);
3568}
3569
3570
3571/* Return the label numbered INDEX. The default label is 0, followed by any
3572 labels in a switch statement. */
3573
3574static inline tree
3575gimple_switch_label (const_gimple gs, unsigned index)
3576{
3577 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3578 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3579 return gimple_op (gs, index + 1);
3580}
3581
3582/* Set the label number INDEX to LABEL. 0 is always the default label. */
3583
3584static inline void
3585gimple_switch_set_label (gimple gs, unsigned index, tree label)
3586{
3587 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3588 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3589 && (label == NULL_TREE
3590 || TREE_CODE (label) == CASE_LABEL_EXPR));
3591 gimple_set_op (gs, index + 1, label);
3592}
3593
3594/* Return the default label for a switch statement. */
3595
3596static inline tree
3597gimple_switch_default_label (const_gimple gs)
3598{
3599 return gimple_switch_label (gs, 0);
3600}
3601
3602/* Set the default label for a switch statement. */
3603
3604static inline void
3605gimple_switch_set_default_label (gimple gs, tree label)
3606{
3607 gimple_switch_set_label (gs, 0, label);
3608}
3609
3610/* Return true if GS is a GIMPLE_DEBUG statement. */
3611
3612static inline bool
3613is_gimple_debug (const_gimple gs)
3614{
3615 return gimple_code (gs) == GIMPLE_DEBUG;
3616}
3617
3618/* Return true if S is a GIMPLE_DEBUG BIND statement. */
3619
3620static inline bool
3621gimple_debug_bind_p (const_gimple s)
3622{
3623 if (is_gimple_debug (s))
3624 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3625
3626 return false;
3627}
3628
3629/* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3630
3631static inline tree
3632gimple_debug_bind_get_var (gimple dbg)
3633{
3634 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3635 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3636 return gimple_op (dbg, 0);
3637}
3638
3639/* Return the value bound to the variable in a GIMPLE_DEBUG bind
3640 statement. */
3641
3642static inline tree
3643gimple_debug_bind_get_value (gimple dbg)
3644{
3645 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3646 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3647 return gimple_op (dbg, 1);
3648}
3649
3650/* Return a pointer to the value bound to the variable in a
3651 GIMPLE_DEBUG bind statement. */
3652
3653static inline tree *
3654gimple_debug_bind_get_value_ptr (gimple dbg)
3655{
3656 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3657 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3658 return gimple_op_ptr (dbg, 1);
3659}
3660
3661/* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3662
3663static inline void
3664gimple_debug_bind_set_var (gimple dbg, tree var)
3665{
3666 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3667 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3668 gimple_set_op (dbg, 0, var);
3669}
3670
3671/* Set the value bound to the variable in a GIMPLE_DEBUG bind
3672 statement. */
3673
3674static inline void
3675gimple_debug_bind_set_value (gimple dbg, tree value)
3676{
3677 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3678 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3679 gimple_set_op (dbg, 1, value);
3680}
3681
3682/* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3683 optimized away. */
3684#define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3685
3686/* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3687 statement. */
3688
3689static inline void
3690gimple_debug_bind_reset_value (gimple dbg)
3691{
3692 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3693 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3694 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3695}
3696
3697/* Return true if the GIMPLE_DEBUG bind statement is bound to a
3698 value. */
3699
3700static inline bool
3701gimple_debug_bind_has_value_p (gimple dbg)
3702{
3703 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3704 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3705 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3706}
3707
3708#undef GIMPLE_DEBUG_BIND_NOVALUE
3709
3710/* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3711
3712static inline bool
3713gimple_debug_source_bind_p (const_gimple s)
3714{
3715 if (is_gimple_debug (s))
3716 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3717
3718 return false;
3719}
3720
3721/* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3722
3723static inline tree
3724gimple_debug_source_bind_get_var (gimple dbg)
3725{
3726 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3727 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3728 return gimple_op (dbg, 0);
3729}
3730
3731/* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3732 statement. */
3733
3734static inline tree
3735gimple_debug_source_bind_get_value (gimple dbg)
3736{
3737 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3738 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3739 return gimple_op (dbg, 1);
3740}
3741
3742/* Return a pointer to the value bound to the variable in a
3743 GIMPLE_DEBUG source bind statement. */
3744
3745static inline tree *
3746gimple_debug_source_bind_get_value_ptr (gimple dbg)
3747{
3748 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3749 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3750 return gimple_op_ptr (dbg, 1);
3751}
3752
3753/* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3754
3755static inline void
3756gimple_debug_source_bind_set_var (gimple dbg, tree var)
3757{
3758 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3759 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3760 gimple_set_op (dbg, 0, var);
3761}
3762
3763/* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3764 statement. */
3765
3766static inline void
3767gimple_debug_source_bind_set_value (gimple dbg, tree value)
3768{
3769 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3770 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3771 gimple_set_op (dbg, 1, value);
3772}
3773
3774/* Return the body for the OMP statement GS. */
3775
3776static inline gimple_seq
3777gimple_omp_body (gimple gs)
3778{
3779 return gs->omp.body;
3780}
3781
3782/* Set BODY to be the body for the OMP statement GS. */
3783
3784static inline void
3785gimple_omp_set_body (gimple gs, gimple_seq body)
3786{
3787 gs->omp.body = body;
3788}
3789
3790
3791/* Return the name associated with OMP_CRITICAL statement GS. */
3792
3793static inline tree
3794gimple_omp_critical_name (const_gimple gs)
3795{
3796 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3797 return gs->gimple_omp_critical.name;
3798}
3799
3800
3801/* Return a pointer to the name associated with OMP critical statement GS. */
3802
3803static inline tree *
3804gimple_omp_critical_name_ptr (gimple gs)
3805{
3806 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3807 return &gs->gimple_omp_critical.name;
3808}
3809
3810
3811/* Set NAME to be the name associated with OMP critical statement GS. */
3812
3813static inline void
3814gimple_omp_critical_set_name (gimple gs, tree name)
3815{
3816 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3817 gs->gimple_omp_critical.name = name;
3818}
3819
3820
3821/* Return the clauses associated with OMP_FOR GS. */
3822
3823static inline tree
3824gimple_omp_for_clauses (const_gimple gs)
3825{
3826 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3827 return gs->gimple_omp_for.clauses;
3828}
3829
3830
3831/* Return a pointer to the OMP_FOR GS. */
3832
3833static inline tree *
3834gimple_omp_for_clauses_ptr (gimple gs)
3835{
3836 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3837 return &gs->gimple_omp_for.clauses;
3838}
3839
3840
3841/* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3842
3843static inline void
3844gimple_omp_for_set_clauses (gimple gs, tree clauses)
3845{
3846 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3847 gs->gimple_omp_for.clauses = clauses;
3848}
3849
3850
3851/* Get the collapse count of OMP_FOR GS. */
3852
3853static inline size_t
3854gimple_omp_for_collapse (gimple gs)
3855{
3856 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3857 return gs->gimple_omp_for.collapse;
3858}
3859
3860
3861/* Return the index variable for OMP_FOR GS. */
3862
3863static inline tree
3864gimple_omp_for_index (const_gimple gs, size_t i)
3865{
3866 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3867 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3868 return gs->gimple_omp_for.iter[i].index;
3869}
3870
3871
3872/* Return a pointer to the index variable for OMP_FOR GS. */
3873
3874static inline tree *
3875gimple_omp_for_index_ptr (gimple gs, size_t i)
3876{
3877 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3878 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3879 return &gs->gimple_omp_for.iter[i].index;
3880}
3881
3882
3883/* Set INDEX to be the index variable for OMP_FOR GS. */
3884
3885static inline void
3886gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3887{
3888 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3889 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3890 gs->gimple_omp_for.iter[i].index = index;
3891}
3892
3893
3894/* Return the initial value for OMP_FOR GS. */
3895
3896static inline tree
3897gimple_omp_for_initial (const_gimple gs, size_t i)
3898{
3899 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3900 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3901 return gs->gimple_omp_for.iter[i].initial;
3902}
3903
3904
3905/* Return a pointer to the initial value for OMP_FOR GS. */
3906
3907static inline tree *
3908gimple_omp_for_initial_ptr (gimple gs, size_t i)
3909{
3910 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3911 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3912 return &gs->gimple_omp_for.iter[i].initial;
3913}
3914
3915
3916/* Set INITIAL to be the initial value for OMP_FOR GS. */
3917
3918static inline void