GCC Middle and Back End API Reference
gimple.h
Go to the documentation of this file.
1/* Gimple IR definitions.
2
3 Copyright (C) 2007-2024 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
21
22#ifndef GCC_GIMPLE_H
23#define GCC_GIMPLE_H
24
25#include "tree-ssa-alias.h"
26#include "gimple-expr.h"
27
29
31#define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32#include "gimple.def"
33#undef DEFGSCODE
35};
36
37extern const char *const gimple_code_name[];
38extern const unsigned char gimple_rhs_class_table[];
39
40/* Strip the outermost pointer, from tr1/type_traits. */
41template<typename T> struct remove_pointer { typedef T type; };
42template<typename T> struct remove_pointer<T *> { typedef T type; };
43
44/* Error out if a gimple tuple is addressed incorrectly. */
45#if defined ENABLE_GIMPLE_CHECKING
46#define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN \
50 ATTRIBUTE_COLD;
51
52#define GIMPLE_CHECK(GS, CODE) \
53 do { \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
58 } while (0)
59template <typename T>
60inline T
61GIMPLE_CHECK2(const gimple *gs,
62#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file = __builtin_FILE (),
64 int line = __builtin_LINE (),
65 const char *fun = __builtin_FUNCTION ())
66#else
67 const char *file = __FILE__,
68 int line = __LINE__,
69 const char *fun = NULL)
70#endif
71{
72 T ret = dyn_cast <T> (gs);
73 if (!ret)
74 gimple_check_failed (gs, file, line, fun,
76 return ret;
77}
78template <typename T>
79inline T
81#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file = __builtin_FILE (),
83 int line = __builtin_LINE (),
84 const char *fun = __builtin_FUNCTION ())
85#else
86 const char *file = __FILE__,
87 int line = __LINE__,
88 const char *fun = NULL)
89#endif
90{
91 T ret = dyn_cast <T> (gs);
92 if (!ret)
93 gimple_check_failed (gs, file, line, fun,
95 return ret;
96}
97#else /* not ENABLE_GIMPLE_CHECKING */
98#define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99#define GIMPLE_CHECK(GS, CODE) (void)0
100template <typename T>
101inline T
103{
104 return as_a <T> (gs);
105}
106template <typename T>
107inline T
109{
110 return as_a <T> (gs);
111}
112#endif
113
114/* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
117{
118 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
125
126/* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
129
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
132
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
135
136 Keep this list sorted. */
138 GF_ASM_INPUT = 1 << 0,
153 GF_CALL_XTHROW = 1 << 13,
157 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
180 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
181 decomposed part, parallelized. */
183 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
184 decomposed part, "gang-single". */
186 /* A 'GF_OMP_TARGET_KIND_OACC_DATA' representing an OpenACC 'kernels'
187 decomposed parts' 'data' construct. */
190
191 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
192 a thread synchronization via some sort of barrier. The exact barrier
193 that would otherwise be emitted is dependent on the OMP statement with
194 which this return is associated. */
196
202 GF_PREDICT_TAKEN = 1 << 15
204
205/* This subcode tells apart different kinds of stmts that are not used
206 for codegen, but rather to retain debug information. */
213
214/* Masks for selecting a pass local flag (PLF) to work on. These
215 masks are used by gimple_set_plf and gimple_plf. */
217 GF_PLF_1 = 1 << 0,
218 GF_PLF_2 = 1 << 1
220
221/* Data structure definitions for GIMPLE tuples. NOTE: word markers
222 are for 64 bit hosts. */
223
224struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
225 chain_next ("%h.next"), variable_size))
226 gimple
227{
228 /* [ WORD 1 ]
229 Main identifying code for a tuple. */
230 ENUM_BITFIELD(gimple_code) code : 8;
232 /* Nonzero if a warning should not be emitted on this tuple. */
233 unsigned int no_warning : 1;
234
235 /* Nonzero if this tuple has been visited. Passes are responsible
236 for clearing this bit before using it. */
237 unsigned int visited : 1;
238
239 /* Nonzero if this tuple represents a non-temporal move; currently
240 only stores are supported. */
241 unsigned int nontemporal_move : 1;
242
243 /* Pass local flags. These flags are free for any pass to use as
244 they see fit. Passes should not assume that these flags contain
245 any useful value when the pass starts. Any initial state that
246 the pass requires should be set on entry to the pass. See
247 gimple_set_plf and gimple_plf for usage. */
248 unsigned int plf : 2;
249
250 /* Nonzero if this statement has been modified and needs to have its
251 operands rescanned. */
252 unsigned modified : 1;
254 /* Nonzero if this statement contains volatile operands. */
255 unsigned has_volatile_ops : 1;
257 /* Padding to get subcode to 16 bit alignment. */
258 unsigned pad : 1;
259
260 /* The SUBCODE field can be used for tuple-specific flags for tuples
261 that do not require subcodes. Note that SUBCODE should be at
262 least as wide as tree codes, as several tuples store tree codes
263 in there. */
264 unsigned int subcode : 16;
265
266 /* UID of this statement. This is used by passes that want to
267 assign IDs to statements. It must be assigned and used by each
268 pass. By default it should be assumed to contain garbage. */
269 unsigned uid;
270
271 /* [ WORD 2 ]
272 Locus information for debug info. */
273 location_t location;
275 /* Number of operands in this tuple. */
276 unsigned num_ops;
277
278 /* [ WORD 3 ]
279 Basic block holding this statement. */
280 basic_block bb;
281
282 /* [ WORD 4-5 ]
283 Linked lists of gimple statements. The next pointers form
284 a NULL terminated list, the prev pointers are a cyclic list.
285 A gimple statement is hence also a double-ended list of
286 statements, with the pointer itself being the first element,
287 and the prev pointer being the last. */
288 gimple *next;
289 gimple *GTY((skip)) prev;
290};
291
292
293/* Base structure for tuples with operands. */
295/* This gimple subclass has no tag value. */
296struct GTY(())
298{
299 /* [ WORD 1-6 ] : base class */
300
301 /* [ WORD 7 ]
302 SSA operand vectors. NOTE: It should be possible to
303 amalgamate these vectors with the operand vector OP. However,
304 the SSA operand vectors are organized differently and contain
305 more information (like immediate use chaining). */
306 struct use_optype_d GTY((skip (""))) *use_ops;
307};
308
310/* Statements that take register operands. */
311
312struct GTY((tag("GSS_WITH_OPS")))
314{
315 /* [ WORD 1-7 ] : base class */
316
317 /* [ WORD 8 ]
318 Operand vector. NOTE! This must always be the last field
319 of this structure. In particular, this means that this
320 structure cannot be embedded inside another one. */
321 tree GTY((length ("%h.num_ops"))) op[1];
322};
324
325/* Base for statements that take both memory and register operands. */
326
327struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
329{
330 /* [ WORD 1-7 ] : base class */
332 /* [ WORD 8-9 ]
333 Virtual operands for this statement. The GC will pick them
334 up via the ssa_names array. */
335 tree GTY((skip (""))) vdef;
336 tree GTY((skip (""))) vuse;
338
339
340/* Statements that take both memory and register operands. */
341
342struct GTY((tag("GSS_WITH_MEM_OPS")))
345{
346 /* [ WORD 1-9 ] : base class */
347
348 /* [ WORD 10 ]
349 Operand vector. NOTE! This must always be the last field
350 of this structure. In particular, this means that this
351 structure cannot be embedded inside another one. */
352 tree GTY((length ("%h.num_ops"))) op[1];
353};
354
355
356/* Call statements that take both memory and register operands. */
358struct GTY((tag("GSS_CALL")))
360{
361 /* [ WORD 1-9 ] : base class */
363 /* [ WORD 10-13 ] */
364 struct pt_solution call_used;
365 struct pt_solution call_clobbered;
366
367 /* [ WORD 14 ] */
368 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
369 tree GTY ((tag ("0"))) fntype;
371 } u;
373 /* [ WORD 15 ]
374 Operand vector. NOTE! This must always be the last field
375 of this structure. In particular, this means that this
376 structure cannot be embedded inside another one. */
377 tree GTY((length ("%h.num_ops"))) op[1];
379 static const enum gimple_code code_ = GIMPLE_CALL;
380};
381
382
383/* OMP statements. */
384
385struct GTY((tag("GSS_OMP")))
387{
388 /* [ WORD 1-6 ] : base class */
390 /* [ WORD 7 ] */
391 gimple_seq body;
392};
393
394
395/* GIMPLE_BIND */
396
397struct GTY((tag("GSS_BIND")))
398 gbind : public gimple
399{
400 /* [ WORD 1-6 ] : base class */
401
402 /* [ WORD 7 ]
403 Variables declared in this scope. */
404 tree vars;
405
406 /* [ WORD 8 ]
407 This is different than the BLOCK field in gimple,
408 which is analogous to TREE_BLOCK (i.e., the lexical block holding
409 this statement). This field is the equivalent of BIND_EXPR_BLOCK
410 in tree land (i.e., the lexical scope defined by this bind). See
411 gimple-low.cc. */
412 tree block;
413
414 /* [ WORD 9 ] */
415 gimple_seq body;
416};
418
419/* GIMPLE_CATCH */
421struct GTY((tag("GSS_CATCH")))
422 gcatch : public gimple
423{
424 /* [ WORD 1-6 ] : base class */
425
426 /* [ WORD 7 ] */
427 tree types;
428
429 /* [ WORD 8 ] */
430 gimple_seq handler;
431};
433
434/* GIMPLE_EH_FILTER */
435
436struct GTY((tag("GSS_EH_FILTER")))
437 geh_filter : public gimple
438{
439 /* [ WORD 1-6 ] : base class */
440
441 /* [ WORD 7 ]
442 Filter types. */
443 tree types;
444
445 /* [ WORD 8 ]
446 Failure actions. */
448};
449
450/* GIMPLE_EH_ELSE */
452struct GTY((tag("GSS_EH_ELSE")))
453 geh_else : public gimple
454{
455 /* [ WORD 1-6 ] : base class */
457 /* [ WORD 7,8 ] */
458 gimple_seq n_body, e_body;
459};
460
461/* GIMPLE_EH_MUST_NOT_THROW */
462
463struct GTY((tag("GSS_EH_MNT")))
464 geh_mnt : public gimple
465{
466 /* [ WORD 1-6 ] : base class */
468 /* [ WORD 7 ] Abort function decl. */
469 tree fndecl;
471
472/* GIMPLE_PHI */
474struct GTY((tag("GSS_PHI")))
475 gphi : public gimple
476{
477 /* [ WORD 1-6 ] : base class */
478
479 /* [ WORD 7 ] */
480 unsigned capacity;
481 unsigned nargs;
482
483 /* [ WORD 8 ] */
484 tree result;
486 /* [ WORD 9 ] */
487 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
489
490
491/* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
492
493struct GTY((tag("GSS_EH_CTRL")))
495{
496 /* [ WORD 1-6 ] : base class */
497
498 /* [ WORD 7 ]
499 Exception region number. */
500 int region;
501};
502
503struct GTY((tag("GSS_EH_CTRL")))
505{
506 /* No extra fields; adds invariant:
507 stmt->code == GIMPLE_RESX. */
508};
510struct GTY((tag("GSS_EH_CTRL")))
512{
513 /* No extra fields; adds invariant:
514 stmt->code == GIMPLE_EH_DISPATH. */
515};
516
518/* GIMPLE_TRY */
519
520struct GTY((tag("GSS_TRY")))
521 gtry : public gimple
522{
523 /* [ WORD 1-6 ] : base class */
525 /* [ WORD 7 ]
526 Expression to evaluate. */
527 gimple_seq eval;
529 /* [ WORD 8 ]
530 Cleanup expression. */
531 gimple_seq cleanup;
533
534/* Kind of GIMPLE_TRY statements. */
536{
537 /* A try/catch. */
538 GIMPLE_TRY_CATCH = 1 << 0,
539
540 /* A try/finally. */
541 GIMPLE_TRY_FINALLY = 1 << 1,
544 /* Analogous to TRY_CATCH_IS_CLEANUP. */
546};
547
548/* GIMPLE_WITH_CLEANUP_EXPR */
550struct GTY((tag("GSS_WCE")))
552{
553 /* [ WORD 1-6 ] : base class */
554
555 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
556 executed if an exception is thrown, not on normal exit of its
557 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
558 in TARGET_EXPRs. */
560 /* [ WORD 7 ]
561 Cleanup expression. */
562 gimple_seq cleanup;
563};
564
565
566/* GIMPLE_ASM */
567
568struct GTY((tag("GSS_ASM")))
570{
571 /* [ WORD 1-9 ] : base class */
572
573 /* [ WORD 10 ]
574 __asm__ statement. */
575 const char *string;
576
577 /* [ WORD 11 ]
578 Number of inputs, outputs, clobbers, labels. */
579 unsigned char ni;
580 unsigned char no;
581 unsigned char nc;
582 unsigned char nl;
583
584 /* [ WORD 12 ]
585 Operand vector. NOTE! This must always be the last field
586 of this structure. In particular, this means that this
587 structure cannot be embedded inside another one. */
588 tree GTY((length ("%h.num_ops"))) op[1];
589};
590
591/* GIMPLE_OMP_CRITICAL */
592
593struct GTY((tag("GSS_OMP_CRITICAL")))
595{
596 /* [ WORD 1-7 ] : base class */
598 /* [ WORD 8 ] */
599 tree clauses;
601 /* [ WORD 9 ]
602 Critical section name. */
603 tree name;
604};
606
607struct GTY(()) gimple_omp_for_iter {
608 /* Condition code. */
609 enum tree_code cond;
611 /* Index variable. */
612 tree index;
613
614 /* Initial value. */
615 tree initial;
616
617 /* Final value. */
618 tree final;
619
620 /* Increment. */
621 tree incr;
622};
623
624/* GIMPLE_OMP_FOR */
625
626struct GTY((tag("GSS_OMP_FOR")))
628{
629 /* [ WORD 1-7 ] : base class */
630
631 /* [ WORD 8 ] */
632 tree clauses;
634 /* [ WORD 9 ]
635 Number of elements in iter array. */
636 size_t collapse;
638 /* [ WORD 10 ] */
639 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
640
641 /* [ WORD 11 ]
642 Pre-body evaluated before the loop body begins. */
643 gimple_seq pre_body;
644};
646
647/* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
648
649struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
651{
652 /* [ WORD 1-7 ] : base class */
653
654 /* [ WORD 8 ]
655 Clauses. */
656 tree clauses;
657
658 /* [ WORD 9 ]
659 Child function holding the body of the parallel region. */
660 tree child_fn;
662 /* [ WORD 10 ]
663 Shared data argument. */
664 tree data_arg;
665};
666
667/* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
668struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
670{
671 /* No extra fields; adds invariant:
672 stmt->code == GIMPLE_OMP_PARALLEL
673 || stmt->code == GIMPLE_OMP_TASK
674 || stmt->code == GIMPLE_OMP_TEAMS. */
676
677/* GIMPLE_OMP_PARALLEL */
678struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
681 /* No extra fields; adds invariant:
682 stmt->code == GIMPLE_OMP_PARALLEL. */
683};
684
685/* GIMPLE_OMP_TARGET */
686struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
688{
689 /* No extra fields; adds invariant:
690 stmt->code == GIMPLE_OMP_TARGET. */
691};
692
693/* GIMPLE_OMP_TASK */
694
695struct GTY((tag("GSS_OMP_TASK")))
697{
698 /* [ WORD 1-10 ] : base class */
699
700 /* [ WORD 11 ]
701 Child function holding firstprivate initialization if needed. */
703
704 /* [ WORD 12-13 ]
705 Size and alignment in bytes of the argument data block. */
706 tree arg_size;
707 tree arg_align;
709
710
711/* GIMPLE_OMP_SECTION */
712/* Uses struct gimple_statement_omp. */
714
715/* GIMPLE_OMP_SECTIONS */
717struct GTY((tag("GSS_OMP_SECTIONS")))
719{
720 /* [ WORD 1-7 ] : base class */
721
722 /* [ WORD 8 ] */
723 tree clauses;
724
725 /* [ WORD 9 ]
726 The control variable used for deciding which of the sections to
727 execute. */
728 tree control;
729};
731/* GIMPLE_OMP_CONTINUE.
732
733 Note: This does not inherit from gimple_statement_omp, because we
734 do not need the body field. */
735
736struct GTY((tag("GSS_OMP_CONTINUE")))
737 gomp_continue : public gimple
738{
739 /* [ WORD 1-6 ] : base class */
740
741 /* [ WORD 7 ] */
742 tree control_def;
743
744 /* [ WORD 8 ] */
745 tree control_use;
746};
747
748/* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
749 GIMPLE_OMP_SCAN, GIMPLE_OMP_MASKED, GIMPLE_OMP_SCOPE. */
750
751struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
753{
754 /* [ WORD 1-7 ] : base class */
755
756 /* [ WORD 8 ] */
757 tree clauses;
758};
760struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
762{
763 /* No extra fields; adds invariant:
764 stmt->code == GIMPLE_OMP_SINGLE. */
765};
766
767struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
769{
770 /* No extra fields; adds invariant:
771 stmt->code == GIMPLE_OMP_TEAMS. */
772};
773
774struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
776{
777 /* No extra fields; adds invariant:
778 stmt->code == GIMPLE_OMP_ORDERED. */
779};
780
781struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
783{
784 /* No extra fields; adds invariant:
785 stmt->code == GIMPLE_OMP_SCAN. */
786};
787
788
789/* GIMPLE_OMP_ATOMIC_LOAD.
790 Note: This is based on gimple, not g_s_omp, because g_s_omp
791 contains a sequence, which we don't need here. */
792
793struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
795{
796 /* [ WORD 1-6 ] : base class */
797
798 /* [ WORD 7-8 ] */
799 tree rhs, lhs;
800};
801
802/* GIMPLE_OMP_ATOMIC_STORE.
803 See note on GIMPLE_OMP_ATOMIC_LOAD. */
804
805struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
807{
808 /* [ WORD 1-6 ] : base class */
809
810 /* [ WORD 7 ] */
811 tree val;
814struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
817{
818 /* No extra fields; adds invariant:
819 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
820};
822struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
825{
826 /* No extra fields; adds invariant:
827 stmt->code == GIMPLE_OMP_RETURN. */
829
830/* Assumptions. */
832struct GTY((tag("GSS_ASSUME")))
834{
835 /* [ WORD 1-6 ] : base class */
836
837 /* [ WORD 7 ] */
838 tree guard;
839
840 /* [ WORD 8 ] */
844/* GIMPLE_TRANSACTION. */
845
846/* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
848/* The __transaction_atomic was declared [[outer]] or it is
849 __transaction_relaxed. */
850#define GTMA_IS_OUTER (1u << 0)
851#define GTMA_IS_RELAXED (1u << 1)
852#define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
853
854/* The transaction is seen to not have an abort. */
855#define GTMA_HAVE_ABORT (1u << 2)
856/* The transaction is seen to have loads or stores. */
857#define GTMA_HAVE_LOAD (1u << 3)
858#define GTMA_HAVE_STORE (1u << 4)
859/* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
860#define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
861/* The transaction WILL enter serial irrevocable mode.
862 An irrevocable block post-dominates the entire transaction, such
863 that all invocations of the transaction will go serial-irrevocable.
864 In such case, we don't bother instrumenting the transaction, and
865 tell the runtime that it should begin the transaction in
866 serial-irrevocable mode. */
867#define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
868/* The transaction contains no instrumentation code whatsover, most
869 likely because it is guaranteed to go irrevocable upon entry. */
870#define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
871
872struct GTY((tag("GSS_TRANSACTION")))
874{
875 /* [ WORD 1-9 ] : base class */
877 /* [ WORD 10 ] */
878 gimple_seq body;
879
880 /* [ WORD 11-13 ] */
881 tree label_norm;
882 tree label_uninst;
883 tree label_over;
884};
886#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
888#include "gsstruct.def"
890};
891#undef DEFGSSTRUCT
892
893/* A statement with the invariant that
894 stmt->code == GIMPLE_COND
895 i.e. a conditional jump statement. */
896
897struct GTY((tag("GSS_WITH_OPS")))
899{
900 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
901 static const enum gimple_code code_ = GIMPLE_COND;
902};
904/* A statement with the invariant that
905 stmt->code == GIMPLE_DEBUG
906 i.e. a debug statement. */
907
908struct GTY((tag("GSS_WITH_OPS")))
910{
911 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
912};
914/* A statement with the invariant that
915 stmt->code == GIMPLE_GOTO
916 i.e. a goto statement. */
917
918struct GTY((tag("GSS_WITH_OPS")))
920{
921 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
922};
923
924/* A statement with the invariant that
925 stmt->code == GIMPLE_LABEL
926 i.e. a label statement. */
927
928struct GTY((tag("GSS_WITH_OPS")))
930{
931 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
932};
933
934/* A statement with the invariant that
935 stmt->code == GIMPLE_SWITCH
936 i.e. a switch statement. */
938struct GTY((tag("GSS_WITH_OPS")))
940{
941 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
942};
943
944/* A statement with the invariant that
945 stmt->code == GIMPLE_ASSIGN
946 i.e. an assignment statement. */
947
948struct GTY((tag("GSS_WITH_MEM_OPS")))
950{
951 static const enum gimple_code code_ = GIMPLE_ASSIGN;
952 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
954
955/* A statement with the invariant that
956 stmt->code == GIMPLE_RETURN
957 i.e. a return statement. */
958
959struct GTY((tag("GSS_WITH_MEM_OPS")))
962 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
963};
964
965template <>
966template <>
967inline bool
970 return gs->code == GIMPLE_ASM;
971}
972
973template <>
974template <>
975inline bool
978 return gs->code == GIMPLE_ASSIGN;
979}
980
981template <>
982template <>
983inline bool
986 return gs->code == GIMPLE_ASSIGN;
987}
988
989template <>
990template <>
991inline bool
994 return gs->code == GIMPLE_BIND;
995}
996
997template <>
998template <>
999inline bool
1002 return gs->code == GIMPLE_CALL;
1003}
1004
1005template <>
1006template <>
1007inline bool
1010 return gs->code == GIMPLE_CATCH;
1011}
1012
1013template <>
1014template <>
1015inline bool
1018 return gs->code == GIMPLE_COND;
1019}
1020
1021template <>
1022template <>
1023inline bool
1026 return gs->code == GIMPLE_COND;
1027}
1028
1029template <>
1030template <>
1031inline bool
1034 return gs->code == GIMPLE_DEBUG;
1035}
1036
1037template <>
1038template <>
1039inline bool
1042 return gs->code == GIMPLE_DEBUG;
1043}
1044
1045template <>
1046template <>
1047inline bool
1050 return gs->code == GIMPLE_GOTO;
1051}
1052
1053template <>
1054template <>
1055inline bool
1058 return gs->code == GIMPLE_GOTO;
1059}
1060
1061template <>
1062template <>
1063inline bool
1066 return gs->code == GIMPLE_LABEL;
1067}
1068
1069template <>
1070template <>
1071inline bool
1074 return gs->code == GIMPLE_LABEL;
1075}
1076
1077template <>
1078template <>
1079inline bool
1082 return gs->code == GIMPLE_RESX;
1083}
1084
1085template <>
1086template <>
1087inline bool
1090 return gs->code == GIMPLE_EH_DISPATCH;
1091}
1092
1093template <>
1094template <>
1095inline bool
1098 return gs->code == GIMPLE_EH_ELSE;
1099}
1100
1101template <>
1102template <>
1103inline bool
1106 return gs->code == GIMPLE_EH_ELSE;
1107}
1108
1109template <>
1110template <>
1111inline bool
1114 return gs->code == GIMPLE_EH_FILTER;
1115}
1116
1117template <>
1118template <>
1119inline bool
1122 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1123}
1124
1125template <>
1126template <>
1127inline bool
1130 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1131}
1132
1133template <>
1134template <>
1135inline bool
1138 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1139}
1140
1141template <>
1142template <>
1143inline bool
1146 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1147}
1148
1149template <>
1150template <>
1151inline bool
1154 return gs->code == GIMPLE_OMP_RETURN;
1155}
1156
1157template <>
1158template <>
1159inline bool
1161{
1162 return gs->code == GIMPLE_OMP_CONTINUE;
1164
1165template <>
1166template <>
1167inline bool
1169{
1170 return gs->code == GIMPLE_OMP_CRITICAL;
1172
1173template <>
1174template <>
1175inline bool
1177{
1178 return gs->code == GIMPLE_OMP_ORDERED;
1180
1181template <>
1182template <>
1183inline bool
1185{
1186 return gs->code == GIMPLE_OMP_SCAN;
1188
1189template <>
1190template <>
1191inline bool
1193{
1194 return gs->code == GIMPLE_OMP_FOR;
1196
1197template <>
1198template <>
1199inline bool
1201{
1202 return (gs->code == GIMPLE_OMP_PARALLEL
1203 || gs->code == GIMPLE_OMP_TASK
1204 || gs->code == GIMPLE_OMP_TEAMS);
1205}
1206
1207template <>
1208template <>
1209inline bool
1212 return gs->code == GIMPLE_OMP_PARALLEL;
1213}
1214
1215template <>
1216template <>
1217inline bool
1220 return gs->code == GIMPLE_OMP_TARGET;
1221}
1222
1223template <>
1224template <>
1225inline bool
1228 return gs->code == GIMPLE_OMP_SECTIONS;
1229}
1230
1231template <>
1232template <>
1233inline bool
1236 return gs->code == GIMPLE_OMP_SINGLE;
1237}
1238
1239template <>
1240template <>
1241inline bool
1244 return gs->code == GIMPLE_OMP_TEAMS;
1245}
1246
1247template <>
1248template <>
1249inline bool
1252 return gs->code == GIMPLE_OMP_TASK;
1253}
1254
1255template <>
1256template <>
1257inline bool
1260 return gs->code == GIMPLE_PHI;
1261}
1262
1263template <>
1264template <>
1265inline bool
1268 return gs->code == GIMPLE_RETURN;
1269}
1270
1271template <>
1272template <>
1273inline bool
1276 return gs->code == GIMPLE_SWITCH;
1277}
1278
1279template <>
1280template <>
1281inline bool
1284 return gs->code == GIMPLE_SWITCH;
1285}
1286
1287template <>
1288template <>
1289inline bool
1292 return gs->code == GIMPLE_ASSUME;
1293}
1294
1295template <>
1296template <>
1297inline bool
1300 return gs->code == GIMPLE_TRANSACTION;
1301}
1302
1303template <>
1304template <>
1305inline bool
1308 return gs->code == GIMPLE_TRY;
1309}
1310
1311template <>
1312template <>
1313inline bool
1316 return gs->code == GIMPLE_TRY;
1317}
1318
1319template <>
1320template <>
1321inline bool
1324 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1325}
1326
1327template <>
1328template <>
1329inline bool
1332 return gs->code == GIMPLE_ASM;
1333}
1334
1335template <>
1336template <>
1337inline bool
1340 return gs->code == GIMPLE_BIND;
1341}
1342
1343template <>
1344template <>
1345inline bool
1348 return gs->code == GIMPLE_CALL;
1349}
1350
1351template <>
1352template <>
1353inline bool
1356 return gs->code == GIMPLE_CATCH;
1357}
1358
1359template <>
1360template <>
1361inline bool
1364 return gs->code == GIMPLE_RESX;
1365}
1366
1367template <>
1368template <>
1369inline bool
1372 return gs->code == GIMPLE_EH_DISPATCH;
1373}
1374
1375template <>
1376template <>
1377inline bool
1380 return gs->code == GIMPLE_EH_FILTER;
1381}
1382
1383template <>
1384template <>
1385inline bool
1388 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1389}
1390
1391template <>
1392template <>
1393inline bool
1396 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1397}
1398
1399template <>
1400template <>
1401inline bool
1404 return gs->code == GIMPLE_OMP_RETURN;
1405}
1406
1407template <>
1408template <>
1409inline bool
1411{
1412 return gs->code == GIMPLE_OMP_CONTINUE;
1414
1415template <>
1416template <>
1417inline bool
1419{
1420 return gs->code == GIMPLE_OMP_CRITICAL;
1422
1423template <>
1424template <>
1425inline bool
1427{
1428 return gs->code == GIMPLE_OMP_ORDERED;
1430
1431template <>
1432template <>
1433inline bool
1435{
1436 return gs->code == GIMPLE_OMP_SCAN;
1438
1439template <>
1440template <>
1441inline bool
1443{
1444 return gs->code == GIMPLE_OMP_FOR;
1446
1447template <>
1448template <>
1449inline bool
1451{
1452 return (gs->code == GIMPLE_OMP_PARALLEL
1453 || gs->code == GIMPLE_OMP_TASK
1454 || gs->code == GIMPLE_OMP_TEAMS);
1455}
1456
1457template <>
1458template <>
1459inline bool
1462 return gs->code == GIMPLE_OMP_PARALLEL;
1463}
1464
1465template <>
1466template <>
1467inline bool
1470 return gs->code == GIMPLE_OMP_TARGET;
1471}
1472
1473template <>
1474template <>
1475inline bool
1478 return gs->code == GIMPLE_OMP_SECTIONS;
1479}
1480
1481template <>
1482template <>
1483inline bool
1486 return gs->code == GIMPLE_OMP_SINGLE;
1487}
1488
1489template <>
1490template <>
1491inline bool
1493{
1494 return gs->code == GIMPLE_OMP_TEAMS;
1495}
1496
1497template <>
1498template <>
1499inline bool
1501{
1502 return gs->code == GIMPLE_OMP_TASK;
1504
1505template <>
1506template <>
1507inline bool
1509{
1510 return gs->code == GIMPLE_PHI;
1511}
1513template <>
1514template <>
1515inline bool
1518 return gs->code == GIMPLE_RETURN;
1519}
1520
1521template <>
1522template <>
1523inline bool
1525{
1526 return gs->code == GIMPLE_ASSUME;
1527}
1528
1529template <>
1530template <>
1531inline bool
1533{
1534 return gs->code == GIMPLE_TRANSACTION;
1535}
1536
1537/* Offset in bytes to the location of the operand vector.
1538 Zero if there is no operand vector for this tuple structure. */
1539extern size_t const gimple_ops_offset_[];
1541/* Map GIMPLE codes to GSS codes. */
1543
1544/* This variable holds the currently expanded gimple statement for purposes
1545 of comminucating the profile info to the builtin expanders. */
1547
1548size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1549void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1554gcall *gimple_build_call (tree, unsigned, ...);
1555gcall *gimple_build_call_valist (tree, unsigned, va_list);
1556gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1570gimple *gimple_build_nop (void);
1580 enum gimple_try_flags);
1594 tree, tree);
1611 enum omp_memory_order);
1615extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1620 location_t);
1621extern void annotate_all_with_location (gimple_seq, location_t);
1624bool gimple_call_same_target_p (const gimple *, const gimple *);
1625int gimple_call_flags (const gimple *);
1626int gimple_call_arg_flags (const gcall *, unsigned);
1627int gimple_call_retslot_flags (const gcall *);
1629int gimple_call_return_flags (const gcall *);
1635bool gimple_assign_load_p (const gimple *);
1639 tree, tree, tree);
1640tree gimple_get_lhs (const gimple *);
1641void gimple_set_lhs (gimple *, tree);
1643void gimple_move_vops (gimple *, gimple *);
1644bool gimple_has_side_effects (const gimple *);
1645bool gimple_could_trap_p_1 (const gimple *, bool, bool);
1646bool gimple_could_trap_p (const gimple *);
1648extern void dump_gimple_statistics (void);
1649unsigned get_gimple_rhs_num_ops (enum tree_code);
1659extern bool gimple_call_builtin_p (const gimple *);
1660extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1661extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1663extern void dump_decl_set (FILE *, bitmap);
1664extern bool nonfreeing_call_p (gimple *);
1665extern bool nonbarrier_call_p (gimple *);
1666extern bool infer_nonnull_range (gimple *, tree);
1671extern void gimple_seq_set_location (gimple_seq, location_t);
1672extern void gimple_seq_discard (gimple_seq);
1673extern void maybe_remove_unused_call_args (struct function *, gimple *);
1674extern bool gimple_inexpensive_call_p (gcall *);
1675extern bool stmt_can_terminate_bb_p (gimple *);
1678
1679/* Return the disposition for a warning (or all warnings by default)
1680 for a statement. */
1681extern bool warning_suppressed_p (const gimple *, opt_code = all_warnings)
1682 ATTRIBUTE_NONNULL (1);
1683/* Set the disposition for a warning (or all warnings by default)
1684 at a location to enabled by default. */
1685extern void suppress_warning (gimple *, opt_code = all_warnings,
1686 bool = true) ATTRIBUTE_NONNULL (1);
1687
1688/* Copy the warning disposition mapping from one statement to another. */
1689extern void copy_warning (gimple *, const gimple *)
1690 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1691/* Copy the warning disposition mapping from an expression to a statement. */
1692extern void copy_warning (gimple *, const_tree)
1693 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1694/* Copy the warning disposition mapping from a statement to an expression. */
1695extern void copy_warning (tree, const gimple *)
1696 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1697
1698/* Formal (expression) temporary table handling: multiple occurrences of
1699 the same scalar expression are evaluated into the same temporary. */
1700
1701typedef struct gimple_temp_hash_elt
1702{
1703 tree val; /* Key */
1704 tree temp; /* Value */
1705} elt_t;
1706
1707/* Get the number of the next statement uid to be allocated. */
1708inline unsigned int
1709gimple_stmt_max_uid (struct function *fn)
1710{
1711 return fn->last_stmt_uid;
1712}
1714/* Set the number of the next statement uid to be allocated. */
1715inline void
1716set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1717{
1718 fn->last_stmt_uid = maxid;
1719}
1720
1721/* Set the number of the next statement uid to be allocated. */
1722inline unsigned int
1724{
1725 return fn->last_stmt_uid++;
1726}
1727
1728/* Return the first node in GIMPLE sequence S. */
1729
1730inline gimple_seq_node
1733 return s;
1734}
1735
1736
1737/* Return the first statement in GIMPLE sequence S. */
1738
1739inline gimple *
1743 return n;
1744}
1745
1746/* Return the first statement in GIMPLE sequence S as a gbind *,
1747 verifying that it has code GIMPLE_BIND in a checked build. */
1748
1749inline gbind *
1754}
1755
1756
1757/* Return the last node in GIMPLE sequence S. */
1759inline gimple_seq_node
1761{
1762 return s ? s->prev : NULL;
1763}
1764
1765
1766/* Return the last statement in GIMPLE sequence S. */
1767
1768inline gimple *
1773}
1774
1776/* Set the last node in GIMPLE sequence *PS to LAST. */
1777
1778inline void
1780{
1781 (*ps)->prev = last;
1782}
1784
1785/* Set the first node in GIMPLE sequence *PS to FIRST. */
1786
1787inline void
1789{
1790 *ps = first;
1791}
1792
1794/* Return true if GIMPLE sequence S is empty. */
1795
1796inline bool
1798{
1799 return s == NULL;
1800}
1801
1802/* Allocate a new sequence and initialize its first element with STMT. */
1803
1804inline gimple_seq
1806{
1807 gimple_seq seq = NULL;
1808 gimple_seq_add_stmt (&seq, stmt);
1809 return seq;
1810}
1811
1813/* Returns the sequence of statements in BB. */
1814
1815inline gimple_seq
1817{
1818 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1819}
1820
1821inline gimple_seq *
1823{
1824 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1825}
1826
1827/* Sets the sequence of statements in BB to SEQ. */
1828
1829inline void
1831{
1832 gcc_checking_assert (!(bb->flags & BB_RTL));
1833 bb->il.gimple.seq = seq;
1834}
1835
1836
1837/* Return the code for GIMPLE statement G. */
1838
1839inline enum gimple_code
1840gimple_code (const gimple *g)
1841{
1842 return g->code;
1843}
1844
1845
1846/* Return the GSS code used by a GIMPLE code. */
1847
1849gss_for_code (enum gimple_code code)
1850{
1852 return gss_for_code_[code];
1853}
1854
1855
1856/* Return which GSS code is used by GS. */
1857
1861 return gss_for_code (gimple_code (gs));
1862}
1863
1864
1865/* Return true if statement G has sub-statements. This is only true for
1866 High GIMPLE statements. */
1867
1868inline bool
1870{
1871 switch (gimple_code (g))
1872 {
1873 case GIMPLE_ASSUME:
1874 case GIMPLE_BIND:
1875 case GIMPLE_CATCH:
1876 case GIMPLE_EH_FILTER:
1877 case GIMPLE_EH_ELSE:
1878 case GIMPLE_TRY:
1879 case GIMPLE_OMP_FOR:
1880 case GIMPLE_OMP_MASTER:
1881 case GIMPLE_OMP_MASKED:
1882 case GIMPLE_OMP_TASKGROUP:
1883 case GIMPLE_OMP_ORDERED:
1884 case GIMPLE_OMP_SECTION:
1885 case GIMPLE_OMP_STRUCTURED_BLOCK:
1886 case GIMPLE_OMP_PARALLEL:
1887 case GIMPLE_OMP_TASK:
1888 case GIMPLE_OMP_SCOPE:
1889 case GIMPLE_OMP_SECTIONS:
1890 case GIMPLE_OMP_SINGLE:
1891 case GIMPLE_OMP_TARGET:
1892 case GIMPLE_OMP_TEAMS:
1893 case GIMPLE_OMP_CRITICAL:
1894 case GIMPLE_WITH_CLEANUP_EXPR:
1895 case GIMPLE_TRANSACTION:
1896 return true;
1898 default:
1899 return false;
1900 }
1901}
1902
1903
1904/* Return the basic block holding statement G. */
1906inline basic_block
1907gimple_bb (const gimple *g)
1908{
1909 return g->bb;
1910}
1911
1912
1913/* Return the lexical scope block holding statement G. */
1914
1915inline tree
1917{
1918 return LOCATION_BLOCK (g->location);
1919}
1920
1921/* Forward declare. */
1922inline void gimple_set_location (gimple *, location_t);
1923
1924/* Set BLOCK to be the lexical scope block holding statement G. */
1926inline void
1927gimple_set_block (gimple *g, tree block)
1928{
1929 gimple_set_location (g, set_block (g->location, block));
1930}
1931
1932/* Return location information for statement G. */
1933
1934inline location_t
1935gimple_location (const gimple *g)
1936{
1937 return g->location;
1938}
1939
1940/* Return location information for statement G if g is not NULL.
1941 Otherwise, UNKNOWN_LOCATION is returned. */
1942
1943inline location_t
1945{
1946 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1947}
1949/* Set location information for statement G. */
1950
1951inline void
1952gimple_set_location (gimple *g, location_t location)
1953{
1954 /* Copy the no-warning data to the statement location. */
1955 if (g->location != UNKNOWN_LOCATION)
1956 copy_warning (location, g->location);
1957 g->location = location;
1958}
1959
1960/* Return address of the location information for statement G. */
1961
1962inline location_t *
1964{
1965 return &g->location;
1967
1968
1969/* Return true if G contains location information. */
1970
1971inline bool
1973{
1976
1977
1978/* Return non-artificial location information for statement G. */
1979
1980inline location_t
1982{
1983 location_t *ploc = NULL;
1984
1985 if (tree block = gimple_block (g))
1986 ploc = block_nonartificial_location (block);
1987
1988 return ploc ? *ploc : gimple_location (g);
1989}
1990
1991
1992/* Return the file name of the location of STMT. */
1993
1994inline const char *
1995gimple_filename (const gimple *stmt)
1996{
1997 return LOCATION_FILE (gimple_location (stmt));
1998}
1999
2000
2001/* Return the line number of the location of STMT. */
2002
2003inline int
2004gimple_lineno (const gimple *stmt)
2005{
2006 return LOCATION_LINE (gimple_location (stmt));
2007}
2008
2009
2010/* Determine whether SEQ is a singleton. */
2011
2012inline bool
2014{
2015 return ((gimple_seq_first (seq) != NULL)
2016 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
2017}
2018
2019/* Return true if no warnings should be emitted for statement STMT. */
2020
2021inline bool
2022gimple_no_warning_p (const gimple *stmt)
2023{
2024 return stmt->no_warning;
2025}
2026
2027/* Set the no_warning flag of STMT to NO_WARNING. */
2028
2029inline void
2031{
2032 stmt->no_warning = (unsigned) no_warning;
2033}
2034
2035/* Set the visited status on statement STMT to VISITED_P.
2037 Please note that this 'visited' property of the gimple statement is
2038 supposed to be undefined at pass boundaries. This means that a
2039 given pass should not assume it contains any useful value when the
2040 pass starts and thus can set it to any value it sees fit.
2041
2042 You can learn more about the visited property of the gimple
2043 statement by reading the comments of the 'visited' data member of
2044 struct gimple.
2045 */
2046
2047inline void
2048gimple_set_visited (gimple *stmt, bool visited_p)
2049{
2050 stmt->visited = (unsigned) visited_p;
2051}
2052
2053
2054/* Return the visited status for statement STMT.
2055
2056 Please note that this 'visited' property of the gimple statement is
2057 supposed to be undefined at pass boundaries. This means that a
2058 given pass should not assume it contains any useful value when the
2059 pass starts and thus can set it to any value it sees fit.
2060
2061 You can learn more about the visited property of the gimple
2062 statement by reading the comments of the 'visited' data member of
2063 struct gimple. */
2064
2065inline bool
2067{
2068 return stmt->visited;
2069}
2071
2072/* Set pass local flag PLF on statement STMT to VAL_P.
2073
2074 Please note that this PLF property of the gimple statement is
2075 supposed to be undefined at pass boundaries. This means that a
2076 given pass should not assume it contains any useful value when the
2077 pass starts and thus can set it to any value it sees fit.
2078
2079 You can learn more about the PLF property by reading the comment of
2080 the 'plf' data member of struct gimple_statement_structure. */
2081
2082inline void
2083gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2085 if (val_p)
2086 stmt->plf |= (unsigned int) plf;
2087 else
2088 stmt->plf &= ~((unsigned int) plf);
2089}
2090
2091
2092/* Return the value of pass local flag PLF on statement STMT.
2094 Please note that this 'plf' property of the gimple statement is
2095 supposed to be undefined at pass boundaries. This means that a
2096 given pass should not assume it contains any useful value when the
2097 pass starts and thus can set it to any value it sees fit.
2098
2099 You can learn more about the plf property by reading the comment of
2100 the 'plf' data member of struct gimple_statement_structure. */
2101
2102inline unsigned int
2103gimple_plf (gimple *stmt, enum plf_mask plf)
2104{
2105 return stmt->plf & ((unsigned int) plf);
2106}
2107
2108
2109/* Set the UID of statement.
2110
2111 Please note that this UID property is supposed to be undefined at
2112 pass boundaries. This means that a given pass should not assume it
2113 contains any useful value when the pass starts and thus can set it
2114 to any value it sees fit. */
2115
2116inline void
2117gimple_set_uid (gimple *g, unsigned uid)
2118{
2119 g->uid = uid;
2120}
2121
2122
2123/* Return the UID of statement.
2124
2125 Please note that this UID property is supposed to be undefined at
2126 pass boundaries. This means that a given pass should not assume it
2127 contains any useful value when the pass starts and thus can set it
2128 to any value it sees fit. */
2129
2130inline unsigned
2131gimple_uid (const gimple *g)
2132{
2133 return g->uid;
2134}
2136
2137/* Make statement G a singleton sequence. */
2138
2139inline void
2141{
2142 g->next = NULL;
2143 g->prev = g;
2144}
2145
2146
2147/* Return true if GIMPLE statement G has register or memory operands. */
2148
2149inline bool
2150gimple_has_ops (const gimple *g)
2152 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2153}
2154
2155template <>
2156template <>
2157inline bool
2159{
2160 return gimple_has_ops (gs);
2161}
2162
2163template <>
2164template <>
2165inline bool
2167{
2168 return gimple_has_ops (gs);
2169}
2170
2171/* Return true if GIMPLE statement G has memory operands. */
2172
2173inline bool
2176 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2177}
2178
2179template <>
2180template <>
2181inline bool
2183{
2184 return gimple_has_mem_ops (gs);
2185}
2186
2187template <>
2188template <>
2189inline bool
2191{
2192 return gimple_has_mem_ops (gs);
2193}
2194
2195/* Return the set of USE operands for statement G. */
2196
2197inline struct use_optype_d *
2198gimple_use_ops (const gimple *g)
2200 const gimple_statement_with_ops *ops_stmt =
2202 if (!ops_stmt)
2203 return NULL;
2204 return ops_stmt->use_ops;
2205}
2206
2207
2208/* Set USE to be the set of USE operands for statement G. */
2209
2210inline void
2212{
2213 gimple_statement_with_ops *ops_stmt =
2215 ops_stmt->use_ops = use;
2216}
2217
2218
2219/* Return the single VUSE operand of the statement G. */
2220
2221inline tree
2222gimple_vuse (const gimple *g)
2224 const gimple_statement_with_memory_ops *mem_ops_stmt =
2226 if (!mem_ops_stmt)
2227 return NULL_TREE;
2228 return mem_ops_stmt->vuse;
2229}
2230
2231/* Return the single VDEF operand of the statement G. */
2232
2233inline tree
2234gimple_vdef (const gimple *g)
2235{
2236 const gimple_statement_with_memory_ops *mem_ops_stmt =
2238 if (!mem_ops_stmt)
2239 return NULL_TREE;
2240 return mem_ops_stmt->vdef;
2241}
2242
2243/* Return the single VUSE operand of the statement G. */
2244
2245inline tree *
2247{
2248 gimple_statement_with_memory_ops *mem_ops_stmt =
2250 if (!mem_ops_stmt)
2251 return NULL;
2252 return &mem_ops_stmt->vuse;
2253}
2254
2255/* Return the single VDEF operand of the statement G. */
2256
2257inline tree *
2259{
2260 gimple_statement_with_memory_ops *mem_ops_stmt =
2262 if (!mem_ops_stmt)
2263 return NULL;
2264 return &mem_ops_stmt->vdef;
2266
2267/* Set the single VUSE operand of the statement G. */
2268
2269inline void
2271{
2272 gimple_statement_with_memory_ops *mem_ops_stmt =
2274 mem_ops_stmt->vuse = vuse;
2275}
2276
2277/* Set the single VDEF operand of the statement G. */
2278
2279inline void
2281{
2282 gimple_statement_with_memory_ops *mem_ops_stmt =
2284 mem_ops_stmt->vdef = vdef;
2285}
2287
2288/* Return true if statement G has operands and the modified field has
2289 been set. */
2290
2291inline bool
2292gimple_modified_p (const gimple *g)
2293{
2294 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2295}
2296
2297
2298/* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2299 a MODIFIED field. */
2300
2301inline void
2302gimple_set_modified (gimple *s, bool modifiedp)
2304 if (gimple_has_ops (s))
2305 s->modified = (unsigned) modifiedp;
2306}
2307
2308
2309/* Return true if statement STMT contains volatile operands. */
2310
2311inline bool
2312gimple_has_volatile_ops (const gimple *stmt)
2314 if (gimple_has_mem_ops (stmt))
2315 return stmt->has_volatile_ops;
2316 else
2317 return false;
2318}
2319
2320
2321/* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2322
2323inline void
2325{
2326 if (gimple_has_mem_ops (stmt))
2327 stmt->has_volatile_ops = (unsigned) volatilep;
2328}
2329
2330/* Return true if STMT is in a transaction. */
2331
2332inline bool
2333gimple_in_transaction (const gimple *stmt)
2334{
2336}
2337
2338/* Return true if statement STMT may access memory. */
2339
2340inline bool
2342{
2343 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2344}
2346
2347/* Return the subcode for OMP statement S. */
2348
2349inline unsigned
2350gimple_omp_subcode (const gimple *s)
2351{
2352 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2353 && gimple_code (s) <= GIMPLE_OMP_ORDERED);
2354 return s->subcode;
2355}
2357/* Set the subcode for OMP statement S to SUBCODE. */
2358
2359inline void
2360gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2361{
2362 /* We only have 16 bits for the subcode. Assert that we are not
2363 overflowing it. */
2364 gcc_gimple_checking_assert (subcode < (1 << 16));
2365 s->subcode = subcode;
2366}
2368/* Set the nowait flag on OMP_RETURN statement S. */
2369
2370inline void
2372{
2373 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2375}
2376
2377
2378/* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2379 flag set. */
2380
2381inline bool
2383{
2384 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2385 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2386}
2387
2388
2389/* Set the LHS of OMP return. */
2390
2391inline void
2393{
2394 gimple_statement_omp_return *omp_return_stmt =
2396 omp_return_stmt->val = lhs;
2397}
2398
2399
2400/* Get the LHS of OMP return. */
2401
2402inline tree
2404{
2405 const gimple_statement_omp_return *omp_return_stmt =
2407 return omp_return_stmt->val;
2408}
2409
2411/* Return a pointer to the LHS of OMP return. */
2412
2413inline tree *
2415{
2416 gimple_statement_omp_return *omp_return_stmt =
2418 return &omp_return_stmt->val;
2419}
2420
2422/* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2423 flag set. */
2424
2425inline bool
2427{
2428 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2429 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2430}
2431
2433/* Set the GF_OMP_SECTION_LAST flag on G. */
2434
2435inline void
2437{
2438 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2439 g->subcode |= GF_OMP_SECTION_LAST;
2440}
2441
2442
2443/* Return true if OMP ordered construct is stand-alone
2444 (G has the GF_OMP_ORDERED_STANDALONE flag set). */
2445
2446inline bool
2448{
2449 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2451}
2452
2453
2454/* Set the GF_OMP_ORDERED_STANDALONE flag on G. */
2455
2456inline void
2458{
2459 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2460 g->subcode |= GF_OMP_ORDERED_STANDALONE;
2461}
2462
2463
2464/* Return true if OMP parallel statement G has the
2465 GF_OMP_PARALLEL_COMBINED flag set. */
2466
2467inline bool
2470 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2472}
2473
2474
2475/* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2476 value of COMBINED_P. */
2477
2478inline void
2481 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2482 if (combined_p)
2483 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2484 else
2485 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2486}
2487
2488
2489/* Return true if OMP atomic load/store statement G has the
2490 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2492inline bool
2494{
2495 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2496 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2498}
2499
2500
2501/* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2502
2503inline void
2505{
2506 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2507 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2508 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2509}
2510
2511
2512/* Return true if OMP atomic load/store statement G has the
2513 GF_OMP_ATOMIC_WEAK flag set. */
2514
2515inline bool
2517{
2518 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2519 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2520 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_WEAK) != 0;
2521}
2522
2523
2524/* Set the GF_OMP_ATOMIC_WEAK flag on G. */
2525
2526inline void
2528{
2529 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2530 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2531 g->subcode |= GF_OMP_ATOMIC_WEAK;
2532}
2534
2535/* Return the memory order of the OMP atomic load/store statement G. */
2536
2537inline enum omp_memory_order
2539{
2540 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2541 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2542 return (enum omp_memory_order)
2544}
2545
2546
2547/* Set the memory order on G. */
2548
2549inline void
2551{
2552 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2553 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2554 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2556}
2557
2558
2559/* Return the number of operands for statement GS. */
2560
2561inline unsigned
2562gimple_num_ops (const gimple *gs)
2563{
2564 return gs->num_ops;
2565}
2566
2567
2568/* Set the number of operands for statement GS. */
2569
2570inline void
2571gimple_set_num_ops (gimple *gs, unsigned num_ops)
2572{
2573 gs->num_ops = num_ops;
2574}
2575
2576
2577/* Return the array of operands for statement GS. */
2579inline tree *
2580gimple_ops (gimple *gs)
2581{
2582 size_t off;
2583
2584 /* All the tuples have their operand vector at the very bottom
2585 of the structure. Note that those structures that do not
2586 have an operand vector have a zero offset. */
2588 gcc_gimple_checking_assert (off != 0);
2589
2590 return (tree *) ((char *) gs + off);
2591}
2593
2594/* Return operand I for statement GS. */
2595
2596inline tree
2597gimple_op (const gimple *gs, unsigned i)
2598{
2599 if (gimple_has_ops (gs))
2600 {
2602 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2603 }
2604 else
2605 return NULL_TREE;
2606}
2607
2608/* Return a pointer to operand I for statement GS. */
2610inline tree *
2611gimple_op_ptr (gimple *gs, unsigned i)
2612{
2613 if (gimple_has_ops (gs))
2614 {
2616 return gimple_ops (gs) + i;
2617 }
2618 else
2619 return NULL;
2620}
2621
2622/* Set operand I of statement GS to OP. */
2623
2624inline void
2625gimple_set_op (gimple *gs, unsigned i, tree op)
2626{
2628
2629 /* Note. It may be tempting to assert that OP matches
2630 is_gimple_operand, but that would be wrong. Different tuples
2631 accept slightly different sets of tree operands. Each caller
2632 should perform its own validation. */
2633 gimple_ops (gs)[i] = op;
2634}
2635
2636/* Return true if GS is a GIMPLE_ASSIGN. */
2637
2638inline bool
2639is_gimple_assign (const gimple *gs)
2640{
2641 return gimple_code (gs) == GIMPLE_ASSIGN;
2642}
2643
2644/* Determine if expression CODE is one of the valid expressions that can
2645 be used on the RHS of GIMPLE assignments. */
2646
2647inline enum gimple_rhs_class
2649{
2650 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2651}
2652
2653/* Return the LHS of assignment statement GS. */
2654
2655inline tree
2656gimple_assign_lhs (const gassign *gs)
2657{
2658 return gs->op[0];
2659}
2661inline tree
2662gimple_assign_lhs (const gimple *gs)
2663{
2664 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2665 return gimple_assign_lhs (ass);
2667
2668
2669/* Return a pointer to the LHS of assignment statement GS. */
2670
2671inline tree *
2673{
2674 return &gs->op[0];
2675}
2676
2677inline tree *
2679{
2681 return gimple_assign_lhs_ptr (ass);
2682}
2684
2685/* Set LHS to be the LHS operand of assignment statement GS. */
2686
2687inline void
2689{
2690 gs->op[0] = lhs;
2691
2692 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2693 SSA_NAME_DEF_STMT (lhs) = gs;
2694}
2695
2696inline void
2700 gimple_assign_set_lhs (ass, lhs);
2701}
2702
2703
2704/* Return the first operand on the RHS of assignment statement GS. */
2705
2706inline tree
2707gimple_assign_rhs1 (const gassign *gs)
2708{
2709 return gs->op[1];
2710}
2711
2712inline tree
2713gimple_assign_rhs1 (const gimple *gs)
2714{
2715 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2716 return gimple_assign_rhs1 (ass);
2717}
2719
2720/* Return a pointer to the first operand on the RHS of assignment
2721 statement GS. */
2722
2723inline tree *
2725{
2726 return &gs->op[1];
2727}
2728
2729inline tree *
2731{
2733 return gimple_assign_rhs1_ptr (ass);
2734}
2735
2736/* Set RHS to be the first operand on the RHS of assignment statement GS. */
2737
2738inline void
2740{
2741 gs->op[1] = rhs;
2742}
2743
2744inline void
2748 gimple_assign_set_rhs1 (ass, rhs);
2749}
2750
2751
2752/* Return the second operand on the RHS of assignment statement GS.
2753 If GS does not have two operands, NULL is returned instead. */
2754
2755inline tree
2756gimple_assign_rhs2 (const gassign *gs)
2757{
2758 if (gimple_num_ops (gs) >= 3)
2759 return gs->op[2];
2760 else
2761 return NULL_TREE;
2762}
2764inline tree
2765gimple_assign_rhs2 (const gimple *gs)
2766{
2767 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2768 return gimple_assign_rhs2 (ass);
2769}
2770
2771
2772/* Return a pointer to the second operand on the RHS of assignment
2773 statement GS. */
2774
2775inline tree *
2777{
2779 return &gs->op[2];
2780}
2781
2782inline tree *
2784{
2786 return gimple_assign_rhs2_ptr (ass);
2787}
2788
2789
2790/* Set RHS to be the second operand on the RHS of assignment statement GS. */
2791
2792inline void
2794{
2796 gs->op[2] = rhs;
2797}
2798
2799inline void
2801{
2803 return gimple_assign_set_rhs2 (ass, rhs);
2804}
2805
2806/* Return the third operand on the RHS of assignment statement GS.
2807 If GS does not have two operands, NULL is returned instead. */
2808
2809inline tree
2810gimple_assign_rhs3 (const gassign *gs)
2812 if (gimple_num_ops (gs) >= 4)
2813 return gs->op[3];
2814 else
2815 return NULL_TREE;
2816}
2817
2818inline tree
2819gimple_assign_rhs3 (const gimple *gs)
2820{
2822 return gimple_assign_rhs3 (ass);
2823}
2824
2825/* Return a pointer to the third operand on the RHS of assignment
2826 statement GS. */
2827
2828inline tree *
2833 return &ass->op[3];
2834}
2835
2836
2837/* Set RHS to be the third operand on the RHS of assignment statement GS. */
2839inline void
2841{
2843 gs->op[3] = rhs;
2844}
2845
2846inline void
2848{
2851}
2852
2853
2854/* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2855 which expect to see only two operands. */
2856
2857inline void
2859 tree op1, tree op2)
2860{
2861 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2862}
2864/* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2865 which expect to see only one operands. */
2866
2867inline void
2869 tree op1)
2870{
2871 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2872}
2873
2874/* Returns true if GS is a nontemporal move. */
2875
2876inline bool
2878{
2879 return gs->nontemporal_move;
2880}
2881
2882/* Sets nontemporal move flag of GS to NONTEMPORAL. */
2883
2884inline void
2885gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2887 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2888 gs->nontemporal_move = nontemporal;
2889}
2890
2891
2892/* Return the code of the expression computed on the rhs of assignment
2893 statement GS. In case that the RHS is a single object, returns the
2894 tree code of the object. */
2895
2896inline enum tree_code
2899 enum tree_code code = (enum tree_code) gs->subcode;
2900 /* While we initially set subcode to the TREE_CODE of the rhs for
2901 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2902 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2904 code = TREE_CODE (gs->op[1]);
2905
2906 return code;
2908
2909inline enum tree_code
2911{
2912 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2913 return gimple_assign_rhs_code (ass);
2914}
2915
2917/* Set CODE to be the code for the expression computed on the RHS of
2918 assignment S. */
2919
2920inline void
2922{
2923 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2924 s->subcode = code;
2925}
2926
2927
2928/* Return the gimple rhs class of the code of the expression computed on
2929 the rhs of assignment statement GS.
2930 This will never return GIMPLE_INVALID_RHS. */
2931
2934{
2936}
2937
2938/* Return true if GS is an assignment with a singleton RHS, i.e.,
2939 there is no operator associated with the assignment itself.
2940 Unlike gimple_assign_copy_p, this predicate returns true for
2941 any RHS operand, including those that perform an operation
2942 and do not have the semantics of a copy, such as COND_EXPR. */
2943
2944inline bool
2946{
2947 return (is_gimple_assign (gs)
2949}
2951/* Return true if GS performs a store to its lhs. */
2952
2953inline bool
2954gimple_store_p (const gimple *gs)
2955{
2956 tree lhs = gimple_get_lhs (gs);
2957 return lhs && !is_gimple_reg (lhs);
2959
2960/* Return true if S is a type-cast assignment. */
2961
2962inline bool
2965 if (is_gimple_assign (s))
2966 {
2968 return CONVERT_EXPR_CODE_P (sc)
2969 || sc == VIEW_CONVERT_EXPR
2970 || sc == FIX_TRUNC_EXPR;
2971 }
2972
2973 return false;
2975
2976/* Return true if S is a clobber statement. */
2977
2978inline bool
2979gimple_clobber_p (const gimple *s)
2981 return gimple_assign_single_p (s)
2983}
2984
2985/* Return true if S is a clobber statement. */
2986
2987inline bool
2988gimple_clobber_p (const gimple *s, enum clobber_kind kind)
2989{
2991 && CLOBBER_KIND (gimple_assign_rhs1 (s)) == kind;
2992}
2993
2994/* Return true if GS is a GIMPLE_CALL. */
2995
2996inline bool
2997is_gimple_call (const gimple *gs)
2999 return gimple_code (gs) == GIMPLE_CALL;
3000}
3001
3002/* Return the LHS of call statement GS. */
3003
3004inline tree
3005gimple_call_lhs (const gcall *gs)
3006{
3007 return gs->op[0];
3008}
3010inline tree
3011gimple_call_lhs (const gimple *gs)
3012{
3013 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3014 return gimple_call_lhs (gc);
3016
3017
3018/* Return a pointer to the LHS of call statement GS. */
3019
3020inline tree *
3022{
3023 return &gs->op[0];
3025
3026inline tree *
3028{
3029 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3030 return gimple_call_lhs_ptr (gc);
3031}
3033
3034/* Set LHS to be the LHS operand of call statement GS. */
3035
3036inline void
3038{
3039 gs->op[0] = lhs;
3040 if (lhs && TREE_CODE (lhs) == SSA_NAME)
3041 SSA_NAME_DEF_STMT (lhs) = gs;
3042}
3044inline void
3046{
3047 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3048 gimple_call_set_lhs (gc, lhs);
3049}
3051
3052/* Return true if call GS calls an internal-only function, as enumerated
3053 by internal_fn. */
3054
3055inline bool
3056gimple_call_internal_p (const gcall *gs)
3057{
3058 return (gs->subcode & GF_CALL_INTERNAL) != 0;
3060
3061inline bool
3063{
3064 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3066}
3067
3068/* Return true if call GS is marked as nocf_check. */
3069
3070inline bool
3072{
3073 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
3075
3076/* Mark statement GS as nocf_check call. */
3077
3078inline void
3079gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
3080{
3081 if (nocf_check)
3083 else
3084 gs->subcode &= ~GF_CALL_NOCF_CHECK;
3086
3087/* Return the target of internal call GS. */
3088
3089inline enum internal_fn
3091{
3093 return gs->u.internal_fn;
3095
3096inline enum internal_fn
3098{
3099 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3100 return gimple_call_internal_fn (gc);
3101}
3102
3103/* Return true, if this internal gimple call is unique. */
3105inline bool
3107{
3108 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3109}
3111inline bool
3113{
3114 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3116}
3117
3118/* Return true if GS is an internal function FN. */
3119
3120inline bool
3122{
3123 return (is_gimple_call (gs)
3125 && gimple_call_internal_fn (gs) == fn);
3126}
3127
3128/* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3129 that could alter control flow. */
3130
3131inline void
3132gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3133{
3134 if (ctrl_altering_p)
3136 else
3137 s->subcode &= ~GF_CALL_CTRL_ALTERING;
3138}
3139
3140inline void
3141gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3142{
3143 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3144 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
3145}
3146
3147/* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3148 flag is set. Such call could not be a stmt in the middle of a bb. */
3149
3150inline bool
3152{
3153 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3155
3156inline bool
3158{
3159 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3160 return gimple_call_ctrl_altering_p (gc);
3161}
3162
3163
3164/* Return the function type of the function called by GS. */
3165
3166inline tree
3167gimple_call_fntype (const gcall *gs)
3168{
3169 if (gimple_call_internal_p (gs))
3171 return gs->u.fntype;
3172}
3173
3174inline tree
3175gimple_call_fntype (const gimple *gs)
3176{
3177 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3178 return gimple_call_fntype (call_stmt);
3179}
3181/* Set the type of the function called by CALL_STMT to FNTYPE. */
3182
3183inline void
3184gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3185{
3187 call_stmt->u.fntype = fntype;
3188}
3189
3191/* Return the tree node representing the function called by call
3192 statement GS. */
3193
3194inline tree
3195gimple_call_fn (const gcall *gs)
3196{
3197 return gs->op[1];
3199
3200inline tree
3201gimple_call_fn (const gimple *gs)
3202{
3203 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3204 return gimple_call_fn (gc);
3205}
3206
3207/* Return a pointer to the tree node representing the function called by call
3208 statement GS. */
3209
3210inline tree *
3212{
3213 return &gs->op[1];
3214}
3215
3216inline tree *
3218{
3219 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3221}
3222
3223
3224/* Set FN to be the function called by call statement GS. */
3225
3226inline void
3228{
3230 gs->op[1] = fn;
3231}
3232
3233
3234/* Set FNDECL to be the function called by call statement GS. */
3235
3236inline void
3238{
3240 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3242}
3243
3244inline void
3246{
3247 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3249}
3250
3251
3252/* Set internal function FN to be the function called by call statement CALL_STMT. */
3253
3254inline void
3255gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3256{
3258 call_stmt->u.internal_fn = fn;
3259}
3260
3261
3262/* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3263 Otherwise return NULL. This function is analogous to
3264 get_callee_fndecl in tree land. */
3265
3266inline tree
3267gimple_call_fndecl (const gcall *gs)
3270}
3271
3272inline tree
3273gimple_call_fndecl (const gimple *gs)
3274{
3275 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3277}
3278
3279
3280/* Return the type returned by call statement GS. */
3281
3282inline tree
3284{
3286
3287 if (type == NULL_TREE)
3288 return TREE_TYPE (gimple_call_lhs (gs));
3289
3290 /* The type returned by a function is the type of its
3291 function type. */
3292 return TREE_TYPE (type);
3293}
3294
3295
3296/* Return the static chain for call statement GS. */
3297
3298inline tree
3299gimple_call_chain (const gcall *gs)
3300{
3301 return gs->op[2];
3302}
3303
3304inline tree
3305gimple_call_chain (const gimple *gs)
3306{
3307 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3309}
3310
3311
3312/* Return a pointer to the static chain for call statement CALL_STMT. */
3313
3314inline tree *
3315gimple_call_chain_ptr (gcall *call_stmt)
3316{
3317 return &call_stmt->op[2];
3318}
3320/* Set CHAIN to be the static chain for call statement CALL_STMT. */
3321
3322inline void
3324{
3325 call_stmt->op[2] = chain;
3327
3328
3329/* Return the number of arguments used by call statement GS. */
3330
3331inline unsigned
3332gimple_call_num_args (const gcall *gs)
3333{
3334 return gimple_num_ops (gs) - 3;
3335}
3337inline unsigned
3338gimple_call_num_args (const gimple *gs)
3339{
3340 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3341 return gimple_call_num_args (gc);
3342}
3344
3345/* Return the argument at position INDEX for call statement GS. */
3346
3347inline tree
3348gimple_call_arg (const gcall *gs, unsigned index)
3349{
3350 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3351 return gs->op[index + 3];
3352}
3353
3354inline tree
3355gimple_call_arg (const gimple *gs, unsigned index)
3356{
3357 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3358 return gimple_call_arg (gc, index);
3359}
3360
3361
3362/* Return a pointer to the argument at position INDEX for call
3363 statement GS. */
3364
3365inline tree *
3366gimple_call_arg_ptr (gcall *gs, unsigned index)
3368 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3369 return &gs->op[index + 3];
3370}
3371
3372inline tree *
3373gimple_call_arg_ptr (gimple *gs, unsigned index)
3374{
3376 return gimple_call_arg_ptr (gc, index);
3377}
3378
3379
3380/* Set ARG to be the argument at position INDEX for call statement GS. */
3381
3382inline void
3383gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3384{
3385 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3386 gs->op[index + 3] = arg;
3388
3389inline void
3390gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3391{
3392 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3393 gimple_call_set_arg (gc, index, arg);
3394}
3395
3396
3397/* If TAIL_P is true, mark call statement S as being a tail call
3398 (i.e., a call just before the exit of a function). These calls are
3399 candidate for tail call optimization. */
3400
3401inline void
3402gimple_call_set_tail (gcall *s, bool tail_p)
3403{
3404 if (tail_p)
3406 else
3407 s->subcode &= ~GF_CALL_TAILCALL;
3408}
3410
3411/* Return true if GIMPLE_CALL S is marked as a tail call. */
3412
3413inline bool
3414gimple_call_tail_p (const gcall *s)
3415{
3416 return (s->subcode & GF_CALL_TAILCALL) != 0;
3417}
3418
3419/* Mark (or clear) call statement S as requiring tail call optimization. */
3420
3421inline void
3422gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3423{
3424 if (must_tail_p)
3426 else
3427 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3428}
3429
3430/* Return true if call statement has been marked as requiring
3431 tail call optimization. */
3432
3433inline bool
3435{
3436 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3437}
3438
3439/* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3440 slot optimization. This transformation uses the target of the call
3441 expansion as the return slot for calls that return in memory. */
3442
3443inline void
3444gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3445{
3446 if (return_slot_opt_p)
3448 else
3449 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3450}
3451
3452
3453/* Return true if S is marked for return slot optimization. */
3455inline bool
3457{
3458 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3459}
3460
3461
3462/* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3463 thunk to the thunked-to function. */
3465inline void
3466gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3467{
3468 if (from_thunk_p)
3470 else
3471 s->subcode &= ~GF_CALL_FROM_THUNK;
3472}
3473
3474
3475/* Return true if GIMPLE_CALL S is a jump from a thunk. */
3476
3477inline bool
3479{
3480 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3481}
3482
3483
3484/* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3485 to operator new or delete created from a new or delete expression. */
3487inline void
3488gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
3489{
3490 if (from_new_or_delete_p)
3492 else
3493 s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE;
3494}
3495
3496
3497/* Return true if GIMPLE_CALL S is a call to operator new or delete from
3498 from a new or delete expression. */
3499
3500inline bool
3502{
3504}
3505
3506
3507/* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3508 argument pack in its argument list. */
3509
3510inline void
3511gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3512{
3513 if (pass_arg_pack_p)
3515 else
3516 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3517}
3518
3519
3520/* Return true if GIMPLE_CALL S is a stdarg call that needs the
3521 argument pack in its argument list. */
3522
3523inline bool
3525{
3526 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3527}
3528
3529
3530/* Return true if S is a noreturn call. */
3531
3532inline bool
3534{
3535 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3537
3538inline bool
3540{
3541 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3542 return gimple_call_noreturn_p (gc);
3543}
3544
3545
3546/* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3547 even if the called function can throw in other cases. */
3548
3549inline void
3550gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3551{
3552 if (nothrow_p)
3554 else
3555 s->subcode &= ~GF_CALL_NOTHROW;
3556}
3557
3558/* Return true if S is a nothrow call. */
3559
3560inline bool
3562{
3563 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3565
3566/* If EXPECTED_THROW_P is true, GIMPLE_CALL S is a call that is known
3567 to be more likely to throw than to run forever, terminate the
3568 program or return by other means. */
3569
3570static inline void
3571gimple_call_set_expected_throw (gcall *s, bool expected_throw_p)
3572{
3573 if (expected_throw_p)
3575 else
3576 s->subcode &= ~GF_CALL_XTHROW;
3577}
3578
3579/* Return true if S is a call that is more likely to end by
3580 propagating an exception than by other means. */
3581
3582static inline bool
3584{
3585 return (gimple_call_flags (s) & ECF_XTHROW) != 0;
3586}
3587
3588/* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3589 is known to be emitted for VLA objects. Those are wrapped by
3590 stack_save/stack_restore calls and hence can't lead to unbounded
3591 stack growth even when they occur in loops. */
3592
3593inline void
3594gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3595{
3596 if (for_var)
3598 else
3599 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3600}
3601
3602/* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3604inline bool
3606{
3607 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3608}
3609
3610inline bool
3612{
3613 const gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3614 return (gc->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3615}
3616
3617/* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3618 pointers to nested function are descriptors instead of trampolines. */
3619
3620inline void
3621gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3622{
3623 if (by_descriptor_p)
3625 else
3626 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3627}
3629/* Return true if S is a by-descriptor call. */
3630
3631inline bool
3633{
3634 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3635}
3636
3637/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3639inline void
3640gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3641{
3642 dest_call->subcode = orig_call->subcode;
3643}
3644
3645
3646/* Return a pointer to the points-to solution for the set of call-used
3647 variables of the call CALL_STMT. */
3648
3649inline struct pt_solution *
3650gimple_call_use_set (gcall *call_stmt)
3652 return &call_stmt->call_used;
3653}
3654
3655/* As above, but const. */
3656
3657inline const pt_solution *
3658gimple_call_use_set (const gcall *call_stmt)
3659{
3660 return &call_stmt->call_used;
3661}
3662
3663/* Return a pointer to the points-to solution for the set of call-used
3664 variables of the call CALL_STMT. */
3665
3666inline struct pt_solution *
3668{
3669 return &call_stmt->call_clobbered;
3670}
3671
3672/* As above, but const. */
3673
3674inline const pt_solution *
3675gimple_call_clobber_set (const gcall *call_stmt)
3677 return &call_stmt->call_clobbered;
3678}
3679
3680
3681/* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3682 non-NULL lhs. */
3683
3684inline bool
3685gimple_has_lhs (const gimple *stmt)
3686{
3687 if (is_gimple_assign (stmt))
3688 return true;
3689 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3690 return gimple_call_lhs (call) != NULL_TREE;
3691 return false;
3693
3694
3695/* Return the code of the predicate computed by conditional statement GS. */
3696
3697inline enum tree_code
3698gimple_cond_code (const gcond *gs)
3699{
3700 return (enum tree_code) gs->subcode;
3702
3703inline enum tree_code
3704gimple_cond_code (const gimple *gs)
3705{
3706 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3707 return gimple_cond_code (gc);
3708}
3709
3711/* Set CODE to be the predicate code for the conditional statement GS. */
3712
3713inline void
3714gimple_cond_set_code (gcond *gs, enum tree_code code)
3715{
3716 gs->subcode = code;
3717}
3718
3719
3720/* Return the LHS of the predicate computed by conditional statement GS. */
3721
3722inline tree
3723gimple_cond_lhs (const gcond *gs)
3724{
3725 return gs->op[0];
3727
3728inline tree
3729gimple_cond_lhs (const gimple *gs)
3730{
3731 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3732 return gimple_cond_lhs (gc);
3733}
3734
3735/* Return the pointer to the LHS of the predicate computed by conditional
3736 statement GS. */
3737
3738inline tree *
3740{
3741 return &gs->op[0];
3742}
3743
3744/* Set LHS to be the LHS operand of the predicate computed by
3745 conditional statement GS. */
3747inline void
3749{
3750 gs->op[0] = lhs;
3751}
3752
3753
3754/* Return the RHS operand of the predicate computed by conditional GS. */
3755
3756inline tree
3757gimple_cond_rhs (const gcond *gs)
3758{
3759 return gs->op[1];
3760}
3761
3762inline tree
3763gimple_cond_rhs (const gimple *gs)
3764{
3765 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3766 return gimple_cond_rhs (gc);
3767}
3768
3769/* Return the pointer to the RHS operand of the predicate computed by
3770 conditional GS. */
3771
3772inline tree *
3774{
3775 return &gs->op[1];
3777
3778
3779/* Set RHS to be the RHS operand of the predicate computed by
3780 conditional statement GS. */
3781
3782inline void
3784{
3785 gs->op[1] = rhs;
3786}
3787
3788
3789/* Return the label used by conditional statement GS when its
3790 predicate evaluates to true. */
3791
3792inline tree
3793gimple_cond_true_label (const gcond *gs)
3794{
3795 return gs->op[2];
3797
3798
3799/* Set LABEL to be the label used by conditional statement GS when its
3800 predicate evaluates to true. */
3801
3802inline void
3804{
3805 gs->op[2] = label;
3806}
3808
3809/* Set LABEL to be the label used by conditional statement GS when its
3810 predicate evaluates to false. */
3811
3812inline void
3814{
3815 gs->op[3] = label;
3816}
3817
3818
3819/* Return the label used by conditional statement GS when its
3820 predicate evaluates to false. */
3821
3822inline tree
3824{
3825 return gs->op[3];
3826}
3827
3828
3829/* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3830
3831inline void
3833{
3836 gs->subcode = NE_EXPR;
3837}
3838
3839
3840/* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3841
3842inline void
3844{
3847 gs->subcode = NE_EXPR;
3848}
3849
3850/* Check if conditional statemente GS is of the form 'if (1 == 1)',
3851 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3852
3853inline bool
3854gimple_cond_true_p (const gcond *gs)
3855{
3857 tree rhs = gimple_cond_rhs (gs);
3858 enum tree_code code = gimple_cond_code (gs);
3859
3860 if (lhs != boolean_true_node && lhs != boolean_false_node)
3861 return false;
3862
3863 if (rhs != boolean_true_node && rhs != boolean_false_node)
3864 return false;
3865
3866 if (code == NE_EXPR && lhs != rhs)
3867 return true;
3868
3869 if (code == EQ_EXPR && lhs == rhs)
3870 return true;
3871
3872 return false;
3873}
3874
3875/* Check if conditional statement GS is of the form 'if (1 != 1)',
3876 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3877
3878inline bool
3879gimple_cond_false_p (const gcond *gs)
3880{
3881 tree lhs = gimple_cond_lhs (gs);
3882 tree rhs = gimple_cond_rhs (gs);
3883 enum tree_code code = gimple_cond_code (gs);
3884
3885 if (lhs != boolean_true_node && lhs != boolean_false_node)
3886 return false;
3887
3888 if (rhs != boolean_true_node && rhs != boolean_false_node)
3889 return false;
3890
3891 if (code == NE_EXPR && lhs == rhs)
3892 return true;
3893
3894 if (code == EQ_EXPR && lhs != rhs)
3895 return true;
3896
3897 return false;
3898}
3900/* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3901
3902inline void
3903gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3904 tree rhs)
3905{
3906 gimple_cond_set_code (stmt, code);
3907 gimple_cond_set_lhs (stmt, lhs);
3909}
3910
3911
3912/* Return the tree code for the expression computed by STMT. This is
3913 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3914 GIMPLE_CALL, return CALL_EXPR as the expression code for
3915 consistency. This is useful when the caller needs to deal with the
3916 three kinds of computation that GIMPLE supports. */
3917
3918inline enum tree_code
3919gimple_expr_code (const gimple *stmt)
3920{
3921 if (const gassign *ass = dyn_cast<const gassign *> (stmt))
3922 return gimple_assign_rhs_code (ass);
3923 if (const gcond *cond = dyn_cast<const gcond *> (stmt))
3924 return gimple_cond_code (cond);
3925 else
3926 {
3928 return CALL_EXPR;
3929 }
3930}
3931
3932
3933/* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3934
3935inline tree
3936gimple_label_label (const glabel *gs)
3938 return gs->op[0];
3939}
3940
3941
3942/* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3943 GS. */
3944
3945inline void
3948 gs->op[0] = label;
3949}
3950
3951
3952/* Return the destination of the unconditional jump GS. */
3953
3954inline tree
3955gimple_goto_dest (const gimple *gs)
3956{
3957 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3958 return gimple_op (gs, 0);
3959}
3960
3961
3962/* Set DEST to be the destination of the unconditonal jump GS. */
3963
3964inline void
3966{
3967 gs->op[0] = dest;
3968}
3969
3970
3971/* Return the variables declared in the GIMPLE_BIND statement GS. */
3973inline tree
3974gimple_bind_vars (const gbind *bind_stmt)
3975{
3976 return bind_stmt->vars;
3977}
3978
3979
3980/* Set VARS to be the set of variables declared in the GIMPLE_BIND
3981 statement GS. */
3982
3983inline void
3984gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3985{
3986 bind_stmt->vars = vars;
3987}
3988
3989
3990/* Append VARS to the set of variables declared in the GIMPLE_BIND
3991 statement GS. */
3992
3993inline void
3994gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3995{
3996 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3997}
3998
3999
4001gimple_bind_body_ptr (gbind *bind_stmt)
4002{
4003 return &bind_stmt->body;
4004}
4005
4006/* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
4007
4008inline gimple_seq
4009gimple_bind_body (const gbind *gs)
4011 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
4012}
4013
4014
4015/* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
4016 statement GS. */
4017
4018inline void
4019gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
4020{
4021 bind_stmt->body = seq;
4022}
4023
4024
4025/* Append a statement to the end of a GIMPLE_BIND's body. */
4026
4027inline void
4028gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
4029{
4030 gimple_seq_add_stmt (&bind_stmt->body, stmt);
4031}
4032
4033
4034/* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
4035
4036inline void
4037gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
4038{
4039 gimple_seq_add_seq (&bind_stmt->body, seq);
4040}
4041
4042
4043/* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
4044 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
4045
4046inline tree
4047gimple_bind_block (const gbind *bind_stmt)
4048{
4049 return bind_stmt->block;
4050}
4051
4052
4053/* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
4054 statement GS. */
4056inline void
4057gimple_bind_set_block (gbind *bind_stmt, tree block)
4058{
4060 || TREE_CODE (block) == BLOCK);
4061 bind_stmt->block = block;
4062}
4063
4065/* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
4066
4067inline unsigned
4068gimple_asm_ninputs (const gasm *asm_stmt)
4069{
4070 return asm_stmt->ni;
4071}
4072
4073
4074/* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
4076inline unsigned
4077gimple_asm_noutputs (const gasm *asm_stmt)
4078{
4079 return asm_stmt->no;
4080}
4081
4082
4083/* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
4085inline unsigned
4086gimple_asm_nclobbers (const gasm *asm_stmt)
4087{
4088 return asm_stmt->nc;
4089}
4090
4091/* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
4092
4093inline unsigned
4094gimple_asm_nlabels (const gasm *asm_stmt)
4096 return asm_stmt->nl;
4097}
4098
4099/* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
4100
4101inline tree
4102gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
4103{
4104 gcc_gimple_checking_assert (index < asm_stmt->ni);
4105 return asm_stmt->op[index + asm_stmt->no];
4106}
4107
4108/* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4109
4110inline void
4111gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
4112{
4113 gcc_gimple_checking_assert (index < asm_stmt->ni
4114 && TREE_CODE (in_op) == TREE_LIST);
4115 asm_stmt->op[index + asm_stmt->no] = in_op;
4116}
4117
4118
4119/* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4120
4121inline tree
4122gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
4123{
4124 gcc_gimple_checking_assert (index < asm_stmt->no);
4125 return asm_stmt->op[index];
4126}
4127
4128/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4129
4130inline void
4131gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
4132{
4133 gcc_gimple_checking_assert (index < asm_stmt->no
4134 && TREE_CODE (out_op) == TREE_LIST);
4135 asm_stmt->op[index] = out_op;
4136}
4137
4138
4139/* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4140
4141inline tree
4142gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
4143{
4144 gcc_gimple_checking_assert (index < asm_stmt->nc);
4145 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
4146}
4147
4148
4149/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4150
4151inline void
4152gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
4154 gcc_gimple_checking_assert (index < asm_stmt->nc
4155 && TREE_CODE (clobber_op) == TREE_LIST);
4156 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4157}
4158
4159/* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4160
4161inline tree
4162gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4163{
4164 gcc_gimple_checking_assert (index < asm_stmt->nl);
4165 return asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc];
4166}
4167
4168/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4169
4170inline void
4171gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4172{
4173 gcc_gimple_checking_assert (index < asm_stmt->nl
4174 && TREE_CODE (label_op) == TREE_LIST);
4175 asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc] = label_op;
4176}
4177
4178/* Return the string representing the assembly instruction in
4179 GIMPLE_ASM ASM_STMT. */
4180
4181inline const char *
4182gimple_asm_string (const gasm *asm_stmt)
4183{
4184 return asm_stmt->string;
4185}
4187
4188/* Return true if ASM_STMT is marked volatile. */
4189
4190inline bool
4191gimple_asm_volatile_p (const gasm *asm_stmt)
4192{
4193 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4194}
4195
4196
4197/* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4199inline void
4200gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4201{
4202 if (volatile_p)
4203 asm_stmt->subcode |= GF_ASM_VOLATILE;
4204 else
4205 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4206}
4208
4209/* Return true if ASM_STMT is marked inline. */
4210
4211inline bool
4212gimple_asm_inline_p (const gasm *asm_stmt)
4213{
4214 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4215}
4217
4218/* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4219
4220inline void
4221gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4222{
4223 if (inline_p)
4224 asm_stmt->subcode |= GF_ASM_INLINE;
4225 else
4226 asm_stmt->subcode &= ~GF_ASM_INLINE;
4227}
4228
4229
4230/* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4231
4232inline void
4233gimple_asm_set_input (gasm *asm_stmt, bool input_p)
4234{
4235 if (input_p)
4236 asm_stmt->subcode |= GF_ASM_INPUT;
4237 else
4238 asm_stmt->subcode &= ~GF_ASM_INPUT;
4239}
4240
4241
4242/* Return true if asm ASM_STMT is an ASM_INPUT. */
4243
4244inline bool
4245gimple_asm_input_p (const gasm *asm_stmt)
4246{
4247 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4248}
4249
4250
4251/* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4252
4253inline tree
4254gimple_catch_types (const gcatch *catch_stmt)
4255{
4256 return catch_stmt->types;
4257}
4258
4259
4260/* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4261
4262inline tree *
4264{
4265 return &catch_stmt->types;
4266}
4267
4268
4269/* Return a pointer to the GIMPLE sequence representing the body of
4270 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4271
4272inline gimple_seq *
4273gimple_catch_handler_ptr (gcatch *catch_stmt)
4275 return &catch_stmt->handler;
4276}
4277
4278
4279/* Return the GIMPLE sequence representing the body of the handler of
4280 GIMPLE_CATCH statement CATCH_STMT. */
4281
4282inline gimple_seq
4283gimple_catch_handler (const gcatch *catch_stmt)
4284{
4285 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4286}
4287
4288
4289/* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4290
4291inline void
4292gimple_catch_set_types (gcatch *catch_stmt, tree t)
4293{
4294 catch_stmt->types = t;
4295}
4297
4298/* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4299
4300inline void
4301gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4302{
4303 catch_stmt->handler = handler;
4304}
4305
4307/* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4308
4309inline tree
4311{
4312 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4313 return eh_filter_stmt->types;
4314}
4315
4317/* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4318 GS. */
4319
4320inline tree *
4322{
4323 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4324 return &eh_filter_stmt->types;
4326
4327
4328/* Return a pointer to the sequence of statement to execute when
4329 GIMPLE_EH_FILTER statement fails. */
4330
4331inline gimple_seq *
4334 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4335 return &eh_filter_stmt->failure;
4336}
4337
4338
4339/* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4340 statement fails. */
4341
4344{
4345 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4346}
4347
4349/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4350 EH_FILTER_STMT. */
4351
4352inline void
4353gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4355 eh_filter_stmt->types = types;
4356}
4357
4358
4359/* Set FAILURE to be the sequence of statements to execute on failure
4360 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4361
4362inline void
4365{
4366 eh_filter_stmt->failure = failure;
4367}
4368
4369/* Get the function decl to be called by the MUST_NOT_THROW region. */
4370
4371inline tree
4373{
4374 return eh_mnt_stmt->fndecl;
4375}
4376
4377/* Set the function decl to be called by GS to DECL. */
4378
4379inline void
4381 tree decl)
4382{
4383 eh_mnt_stmt->fndecl = decl;
4384}
4385
4386/* GIMPLE_EH_ELSE accessors. */
4387
4388inline gimple_seq *
4389gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4390{
4391 return &eh_else_stmt->n_body;
4392}
4394inline gimple_seq
4395gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4396{
4397 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4398}
4399
4400inline gimple_seq *
4401gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4402{
4403 return &eh_else_stmt->e_body;
4404}
4406inline gimple_seq
4407gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4408{
4409 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4410}
4411
4412inline void
4414{
4415 eh_else_stmt->n_body = seq;
4417
4418inline void
4420{
4421 eh_else_stmt->e_body = seq;
4422}
4423
4424/* GIMPLE_TRY accessors. */
4425
4426/* Return the kind of try block represented by GIMPLE_TRY GS. This is
4427 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4428
4429inline enum gimple_try_flags
4430gimple_try_kind (const gimple *gs)
4431{
4432 GIMPLE_CHECK (gs, GIMPLE_TRY);
4433 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4434}
4435
4437/* Set the kind of try block represented by GIMPLE_TRY GS. */
4438
4439inline void
4441{
4443 || kind == GIMPLE_TRY_FINALLY);
4444 if (gimple_try_kind (gs) != kind)
4445 gs->subcode = (unsigned int) kind;
4446}
4448
4449/* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4450
4451inline bool
4453{
4455 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4457
4458
4459/* Return a pointer to the sequence of statements used as the
4460 body for GIMPLE_TRY GS. */
4461
4462inline gimple_seq *
4464{
4465 gtry *try_stmt = as_a <gtry *> (gs);
4466 return &try_stmt->eval;
4467}
4468
4469
4470/* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4471
4472inline gimple_seq
4473gimple_try_eval (const gimple *gs)
4474{
4475 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4476}
4477
4478
4479/* Return a pointer to the sequence of statements used as the cleanup body for
4480 GIMPLE_TRY GS. */
4481
4482inline gimple_seq *
4484{
4485 gtry *try_stmt = as_a <gtry *> (gs);
4486 return &try_stmt->cleanup;
4487}
4488
4490/* Return the sequence of statements used as the cleanup body for
4491 GIMPLE_TRY GS. */
4492
4493inline gimple_seq
4494gimple_try_cleanup (const gimple *gs)
4495{
4496 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4497}
4498
4500/* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4501
4502inline void
4503gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4504{
4506 if (catch_is_cleanup)
4507 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4508 else
4509 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4510}
4511
4512
4513/* Set EVAL to be the sequence of statements to use as the body for
4514 GIMPLE_TRY TRY_STMT. */
4515
4516inline void
4517gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4519 try_stmt->eval = eval;
4520}
4521
4522
4523/* Set CLEANUP to be the sequence of statements to use as the cleanup
4524 body for GIMPLE_TRY TRY_STMT. */
4525
4526inline void
4527gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4529 try_stmt->cleanup = cleanup;
4530}
4531
4532
4533/* Return a pointer to the cleanup sequence for cleanup statement GS. */
4534
4535inline gimple_seq *
4537{
4539 return &wce_stmt->cleanup;
4540}
4541
4542
4543/* Return the cleanup sequence for cleanup statement GS. */
4544
4545inline gimple_seq
4547{
4548 return *gimple_wce_cleanup_ptr (gs);
4549}
4551
4552/* Set CLEANUP to be the cleanup sequence for GS. */
4553
4554inline void
4556{
4558 wce_stmt->cleanup = cleanup;
4559}
4561
4562/* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4563
4564inline bool
4567 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4568 return gs->subcode != 0;
4569}
4570
4571
4572/* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4573
4574inline void
4576{
4577 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4578 gs->subcode = (unsigned int) eh_only_p;
4579}
4580
4582/* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4583
4584inline unsigned
4585gimple_phi_capacity (const gimple *gs)
4586{
4587 const gphi *phi_stmt = as_a <const gphi *> (gs);
4588 return phi_stmt->capacity;
4589}
4591
4592/* Return the number of arguments in GIMPLE_PHI GS. This must always
4593 be exactly the number of incoming edges for the basic block holding
4594 GS. */
4595
4596inline unsigned
4597gimple_phi_num_args (const gimple *gs)
4598{
4599 const gphi *phi_stmt = as_a <const gphi *> (gs);
4600 return phi_stmt->nargs;
4601}
4603
4604/* Return the SSA name created by GIMPLE_PHI GS. */
4605
4606inline tree
4607gimple_phi_result (const gphi *gs)
4608{
4609 return gs->result;
4610}
4611
4612inline tree
4613gimple_phi_result (const gimple *gs)
4614{
4615 const gphi *phi_stmt = as_a <const gphi *> (gs);
4616 return gimple_phi_result (phi_stmt);
4617}
4618
4619/* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4620
4621inline tree *
4624 return &gs->result;
4625}
4626
4627inline tree *
4629{
4630 gphi *phi_stmt = as_a <gphi *> (gs);
4631 return gimple_phi_result_ptr (phi_stmt);
4632}
4634/* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4635
4636inline void
4637gimple_phi_set_result (gphi *phi, tree result)
4638{
4639 phi->result = result;
4640 if (result && TREE_CODE (result) == SSA_NAME)
4641 SSA_NAME_DEF_STMT (result) = phi;
4642}
4644
4645/* Return the PHI argument corresponding to incoming edge INDEX for
4646 GIMPLE_PHI GS. */
4647
4648inline struct phi_arg_d *
4649gimple_phi_arg (gphi *gs, unsigned index)
4650{
4651 gcc_gimple_checking_assert (index < gs->nargs);
4652 return &(gs->args[index]);
4653}
4654
4655inline const phi_arg_d *
4656gimple_phi_arg (const gphi *gs, unsigned index)
4657{
4658 gcc_gimple_checking_assert (index < gs->nargs);
4659 return &(gs->args[index]);
4660}
4662inline const phi_arg_d *
4663gimple_phi_arg (const gimple *gs, unsigned index)
4664{
4665 const gphi *phi_stmt = as_a <const gphi *> (gs);
4666 return gimple_phi_arg (phi_stmt, index);
4668
4669inline struct phi_arg_d *
4670gimple_phi_arg (gimple *gs, unsigned index)
4671{
4672 gphi *phi_stmt = as_a <gphi *> (gs);
4673 return gimple_phi_arg (phi_stmt, index);
4674}
4675
4676/* Set PHIARG to be the argument corresponding to incoming edge INDEX
4677 for GIMPLE_PHI PHI. */
4678
4679inline void
4680gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4681{
4682 gcc_gimple_checking_assert (index < phi->nargs);
4683 phi->args[index] = *phiarg;
4684}
4685
4686/* Return the PHI nodes for basic block BB, or NULL if there are no
4687 PHI nodes. */
4688
4689inline gimple_seq
4691{
4692 gcc_checking_assert (!(bb->flags & BB_RTL));
4693 return bb->il.gimple.phi_nodes;
4694}
4695
4696/* Return a pointer to the PHI nodes for basic block BB. */
4697
4698inline gimple_seq *
4701 gcc_checking_assert (!(bb->flags & BB_RTL));
4702 return &bb->il.gimple.phi_nodes;
4703}
4704
4705/* Return the tree operand for argument I of PHI node GS. */
4706
4707inline tree
4708gimple_phi_arg_def (const gphi *gs, size_t index)
4709{
4710 return gimple_phi_arg (gs, index)->def;
4711}
4712
4713inline tree
4714gimple_phi_arg_def (const gimple *gs, size_t index)
4715{
4716 return gimple_phi_arg (gs, index)->def;
4717}
4718
4719/* Return the tree operand for the argument associated with
4720 edge E of PHI node GS. */
4721
4722inline tree
4725 gcc_checking_assert (e->dest == gimple_bb (gs));
4726 return gimple_phi_arg (gs, e->dest_idx)->def;
4727}
4728
4729inline tree
4731{
4733 return gimple_phi_arg (gs, e->dest_idx)->def;
4734}
4735
4736/* Return a pointer to the tree operand for argument I of phi node PHI. */
4737
4738inline tree *
4739gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4741 return &gimple_phi_arg (phi, index)->def;
4742}
4743
4744/* Return the edge associated with argument I of phi node PHI. */
4745
4746inline edge
4747gimple_phi_arg_edge (const gphi *phi, size_t i)
4749 return EDGE_PRED (gimple_bb (phi), i);
4750}
4751
4752/* Return the source location of gimple argument I of phi node PHI. */
4753
4754inline location_t
4755gimple_phi_arg_location (const gphi *phi, size_t i)
4756{
4757 return gimple_phi_arg (phi, i)->locus;
4758}
4759
4760/* Return the source location of the argument on edge E of phi node PHI. */
4761
4762inline location_t
4764{
4765 return gimple_phi_arg (phi, e->dest_idx)->locus;
4766}
4767
4768/* Set the source location of gimple argument I of phi node PHI to LOC. */
4769
4770inline void
4771gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4772{
4773 gimple_phi_arg (phi, i)->locus = loc;
4774}
4776/* Return address of source location of gimple argument I of phi node PHI. */
4777
4778inline location_t *
4779gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4780{
4781 return &gimple_phi_arg (phi, i)->locus;
4782}
4783
4784/* Return TRUE if argument I of phi node PHI has a location record. */
4785
4786inline bool
4788{
4790}
4791
4792/* Return the number of arguments that can be accessed by gimple_arg. */
4793
4794inline unsigned
4796{
4797 if (auto phi = dyn_cast<const gphi *> (gs))
4798 return gimple_phi_num_args (phi);
4799 if (auto call = dyn_cast<const gcall *> (gs))
4800 return gimple_call_num_args (call);
4801 return gimple_num_ops (as_a <const gassign *> (gs)) - 1;
4802}
4804/* GS must be an assignment, a call, or a PHI.
4805 If it's an assignment, return rhs operand I.
4806 If it's a call, return function argument I.
4807 If it's a PHI, return the value of PHI argument I. */
4808
4809inline tree
4810gimple_arg (const gimple *gs, unsigned int i)
4811{
4812 if (auto phi = dyn_cast<const gphi *> (gs))
4813 return gimple_phi_arg_def (phi, i);
4814 if (auto call = dyn_cast<const gcall *> (gs))
4815 return gimple_call_arg (call, i);
4816 return gimple_op (as_a <const gassign *> (gs), i + 1);
4817}
4818
4819/* Return a pointer to gimple_arg (GS, I). */
4821inline tree *
4822gimple_arg_ptr (gimple *gs, unsigned int i)
4823{
4824 if (auto phi = dyn_cast<gphi *> (gs))
4825 return gimple_phi_arg_def_ptr (phi, i);
4826 if (auto call = dyn_cast<gcall *> (gs))
4827 return gimple_call_arg_ptr (call, i);
4828 return gimple_op_ptr (as_a <gassign *> (gs), i + 1);
4829}
4830
4831/* Return the region number for GIMPLE_RESX RESX_STMT. */
4832
4833inline int
4834gimple_resx_region (const gresx *resx_stmt)
4835{
4836 return resx_stmt->region;
4837}
4838
4839/* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4840
4841inline void
4842gimple_resx_set_region (gresx *resx_stmt, int region)
4844 resx_stmt->region = region;
4845}
4846
4847/* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4848
4849inline int
4850gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4851{
4852 return eh_dispatch_stmt->region;
4853}
4854
4855/* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4856 EH_DISPATCH_STMT. */
4857
4858inline void
4859gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4860{
4861 eh_dispatch_stmt->region = region;
4862}
4863
4864/* Return the number of labels associated with the switch statement GS. */
4865
4866inline unsigned
4868{
4869 unsigned num_ops;
4870 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4871 num_ops = gimple_num_ops (gs);
4873 return num_ops - 1;
4874}
4875
4876
4877/* Set NLABELS to be the number of labels for the switch statement GS. */
4878
4879inline void
4880gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4882 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4883 gimple_set_num_ops (g, nlabels + 1);
4884}
4885
4886
4887/* Return the index variable used by the switch statement GS. */
4888
4889inline tree
4890gimple_switch_index (const gswitch *gs)
4891{
4892 return gs->op[0];
4893}
4894
4895
4896/* Return a pointer to the index variable for the switch statement GS. */
4897
4898inline tree *
4900{
4901 return &gs->op[0];
4903
4904
4905/* Set INDEX to be the index variable for switch statement GS. */
4906
4907inline void
4909{
4911 gs->op[0] = index;
4912}
4913
4914
4915/* Return the label numbered INDEX. The default label is 0, followed by any
4916 labels in a switch statement. */
4917
4918inline tree
4919gimple_switch_label (const gswitch *gs, unsigned index)
4921 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4922 return gs->op[index + 1];
4923}
4924
4925/* Set the label number INDEX to LABEL. 0 is always the default label. */
4926
4927inline void
4928gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4929{
4931 && (label == NULL_TREE
4932 || TREE_CODE (label) == CASE_LABEL_EXPR));
4933 gs->op[index + 1] = label;
4934}
4935
4936/* Return the default label for a switch statement. */
4937
4938inline tree
4940{
4941 tree label = gimple_switch_label (gs, 0);
4942 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4943 return label;
4944}
4945
4946/* Set the default label for a switch statement. */
4948inline void
4950{
4951 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4952 gimple_switch_set_label (gs, 0, label);
4953}
4954
4955/* Return true if GS is a GIMPLE_DEBUG statement. */
4956
4957inline bool
4959{
4960 return gimple_code (gs) == GIMPLE_DEBUG;
4961}
4962
4963
4964/* Return the first nondebug statement in GIMPLE sequence S. */
4965
4966inline gimple *
4968{
4970 while (n && is_gimple_debug (n))
4971 n = n->next;
4972 return n;
4973}
4974
4975
4976/* Return the last nondebug statement in GIMPLE sequence S. */
4977
4978inline gimple *
4982 for (n = gimple_seq_last (s);
4983 n && is_gimple_debug (n);
4984 n = n->prev)
4985 if (n == s)
4986 return NULL;
4987 return n;
4988}
4989
4991/* Return true if S is a GIMPLE_DEBUG BIND statement. */
4992
4993inline bool
4994gimple_debug_bind_p (const gimple *s)
4995{
4996 if (is_gimple_debug (s))
4997 return s->subcode == GIMPLE_DEBUG_BIND;
4998
4999 return false;
5000}
5002/* Return the variable bound in a GIMPLE_DEBUG bind statement. */
5003
5004inline tree
5006{
5007 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5009 return gimple_op (dbg, 0);
5011
5012/* Return the value bound to the variable in a GIMPLE_DEBUG bind
5013 statement. */
5014
5015inline tree
5017{
5018 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5020 return gimple_op (dbg, 1);
5021}
5022
5023/* Return a pointer to the value bound to the variable in a
5024 GIMPLE_DEBUG bind statement. */
5025
5026inline tree *
5028{
5029 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5031 return gimple_op_ptr (dbg, 1);
5032}
5033
5034/* Set the variable bound in a GIMPLE_DEBUG bind statement. */
5035
5036inline void
5038{
5039 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5041 gimple_set_op (dbg, 0, var);
5042}
5043
5044/* Set the value bound to the variable in a GIMPLE_DEBUG bind
5045 statement. */
5046
5047inline void
5049{
5050 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5052 gimple_set_op (dbg, 1, value);
5053}
5054
5055/* The second operand of a GIMPLE_DEBUG_BIND, when the value was
5056 optimized away. */
5057#define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
5058
5059/* Remove the value bound to the variable in a GIMPLE_DEBUG bind
5060 statement. */
5062inline void
5064{
5065 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5068}
5069
5070/* Return true if the GIMPLE_DEBUG bind statement is bound to a
5071 value. */
5073inline bool
5075{
5076 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5078 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
5079}
5080
5081#undef GIMPLE_DEBUG_BIND_NOVALUE
5083/* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
5084
5085inline bool
5087{
5088 if (is_gimple_debug (s))
5089 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
5090
5091 return false;
5092}
5094/* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
5095
5096inline tree
5098{
5099 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5101 return gimple_op (dbg, 0);
5102}
5104/* Return the value bound to the variable in a GIMPLE_DEBUG source bind
5105 statement. */
5106
5107inline tree
5109{
5110 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5112 return gimple_op (dbg, 1);
5113}
5115/* Return a pointer to the value bound to the variable in a
5116 GIMPLE_DEBUG source bind statement. */
5117
5118inline tree *
5120{
5121 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5123 return gimple_op_ptr (dbg, 1);
5124}
5126/* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
5127
5128inline void
5130{
5131 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5133 gimple_set_op (dbg, 0, var);
5134}
5135
5136/* Set the value bound to the variable in a GIMPLE_DEBUG source bind
5137 statement. */
5138
5139inline void
5141{
5142 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5144 gimple_set_op (dbg, 1, value);
5145}
5146
5147/* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
5148
5149inline bool
5151{
5152 if (is_gimple_debug (s))
5153 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
5155 return false;
5156}
5157
5158/* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
5159
5160inline bool
5163 if (is_gimple_debug (s))
5165
5166 return false;
5167}
5168
5169/* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
5171inline bool
5173{
5174 if (is_gimple_debug (s))
5175 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
5177
5178 return false;
5180
5181/* Return the line number for EXPR, or return -1 if we have no line
5182 number information for it. */
5183inline int
5184get_lineno (const gimple *stmt)
5185{
5186 location_t loc;
5187
5188 if (!stmt)
5189 return -1;
5190
5191 loc = gimple_location (stmt);
5192 if (loc == UNKNOWN_LOCATION)
5193 return -1;
5194
5195 return LOCATION_LINE (loc);
5196}
5197
5198/* Return a pointer to the body for the OMP statement GS. */
5200inline gimple_seq *
5202{
5203 return &static_cast <gimple_statement_omp *> (gs)->body;
5204}
5205
5206/* Return the body for the OMP statement GS. */
5207
5209gimple_omp_body (const gimple *gs)
5210{
5211 return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
5212}
5213
5214/* Set BODY to be the body for the OMP statement GS. */
5215
5216inline void
5219 static_cast <gimple_statement_omp *> (gs)->body = body;
5220}
5221
5222
5223/* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5224
5225inline tree
5226gimple_omp_critical_name (const gomp_critical *crit_stmt)
5227{
5228 return crit_stmt->name;
5229}
5230
5231
5232/* Return a pointer to the name associated with OMP critical statement
5233 CRIT_STMT. */
5234
5235inline tree *
5238 return &crit_stmt->name;
5239}
5240
5241
5242/* Set NAME to be the name associated with OMP critical statement
5243 CRIT_STMT. */
5244
5245inline void
5248 crit_stmt->name = name;
5249}
5250
5251
5252/* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5253
5254inline tree
5256{
5257 return crit_stmt->clauses;
5258}
5259
5260
5261/* Return a pointer to the clauses associated with OMP critical statement
5262 CRIT_STMT. */
5263
5264inline tree *
5267 return &crit_stmt->clauses;
5268}
5269
5270
5271/* Set CLAUSES to be the clauses associated with OMP critical statement
5272 CRIT_STMT. */
5273
5274inline void
5277 crit_stmt->clauses = clauses;
5278}
5279
5280
5281/* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5282
5283inline tree
5285{
5286 return ord_stmt->clauses;
5287}
5288
5289
5290/* Return a pointer to the clauses associated with OMP ordered statement
5291 ORD_STMT. */
5292
5293inline tree *
5296 return &ord_stmt->clauses;
5297}
5298
5299
5300/* Set CLAUSES to be the clauses associated with OMP ordered statement
5301 ORD_STMT. */
5302
5303inline void
5305{
5306 ord_stmt->clauses = clauses;
5308
5309
5310/* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5311
5312inline tree
5313gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5314{
5315 return scan_stmt->clauses;
5316}
5317
5319/* Return a pointer to the clauses associated with OMP scan statement
5320 ORD_STMT. */
5321
5322inline tree *
5324{
5325 return &scan_stmt->clauses;
5326}
5327
5328
5329/* Set CLAUSES to be the clauses associated with OMP scan statement
5330 ORD_STMT. */
5331
5332inline void
5333gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5334{