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