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, \
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
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;
239 /* Nonzero if this tuple represents a non-temporal move. */
240 unsigned int nontemporal_move : 1;
241
242 /* Pass local flags. These flags are free for any pass to use as
243 they see fit. Passes should not assume that these flags contain
244 any useful value when the pass starts. Any initial state that
245 the pass requires should be set on entry to the pass. See
246 gimple_set_plf and gimple_plf for usage. */
247 unsigned int plf : 2;
248
249 /* Nonzero if this statement has been modified and needs to have its
250 operands rescanned. */
251 unsigned modified : 1;
253 /* Nonzero if this statement contains volatile operands. */
254 unsigned has_volatile_ops : 1;
256 /* Padding to get subcode to 16 bit alignment. */
257 unsigned pad : 1;
258
259 /* The SUBCODE field can be used for tuple-specific flags for tuples
260 that do not require subcodes. Note that SUBCODE should be at
261 least as wide as tree codes, as several tuples store tree codes
262 in there. */
263 unsigned int subcode : 16;
264
265 /* UID of this statement. This is used by passes that want to
266 assign IDs to statements. It must be assigned and used by each
267 pass. By default it should be assumed to contain garbage. */
268 unsigned uid;
269
270 /* [ WORD 2 ]
271 Locus information for debug info. */
272 location_t location;
274 /* Number of operands in this tuple. */
275 unsigned num_ops;
276
277 /* [ WORD 3 ]
278 Basic block holding this statement. */
279 basic_block bb;
280
281 /* [ WORD 4-5 ]
282 Linked lists of gimple statements. The next pointers form
283 a NULL terminated list, the prev pointers are a cyclic list.
284 A gimple statement is hence also a double-ended list of
285 statements, with the pointer itself being the first element,
286 and the prev pointer being the last. */
287 gimple *next;
288 gimple *GTY((skip)) prev;
289};
290
291
292/* Base structure for tuples with operands. */
294/* This gimple subclass has no tag value. */
295struct GTY(())
297{
298 /* [ WORD 1-6 ] : base class */
299
300 /* [ WORD 7 ]
301 SSA operand vectors. NOTE: It should be possible to
302 amalgamate these vectors with the operand vector OP. However,
303 the SSA operand vectors are organized differently and contain
304 more information (like immediate use chaining). */
305 struct use_optype_d GTY((skip (""))) *use_ops;
306};
307
309/* Statements that take register operands. */
310
311struct GTY((tag("GSS_WITH_OPS")))
313{
314 /* [ WORD 1-7 ] : base class */
315
316 /* [ WORD 8 ]
317 Operand vector. NOTE! This must always be the last field
318 of this structure. In particular, this means that this
319 structure cannot be embedded inside another one. */
320 tree GTY((length ("%h.num_ops"))) op[1];
321};
323
324/* Base for statements that take both memory and register operands. */
325
328{
329 /* [ WORD 1-7 ] : base class */
331 /* [ WORD 8-9 ]
332 Virtual operands for this statement. The GC will pick them
333 up via the ssa_names array. */
334 tree GTY((skip (""))) vdef;
335 tree GTY((skip (""))) vuse;
337
338
339/* Statements that take both memory and register operands. */
340
344{
345 /* [ WORD 1-9 ] : base class */
346
347 /* [ WORD 10 ]
348 Operand vector. NOTE! This must always be the last field
349 of this structure. In particular, this means that this
350 structure cannot be embedded inside another one. */
351 tree GTY((length ("%h.num_ops"))) op[1];
352};
353
354
355/* Call statements that take both memory and register operands. */
359{
360 /* [ WORD 1-9 ] : base class */
362 /* [ WORD 10-13 ] */
363 struct pt_solution call_used;
364 struct pt_solution call_clobbered;
365
366 /* [ WORD 14 ] */
367 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
368 tree GTY ((tag ("0"))) fntype;
370 } u;
372 /* [ WORD 15 ]
373 Operand vector. NOTE! This must always be the last field
374 of this structure. In particular, this means that this
375 structure cannot be embedded inside another one. */
376 tree GTY((length ("%h.num_ops"))) op[1];
379};
380
381
382/* OMP statements. */
383
384struct GTY((tag("GSS_OMP")))
386{
387 /* [ WORD 1-6 ] : base class */
389 /* [ WORD 7 ] */
390 gimple_seq body;
391};
392
393
394/* GIMPLE_BIND */
395
396struct GTY((tag("GSS_BIND")))
397 gbind : public gimple
398{
399 /* [ WORD 1-6 ] : base class */
400
401 /* [ WORD 7 ]
402 Variables declared in this scope. */
403 tree vars;
404
405 /* [ WORD 8 ]
406 This is different than the BLOCK field in gimple,
407 which is analogous to TREE_BLOCK (i.e., the lexical block holding
408 this statement). This field is the equivalent of BIND_EXPR_BLOCK
409 in tree land (i.e., the lexical scope defined by this bind). See
410 gimple-low.cc. */
411 tree block;
412
413 /* [ WORD 9 ] */
414 gimple_seq body;
415};
417
418/* GIMPLE_CATCH */
420struct GTY((tag("GSS_CATCH")))
421 gcatch : public gimple
422{
423 /* [ WORD 1-6 ] : base class */
424
425 /* [ WORD 7 ] */
426 tree types;
427
428 /* [ WORD 8 ] */
429 gimple_seq handler;
430};
432
433/* GIMPLE_EH_FILTER */
434
435struct GTY((tag("GSS_EH_FILTER")))
436 geh_filter : public gimple
437{
438 /* [ WORD 1-6 ] : base class */
439
440 /* [ WORD 7 ]
441 Filter types. */
442 tree types;
443
444 /* [ WORD 8 ]
445 Failure actions. */
447};
448
449/* GIMPLE_EH_ELSE */
451struct GTY((tag("GSS_EH_ELSE")))
452 geh_else : public gimple
453{
454 /* [ WORD 1-6 ] : base class */
456 /* [ WORD 7,8 ] */
457 gimple_seq n_body, e_body;
458};
459
460/* GIMPLE_EH_MUST_NOT_THROW */
461
462struct GTY((tag("GSS_EH_MNT")))
463 geh_mnt : public gimple
464{
465 /* [ WORD 1-6 ] : base class */
467 /* [ WORD 7 ] Abort function decl. */
468 tree fndecl;
470
471/* GIMPLE_PHI */
473struct GTY((tag("GSS_PHI")))
474 gphi : public gimple
475{
476 /* [ WORD 1-6 ] : base class */
477
478 /* [ WORD 7 ] */
479 unsigned capacity;
480 unsigned nargs;
481
482 /* [ WORD 8 ] */
483 tree result;
485 /* [ WORD 9 ] */
486 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
488
489
490/* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
491
492struct GTY((tag("GSS_EH_CTRL")))
494{
495 /* [ WORD 1-6 ] : base class */
496
497 /* [ WORD 7 ]
498 Exception region number. */
499 int region;
500};
501
502struct GTY((tag("GSS_EH_CTRL")))
504{
505 /* No extra fields; adds invariant:
506 stmt->code == GIMPLE_RESX. */
507};
509struct GTY((tag("GSS_EH_CTRL")))
511{
512 /* No extra fields; adds invariant:
513 stmt->code == GIMPLE_EH_DISPATH. */
514};
515
517/* GIMPLE_TRY */
518
519struct GTY((tag("GSS_TRY")))
520 gtry : public gimple
521{
522 /* [ WORD 1-6 ] : base class */
524 /* [ WORD 7 ]
525 Expression to evaluate. */
526 gimple_seq eval;
528 /* [ WORD 8 ]
529 Cleanup expression. */
530 gimple_seq cleanup;
532
533/* Kind of GIMPLE_TRY statements. */
535{
536 /* A try/catch. */
537 GIMPLE_TRY_CATCH = 1 << 0,
538
539 /* A try/finally. */
540 GIMPLE_TRY_FINALLY = 1 << 1,
543 /* Analogous to TRY_CATCH_IS_CLEANUP. */
545};
546
547/* GIMPLE_WITH_CLEANUP_EXPR */
549struct GTY((tag("GSS_WCE")))
551{
552 /* [ WORD 1-6 ] : base class */
553
554 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
555 executed if an exception is thrown, not on normal exit of its
556 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
557 in TARGET_EXPRs. */
559 /* [ WORD 7 ]
560 Cleanup expression. */
561 gimple_seq cleanup;
562};
563
564
565/* GIMPLE_ASM */
566
567struct GTY((tag("GSS_ASM")))
569{
570 /* [ WORD 1-9 ] : base class */
571
572 /* [ WORD 10 ]
573 __asm__ statement. */
574 const char *string;
575
576 /* [ WORD 11 ]
577 Number of inputs, outputs, clobbers, labels. */
578 unsigned char ni;
579 unsigned char no;
580 unsigned char nc;
581 unsigned char nl;
582
583 /* [ WORD 12 ]
584 Operand vector. NOTE! This must always be the last field
585 of this structure. In particular, this means that this
586 structure cannot be embedded inside another one. */
587 tree GTY((length ("%h.num_ops"))) op[1];
588};
589
590/* GIMPLE_OMP_CRITICAL */
591
594{
595 /* [ WORD 1-7 ] : base class */
597 /* [ WORD 8 ] */
598 tree clauses;
600 /* [ WORD 9 ]
601 Critical section name. */
602 tree name;
603};
605
606struct GTY(()) gimple_omp_for_iter {
607 /* Condition code. */
608 enum tree_code cond;
610 /* Index variable. */
611 tree index;
612
613 /* Initial value. */
614 tree initial;
615
616 /* Final value. */
617 tree final;
618
619 /* Increment. */
620 tree incr;
621};
622
623/* GIMPLE_OMP_FOR */
624
625struct GTY((tag("GSS_OMP_FOR")))
627{
628 /* [ WORD 1-7 ] : base class */
629
630 /* [ WORD 8 ] */
631 tree clauses;
633 /* [ WORD 9 ]
634 Number of elements in iter array. */
635 size_t collapse;
637 /* [ WORD 10 ] */
638 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
639
640 /* [ WORD 11 ]
641 Pre-body evaluated before the loop body begins. */
642 gimple_seq pre_body;
643};
645
646/* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
647
650{
651 /* [ WORD 1-7 ] : base class */
652
653 /* [ WORD 8 ]
654 Clauses. */
655 tree clauses;
656
657 /* [ WORD 9 ]
658 Child function holding the body of the parallel region. */
659 tree child_fn;
661 /* [ WORD 10 ]
662 Shared data argument. */
663 tree data_arg;
664};
665
666/* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
667struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
669{
670 /* No extra fields; adds invariant:
671 stmt->code == GIMPLE_OMP_PARALLEL
672 || stmt->code == GIMPLE_OMP_TASK
673 || stmt->code == GIMPLE_OMP_TEAMS. */
675
676/* GIMPLE_OMP_PARALLEL */
677struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
680 /* No extra fields; adds invariant:
681 stmt->code == GIMPLE_OMP_PARALLEL. */
682};
683
684/* GIMPLE_OMP_TARGET */
685struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
687{
688 /* No extra fields; adds invariant:
689 stmt->code == GIMPLE_OMP_TARGET. */
690};
691
692/* GIMPLE_OMP_TASK */
693
694struct GTY((tag("GSS_OMP_TASK")))
696{
697 /* [ WORD 1-10 ] : base class */
698
699 /* [ WORD 11 ]
700 Child function holding firstprivate initialization if needed. */
702
703 /* [ WORD 12-13 ]
704 Size and alignment in bytes of the argument data block. */
705 tree arg_size;
706 tree arg_align;
708
709
710/* GIMPLE_OMP_SECTION */
711/* Uses struct gimple_statement_omp. */
713
714/* GIMPLE_OMP_SECTIONS */
716struct GTY((tag("GSS_OMP_SECTIONS")))
718{
719 /* [ WORD 1-7 ] : base class */
720
721 /* [ WORD 8 ] */
722 tree clauses;
723
724 /* [ WORD 9 ]
725 The control variable used for deciding which of the sections to
726 execute. */
727 tree control;
728};
730/* GIMPLE_OMP_CONTINUE.
731
732 Note: This does not inherit from gimple_statement_omp, because we
733 do not need the body field. */
734
735struct GTY((tag("GSS_OMP_CONTINUE")))
736 gomp_continue : public gimple
737{
738 /* [ WORD 1-6 ] : base class */
739
740 /* [ WORD 7 ] */
741 tree control_def;
742
743 /* [ WORD 8 ] */
744 tree control_use;
745};
746
747/* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
748 GIMPLE_OMP_SCAN, GIMPLE_OMP_MASKED, GIMPLE_OMP_SCOPE. */
749
750struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
752{
753 /* [ WORD 1-7 ] : base class */
754
755 /* [ WORD 8 ] */
756 tree clauses;
757};
759struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
761{
762 /* No extra fields; adds invariant:
763 stmt->code == GIMPLE_OMP_SINGLE. */
764};
765
766struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
768{
769 /* No extra fields; adds invariant:
770 stmt->code == GIMPLE_OMP_TEAMS. */
771};
772
773struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
775{
776 /* No extra fields; adds invariant:
777 stmt->code == GIMPLE_OMP_ORDERED. */
778};
779
780struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
782{
783 /* No extra fields; adds invariant:
784 stmt->code == GIMPLE_OMP_SCAN. */
785};
786
787
788/* GIMPLE_OMP_ATOMIC_LOAD.
789 Note: This is based on gimple, not g_s_omp, because g_s_omp
790 contains a sequence, which we don't need here. */
791
792struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
794{
795 /* [ WORD 1-6 ] : base class */
796
797 /* [ WORD 7-8 ] */
798 tree rhs, lhs;
799};
800
801/* GIMPLE_OMP_ATOMIC_STORE.
802 See note on GIMPLE_OMP_ATOMIC_LOAD. */
803
804struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
806{
807 /* [ WORD 1-6 ] : base class */
808
809 /* [ WORD 7 ] */
810 tree val;
813struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
816{
817 /* No extra fields; adds invariant:
818 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
819};
821struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
824{
825 /* No extra fields; adds invariant:
826 stmt->code == GIMPLE_OMP_RETURN. */
828
829/* Assumptions. */
831struct GTY((tag("GSS_ASSUME")))
833{
834 /* [ WORD 1-6 ] : base class */
835
836 /* [ WORD 7 ] */
837 tree guard;
838
839 /* [ WORD 8 ] */
843/* GIMPLE_TRANSACTION. */
844
845/* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
847/* The __transaction_atomic was declared [[outer]] or it is
848 __transaction_relaxed. */
849#define GTMA_IS_OUTER (1u << 0)
850#define GTMA_IS_RELAXED (1u << 1)
851#define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
852
853/* The transaction is seen to not have an abort. */
854#define GTMA_HAVE_ABORT (1u << 2)
855/* The transaction is seen to have loads or stores. */
856#define GTMA_HAVE_LOAD (1u << 3)
857#define GTMA_HAVE_STORE (1u << 4)
858/* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
859#define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
860/* The transaction WILL enter serial irrevocable mode.
861 An irrevocable block post-dominates the entire transaction, such
862 that all invocations of the transaction will go serial-irrevocable.
863 In such case, we don't bother instrumenting the transaction, and
864 tell the runtime that it should begin the transaction in
865 serial-irrevocable mode. */
866#define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
867/* The transaction contains no instrumentation code whatsover, most
868 likely because it is guaranteed to go irrevocable upon entry. */
869#define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
870
871struct GTY((tag("GSS_TRANSACTION")))
873{
874 /* [ WORD 1-9 ] : base class */
876 /* [ WORD 10 ] */
877 gimple_seq body;
878
879 /* [ WORD 11-13 ] */
880 tree label_norm;
881 tree label_uninst;
882 tree label_over;
883};
885#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
887#include "gsstruct.def"
889};
890#undef DEFGSSTRUCT
891
892/* A statement with the invariant that
893 stmt->code == GIMPLE_COND
894 i.e. a conditional jump statement. */
895
896struct GTY((tag("GSS_WITH_OPS")))
898{
899 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
900 static const enum gimple_code code_ = GIMPLE_COND;
901};
903/* A statement with the invariant that
904 stmt->code == GIMPLE_DEBUG
905 i.e. a debug statement. */
906
907struct GTY((tag("GSS_WITH_OPS")))
909{
910 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
911};
913/* A statement with the invariant that
914 stmt->code == GIMPLE_GOTO
915 i.e. a goto statement. */
916
917struct GTY((tag("GSS_WITH_OPS")))
919{
920 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
921};
922
923/* A statement with the invariant that
924 stmt->code == GIMPLE_LABEL
925 i.e. a label statement. */
926
927struct GTY((tag("GSS_WITH_OPS")))
929{
930 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
931};
932
933/* A statement with the invariant that
934 stmt->code == GIMPLE_SWITCH
935 i.e. a switch statement. */
937struct GTY((tag("GSS_WITH_OPS")))
939{
940 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
941};
942
943/* A statement with the invariant that
944 stmt->code == GIMPLE_ASSIGN
945 i.e. an assignment statement. */
946
947struct GTY((tag("GSS_WITH_MEM_OPS")))
949{
950 static const enum gimple_code code_ = GIMPLE_ASSIGN;
951 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
953
954/* A statement with the invariant that
955 stmt->code == GIMPLE_RETURN
956 i.e. a return statement. */
957
958struct GTY((tag("GSS_WITH_MEM_OPS")))
961 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
962};
963
964template <>
965template <>
966inline bool
969 return gs->code == GIMPLE_ASM;
970}
971
972template <>
973template <>
974inline bool
977 return gs->code == GIMPLE_ASSIGN;
978}
979
980template <>
981template <>
982inline bool
985 return gs->code == GIMPLE_ASSIGN;
986}
987
988template <>
989template <>
990inline bool
993 return gs->code == GIMPLE_BIND;
994}
995
996template <>
997template <>
998inline bool
1001 return gs->code == GIMPLE_CALL;
1002}
1003
1004template <>
1005template <>
1006inline bool
1009 return gs->code == GIMPLE_CATCH;
1010}
1011
1012template <>
1013template <>
1014inline bool
1017 return gs->code == GIMPLE_COND;
1018}
1019
1020template <>
1021template <>
1022inline bool
1025 return gs->code == GIMPLE_COND;
1026}
1027
1028template <>
1029template <>
1030inline bool
1033 return gs->code == GIMPLE_DEBUG;
1034}
1035
1036template <>
1037template <>
1038inline bool
1041 return gs->code == GIMPLE_DEBUG;
1042}
1043
1044template <>
1045template <>
1046inline bool
1049 return gs->code == GIMPLE_GOTO;
1050}
1051
1052template <>
1053template <>
1054inline bool
1057 return gs->code == GIMPLE_GOTO;
1058}
1059
1060template <>
1061template <>
1062inline bool
1065 return gs->code == GIMPLE_LABEL;
1066}
1067
1068template <>
1069template <>
1070inline bool
1073 return gs->code == GIMPLE_LABEL;
1074}
1075
1076template <>
1077template <>
1078inline bool
1081 return gs->code == GIMPLE_RESX;
1082}
1083
1084template <>
1085template <>
1086inline bool
1089 return gs->code == GIMPLE_EH_DISPATCH;
1090}
1091
1092template <>
1093template <>
1094inline bool
1097 return gs->code == GIMPLE_EH_ELSE;
1098}
1099
1100template <>
1101template <>
1102inline bool
1105 return gs->code == GIMPLE_EH_ELSE;
1106}
1107
1108template <>
1109template <>
1110inline bool
1113 return gs->code == GIMPLE_EH_FILTER;
1114}
1115
1116template <>
1117template <>
1118inline bool
1121 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1122}
1123
1124template <>
1125template <>
1126inline bool
1129 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1130}
1131
1132template <>
1133template <>
1134inline bool
1137 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1138}
1139
1140template <>
1141template <>
1142inline bool
1145 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1146}
1147
1148template <>
1149template <>
1150inline bool
1153 return gs->code == GIMPLE_OMP_RETURN;
1154}
1155
1156template <>
1157template <>
1158inline bool
1160{
1161 return gs->code == GIMPLE_OMP_CONTINUE;
1163
1164template <>
1165template <>
1166inline bool
1168{
1169 return gs->code == GIMPLE_OMP_CRITICAL;
1171
1172template <>
1173template <>
1174inline bool
1176{
1177 return gs->code == GIMPLE_OMP_ORDERED;
1179
1180template <>
1181template <>
1182inline bool
1184{
1185 return gs->code == GIMPLE_OMP_SCAN;
1187
1188template <>
1189template <>
1190inline bool
1192{
1193 return gs->code == GIMPLE_OMP_FOR;
1195
1196template <>
1197template <>
1198inline bool
1200{
1201 return (gs->code == GIMPLE_OMP_PARALLEL
1203 || gs->code == GIMPLE_OMP_TEAMS);
1204}
1205
1206template <>
1207template <>
1208inline bool
1211 return gs->code == GIMPLE_OMP_PARALLEL;
1212}
1213
1214template <>
1215template <>
1216inline bool
1219 return gs->code == GIMPLE_OMP_TARGET;
1220}
1221
1222template <>
1223template <>
1224inline bool
1227 return gs->code == GIMPLE_OMP_SECTIONS;
1228}
1229
1230template <>
1231template <>
1232inline bool
1235 return gs->code == GIMPLE_OMP_SINGLE;
1236}
1237
1238template <>
1239template <>
1240inline bool
1243 return gs->code == GIMPLE_OMP_TEAMS;
1244}
1245
1246template <>
1247template <>
1248inline bool
1251 return gs->code == GIMPLE_OMP_TASK;
1252}
1253
1254template <>
1255template <>
1256inline bool
1259 return gs->code == GIMPLE_PHI;
1260}
1261
1262template <>
1263template <>
1264inline bool
1267 return gs->code == GIMPLE_RETURN;
1268}
1269
1270template <>
1271template <>
1272inline bool
1275 return gs->code == GIMPLE_SWITCH;
1276}
1277
1278template <>
1279template <>
1280inline bool
1283 return gs->code == GIMPLE_SWITCH;
1284}
1285
1286template <>
1287template <>
1288inline bool
1291 return gs->code == GIMPLE_ASSUME;
1292}
1293
1294template <>
1295template <>
1296inline bool
1299 return gs->code == GIMPLE_TRANSACTION;
1300}
1301
1302template <>
1303template <>
1304inline bool
1307 return gs->code == GIMPLE_TRY;
1308}
1309
1310template <>
1311template <>
1312inline bool
1315 return gs->code == GIMPLE_TRY;
1316}
1317
1318template <>
1319template <>
1320inline bool
1323 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1324}
1325
1326template <>
1327template <>
1328inline bool
1331 return gs->code == GIMPLE_ASM;
1332}
1333
1334template <>
1335template <>
1336inline bool
1339 return gs->code == GIMPLE_BIND;
1340}
1341
1342template <>
1343template <>
1344inline bool
1347 return gs->code == GIMPLE_CALL;
1348}
1349
1350template <>
1351template <>
1352inline bool
1355 return gs->code == GIMPLE_CATCH;
1356}
1357
1358template <>
1359template <>
1360inline bool
1363 return gs->code == GIMPLE_RESX;
1364}
1365
1366template <>
1367template <>
1368inline bool
1371 return gs->code == GIMPLE_EH_DISPATCH;
1372}
1373
1374template <>
1375template <>
1376inline bool
1379 return gs->code == GIMPLE_EH_FILTER;
1380}
1381
1382template <>
1383template <>
1384inline bool
1387 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1388}
1389
1390template <>
1391template <>
1392inline bool
1395 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1396}
1397
1398template <>
1399template <>
1400inline bool
1403 return gs->code == GIMPLE_OMP_RETURN;
1404}
1405
1406template <>
1407template <>
1408inline bool
1410{
1411 return gs->code == GIMPLE_OMP_CONTINUE;
1413
1414template <>
1415template <>
1416inline bool
1418{
1419 return gs->code == GIMPLE_OMP_CRITICAL;
1421
1422template <>
1423template <>
1424inline bool
1426{
1427 return gs->code == GIMPLE_OMP_ORDERED;
1429
1430template <>
1431template <>
1432inline bool
1434{
1435 return gs->code == GIMPLE_OMP_SCAN;
1437
1438template <>
1439template <>
1440inline bool
1442{
1443 return gs->code == GIMPLE_OMP_FOR;
1445
1446template <>
1447template <>
1448inline bool
1450{
1451 return (gs->code == GIMPLE_OMP_PARALLEL
1453 || gs->code == GIMPLE_OMP_TEAMS);
1454}
1455
1456template <>
1457template <>
1458inline bool
1461 return gs->code == GIMPLE_OMP_PARALLEL;
1462}
1463
1464template <>
1465template <>
1466inline bool
1469 return gs->code == GIMPLE_OMP_TARGET;
1470}
1471
1472template <>
1473template <>
1474inline bool
1477 return gs->code == GIMPLE_OMP_SECTIONS;
1478}
1479
1480template <>
1481template <>
1482inline bool
1485 return gs->code == GIMPLE_OMP_SINGLE;
1486}
1487
1488template <>
1489template <>
1490inline bool
1492{
1493 return gs->code == GIMPLE_OMP_TEAMS;
1494}
1495
1496template <>
1497template <>
1498inline bool
1500{
1501 return gs->code == GIMPLE_OMP_TASK;
1503
1504template <>
1505template <>
1506inline bool
1508{
1509 return gs->code == GIMPLE_PHI;
1510}
1512template <>
1513template <>
1514inline bool
1517 return gs->code == GIMPLE_RETURN;
1518}
1519
1520template <>
1521template <>
1522inline bool
1524{
1525 return gs->code == GIMPLE_ASSUME;
1526}
1527
1528template <>
1529template <>
1530inline bool
1532{
1533 return gs->code == GIMPLE_TRANSACTION;
1534}
1535
1536/* Offset in bytes to the location of the operand vector.
1537 Zero if there is no operand vector for this tuple structure. */
1538extern size_t const gimple_ops_offset_[];
1540/* Map GIMPLE codes to GSS codes. */
1542
1543/* This variable holds the currently expanded gimple statement for purposes
1544 of comminucating the profile info to the builtin expanders. */
1546
1547size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1548void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1553gcall *gimple_build_call (tree, unsigned, ...);
1555gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1569gimple *gimple_build_nop (void);
1579 enum gimple_try_flags);
1593 tree, tree);
1610 enum omp_memory_order);
1614extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1619 location_t);
1623bool gimple_call_same_target_p (const gimple *, const gimple *);
1624int gimple_call_flags (const gimple *);
1625int gimple_call_arg_flags (const gcall *, unsigned);
1626int gimple_call_retslot_flags (const gcall *);
1628int gimple_call_return_flags (const gcall *);
1634bool gimple_assign_load_p (const gimple *);
1638 tree, tree, tree);
1639tree gimple_get_lhs (const gimple *);
1640void gimple_set_lhs (gimple *, tree);
1642void gimple_move_vops (gimple *, gimple *);
1643bool gimple_has_side_effects (const gimple *);
1644bool gimple_could_trap_p_1 (const gimple *, bool, bool);
1645bool gimple_could_trap_p (const gimple *);
1647extern void dump_gimple_statistics (void);
1648unsigned get_gimple_rhs_num_ops (enum tree_code);
1658extern bool gimple_call_builtin_p (const gimple *);
1659extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1660extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1662extern void dump_decl_set (FILE *, bitmap);
1663extern bool nonfreeing_call_p (gimple *);
1664extern bool nonbarrier_call_p (gimple *);
1665extern bool infer_nonnull_range (gimple *, tree);
1672extern void maybe_remove_unused_call_args (struct function *, gimple *);
1673extern bool gimple_inexpensive_call_p (gcall *);
1674extern bool stmt_can_terminate_bb_p (gimple *);
1677
1678/* Return the disposition for a warning (or all warnings by default)
1679 for a statement. */
1680extern bool warning_suppressed_p (const gimple *, opt_code = all_warnings)
1682/* Set the disposition for a warning (or all warnings by default)
1683 at a location to enabled by default. */
1685 bool = true) ATTRIBUTE_NONNULL (1);
1686
1687/* Copy the warning disposition mapping from one statement to another. */
1690/* Copy the warning disposition mapping from an expression to a statement. */
1693/* Copy the warning disposition mapping from a statement to an expression. */
1696
1697/* Formal (expression) temporary table handling: multiple occurrences of
1698 the same scalar expression are evaluated into the same temporary. */
1699
1701{
1702 tree val; /* Key */
1703 tree temp; /* Value */
1704} elt_t;
1705
1706/* Get the number of the next statement uid to be allocated. */
1707inline unsigned int
1708gimple_stmt_max_uid (struct function *fn)
1709{
1710 return fn->last_stmt_uid;
1711}
1713/* Set the number of the next statement uid to be allocated. */
1714inline void
1715set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1716{
1717 fn->last_stmt_uid = maxid;
1718}
1719
1720/* Set the number of the next statement uid to be allocated. */
1721inline unsigned int
1723{
1724 return fn->last_stmt_uid++;
1725}
1726
1727/* Return the first node in GIMPLE sequence S. */
1728
1729inline gimple_seq_node
1732 return s;
1733}
1734
1735
1736/* Return the first statement in GIMPLE sequence S. */
1737
1738inline gimple *
1742 return n;
1743}
1744
1745/* Return the first statement in GIMPLE sequence S as a gbind *,
1746 verifying that it has code GIMPLE_BIND in a checked build. */
1747
1748inline gbind *
1753}
1754
1755
1756/* Return the last node in GIMPLE sequence S. */
1758inline gimple_seq_node
1760{
1761 return s ? s->prev : NULL;
1762}
1763
1764
1765/* Return the last statement in GIMPLE sequence S. */
1766
1767inline gimple *
1772}
1773
1775/* Set the last node in GIMPLE sequence *PS to LAST. */
1776
1777inline void
1779{
1780 (*ps)->prev = last;
1781}
1783
1784/* Set the first node in GIMPLE sequence *PS to FIRST. */
1785
1786inline void
1788{
1789 *ps = first;
1790}
1791
1793/* Return true if GIMPLE sequence S is empty. */
1794
1795inline bool
1797{
1798 return s == NULL;
1799}
1800
1801/* Allocate a new sequence and initialize its first element with STMT. */
1802
1803inline gimple_seq
1805{
1806 gimple_seq seq = NULL;
1807 gimple_seq_add_stmt (&seq, stmt);
1808 return seq;
1809}
1810
1812/* Returns the sequence of statements in BB. */
1813
1814inline gimple_seq
1816{
1817 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1818}
1819
1820inline gimple_seq *
1822{
1823 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1824}
1825
1826/* Sets the sequence of statements in BB to SEQ. */
1827
1828inline void
1830{
1831 gcc_checking_assert (!(bb->flags & BB_RTL));
1832 bb->il.gimple.seq = seq;
1833}
1834
1835
1836/* Return the code for GIMPLE statement G. */
1837
1838inline enum gimple_code
1839gimple_code (const gimple *g)
1840{
1841 return g->code;
1842}
1843
1844
1845/* Return the GSS code used by a GIMPLE code. */
1846
1848gss_for_code (enum gimple_code code)
1849{
1851 return gss_for_code_[code];
1852}
1853
1854
1855/* Return which GSS code is used by GS. */
1856
1860 return gss_for_code (gimple_code (gs));
1861}
1862
1863
1864/* Return true if statement G has sub-statements. This is only true for
1865 High GIMPLE statements. */
1866
1867inline bool
1869{
1870 switch (gimple_code (g))
1871 {
1872 case GIMPLE_ASSUME:
1873 case GIMPLE_BIND:
1874 case GIMPLE_CATCH:
1875 case GIMPLE_EH_FILTER:
1876 case GIMPLE_EH_ELSE:
1877 case GIMPLE_TRY:
1878 case GIMPLE_OMP_FOR:
1883 case GIMPLE_OMP_SECTION:
1886 case GIMPLE_OMP_TASK:
1891 case GIMPLE_OMP_TEAMS:
1894 case GIMPLE_TRANSACTION:
1895 return true;
1897 default:
1898 return false;
1899 }
1900}
1901
1902
1903/* Return the basic block holding statement G. */
1905inline basic_block
1906gimple_bb (const gimple *g)
1907{
1908 return g->bb;
1909}
1910
1911
1912/* Return the lexical scope block holding statement G. */
1913
1914inline tree
1916{
1917 return LOCATION_BLOCK (g->location);
1918}
1919
1920/* Forward declare. */
1921inline void gimple_set_location (gimple *, location_t);
1922
1923/* Set BLOCK to be the lexical scope block holding statement G. */
1925inline void
1926gimple_set_block (gimple *g, tree block)
1927{
1928 gimple_set_location (g, set_block (g->location, block));
1929}
1930
1931/* Return location information for statement G. */
1932
1934gimple_location (const gimple *g)
1935{
1936 return g->location;
1937}
1938
1939/* Return location information for statement G if g is not NULL.
1940 Otherwise, UNKNOWN_LOCATION is returned. */
1941
1942inline location_t
1944{
1945 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1946}
1948/* Set location information for statement G. */
1949
1950inline void
1952{
1953 /* Copy the no-warning data to the statement location. */
1954 if (g->location != UNKNOWN_LOCATION)
1955 copy_warning (location, g->location);
1956 g->location = location;
1957}
1958
1959/* Return address of the location information for statement G. */
1960
1961inline location_t *
1963{
1964 return &g->location;
1966
1967
1968/* Return true if G contains location information. */
1969
1970inline bool
1972{
1975
1976
1977/* Return non-artificial location information for statement G. */
1978
1979inline location_t
1981{
1983
1984 if (tree block = gimple_block (g))
1986
1987 return ploc ? *ploc : gimple_location (g);
1988}
1989
1990
1991/* Return the file name of the location of STMT. */
1992
1993inline const char *
1994gimple_filename (const gimple *stmt)
1995{
1996 return LOCATION_FILE (gimple_location (stmt));
1997}
1998
1999
2000/* Return the line number of the location of STMT. */
2001
2002inline int
2003gimple_lineno (const gimple *stmt)
2004{
2005 return LOCATION_LINE (gimple_location (stmt));
2006}
2007
2008
2009/* Determine whether SEQ is a singleton. */
2010
2011inline bool
2013{
2014 return ((gimple_seq_first (seq) != NULL)
2015 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
2016}
2017
2018/* Return true if no warnings should be emitted for statement STMT. */
2019
2020inline bool
2021gimple_no_warning_p (const gimple *stmt)
2022{
2023 return stmt->no_warning;
2024}
2025
2026/* Set the no_warning flag of STMT to NO_WARNING. */
2027
2028inline void
2030{
2031 stmt->no_warning = (unsigned) no_warning;
2032}
2033
2034/* Set the visited status on statement STMT to VISITED_P.
2036 Please note that this 'visited' property of the gimple statement is
2037 supposed to be undefined at pass boundaries. This means that a
2038 given pass should not assume it contains any useful value when the
2039 pass starts and thus can set it to any value it sees fit.
2040
2041 You can learn more about the visited property of the gimple
2042 statement by reading the comments of the 'visited' data member of
2043 struct gimple.
2044 */
2045
2046inline void
2047gimple_set_visited (gimple *stmt, bool visited_p)
2048{
2049 stmt->visited = (unsigned) visited_p;
2050}
2051
2052
2053/* Return the visited status for statement STMT.
2054
2055 Please note that this 'visited' property of the gimple statement is
2056 supposed to be undefined at pass boundaries. This means that a
2057 given pass should not assume it contains any useful value when the
2058 pass starts and thus can set it to any value it sees fit.
2059
2060 You can learn more about the visited property of the gimple
2061 statement by reading the comments of the 'visited' data member of
2062 struct gimple. */
2063
2064inline bool
2066{
2067 return stmt->visited;
2068}
2070
2071/* Set pass local flag PLF on statement STMT to VAL_P.
2072
2073 Please note that this PLF property of the gimple statement is
2074 supposed to be undefined at pass boundaries. This means that a
2075 given pass should not assume it contains any useful value when the
2076 pass starts and thus can set it to any value it sees fit.
2077
2078 You can learn more about the PLF property by reading the comment of
2079 the 'plf' data member of struct gimple_statement_structure. */
2080
2081inline void
2082gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2084 if (val_p)
2085 stmt->plf |= (unsigned int) plf;
2086 else
2087 stmt->plf &= ~((unsigned int) plf);
2088}
2089
2090
2091/* Return the value of pass local flag PLF on statement STMT.
2093 Please note that this 'plf' property of the gimple statement is
2094 supposed to be undefined at pass boundaries. This means that a
2095 given pass should not assume it contains any useful value when the
2096 pass starts and thus can set it to any value it sees fit.
2097
2098 You can learn more about the plf property by reading the comment of
2099 the 'plf' data member of struct gimple_statement_structure. */
2100
2101inline unsigned int
2102gimple_plf (gimple *stmt, enum plf_mask plf)
2103{
2104 return stmt->plf & ((unsigned int) plf);
2105}
2106
2107
2108/* Set the UID of statement.
2109
2110 Please note that this UID property is supposed to be undefined at
2111 pass boundaries. This means that a given pass should not assume it
2112 contains any useful value when the pass starts and thus can set it
2113 to any value it sees fit. */
2114
2115inline void
2116gimple_set_uid (gimple *g, unsigned uid)
2117{
2118 g->uid = uid;
2119}
2120
2121
2122/* Return the UID of statement.
2123
2124 Please note that this UID property is supposed to be undefined at
2125 pass boundaries. This means that a given pass should not assume it
2126 contains any useful value when the pass starts and thus can set it
2127 to any value it sees fit. */
2128
2129inline unsigned
2130gimple_uid (const gimple *g)
2131{
2132 return g->uid;
2133}
2135
2136/* Make statement G a singleton sequence. */
2137
2138inline void
2140{
2141 g->next = NULL;
2142 g->prev = g;
2143}
2144
2145
2146/* Return true if GIMPLE statement G has register or memory operands. */
2147
2148inline bool
2149gimple_has_ops (const gimple *g)
2151 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2152}
2153
2154template <>
2155template <>
2156inline bool
2158{
2159 return gimple_has_ops (gs);
2160}
2161
2162template <>
2163template <>
2164inline bool
2166{
2167 return gimple_has_ops (gs);
2168}
2169
2170/* Return true if GIMPLE statement G has memory operands. */
2171
2172inline bool
2176}
2177
2178template <>
2179template <>
2180inline bool
2182{
2183 return gimple_has_mem_ops (gs);
2184}
2185
2186template <>
2187template <>
2188inline bool
2190{
2191 return gimple_has_mem_ops (gs);
2192}
2193
2194/* Return the set of USE operands for statement G. */
2195
2196inline struct use_optype_d *
2197gimple_use_ops (const gimple *g)
2201 if (!ops_stmt)
2202 return NULL;
2203 return ops_stmt->use_ops;
2204}
2205
2206
2207/* Set USE to be the set of USE operands for statement G. */
2208
2209inline void
2218/* Return the single VUSE operand of the statement G. */
2219
2220inline tree
2221gimple_vuse (const gimple *g)
2228}
2229
2230/* Return the single VDEF operand of the statement G. */
2231
2238 return NULL_TREE;
2239 return mem_ops_stmt->vdef;
2240}
2241
2242/* Return the single VUSE operand of the statement G. */
2243
2249 if (!mem_ops_stmt)
2250 return NULL;
2251 return &mem_ops_stmt->vuse;
2252}
2253
2254/* Return the single VDEF operand of the statement G. */
2255
2256inline tree *
2258{
2261 if (!mem_ops_stmt)
2262 return NULL;
2263 return &mem_ops_stmt->vdef;
2265
2266/* Set the single VUSE operand of the statement G. */
2267
2268inline void
2270{
2273 mem_ops_stmt->vuse = vuse;
2274}
2275
2276/* Set the single VDEF operand of the statement G. */
2277
2278inline void
2280{
2283 mem_ops_stmt->vdef = vdef;
2284}
2286
2287/* Return true if statement G has operands and the modified field has
2288 been set. */
2289
2290inline bool
2291gimple_modified_p (const gimple *g)
2292{
2293 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2294}
2295
2296
2297/* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2298 a MODIFIED field. */
2299
2300inline void
2303 if (gimple_has_ops (s))
2305}
2306
2307
2308/* Return true if statement STMT contains volatile operands. */
2309
2310inline bool
2311gimple_has_volatile_ops (const gimple *stmt)
2313 if (gimple_has_mem_ops (stmt))
2314 return stmt->has_volatile_ops;
2315 else
2316 return false;
2317}
2318
2319
2320/* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2321
2322inline void
2324{
2325 if (gimple_has_mem_ops (stmt))
2327}
2328
2329/* Return true if STMT is in a transaction. */
2330
2331inline bool
2332gimple_in_transaction (const gimple *stmt)
2333{
2335}
2336
2337/* Return true if statement STMT may access memory. */
2338
2339inline bool
2341{
2342 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2343}
2345
2346/* Return the subcode for OMP statement S. */
2347
2348inline unsigned
2349gimple_omp_subcode (const gimple *s)
2350{
2353 return s->subcode;
2354}
2356/* Set the subcode for OMP statement S to SUBCODE. */
2357
2358inline void
2359gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2360{
2361 /* We only have 16 bits for the subcode. Assert that we are not
2362 overflowing it. */
2363 gcc_gimple_checking_assert (subcode < (1 << 16));
2364 s->subcode = subcode;
2365}
2367/* Set the nowait flag on OMP_RETURN statement S. */
2368
2369inline void
2371{
2374}
2375
2376
2377/* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2378 flag set. */
2379
2380inline bool
2382{
2384 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2385}
2386
2387
2388/* Set the LHS of OMP return. */
2389
2390inline void
2392{
2395 omp_return_stmt->val = lhs;
2396}
2397
2398
2399/* Get the LHS of OMP return. */
2400
2401inline tree
2403{
2406 return omp_return_stmt->val;
2407}
2408
2410/* Return a pointer to the LHS of OMP return. */
2411
2412inline tree *
2414{
2417 return &omp_return_stmt->val;
2418}
2419
2421/* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2422 flag set. */
2423
2424inline bool
2426{
2428 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2429}
2430
2432/* Set the GF_OMP_SECTION_LAST flag on G. */
2433
2434inline void
2436{
2438 g->subcode |= GF_OMP_SECTION_LAST;
2439}
2440
2441
2442/* Return true if OMP ordered construct is stand-alone
2443 (G has the GF_OMP_ORDERED_STANDALONE flag set). */
2444
2445inline bool
2447{
2450}
2451
2452
2453/* Set the GF_OMP_ORDERED_STANDALONE flag on G. */
2454
2455inline void
2462
2463/* Return true if OMP parallel statement G has the
2464 GF_OMP_PARALLEL_COMBINED flag set. */
2465
2466inline bool
2471}
2472
2473
2474/* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2475 value of COMBINED_P. */
2476
2477inline void
2481 if (combined_p)
2482 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2483 else
2484 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2485}
2486
2487
2488/* Return true if OMP atomic load/store statement G has the
2489 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2497}
2498
2499
2500/* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2501
2509
2510
2511/* Return true if OMP atomic load/store statement G has the
2512 GF_OMP_ATOMIC_WEAK flag set. */
2513
2514inline bool
2516{
2519 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_WEAK) != 0;
2520}
2521
2522
2523/* Set the GF_OMP_ATOMIC_WEAK flag on G. */
2524
2525inline void
2527{
2530 g->subcode |= GF_OMP_ATOMIC_WEAK;
2531}
2533
2534/* Return the memory order of the OMP atomic load/store statement G. */
2535
2536inline enum omp_memory_order
2538{
2541 return (enum omp_memory_order)
2543}
2544
2545
2546/* Set the memory order on G. */
2547
2548inline void
2550{
2553 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2555}
2556
2557
2558/* Return the number of operands for statement GS. */
2559
2560inline unsigned
2561gimple_num_ops (const gimple *gs)
2562{
2563 return gs->num_ops;
2564}
2565
2566
2567/* Set the number of operands for statement GS. */
2568
2569inline void
2570gimple_set_num_ops (gimple *gs, unsigned num_ops)
2571{
2572 gs->num_ops = num_ops;
2573}
2574
2575
2576/* Return the array of operands for statement GS. */
2578inline tree *
2580{
2581 size_t off;
2582
2583 /* All the tuples have their operand vector at the very bottom
2584 of the structure. Note that those structures that do not
2585 have an operand vector have a zero offset. */
2587 gcc_gimple_checking_assert (off != 0);
2588
2589 return (tree *) ((char *) gs + off);
2590}
2592
2593/* Return operand I for statement GS. */
2594
2595inline tree
2596gimple_op (const gimple *gs, unsigned i)
2597{
2598 if (gimple_has_ops (gs))
2599 {
2604 return NULL_TREE;
2605}
2606
2607/* Return a pointer to operand I for statement GS. */
2609inline tree *
2610gimple_op_ptr (gimple *gs, unsigned i)
2611{
2612 if (gimple_has_ops (gs))
2613 {
2615 return gimple_ops (gs) + i;
2616 }
2617 else
2618 return NULL;
2619}
2620
2621/* Set operand I of statement GS to OP. */
2622
2623inline void
2628 /* Note. It may be tempting to assert that OP matches
2629 is_gimple_operand, but that would be wrong. Different tuples
2630 accept slightly different sets of tree operands. Each caller
2631 should perform its own validation. */
2632 gimple_ops (gs)[i] = op;
2633}
2634
2635/* Return true if GS is a GIMPLE_ASSIGN. */
2636
2637inline bool
2638is_gimple_assign (const gimple *gs)
2639{
2641}
2642
2643/* Determine if expression CODE is one of the valid expressions that can
2644 be used on the RHS of GIMPLE assignments. */
2645
2646inline enum gimple_rhs_class
2648{
2649 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2650}
2651
2652/* Return the LHS of assignment statement GS. */
2653
2654inline tree
2656{
2657 return gs->op[0];
2658}
2660inline tree
2662{
2664 return gimple_assign_lhs (ass);
2666
2667
2668/* Return a pointer to the LHS of assignment statement GS. */
2669
2670inline tree *
2672{
2673 return &gs->op[0];
2674}
2675
2680 return gimple_assign_lhs_ptr (ass);
2681}
2683
2684/* Set LHS to be the LHS operand of assignment statement GS. */
2685
2686inline void
2688{
2689 gs->op[0] = lhs;
2690
2691 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2692 SSA_NAME_DEF_STMT (lhs) = gs;
2693}
2694
2695inline void
2702
2703/* Return the first operand on the RHS of assignment statement GS. */
2704
2705inline tree
2707{
2708 return gs->op[1];
2709}
2710
2711inline tree
2713{
2715 return gimple_assign_rhs1 (ass);
2716}
2718
2719/* Return a pointer to the first operand on the RHS of assignment
2720 statement GS. */
2721
2722inline tree *
2724{
2725 return &gs->op[1];
2726}
2727
2733}
2734
2735/* Set RHS to be the first operand on the RHS of assignment statement GS. */
2736
2737inline void
2739{
2740 gs->op[1] = rhs;
2741}
2742
2743inline void
2750
2751/* Return the second operand on the RHS of assignment statement GS.
2752 If GS does not have two operands, NULL is returned instead. */
2753
2754inline tree
2756{
2757 if (gimple_num_ops (gs) >= 3)
2758 return gs->op[2];
2759 else
2760 return NULL_TREE;
2761}
2763inline tree
2765{
2767 return gimple_assign_rhs2 (ass);
2768}
2769
2770
2771/* Return a pointer to the second operand on the RHS of assignment
2772 statement GS. */
2773
2774inline tree *
2776{
2778 return &gs->op[2];
2779}
2780
2787
2788
2789/* Set RHS to be the second operand on the RHS of assignment statement GS. */
2790
2791inline void
2793{
2795 gs->op[2] = rhs;
2796}
2797
2798inline void
2804
2805/* Return the third operand on the RHS of assignment statement GS.
2806 If GS does not have two operands, NULL is returned instead. */
2807
2808inline tree
2811 if (gimple_num_ops (gs) >= 4)
2812 return gs->op[3];
2813 else
2814 return NULL_TREE;
2815}
2816
2817inline tree
2819{
2821 return gimple_assign_rhs3 (ass);
2822}
2823
2824/* Return a pointer to the third operand on the RHS of assignment
2825 statement GS. */
2826
2827inline tree *
2833}
2834
2835
2836/* Set RHS to be the third operand on the RHS of assignment statement GS. */
2838inline void
2840{
2842 gs->op[3] = rhs;
2843}
2844
2845inline void
2847{
2850}
2851
2852
2853/* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2854 which expect to see only two operands. */
2855
2856inline void
2858 tree op1, tree op2)
2859{
2860 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2861}
2863/* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2864 which expect to see only one operands. */
2865
2866inline void
2868 tree op1)
2869{
2870 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2871}
2872
2873/* Returns true if GS is a nontemporal move. */
2874
2875inline bool
2877{
2878 return gs->nontemporal_move;
2879}
2880
2881/* Sets nontemporal move flag of GS to NONTEMPORAL. */
2882
2883inline void
2887 gs->nontemporal_move = nontemporal;
2888}
2889
2890
2891/* Return the code of the expression computed on the rhs of assignment
2892 statement GS. In case that the RHS is a single object, returns the
2893 tree code of the object. */
2894
2895inline enum tree_code
2898 enum tree_code code = (enum tree_code) gs->subcode;
2899 /* While we initially set subcode to the TREE_CODE of the rhs for
2900 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2901 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2903 code = TREE_CODE (gs->op[1]);
2904
2905 return code;
2907
2908inline enum tree_code
2910{
2912 return gimple_assign_rhs_code (ass);
2913}
2914
2916/* Set CODE to be the code for the expression computed on the RHS of
2917 assignment S. */
2918
2919inline void
2921{
2923 s->subcode = code;
2924}
2925
2926
2927/* Return the gimple rhs class of the code of the expression computed on
2928 the rhs of assignment statement GS.
2929 This will never return GIMPLE_INVALID_RHS. */
2930
2936
2937/* Return true if GS is an assignment with a singleton RHS, i.e.,
2938 there is no operator associated with the assignment itself.
2939 Unlike gimple_assign_copy_p, this predicate returns true for
2940 any RHS operand, including those that perform an operation
2941 and do not have the semantics of a copy, such as COND_EXPR. */
2942
2943inline bool
2945{
2946 return (is_gimple_assign (gs)
2948}
2950/* Return true if GS performs a store to its lhs. */
2951
2952inline bool
2953gimple_store_p (const gimple *gs)
2954{
2955 tree lhs = gimple_get_lhs (gs);
2956 return lhs && !is_gimple_reg (lhs);
2958
2959/* Return true if S is a type-cast assignment. */
2960
2961inline bool
2964 if (is_gimple_assign (s))
2965 {
2967 return CONVERT_EXPR_CODE_P (sc)
2968 || sc == VIEW_CONVERT_EXPR
2969 || sc == FIX_TRUNC_EXPR;
2970 }
2971
2972 return false;
2974
2975/* Return true if S is a clobber statement. */
2976
2977inline bool
2978gimple_clobber_p (const gimple *s)
2980 return gimple_assign_single_p (s)
2982}
2983
2984/* Return true if S is a clobber statement. */
2985
2986inline bool
2987gimple_clobber_p (const gimple *s, enum clobber_kind kind)
2988{
2990 && CLOBBER_KIND (gimple_assign_rhs1 (s)) == kind;
2991}
2992
2993/* Return true if GS is a GIMPLE_CALL. */
2994
2995inline bool
2996is_gimple_call (const gimple *gs)
2998 return gimple_code (gs) == GIMPLE_CALL;
2999}
3000
3001/* Return the LHS of call statement GS. */
3002
3003inline tree
3004gimple_call_lhs (const gcall *gs)
3005{
3006 return gs->op[0];
3007}
3009inline tree
3010gimple_call_lhs (const gimple *gs)
3011{
3013 return gimple_call_lhs (gc);
3015
3016
3017/* Return a pointer to the LHS of call statement GS. */
3018
3019inline tree *
3021{
3022 return &gs->op[0];
3024
3025inline tree *
3027{
3029 return gimple_call_lhs_ptr (gc);
3030}
3032
3033/* Set LHS to be the LHS operand of call statement GS. */
3034
3035inline void
3037{
3038 gs->op[0] = lhs;
3039 if (lhs && TREE_CODE (lhs) == SSA_NAME)
3040 SSA_NAME_DEF_STMT (lhs) = gs;
3041}
3043inline void
3045{
3047 gimple_call_set_lhs (gc, lhs);
3048}
3050
3051/* Return true if call GS calls an internal-only function, as enumerated
3052 by internal_fn. */
3053
3054inline bool
3056{
3057 return (gs->subcode & GF_CALL_INTERNAL) != 0;
3059
3060inline bool
3062{
3065}
3066
3067/* Return true if call GS is marked as nocf_check. */
3068
3069inline bool
3071{
3072 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
3074
3075/* Mark statement GS as nocf_check call. */
3076
3077inline void
3079{
3080 if (nocf_check)
3081 gs->subcode |= GF_CALL_NOCF_CHECK;
3082 else
3083 gs->subcode &= ~GF_CALL_NOCF_CHECK;
3085
3086/* Return the target of internal call GS. */
3087
3088inline enum internal_fn
3090{
3092 return gs->u.internal_fn;
3094
3095inline enum internal_fn
3097{
3099 return gimple_call_internal_fn (gc);
3100}
3101
3102/* Return true, if this internal gimple call is unique. */
3104inline bool
3106{
3108}
3110inline bool
3112{
3115}
3116
3117/* Return true if GS is an internal function FN. */
3118
3119inline bool
3121{
3122 return (is_gimple_call (gs)
3124 && gimple_call_internal_fn (gs) == fn);
3125}
3126
3127/* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3128 that could alter control flow. */
3129
3130inline void
3132{
3133 if (ctrl_altering_p)
3135 else
3141{
3144}
3145
3146/* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3147 flag is set. Such call could not be a stmt in the middle of a bb. */
3148
3149inline bool
3151{
3152 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3154
3155inline bool
3157{
3160}
3161
3162
3163/* Return the function type of the function called by GS. */
3164
3165inline tree
3167{
3170 return gs->u.fntype;
3171}
3172
3173inline tree
3175{
3176 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3177 return gimple_call_fntype (call_stmt);
3178}
3180/* Set the type of the function called by CALL_STMT to FNTYPE. */
3181
3182inline void
3183gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3184{
3186 call_stmt->u.fntype = fntype;
3187}
3188
3190/* Return the tree node representing the function called by call
3191 statement GS. */
3192
3193inline tree
3194gimple_call_fn (const gcall *gs)
3195{
3196 return gs->op[1];
3198
3199inline tree
3200gimple_call_fn (const gimple *gs)
3201{
3203 return gimple_call_fn (gc);
3204}
3205
3206/* Return a pointer to the tree node representing the function called by call
3207 statement GS. */
3208
3209inline tree *
3211{
3212 return &gs->op[1];
3213}
3214
3215inline tree *
3217{
3220}
3221
3222
3223/* Set FN to be the function called by call statement GS. */
3224
3225inline void
3227{
3229 gs->op[1] = fn;
3230}
3231
3232
3233/* Set FNDECL to be the function called by call statement GS. */
3234
3248}
3249
3250
3251/* Set internal function FN to be the function called by call statement CALL_STMT. */
3252
3253inline void
3254gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3255{
3257 call_stmt->u.internal_fn = fn;
3258}
3259
3260
3261/* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3262 Otherwise return NULL. This function is analogous to
3263 get_callee_fndecl in tree land. */
3264
3265inline tree
3269}
3270
3271inline tree
3273{
3276}
3277
3278
3279/* Return the type returned by call statement GS. */
3280
3281inline tree
3283{
3285
3286 if (type == NULL_TREE)
3287 return TREE_TYPE (gimple_call_lhs (gs));
3288
3289 /* The type returned by a function is the type of its
3290 function type. */
3291 return TREE_TYPE (type);
3292}
3293
3294
3295/* Return the static chain for call statement GS. */
3296
3297inline tree
3298gimple_call_chain (const gcall *gs)
3299{
3300 return gs->op[2];
3301}
3302
3303inline tree
3305{
3308}
3309
3310
3311/* Return a pointer to the static chain for call statement CALL_STMT. */
3312
3313inline tree *
3314gimple_call_chain_ptr (gcall *call_stmt)
3315{
3316 return &call_stmt->op[2];
3317}
3319/* Set CHAIN to be the static chain for call statement CALL_STMT. */
3320
3321inline void
3323{
3324 call_stmt->op[2] = chain;
3326
3327
3328/* Return the number of arguments used by call statement GS. */
3329
3330inline unsigned
3332{
3333 return gimple_num_ops (gs) - 3;
3334}
3336inline unsigned
3338{
3340 return gimple_call_num_args (gc);
3341}
3343
3344/* Return the argument at position INDEX for call statement GS. */
3345
3346inline tree
3347gimple_call_arg (const gcall *gs, unsigned index)
3348{
3350 return gs->op[index + 3];
3351}
3352
3353inline tree
3354gimple_call_arg (const gimple *gs, unsigned index)
3355{
3357 return gimple_call_arg (gc, index);
3358}
3359
3360
3361/* Return a pointer to the argument at position INDEX for call
3362 statement GS. */
3363
3364inline tree *
3365gimple_call_arg_ptr (gcall *gs, unsigned index)
3368 return &gs->op[index + 3];
3369}
3370
3371inline tree *
3372gimple_call_arg_ptr (gimple *gs, unsigned index)
3373{
3375 return gimple_call_arg_ptr (gc, index);
3376}
3377
3378
3379/* Set ARG to be the argument at position INDEX for call statement GS. */
3380
3381inline void
3382gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3383{
3385 gs->op[index + 3] = arg;
3387
3388inline void
3389gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3390{
3392 gimple_call_set_arg (gc, index, arg);
3393}
3394
3395
3396/* If TAIL_P is true, mark call statement S as being a tail call
3397 (i.e., a call just before the exit of a function). These calls are
3398 candidate for tail call optimization. */
3399
3400inline void
3402{
3403 if (tail_p)
3405 else
3407}
3409
3410/* Return true if GIMPLE_CALL S is marked as a tail call. */
3411
3412inline bool
3413gimple_call_tail_p (const gcall *s)
3414{
3415 return (s->subcode & GF_CALL_TAILCALL) != 0;
3416}
3417
3418/* Mark (or clear) call statement S as requiring tail call optimization. */
3419
3420inline void
3422{
3423 if (must_tail_p)
3425 else
3427}
3428
3429/* Return true if call statement has been marked as requiring
3430 tail call optimization. */
3431
3432inline bool
3434{
3435 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3436}
3437
3438/* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3439 slot optimization. This transformation uses the target of the call
3440 expansion as the return slot for calls that return in memory. */
3441
3442inline void
3444{
3447 else
3449}
3450
3451
3452/* Return true if S is marked for return slot optimization. */
3454inline bool
3456{
3457 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3458}
3459
3460
3461/* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3462 thunk to the thunked-to function. */
3464inline void
3466{
3467 if (from_thunk_p)
3469 else
3471}
3472
3473
3474/* Return true if GIMPLE_CALL S is a jump from a thunk. */
3475
3476inline bool
3478{
3479 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3480}
3481
3482
3483/* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3484 to operator new or delete created from a new or delete expression. */
3491 else
3493}
3494
3495
3496/* Return true if GIMPLE_CALL S is a call to operator new or delete from
3497 from a new or delete expression. */
3498
3499inline bool
3501{
3503}
3504
3505
3506/* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3507 argument pack in its argument list. */
3508
3509inline void
3511{
3512 if (pass_arg_pack_p)
3514 else
3516}
3517
3518
3519/* Return true if GIMPLE_CALL S is a stdarg call that needs the
3520 argument pack in its argument list. */
3521
3522inline bool
3524{
3525 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3526}
3527
3528
3529/* Return true if S is a noreturn call. */
3530
3531inline bool
3533{
3534 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3536
3537inline bool
3539{
3541 return gimple_call_noreturn_p (gc);
3542}
3543
3544
3545/* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3546 even if the called function can throw in other cases. */
3547
3548inline void
3550{
3551 if (nothrow_p)
3553 else
3555}
3556
3557/* Return true if S is a nothrow call. */
3558
3559inline bool
3561{
3562 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3564
3565/* If EXPECTED_THROW_P is true, GIMPLE_CALL S is a call that is known
3566 to be more likely to throw than to run forever, terminate the
3567 program or return by other means. */
3568
3569static inline void
3571{
3572 if (expected_throw_p)
3574 else
3576}
3577
3578/* Return true if S is a call that is more likely to end by
3579 propagating an exception than by other means. */
3580
3581static inline bool
3583{
3584 return (gimple_call_flags (s) & ECF_XTHROW) != 0;
3585}
3586
3587/* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3588 is known to be emitted for VLA objects. Those are wrapped by
3589 stack_save/stack_restore calls and hence can't lead to unbounded
3590 stack growth even when they occur in loops. */
3591
3592inline void
3594{
3595 if (for_var)
3597 else
3599}
3600
3601/* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3603inline bool
3605{
3606 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3607}
3608
3609inline bool
3611{
3612 const gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3613 return (gc->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3614}
3615
3616/* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3617 pointers to nested function are descriptors instead of trampolines. */
3618
3619inline void
3621{
3622 if (by_descriptor_p)
3624 else
3626}
3628/* Return true if S is a by-descriptor call. */
3629
3630inline bool
3632{
3633 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3634}
3635
3636/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3638inline void
3640{
3641 dest_call->subcode = orig_call->subcode;
3642}
3643
3644
3645/* Return a pointer to the points-to solution for the set of call-used
3646 variables of the call CALL_STMT. */
3647
3648inline struct pt_solution *
3649gimple_call_use_set (gcall *call_stmt)
3651 return &call_stmt->call_used;
3652}
3653
3654/* As above, but const. */
3655
3656inline const pt_solution *
3657gimple_call_use_set (const gcall *call_stmt)
3658{
3659 return &call_stmt->call_used;
3660}
3661
3662/* Return a pointer to the points-to solution for the set of call-used
3663 variables of the call CALL_STMT. */
3664
3665inline struct pt_solution *
3667{
3668 return &call_stmt->call_clobbered;
3669}
3670
3671/* As above, but const. */
3672
3673inline const pt_solution *
3674gimple_call_clobber_set (const gcall *call_stmt)
3676 return &call_stmt->call_clobbered;
3677}
3678
3679
3680/* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3681 non-NULL lhs. */
3682
3683inline bool
3684gimple_has_lhs (const gimple *stmt)
3685{
3686 if (is_gimple_assign (stmt))
3687 return true;
3688 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3689 return gimple_call_lhs (call) != NULL_TREE;
3690 return false;
3692
3693
3694/* Return the code of the predicate computed by conditional statement GS. */
3695
3696inline enum tree_code
3697gimple_cond_code (const gcond *gs)
3698{
3699 return (enum tree_code) gs->subcode;
3701
3702inline enum tree_code
3703gimple_cond_code (const gimple *gs)
3704{
3706 return gimple_cond_code (gc);
3707}
3708
3710/* Set CODE to be the predicate code for the conditional statement GS. */
3711
3712inline void
3714{
3715 gs->subcode = code;
3716}
3717
3718
3719/* Return the LHS of the predicate computed by conditional statement GS. */
3720
3721inline tree
3722gimple_cond_lhs (const gcond *gs)
3723{
3724 return gs->op[0];
3726
3727inline tree
3728gimple_cond_lhs (const gimple *gs)
3729{
3731 return gimple_cond_lhs (gc);
3732}
3733
3734/* Return the pointer to the LHS of the predicate computed by conditional
3735 statement GS. */
3736
3737inline tree *
3739{
3740 return &gs->op[0];
3741}
3742
3743/* Set LHS to be the LHS operand of the predicate computed by
3744 conditional statement GS. */
3746inline void
3748{
3749 gs->op[0] = lhs;
3750}
3751
3752
3753/* Return the RHS operand of the predicate computed by conditional GS. */
3754
3755inline tree
3756gimple_cond_rhs (const gcond *gs)
3757{
3758 return gs->op[1];
3759}
3760
3761inline tree
3762gimple_cond_rhs (const gimple *gs)
3763{
3766}
3767
3768/* Return the pointer to the RHS operand of the predicate computed by
3769 conditional GS. */
3770
3771inline tree *
3773{
3774 return &gs->op[1];
3776
3777
3778/* Set RHS to be the RHS operand of the predicate computed by
3779 conditional statement GS. */
3780
3781inline void
3783{
3784 gs->op[1] = rhs;
3785}
3786
3787
3788/* Return the label used by conditional statement GS when its
3789 predicate evaluates to true. */
3790
3791inline tree
3793{
3794 return gs->op[2];
3796
3797
3798/* Set LABEL to be the label used by conditional statement GS when its
3799 predicate evaluates to true. */
3800
3801inline void
3803{
3804 gs->op[2] = label;
3805}
3807
3808/* Set LABEL to be the label used by conditional statement GS when its
3809 predicate evaluates to false. */
3810
3811inline void
3813{
3814 gs->op[3] = label;
3815}
3816
3817
3818/* Return the label used by conditional statement GS when its
3819 predicate evaluates to false. */
3820
3821inline tree
3823{
3824 return gs->op[3];
3825}
3826
3827
3828/* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3829
3830inline void
3832{
3835 gs->subcode = NE_EXPR;
3836}
3837
3838
3839/* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3840
3841inline void
3843{
3846 gs->subcode = NE_EXPR;
3847}
3848
3849/* Check if conditional statemente GS is of the form 'if (1 == 1)',
3850 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3851
3852inline bool
3854{
3856 tree rhs = gimple_cond_rhs (gs);
3857 enum tree_code code = gimple_cond_code (gs);
3858
3859 if (lhs != boolean_true_node && lhs != boolean_false_node)
3860 return false;
3861
3862 if (rhs != boolean_true_node && rhs != boolean_false_node)
3863 return false;
3864
3865 if (code == NE_EXPR && lhs != rhs)
3866 return true;
3867
3868 if (code == EQ_EXPR && lhs == rhs)
3869 return true;
3870
3871 return false;
3872}
3873
3874/* Check if conditional statement GS is of the form 'if (1 != 1)',
3875 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3876
3877inline bool
3879{
3880 tree lhs = gimple_cond_lhs (gs);
3881 tree rhs = gimple_cond_rhs (gs);
3882 enum tree_code code = gimple_cond_code (gs);
3883
3884 if (lhs != boolean_true_node && lhs != boolean_false_node)
3885 return false;
3886
3887 if (rhs != boolean_true_node && rhs != boolean_false_node)
3888 return false;
3889
3890 if (code == NE_EXPR && lhs == rhs)
3891 return true;
3892
3893 if (code == EQ_EXPR && lhs != rhs)
3894 return true;
3895
3896 return false;
3897}
3899/* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3900
3901inline void
3902gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3903 tree rhs)
3904{
3905 gimple_cond_set_code (stmt, code);
3906 gimple_cond_set_lhs (stmt, lhs);
3908}
3909
3910
3911/* Return the tree code for the expression computed by STMT. This is
3912 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3913 GIMPLE_CALL, return CALL_EXPR as the expression code for
3914 consistency. This is useful when the caller needs to deal with the
3915 three kinds of computation that GIMPLE supports. */
3916
3917inline enum tree_code
3918gimple_expr_code (const gimple *stmt)
3919{
3920 if (const gassign *ass = dyn_cast<const gassign *> (stmt))
3921 return gimple_assign_rhs_code (ass);
3922 if (const gcond *cond = dyn_cast<const gcond *> (stmt))
3923 return gimple_cond_code (cond);
3924 else
3925 {
3927 return CALL_EXPR;
3928 }
3929}
3930
3931
3932/* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3933
3934inline tree
3937 return gs->op[0];
3938}
3939
3940
3941/* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3942 GS. */
3943
3944inline void
3947 gs->op[0] = label;
3948}
3949
3950
3951/* Return the destination of the unconditional jump GS. */
3952
3953inline tree
3954gimple_goto_dest (const gimple *gs)
3955{
3957 return gimple_op (gs, 0);
3958}
3959
3960
3961/* Set DEST to be the destination of the unconditonal jump GS. */
3962
3963inline void
3965{
3966 gs->op[0] = dest;
3967}
3968
3969
3970/* Return the variables declared in the GIMPLE_BIND statement GS. */
3972inline tree
3974{
3975 return bind_stmt->vars;
3976}
3977
3978
3979/* Set VARS to be the set of variables declared in the GIMPLE_BIND
3980 statement GS. */
3981
3982inline void
3984{
3985 bind_stmt->vars = vars;
3986}
3987
3988
3989/* Append VARS to the set of variables declared in the GIMPLE_BIND
3990 statement GS. */
3991
3992inline void
3994{
3995 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3996}
3997
3998
4001{
4002 return &bind_stmt->body;
4003}
4004
4005/* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
4006
4007inline gimple_seq
4008gimple_bind_body (const gbind *gs)
4010 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
4011}
4012
4013
4014/* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
4015 statement GS. */
4016
4017inline void
4019{
4020 bind_stmt->body = seq;
4021}
4022
4023
4024/* Append a statement to the end of a GIMPLE_BIND's body. */
4025
4026inline void
4028{
4030}
4031
4032
4033/* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
4034
4035inline void
4037{
4039}
4040
4041
4042/* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
4043 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
4044
4045inline tree
4047{
4048 return bind_stmt->block;
4049}
4050
4051
4052/* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
4053 statement GS. */
4055inline void
4057{
4059 || TREE_CODE (block) == BLOCK);
4060 bind_stmt->block = block;
4061}
4062
4064/* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
4065
4066inline unsigned
4068{
4069 return asm_stmt->ni;
4070}
4071
4072
4073/* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
4075inline unsigned
4077{
4078 return asm_stmt->no;
4079}
4080
4081
4082/* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
4084inline unsigned
4086{
4087 return asm_stmt->nc;
4088}
4089
4090/* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
4091
4092inline unsigned
4095 return asm_stmt->nl;
4096}
4097
4098/* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
4099
4100inline tree
4101gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
4102{
4104 return asm_stmt->op[index + asm_stmt->no];
4105}
4106
4107/* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4108
4109inline void
4111{
4113 && TREE_CODE (in_op) == TREE_LIST);
4114 asm_stmt->op[index + asm_stmt->no] = in_op;
4115}
4116
4117
4118/* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4119
4120inline tree
4121gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
4122{
4124 return asm_stmt->op[index];
4125}
4126
4127/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4128
4129inline void
4131{
4133 && TREE_CODE (out_op) == TREE_LIST);
4134 asm_stmt->op[index] = out_op;
4135}
4136
4137
4138/* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4139
4140inline tree
4141gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
4142{
4144 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
4145}
4146
4147
4148/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4149
4150inline void
4155 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4156}
4157
4158/* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4159
4160inline tree
4161gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4162{
4164 return asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc];
4165}
4166
4167/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4168
4169inline void
4171{
4174 asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc] = label_op;
4175}
4176
4177/* Return the string representing the assembly instruction in
4178 GIMPLE_ASM ASM_STMT. */
4179
4180inline const char *
4182{
4183 return asm_stmt->string;
4184}
4186
4187/* Return true if ASM_STMT is marked volatile. */
4188
4189inline bool
4191{
4192 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4193}
4194
4195
4196/* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4198inline void
4199gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4200{
4201 if (volatile_p)
4202 asm_stmt->subcode |= GF_ASM_VOLATILE;
4203 else
4204 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4205}
4207
4208/* Return true if ASM_STMT is marked inline. */
4209
4210inline bool
4212{
4213 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4214}
4216
4217/* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4218
4219inline void
4221{
4222 if (inline_p)
4223 asm_stmt->subcode |= GF_ASM_INLINE;
4224 else
4226}
4227
4228
4229/* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4230
4231inline void
4233{
4234 if (input_p)
4236 else
4237 asm_stmt->subcode &= ~GF_ASM_INPUT;
4238}
4239
4240
4241/* Return true if asm ASM_STMT is an ASM_INPUT. */
4242
4243inline bool
4245{
4246 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4247}
4248
4249
4250/* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4251
4252inline tree
4254{
4255 return catch_stmt->types;
4256}
4257
4258
4259/* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4260
4261inline tree *
4263{
4264 return &catch_stmt->types;
4265}
4266
4267
4268/* Return a pointer to the GIMPLE sequence representing the body of
4269 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4270
4271inline gimple_seq *
4274 return &catch_stmt->handler;
4275}
4276
4277
4278/* Return the GIMPLE sequence representing the body of the handler of
4279 GIMPLE_CATCH statement CATCH_STMT. */
4280
4281inline gimple_seq
4283{
4284 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4285}
4286
4287
4288/* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4289
4290inline void
4292{
4293 catch_stmt->types = t;
4294}
4296
4297/* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4298
4299inline void
4301{
4302 catch_stmt->handler = handler;
4303}
4304
4306/* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4307
4308inline tree
4310{
4312 return eh_filter_stmt->types;
4313}
4314
4316/* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4317 GS. */
4318
4319inline tree *
4321{
4323 return &eh_filter_stmt->types;
4325
4326
4327/* Return a pointer to the sequence of statement to execute when
4328 GIMPLE_EH_FILTER statement fails. */
4329
4330inline gimple_seq *
4334 return &eh_filter_stmt->failure;
4335}
4336
4337
4338/* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4339 statement fails. */
4340
4343{
4344 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4345}
4346
4348/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4349 EH_FILTER_STMT. */
4350
4351inline void
4354 eh_filter_stmt->types = types;
4355}
4356
4357
4358/* Set FAILURE to be the sequence of statements to execute on failure
4359 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4360
4361inline void
4364{
4366}
4367
4368/* Get the function decl to be called by the MUST_NOT_THROW region. */
4369
4370inline tree
4372{
4373 return eh_mnt_stmt->fndecl;
4374}
4375
4376/* Set the function decl to be called by GS to DECL. */
4377
4378inline void
4380 tree decl)
4381{
4383}
4384
4385/* GIMPLE_EH_ELSE accessors. */
4386
4387inline gimple_seq *
4389{
4390 return &eh_else_stmt->n_body;
4391}
4393inline gimple_seq
4395{
4396 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4397}
4398
4399inline gimple_seq *
4401{
4402 return &eh_else_stmt->e_body;
4403}
4405inline gimple_seq
4407{
4408 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4409}
4410
4411inline void
4413{
4414 eh_else_stmt->n_body = seq;
4416
4417inline void
4419{
4420 eh_else_stmt->e_body = seq;
4421}
4422
4423/* GIMPLE_TRY accessors. */
4424
4425/* Return the kind of try block represented by GIMPLE_TRY GS. This is
4426 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4427
4428inline enum gimple_try_flags
4429gimple_try_kind (const gimple *gs)
4430{
4432 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4433}
4434
4436/* Set the kind of try block represented by GIMPLE_TRY GS. */
4437
4438inline void
4440{
4442 || kind == GIMPLE_TRY_FINALLY);
4443 if (gimple_try_kind (gs) != kind)
4444 gs->subcode = (unsigned int) kind;
4445}
4447
4448/* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4449
4450inline bool
4452{
4454 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4456
4457
4458/* Return a pointer to the sequence of statements used as the
4459 body for GIMPLE_TRY GS. */
4460
4461inline gimple_seq *
4463{
4465 return &try_stmt->eval;
4466}
4467
4468
4469/* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4470
4471inline gimple_seq
4472gimple_try_eval (const gimple *gs)
4473{
4474 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4475}
4476
4477
4478/* Return a pointer to the sequence of statements used as the cleanup body for
4479 GIMPLE_TRY GS. */
4480
4481inline gimple_seq *
4483{
4485 return &try_stmt->cleanup;
4486}
4487
4489/* Return the sequence of statements used as the cleanup body for
4490 GIMPLE_TRY GS. */
4491
4492inline gimple_seq
4494{
4495 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4496}
4497
4499/* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4500
4501inline void
4503{
4505 if (catch_is_cleanup)
4506 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4507 else
4508 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4509}
4510
4511
4512/* Set EVAL to be the sequence of statements to use as the body for
4513 GIMPLE_TRY TRY_STMT. */
4514
4515inline void
4518 try_stmt->eval = eval;
4519}
4520
4521
4522/* Set CLEANUP to be the sequence of statements to use as the cleanup
4523 body for GIMPLE_TRY TRY_STMT. */
4524
4525inline void
4528 try_stmt->cleanup = cleanup;
4529}
4530
4531
4532/* Return a pointer to the cleanup sequence for cleanup statement GS. */
4533
4534inline gimple_seq *
4536{
4538 return &wce_stmt->cleanup;
4539}
4540
4541
4542/* Return the cleanup sequence for cleanup statement GS. */
4543
4544inline gimple_seq
4546{
4547 return *gimple_wce_cleanup_ptr (gs);
4548}
4550
4551/* Set CLEANUP to be the cleanup sequence for GS. */
4552
4553inline void
4555{
4557 wce_stmt->cleanup = cleanup;
4558}
4560
4561/* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4562
4563inline bool
4567 return gs->subcode != 0;
4568}
4569
4570
4571/* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4572
4573inline void
4578}
4579
4581/* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4582
4583inline unsigned
4585{
4587 return phi_stmt->capacity;
4588}
4590
4591/* Return the number of arguments in GIMPLE_PHI GS. This must always
4592 be exactly the number of incoming edges for the basic block holding
4593 GS. */
4594
4595inline unsigned
4597{
4599 return phi_stmt->nargs;
4600}
4602
4603/* Return the SSA name created by GIMPLE_PHI GS. */
4604
4605inline tree
4606gimple_phi_result (const gphi *gs)
4607{
4608 return gs->result;
4609}
4610
4611inline tree
4613{
4616}
4617
4618/* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4619
4620inline tree *
4623 return &gs->result;
4624}
4625
4626inline tree *
4628{
4631}
4633/* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4634
4635inline void
4636gimple_phi_set_result (gphi *phi, tree result)
4637{
4638 phi->result = result;
4639 if (result && TREE_CODE (result) == SSA_NAME)
4640 SSA_NAME_DEF_STMT (result) = phi;
4641}
4643
4644/* Return the PHI argument corresponding to incoming edge INDEX for
4645 GIMPLE_PHI GS. */
4646
4647inline struct phi_arg_d *
4648gimple_phi_arg (gphi *gs, unsigned index)
4649{
4651 return &(gs->args[index]);
4652}
4653
4654inline const phi_arg_d *
4655gimple_phi_arg (const gphi *gs, unsigned index)
4656{
4658 return &(gs->args[index]);
4659}
4661inline const phi_arg_d *
4662gimple_phi_arg (const gimple *gs, unsigned index)
4663{
4665 return gimple_phi_arg (phi_stmt, index);
4667
4668inline struct phi_arg_d *
4669gimple_phi_arg (gimple *gs, unsigned index)
4670{
4672 return gimple_phi_arg (phi_stmt, index);
4673}
4674
4675/* Set PHIARG to be the argument corresponding to incoming edge INDEX
4676 for GIMPLE_PHI PHI. */
4677
4678inline void
4679gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4680{
4682 phi->args[index] = *phiarg;
4683}
4684
4685/* Return the PHI nodes for basic block BB, or NULL if there are no
4686 PHI nodes. */
4687
4688inline gimple_seq
4690{
4692 return bb->il.gimple.phi_nodes;
4693}
4694
4695/* Return a pointer to the PHI nodes for basic block BB. */
4696
4697inline gimple_seq *
4700 gcc_checking_assert (!(bb->flags & BB_RTL));
4701 return &bb->il.gimple.phi_nodes;
4702}
4703
4704/* Return the tree operand for argument I of PHI node GS. */
4705
4706inline tree
4707gimple_phi_arg_def (const gphi *gs, size_t index)
4708{
4709 return gimple_phi_arg (gs, index)->def;
4710}
4711
4712inline tree
4713gimple_phi_arg_def (const gimple *gs, size_t index)
4714{
4715 return gimple_phi_arg (gs, index)->def;
4716}
4717
4718/* Return the tree operand for the argument associated with
4719 edge E of PHI node GS. */
4720
4721inline tree
4724 gcc_checking_assert (e->dest == gimple_bb (gs));
4725 return gimple_phi_arg (gs, e->dest_idx)->def;
4726}
4727
4728inline tree
4730{
4732 return gimple_phi_arg (gs, e->dest_idx)->def;
4733}
4734
4735/* Return a pointer to the tree operand for argument I of phi node PHI. */
4736
4737inline tree *
4738gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4740 return &gimple_phi_arg (phi, index)->def;
4741}
4742
4743/* Return the edge associated with argument I of phi node PHI. */
4744
4745inline edge
4746gimple_phi_arg_edge (const gphi *phi, size_t i)
4748 return EDGE_PRED (gimple_bb (phi), i);
4749}
4750
4751/* Return the source location of gimple argument I of phi node PHI. */
4752
4753inline location_t
4754gimple_phi_arg_location (const gphi *phi, size_t i)
4755{
4756 return gimple_phi_arg (phi, i)->locus;
4757}
4758
4759/* Return the source location of the argument on edge E of phi node PHI. */
4760
4761inline location_t
4763{
4764 return gimple_phi_arg (phi, e->dest_idx)->locus;
4765}
4766
4767/* Set the source location of gimple argument I of phi node PHI to LOC. */
4768
4769inline void
4770gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4771{
4772 gimple_phi_arg (phi, i)->locus = loc;
4773}
4775/* Return address of source location of gimple argument I of phi node PHI. */
4776
4777inline location_t *
4778gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4779{
4780 return &gimple_phi_arg (phi, i)->locus;
4781}
4782
4783/* Return TRUE if argument I of phi node PHI has a location record. */
4784
4785inline bool
4787{
4789}
4790
4791/* Return the number of arguments that can be accessed by gimple_arg. */
4792
4793inline unsigned
4795{
4796 if (auto phi = dyn_cast<const gphi *> (gs))
4797 return gimple_phi_num_args (phi);
4798 if (auto call = dyn_cast<const gcall *> (gs))
4799 return gimple_call_num_args (call);
4801}
4803/* GS must be an assignment, a call, or a PHI.
4804 If it's an assignment, return rhs operand I.
4805 If it's a call, return function argument I.
4806 If it's a PHI, return the value of PHI argument I. */
4807
4808inline tree
4809gimple_arg (const gimple *gs, unsigned int i)
4810{
4811 if (auto phi = dyn_cast<const gphi *> (gs))
4812 return gimple_phi_arg_def (phi, i);
4813 if (auto call = dyn_cast<const gcall *> (gs))
4814 return gimple_call_arg (call, i);
4815 return gimple_op (as_a <const gassign *> (gs), i + 1);
4816}
4817
4818/* Return a pointer to gimple_arg (GS, I). */
4820inline tree *
4821gimple_arg_ptr (gimple *gs, unsigned int i)
4822{
4823 if (auto phi = dyn_cast<gphi *> (gs))
4824 return gimple_phi_arg_def_ptr (phi, i);
4825 if (auto call = dyn_cast<gcall *> (gs))
4826 return gimple_call_arg_ptr (call, i);
4827 return gimple_op_ptr (as_a <gassign *> (gs), i + 1);
4828}
4829
4830/* Return the region number for GIMPLE_RESX RESX_STMT. */
4831
4832inline int
4834{
4835 return resx_stmt->region;
4836}
4837
4838/* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4839
4840inline void
4843 resx_stmt->region = region;
4844}
4845
4846/* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4847
4848inline int
4850{
4851 return eh_dispatch_stmt->region;
4852}
4853
4854/* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4855 EH_DISPATCH_STMT. */
4856
4857inline void
4859{
4860 eh_dispatch_stmt->region = region;
4861}
4862
4863/* Return the number of labels associated with the switch statement GS. */
4864
4865inline unsigned
4867{
4868 unsigned num_ops;
4870 num_ops = gimple_num_ops (gs);
4872 return num_ops - 1;
4873}
4874
4875
4876/* Set NLABELS to be the number of labels for the switch statement GS. */
4877
4878inline void
4883}
4884
4885
4886/* Return the index variable used by the switch statement GS. */
4887
4888inline tree
4890{
4891 return gs->op[0];
4892}
4893
4894
4895/* Return a pointer to the index variable for the switch statement GS. */
4896
4897inline tree *
4899{
4900 return &gs->op[0];
4902
4903
4904/* Set INDEX to be the index variable for switch statement GS. */
4905
4906inline void
4908{
4910 gs->op[0] = index;
4911}
4912
4913
4914/* Return the label numbered INDEX. The default label is 0, followed by any
4915 labels in a switch statement. */
4916
4917inline tree
4918gimple_switch_label (const gswitch *gs, unsigned index)
4921 return gs->op[index + 1];
4922}
4923
4924/* Set the label number INDEX to LABEL. 0 is always the default label. */
4925
4926inline void
4927gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4928{
4930 && (label == NULL_TREE
4932 gs->op[index + 1] = label;
4933}
4934
4935/* Return the default label for a switch statement. */
4936
4937inline tree
4939{
4940 tree label = gimple_switch_label (gs, 0);
4941 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4942