138fd1498Szrj /* Gimple IR definitions. 238fd1498Szrj 338fd1498Szrj Copyright (C) 2007-2018 Free Software Foundation, Inc. 438fd1498Szrj Contributed by Aldy Hernandez <aldyh@redhat.com> 538fd1498Szrj 638fd1498Szrj This file is part of GCC. 738fd1498Szrj 838fd1498Szrj GCC is free software; you can redistribute it and/or modify it under 938fd1498Szrj the terms of the GNU General Public License as published by the Free 1038fd1498Szrj Software Foundation; either version 3, or (at your option) any later 1138fd1498Szrj version. 1238fd1498Szrj 1338fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY 1438fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or 1538fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1638fd1498Szrj for more details. 1738fd1498Szrj 1838fd1498Szrj You should have received a copy of the GNU General Public License 1938fd1498Szrj along with GCC; see the file COPYING3. If not see 2038fd1498Szrj <http://www.gnu.org/licenses/>. */ 2138fd1498Szrj 2238fd1498Szrj #ifndef GCC_GIMPLE_H 2338fd1498Szrj #define GCC_GIMPLE_H 2438fd1498Szrj 2538fd1498Szrj #include "tree-ssa-alias.h" 2638fd1498Szrj #include "gimple-expr.h" 2738fd1498Szrj 2838fd1498Szrj typedef gimple *gimple_seq_node; 2938fd1498Szrj 3038fd1498Szrj enum gimple_code { 3138fd1498Szrj #define DEFGSCODE(SYM, STRING, STRUCT) SYM, 3238fd1498Szrj #include "gimple.def" 3338fd1498Szrj #undef DEFGSCODE 3438fd1498Szrj LAST_AND_UNUSED_GIMPLE_CODE 3538fd1498Szrj }; 3638fd1498Szrj 3738fd1498Szrj extern const char *const gimple_code_name[]; 3838fd1498Szrj extern const unsigned char gimple_rhs_class_table[]; 3938fd1498Szrj 4038fd1498Szrj /* Strip the outermost pointer, from tr1/type_traits. */ 4138fd1498Szrj template<typename T> struct remove_pointer { typedef T type; }; 4238fd1498Szrj template<typename T> struct remove_pointer<T *> { typedef T type; }; 4338fd1498Szrj 4438fd1498Szrj /* Error out if a gimple tuple is addressed incorrectly. */ 4538fd1498Szrj #if defined ENABLE_GIMPLE_CHECKING 4638fd1498Szrj #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR) 4738fd1498Szrj extern void gimple_check_failed (const gimple *, const char *, int, \ 4838fd1498Szrj const char *, enum gimple_code, \ 4938fd1498Szrj enum tree_code) ATTRIBUTE_NORETURN \ 5038fd1498Szrj ATTRIBUTE_COLD; 5138fd1498Szrj 5238fd1498Szrj #define GIMPLE_CHECK(GS, CODE) \ 5338fd1498Szrj do { \ 5438fd1498Szrj const gimple *__gs = (GS); \ 5538fd1498Szrj if (gimple_code (__gs) != (CODE)) \ 5638fd1498Szrj gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \ 5738fd1498Szrj (CODE), ERROR_MARK); \ 5838fd1498Szrj } while (0) 5938fd1498Szrj template <typename T> 6038fd1498Szrj static inline T 6138fd1498Szrj GIMPLE_CHECK2(const gimple *gs, 6238fd1498Szrj #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) 6338fd1498Szrj const char *file = __builtin_FILE (), 6438fd1498Szrj int line = __builtin_LINE (), 6538fd1498Szrj const char *fun = __builtin_FUNCTION ()) 6638fd1498Szrj #else 6738fd1498Szrj const char *file = __FILE__, 6838fd1498Szrj int line = __LINE__, 6938fd1498Szrj const char *fun = NULL) 7038fd1498Szrj #endif 7138fd1498Szrj { 7238fd1498Szrj T ret = dyn_cast <T> (gs); 7338fd1498Szrj if (!ret) 7438fd1498Szrj gimple_check_failed (gs, file, line, fun, 7538fd1498Szrj remove_pointer<T>::type::code_, ERROR_MARK); 7638fd1498Szrj return ret; 7738fd1498Szrj } 7838fd1498Szrj template <typename T> 7938fd1498Szrj static inline T 8038fd1498Szrj GIMPLE_CHECK2(gimple *gs, 8138fd1498Szrj #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) 8238fd1498Szrj const char *file = __builtin_FILE (), 8338fd1498Szrj int line = __builtin_LINE (), 8438fd1498Szrj const char *fun = __builtin_FUNCTION ()) 8538fd1498Szrj #else 8638fd1498Szrj const char *file = __FILE__, 8738fd1498Szrj int line = __LINE__, 8838fd1498Szrj const char *fun = NULL) 8938fd1498Szrj #endif 9038fd1498Szrj { 9138fd1498Szrj T ret = dyn_cast <T> (gs); 9238fd1498Szrj if (!ret) 9338fd1498Szrj gimple_check_failed (gs, file, line, fun, 9438fd1498Szrj remove_pointer<T>::type::code_, ERROR_MARK); 9538fd1498Szrj return ret; 9638fd1498Szrj } 9738fd1498Szrj #else /* not ENABLE_GIMPLE_CHECKING */ 9838fd1498Szrj #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR))) 9938fd1498Szrj #define GIMPLE_CHECK(GS, CODE) (void)0 10038fd1498Szrj template <typename T> 10138fd1498Szrj static inline T 10238fd1498Szrj GIMPLE_CHECK2(gimple *gs) 10338fd1498Szrj { 10438fd1498Szrj return as_a <T> (gs); 10538fd1498Szrj } 10638fd1498Szrj template <typename T> 10738fd1498Szrj static inline T 10838fd1498Szrj GIMPLE_CHECK2(const gimple *gs) 10938fd1498Szrj { 11038fd1498Szrj return as_a <T> (gs); 11138fd1498Szrj } 11238fd1498Szrj #endif 11338fd1498Szrj 11438fd1498Szrj /* Class of GIMPLE expressions suitable for the RHS of assignments. See 11538fd1498Szrj get_gimple_rhs_class. */ 11638fd1498Szrj enum gimple_rhs_class 11738fd1498Szrj { 11838fd1498Szrj GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */ 11938fd1498Szrj GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */ 12038fd1498Szrj GIMPLE_BINARY_RHS, /* The expression is a binary operation. */ 12138fd1498Szrj GIMPLE_UNARY_RHS, /* The expression is a unary operation. */ 12238fd1498Szrj GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA 12338fd1498Szrj name, a _DECL, a _REF, etc. */ 12438fd1498Szrj }; 12538fd1498Szrj 12638fd1498Szrj /* Specific flags for individual GIMPLE statements. These flags are 12738fd1498Szrj always stored in gimple.subcode and they may only be 12838fd1498Szrj defined for statement codes that do not use subcodes. 12938fd1498Szrj 13038fd1498Szrj Values for the masks can overlap as long as the overlapping values 13138fd1498Szrj are never used in the same statement class. 13238fd1498Szrj 13338fd1498Szrj The maximum mask value that can be defined is 1 << 15 (i.e., each 13438fd1498Szrj statement code can hold up to 16 bitflags). 13538fd1498Szrj 13638fd1498Szrj Keep this list sorted. */ 13738fd1498Szrj enum gf_mask { 13838fd1498Szrj GF_ASM_INPUT = 1 << 0, 13938fd1498Szrj GF_ASM_VOLATILE = 1 << 1, 140*58e805e6Szrj GF_ASM_INLINE = 1 << 2, 14138fd1498Szrj GF_CALL_FROM_THUNK = 1 << 0, 14238fd1498Szrj GF_CALL_RETURN_SLOT_OPT = 1 << 1, 14338fd1498Szrj GF_CALL_TAILCALL = 1 << 2, 14438fd1498Szrj GF_CALL_VA_ARG_PACK = 1 << 3, 14538fd1498Szrj GF_CALL_NOTHROW = 1 << 4, 14638fd1498Szrj GF_CALL_ALLOCA_FOR_VAR = 1 << 5, 14738fd1498Szrj GF_CALL_INTERNAL = 1 << 6, 14838fd1498Szrj GF_CALL_CTRL_ALTERING = 1 << 7, 14938fd1498Szrj GF_CALL_WITH_BOUNDS = 1 << 8, 15038fd1498Szrj GF_CALL_MUST_TAIL_CALL = 1 << 9, 15138fd1498Szrj GF_CALL_BY_DESCRIPTOR = 1 << 10, 15238fd1498Szrj GF_CALL_NOCF_CHECK = 1 << 11, 15338fd1498Szrj GF_OMP_PARALLEL_COMBINED = 1 << 0, 15438fd1498Szrj GF_OMP_PARALLEL_GRID_PHONY = 1 << 1, 15538fd1498Szrj GF_OMP_TASK_TASKLOOP = 1 << 0, 15638fd1498Szrj GF_OMP_FOR_KIND_MASK = (1 << 4) - 1, 15738fd1498Szrj GF_OMP_FOR_KIND_FOR = 0, 15838fd1498Szrj GF_OMP_FOR_KIND_DISTRIBUTE = 1, 15938fd1498Szrj GF_OMP_FOR_KIND_TASKLOOP = 2, 16038fd1498Szrj GF_OMP_FOR_KIND_OACC_LOOP = 4, 16138fd1498Szrj GF_OMP_FOR_KIND_GRID_LOOP = 5, 16238fd1498Szrj /* Flag for SIMD variants of OMP_FOR kinds. */ 16338fd1498Szrj GF_OMP_FOR_SIMD = 1 << 3, 16438fd1498Szrj GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0, 16538fd1498Szrj GF_OMP_FOR_COMBINED = 1 << 4, 16638fd1498Szrj GF_OMP_FOR_COMBINED_INTO = 1 << 5, 16738fd1498Szrj /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop 16838fd1498Szrj statements. */ 16938fd1498Szrj GF_OMP_FOR_GRID_PHONY = 1 << 6, 17038fd1498Szrj /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP 17138fd1498Szrj loop statements. */ 17238fd1498Szrj GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6, 17338fd1498Szrj GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7, 17438fd1498Szrj GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1, 17538fd1498Szrj GF_OMP_TARGET_KIND_REGION = 0, 17638fd1498Szrj GF_OMP_TARGET_KIND_DATA = 1, 17738fd1498Szrj GF_OMP_TARGET_KIND_UPDATE = 2, 17838fd1498Szrj GF_OMP_TARGET_KIND_ENTER_DATA = 3, 17938fd1498Szrj GF_OMP_TARGET_KIND_EXIT_DATA = 4, 18038fd1498Szrj GF_OMP_TARGET_KIND_OACC_PARALLEL = 5, 18138fd1498Szrj GF_OMP_TARGET_KIND_OACC_KERNELS = 6, 18238fd1498Szrj GF_OMP_TARGET_KIND_OACC_DATA = 7, 18338fd1498Szrj GF_OMP_TARGET_KIND_OACC_UPDATE = 8, 18438fd1498Szrj GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9, 18538fd1498Szrj GF_OMP_TARGET_KIND_OACC_DECLARE = 10, 18638fd1498Szrj GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11, 18738fd1498Szrj GF_OMP_TEAMS_GRID_PHONY = 1 << 0, 18838fd1498Szrj 18938fd1498Szrj /* True on an GIMPLE_OMP_RETURN statement if the return does not require 19038fd1498Szrj a thread synchronization via some sort of barrier. The exact barrier 19138fd1498Szrj that would otherwise be emitted is dependent on the OMP statement with 19238fd1498Szrj which this return is associated. */ 19338fd1498Szrj GF_OMP_RETURN_NOWAIT = 1 << 0, 19438fd1498Szrj 19538fd1498Szrj GF_OMP_SECTION_LAST = 1 << 0, 19638fd1498Szrj GF_OMP_ATOMIC_NEED_VALUE = 1 << 0, 19738fd1498Szrj GF_OMP_ATOMIC_SEQ_CST = 1 << 1, 19838fd1498Szrj GF_PREDICT_TAKEN = 1 << 15 19938fd1498Szrj }; 20038fd1498Szrj 20138fd1498Szrj /* This subcode tells apart different kinds of stmts that are not used 20238fd1498Szrj for codegen, but rather to retain debug information. */ 20338fd1498Szrj enum gimple_debug_subcode { 20438fd1498Szrj GIMPLE_DEBUG_BIND = 0, 20538fd1498Szrj GIMPLE_DEBUG_SOURCE_BIND = 1, 20638fd1498Szrj GIMPLE_DEBUG_BEGIN_STMT = 2, 20738fd1498Szrj GIMPLE_DEBUG_INLINE_ENTRY = 3 20838fd1498Szrj }; 20938fd1498Szrj 21038fd1498Szrj /* Masks for selecting a pass local flag (PLF) to work on. These 21138fd1498Szrj masks are used by gimple_set_plf and gimple_plf. */ 21238fd1498Szrj enum plf_mask { 21338fd1498Szrj GF_PLF_1 = 1 << 0, 21438fd1498Szrj GF_PLF_2 = 1 << 1 21538fd1498Szrj }; 21638fd1498Szrj 21738fd1498Szrj /* Data structure definitions for GIMPLE tuples. NOTE: word markers 21838fd1498Szrj are for 64 bit hosts. */ 21938fd1498Szrj 22038fd1498Szrj struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"), 22138fd1498Szrj chain_next ("%h.next"), variable_size)) 22238fd1498Szrj gimple 22338fd1498Szrj { 22438fd1498Szrj /* [ WORD 1 ] 22538fd1498Szrj Main identifying code for a tuple. */ 22638fd1498Szrj ENUM_BITFIELD(gimple_code) code : 8; 22738fd1498Szrj 22838fd1498Szrj /* Nonzero if a warning should not be emitted on this tuple. */ 22938fd1498Szrj unsigned int no_warning : 1; 23038fd1498Szrj 23138fd1498Szrj /* Nonzero if this tuple has been visited. Passes are responsible 23238fd1498Szrj for clearing this bit before using it. */ 23338fd1498Szrj unsigned int visited : 1; 23438fd1498Szrj 23538fd1498Szrj /* Nonzero if this tuple represents a non-temporal move. */ 23638fd1498Szrj unsigned int nontemporal_move : 1; 23738fd1498Szrj 23838fd1498Szrj /* Pass local flags. These flags are free for any pass to use as 23938fd1498Szrj they see fit. Passes should not assume that these flags contain 24038fd1498Szrj any useful value when the pass starts. Any initial state that 24138fd1498Szrj the pass requires should be set on entry to the pass. See 24238fd1498Szrj gimple_set_plf and gimple_plf for usage. */ 24338fd1498Szrj unsigned int plf : 2; 24438fd1498Szrj 24538fd1498Szrj /* Nonzero if this statement has been modified and needs to have its 24638fd1498Szrj operands rescanned. */ 24738fd1498Szrj unsigned modified : 1; 24838fd1498Szrj 24938fd1498Szrj /* Nonzero if this statement contains volatile operands. */ 25038fd1498Szrj unsigned has_volatile_ops : 1; 25138fd1498Szrj 25238fd1498Szrj /* Padding to get subcode to 16 bit alignment. */ 25338fd1498Szrj unsigned pad : 1; 25438fd1498Szrj 25538fd1498Szrj /* The SUBCODE field can be used for tuple-specific flags for tuples 25638fd1498Szrj that do not require subcodes. Note that SUBCODE should be at 25738fd1498Szrj least as wide as tree codes, as several tuples store tree codes 25838fd1498Szrj in there. */ 25938fd1498Szrj unsigned int subcode : 16; 26038fd1498Szrj 26138fd1498Szrj /* UID of this statement. This is used by passes that want to 26238fd1498Szrj assign IDs to statements. It must be assigned and used by each 26338fd1498Szrj pass. By default it should be assumed to contain garbage. */ 26438fd1498Szrj unsigned uid; 26538fd1498Szrj 26638fd1498Szrj /* [ WORD 2 ] 26738fd1498Szrj Locus information for debug info. */ 26838fd1498Szrj location_t location; 26938fd1498Szrj 27038fd1498Szrj /* Number of operands in this tuple. */ 27138fd1498Szrj unsigned num_ops; 27238fd1498Szrj 27338fd1498Szrj /* [ WORD 3 ] 27438fd1498Szrj Basic block holding this statement. */ 27538fd1498Szrj basic_block bb; 27638fd1498Szrj 27738fd1498Szrj /* [ WORD 4-5 ] 27838fd1498Szrj Linked lists of gimple statements. The next pointers form 27938fd1498Szrj a NULL terminated list, the prev pointers are a cyclic list. 28038fd1498Szrj A gimple statement is hence also a double-ended list of 28138fd1498Szrj statements, with the pointer itself being the first element, 28238fd1498Szrj and the prev pointer being the last. */ 28338fd1498Szrj gimple *next; 28438fd1498Szrj gimple *GTY((skip)) prev; 28538fd1498Szrj }; 28638fd1498Szrj 28738fd1498Szrj 28838fd1498Szrj /* Base structure for tuples with operands. */ 28938fd1498Szrj 29038fd1498Szrj /* This gimple subclass has no tag value. */ 29138fd1498Szrj struct GTY(()) 29238fd1498Szrj gimple_statement_with_ops_base : public gimple 29338fd1498Szrj { 29438fd1498Szrj /* [ WORD 1-6 ] : base class */ 29538fd1498Szrj 29638fd1498Szrj /* [ WORD 7 ] 29738fd1498Szrj SSA operand vectors. NOTE: It should be possible to 29838fd1498Szrj amalgamate these vectors with the operand vector OP. However, 29938fd1498Szrj the SSA operand vectors are organized differently and contain 30038fd1498Szrj more information (like immediate use chaining). */ 30138fd1498Szrj struct use_optype_d GTY((skip (""))) *use_ops; 30238fd1498Szrj }; 30338fd1498Szrj 30438fd1498Szrj 30538fd1498Szrj /* Statements that take register operands. */ 30638fd1498Szrj 30738fd1498Szrj struct GTY((tag("GSS_WITH_OPS"))) 30838fd1498Szrj gimple_statement_with_ops : public gimple_statement_with_ops_base 30938fd1498Szrj { 31038fd1498Szrj /* [ WORD 1-7 ] : base class */ 31138fd1498Szrj 31238fd1498Szrj /* [ WORD 8 ] 31338fd1498Szrj Operand vector. NOTE! This must always be the last field 31438fd1498Szrj of this structure. In particular, this means that this 31538fd1498Szrj structure cannot be embedded inside another one. */ 31638fd1498Szrj tree GTY((length ("%h.num_ops"))) op[1]; 31738fd1498Szrj }; 31838fd1498Szrj 31938fd1498Szrj 32038fd1498Szrj /* Base for statements that take both memory and register operands. */ 32138fd1498Szrj 32238fd1498Szrj struct GTY((tag("GSS_WITH_MEM_OPS_BASE"))) 32338fd1498Szrj gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base 32438fd1498Szrj { 32538fd1498Szrj /* [ WORD 1-7 ] : base class */ 32638fd1498Szrj 32738fd1498Szrj /* [ WORD 8-9 ] 32838fd1498Szrj Virtual operands for this statement. The GC will pick them 32938fd1498Szrj up via the ssa_names array. */ 33038fd1498Szrj tree GTY((skip (""))) vdef; 33138fd1498Szrj tree GTY((skip (""))) vuse; 33238fd1498Szrj }; 33338fd1498Szrj 33438fd1498Szrj 33538fd1498Szrj /* Statements that take both memory and register operands. */ 33638fd1498Szrj 33738fd1498Szrj struct GTY((tag("GSS_WITH_MEM_OPS"))) 33838fd1498Szrj gimple_statement_with_memory_ops : 33938fd1498Szrj public gimple_statement_with_memory_ops_base 34038fd1498Szrj { 34138fd1498Szrj /* [ WORD 1-9 ] : base class */ 34238fd1498Szrj 34338fd1498Szrj /* [ WORD 10 ] 34438fd1498Szrj Operand vector. NOTE! This must always be the last field 34538fd1498Szrj of this structure. In particular, this means that this 34638fd1498Szrj structure cannot be embedded inside another one. */ 34738fd1498Szrj tree GTY((length ("%h.num_ops"))) op[1]; 34838fd1498Szrj }; 34938fd1498Szrj 35038fd1498Szrj 35138fd1498Szrj /* Call statements that take both memory and register operands. */ 35238fd1498Szrj 35338fd1498Szrj struct GTY((tag("GSS_CALL"))) 35438fd1498Szrj gcall : public gimple_statement_with_memory_ops_base 35538fd1498Szrj { 35638fd1498Szrj /* [ WORD 1-9 ] : base class */ 35738fd1498Szrj 35838fd1498Szrj /* [ WORD 10-13 ] */ 35938fd1498Szrj struct pt_solution call_used; 36038fd1498Szrj struct pt_solution call_clobbered; 36138fd1498Szrj 36238fd1498Szrj /* [ WORD 14 ] */ 36338fd1498Szrj union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) { 36438fd1498Szrj tree GTY ((tag ("0"))) fntype; 36538fd1498Szrj enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn; 36638fd1498Szrj } u; 36738fd1498Szrj 36838fd1498Szrj /* [ WORD 15 ] 36938fd1498Szrj Operand vector. NOTE! This must always be the last field 37038fd1498Szrj of this structure. In particular, this means that this 37138fd1498Szrj structure cannot be embedded inside another one. */ 37238fd1498Szrj tree GTY((length ("%h.num_ops"))) op[1]; 37338fd1498Szrj 37438fd1498Szrj static const enum gimple_code code_ = GIMPLE_CALL; 37538fd1498Szrj }; 37638fd1498Szrj 37738fd1498Szrj 37838fd1498Szrj /* OMP statements. */ 37938fd1498Szrj 38038fd1498Szrj struct GTY((tag("GSS_OMP"))) 38138fd1498Szrj gimple_statement_omp : public gimple 38238fd1498Szrj { 38338fd1498Szrj /* [ WORD 1-6 ] : base class */ 38438fd1498Szrj 38538fd1498Szrj /* [ WORD 7 ] */ 38638fd1498Szrj gimple_seq body; 38738fd1498Szrj }; 38838fd1498Szrj 38938fd1498Szrj 39038fd1498Szrj /* GIMPLE_BIND */ 39138fd1498Szrj 39238fd1498Szrj struct GTY((tag("GSS_BIND"))) 39338fd1498Szrj gbind : public gimple 39438fd1498Szrj { 39538fd1498Szrj /* [ WORD 1-6 ] : base class */ 39638fd1498Szrj 39738fd1498Szrj /* [ WORD 7 ] 39838fd1498Szrj Variables declared in this scope. */ 39938fd1498Szrj tree vars; 40038fd1498Szrj 40138fd1498Szrj /* [ WORD 8 ] 40238fd1498Szrj This is different than the BLOCK field in gimple, 40338fd1498Szrj which is analogous to TREE_BLOCK (i.e., the lexical block holding 40438fd1498Szrj this statement). This field is the equivalent of BIND_EXPR_BLOCK 40538fd1498Szrj in tree land (i.e., the lexical scope defined by this bind). See 40638fd1498Szrj gimple-low.c. */ 40738fd1498Szrj tree block; 40838fd1498Szrj 40938fd1498Szrj /* [ WORD 9 ] */ 41038fd1498Szrj gimple_seq body; 41138fd1498Szrj }; 41238fd1498Szrj 41338fd1498Szrj 41438fd1498Szrj /* GIMPLE_CATCH */ 41538fd1498Szrj 41638fd1498Szrj struct GTY((tag("GSS_CATCH"))) 41738fd1498Szrj gcatch : public gimple 41838fd1498Szrj { 41938fd1498Szrj /* [ WORD 1-6 ] : base class */ 42038fd1498Szrj 42138fd1498Szrj /* [ WORD 7 ] */ 42238fd1498Szrj tree types; 42338fd1498Szrj 42438fd1498Szrj /* [ WORD 8 ] */ 42538fd1498Szrj gimple_seq handler; 42638fd1498Szrj }; 42738fd1498Szrj 42838fd1498Szrj 42938fd1498Szrj /* GIMPLE_EH_FILTER */ 43038fd1498Szrj 43138fd1498Szrj struct GTY((tag("GSS_EH_FILTER"))) 43238fd1498Szrj geh_filter : public gimple 43338fd1498Szrj { 43438fd1498Szrj /* [ WORD 1-6 ] : base class */ 43538fd1498Szrj 43638fd1498Szrj /* [ WORD 7 ] 43738fd1498Szrj Filter types. */ 43838fd1498Szrj tree types; 43938fd1498Szrj 44038fd1498Szrj /* [ WORD 8 ] 44138fd1498Szrj Failure actions. */ 44238fd1498Szrj gimple_seq failure; 44338fd1498Szrj }; 44438fd1498Szrj 44538fd1498Szrj /* GIMPLE_EH_ELSE */ 44638fd1498Szrj 44738fd1498Szrj struct GTY((tag("GSS_EH_ELSE"))) 44838fd1498Szrj geh_else : public gimple 44938fd1498Szrj { 45038fd1498Szrj /* [ WORD 1-6 ] : base class */ 45138fd1498Szrj 45238fd1498Szrj /* [ WORD 7,8 ] */ 45338fd1498Szrj gimple_seq n_body, e_body; 45438fd1498Szrj }; 45538fd1498Szrj 45638fd1498Szrj /* GIMPLE_EH_MUST_NOT_THROW */ 45738fd1498Szrj 45838fd1498Szrj struct GTY((tag("GSS_EH_MNT"))) 45938fd1498Szrj geh_mnt : public gimple 46038fd1498Szrj { 46138fd1498Szrj /* [ WORD 1-6 ] : base class */ 46238fd1498Szrj 46338fd1498Szrj /* [ WORD 7 ] Abort function decl. */ 46438fd1498Szrj tree fndecl; 46538fd1498Szrj }; 46638fd1498Szrj 46738fd1498Szrj /* GIMPLE_PHI */ 46838fd1498Szrj 46938fd1498Szrj struct GTY((tag("GSS_PHI"))) 47038fd1498Szrj gphi : public gimple 47138fd1498Szrj { 47238fd1498Szrj /* [ WORD 1-6 ] : base class */ 47338fd1498Szrj 47438fd1498Szrj /* [ WORD 7 ] */ 47538fd1498Szrj unsigned capacity; 47638fd1498Szrj unsigned nargs; 47738fd1498Szrj 47838fd1498Szrj /* [ WORD 8 ] */ 47938fd1498Szrj tree result; 48038fd1498Szrj 48138fd1498Szrj /* [ WORD 9 ] */ 48238fd1498Szrj struct phi_arg_d GTY ((length ("%h.nargs"))) args[1]; 48338fd1498Szrj }; 48438fd1498Szrj 48538fd1498Szrj 48638fd1498Szrj /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */ 48738fd1498Szrj 48838fd1498Szrj struct GTY((tag("GSS_EH_CTRL"))) 48938fd1498Szrj gimple_statement_eh_ctrl : public gimple 49038fd1498Szrj { 49138fd1498Szrj /* [ WORD 1-6 ] : base class */ 49238fd1498Szrj 49338fd1498Szrj /* [ WORD 7 ] 49438fd1498Szrj Exception region number. */ 49538fd1498Szrj int region; 49638fd1498Szrj }; 49738fd1498Szrj 49838fd1498Szrj struct GTY((tag("GSS_EH_CTRL"))) 49938fd1498Szrj gresx : public gimple_statement_eh_ctrl 50038fd1498Szrj { 50138fd1498Szrj /* No extra fields; adds invariant: 50238fd1498Szrj stmt->code == GIMPLE_RESX. */ 50338fd1498Szrj }; 50438fd1498Szrj 50538fd1498Szrj struct GTY((tag("GSS_EH_CTRL"))) 50638fd1498Szrj geh_dispatch : public gimple_statement_eh_ctrl 50738fd1498Szrj { 50838fd1498Szrj /* No extra fields; adds invariant: 50938fd1498Szrj stmt->code == GIMPLE_EH_DISPATH. */ 51038fd1498Szrj }; 51138fd1498Szrj 51238fd1498Szrj 51338fd1498Szrj /* GIMPLE_TRY */ 51438fd1498Szrj 51538fd1498Szrj struct GTY((tag("GSS_TRY"))) 51638fd1498Szrj gtry : public gimple 51738fd1498Szrj { 51838fd1498Szrj /* [ WORD 1-6 ] : base class */ 51938fd1498Szrj 52038fd1498Szrj /* [ WORD 7 ] 52138fd1498Szrj Expression to evaluate. */ 52238fd1498Szrj gimple_seq eval; 52338fd1498Szrj 52438fd1498Szrj /* [ WORD 8 ] 52538fd1498Szrj Cleanup expression. */ 52638fd1498Szrj gimple_seq cleanup; 52738fd1498Szrj }; 52838fd1498Szrj 52938fd1498Szrj /* Kind of GIMPLE_TRY statements. */ 53038fd1498Szrj enum gimple_try_flags 53138fd1498Szrj { 53238fd1498Szrj /* A try/catch. */ 53338fd1498Szrj GIMPLE_TRY_CATCH = 1 << 0, 53438fd1498Szrj 53538fd1498Szrj /* A try/finally. */ 53638fd1498Szrj GIMPLE_TRY_FINALLY = 1 << 1, 53738fd1498Szrj GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY, 53838fd1498Szrj 53938fd1498Szrj /* Analogous to TRY_CATCH_IS_CLEANUP. */ 54038fd1498Szrj GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2 54138fd1498Szrj }; 54238fd1498Szrj 54338fd1498Szrj /* GIMPLE_WITH_CLEANUP_EXPR */ 54438fd1498Szrj 54538fd1498Szrj struct GTY((tag("GSS_WCE"))) 54638fd1498Szrj gimple_statement_wce : public gimple 54738fd1498Szrj { 54838fd1498Szrj /* [ WORD 1-6 ] : base class */ 54938fd1498Szrj 55038fd1498Szrj /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be 55138fd1498Szrj executed if an exception is thrown, not on normal exit of its 55238fd1498Szrj scope. This flag is analogous to the CLEANUP_EH_ONLY flag 55338fd1498Szrj in TARGET_EXPRs. */ 55438fd1498Szrj 55538fd1498Szrj /* [ WORD 7 ] 55638fd1498Szrj Cleanup expression. */ 55738fd1498Szrj gimple_seq cleanup; 55838fd1498Szrj }; 55938fd1498Szrj 56038fd1498Szrj 56138fd1498Szrj /* GIMPLE_ASM */ 56238fd1498Szrj 56338fd1498Szrj struct GTY((tag("GSS_ASM"))) 56438fd1498Szrj gasm : public gimple_statement_with_memory_ops_base 56538fd1498Szrj { 56638fd1498Szrj /* [ WORD 1-9 ] : base class */ 56738fd1498Szrj 56838fd1498Szrj /* [ WORD 10 ] 56938fd1498Szrj __asm__ statement. */ 57038fd1498Szrj const char *string; 57138fd1498Szrj 57238fd1498Szrj /* [ WORD 11 ] 57338fd1498Szrj Number of inputs, outputs, clobbers, labels. */ 57438fd1498Szrj unsigned char ni; 57538fd1498Szrj unsigned char no; 57638fd1498Szrj unsigned char nc; 57738fd1498Szrj unsigned char nl; 57838fd1498Szrj 57938fd1498Szrj /* [ WORD 12 ] 58038fd1498Szrj Operand vector. NOTE! This must always be the last field 58138fd1498Szrj of this structure. In particular, this means that this 58238fd1498Szrj structure cannot be embedded inside another one. */ 58338fd1498Szrj tree GTY((length ("%h.num_ops"))) op[1]; 58438fd1498Szrj }; 58538fd1498Szrj 58638fd1498Szrj /* GIMPLE_OMP_CRITICAL */ 58738fd1498Szrj 58838fd1498Szrj struct GTY((tag("GSS_OMP_CRITICAL"))) 58938fd1498Szrj gomp_critical : public gimple_statement_omp 59038fd1498Szrj { 59138fd1498Szrj /* [ WORD 1-7 ] : base class */ 59238fd1498Szrj 59338fd1498Szrj /* [ WORD 8 ] */ 59438fd1498Szrj tree clauses; 59538fd1498Szrj 59638fd1498Szrj /* [ WORD 9 ] 59738fd1498Szrj Critical section name. */ 59838fd1498Szrj tree name; 59938fd1498Szrj }; 60038fd1498Szrj 60138fd1498Szrj 60238fd1498Szrj struct GTY(()) gimple_omp_for_iter { 60338fd1498Szrj /* Condition code. */ 60438fd1498Szrj enum tree_code cond; 60538fd1498Szrj 60638fd1498Szrj /* Index variable. */ 60738fd1498Szrj tree index; 60838fd1498Szrj 60938fd1498Szrj /* Initial value. */ 61038fd1498Szrj tree initial; 61138fd1498Szrj 61238fd1498Szrj /* Final value. */ 61338fd1498Szrj tree final; 61438fd1498Szrj 61538fd1498Szrj /* Increment. */ 61638fd1498Szrj tree incr; 61738fd1498Szrj }; 61838fd1498Szrj 61938fd1498Szrj /* GIMPLE_OMP_FOR */ 62038fd1498Szrj 62138fd1498Szrj struct GTY((tag("GSS_OMP_FOR"))) 62238fd1498Szrj gomp_for : public gimple_statement_omp 62338fd1498Szrj { 62438fd1498Szrj /* [ WORD 1-7 ] : base class */ 62538fd1498Szrj 62638fd1498Szrj /* [ WORD 8 ] */ 62738fd1498Szrj tree clauses; 62838fd1498Szrj 62938fd1498Szrj /* [ WORD 9 ] 63038fd1498Szrj Number of elements in iter array. */ 63138fd1498Szrj size_t collapse; 63238fd1498Szrj 63338fd1498Szrj /* [ WORD 10 ] */ 63438fd1498Szrj struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter; 63538fd1498Szrj 63638fd1498Szrj /* [ WORD 11 ] 63738fd1498Szrj Pre-body evaluated before the loop body begins. */ 63838fd1498Szrj gimple_seq pre_body; 63938fd1498Szrj }; 64038fd1498Szrj 64138fd1498Szrj 64238fd1498Szrj /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */ 64338fd1498Szrj 64438fd1498Szrj struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) 64538fd1498Szrj gimple_statement_omp_parallel_layout : public gimple_statement_omp 64638fd1498Szrj { 64738fd1498Szrj /* [ WORD 1-7 ] : base class */ 64838fd1498Szrj 64938fd1498Szrj /* [ WORD 8 ] 65038fd1498Szrj Clauses. */ 65138fd1498Szrj tree clauses; 65238fd1498Szrj 65338fd1498Szrj /* [ WORD 9 ] 65438fd1498Szrj Child function holding the body of the parallel region. */ 65538fd1498Szrj tree child_fn; 65638fd1498Szrj 65738fd1498Szrj /* [ WORD 10 ] 65838fd1498Szrj Shared data argument. */ 65938fd1498Szrj tree data_arg; 66038fd1498Szrj }; 66138fd1498Szrj 66238fd1498Szrj /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */ 66338fd1498Szrj struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) 66438fd1498Szrj gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout 66538fd1498Szrj { 66638fd1498Szrj /* No extra fields; adds invariant: 66738fd1498Szrj stmt->code == GIMPLE_OMP_PARALLEL 66838fd1498Szrj || stmt->code == GIMPLE_OMP_TASK. */ 66938fd1498Szrj }; 67038fd1498Szrj 67138fd1498Szrj /* GIMPLE_OMP_PARALLEL */ 67238fd1498Szrj struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) 67338fd1498Szrj gomp_parallel : public gimple_statement_omp_taskreg 67438fd1498Szrj { 67538fd1498Szrj /* No extra fields; adds invariant: 67638fd1498Szrj stmt->code == GIMPLE_OMP_PARALLEL. */ 67738fd1498Szrj }; 67838fd1498Szrj 67938fd1498Szrj /* GIMPLE_OMP_TARGET */ 68038fd1498Szrj struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) 68138fd1498Szrj gomp_target : public gimple_statement_omp_parallel_layout 68238fd1498Szrj { 68338fd1498Szrj /* No extra fields; adds invariant: 68438fd1498Szrj stmt->code == GIMPLE_OMP_TARGET. */ 68538fd1498Szrj }; 68638fd1498Szrj 68738fd1498Szrj /* GIMPLE_OMP_TASK */ 68838fd1498Szrj 68938fd1498Szrj struct GTY((tag("GSS_OMP_TASK"))) 69038fd1498Szrj gomp_task : public gimple_statement_omp_taskreg 69138fd1498Szrj { 69238fd1498Szrj /* [ WORD 1-10 ] : base class */ 69338fd1498Szrj 69438fd1498Szrj /* [ WORD 11 ] 69538fd1498Szrj Child function holding firstprivate initialization if needed. */ 69638fd1498Szrj tree copy_fn; 69738fd1498Szrj 69838fd1498Szrj /* [ WORD 12-13 ] 69938fd1498Szrj Size and alignment in bytes of the argument data block. */ 70038fd1498Szrj tree arg_size; 70138fd1498Szrj tree arg_align; 70238fd1498Szrj }; 70338fd1498Szrj 70438fd1498Szrj 70538fd1498Szrj /* GIMPLE_OMP_SECTION */ 70638fd1498Szrj /* Uses struct gimple_statement_omp. */ 70738fd1498Szrj 70838fd1498Szrj 70938fd1498Szrj /* GIMPLE_OMP_SECTIONS */ 71038fd1498Szrj 71138fd1498Szrj struct GTY((tag("GSS_OMP_SECTIONS"))) 71238fd1498Szrj gomp_sections : public gimple_statement_omp 71338fd1498Szrj { 71438fd1498Szrj /* [ WORD 1-7 ] : base class */ 71538fd1498Szrj 71638fd1498Szrj /* [ WORD 8 ] */ 71738fd1498Szrj tree clauses; 71838fd1498Szrj 71938fd1498Szrj /* [ WORD 9 ] 72038fd1498Szrj The control variable used for deciding which of the sections to 72138fd1498Szrj execute. */ 72238fd1498Szrj tree control; 72338fd1498Szrj }; 72438fd1498Szrj 72538fd1498Szrj /* GIMPLE_OMP_CONTINUE. 72638fd1498Szrj 72738fd1498Szrj Note: This does not inherit from gimple_statement_omp, because we 72838fd1498Szrj do not need the body field. */ 72938fd1498Szrj 73038fd1498Szrj struct GTY((tag("GSS_OMP_CONTINUE"))) 73138fd1498Szrj gomp_continue : public gimple 73238fd1498Szrj { 73338fd1498Szrj /* [ WORD 1-6 ] : base class */ 73438fd1498Szrj 73538fd1498Szrj /* [ WORD 7 ] */ 73638fd1498Szrj tree control_def; 73738fd1498Szrj 73838fd1498Szrj /* [ WORD 8 ] */ 73938fd1498Szrj tree control_use; 74038fd1498Szrj }; 74138fd1498Szrj 74238fd1498Szrj /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */ 74338fd1498Szrj 74438fd1498Szrj struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) 74538fd1498Szrj gimple_statement_omp_single_layout : public gimple_statement_omp 74638fd1498Szrj { 74738fd1498Szrj /* [ WORD 1-7 ] : base class */ 74838fd1498Szrj 74938fd1498Szrj /* [ WORD 8 ] */ 75038fd1498Szrj tree clauses; 75138fd1498Szrj }; 75238fd1498Szrj 75338fd1498Szrj struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) 75438fd1498Szrj gomp_single : public gimple_statement_omp_single_layout 75538fd1498Szrj { 75638fd1498Szrj /* No extra fields; adds invariant: 75738fd1498Szrj stmt->code == GIMPLE_OMP_SINGLE. */ 75838fd1498Szrj }; 75938fd1498Szrj 76038fd1498Szrj struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) 76138fd1498Szrj gomp_teams : public gimple_statement_omp_single_layout 76238fd1498Szrj { 76338fd1498Szrj /* No extra fields; adds invariant: 76438fd1498Szrj stmt->code == GIMPLE_OMP_TEAMS. */ 76538fd1498Szrj }; 76638fd1498Szrj 76738fd1498Szrj struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) 76838fd1498Szrj gomp_ordered : public gimple_statement_omp_single_layout 76938fd1498Szrj { 77038fd1498Szrj /* No extra fields; adds invariant: 77138fd1498Szrj stmt->code == GIMPLE_OMP_ORDERED. */ 77238fd1498Szrj }; 77338fd1498Szrj 77438fd1498Szrj 77538fd1498Szrj /* GIMPLE_OMP_ATOMIC_LOAD. 77638fd1498Szrj Note: This is based on gimple, not g_s_omp, because g_s_omp 77738fd1498Szrj contains a sequence, which we don't need here. */ 77838fd1498Szrj 77938fd1498Szrj struct GTY((tag("GSS_OMP_ATOMIC_LOAD"))) 78038fd1498Szrj gomp_atomic_load : public gimple 78138fd1498Szrj { 78238fd1498Szrj /* [ WORD 1-6 ] : base class */ 78338fd1498Szrj 78438fd1498Szrj /* [ WORD 7-8 ] */ 78538fd1498Szrj tree rhs, lhs; 78638fd1498Szrj }; 78738fd1498Szrj 78838fd1498Szrj /* GIMPLE_OMP_ATOMIC_STORE. 78938fd1498Szrj See note on GIMPLE_OMP_ATOMIC_LOAD. */ 79038fd1498Szrj 79138fd1498Szrj struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) 79238fd1498Szrj gimple_statement_omp_atomic_store_layout : public gimple 79338fd1498Szrj { 79438fd1498Szrj /* [ WORD 1-6 ] : base class */ 79538fd1498Szrj 79638fd1498Szrj /* [ WORD 7 ] */ 79738fd1498Szrj tree val; 79838fd1498Szrj }; 79938fd1498Szrj 80038fd1498Szrj struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) 80138fd1498Szrj gomp_atomic_store : 80238fd1498Szrj public gimple_statement_omp_atomic_store_layout 80338fd1498Szrj { 80438fd1498Szrj /* No extra fields; adds invariant: 80538fd1498Szrj stmt->code == GIMPLE_OMP_ATOMIC_STORE. */ 80638fd1498Szrj }; 80738fd1498Szrj 80838fd1498Szrj struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) 80938fd1498Szrj gimple_statement_omp_return : 81038fd1498Szrj public gimple_statement_omp_atomic_store_layout 81138fd1498Szrj { 81238fd1498Szrj /* No extra fields; adds invariant: 81338fd1498Szrj stmt->code == GIMPLE_OMP_RETURN. */ 81438fd1498Szrj }; 81538fd1498Szrj 81638fd1498Szrj /* GIMPLE_TRANSACTION. */ 81738fd1498Szrj 81838fd1498Szrj /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */ 81938fd1498Szrj 82038fd1498Szrj /* The __transaction_atomic was declared [[outer]] or it is 82138fd1498Szrj __transaction_relaxed. */ 82238fd1498Szrj #define GTMA_IS_OUTER (1u << 0) 82338fd1498Szrj #define GTMA_IS_RELAXED (1u << 1) 82438fd1498Szrj #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED) 82538fd1498Szrj 82638fd1498Szrj /* The transaction is seen to not have an abort. */ 82738fd1498Szrj #define GTMA_HAVE_ABORT (1u << 2) 82838fd1498Szrj /* The transaction is seen to have loads or stores. */ 82938fd1498Szrj #define GTMA_HAVE_LOAD (1u << 3) 83038fd1498Szrj #define GTMA_HAVE_STORE (1u << 4) 83138fd1498Szrj /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */ 83238fd1498Szrj #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5) 83338fd1498Szrj /* The transaction WILL enter serial irrevocable mode. 83438fd1498Szrj An irrevocable block post-dominates the entire transaction, such 83538fd1498Szrj that all invocations of the transaction will go serial-irrevocable. 83638fd1498Szrj In such case, we don't bother instrumenting the transaction, and 83738fd1498Szrj tell the runtime that it should begin the transaction in 83838fd1498Szrj serial-irrevocable mode. */ 83938fd1498Szrj #define GTMA_DOES_GO_IRREVOCABLE (1u << 6) 84038fd1498Szrj /* The transaction contains no instrumentation code whatsover, most 84138fd1498Szrj likely because it is guaranteed to go irrevocable upon entry. */ 84238fd1498Szrj #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7) 84338fd1498Szrj 84438fd1498Szrj struct GTY((tag("GSS_TRANSACTION"))) 84538fd1498Szrj gtransaction : public gimple_statement_with_memory_ops_base 84638fd1498Szrj { 84738fd1498Szrj /* [ WORD 1-9 ] : base class */ 84838fd1498Szrj 84938fd1498Szrj /* [ WORD 10 ] */ 85038fd1498Szrj gimple_seq body; 85138fd1498Szrj 85238fd1498Szrj /* [ WORD 11-13 ] */ 85338fd1498Szrj tree label_norm; 85438fd1498Szrj tree label_uninst; 85538fd1498Szrj tree label_over; 85638fd1498Szrj }; 85738fd1498Szrj 85838fd1498Szrj #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM, 85938fd1498Szrj enum gimple_statement_structure_enum { 86038fd1498Szrj #include "gsstruct.def" 86138fd1498Szrj LAST_GSS_ENUM 86238fd1498Szrj }; 86338fd1498Szrj #undef DEFGSSTRUCT 86438fd1498Szrj 86538fd1498Szrj /* A statement with the invariant that 86638fd1498Szrj stmt->code == GIMPLE_COND 86738fd1498Szrj i.e. a conditional jump statement. */ 86838fd1498Szrj 86938fd1498Szrj struct GTY((tag("GSS_WITH_OPS"))) 87038fd1498Szrj gcond : public gimple_statement_with_ops 87138fd1498Szrj { 87238fd1498Szrj /* no additional fields; this uses the layout for GSS_WITH_OPS. */ 87338fd1498Szrj static const enum gimple_code code_ = GIMPLE_COND; 87438fd1498Szrj }; 87538fd1498Szrj 87638fd1498Szrj /* A statement with the invariant that 87738fd1498Szrj stmt->code == GIMPLE_DEBUG 87838fd1498Szrj i.e. a debug statement. */ 87938fd1498Szrj 88038fd1498Szrj struct GTY((tag("GSS_WITH_OPS"))) 88138fd1498Szrj gdebug : public gimple_statement_with_ops 88238fd1498Szrj { 88338fd1498Szrj /* no additional fields; this uses the layout for GSS_WITH_OPS. */ 88438fd1498Szrj }; 88538fd1498Szrj 88638fd1498Szrj /* A statement with the invariant that 88738fd1498Szrj stmt->code == GIMPLE_GOTO 88838fd1498Szrj i.e. a goto statement. */ 88938fd1498Szrj 89038fd1498Szrj struct GTY((tag("GSS_WITH_OPS"))) 89138fd1498Szrj ggoto : public gimple_statement_with_ops 89238fd1498Szrj { 89338fd1498Szrj /* no additional fields; this uses the layout for GSS_WITH_OPS. */ 89438fd1498Szrj }; 89538fd1498Szrj 89638fd1498Szrj /* A statement with the invariant that 89738fd1498Szrj stmt->code == GIMPLE_LABEL 89838fd1498Szrj i.e. a label statement. */ 89938fd1498Szrj 90038fd1498Szrj struct GTY((tag("GSS_WITH_OPS"))) 90138fd1498Szrj glabel : public gimple_statement_with_ops 90238fd1498Szrj { 90338fd1498Szrj /* no additional fields; this uses the layout for GSS_WITH_OPS. */ 90438fd1498Szrj }; 90538fd1498Szrj 90638fd1498Szrj /* A statement with the invariant that 90738fd1498Szrj stmt->code == GIMPLE_SWITCH 90838fd1498Szrj i.e. a switch statement. */ 90938fd1498Szrj 91038fd1498Szrj struct GTY((tag("GSS_WITH_OPS"))) 91138fd1498Szrj gswitch : public gimple_statement_with_ops 91238fd1498Szrj { 91338fd1498Szrj /* no additional fields; this uses the layout for GSS_WITH_OPS. */ 91438fd1498Szrj }; 91538fd1498Szrj 91638fd1498Szrj /* A statement with the invariant that 91738fd1498Szrj stmt->code == GIMPLE_ASSIGN 91838fd1498Szrj i.e. an assignment statement. */ 91938fd1498Szrj 92038fd1498Szrj struct GTY((tag("GSS_WITH_MEM_OPS"))) 92138fd1498Szrj gassign : public gimple_statement_with_memory_ops 92238fd1498Szrj { 92338fd1498Szrj static const enum gimple_code code_ = GIMPLE_ASSIGN; 92438fd1498Szrj /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */ 92538fd1498Szrj }; 92638fd1498Szrj 92738fd1498Szrj /* A statement with the invariant that 92838fd1498Szrj stmt->code == GIMPLE_RETURN 92938fd1498Szrj i.e. a return statement. */ 93038fd1498Szrj 93138fd1498Szrj struct GTY((tag("GSS_WITH_MEM_OPS"))) 93238fd1498Szrj greturn : public gimple_statement_with_memory_ops 93338fd1498Szrj { 93438fd1498Szrj /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */ 93538fd1498Szrj }; 93638fd1498Szrj 93738fd1498Szrj template <> 93838fd1498Szrj template <> 93938fd1498Szrj inline bool 94038fd1498Szrj is_a_helper <gasm *>::test (gimple *gs) 94138fd1498Szrj { 94238fd1498Szrj return gs->code == GIMPLE_ASM; 94338fd1498Szrj } 94438fd1498Szrj 94538fd1498Szrj template <> 94638fd1498Szrj template <> 94738fd1498Szrj inline bool 94838fd1498Szrj is_a_helper <gassign *>::test (gimple *gs) 94938fd1498Szrj { 95038fd1498Szrj return gs->code == GIMPLE_ASSIGN; 95138fd1498Szrj } 95238fd1498Szrj 95338fd1498Szrj template <> 95438fd1498Szrj template <> 95538fd1498Szrj inline bool 95638fd1498Szrj is_a_helper <const gassign *>::test (const gimple *gs) 95738fd1498Szrj { 95838fd1498Szrj return gs->code == GIMPLE_ASSIGN; 95938fd1498Szrj } 96038fd1498Szrj 96138fd1498Szrj template <> 96238fd1498Szrj template <> 96338fd1498Szrj inline bool 96438fd1498Szrj is_a_helper <gbind *>::test (gimple *gs) 96538fd1498Szrj { 96638fd1498Szrj return gs->code == GIMPLE_BIND; 96738fd1498Szrj } 96838fd1498Szrj 96938fd1498Szrj template <> 97038fd1498Szrj template <> 97138fd1498Szrj inline bool 97238fd1498Szrj is_a_helper <gcall *>::test (gimple *gs) 97338fd1498Szrj { 97438fd1498Szrj return gs->code == GIMPLE_CALL; 97538fd1498Szrj } 97638fd1498Szrj 97738fd1498Szrj template <> 97838fd1498Szrj template <> 97938fd1498Szrj inline bool 98038fd1498Szrj is_a_helper <gcatch *>::test (gimple *gs) 98138fd1498Szrj { 98238fd1498Szrj return gs->code == GIMPLE_CATCH; 98338fd1498Szrj } 98438fd1498Szrj 98538fd1498Szrj template <> 98638fd1498Szrj template <> 98738fd1498Szrj inline bool 98838fd1498Szrj is_a_helper <gcond *>::test (gimple *gs) 98938fd1498Szrj { 99038fd1498Szrj return gs->code == GIMPLE_COND; 99138fd1498Szrj } 99238fd1498Szrj 99338fd1498Szrj template <> 99438fd1498Szrj template <> 99538fd1498Szrj inline bool 99638fd1498Szrj is_a_helper <const gcond *>::test (const gimple *gs) 99738fd1498Szrj { 99838fd1498Szrj return gs->code == GIMPLE_COND; 99938fd1498Szrj } 100038fd1498Szrj 100138fd1498Szrj template <> 100238fd1498Szrj template <> 100338fd1498Szrj inline bool 100438fd1498Szrj is_a_helper <gdebug *>::test (gimple *gs) 100538fd1498Szrj { 100638fd1498Szrj return gs->code == GIMPLE_DEBUG; 100738fd1498Szrj } 100838fd1498Szrj 100938fd1498Szrj template <> 101038fd1498Szrj template <> 101138fd1498Szrj inline bool 101238fd1498Szrj is_a_helper <ggoto *>::test (gimple *gs) 101338fd1498Szrj { 101438fd1498Szrj return gs->code == GIMPLE_GOTO; 101538fd1498Szrj } 101638fd1498Szrj 101738fd1498Szrj template <> 101838fd1498Szrj template <> 101938fd1498Szrj inline bool 102038fd1498Szrj is_a_helper <glabel *>::test (gimple *gs) 102138fd1498Szrj { 102238fd1498Szrj return gs->code == GIMPLE_LABEL; 102338fd1498Szrj } 102438fd1498Szrj 102538fd1498Szrj template <> 102638fd1498Szrj template <> 102738fd1498Szrj inline bool 102838fd1498Szrj is_a_helper <gresx *>::test (gimple *gs) 102938fd1498Szrj { 103038fd1498Szrj return gs->code == GIMPLE_RESX; 103138fd1498Szrj } 103238fd1498Szrj 103338fd1498Szrj template <> 103438fd1498Szrj template <> 103538fd1498Szrj inline bool 103638fd1498Szrj is_a_helper <geh_dispatch *>::test (gimple *gs) 103738fd1498Szrj { 103838fd1498Szrj return gs->code == GIMPLE_EH_DISPATCH; 103938fd1498Szrj } 104038fd1498Szrj 104138fd1498Szrj template <> 104238fd1498Szrj template <> 104338fd1498Szrj inline bool 104438fd1498Szrj is_a_helper <geh_else *>::test (gimple *gs) 104538fd1498Szrj { 104638fd1498Szrj return gs->code == GIMPLE_EH_ELSE; 104738fd1498Szrj } 104838fd1498Szrj 104938fd1498Szrj template <> 105038fd1498Szrj template <> 105138fd1498Szrj inline bool 105238fd1498Szrj is_a_helper <geh_filter *>::test (gimple *gs) 105338fd1498Szrj { 105438fd1498Szrj return gs->code == GIMPLE_EH_FILTER; 105538fd1498Szrj } 105638fd1498Szrj 105738fd1498Szrj template <> 105838fd1498Szrj template <> 105938fd1498Szrj inline bool 106038fd1498Szrj is_a_helper <geh_mnt *>::test (gimple *gs) 106138fd1498Szrj { 106238fd1498Szrj return gs->code == GIMPLE_EH_MUST_NOT_THROW; 106338fd1498Szrj } 106438fd1498Szrj 106538fd1498Szrj template <> 106638fd1498Szrj template <> 106738fd1498Szrj inline bool 106838fd1498Szrj is_a_helper <gomp_atomic_load *>::test (gimple *gs) 106938fd1498Szrj { 107038fd1498Szrj return gs->code == GIMPLE_OMP_ATOMIC_LOAD; 107138fd1498Szrj } 107238fd1498Szrj 107338fd1498Szrj template <> 107438fd1498Szrj template <> 107538fd1498Szrj inline bool 107638fd1498Szrj is_a_helper <gomp_atomic_store *>::test (gimple *gs) 107738fd1498Szrj { 107838fd1498Szrj return gs->code == GIMPLE_OMP_ATOMIC_STORE; 107938fd1498Szrj } 108038fd1498Szrj 108138fd1498Szrj template <> 108238fd1498Szrj template <> 108338fd1498Szrj inline bool 108438fd1498Szrj is_a_helper <gimple_statement_omp_return *>::test (gimple *gs) 108538fd1498Szrj { 108638fd1498Szrj return gs->code == GIMPLE_OMP_RETURN; 108738fd1498Szrj } 108838fd1498Szrj 108938fd1498Szrj template <> 109038fd1498Szrj template <> 109138fd1498Szrj inline bool 109238fd1498Szrj is_a_helper <gomp_continue *>::test (gimple *gs) 109338fd1498Szrj { 109438fd1498Szrj return gs->code == GIMPLE_OMP_CONTINUE; 109538fd1498Szrj } 109638fd1498Szrj 109738fd1498Szrj template <> 109838fd1498Szrj template <> 109938fd1498Szrj inline bool 110038fd1498Szrj is_a_helper <gomp_critical *>::test (gimple *gs) 110138fd1498Szrj { 110238fd1498Szrj return gs->code == GIMPLE_OMP_CRITICAL; 110338fd1498Szrj } 110438fd1498Szrj 110538fd1498Szrj template <> 110638fd1498Szrj template <> 110738fd1498Szrj inline bool 110838fd1498Szrj is_a_helper <gomp_ordered *>::test (gimple *gs) 110938fd1498Szrj { 111038fd1498Szrj return gs->code == GIMPLE_OMP_ORDERED; 111138fd1498Szrj } 111238fd1498Szrj 111338fd1498Szrj template <> 111438fd1498Szrj template <> 111538fd1498Szrj inline bool 111638fd1498Szrj is_a_helper <gomp_for *>::test (gimple *gs) 111738fd1498Szrj { 111838fd1498Szrj return gs->code == GIMPLE_OMP_FOR; 111938fd1498Szrj } 112038fd1498Szrj 112138fd1498Szrj template <> 112238fd1498Szrj template <> 112338fd1498Szrj inline bool 112438fd1498Szrj is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs) 112538fd1498Szrj { 112638fd1498Szrj return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK; 112738fd1498Szrj } 112838fd1498Szrj 112938fd1498Szrj template <> 113038fd1498Szrj template <> 113138fd1498Szrj inline bool 113238fd1498Szrj is_a_helper <gomp_parallel *>::test (gimple *gs) 113338fd1498Szrj { 113438fd1498Szrj return gs->code == GIMPLE_OMP_PARALLEL; 113538fd1498Szrj } 113638fd1498Szrj 113738fd1498Szrj template <> 113838fd1498Szrj template <> 113938fd1498Szrj inline bool 114038fd1498Szrj is_a_helper <gomp_target *>::test (gimple *gs) 114138fd1498Szrj { 114238fd1498Szrj return gs->code == GIMPLE_OMP_TARGET; 114338fd1498Szrj } 114438fd1498Szrj 114538fd1498Szrj template <> 114638fd1498Szrj template <> 114738fd1498Szrj inline bool 114838fd1498Szrj is_a_helper <gomp_sections *>::test (gimple *gs) 114938fd1498Szrj { 115038fd1498Szrj return gs->code == GIMPLE_OMP_SECTIONS; 115138fd1498Szrj } 115238fd1498Szrj 115338fd1498Szrj template <> 115438fd1498Szrj template <> 115538fd1498Szrj inline bool 115638fd1498Szrj is_a_helper <gomp_single *>::test (gimple *gs) 115738fd1498Szrj { 115838fd1498Szrj return gs->code == GIMPLE_OMP_SINGLE; 115938fd1498Szrj } 116038fd1498Szrj 116138fd1498Szrj template <> 116238fd1498Szrj template <> 116338fd1498Szrj inline bool 116438fd1498Szrj is_a_helper <gomp_teams *>::test (gimple *gs) 116538fd1498Szrj { 116638fd1498Szrj return gs->code == GIMPLE_OMP_TEAMS; 116738fd1498Szrj } 116838fd1498Szrj 116938fd1498Szrj template <> 117038fd1498Szrj template <> 117138fd1498Szrj inline bool 117238fd1498Szrj is_a_helper <gomp_task *>::test (gimple *gs) 117338fd1498Szrj { 117438fd1498Szrj return gs->code == GIMPLE_OMP_TASK; 117538fd1498Szrj } 117638fd1498Szrj 117738fd1498Szrj template <> 117838fd1498Szrj template <> 117938fd1498Szrj inline bool 118038fd1498Szrj is_a_helper <gphi *>::test (gimple *gs) 118138fd1498Szrj { 118238fd1498Szrj return gs->code == GIMPLE_PHI; 118338fd1498Szrj } 118438fd1498Szrj 118538fd1498Szrj template <> 118638fd1498Szrj template <> 118738fd1498Szrj inline bool 118838fd1498Szrj is_a_helper <greturn *>::test (gimple *gs) 118938fd1498Szrj { 119038fd1498Szrj return gs->code == GIMPLE_RETURN; 119138fd1498Szrj } 119238fd1498Szrj 119338fd1498Szrj template <> 119438fd1498Szrj template <> 119538fd1498Szrj inline bool 119638fd1498Szrj is_a_helper <gswitch *>::test (gimple *gs) 119738fd1498Szrj { 119838fd1498Szrj return gs->code == GIMPLE_SWITCH; 119938fd1498Szrj } 120038fd1498Szrj 120138fd1498Szrj template <> 120238fd1498Szrj template <> 120338fd1498Szrj inline bool 120438fd1498Szrj is_a_helper <gtransaction *>::test (gimple *gs) 120538fd1498Szrj { 120638fd1498Szrj return gs->code == GIMPLE_TRANSACTION; 120738fd1498Szrj } 120838fd1498Szrj 120938fd1498Szrj template <> 121038fd1498Szrj template <> 121138fd1498Szrj inline bool 121238fd1498Szrj is_a_helper <gtry *>::test (gimple *gs) 121338fd1498Szrj { 121438fd1498Szrj return gs->code == GIMPLE_TRY; 121538fd1498Szrj } 121638fd1498Szrj 121738fd1498Szrj template <> 121838fd1498Szrj template <> 121938fd1498Szrj inline bool 122038fd1498Szrj is_a_helper <gimple_statement_wce *>::test (gimple *gs) 122138fd1498Szrj { 122238fd1498Szrj return gs->code == GIMPLE_WITH_CLEANUP_EXPR; 122338fd1498Szrj } 122438fd1498Szrj 122538fd1498Szrj template <> 122638fd1498Szrj template <> 122738fd1498Szrj inline bool 122838fd1498Szrj is_a_helper <const gasm *>::test (const gimple *gs) 122938fd1498Szrj { 123038fd1498Szrj return gs->code == GIMPLE_ASM; 123138fd1498Szrj } 123238fd1498Szrj 123338fd1498Szrj template <> 123438fd1498Szrj template <> 123538fd1498Szrj inline bool 123638fd1498Szrj is_a_helper <const gbind *>::test (const gimple *gs) 123738fd1498Szrj { 123838fd1498Szrj return gs->code == GIMPLE_BIND; 123938fd1498Szrj } 124038fd1498Szrj 124138fd1498Szrj template <> 124238fd1498Szrj template <> 124338fd1498Szrj inline bool 124438fd1498Szrj is_a_helper <const gcall *>::test (const gimple *gs) 124538fd1498Szrj { 124638fd1498Szrj return gs->code == GIMPLE_CALL; 124738fd1498Szrj } 124838fd1498Szrj 124938fd1498Szrj template <> 125038fd1498Szrj template <> 125138fd1498Szrj inline bool 125238fd1498Szrj is_a_helper <const gcatch *>::test (const gimple *gs) 125338fd1498Szrj { 125438fd1498Szrj return gs->code == GIMPLE_CATCH; 125538fd1498Szrj } 125638fd1498Szrj 125738fd1498Szrj template <> 125838fd1498Szrj template <> 125938fd1498Szrj inline bool 126038fd1498Szrj is_a_helper <const gresx *>::test (const gimple *gs) 126138fd1498Szrj { 126238fd1498Szrj return gs->code == GIMPLE_RESX; 126338fd1498Szrj } 126438fd1498Szrj 126538fd1498Szrj template <> 126638fd1498Szrj template <> 126738fd1498Szrj inline bool 126838fd1498Szrj is_a_helper <const geh_dispatch *>::test (const gimple *gs) 126938fd1498Szrj { 127038fd1498Szrj return gs->code == GIMPLE_EH_DISPATCH; 127138fd1498Szrj } 127238fd1498Szrj 127338fd1498Szrj template <> 127438fd1498Szrj template <> 127538fd1498Szrj inline bool 127638fd1498Szrj is_a_helper <const geh_filter *>::test (const gimple *gs) 127738fd1498Szrj { 127838fd1498Szrj return gs->code == GIMPLE_EH_FILTER; 127938fd1498Szrj } 128038fd1498Szrj 128138fd1498Szrj template <> 128238fd1498Szrj template <> 128338fd1498Szrj inline bool 128438fd1498Szrj is_a_helper <const gomp_atomic_load *>::test (const gimple *gs) 128538fd1498Szrj { 128638fd1498Szrj return gs->code == GIMPLE_OMP_ATOMIC_LOAD; 128738fd1498Szrj } 128838fd1498Szrj 128938fd1498Szrj template <> 129038fd1498Szrj template <> 129138fd1498Szrj inline bool 129238fd1498Szrj is_a_helper <const gomp_atomic_store *>::test (const gimple *gs) 129338fd1498Szrj { 129438fd1498Szrj return gs->code == GIMPLE_OMP_ATOMIC_STORE; 129538fd1498Szrj } 129638fd1498Szrj 129738fd1498Szrj template <> 129838fd1498Szrj template <> 129938fd1498Szrj inline bool 130038fd1498Szrj is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs) 130138fd1498Szrj { 130238fd1498Szrj return gs->code == GIMPLE_OMP_RETURN; 130338fd1498Szrj } 130438fd1498Szrj 130538fd1498Szrj template <> 130638fd1498Szrj template <> 130738fd1498Szrj inline bool 130838fd1498Szrj is_a_helper <const gomp_continue *>::test (const gimple *gs) 130938fd1498Szrj { 131038fd1498Szrj return gs->code == GIMPLE_OMP_CONTINUE; 131138fd1498Szrj } 131238fd1498Szrj 131338fd1498Szrj template <> 131438fd1498Szrj template <> 131538fd1498Szrj inline bool 131638fd1498Szrj is_a_helper <const gomp_critical *>::test (const gimple *gs) 131738fd1498Szrj { 131838fd1498Szrj return gs->code == GIMPLE_OMP_CRITICAL; 131938fd1498Szrj } 132038fd1498Szrj 132138fd1498Szrj template <> 132238fd1498Szrj template <> 132338fd1498Szrj inline bool 132438fd1498Szrj is_a_helper <const gomp_ordered *>::test (const gimple *gs) 132538fd1498Szrj { 132638fd1498Szrj return gs->code == GIMPLE_OMP_ORDERED; 132738fd1498Szrj } 132838fd1498Szrj 132938fd1498Szrj template <> 133038fd1498Szrj template <> 133138fd1498Szrj inline bool 133238fd1498Szrj is_a_helper <const gomp_for *>::test (const gimple *gs) 133338fd1498Szrj { 133438fd1498Szrj return gs->code == GIMPLE_OMP_FOR; 133538fd1498Szrj } 133638fd1498Szrj 133738fd1498Szrj template <> 133838fd1498Szrj template <> 133938fd1498Szrj inline bool 134038fd1498Szrj is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs) 134138fd1498Szrj { 134238fd1498Szrj return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK; 134338fd1498Szrj } 134438fd1498Szrj 134538fd1498Szrj template <> 134638fd1498Szrj template <> 134738fd1498Szrj inline bool 134838fd1498Szrj is_a_helper <const gomp_parallel *>::test (const gimple *gs) 134938fd1498Szrj { 135038fd1498Szrj return gs->code == GIMPLE_OMP_PARALLEL; 135138fd1498Szrj } 135238fd1498Szrj 135338fd1498Szrj template <> 135438fd1498Szrj template <> 135538fd1498Szrj inline bool 135638fd1498Szrj is_a_helper <const gomp_target *>::test (const gimple *gs) 135738fd1498Szrj { 135838fd1498Szrj return gs->code == GIMPLE_OMP_TARGET; 135938fd1498Szrj } 136038fd1498Szrj 136138fd1498Szrj template <> 136238fd1498Szrj template <> 136338fd1498Szrj inline bool 136438fd1498Szrj is_a_helper <const gomp_sections *>::test (const gimple *gs) 136538fd1498Szrj { 136638fd1498Szrj return gs->code == GIMPLE_OMP_SECTIONS; 136738fd1498Szrj } 136838fd1498Szrj 136938fd1498Szrj template <> 137038fd1498Szrj template <> 137138fd1498Szrj inline bool 137238fd1498Szrj is_a_helper <const gomp_single *>::test (const gimple *gs) 137338fd1498Szrj { 137438fd1498Szrj return gs->code == GIMPLE_OMP_SINGLE; 137538fd1498Szrj } 137638fd1498Szrj 137738fd1498Szrj template <> 137838fd1498Szrj template <> 137938fd1498Szrj inline bool 138038fd1498Szrj is_a_helper <const gomp_teams *>::test (const gimple *gs) 138138fd1498Szrj { 138238fd1498Szrj return gs->code == GIMPLE_OMP_TEAMS; 138338fd1498Szrj } 138438fd1498Szrj 138538fd1498Szrj template <> 138638fd1498Szrj template <> 138738fd1498Szrj inline bool 138838fd1498Szrj is_a_helper <const gomp_task *>::test (const gimple *gs) 138938fd1498Szrj { 139038fd1498Szrj return gs->code == GIMPLE_OMP_TASK; 139138fd1498Szrj } 139238fd1498Szrj 139338fd1498Szrj template <> 139438fd1498Szrj template <> 139538fd1498Szrj inline bool 139638fd1498Szrj is_a_helper <const gphi *>::test (const gimple *gs) 139738fd1498Szrj { 139838fd1498Szrj return gs->code == GIMPLE_PHI; 139938fd1498Szrj } 140038fd1498Szrj 140138fd1498Szrj template <> 140238fd1498Szrj template <> 140338fd1498Szrj inline bool 140438fd1498Szrj is_a_helper <const gtransaction *>::test (const gimple *gs) 140538fd1498Szrj { 140638fd1498Szrj return gs->code == GIMPLE_TRANSACTION; 140738fd1498Szrj } 140838fd1498Szrj 140938fd1498Szrj /* Offset in bytes to the location of the operand vector. 141038fd1498Szrj Zero if there is no operand vector for this tuple structure. */ 141138fd1498Szrj extern size_t const gimple_ops_offset_[]; 141238fd1498Szrj 141338fd1498Szrj /* Map GIMPLE codes to GSS codes. */ 141438fd1498Szrj extern enum gimple_statement_structure_enum const gss_for_code_[]; 141538fd1498Szrj 141638fd1498Szrj /* This variable holds the currently expanded gimple statement for purposes 141738fd1498Szrj of comminucating the profile info to the builtin expanders. */ 141838fd1498Szrj extern gimple *currently_expanding_gimple_stmt; 141938fd1498Szrj 142038fd1498Szrj gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO); 142138fd1498Szrj greturn *gimple_build_return (tree); 142238fd1498Szrj void gimple_call_reset_alias_info (gcall *); 142338fd1498Szrj gcall *gimple_build_call_vec (tree, vec<tree> ); 142438fd1498Szrj gcall *gimple_build_call (tree, unsigned, ...); 142538fd1498Szrj gcall *gimple_build_call_valist (tree, unsigned, va_list); 142638fd1498Szrj gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...); 142738fd1498Szrj gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> ); 142838fd1498Szrj gcall *gimple_build_call_from_tree (tree, tree); 142938fd1498Szrj gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO); 143038fd1498Szrj gassign *gimple_build_assign (tree, enum tree_code, 143138fd1498Szrj tree, tree, tree CXX_MEM_STAT_INFO); 143238fd1498Szrj gassign *gimple_build_assign (tree, enum tree_code, 143338fd1498Szrj tree, tree CXX_MEM_STAT_INFO); 143438fd1498Szrj gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO); 143538fd1498Szrj gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree); 143638fd1498Szrj gcond *gimple_build_cond_from_tree (tree, tree, tree); 143738fd1498Szrj void gimple_cond_set_condition_from_tree (gcond *, tree); 143838fd1498Szrj glabel *gimple_build_label (tree label); 143938fd1498Szrj ggoto *gimple_build_goto (tree dest); 144038fd1498Szrj gimple *gimple_build_nop (void); 144138fd1498Szrj gbind *gimple_build_bind (tree, gimple_seq, tree); 144238fd1498Szrj gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *, 144338fd1498Szrj vec<tree, va_gc> *, vec<tree, va_gc> *, 144438fd1498Szrj vec<tree, va_gc> *); 144538fd1498Szrj gcatch *gimple_build_catch (tree, gimple_seq); 144638fd1498Szrj geh_filter *gimple_build_eh_filter (tree, gimple_seq); 144738fd1498Szrj geh_mnt *gimple_build_eh_must_not_throw (tree); 144838fd1498Szrj geh_else *gimple_build_eh_else (gimple_seq, gimple_seq); 144938fd1498Szrj gtry *gimple_build_try (gimple_seq, gimple_seq, 145038fd1498Szrj enum gimple_try_flags); 145138fd1498Szrj gimple *gimple_build_wce (gimple_seq); 145238fd1498Szrj gresx *gimple_build_resx (int); 145338fd1498Szrj gswitch *gimple_build_switch_nlabels (unsigned, tree, tree); 145438fd1498Szrj gswitch *gimple_build_switch (tree, tree, vec<tree> ); 145538fd1498Szrj geh_dispatch *gimple_build_eh_dispatch (int); 145638fd1498Szrj gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO); 145738fd1498Szrj gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO); 145838fd1498Szrj gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO); 145938fd1498Szrj gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO); 146038fd1498Szrj gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree); 146138fd1498Szrj gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq); 146238fd1498Szrj gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree); 146338fd1498Szrj gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, 146438fd1498Szrj tree, tree); 146538fd1498Szrj gimple *gimple_build_omp_section (gimple_seq); 146638fd1498Szrj gimple *gimple_build_omp_master (gimple_seq); 146738fd1498Szrj gimple *gimple_build_omp_grid_body (gimple_seq); 146838fd1498Szrj gimple *gimple_build_omp_taskgroup (gimple_seq); 146938fd1498Szrj gomp_continue *gimple_build_omp_continue (tree, tree); 147038fd1498Szrj gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree); 147138fd1498Szrj gimple *gimple_build_omp_return (bool); 147238fd1498Szrj gomp_sections *gimple_build_omp_sections (gimple_seq, tree); 147338fd1498Szrj gimple *gimple_build_omp_sections_switch (void); 147438fd1498Szrj gomp_single *gimple_build_omp_single (gimple_seq, tree); 147538fd1498Szrj gomp_target *gimple_build_omp_target (gimple_seq, int, tree); 147638fd1498Szrj gomp_teams *gimple_build_omp_teams (gimple_seq, tree); 147738fd1498Szrj gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree); 147838fd1498Szrj gomp_atomic_store *gimple_build_omp_atomic_store (tree); 147938fd1498Szrj gtransaction *gimple_build_transaction (gimple_seq); 148038fd1498Szrj extern void gimple_seq_add_stmt (gimple_seq *, gimple *); 148138fd1498Szrj extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *); 148238fd1498Szrj void gimple_seq_add_seq (gimple_seq *, gimple_seq); 148338fd1498Szrj void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq); 148438fd1498Szrj extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator, 148538fd1498Szrj location_t); 148638fd1498Szrj extern void annotate_all_with_location (gimple_seq, location_t); 148738fd1498Szrj bool empty_body_p (gimple_seq); 148838fd1498Szrj gimple_seq gimple_seq_copy (gimple_seq); 148938fd1498Szrj bool gimple_call_same_target_p (const gimple *, const gimple *); 149038fd1498Szrj int gimple_call_flags (const gimple *); 149138fd1498Szrj int gimple_call_arg_flags (const gcall *, unsigned); 149238fd1498Szrj int gimple_call_return_flags (const gcall *); 149338fd1498Szrj bool gimple_assign_copy_p (gimple *); 149438fd1498Szrj bool gimple_assign_ssa_name_copy_p (gimple *); 149538fd1498Szrj bool gimple_assign_unary_nop_p (gimple *); 149638fd1498Szrj void gimple_set_bb (gimple *, basic_block); 149738fd1498Szrj void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree); 149838fd1498Szrj void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code, 149938fd1498Szrj tree, tree, tree); 150038fd1498Szrj tree gimple_get_lhs (const gimple *); 150138fd1498Szrj void gimple_set_lhs (gimple *, tree); 150238fd1498Szrj gimple *gimple_copy (gimple *); 150338fd1498Szrj bool gimple_has_side_effects (const gimple *); 150438fd1498Szrj bool gimple_could_trap_p_1 (gimple *, bool, bool); 150538fd1498Szrj bool gimple_could_trap_p (gimple *); 150638fd1498Szrj bool gimple_assign_rhs_could_trap_p (gimple *); 150738fd1498Szrj extern void dump_gimple_statistics (void); 150838fd1498Szrj unsigned get_gimple_rhs_num_ops (enum tree_code); 150938fd1498Szrj extern tree canonicalize_cond_expr_cond (tree); 151038fd1498Szrj gcall *gimple_call_copy_skip_args (gcall *, bitmap); 151138fd1498Szrj extern bool gimple_compare_field_offset (tree, tree); 151238fd1498Szrj extern tree gimple_unsigned_type (tree); 151338fd1498Szrj extern tree gimple_signed_type (tree); 151438fd1498Szrj extern alias_set_type gimple_get_alias_set (tree); 151538fd1498Szrj extern bool gimple_ior_addresses_taken (bitmap, gimple *); 151638fd1498Szrj extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree); 151738fd1498Szrj extern combined_fn gimple_call_combined_fn (const gimple *); 151838fd1498Szrj extern bool gimple_call_builtin_p (const gimple *); 151938fd1498Szrj extern bool gimple_call_builtin_p (const gimple *, enum built_in_class); 152038fd1498Szrj extern bool gimple_call_builtin_p (const gimple *, enum built_in_function); 152138fd1498Szrj extern bool gimple_asm_clobbers_memory_p (const gasm *); 152238fd1498Szrj extern void dump_decl_set (FILE *, bitmap); 152338fd1498Szrj extern bool nonfreeing_call_p (gimple *); 152438fd1498Szrj extern bool nonbarrier_call_p (gimple *); 152538fd1498Szrj extern bool infer_nonnull_range (gimple *, tree); 152638fd1498Szrj extern bool infer_nonnull_range_by_dereference (gimple *, tree); 152738fd1498Szrj extern bool infer_nonnull_range_by_attribute (gimple *, tree); 152838fd1498Szrj extern void sort_case_labels (vec<tree>); 152938fd1498Szrj extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *); 153038fd1498Szrj extern void gimple_seq_set_location (gimple_seq, location_t); 153138fd1498Szrj extern void gimple_seq_discard (gimple_seq); 153238fd1498Szrj extern void maybe_remove_unused_call_args (struct function *, gimple *); 153338fd1498Szrj extern bool gimple_inexpensive_call_p (gcall *); 153438fd1498Szrj extern bool stmt_can_terminate_bb_p (gimple *); 153538fd1498Szrj 153638fd1498Szrj /* Formal (expression) temporary table handling: multiple occurrences of 153738fd1498Szrj the same scalar expression are evaluated into the same temporary. */ 153838fd1498Szrj 153938fd1498Szrj typedef struct gimple_temp_hash_elt 154038fd1498Szrj { 154138fd1498Szrj tree val; /* Key */ 154238fd1498Szrj tree temp; /* Value */ 154338fd1498Szrj } elt_t; 154438fd1498Szrj 154538fd1498Szrj /* Get the number of the next statement uid to be allocated. */ 154638fd1498Szrj static inline unsigned int 154738fd1498Szrj gimple_stmt_max_uid (struct function *fn) 154838fd1498Szrj { 154938fd1498Szrj return fn->last_stmt_uid; 155038fd1498Szrj } 155138fd1498Szrj 155238fd1498Szrj /* Set the number of the next statement uid to be allocated. */ 155338fd1498Szrj static inline void 155438fd1498Szrj set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid) 155538fd1498Szrj { 155638fd1498Szrj fn->last_stmt_uid = maxid; 155738fd1498Szrj } 155838fd1498Szrj 155938fd1498Szrj /* Set the number of the next statement uid to be allocated. */ 156038fd1498Szrj static inline unsigned int 156138fd1498Szrj inc_gimple_stmt_max_uid (struct function *fn) 156238fd1498Szrj { 156338fd1498Szrj return fn->last_stmt_uid++; 156438fd1498Szrj } 156538fd1498Szrj 156638fd1498Szrj /* Return the first node in GIMPLE sequence S. */ 156738fd1498Szrj 156838fd1498Szrj static inline gimple_seq_node 156938fd1498Szrj gimple_seq_first (gimple_seq s) 157038fd1498Szrj { 157138fd1498Szrj return s; 157238fd1498Szrj } 157338fd1498Szrj 157438fd1498Szrj 157538fd1498Szrj /* Return the first statement in GIMPLE sequence S. */ 157638fd1498Szrj 157738fd1498Szrj static inline gimple * 157838fd1498Szrj gimple_seq_first_stmt (gimple_seq s) 157938fd1498Szrj { 158038fd1498Szrj gimple_seq_node n = gimple_seq_first (s); 158138fd1498Szrj return n; 158238fd1498Szrj } 158338fd1498Szrj 158438fd1498Szrj /* Return the first statement in GIMPLE sequence S as a gbind *, 158538fd1498Szrj verifying that it has code GIMPLE_BIND in a checked build. */ 158638fd1498Szrj 158738fd1498Szrj static inline gbind * 158838fd1498Szrj gimple_seq_first_stmt_as_a_bind (gimple_seq s) 158938fd1498Szrj { 159038fd1498Szrj gimple_seq_node n = gimple_seq_first (s); 159138fd1498Szrj return as_a <gbind *> (n); 159238fd1498Szrj } 159338fd1498Szrj 159438fd1498Szrj 159538fd1498Szrj /* Return the last node in GIMPLE sequence S. */ 159638fd1498Szrj 159738fd1498Szrj static inline gimple_seq_node 159838fd1498Szrj gimple_seq_last (gimple_seq s) 159938fd1498Szrj { 160038fd1498Szrj return s ? s->prev : NULL; 160138fd1498Szrj } 160238fd1498Szrj 160338fd1498Szrj 160438fd1498Szrj /* Return the last statement in GIMPLE sequence S. */ 160538fd1498Szrj 160638fd1498Szrj static inline gimple * 160738fd1498Szrj gimple_seq_last_stmt (gimple_seq s) 160838fd1498Szrj { 160938fd1498Szrj gimple_seq_node n = gimple_seq_last (s); 161038fd1498Szrj return n; 161138fd1498Szrj } 161238fd1498Szrj 161338fd1498Szrj 161438fd1498Szrj /* Set the last node in GIMPLE sequence *PS to LAST. */ 161538fd1498Szrj 161638fd1498Szrj static inline void 161738fd1498Szrj gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last) 161838fd1498Szrj { 161938fd1498Szrj (*ps)->prev = last; 162038fd1498Szrj } 162138fd1498Szrj 162238fd1498Szrj 162338fd1498Szrj /* Set the first node in GIMPLE sequence *PS to FIRST. */ 162438fd1498Szrj 162538fd1498Szrj static inline void 162638fd1498Szrj gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first) 162738fd1498Szrj { 162838fd1498Szrj *ps = first; 162938fd1498Szrj } 163038fd1498Szrj 163138fd1498Szrj 163238fd1498Szrj /* Return true if GIMPLE sequence S is empty. */ 163338fd1498Szrj 163438fd1498Szrj static inline bool 163538fd1498Szrj gimple_seq_empty_p (gimple_seq s) 163638fd1498Szrj { 163738fd1498Szrj return s == NULL; 163838fd1498Szrj } 163938fd1498Szrj 164038fd1498Szrj /* Allocate a new sequence and initialize its first element with STMT. */ 164138fd1498Szrj 164238fd1498Szrj static inline gimple_seq 164338fd1498Szrj gimple_seq_alloc_with_stmt (gimple *stmt) 164438fd1498Szrj { 164538fd1498Szrj gimple_seq seq = NULL; 164638fd1498Szrj gimple_seq_add_stmt (&seq, stmt); 164738fd1498Szrj return seq; 164838fd1498Szrj } 164938fd1498Szrj 165038fd1498Szrj 165138fd1498Szrj /* Returns the sequence of statements in BB. */ 165238fd1498Szrj 165338fd1498Szrj static inline gimple_seq 165438fd1498Szrj bb_seq (const_basic_block bb) 165538fd1498Szrj { 165638fd1498Szrj return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL; 165738fd1498Szrj } 165838fd1498Szrj 165938fd1498Szrj static inline gimple_seq * 166038fd1498Szrj bb_seq_addr (basic_block bb) 166138fd1498Szrj { 166238fd1498Szrj return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL; 166338fd1498Szrj } 166438fd1498Szrj 166538fd1498Szrj /* Sets the sequence of statements in BB to SEQ. */ 166638fd1498Szrj 166738fd1498Szrj static inline void 166838fd1498Szrj set_bb_seq (basic_block bb, gimple_seq seq) 166938fd1498Szrj { 167038fd1498Szrj gcc_checking_assert (!(bb->flags & BB_RTL)); 167138fd1498Szrj bb->il.gimple.seq = seq; 167238fd1498Szrj } 167338fd1498Szrj 167438fd1498Szrj 167538fd1498Szrj /* Return the code for GIMPLE statement G. */ 167638fd1498Szrj 167738fd1498Szrj static inline enum gimple_code 167838fd1498Szrj gimple_code (const gimple *g) 167938fd1498Szrj { 168038fd1498Szrj return g->code; 168138fd1498Szrj } 168238fd1498Szrj 168338fd1498Szrj 168438fd1498Szrj /* Return the GSS code used by a GIMPLE code. */ 168538fd1498Szrj 168638fd1498Szrj static inline enum gimple_statement_structure_enum 168738fd1498Szrj gss_for_code (enum gimple_code code) 168838fd1498Szrj { 168938fd1498Szrj gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE); 169038fd1498Szrj return gss_for_code_[code]; 169138fd1498Szrj } 169238fd1498Szrj 169338fd1498Szrj 169438fd1498Szrj /* Return which GSS code is used by GS. */ 169538fd1498Szrj 169638fd1498Szrj static inline enum gimple_statement_structure_enum 169738fd1498Szrj gimple_statement_structure (gimple *gs) 169838fd1498Szrj { 169938fd1498Szrj return gss_for_code (gimple_code (gs)); 170038fd1498Szrj } 170138fd1498Szrj 170238fd1498Szrj 170338fd1498Szrj /* Return true if statement G has sub-statements. This is only true for 170438fd1498Szrj High GIMPLE statements. */ 170538fd1498Szrj 170638fd1498Szrj static inline bool 170738fd1498Szrj gimple_has_substatements (gimple *g) 170838fd1498Szrj { 170938fd1498Szrj switch (gimple_code (g)) 171038fd1498Szrj { 171138fd1498Szrj case GIMPLE_BIND: 171238fd1498Szrj case GIMPLE_CATCH: 171338fd1498Szrj case GIMPLE_EH_FILTER: 171438fd1498Szrj case GIMPLE_EH_ELSE: 171538fd1498Szrj case GIMPLE_TRY: 171638fd1498Szrj case GIMPLE_OMP_FOR: 171738fd1498Szrj case GIMPLE_OMP_MASTER: 171838fd1498Szrj case GIMPLE_OMP_TASKGROUP: 171938fd1498Szrj case GIMPLE_OMP_ORDERED: 172038fd1498Szrj case GIMPLE_OMP_SECTION: 172138fd1498Szrj case GIMPLE_OMP_PARALLEL: 172238fd1498Szrj case GIMPLE_OMP_TASK: 172338fd1498Szrj case GIMPLE_OMP_SECTIONS: 172438fd1498Szrj case GIMPLE_OMP_SINGLE: 172538fd1498Szrj case GIMPLE_OMP_TARGET: 172638fd1498Szrj case GIMPLE_OMP_TEAMS: 172738fd1498Szrj case GIMPLE_OMP_CRITICAL: 172838fd1498Szrj case GIMPLE_WITH_CLEANUP_EXPR: 172938fd1498Szrj case GIMPLE_TRANSACTION: 173038fd1498Szrj case GIMPLE_OMP_GRID_BODY: 173138fd1498Szrj return true; 173238fd1498Szrj 173338fd1498Szrj default: 173438fd1498Szrj return false; 173538fd1498Szrj } 173638fd1498Szrj } 173738fd1498Szrj 173838fd1498Szrj 173938fd1498Szrj /* Return the basic block holding statement G. */ 174038fd1498Szrj 174138fd1498Szrj static inline basic_block 174238fd1498Szrj gimple_bb (const gimple *g) 174338fd1498Szrj { 174438fd1498Szrj return g->bb; 174538fd1498Szrj } 174638fd1498Szrj 174738fd1498Szrj 174838fd1498Szrj /* Return the lexical scope block holding statement G. */ 174938fd1498Szrj 175038fd1498Szrj static inline tree 175138fd1498Szrj gimple_block (const gimple *g) 175238fd1498Szrj { 175338fd1498Szrj return LOCATION_BLOCK (g->location); 175438fd1498Szrj } 175538fd1498Szrj 175638fd1498Szrj 175738fd1498Szrj /* Set BLOCK to be the lexical scope block holding statement G. */ 175838fd1498Szrj 175938fd1498Szrj static inline void 176038fd1498Szrj gimple_set_block (gimple *g, tree block) 176138fd1498Szrj { 176238fd1498Szrj g->location = set_block (g->location, block); 176338fd1498Szrj } 176438fd1498Szrj 176538fd1498Szrj 176638fd1498Szrj /* Return location information for statement G. */ 176738fd1498Szrj 176838fd1498Szrj static inline location_t 176938fd1498Szrj gimple_location (const gimple *g) 177038fd1498Szrj { 177138fd1498Szrj return g->location; 177238fd1498Szrj } 177338fd1498Szrj 177438fd1498Szrj /* Return location information for statement G if g is not NULL. 177538fd1498Szrj Otherwise, UNKNOWN_LOCATION is returned. */ 177638fd1498Szrj 177738fd1498Szrj static inline location_t 177838fd1498Szrj gimple_location_safe (const gimple *g) 177938fd1498Szrj { 178038fd1498Szrj return g ? gimple_location (g) : UNKNOWN_LOCATION; 178138fd1498Szrj } 178238fd1498Szrj 178338fd1498Szrj /* Set location information for statement G. */ 178438fd1498Szrj 178538fd1498Szrj static inline void 178638fd1498Szrj gimple_set_location (gimple *g, location_t location) 178738fd1498Szrj { 178838fd1498Szrj g->location = location; 178938fd1498Szrj } 179038fd1498Szrj 179138fd1498Szrj 179238fd1498Szrj /* Return true if G contains location information. */ 179338fd1498Szrj 179438fd1498Szrj static inline bool 179538fd1498Szrj gimple_has_location (const gimple *g) 179638fd1498Szrj { 179738fd1498Szrj return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION; 179838fd1498Szrj } 179938fd1498Szrj 180038fd1498Szrj 180138fd1498Szrj /* Return the file name of the location of STMT. */ 180238fd1498Szrj 180338fd1498Szrj static inline const char * 180438fd1498Szrj gimple_filename (const gimple *stmt) 180538fd1498Szrj { 180638fd1498Szrj return LOCATION_FILE (gimple_location (stmt)); 180738fd1498Szrj } 180838fd1498Szrj 180938fd1498Szrj 181038fd1498Szrj /* Return the line number of the location of STMT. */ 181138fd1498Szrj 181238fd1498Szrj static inline int 181338fd1498Szrj gimple_lineno (const gimple *stmt) 181438fd1498Szrj { 181538fd1498Szrj return LOCATION_LINE (gimple_location (stmt)); 181638fd1498Szrj } 181738fd1498Szrj 181838fd1498Szrj 181938fd1498Szrj /* Determine whether SEQ is a singleton. */ 182038fd1498Szrj 182138fd1498Szrj static inline bool 182238fd1498Szrj gimple_seq_singleton_p (gimple_seq seq) 182338fd1498Szrj { 182438fd1498Szrj return ((gimple_seq_first (seq) != NULL) 182538fd1498Szrj && (gimple_seq_first (seq) == gimple_seq_last (seq))); 182638fd1498Szrj } 182738fd1498Szrj 182838fd1498Szrj /* Return true if no warnings should be emitted for statement STMT. */ 182938fd1498Szrj 183038fd1498Szrj static inline bool 183138fd1498Szrj gimple_no_warning_p (const gimple *stmt) 183238fd1498Szrj { 183338fd1498Szrj return stmt->no_warning; 183438fd1498Szrj } 183538fd1498Szrj 183638fd1498Szrj /* Set the no_warning flag of STMT to NO_WARNING. */ 183738fd1498Szrj 183838fd1498Szrj static inline void 183938fd1498Szrj gimple_set_no_warning (gimple *stmt, bool no_warning) 184038fd1498Szrj { 184138fd1498Szrj stmt->no_warning = (unsigned) no_warning; 184238fd1498Szrj } 184338fd1498Szrj 184438fd1498Szrj /* Set the visited status on statement STMT to VISITED_P. 184538fd1498Szrj 184638fd1498Szrj Please note that this 'visited' property of the gimple statement is 184738fd1498Szrj supposed to be undefined at pass boundaries. This means that a 184838fd1498Szrj given pass should not assume it contains any useful value when the 184938fd1498Szrj pass starts and thus can set it to any value it sees fit. 185038fd1498Szrj 185138fd1498Szrj You can learn more about the visited property of the gimple 185238fd1498Szrj statement by reading the comments of the 'visited' data member of 185338fd1498Szrj struct gimple. 185438fd1498Szrj */ 185538fd1498Szrj 185638fd1498Szrj static inline void 185738fd1498Szrj gimple_set_visited (gimple *stmt, bool visited_p) 185838fd1498Szrj { 185938fd1498Szrj stmt->visited = (unsigned) visited_p; 186038fd1498Szrj } 186138fd1498Szrj 186238fd1498Szrj 186338fd1498Szrj /* Return the visited status for statement STMT. 186438fd1498Szrj 186538fd1498Szrj Please note that this 'visited' property of the gimple statement is 186638fd1498Szrj supposed to be undefined at pass boundaries. This means that a 186738fd1498Szrj given pass should not assume it contains any useful value when the 186838fd1498Szrj pass starts and thus can set it to any value it sees fit. 186938fd1498Szrj 187038fd1498Szrj You can learn more about the visited property of the gimple 187138fd1498Szrj statement by reading the comments of the 'visited' data member of 187238fd1498Szrj struct gimple. */ 187338fd1498Szrj 187438fd1498Szrj static inline bool 187538fd1498Szrj gimple_visited_p (gimple *stmt) 187638fd1498Szrj { 187738fd1498Szrj return stmt->visited; 187838fd1498Szrj } 187938fd1498Szrj 188038fd1498Szrj 188138fd1498Szrj /* Set pass local flag PLF on statement STMT to VAL_P. 188238fd1498Szrj 188338fd1498Szrj Please note that this PLF property of the gimple statement is 188438fd1498Szrj supposed to be undefined at pass boundaries. This means that a 188538fd1498Szrj given pass should not assume it contains any useful value when the 188638fd1498Szrj pass starts and thus can set it to any value it sees fit. 188738fd1498Szrj 188838fd1498Szrj You can learn more about the PLF property by reading the comment of 188938fd1498Szrj the 'plf' data member of struct gimple_statement_structure. */ 189038fd1498Szrj 189138fd1498Szrj static inline void 189238fd1498Szrj gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p) 189338fd1498Szrj { 189438fd1498Szrj if (val_p) 189538fd1498Szrj stmt->plf |= (unsigned int) plf; 189638fd1498Szrj else 189738fd1498Szrj stmt->plf &= ~((unsigned int) plf); 189838fd1498Szrj } 189938fd1498Szrj 190038fd1498Szrj 190138fd1498Szrj /* Return the value of pass local flag PLF on statement STMT. 190238fd1498Szrj 190338fd1498Szrj Please note that this 'plf' property of the gimple statement is 190438fd1498Szrj supposed to be undefined at pass boundaries. This means that a 190538fd1498Szrj given pass should not assume it contains any useful value when the 190638fd1498Szrj pass starts and thus can set it to any value it sees fit. 190738fd1498Szrj 190838fd1498Szrj You can learn more about the plf property by reading the comment of 190938fd1498Szrj the 'plf' data member of struct gimple_statement_structure. */ 191038fd1498Szrj 191138fd1498Szrj static inline unsigned int 191238fd1498Szrj gimple_plf (gimple *stmt, enum plf_mask plf) 191338fd1498Szrj { 191438fd1498Szrj return stmt->plf & ((unsigned int) plf); 191538fd1498Szrj } 191638fd1498Szrj 191738fd1498Szrj 191838fd1498Szrj /* Set the UID of statement. 191938fd1498Szrj 192038fd1498Szrj Please note that this UID property is supposed to be undefined at 192138fd1498Szrj pass boundaries. This means that a given pass should not assume it 192238fd1498Szrj contains any useful value when the pass starts and thus can set it 192338fd1498Szrj to any value it sees fit. */ 192438fd1498Szrj 192538fd1498Szrj static inline void 192638fd1498Szrj gimple_set_uid (gimple *g, unsigned uid) 192738fd1498Szrj { 192838fd1498Szrj g->uid = uid; 192938fd1498Szrj } 193038fd1498Szrj 193138fd1498Szrj 193238fd1498Szrj /* Return the UID of statement. 193338fd1498Szrj 193438fd1498Szrj Please note that this UID property is supposed to be undefined at 193538fd1498Szrj pass boundaries. This means that a given pass should not assume it 193638fd1498Szrj contains any useful value when the pass starts and thus can set it 193738fd1498Szrj to any value it sees fit. */ 193838fd1498Szrj 193938fd1498Szrj static inline unsigned 194038fd1498Szrj gimple_uid (const gimple *g) 194138fd1498Szrj { 194238fd1498Szrj return g->uid; 194338fd1498Szrj } 194438fd1498Szrj 194538fd1498Szrj 194638fd1498Szrj /* Make statement G a singleton sequence. */ 194738fd1498Szrj 194838fd1498Szrj static inline void 194938fd1498Szrj gimple_init_singleton (gimple *g) 195038fd1498Szrj { 195138fd1498Szrj g->next = NULL; 195238fd1498Szrj g->prev = g; 195338fd1498Szrj } 195438fd1498Szrj 195538fd1498Szrj 195638fd1498Szrj /* Return true if GIMPLE statement G has register or memory operands. */ 195738fd1498Szrj 195838fd1498Szrj static inline bool 195938fd1498Szrj gimple_has_ops (const gimple *g) 196038fd1498Szrj { 196138fd1498Szrj return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN; 196238fd1498Szrj } 196338fd1498Szrj 196438fd1498Szrj template <> 196538fd1498Szrj template <> 196638fd1498Szrj inline bool 196738fd1498Szrj is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs) 196838fd1498Szrj { 196938fd1498Szrj return gimple_has_ops (gs); 197038fd1498Szrj } 197138fd1498Szrj 197238fd1498Szrj template <> 197338fd1498Szrj template <> 197438fd1498Szrj inline bool 197538fd1498Szrj is_a_helper <gimple_statement_with_ops *>::test (gimple *gs) 197638fd1498Szrj { 197738fd1498Szrj return gimple_has_ops (gs); 197838fd1498Szrj } 197938fd1498Szrj 198038fd1498Szrj /* Return true if GIMPLE statement G has memory operands. */ 198138fd1498Szrj 198238fd1498Szrj static inline bool 198338fd1498Szrj gimple_has_mem_ops (const gimple *g) 198438fd1498Szrj { 198538fd1498Szrj return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN; 198638fd1498Szrj } 198738fd1498Szrj 198838fd1498Szrj template <> 198938fd1498Szrj template <> 199038fd1498Szrj inline bool 199138fd1498Szrj is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs) 199238fd1498Szrj { 199338fd1498Szrj return gimple_has_mem_ops (gs); 199438fd1498Szrj } 199538fd1498Szrj 199638fd1498Szrj template <> 199738fd1498Szrj template <> 199838fd1498Szrj inline bool 199938fd1498Szrj is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs) 200038fd1498Szrj { 200138fd1498Szrj return gimple_has_mem_ops (gs); 200238fd1498Szrj } 200338fd1498Szrj 200438fd1498Szrj /* Return the set of USE operands for statement G. */ 200538fd1498Szrj 200638fd1498Szrj static inline struct use_optype_d * 200738fd1498Szrj gimple_use_ops (const gimple *g) 200838fd1498Szrj { 200938fd1498Szrj const gimple_statement_with_ops *ops_stmt = 201038fd1498Szrj dyn_cast <const gimple_statement_with_ops *> (g); 201138fd1498Szrj if (!ops_stmt) 201238fd1498Szrj return NULL; 201338fd1498Szrj return ops_stmt->use_ops; 201438fd1498Szrj } 201538fd1498Szrj 201638fd1498Szrj 201738fd1498Szrj /* Set USE to be the set of USE operands for statement G. */ 201838fd1498Szrj 201938fd1498Szrj static inline void 202038fd1498Szrj gimple_set_use_ops (gimple *g, struct use_optype_d *use) 202138fd1498Szrj { 202238fd1498Szrj gimple_statement_with_ops *ops_stmt = 202338fd1498Szrj as_a <gimple_statement_with_ops *> (g); 202438fd1498Szrj ops_stmt->use_ops = use; 202538fd1498Szrj } 202638fd1498Szrj 202738fd1498Szrj 202838fd1498Szrj /* Return the single VUSE operand of the statement G. */ 202938fd1498Szrj 203038fd1498Szrj static inline tree 203138fd1498Szrj gimple_vuse (const gimple *g) 203238fd1498Szrj { 203338fd1498Szrj const gimple_statement_with_memory_ops *mem_ops_stmt = 203438fd1498Szrj dyn_cast <const gimple_statement_with_memory_ops *> (g); 203538fd1498Szrj if (!mem_ops_stmt) 203638fd1498Szrj return NULL_TREE; 203738fd1498Szrj return mem_ops_stmt->vuse; 203838fd1498Szrj } 203938fd1498Szrj 204038fd1498Szrj /* Return the single VDEF operand of the statement G. */ 204138fd1498Szrj 204238fd1498Szrj static inline tree 204338fd1498Szrj gimple_vdef (const gimple *g) 204438fd1498Szrj { 204538fd1498Szrj const gimple_statement_with_memory_ops *mem_ops_stmt = 204638fd1498Szrj dyn_cast <const gimple_statement_with_memory_ops *> (g); 204738fd1498Szrj if (!mem_ops_stmt) 204838fd1498Szrj return NULL_TREE; 204938fd1498Szrj return mem_ops_stmt->vdef; 205038fd1498Szrj } 205138fd1498Szrj 205238fd1498Szrj /* Return the single VUSE operand of the statement G. */ 205338fd1498Szrj 205438fd1498Szrj static inline tree * 205538fd1498Szrj gimple_vuse_ptr (gimple *g) 205638fd1498Szrj { 205738fd1498Szrj gimple_statement_with_memory_ops *mem_ops_stmt = 205838fd1498Szrj dyn_cast <gimple_statement_with_memory_ops *> (g); 205938fd1498Szrj if (!mem_ops_stmt) 206038fd1498Szrj return NULL; 206138fd1498Szrj return &mem_ops_stmt->vuse; 206238fd1498Szrj } 206338fd1498Szrj 206438fd1498Szrj /* Return the single VDEF operand of the statement G. */ 206538fd1498Szrj 206638fd1498Szrj static inline tree * 206738fd1498Szrj gimple_vdef_ptr (gimple *g) 206838fd1498Szrj { 206938fd1498Szrj gimple_statement_with_memory_ops *mem_ops_stmt = 207038fd1498Szrj dyn_cast <gimple_statement_with_memory_ops *> (g); 207138fd1498Szrj if (!mem_ops_stmt) 207238fd1498Szrj return NULL; 207338fd1498Szrj return &mem_ops_stmt->vdef; 207438fd1498Szrj } 207538fd1498Szrj 207638fd1498Szrj /* Set the single VUSE operand of the statement G. */ 207738fd1498Szrj 207838fd1498Szrj static inline void 207938fd1498Szrj gimple_set_vuse (gimple *g, tree vuse) 208038fd1498Szrj { 208138fd1498Szrj gimple_statement_with_memory_ops *mem_ops_stmt = 208238fd1498Szrj as_a <gimple_statement_with_memory_ops *> (g); 208338fd1498Szrj mem_ops_stmt->vuse = vuse; 208438fd1498Szrj } 208538fd1498Szrj 208638fd1498Szrj /* Set the single VDEF operand of the statement G. */ 208738fd1498Szrj 208838fd1498Szrj static inline void 208938fd1498Szrj gimple_set_vdef (gimple *g, tree vdef) 209038fd1498Szrj { 209138fd1498Szrj gimple_statement_with_memory_ops *mem_ops_stmt = 209238fd1498Szrj as_a <gimple_statement_with_memory_ops *> (g); 209338fd1498Szrj mem_ops_stmt->vdef = vdef; 209438fd1498Szrj } 209538fd1498Szrj 209638fd1498Szrj 209738fd1498Szrj /* Return true if statement G has operands and the modified field has 209838fd1498Szrj been set. */ 209938fd1498Szrj 210038fd1498Szrj static inline bool 210138fd1498Szrj gimple_modified_p (const gimple *g) 210238fd1498Szrj { 210338fd1498Szrj return (gimple_has_ops (g)) ? (bool) g->modified : false; 210438fd1498Szrj } 210538fd1498Szrj 210638fd1498Szrj 210738fd1498Szrj /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has 210838fd1498Szrj a MODIFIED field. */ 210938fd1498Szrj 211038fd1498Szrj static inline void 211138fd1498Szrj gimple_set_modified (gimple *s, bool modifiedp) 211238fd1498Szrj { 211338fd1498Szrj if (gimple_has_ops (s)) 211438fd1498Szrj s->modified = (unsigned) modifiedp; 211538fd1498Szrj } 211638fd1498Szrj 211738fd1498Szrj 211838fd1498Szrj /* Return the tree code for the expression computed by STMT. This is 211938fd1498Szrj only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For 212038fd1498Szrj GIMPLE_CALL, return CALL_EXPR as the expression code for 212138fd1498Szrj consistency. This is useful when the caller needs to deal with the 212238fd1498Szrj three kinds of computation that GIMPLE supports. */ 212338fd1498Szrj 212438fd1498Szrj static inline enum tree_code 212538fd1498Szrj gimple_expr_code (const gimple *stmt) 212638fd1498Szrj { 212738fd1498Szrj enum gimple_code code = gimple_code (stmt); 212838fd1498Szrj if (code == GIMPLE_ASSIGN || code == GIMPLE_COND) 212938fd1498Szrj return (enum tree_code) stmt->subcode; 213038fd1498Szrj else 213138fd1498Szrj { 213238fd1498Szrj gcc_gimple_checking_assert (code == GIMPLE_CALL); 213338fd1498Szrj return CALL_EXPR; 213438fd1498Szrj } 213538fd1498Szrj } 213638fd1498Szrj 213738fd1498Szrj 213838fd1498Szrj /* Return true if statement STMT contains volatile operands. */ 213938fd1498Szrj 214038fd1498Szrj static inline bool 214138fd1498Szrj gimple_has_volatile_ops (const gimple *stmt) 214238fd1498Szrj { 214338fd1498Szrj if (gimple_has_mem_ops (stmt)) 214438fd1498Szrj return stmt->has_volatile_ops; 214538fd1498Szrj else 214638fd1498Szrj return false; 214738fd1498Szrj } 214838fd1498Szrj 214938fd1498Szrj 215038fd1498Szrj /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */ 215138fd1498Szrj 215238fd1498Szrj static inline void 215338fd1498Szrj gimple_set_has_volatile_ops (gimple *stmt, bool volatilep) 215438fd1498Szrj { 215538fd1498Szrj if (gimple_has_mem_ops (stmt)) 215638fd1498Szrj stmt->has_volatile_ops = (unsigned) volatilep; 215738fd1498Szrj } 215838fd1498Szrj 215938fd1498Szrj /* Return true if STMT is in a transaction. */ 216038fd1498Szrj 216138fd1498Szrj static inline bool 216238fd1498Szrj gimple_in_transaction (const gimple *stmt) 216338fd1498Szrj { 216438fd1498Szrj return bb_in_transaction (gimple_bb (stmt)); 216538fd1498Szrj } 216638fd1498Szrj 216738fd1498Szrj /* Return true if statement STMT may access memory. */ 216838fd1498Szrj 216938fd1498Szrj static inline bool 217038fd1498Szrj gimple_references_memory_p (gimple *stmt) 217138fd1498Szrj { 217238fd1498Szrj return gimple_has_mem_ops (stmt) && gimple_vuse (stmt); 217338fd1498Szrj } 217438fd1498Szrj 217538fd1498Szrj 217638fd1498Szrj /* Return the subcode for OMP statement S. */ 217738fd1498Szrj 217838fd1498Szrj static inline unsigned 217938fd1498Szrj gimple_omp_subcode (const gimple *s) 218038fd1498Szrj { 218138fd1498Szrj gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD 218238fd1498Szrj && gimple_code (s) <= GIMPLE_OMP_TEAMS); 218338fd1498Szrj return s->subcode; 218438fd1498Szrj } 218538fd1498Szrj 218638fd1498Szrj /* Set the subcode for OMP statement S to SUBCODE. */ 218738fd1498Szrj 218838fd1498Szrj static inline void 218938fd1498Szrj gimple_omp_set_subcode (gimple *s, unsigned int subcode) 219038fd1498Szrj { 219138fd1498Szrj /* We only have 16 bits for the subcode. Assert that we are not 219238fd1498Szrj overflowing it. */ 219338fd1498Szrj gcc_gimple_checking_assert (subcode < (1 << 16)); 219438fd1498Szrj s->subcode = subcode; 219538fd1498Szrj } 219638fd1498Szrj 219738fd1498Szrj /* Set the nowait flag on OMP_RETURN statement S. */ 219838fd1498Szrj 219938fd1498Szrj static inline void 220038fd1498Szrj gimple_omp_return_set_nowait (gimple *s) 220138fd1498Szrj { 220238fd1498Szrj GIMPLE_CHECK (s, GIMPLE_OMP_RETURN); 220338fd1498Szrj s->subcode |= GF_OMP_RETURN_NOWAIT; 220438fd1498Szrj } 220538fd1498Szrj 220638fd1498Szrj 220738fd1498Szrj /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT 220838fd1498Szrj flag set. */ 220938fd1498Szrj 221038fd1498Szrj static inline bool 221138fd1498Szrj gimple_omp_return_nowait_p (const gimple *g) 221238fd1498Szrj { 221338fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_RETURN); 221438fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0; 221538fd1498Szrj } 221638fd1498Szrj 221738fd1498Szrj 221838fd1498Szrj /* Set the LHS of OMP return. */ 221938fd1498Szrj 222038fd1498Szrj static inline void 222138fd1498Szrj gimple_omp_return_set_lhs (gimple *g, tree lhs) 222238fd1498Szrj { 222338fd1498Szrj gimple_statement_omp_return *omp_return_stmt = 222438fd1498Szrj as_a <gimple_statement_omp_return *> (g); 222538fd1498Szrj omp_return_stmt->val = lhs; 222638fd1498Szrj } 222738fd1498Szrj 222838fd1498Szrj 222938fd1498Szrj /* Get the LHS of OMP return. */ 223038fd1498Szrj 223138fd1498Szrj static inline tree 223238fd1498Szrj gimple_omp_return_lhs (const gimple *g) 223338fd1498Szrj { 223438fd1498Szrj const gimple_statement_omp_return *omp_return_stmt = 223538fd1498Szrj as_a <const gimple_statement_omp_return *> (g); 223638fd1498Szrj return omp_return_stmt->val; 223738fd1498Szrj } 223838fd1498Szrj 223938fd1498Szrj 224038fd1498Szrj /* Return a pointer to the LHS of OMP return. */ 224138fd1498Szrj 224238fd1498Szrj static inline tree * 224338fd1498Szrj gimple_omp_return_lhs_ptr (gimple *g) 224438fd1498Szrj { 224538fd1498Szrj gimple_statement_omp_return *omp_return_stmt = 224638fd1498Szrj as_a <gimple_statement_omp_return *> (g); 224738fd1498Szrj return &omp_return_stmt->val; 224838fd1498Szrj } 224938fd1498Szrj 225038fd1498Szrj 225138fd1498Szrj /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST 225238fd1498Szrj flag set. */ 225338fd1498Szrj 225438fd1498Szrj static inline bool 225538fd1498Szrj gimple_omp_section_last_p (const gimple *g) 225638fd1498Szrj { 225738fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); 225838fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0; 225938fd1498Szrj } 226038fd1498Szrj 226138fd1498Szrj 226238fd1498Szrj /* Set the GF_OMP_SECTION_LAST flag on G. */ 226338fd1498Szrj 226438fd1498Szrj static inline void 226538fd1498Szrj gimple_omp_section_set_last (gimple *g) 226638fd1498Szrj { 226738fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); 226838fd1498Szrj g->subcode |= GF_OMP_SECTION_LAST; 226938fd1498Szrj } 227038fd1498Szrj 227138fd1498Szrj 227238fd1498Szrj /* Return true if OMP parallel statement G has the 227338fd1498Szrj GF_OMP_PARALLEL_COMBINED flag set. */ 227438fd1498Szrj 227538fd1498Szrj static inline bool 227638fd1498Szrj gimple_omp_parallel_combined_p (const gimple *g) 227738fd1498Szrj { 227838fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); 227938fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0; 228038fd1498Szrj } 228138fd1498Szrj 228238fd1498Szrj 228338fd1498Szrj /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean 228438fd1498Szrj value of COMBINED_P. */ 228538fd1498Szrj 228638fd1498Szrj static inline void 228738fd1498Szrj gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p) 228838fd1498Szrj { 228938fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); 229038fd1498Szrj if (combined_p) 229138fd1498Szrj g->subcode |= GF_OMP_PARALLEL_COMBINED; 229238fd1498Szrj else 229338fd1498Szrj g->subcode &= ~GF_OMP_PARALLEL_COMBINED; 229438fd1498Szrj } 229538fd1498Szrj 229638fd1498Szrj 229738fd1498Szrj /* Return true if OMP atomic load/store statement G has the 229838fd1498Szrj GF_OMP_ATOMIC_NEED_VALUE flag set. */ 229938fd1498Szrj 230038fd1498Szrj static inline bool 230138fd1498Szrj gimple_omp_atomic_need_value_p (const gimple *g) 230238fd1498Szrj { 230338fd1498Szrj if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) 230438fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); 230538fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0; 230638fd1498Szrj } 230738fd1498Szrj 230838fd1498Szrj 230938fd1498Szrj /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */ 231038fd1498Szrj 231138fd1498Szrj static inline void 231238fd1498Szrj gimple_omp_atomic_set_need_value (gimple *g) 231338fd1498Szrj { 231438fd1498Szrj if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) 231538fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); 231638fd1498Szrj g->subcode |= GF_OMP_ATOMIC_NEED_VALUE; 231738fd1498Szrj } 231838fd1498Szrj 231938fd1498Szrj 232038fd1498Szrj /* Return true if OMP atomic load/store statement G has the 232138fd1498Szrj GF_OMP_ATOMIC_SEQ_CST flag set. */ 232238fd1498Szrj 232338fd1498Szrj static inline bool 232438fd1498Szrj gimple_omp_atomic_seq_cst_p (const gimple *g) 232538fd1498Szrj { 232638fd1498Szrj if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) 232738fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); 232838fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0; 232938fd1498Szrj } 233038fd1498Szrj 233138fd1498Szrj 233238fd1498Szrj /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */ 233338fd1498Szrj 233438fd1498Szrj static inline void 233538fd1498Szrj gimple_omp_atomic_set_seq_cst (gimple *g) 233638fd1498Szrj { 233738fd1498Szrj if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) 233838fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); 233938fd1498Szrj g->subcode |= GF_OMP_ATOMIC_SEQ_CST; 234038fd1498Szrj } 234138fd1498Szrj 234238fd1498Szrj 234338fd1498Szrj /* Return the number of operands for statement GS. */ 234438fd1498Szrj 234538fd1498Szrj static inline unsigned 234638fd1498Szrj gimple_num_ops (const gimple *gs) 234738fd1498Szrj { 234838fd1498Szrj return gs->num_ops; 234938fd1498Szrj } 235038fd1498Szrj 235138fd1498Szrj 235238fd1498Szrj /* Set the number of operands for statement GS. */ 235338fd1498Szrj 235438fd1498Szrj static inline void 235538fd1498Szrj gimple_set_num_ops (gimple *gs, unsigned num_ops) 235638fd1498Szrj { 235738fd1498Szrj gs->num_ops = num_ops; 235838fd1498Szrj } 235938fd1498Szrj 236038fd1498Szrj 236138fd1498Szrj /* Return the array of operands for statement GS. */ 236238fd1498Szrj 236338fd1498Szrj static inline tree * 236438fd1498Szrj gimple_ops (gimple *gs) 236538fd1498Szrj { 236638fd1498Szrj size_t off; 236738fd1498Szrj 236838fd1498Szrj /* All the tuples have their operand vector at the very bottom 236938fd1498Szrj of the structure. Note that those structures that do not 237038fd1498Szrj have an operand vector have a zero offset. */ 237138fd1498Szrj off = gimple_ops_offset_[gimple_statement_structure (gs)]; 237238fd1498Szrj gcc_gimple_checking_assert (off != 0); 237338fd1498Szrj 237438fd1498Szrj return (tree *) ((char *) gs + off); 237538fd1498Szrj } 237638fd1498Szrj 237738fd1498Szrj 237838fd1498Szrj /* Return operand I for statement GS. */ 237938fd1498Szrj 238038fd1498Szrj static inline tree 238138fd1498Szrj gimple_op (const gimple *gs, unsigned i) 238238fd1498Szrj { 238338fd1498Szrj if (gimple_has_ops (gs)) 238438fd1498Szrj { 238538fd1498Szrj gcc_gimple_checking_assert (i < gimple_num_ops (gs)); 238638fd1498Szrj return gimple_ops (CONST_CAST_GIMPLE (gs))[i]; 238738fd1498Szrj } 238838fd1498Szrj else 238938fd1498Szrj return NULL_TREE; 239038fd1498Szrj } 239138fd1498Szrj 239238fd1498Szrj /* Return a pointer to operand I for statement GS. */ 239338fd1498Szrj 239438fd1498Szrj static inline tree * 239538fd1498Szrj gimple_op_ptr (gimple *gs, unsigned i) 239638fd1498Szrj { 239738fd1498Szrj if (gimple_has_ops (gs)) 239838fd1498Szrj { 239938fd1498Szrj gcc_gimple_checking_assert (i < gimple_num_ops (gs)); 240038fd1498Szrj return gimple_ops (gs) + i; 240138fd1498Szrj } 240238fd1498Szrj else 240338fd1498Szrj return NULL; 240438fd1498Szrj } 240538fd1498Szrj 240638fd1498Szrj /* Set operand I of statement GS to OP. */ 240738fd1498Szrj 240838fd1498Szrj static inline void 240938fd1498Szrj gimple_set_op (gimple *gs, unsigned i, tree op) 241038fd1498Szrj { 241138fd1498Szrj gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs)); 241238fd1498Szrj 241338fd1498Szrj /* Note. It may be tempting to assert that OP matches 241438fd1498Szrj is_gimple_operand, but that would be wrong. Different tuples 241538fd1498Szrj accept slightly different sets of tree operands. Each caller 241638fd1498Szrj should perform its own validation. */ 241738fd1498Szrj gimple_ops (gs)[i] = op; 241838fd1498Szrj } 241938fd1498Szrj 242038fd1498Szrj /* Return true if GS is a GIMPLE_ASSIGN. */ 242138fd1498Szrj 242238fd1498Szrj static inline bool 242338fd1498Szrj is_gimple_assign (const gimple *gs) 242438fd1498Szrj { 242538fd1498Szrj return gimple_code (gs) == GIMPLE_ASSIGN; 242638fd1498Szrj } 242738fd1498Szrj 242838fd1498Szrj /* Determine if expression CODE is one of the valid expressions that can 242938fd1498Szrj be used on the RHS of GIMPLE assignments. */ 243038fd1498Szrj 243138fd1498Szrj static inline enum gimple_rhs_class 243238fd1498Szrj get_gimple_rhs_class (enum tree_code code) 243338fd1498Szrj { 243438fd1498Szrj return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code]; 243538fd1498Szrj } 243638fd1498Szrj 243738fd1498Szrj /* Return the LHS of assignment statement GS. */ 243838fd1498Szrj 243938fd1498Szrj static inline tree 244038fd1498Szrj gimple_assign_lhs (const gassign *gs) 244138fd1498Szrj { 244238fd1498Szrj return gs->op[0]; 244338fd1498Szrj } 244438fd1498Szrj 244538fd1498Szrj static inline tree 244638fd1498Szrj gimple_assign_lhs (const gimple *gs) 244738fd1498Szrj { 244838fd1498Szrj const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); 244938fd1498Szrj return gimple_assign_lhs (ass); 245038fd1498Szrj } 245138fd1498Szrj 245238fd1498Szrj 245338fd1498Szrj /* Return a pointer to the LHS of assignment statement GS. */ 245438fd1498Szrj 245538fd1498Szrj static inline tree * 245638fd1498Szrj gimple_assign_lhs_ptr (gassign *gs) 245738fd1498Szrj { 245838fd1498Szrj return &gs->op[0]; 245938fd1498Szrj } 246038fd1498Szrj 246138fd1498Szrj static inline tree * 246238fd1498Szrj gimple_assign_lhs_ptr (gimple *gs) 246338fd1498Szrj { 246438fd1498Szrj gassign *ass = GIMPLE_CHECK2<gassign *> (gs); 246538fd1498Szrj return gimple_assign_lhs_ptr (ass); 246638fd1498Szrj } 246738fd1498Szrj 246838fd1498Szrj 246938fd1498Szrj /* Set LHS to be the LHS operand of assignment statement GS. */ 247038fd1498Szrj 247138fd1498Szrj static inline void 247238fd1498Szrj gimple_assign_set_lhs (gassign *gs, tree lhs) 247338fd1498Szrj { 247438fd1498Szrj gs->op[0] = lhs; 247538fd1498Szrj 247638fd1498Szrj if (lhs && TREE_CODE (lhs) == SSA_NAME) 247738fd1498Szrj SSA_NAME_DEF_STMT (lhs) = gs; 247838fd1498Szrj } 247938fd1498Szrj 248038fd1498Szrj static inline void 248138fd1498Szrj gimple_assign_set_lhs (gimple *gs, tree lhs) 248238fd1498Szrj { 248338fd1498Szrj gassign *ass = GIMPLE_CHECK2<gassign *> (gs); 248438fd1498Szrj gimple_assign_set_lhs (ass, lhs); 248538fd1498Szrj } 248638fd1498Szrj 248738fd1498Szrj 248838fd1498Szrj /* Return the first operand on the RHS of assignment statement GS. */ 248938fd1498Szrj 249038fd1498Szrj static inline tree 249138fd1498Szrj gimple_assign_rhs1 (const gassign *gs) 249238fd1498Szrj { 249338fd1498Szrj return gs->op[1]; 249438fd1498Szrj } 249538fd1498Szrj 249638fd1498Szrj static inline tree 249738fd1498Szrj gimple_assign_rhs1 (const gimple *gs) 249838fd1498Szrj { 249938fd1498Szrj const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); 250038fd1498Szrj return gimple_assign_rhs1 (ass); 250138fd1498Szrj } 250238fd1498Szrj 250338fd1498Szrj 250438fd1498Szrj /* Return a pointer to the first operand on the RHS of assignment 250538fd1498Szrj statement GS. */ 250638fd1498Szrj 250738fd1498Szrj static inline tree * 250838fd1498Szrj gimple_assign_rhs1_ptr (gassign *gs) 250938fd1498Szrj { 251038fd1498Szrj return &gs->op[1]; 251138fd1498Szrj } 251238fd1498Szrj 251338fd1498Szrj static inline tree * 251438fd1498Szrj gimple_assign_rhs1_ptr (gimple *gs) 251538fd1498Szrj { 251638fd1498Szrj gassign *ass = GIMPLE_CHECK2<gassign *> (gs); 251738fd1498Szrj return gimple_assign_rhs1_ptr (ass); 251838fd1498Szrj } 251938fd1498Szrj 252038fd1498Szrj /* Set RHS to be the first operand on the RHS of assignment statement GS. */ 252138fd1498Szrj 252238fd1498Szrj static inline void 252338fd1498Szrj gimple_assign_set_rhs1 (gassign *gs, tree rhs) 252438fd1498Szrj { 252538fd1498Szrj gs->op[1] = rhs; 252638fd1498Szrj } 252738fd1498Szrj 252838fd1498Szrj static inline void 252938fd1498Szrj gimple_assign_set_rhs1 (gimple *gs, tree rhs) 253038fd1498Szrj { 253138fd1498Szrj gassign *ass = GIMPLE_CHECK2<gassign *> (gs); 253238fd1498Szrj gimple_assign_set_rhs1 (ass, rhs); 253338fd1498Szrj } 253438fd1498Szrj 253538fd1498Szrj 253638fd1498Szrj /* Return the second operand on the RHS of assignment statement GS. 253738fd1498Szrj If GS does not have two operands, NULL is returned instead. */ 253838fd1498Szrj 253938fd1498Szrj static inline tree 254038fd1498Szrj gimple_assign_rhs2 (const gassign *gs) 254138fd1498Szrj { 254238fd1498Szrj if (gimple_num_ops (gs) >= 3) 254338fd1498Szrj return gs->op[2]; 254438fd1498Szrj else 254538fd1498Szrj return NULL_TREE; 254638fd1498Szrj } 254738fd1498Szrj 254838fd1498Szrj static inline tree 254938fd1498Szrj gimple_assign_rhs2 (const gimple *gs) 255038fd1498Szrj { 255138fd1498Szrj const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); 255238fd1498Szrj return gimple_assign_rhs2 (ass); 255338fd1498Szrj } 255438fd1498Szrj 255538fd1498Szrj 255638fd1498Szrj /* Return a pointer to the second operand on the RHS of assignment 255738fd1498Szrj statement GS. */ 255838fd1498Szrj 255938fd1498Szrj static inline tree * 256038fd1498Szrj gimple_assign_rhs2_ptr (gassign *gs) 256138fd1498Szrj { 256238fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3); 256338fd1498Szrj return &gs->op[2]; 256438fd1498Szrj } 256538fd1498Szrj 256638fd1498Szrj static inline tree * 256738fd1498Szrj gimple_assign_rhs2_ptr (gimple *gs) 256838fd1498Szrj { 256938fd1498Szrj gassign *ass = GIMPLE_CHECK2<gassign *> (gs); 257038fd1498Szrj return gimple_assign_rhs2_ptr (ass); 257138fd1498Szrj } 257238fd1498Szrj 257338fd1498Szrj 257438fd1498Szrj /* Set RHS to be the second operand on the RHS of assignment statement GS. */ 257538fd1498Szrj 257638fd1498Szrj static inline void 257738fd1498Szrj gimple_assign_set_rhs2 (gassign *gs, tree rhs) 257838fd1498Szrj { 257938fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3); 258038fd1498Szrj gs->op[2] = rhs; 258138fd1498Szrj } 258238fd1498Szrj 258338fd1498Szrj static inline void 258438fd1498Szrj gimple_assign_set_rhs2 (gimple *gs, tree rhs) 258538fd1498Szrj { 258638fd1498Szrj gassign *ass = GIMPLE_CHECK2<gassign *> (gs); 258738fd1498Szrj return gimple_assign_set_rhs2 (ass, rhs); 258838fd1498Szrj } 258938fd1498Szrj 259038fd1498Szrj /* Return the third operand on the RHS of assignment statement GS. 259138fd1498Szrj If GS does not have two operands, NULL is returned instead. */ 259238fd1498Szrj 259338fd1498Szrj static inline tree 259438fd1498Szrj gimple_assign_rhs3 (const gassign *gs) 259538fd1498Szrj { 259638fd1498Szrj if (gimple_num_ops (gs) >= 4) 259738fd1498Szrj return gs->op[3]; 259838fd1498Szrj else 259938fd1498Szrj return NULL_TREE; 260038fd1498Szrj } 260138fd1498Szrj 260238fd1498Szrj static inline tree 260338fd1498Szrj gimple_assign_rhs3 (const gimple *gs) 260438fd1498Szrj { 260538fd1498Szrj const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); 260638fd1498Szrj return gimple_assign_rhs3 (ass); 260738fd1498Szrj } 260838fd1498Szrj 260938fd1498Szrj /* Return a pointer to the third operand on the RHS of assignment 261038fd1498Szrj statement GS. */ 261138fd1498Szrj 261238fd1498Szrj static inline tree * 261338fd1498Szrj gimple_assign_rhs3_ptr (gimple *gs) 261438fd1498Szrj { 261538fd1498Szrj gassign *ass = GIMPLE_CHECK2<gassign *> (gs); 261638fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4); 261738fd1498Szrj return &ass->op[3]; 261838fd1498Szrj } 261938fd1498Szrj 262038fd1498Szrj 262138fd1498Szrj /* Set RHS to be the third operand on the RHS of assignment statement GS. */ 262238fd1498Szrj 262338fd1498Szrj static inline void 262438fd1498Szrj gimple_assign_set_rhs3 (gassign *gs, tree rhs) 262538fd1498Szrj { 262638fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4); 262738fd1498Szrj gs->op[3] = rhs; 262838fd1498Szrj } 262938fd1498Szrj 263038fd1498Szrj static inline void 263138fd1498Szrj gimple_assign_set_rhs3 (gimple *gs, tree rhs) 263238fd1498Szrj { 263338fd1498Szrj gassign *ass = GIMPLE_CHECK2<gassign *> (gs); 263438fd1498Szrj gimple_assign_set_rhs3 (ass, rhs); 263538fd1498Szrj } 263638fd1498Szrj 263738fd1498Szrj 263838fd1498Szrj /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers 263938fd1498Szrj which expect to see only two operands. */ 264038fd1498Szrj 264138fd1498Szrj static inline void 264238fd1498Szrj gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, 264338fd1498Szrj tree op1, tree op2) 264438fd1498Szrj { 264538fd1498Szrj gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL); 264638fd1498Szrj } 264738fd1498Szrj 264838fd1498Szrj /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers 264938fd1498Szrj which expect to see only one operands. */ 265038fd1498Szrj 265138fd1498Szrj static inline void 265238fd1498Szrj gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, 265338fd1498Szrj tree op1) 265438fd1498Szrj { 265538fd1498Szrj gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL); 265638fd1498Szrj } 265738fd1498Szrj 265838fd1498Szrj /* Returns true if GS is a nontemporal move. */ 265938fd1498Szrj 266038fd1498Szrj static inline bool 266138fd1498Szrj gimple_assign_nontemporal_move_p (const gassign *gs) 266238fd1498Szrj { 266338fd1498Szrj return gs->nontemporal_move; 266438fd1498Szrj } 266538fd1498Szrj 266638fd1498Szrj /* Sets nontemporal move flag of GS to NONTEMPORAL. */ 266738fd1498Szrj 266838fd1498Szrj static inline void 266938fd1498Szrj gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal) 267038fd1498Szrj { 267138fd1498Szrj GIMPLE_CHECK (gs, GIMPLE_ASSIGN); 267238fd1498Szrj gs->nontemporal_move = nontemporal; 267338fd1498Szrj } 267438fd1498Szrj 267538fd1498Szrj 267638fd1498Szrj /* Return the code of the expression computed on the rhs of assignment 267738fd1498Szrj statement GS. In case that the RHS is a single object, returns the 267838fd1498Szrj tree code of the object. */ 267938fd1498Szrj 268038fd1498Szrj static inline enum tree_code 268138fd1498Szrj gimple_assign_rhs_code (const gassign *gs) 268238fd1498Szrj { 268338fd1498Szrj enum tree_code code = (enum tree_code) gs->subcode; 268438fd1498Szrj /* While we initially set subcode to the TREE_CODE of the rhs for 268538fd1498Szrj GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay 268638fd1498Szrj in sync when we rewrite stmts into SSA form or do SSA propagations. */ 268738fd1498Szrj if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS) 268838fd1498Szrj code = TREE_CODE (gs->op[1]); 268938fd1498Szrj 269038fd1498Szrj return code; 269138fd1498Szrj } 269238fd1498Szrj 269338fd1498Szrj static inline enum tree_code 269438fd1498Szrj gimple_assign_rhs_code (const gimple *gs) 269538fd1498Szrj { 269638fd1498Szrj const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); 269738fd1498Szrj return gimple_assign_rhs_code (ass); 269838fd1498Szrj } 269938fd1498Szrj 270038fd1498Szrj 270138fd1498Szrj /* Set CODE to be the code for the expression computed on the RHS of 270238fd1498Szrj assignment S. */ 270338fd1498Szrj 270438fd1498Szrj static inline void 270538fd1498Szrj gimple_assign_set_rhs_code (gimple *s, enum tree_code code) 270638fd1498Szrj { 270738fd1498Szrj GIMPLE_CHECK (s, GIMPLE_ASSIGN); 270838fd1498Szrj s->subcode = code; 270938fd1498Szrj } 271038fd1498Szrj 271138fd1498Szrj 271238fd1498Szrj /* Return the gimple rhs class of the code of the expression computed on 271338fd1498Szrj the rhs of assignment statement GS. 271438fd1498Szrj This will never return GIMPLE_INVALID_RHS. */ 271538fd1498Szrj 271638fd1498Szrj static inline enum gimple_rhs_class 271738fd1498Szrj gimple_assign_rhs_class (const gimple *gs) 271838fd1498Szrj { 271938fd1498Szrj return get_gimple_rhs_class (gimple_assign_rhs_code (gs)); 272038fd1498Szrj } 272138fd1498Szrj 272238fd1498Szrj /* Return true if GS is an assignment with a singleton RHS, i.e., 272338fd1498Szrj there is no operator associated with the assignment itself. 272438fd1498Szrj Unlike gimple_assign_copy_p, this predicate returns true for 272538fd1498Szrj any RHS operand, including those that perform an operation 272638fd1498Szrj and do not have the semantics of a copy, such as COND_EXPR. */ 272738fd1498Szrj 272838fd1498Szrj static inline bool 272938fd1498Szrj gimple_assign_single_p (const gimple *gs) 273038fd1498Szrj { 273138fd1498Szrj return (is_gimple_assign (gs) 273238fd1498Szrj && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS); 273338fd1498Szrj } 273438fd1498Szrj 273538fd1498Szrj /* Return true if GS performs a store to its lhs. */ 273638fd1498Szrj 273738fd1498Szrj static inline bool 273838fd1498Szrj gimple_store_p (const gimple *gs) 273938fd1498Szrj { 274038fd1498Szrj tree lhs = gimple_get_lhs (gs); 274138fd1498Szrj return lhs && !is_gimple_reg (lhs); 274238fd1498Szrj } 274338fd1498Szrj 274438fd1498Szrj /* Return true if GS is an assignment that loads from its rhs1. */ 274538fd1498Szrj 274638fd1498Szrj static inline bool 274738fd1498Szrj gimple_assign_load_p (const gimple *gs) 274838fd1498Szrj { 274938fd1498Szrj tree rhs; 275038fd1498Szrj if (!gimple_assign_single_p (gs)) 275138fd1498Szrj return false; 275238fd1498Szrj rhs = gimple_assign_rhs1 (gs); 275338fd1498Szrj if (TREE_CODE (rhs) == WITH_SIZE_EXPR) 275438fd1498Szrj return true; 275538fd1498Szrj rhs = get_base_address (rhs); 275638fd1498Szrj return (DECL_P (rhs) 275738fd1498Szrj || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF); 275838fd1498Szrj } 275938fd1498Szrj 276038fd1498Szrj 276138fd1498Szrj /* Return true if S is a type-cast assignment. */ 276238fd1498Szrj 276338fd1498Szrj static inline bool 276438fd1498Szrj gimple_assign_cast_p (const gimple *s) 276538fd1498Szrj { 276638fd1498Szrj if (is_gimple_assign (s)) 276738fd1498Szrj { 276838fd1498Szrj enum tree_code sc = gimple_assign_rhs_code (s); 276938fd1498Szrj return CONVERT_EXPR_CODE_P (sc) 277038fd1498Szrj || sc == VIEW_CONVERT_EXPR 277138fd1498Szrj || sc == FIX_TRUNC_EXPR; 277238fd1498Szrj } 277338fd1498Szrj 277438fd1498Szrj return false; 277538fd1498Szrj } 277638fd1498Szrj 277738fd1498Szrj /* Return true if S is a clobber statement. */ 277838fd1498Szrj 277938fd1498Szrj static inline bool 278038fd1498Szrj gimple_clobber_p (const gimple *s) 278138fd1498Szrj { 278238fd1498Szrj return gimple_assign_single_p (s) 278338fd1498Szrj && TREE_CLOBBER_P (gimple_assign_rhs1 (s)); 278438fd1498Szrj } 278538fd1498Szrj 278638fd1498Szrj /* Return true if GS is a GIMPLE_CALL. */ 278738fd1498Szrj 278838fd1498Szrj static inline bool 278938fd1498Szrj is_gimple_call (const gimple *gs) 279038fd1498Szrj { 279138fd1498Szrj return gimple_code (gs) == GIMPLE_CALL; 279238fd1498Szrj } 279338fd1498Szrj 279438fd1498Szrj /* Return the LHS of call statement GS. */ 279538fd1498Szrj 279638fd1498Szrj static inline tree 279738fd1498Szrj gimple_call_lhs (const gcall *gs) 279838fd1498Szrj { 279938fd1498Szrj return gs->op[0]; 280038fd1498Szrj } 280138fd1498Szrj 280238fd1498Szrj static inline tree 280338fd1498Szrj gimple_call_lhs (const gimple *gs) 280438fd1498Szrj { 280538fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 280638fd1498Szrj return gimple_call_lhs (gc); 280738fd1498Szrj } 280838fd1498Szrj 280938fd1498Szrj 281038fd1498Szrj /* Return a pointer to the LHS of call statement GS. */ 281138fd1498Szrj 281238fd1498Szrj static inline tree * 281338fd1498Szrj gimple_call_lhs_ptr (gcall *gs) 281438fd1498Szrj { 281538fd1498Szrj return &gs->op[0]; 281638fd1498Szrj } 281738fd1498Szrj 281838fd1498Szrj static inline tree * 281938fd1498Szrj gimple_call_lhs_ptr (gimple *gs) 282038fd1498Szrj { 282138fd1498Szrj gcall *gc = GIMPLE_CHECK2<gcall *> (gs); 282238fd1498Szrj return gimple_call_lhs_ptr (gc); 282338fd1498Szrj } 282438fd1498Szrj 282538fd1498Szrj 282638fd1498Szrj /* Set LHS to be the LHS operand of call statement GS. */ 282738fd1498Szrj 282838fd1498Szrj static inline void 282938fd1498Szrj gimple_call_set_lhs (gcall *gs, tree lhs) 283038fd1498Szrj { 283138fd1498Szrj gs->op[0] = lhs; 283238fd1498Szrj if (lhs && TREE_CODE (lhs) == SSA_NAME) 283338fd1498Szrj SSA_NAME_DEF_STMT (lhs) = gs; 283438fd1498Szrj } 283538fd1498Szrj 283638fd1498Szrj static inline void 283738fd1498Szrj gimple_call_set_lhs (gimple *gs, tree lhs) 283838fd1498Szrj { 283938fd1498Szrj gcall *gc = GIMPLE_CHECK2<gcall *> (gs); 284038fd1498Szrj gimple_call_set_lhs (gc, lhs); 284138fd1498Szrj } 284238fd1498Szrj 284338fd1498Szrj 284438fd1498Szrj /* Return true if call GS calls an internal-only function, as enumerated 284538fd1498Szrj by internal_fn. */ 284638fd1498Szrj 284738fd1498Szrj static inline bool 284838fd1498Szrj gimple_call_internal_p (const gcall *gs) 284938fd1498Szrj { 285038fd1498Szrj return (gs->subcode & GF_CALL_INTERNAL) != 0; 285138fd1498Szrj } 285238fd1498Szrj 285338fd1498Szrj static inline bool 285438fd1498Szrj gimple_call_internal_p (const gimple *gs) 285538fd1498Szrj { 285638fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 285738fd1498Szrj return gimple_call_internal_p (gc); 285838fd1498Szrj } 285938fd1498Szrj 286038fd1498Szrj 286138fd1498Szrj /* Return true if call GS is marked as instrumented by 286238fd1498Szrj Pointer Bounds Checker. */ 286338fd1498Szrj 286438fd1498Szrj static inline bool 286538fd1498Szrj gimple_call_with_bounds_p (const gcall *gs) 286638fd1498Szrj { 286738fd1498Szrj return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0; 286838fd1498Szrj } 286938fd1498Szrj 287038fd1498Szrj static inline bool 287138fd1498Szrj gimple_call_with_bounds_p (const gimple *gs) 287238fd1498Szrj { 287338fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 287438fd1498Szrj return gimple_call_with_bounds_p (gc); 287538fd1498Szrj } 287638fd1498Szrj 287738fd1498Szrj 287838fd1498Szrj /* If INSTRUMENTED_P is true, marm statement GS as instrumented by 287938fd1498Szrj Pointer Bounds Checker. */ 288038fd1498Szrj 288138fd1498Szrj static inline void 288238fd1498Szrj gimple_call_set_with_bounds (gcall *gs, bool with_bounds) 288338fd1498Szrj { 288438fd1498Szrj if (with_bounds) 288538fd1498Szrj gs->subcode |= GF_CALL_WITH_BOUNDS; 288638fd1498Szrj else 288738fd1498Szrj gs->subcode &= ~GF_CALL_WITH_BOUNDS; 288838fd1498Szrj } 288938fd1498Szrj 289038fd1498Szrj static inline void 289138fd1498Szrj gimple_call_set_with_bounds (gimple *gs, bool with_bounds) 289238fd1498Szrj { 289338fd1498Szrj gcall *gc = GIMPLE_CHECK2<gcall *> (gs); 289438fd1498Szrj gimple_call_set_with_bounds (gc, with_bounds); 289538fd1498Szrj } 289638fd1498Szrj 289738fd1498Szrj 289838fd1498Szrj /* Return true if call GS is marked as nocf_check. */ 289938fd1498Szrj 290038fd1498Szrj static inline bool 290138fd1498Szrj gimple_call_nocf_check_p (const gcall *gs) 290238fd1498Szrj { 290338fd1498Szrj return (gs->subcode & GF_CALL_NOCF_CHECK) != 0; 290438fd1498Szrj } 290538fd1498Szrj 290638fd1498Szrj /* Mark statement GS as nocf_check call. */ 290738fd1498Szrj 290838fd1498Szrj static inline void 290938fd1498Szrj gimple_call_set_nocf_check (gcall *gs, bool nocf_check) 291038fd1498Szrj { 291138fd1498Szrj if (nocf_check) 291238fd1498Szrj gs->subcode |= GF_CALL_NOCF_CHECK; 291338fd1498Szrj else 291438fd1498Szrj gs->subcode &= ~GF_CALL_NOCF_CHECK; 291538fd1498Szrj } 291638fd1498Szrj 291738fd1498Szrj /* Return the target of internal call GS. */ 291838fd1498Szrj 291938fd1498Szrj static inline enum internal_fn 292038fd1498Szrj gimple_call_internal_fn (const gcall *gs) 292138fd1498Szrj { 292238fd1498Szrj gcc_gimple_checking_assert (gimple_call_internal_p (gs)); 292338fd1498Szrj return gs->u.internal_fn; 292438fd1498Szrj } 292538fd1498Szrj 292638fd1498Szrj static inline enum internal_fn 292738fd1498Szrj gimple_call_internal_fn (const gimple *gs) 292838fd1498Szrj { 292938fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 293038fd1498Szrj return gimple_call_internal_fn (gc); 293138fd1498Szrj } 293238fd1498Szrj 293338fd1498Szrj /* Return true, if this internal gimple call is unique. */ 293438fd1498Szrj 293538fd1498Szrj static inline bool 293638fd1498Szrj gimple_call_internal_unique_p (const gcall *gs) 293738fd1498Szrj { 293838fd1498Szrj return gimple_call_internal_fn (gs) == IFN_UNIQUE; 293938fd1498Szrj } 294038fd1498Szrj 294138fd1498Szrj static inline bool 294238fd1498Szrj gimple_call_internal_unique_p (const gimple *gs) 294338fd1498Szrj { 294438fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 294538fd1498Szrj return gimple_call_internal_unique_p (gc); 294638fd1498Szrj } 294738fd1498Szrj 294838fd1498Szrj /* Return true if GS is an internal function FN. */ 294938fd1498Szrj 295038fd1498Szrj static inline bool 295138fd1498Szrj gimple_call_internal_p (const gimple *gs, internal_fn fn) 295238fd1498Szrj { 295338fd1498Szrj return (is_gimple_call (gs) 295438fd1498Szrj && gimple_call_internal_p (gs) 295538fd1498Szrj && gimple_call_internal_fn (gs) == fn); 295638fd1498Szrj } 295738fd1498Szrj 295838fd1498Szrj /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt 295938fd1498Szrj that could alter control flow. */ 296038fd1498Szrj 296138fd1498Szrj static inline void 296238fd1498Szrj gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p) 296338fd1498Szrj { 296438fd1498Szrj if (ctrl_altering_p) 296538fd1498Szrj s->subcode |= GF_CALL_CTRL_ALTERING; 296638fd1498Szrj else 296738fd1498Szrj s->subcode &= ~GF_CALL_CTRL_ALTERING; 296838fd1498Szrj } 296938fd1498Szrj 297038fd1498Szrj static inline void 297138fd1498Szrj gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p) 297238fd1498Szrj { 297338fd1498Szrj gcall *gc = GIMPLE_CHECK2<gcall *> (s); 297438fd1498Szrj gimple_call_set_ctrl_altering (gc, ctrl_altering_p); 297538fd1498Szrj } 297638fd1498Szrj 297738fd1498Szrj /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING 297838fd1498Szrj flag is set. Such call could not be a stmt in the middle of a bb. */ 297938fd1498Szrj 298038fd1498Szrj static inline bool 298138fd1498Szrj gimple_call_ctrl_altering_p (const gcall *gs) 298238fd1498Szrj { 298338fd1498Szrj return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0; 298438fd1498Szrj } 298538fd1498Szrj 298638fd1498Szrj static inline bool 298738fd1498Szrj gimple_call_ctrl_altering_p (const gimple *gs) 298838fd1498Szrj { 298938fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 299038fd1498Szrj return gimple_call_ctrl_altering_p (gc); 299138fd1498Szrj } 299238fd1498Szrj 299338fd1498Szrj 299438fd1498Szrj /* Return the function type of the function called by GS. */ 299538fd1498Szrj 299638fd1498Szrj static inline tree 299738fd1498Szrj gimple_call_fntype (const gcall *gs) 299838fd1498Szrj { 299938fd1498Szrj if (gimple_call_internal_p (gs)) 300038fd1498Szrj return NULL_TREE; 300138fd1498Szrj return gs->u.fntype; 300238fd1498Szrj } 300338fd1498Szrj 300438fd1498Szrj static inline tree 300538fd1498Szrj gimple_call_fntype (const gimple *gs) 300638fd1498Szrj { 300738fd1498Szrj const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs); 300838fd1498Szrj return gimple_call_fntype (call_stmt); 300938fd1498Szrj } 301038fd1498Szrj 301138fd1498Szrj /* Set the type of the function called by CALL_STMT to FNTYPE. */ 301238fd1498Szrj 301338fd1498Szrj static inline void 301438fd1498Szrj gimple_call_set_fntype (gcall *call_stmt, tree fntype) 301538fd1498Szrj { 301638fd1498Szrj gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt)); 301738fd1498Szrj call_stmt->u.fntype = fntype; 301838fd1498Szrj } 301938fd1498Szrj 302038fd1498Szrj 302138fd1498Szrj /* Return the tree node representing the function called by call 302238fd1498Szrj statement GS. */ 302338fd1498Szrj 302438fd1498Szrj static inline tree 302538fd1498Szrj gimple_call_fn (const gcall *gs) 302638fd1498Szrj { 302738fd1498Szrj return gs->op[1]; 302838fd1498Szrj } 302938fd1498Szrj 303038fd1498Szrj static inline tree 303138fd1498Szrj gimple_call_fn (const gimple *gs) 303238fd1498Szrj { 303338fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 303438fd1498Szrj return gimple_call_fn (gc); 303538fd1498Szrj } 303638fd1498Szrj 303738fd1498Szrj /* Return a pointer to the tree node representing the function called by call 303838fd1498Szrj statement GS. */ 303938fd1498Szrj 304038fd1498Szrj static inline tree * 304138fd1498Szrj gimple_call_fn_ptr (gcall *gs) 304238fd1498Szrj { 304338fd1498Szrj return &gs->op[1]; 304438fd1498Szrj } 304538fd1498Szrj 304638fd1498Szrj static inline tree * 304738fd1498Szrj gimple_call_fn_ptr (gimple *gs) 304838fd1498Szrj { 304938fd1498Szrj gcall *gc = GIMPLE_CHECK2<gcall *> (gs); 305038fd1498Szrj return gimple_call_fn_ptr (gc); 305138fd1498Szrj } 305238fd1498Szrj 305338fd1498Szrj 305438fd1498Szrj /* Set FN to be the function called by call statement GS. */ 305538fd1498Szrj 305638fd1498Szrj static inline void 305738fd1498Szrj gimple_call_set_fn (gcall *gs, tree fn) 305838fd1498Szrj { 305938fd1498Szrj gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); 306038fd1498Szrj gs->op[1] = fn; 306138fd1498Szrj } 306238fd1498Szrj 306338fd1498Szrj 306438fd1498Szrj /* Set FNDECL to be the function called by call statement GS. */ 306538fd1498Szrj 306638fd1498Szrj static inline void 306738fd1498Szrj gimple_call_set_fndecl (gcall *gs, tree decl) 306838fd1498Szrj { 306938fd1498Szrj gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); 307038fd1498Szrj gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR, 307138fd1498Szrj build_pointer_type (TREE_TYPE (decl)), decl); 307238fd1498Szrj } 307338fd1498Szrj 307438fd1498Szrj static inline void 307538fd1498Szrj gimple_call_set_fndecl (gimple *gs, tree decl) 307638fd1498Szrj { 307738fd1498Szrj gcall *gc = GIMPLE_CHECK2<gcall *> (gs); 307838fd1498Szrj gimple_call_set_fndecl (gc, decl); 307938fd1498Szrj } 308038fd1498Szrj 308138fd1498Szrj 308238fd1498Szrj /* Set internal function FN to be the function called by call statement CALL_STMT. */ 308338fd1498Szrj 308438fd1498Szrj static inline void 308538fd1498Szrj gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn) 308638fd1498Szrj { 308738fd1498Szrj gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt)); 308838fd1498Szrj call_stmt->u.internal_fn = fn; 308938fd1498Szrj } 309038fd1498Szrj 309138fd1498Szrj 309238fd1498Szrj /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it. 309338fd1498Szrj Otherwise return NULL. This function is analogous to 309438fd1498Szrj get_callee_fndecl in tree land. */ 309538fd1498Szrj 309638fd1498Szrj static inline tree 309738fd1498Szrj gimple_call_fndecl (const gcall *gs) 309838fd1498Szrj { 309938fd1498Szrj return gimple_call_addr_fndecl (gimple_call_fn (gs)); 310038fd1498Szrj } 310138fd1498Szrj 310238fd1498Szrj static inline tree 310338fd1498Szrj gimple_call_fndecl (const gimple *gs) 310438fd1498Szrj { 310538fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 310638fd1498Szrj return gimple_call_fndecl (gc); 310738fd1498Szrj } 310838fd1498Szrj 310938fd1498Szrj 311038fd1498Szrj /* Return the type returned by call statement GS. */ 311138fd1498Szrj 311238fd1498Szrj static inline tree 311338fd1498Szrj gimple_call_return_type (const gcall *gs) 311438fd1498Szrj { 311538fd1498Szrj tree type = gimple_call_fntype (gs); 311638fd1498Szrj 311738fd1498Szrj if (type == NULL_TREE) 311838fd1498Szrj return TREE_TYPE (gimple_call_lhs (gs)); 311938fd1498Szrj 312038fd1498Szrj /* The type returned by a function is the type of its 312138fd1498Szrj function type. */ 312238fd1498Szrj return TREE_TYPE (type); 312338fd1498Szrj } 312438fd1498Szrj 312538fd1498Szrj 312638fd1498Szrj /* Return the static chain for call statement GS. */ 312738fd1498Szrj 312838fd1498Szrj static inline tree 312938fd1498Szrj gimple_call_chain (const gcall *gs) 313038fd1498Szrj { 313138fd1498Szrj return gs->op[2]; 313238fd1498Szrj } 313338fd1498Szrj 313438fd1498Szrj static inline tree 313538fd1498Szrj gimple_call_chain (const gimple *gs) 313638fd1498Szrj { 313738fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 313838fd1498Szrj return gimple_call_chain (gc); 313938fd1498Szrj } 314038fd1498Szrj 314138fd1498Szrj 314238fd1498Szrj /* Return a pointer to the static chain for call statement CALL_STMT. */ 314338fd1498Szrj 314438fd1498Szrj static inline tree * 314538fd1498Szrj gimple_call_chain_ptr (gcall *call_stmt) 314638fd1498Szrj { 314738fd1498Szrj return &call_stmt->op[2]; 314838fd1498Szrj } 314938fd1498Szrj 315038fd1498Szrj /* Set CHAIN to be the static chain for call statement CALL_STMT. */ 315138fd1498Szrj 315238fd1498Szrj static inline void 315338fd1498Szrj gimple_call_set_chain (gcall *call_stmt, tree chain) 315438fd1498Szrj { 315538fd1498Szrj call_stmt->op[2] = chain; 315638fd1498Szrj } 315738fd1498Szrj 315838fd1498Szrj 315938fd1498Szrj /* Return the number of arguments used by call statement GS. */ 316038fd1498Szrj 316138fd1498Szrj static inline unsigned 316238fd1498Szrj gimple_call_num_args (const gcall *gs) 316338fd1498Szrj { 316438fd1498Szrj return gimple_num_ops (gs) - 3; 316538fd1498Szrj } 316638fd1498Szrj 316738fd1498Szrj static inline unsigned 316838fd1498Szrj gimple_call_num_args (const gimple *gs) 316938fd1498Szrj { 317038fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 317138fd1498Szrj return gimple_call_num_args (gc); 317238fd1498Szrj } 317338fd1498Szrj 317438fd1498Szrj 317538fd1498Szrj /* Return the argument at position INDEX for call statement GS. */ 317638fd1498Szrj 317738fd1498Szrj static inline tree 317838fd1498Szrj gimple_call_arg (const gcall *gs, unsigned index) 317938fd1498Szrj { 318038fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); 318138fd1498Szrj return gs->op[index + 3]; 318238fd1498Szrj } 318338fd1498Szrj 318438fd1498Szrj static inline tree 318538fd1498Szrj gimple_call_arg (const gimple *gs, unsigned index) 318638fd1498Szrj { 318738fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 318838fd1498Szrj return gimple_call_arg (gc, index); 318938fd1498Szrj } 319038fd1498Szrj 319138fd1498Szrj 319238fd1498Szrj /* Return a pointer to the argument at position INDEX for call 319338fd1498Szrj statement GS. */ 319438fd1498Szrj 319538fd1498Szrj static inline tree * 319638fd1498Szrj gimple_call_arg_ptr (gcall *gs, unsigned index) 319738fd1498Szrj { 319838fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); 319938fd1498Szrj return &gs->op[index + 3]; 320038fd1498Szrj } 320138fd1498Szrj 320238fd1498Szrj static inline tree * 320338fd1498Szrj gimple_call_arg_ptr (gimple *gs, unsigned index) 320438fd1498Szrj { 320538fd1498Szrj gcall *gc = GIMPLE_CHECK2<gcall *> (gs); 320638fd1498Szrj return gimple_call_arg_ptr (gc, index); 320738fd1498Szrj } 320838fd1498Szrj 320938fd1498Szrj 321038fd1498Szrj /* Set ARG to be the argument at position INDEX for call statement GS. */ 321138fd1498Szrj 321238fd1498Szrj static inline void 321338fd1498Szrj gimple_call_set_arg (gcall *gs, unsigned index, tree arg) 321438fd1498Szrj { 321538fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); 321638fd1498Szrj gs->op[index + 3] = arg; 321738fd1498Szrj } 321838fd1498Szrj 321938fd1498Szrj static inline void 322038fd1498Szrj gimple_call_set_arg (gimple *gs, unsigned index, tree arg) 322138fd1498Szrj { 322238fd1498Szrj gcall *gc = GIMPLE_CHECK2<gcall *> (gs); 322338fd1498Szrj gimple_call_set_arg (gc, index, arg); 322438fd1498Szrj } 322538fd1498Szrj 322638fd1498Szrj 322738fd1498Szrj /* If TAIL_P is true, mark call statement S as being a tail call 322838fd1498Szrj (i.e., a call just before the exit of a function). These calls are 322938fd1498Szrj candidate for tail call optimization. */ 323038fd1498Szrj 323138fd1498Szrj static inline void 323238fd1498Szrj gimple_call_set_tail (gcall *s, bool tail_p) 323338fd1498Szrj { 323438fd1498Szrj if (tail_p) 323538fd1498Szrj s->subcode |= GF_CALL_TAILCALL; 323638fd1498Szrj else 323738fd1498Szrj s->subcode &= ~GF_CALL_TAILCALL; 323838fd1498Szrj } 323938fd1498Szrj 324038fd1498Szrj 324138fd1498Szrj /* Return true if GIMPLE_CALL S is marked as a tail call. */ 324238fd1498Szrj 324338fd1498Szrj static inline bool 324438fd1498Szrj gimple_call_tail_p (gcall *s) 324538fd1498Szrj { 324638fd1498Szrj return (s->subcode & GF_CALL_TAILCALL) != 0; 324738fd1498Szrj } 324838fd1498Szrj 324938fd1498Szrj /* Mark (or clear) call statement S as requiring tail call optimization. */ 325038fd1498Szrj 325138fd1498Szrj static inline void 325238fd1498Szrj gimple_call_set_must_tail (gcall *s, bool must_tail_p) 325338fd1498Szrj { 325438fd1498Szrj if (must_tail_p) 325538fd1498Szrj s->subcode |= GF_CALL_MUST_TAIL_CALL; 325638fd1498Szrj else 325738fd1498Szrj s->subcode &= ~GF_CALL_MUST_TAIL_CALL; 325838fd1498Szrj } 325938fd1498Szrj 326038fd1498Szrj /* Return true if call statement has been marked as requiring 326138fd1498Szrj tail call optimization. */ 326238fd1498Szrj 326338fd1498Szrj static inline bool 326438fd1498Szrj gimple_call_must_tail_p (const gcall *s) 326538fd1498Szrj { 326638fd1498Szrj return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0; 326738fd1498Szrj } 326838fd1498Szrj 326938fd1498Szrj /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return 327038fd1498Szrj slot optimization. This transformation uses the target of the call 327138fd1498Szrj expansion as the return slot for calls that return in memory. */ 327238fd1498Szrj 327338fd1498Szrj static inline void 327438fd1498Szrj gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p) 327538fd1498Szrj { 327638fd1498Szrj if (return_slot_opt_p) 327738fd1498Szrj s->subcode |= GF_CALL_RETURN_SLOT_OPT; 327838fd1498Szrj else 327938fd1498Szrj s->subcode &= ~GF_CALL_RETURN_SLOT_OPT; 328038fd1498Szrj } 328138fd1498Szrj 328238fd1498Szrj 328338fd1498Szrj /* Return true if S is marked for return slot optimization. */ 328438fd1498Szrj 328538fd1498Szrj static inline bool 328638fd1498Szrj gimple_call_return_slot_opt_p (gcall *s) 328738fd1498Szrj { 328838fd1498Szrj return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0; 328938fd1498Szrj } 329038fd1498Szrj 329138fd1498Szrj 329238fd1498Szrj /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a 329338fd1498Szrj thunk to the thunked-to function. */ 329438fd1498Szrj 329538fd1498Szrj static inline void 329638fd1498Szrj gimple_call_set_from_thunk (gcall *s, bool from_thunk_p) 329738fd1498Szrj { 329838fd1498Szrj if (from_thunk_p) 329938fd1498Szrj s->subcode |= GF_CALL_FROM_THUNK; 330038fd1498Szrj else 330138fd1498Szrj s->subcode &= ~GF_CALL_FROM_THUNK; 330238fd1498Szrj } 330338fd1498Szrj 330438fd1498Szrj 330538fd1498Szrj /* Return true if GIMPLE_CALL S is a jump from a thunk. */ 330638fd1498Szrj 330738fd1498Szrj static inline bool 330838fd1498Szrj gimple_call_from_thunk_p (gcall *s) 330938fd1498Szrj { 331038fd1498Szrj return (s->subcode & GF_CALL_FROM_THUNK) != 0; 331138fd1498Szrj } 331238fd1498Szrj 331338fd1498Szrj 331438fd1498Szrj /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the 331538fd1498Szrj argument pack in its argument list. */ 331638fd1498Szrj 331738fd1498Szrj static inline void 331838fd1498Szrj gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p) 331938fd1498Szrj { 332038fd1498Szrj if (pass_arg_pack_p) 332138fd1498Szrj s->subcode |= GF_CALL_VA_ARG_PACK; 332238fd1498Szrj else 332338fd1498Szrj s->subcode &= ~GF_CALL_VA_ARG_PACK; 332438fd1498Szrj } 332538fd1498Szrj 332638fd1498Szrj 332738fd1498Szrj /* Return true if GIMPLE_CALL S is a stdarg call that needs the 332838fd1498Szrj argument pack in its argument list. */ 332938fd1498Szrj 333038fd1498Szrj static inline bool 333138fd1498Szrj gimple_call_va_arg_pack_p (gcall *s) 333238fd1498Szrj { 333338fd1498Szrj return (s->subcode & GF_CALL_VA_ARG_PACK) != 0; 333438fd1498Szrj } 333538fd1498Szrj 333638fd1498Szrj 333738fd1498Szrj /* Return true if S is a noreturn call. */ 333838fd1498Szrj 333938fd1498Szrj static inline bool 334038fd1498Szrj gimple_call_noreturn_p (const gcall *s) 334138fd1498Szrj { 334238fd1498Szrj return (gimple_call_flags (s) & ECF_NORETURN) != 0; 334338fd1498Szrj } 334438fd1498Szrj 334538fd1498Szrj static inline bool 334638fd1498Szrj gimple_call_noreturn_p (const gimple *s) 334738fd1498Szrj { 334838fd1498Szrj const gcall *gc = GIMPLE_CHECK2<const gcall *> (s); 334938fd1498Szrj return gimple_call_noreturn_p (gc); 335038fd1498Szrj } 335138fd1498Szrj 335238fd1498Szrj 335338fd1498Szrj /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw 335438fd1498Szrj even if the called function can throw in other cases. */ 335538fd1498Szrj 335638fd1498Szrj static inline void 335738fd1498Szrj gimple_call_set_nothrow (gcall *s, bool nothrow_p) 335838fd1498Szrj { 335938fd1498Szrj if (nothrow_p) 336038fd1498Szrj s->subcode |= GF_CALL_NOTHROW; 336138fd1498Szrj else 336238fd1498Szrj s->subcode &= ~GF_CALL_NOTHROW; 336338fd1498Szrj } 336438fd1498Szrj 336538fd1498Szrj /* Return true if S is a nothrow call. */ 336638fd1498Szrj 336738fd1498Szrj static inline bool 336838fd1498Szrj gimple_call_nothrow_p (gcall *s) 336938fd1498Szrj { 337038fd1498Szrj return (gimple_call_flags (s) & ECF_NOTHROW) != 0; 337138fd1498Szrj } 337238fd1498Szrj 337338fd1498Szrj /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that 337438fd1498Szrj is known to be emitted for VLA objects. Those are wrapped by 337538fd1498Szrj stack_save/stack_restore calls and hence can't lead to unbounded 337638fd1498Szrj stack growth even when they occur in loops. */ 337738fd1498Szrj 337838fd1498Szrj static inline void 337938fd1498Szrj gimple_call_set_alloca_for_var (gcall *s, bool for_var) 338038fd1498Szrj { 338138fd1498Szrj if (for_var) 338238fd1498Szrj s->subcode |= GF_CALL_ALLOCA_FOR_VAR; 338338fd1498Szrj else 338438fd1498Szrj s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR; 338538fd1498Szrj } 338638fd1498Szrj 338738fd1498Szrj /* Return true of S is a call to builtin_alloca emitted for VLA objects. */ 338838fd1498Szrj 338938fd1498Szrj static inline bool 339038fd1498Szrj gimple_call_alloca_for_var_p (gcall *s) 339138fd1498Szrj { 339238fd1498Szrj return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0; 339338fd1498Szrj } 339438fd1498Szrj 339538fd1498Szrj /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which 339638fd1498Szrj pointers to nested function are descriptors instead of trampolines. */ 339738fd1498Szrj 339838fd1498Szrj static inline void 339938fd1498Szrj gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p) 340038fd1498Szrj { 340138fd1498Szrj if (by_descriptor_p) 340238fd1498Szrj s->subcode |= GF_CALL_BY_DESCRIPTOR; 340338fd1498Szrj else 340438fd1498Szrj s->subcode &= ~GF_CALL_BY_DESCRIPTOR; 340538fd1498Szrj } 340638fd1498Szrj 340738fd1498Szrj /* Return true if S is a by-descriptor call. */ 340838fd1498Szrj 340938fd1498Szrj static inline bool 341038fd1498Szrj gimple_call_by_descriptor_p (gcall *s) 341138fd1498Szrj { 341238fd1498Szrj return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0; 341338fd1498Szrj } 341438fd1498Szrj 341538fd1498Szrj /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */ 341638fd1498Szrj 341738fd1498Szrj static inline void 341838fd1498Szrj gimple_call_copy_flags (gcall *dest_call, gcall *orig_call) 341938fd1498Szrj { 342038fd1498Szrj dest_call->subcode = orig_call->subcode; 342138fd1498Szrj } 342238fd1498Szrj 342338fd1498Szrj 342438fd1498Szrj /* Return a pointer to the points-to solution for the set of call-used 342538fd1498Szrj variables of the call CALL_STMT. */ 342638fd1498Szrj 342738fd1498Szrj static inline struct pt_solution * 342838fd1498Szrj gimple_call_use_set (gcall *call_stmt) 342938fd1498Szrj { 343038fd1498Szrj return &call_stmt->call_used; 343138fd1498Szrj } 343238fd1498Szrj 343338fd1498Szrj 343438fd1498Szrj /* Return a pointer to the points-to solution for the set of call-used 343538fd1498Szrj variables of the call CALL_STMT. */ 343638fd1498Szrj 343738fd1498Szrj static inline struct pt_solution * 343838fd1498Szrj gimple_call_clobber_set (gcall *call_stmt) 343938fd1498Szrj { 344038fd1498Szrj return &call_stmt->call_clobbered; 344138fd1498Szrj } 344238fd1498Szrj 344338fd1498Szrj 344438fd1498Szrj /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a 344538fd1498Szrj non-NULL lhs. */ 344638fd1498Szrj 344738fd1498Szrj static inline bool 344838fd1498Szrj gimple_has_lhs (gimple *stmt) 344938fd1498Szrj { 345038fd1498Szrj if (is_gimple_assign (stmt)) 345138fd1498Szrj return true; 345238fd1498Szrj if (gcall *call = dyn_cast <gcall *> (stmt)) 345338fd1498Szrj return gimple_call_lhs (call) != NULL_TREE; 345438fd1498Szrj return false; 345538fd1498Szrj } 345638fd1498Szrj 345738fd1498Szrj 345838fd1498Szrj /* Return the code of the predicate computed by conditional statement GS. */ 345938fd1498Szrj 346038fd1498Szrj static inline enum tree_code 346138fd1498Szrj gimple_cond_code (const gcond *gs) 346238fd1498Szrj { 346338fd1498Szrj return (enum tree_code) gs->subcode; 346438fd1498Szrj } 346538fd1498Szrj 346638fd1498Szrj static inline enum tree_code 346738fd1498Szrj gimple_cond_code (const gimple *gs) 346838fd1498Szrj { 346938fd1498Szrj const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs); 347038fd1498Szrj return gimple_cond_code (gc); 347138fd1498Szrj } 347238fd1498Szrj 347338fd1498Szrj 347438fd1498Szrj /* Set CODE to be the predicate code for the conditional statement GS. */ 347538fd1498Szrj 347638fd1498Szrj static inline void 347738fd1498Szrj gimple_cond_set_code (gcond *gs, enum tree_code code) 347838fd1498Szrj { 347938fd1498Szrj gs->subcode = code; 348038fd1498Szrj } 348138fd1498Szrj 348238fd1498Szrj 348338fd1498Szrj /* Return the LHS of the predicate computed by conditional statement GS. */ 348438fd1498Szrj 348538fd1498Szrj static inline tree 348638fd1498Szrj gimple_cond_lhs (const gcond *gs) 348738fd1498Szrj { 348838fd1498Szrj return gs->op[0]; 348938fd1498Szrj } 349038fd1498Szrj 349138fd1498Szrj static inline tree 349238fd1498Szrj gimple_cond_lhs (const gimple *gs) 349338fd1498Szrj { 349438fd1498Szrj const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs); 349538fd1498Szrj return gimple_cond_lhs (gc); 349638fd1498Szrj } 349738fd1498Szrj 349838fd1498Szrj /* Return the pointer to the LHS of the predicate computed by conditional 349938fd1498Szrj statement GS. */ 350038fd1498Szrj 350138fd1498Szrj static inline tree * 350238fd1498Szrj gimple_cond_lhs_ptr (gcond *gs) 350338fd1498Szrj { 350438fd1498Szrj return &gs->op[0]; 350538fd1498Szrj } 350638fd1498Szrj 350738fd1498Szrj /* Set LHS to be the LHS operand of the predicate computed by 350838fd1498Szrj conditional statement GS. */ 350938fd1498Szrj 351038fd1498Szrj static inline void 351138fd1498Szrj gimple_cond_set_lhs (gcond *gs, tree lhs) 351238fd1498Szrj { 351338fd1498Szrj gs->op[0] = lhs; 351438fd1498Szrj } 351538fd1498Szrj 351638fd1498Szrj 351738fd1498Szrj /* Return the RHS operand of the predicate computed by conditional GS. */ 351838fd1498Szrj 351938fd1498Szrj static inline tree 352038fd1498Szrj gimple_cond_rhs (const gcond *gs) 352138fd1498Szrj { 352238fd1498Szrj return gs->op[1]; 352338fd1498Szrj } 352438fd1498Szrj 352538fd1498Szrj static inline tree 352638fd1498Szrj gimple_cond_rhs (const gimple *gs) 352738fd1498Szrj { 352838fd1498Szrj const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs); 352938fd1498Szrj return gimple_cond_rhs (gc); 353038fd1498Szrj } 353138fd1498Szrj 353238fd1498Szrj /* Return the pointer to the RHS operand of the predicate computed by 353338fd1498Szrj conditional GS. */ 353438fd1498Szrj 353538fd1498Szrj static inline tree * 353638fd1498Szrj gimple_cond_rhs_ptr (gcond *gs) 353738fd1498Szrj { 353838fd1498Szrj return &gs->op[1]; 353938fd1498Szrj } 354038fd1498Szrj 354138fd1498Szrj 354238fd1498Szrj /* Set RHS to be the RHS operand of the predicate computed by 354338fd1498Szrj conditional statement GS. */ 354438fd1498Szrj 354538fd1498Szrj static inline void 354638fd1498Szrj gimple_cond_set_rhs (gcond *gs, tree rhs) 354738fd1498Szrj { 354838fd1498Szrj gs->op[1] = rhs; 354938fd1498Szrj } 355038fd1498Szrj 355138fd1498Szrj 355238fd1498Szrj /* Return the label used by conditional statement GS when its 355338fd1498Szrj predicate evaluates to true. */ 355438fd1498Szrj 355538fd1498Szrj static inline tree 355638fd1498Szrj gimple_cond_true_label (const gcond *gs) 355738fd1498Szrj { 355838fd1498Szrj return gs->op[2]; 355938fd1498Szrj } 356038fd1498Szrj 356138fd1498Szrj 356238fd1498Szrj /* Set LABEL to be the label used by conditional statement GS when its 356338fd1498Szrj predicate evaluates to true. */ 356438fd1498Szrj 356538fd1498Szrj static inline void 356638fd1498Szrj gimple_cond_set_true_label (gcond *gs, tree label) 356738fd1498Szrj { 356838fd1498Szrj gs->op[2] = label; 356938fd1498Szrj } 357038fd1498Szrj 357138fd1498Szrj 357238fd1498Szrj /* Set LABEL to be the label used by conditional statement GS when its 357338fd1498Szrj predicate evaluates to false. */ 357438fd1498Szrj 357538fd1498Szrj static inline void 357638fd1498Szrj gimple_cond_set_false_label (gcond *gs, tree label) 357738fd1498Szrj { 357838fd1498Szrj gs->op[3] = label; 357938fd1498Szrj } 358038fd1498Szrj 358138fd1498Szrj 358238fd1498Szrj /* Return the label used by conditional statement GS when its 358338fd1498Szrj predicate evaluates to false. */ 358438fd1498Szrj 358538fd1498Szrj static inline tree 358638fd1498Szrj gimple_cond_false_label (const gcond *gs) 358738fd1498Szrj { 358838fd1498Szrj return gs->op[3]; 358938fd1498Szrj } 359038fd1498Szrj 359138fd1498Szrj 359238fd1498Szrj /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */ 359338fd1498Szrj 359438fd1498Szrj static inline void 359538fd1498Szrj gimple_cond_make_false (gcond *gs) 359638fd1498Szrj { 359738fd1498Szrj gimple_cond_set_lhs (gs, boolean_false_node); 359838fd1498Szrj gimple_cond_set_rhs (gs, boolean_false_node); 359938fd1498Szrj gs->subcode = NE_EXPR; 360038fd1498Szrj } 360138fd1498Szrj 360238fd1498Szrj 360338fd1498Szrj /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */ 360438fd1498Szrj 360538fd1498Szrj static inline void 360638fd1498Szrj gimple_cond_make_true (gcond *gs) 360738fd1498Szrj { 360838fd1498Szrj gimple_cond_set_lhs (gs, boolean_true_node); 360938fd1498Szrj gimple_cond_set_rhs (gs, boolean_false_node); 361038fd1498Szrj gs->subcode = NE_EXPR; 361138fd1498Szrj } 361238fd1498Szrj 361338fd1498Szrj /* Check if conditional statemente GS is of the form 'if (1 == 1)', 361438fd1498Szrj 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */ 361538fd1498Szrj 361638fd1498Szrj static inline bool 361738fd1498Szrj gimple_cond_true_p (const gcond *gs) 361838fd1498Szrj { 361938fd1498Szrj tree lhs = gimple_cond_lhs (gs); 362038fd1498Szrj tree rhs = gimple_cond_rhs (gs); 362138fd1498Szrj enum tree_code code = gimple_cond_code (gs); 362238fd1498Szrj 362338fd1498Szrj if (lhs != boolean_true_node && lhs != boolean_false_node) 362438fd1498Szrj return false; 362538fd1498Szrj 362638fd1498Szrj if (rhs != boolean_true_node && rhs != boolean_false_node) 362738fd1498Szrj return false; 362838fd1498Szrj 362938fd1498Szrj if (code == NE_EXPR && lhs != rhs) 363038fd1498Szrj return true; 363138fd1498Szrj 363238fd1498Szrj if (code == EQ_EXPR && lhs == rhs) 363338fd1498Szrj return true; 363438fd1498Szrj 363538fd1498Szrj return false; 363638fd1498Szrj } 363738fd1498Szrj 363838fd1498Szrj /* Check if conditional statement GS is of the form 'if (1 != 1)', 363938fd1498Szrj 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */ 364038fd1498Szrj 364138fd1498Szrj static inline bool 364238fd1498Szrj gimple_cond_false_p (const gcond *gs) 364338fd1498Szrj { 364438fd1498Szrj tree lhs = gimple_cond_lhs (gs); 364538fd1498Szrj tree rhs = gimple_cond_rhs (gs); 364638fd1498Szrj enum tree_code code = gimple_cond_code (gs); 364738fd1498Szrj 364838fd1498Szrj if (lhs != boolean_true_node && lhs != boolean_false_node) 364938fd1498Szrj return false; 365038fd1498Szrj 365138fd1498Szrj if (rhs != boolean_true_node && rhs != boolean_false_node) 365238fd1498Szrj return false; 365338fd1498Szrj 365438fd1498Szrj if (code == NE_EXPR && lhs == rhs) 365538fd1498Szrj return true; 365638fd1498Szrj 365738fd1498Szrj if (code == EQ_EXPR && lhs != rhs) 365838fd1498Szrj return true; 365938fd1498Szrj 366038fd1498Szrj return false; 366138fd1498Szrj } 366238fd1498Szrj 366338fd1498Szrj /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */ 366438fd1498Szrj 366538fd1498Szrj static inline void 366638fd1498Szrj gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs, 366738fd1498Szrj tree rhs) 366838fd1498Szrj { 366938fd1498Szrj gimple_cond_set_code (stmt, code); 367038fd1498Szrj gimple_cond_set_lhs (stmt, lhs); 367138fd1498Szrj gimple_cond_set_rhs (stmt, rhs); 367238fd1498Szrj } 367338fd1498Szrj 367438fd1498Szrj /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */ 367538fd1498Szrj 367638fd1498Szrj static inline tree 367738fd1498Szrj gimple_label_label (const glabel *gs) 367838fd1498Szrj { 367938fd1498Szrj return gs->op[0]; 368038fd1498Szrj } 368138fd1498Szrj 368238fd1498Szrj 368338fd1498Szrj /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement 368438fd1498Szrj GS. */ 368538fd1498Szrj 368638fd1498Szrj static inline void 368738fd1498Szrj gimple_label_set_label (glabel *gs, tree label) 368838fd1498Szrj { 368938fd1498Szrj gs->op[0] = label; 369038fd1498Szrj } 369138fd1498Szrj 369238fd1498Szrj 369338fd1498Szrj /* Return the destination of the unconditional jump GS. */ 369438fd1498Szrj 369538fd1498Szrj static inline tree 369638fd1498Szrj gimple_goto_dest (const gimple *gs) 369738fd1498Szrj { 369838fd1498Szrj GIMPLE_CHECK (gs, GIMPLE_GOTO); 369938fd1498Szrj return gimple_op (gs, 0); 370038fd1498Szrj } 370138fd1498Szrj 370238fd1498Szrj 370338fd1498Szrj /* Set DEST to be the destination of the unconditonal jump GS. */ 370438fd1498Szrj 370538fd1498Szrj static inline void 370638fd1498Szrj gimple_goto_set_dest (ggoto *gs, tree dest) 370738fd1498Szrj { 370838fd1498Szrj gs->op[0] = dest; 370938fd1498Szrj } 371038fd1498Szrj 371138fd1498Szrj 371238fd1498Szrj /* Return the variables declared in the GIMPLE_BIND statement GS. */ 371338fd1498Szrj 371438fd1498Szrj static inline tree 371538fd1498Szrj gimple_bind_vars (const gbind *bind_stmt) 371638fd1498Szrj { 371738fd1498Szrj return bind_stmt->vars; 371838fd1498Szrj } 371938fd1498Szrj 372038fd1498Szrj 372138fd1498Szrj /* Set VARS to be the set of variables declared in the GIMPLE_BIND 372238fd1498Szrj statement GS. */ 372338fd1498Szrj 372438fd1498Szrj static inline void 372538fd1498Szrj gimple_bind_set_vars (gbind *bind_stmt, tree vars) 372638fd1498Szrj { 372738fd1498Szrj bind_stmt->vars = vars; 372838fd1498Szrj } 372938fd1498Szrj 373038fd1498Szrj 373138fd1498Szrj /* Append VARS to the set of variables declared in the GIMPLE_BIND 373238fd1498Szrj statement GS. */ 373338fd1498Szrj 373438fd1498Szrj static inline void 373538fd1498Szrj gimple_bind_append_vars (gbind *bind_stmt, tree vars) 373638fd1498Szrj { 373738fd1498Szrj bind_stmt->vars = chainon (bind_stmt->vars, vars); 373838fd1498Szrj } 373938fd1498Szrj 374038fd1498Szrj 374138fd1498Szrj static inline gimple_seq * 374238fd1498Szrj gimple_bind_body_ptr (gbind *bind_stmt) 374338fd1498Szrj { 374438fd1498Szrj return &bind_stmt->body; 374538fd1498Szrj } 374638fd1498Szrj 374738fd1498Szrj /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */ 374838fd1498Szrj 374938fd1498Szrj static inline gimple_seq 375038fd1498Szrj gimple_bind_body (gbind *gs) 375138fd1498Szrj { 375238fd1498Szrj return *gimple_bind_body_ptr (gs); 375338fd1498Szrj } 375438fd1498Szrj 375538fd1498Szrj 375638fd1498Szrj /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND 375738fd1498Szrj statement GS. */ 375838fd1498Szrj 375938fd1498Szrj static inline void 376038fd1498Szrj gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq) 376138fd1498Szrj { 376238fd1498Szrj bind_stmt->body = seq; 376338fd1498Szrj } 376438fd1498Szrj 376538fd1498Szrj 376638fd1498Szrj /* Append a statement to the end of a GIMPLE_BIND's body. */ 376738fd1498Szrj 376838fd1498Szrj static inline void 376938fd1498Szrj gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt) 377038fd1498Szrj { 377138fd1498Szrj gimple_seq_add_stmt (&bind_stmt->body, stmt); 377238fd1498Szrj } 377338fd1498Szrj 377438fd1498Szrj 377538fd1498Szrj /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */ 377638fd1498Szrj 377738fd1498Szrj static inline void 377838fd1498Szrj gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq) 377938fd1498Szrj { 378038fd1498Szrj gimple_seq_add_seq (&bind_stmt->body, seq); 378138fd1498Szrj } 378238fd1498Szrj 378338fd1498Szrj 378438fd1498Szrj /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement 378538fd1498Szrj GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */ 378638fd1498Szrj 378738fd1498Szrj static inline tree 378838fd1498Szrj gimple_bind_block (const gbind *bind_stmt) 378938fd1498Szrj { 379038fd1498Szrj return bind_stmt->block; 379138fd1498Szrj } 379238fd1498Szrj 379338fd1498Szrj 379438fd1498Szrj /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND 379538fd1498Szrj statement GS. */ 379638fd1498Szrj 379738fd1498Szrj static inline void 379838fd1498Szrj gimple_bind_set_block (gbind *bind_stmt, tree block) 379938fd1498Szrj { 380038fd1498Szrj gcc_gimple_checking_assert (block == NULL_TREE 380138fd1498Szrj || TREE_CODE (block) == BLOCK); 380238fd1498Szrj bind_stmt->block = block; 380338fd1498Szrj } 380438fd1498Szrj 380538fd1498Szrj 380638fd1498Szrj /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */ 380738fd1498Szrj 380838fd1498Szrj static inline unsigned 380938fd1498Szrj gimple_asm_ninputs (const gasm *asm_stmt) 381038fd1498Szrj { 381138fd1498Szrj return asm_stmt->ni; 381238fd1498Szrj } 381338fd1498Szrj 381438fd1498Szrj 381538fd1498Szrj /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */ 381638fd1498Szrj 381738fd1498Szrj static inline unsigned 381838fd1498Szrj gimple_asm_noutputs (const gasm *asm_stmt) 381938fd1498Szrj { 382038fd1498Szrj return asm_stmt->no; 382138fd1498Szrj } 382238fd1498Szrj 382338fd1498Szrj 382438fd1498Szrj /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */ 382538fd1498Szrj 382638fd1498Szrj static inline unsigned 382738fd1498Szrj gimple_asm_nclobbers (const gasm *asm_stmt) 382838fd1498Szrj { 382938fd1498Szrj return asm_stmt->nc; 383038fd1498Szrj } 383138fd1498Szrj 383238fd1498Szrj /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */ 383338fd1498Szrj 383438fd1498Szrj static inline unsigned 383538fd1498Szrj gimple_asm_nlabels (const gasm *asm_stmt) 383638fd1498Szrj { 383738fd1498Szrj return asm_stmt->nl; 383838fd1498Szrj } 383938fd1498Szrj 384038fd1498Szrj /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */ 384138fd1498Szrj 384238fd1498Szrj static inline tree 384338fd1498Szrj gimple_asm_input_op (const gasm *asm_stmt, unsigned index) 384438fd1498Szrj { 384538fd1498Szrj gcc_gimple_checking_assert (index < asm_stmt->ni); 384638fd1498Szrj return asm_stmt->op[index + asm_stmt->no]; 384738fd1498Szrj } 384838fd1498Szrj 384938fd1498Szrj /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */ 385038fd1498Szrj 385138fd1498Szrj static inline void 385238fd1498Szrj gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op) 385338fd1498Szrj { 385438fd1498Szrj gcc_gimple_checking_assert (index < asm_stmt->ni 385538fd1498Szrj && TREE_CODE (in_op) == TREE_LIST); 385638fd1498Szrj asm_stmt->op[index + asm_stmt->no] = in_op; 385738fd1498Szrj } 385838fd1498Szrj 385938fd1498Szrj 386038fd1498Szrj /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */ 386138fd1498Szrj 386238fd1498Szrj static inline tree 386338fd1498Szrj gimple_asm_output_op (const gasm *asm_stmt, unsigned index) 386438fd1498Szrj { 386538fd1498Szrj gcc_gimple_checking_assert (index < asm_stmt->no); 386638fd1498Szrj return asm_stmt->op[index]; 386738fd1498Szrj } 386838fd1498Szrj 386938fd1498Szrj /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */ 387038fd1498Szrj 387138fd1498Szrj static inline void 387238fd1498Szrj gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op) 387338fd1498Szrj { 387438fd1498Szrj gcc_gimple_checking_assert (index < asm_stmt->no 387538fd1498Szrj && TREE_CODE (out_op) == TREE_LIST); 387638fd1498Szrj asm_stmt->op[index] = out_op; 387738fd1498Szrj } 387838fd1498Szrj 387938fd1498Szrj 388038fd1498Szrj /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */ 388138fd1498Szrj 388238fd1498Szrj static inline tree 388338fd1498Szrj gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index) 388438fd1498Szrj { 388538fd1498Szrj gcc_gimple_checking_assert (index < asm_stmt->nc); 388638fd1498Szrj return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no]; 388738fd1498Szrj } 388838fd1498Szrj 388938fd1498Szrj 389038fd1498Szrj /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */ 389138fd1498Szrj 389238fd1498Szrj static inline void 389338fd1498Szrj gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op) 389438fd1498Szrj { 389538fd1498Szrj gcc_gimple_checking_assert (index < asm_stmt->nc 389638fd1498Szrj && TREE_CODE (clobber_op) == TREE_LIST); 389738fd1498Szrj asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op; 389838fd1498Szrj } 389938fd1498Szrj 390038fd1498Szrj /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */ 390138fd1498Szrj 390238fd1498Szrj static inline tree 390338fd1498Szrj gimple_asm_label_op (const gasm *asm_stmt, unsigned index) 390438fd1498Szrj { 390538fd1498Szrj gcc_gimple_checking_assert (index < asm_stmt->nl); 390638fd1498Szrj return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc]; 390738fd1498Szrj } 390838fd1498Szrj 390938fd1498Szrj /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */ 391038fd1498Szrj 391138fd1498Szrj static inline void 391238fd1498Szrj gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op) 391338fd1498Szrj { 391438fd1498Szrj gcc_gimple_checking_assert (index < asm_stmt->nl 391538fd1498Szrj && TREE_CODE (label_op) == TREE_LIST); 391638fd1498Szrj asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op; 391738fd1498Szrj } 391838fd1498Szrj 391938fd1498Szrj /* Return the string representing the assembly instruction in 392038fd1498Szrj GIMPLE_ASM ASM_STMT. */ 392138fd1498Szrj 392238fd1498Szrj static inline const char * 392338fd1498Szrj gimple_asm_string (const gasm *asm_stmt) 392438fd1498Szrj { 392538fd1498Szrj return asm_stmt->string; 392638fd1498Szrj } 392738fd1498Szrj 392838fd1498Szrj 3929*58e805e6Szrj /* Return true if ASM_STMT is marked volatile. */ 393038fd1498Szrj 393138fd1498Szrj static inline bool 393238fd1498Szrj gimple_asm_volatile_p (const gasm *asm_stmt) 393338fd1498Szrj { 393438fd1498Szrj return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0; 393538fd1498Szrj } 393638fd1498Szrj 393738fd1498Szrj 3938*58e805e6Szrj /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */ 393938fd1498Szrj 394038fd1498Szrj static inline void 394138fd1498Szrj gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p) 394238fd1498Szrj { 394338fd1498Szrj if (volatile_p) 394438fd1498Szrj asm_stmt->subcode |= GF_ASM_VOLATILE; 394538fd1498Szrj else 394638fd1498Szrj asm_stmt->subcode &= ~GF_ASM_VOLATILE; 394738fd1498Szrj } 394838fd1498Szrj 394938fd1498Szrj 3950*58e805e6Szrj /* Return true if ASM_STMT is marked inline. */ 3951*58e805e6Szrj 3952*58e805e6Szrj static inline bool 3953*58e805e6Szrj gimple_asm_inline_p (const gasm *asm_stmt) 3954*58e805e6Szrj { 3955*58e805e6Szrj return (asm_stmt->subcode & GF_ASM_INLINE) != 0; 3956*58e805e6Szrj } 3957*58e805e6Szrj 3958*58e805e6Szrj 3959*58e805e6Szrj /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */ 3960*58e805e6Szrj 3961*58e805e6Szrj static inline void 3962*58e805e6Szrj gimple_asm_set_inline (gasm *asm_stmt, bool inline_p) 3963*58e805e6Szrj { 3964*58e805e6Szrj if (inline_p) 3965*58e805e6Szrj asm_stmt->subcode |= GF_ASM_INLINE; 3966*58e805e6Szrj else 3967*58e805e6Szrj asm_stmt->subcode &= ~GF_ASM_INLINE; 3968*58e805e6Szrj } 3969*58e805e6Szrj 3970*58e805e6Szrj 397138fd1498Szrj /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */ 397238fd1498Szrj 397338fd1498Szrj static inline void 397438fd1498Szrj gimple_asm_set_input (gasm *asm_stmt, bool input_p) 397538fd1498Szrj { 397638fd1498Szrj if (input_p) 397738fd1498Szrj asm_stmt->subcode |= GF_ASM_INPUT; 397838fd1498Szrj else 397938fd1498Szrj asm_stmt->subcode &= ~GF_ASM_INPUT; 398038fd1498Szrj } 398138fd1498Szrj 398238fd1498Szrj 398338fd1498Szrj /* Return true if asm ASM_STMT is an ASM_INPUT. */ 398438fd1498Szrj 398538fd1498Szrj static inline bool 398638fd1498Szrj gimple_asm_input_p (const gasm *asm_stmt) 398738fd1498Szrj { 398838fd1498Szrj return (asm_stmt->subcode & GF_ASM_INPUT) != 0; 398938fd1498Szrj } 399038fd1498Szrj 399138fd1498Szrj 399238fd1498Szrj /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */ 399338fd1498Szrj 399438fd1498Szrj static inline tree 399538fd1498Szrj gimple_catch_types (const gcatch *catch_stmt) 399638fd1498Szrj { 399738fd1498Szrj return catch_stmt->types; 399838fd1498Szrj } 399938fd1498Szrj 400038fd1498Szrj 400138fd1498Szrj /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */ 400238fd1498Szrj 400338fd1498Szrj static inline tree * 400438fd1498Szrj gimple_catch_types_ptr (gcatch *catch_stmt) 400538fd1498Szrj { 400638fd1498Szrj return &catch_stmt->types; 400738fd1498Szrj } 400838fd1498Szrj 400938fd1498Szrj 401038fd1498Szrj /* Return a pointer to the GIMPLE sequence representing the body of 401138fd1498Szrj the handler of GIMPLE_CATCH statement CATCH_STMT. */ 401238fd1498Szrj 401338fd1498Szrj static inline gimple_seq * 401438fd1498Szrj gimple_catch_handler_ptr (gcatch *catch_stmt) 401538fd1498Szrj { 401638fd1498Szrj return &catch_stmt->handler; 401738fd1498Szrj } 401838fd1498Szrj 401938fd1498Szrj 402038fd1498Szrj /* Return the GIMPLE sequence representing the body of the handler of 402138fd1498Szrj GIMPLE_CATCH statement CATCH_STMT. */ 402238fd1498Szrj 402338fd1498Szrj static inline gimple_seq 402438fd1498Szrj gimple_catch_handler (gcatch *catch_stmt) 402538fd1498Szrj { 402638fd1498Szrj return *gimple_catch_handler_ptr (catch_stmt); 402738fd1498Szrj } 402838fd1498Szrj 402938fd1498Szrj 403038fd1498Szrj /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */ 403138fd1498Szrj 403238fd1498Szrj static inline void 403338fd1498Szrj gimple_catch_set_types (gcatch *catch_stmt, tree t) 403438fd1498Szrj { 403538fd1498Szrj catch_stmt->types = t; 403638fd1498Szrj } 403738fd1498Szrj 403838fd1498Szrj 403938fd1498Szrj /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */ 404038fd1498Szrj 404138fd1498Szrj static inline void 404238fd1498Szrj gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler) 404338fd1498Szrj { 404438fd1498Szrj catch_stmt->handler = handler; 404538fd1498Szrj } 404638fd1498Szrj 404738fd1498Szrj 404838fd1498Szrj /* Return the types handled by GIMPLE_EH_FILTER statement GS. */ 404938fd1498Szrj 405038fd1498Szrj static inline tree 405138fd1498Szrj gimple_eh_filter_types (const gimple *gs) 405238fd1498Szrj { 405338fd1498Szrj const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs); 405438fd1498Szrj return eh_filter_stmt->types; 405538fd1498Szrj } 405638fd1498Szrj 405738fd1498Szrj 405838fd1498Szrj /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement 405938fd1498Szrj GS. */ 406038fd1498Szrj 406138fd1498Szrj static inline tree * 406238fd1498Szrj gimple_eh_filter_types_ptr (gimple *gs) 406338fd1498Szrj { 406438fd1498Szrj geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs); 406538fd1498Szrj return &eh_filter_stmt->types; 406638fd1498Szrj } 406738fd1498Szrj 406838fd1498Szrj 406938fd1498Szrj /* Return a pointer to the sequence of statement to execute when 407038fd1498Szrj GIMPLE_EH_FILTER statement fails. */ 407138fd1498Szrj 407238fd1498Szrj static inline gimple_seq * 407338fd1498Szrj gimple_eh_filter_failure_ptr (gimple *gs) 407438fd1498Szrj { 407538fd1498Szrj geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs); 407638fd1498Szrj return &eh_filter_stmt->failure; 407738fd1498Szrj } 407838fd1498Szrj 407938fd1498Szrj 408038fd1498Szrj /* Return the sequence of statement to execute when GIMPLE_EH_FILTER 408138fd1498Szrj statement fails. */ 408238fd1498Szrj 408338fd1498Szrj static inline gimple_seq 408438fd1498Szrj gimple_eh_filter_failure (gimple *gs) 408538fd1498Szrj { 408638fd1498Szrj return *gimple_eh_filter_failure_ptr (gs); 408738fd1498Szrj } 408838fd1498Szrj 408938fd1498Szrj 409038fd1498Szrj /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER 409138fd1498Szrj EH_FILTER_STMT. */ 409238fd1498Szrj 409338fd1498Szrj static inline void 409438fd1498Szrj gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types) 409538fd1498Szrj { 409638fd1498Szrj eh_filter_stmt->types = types; 409738fd1498Szrj } 409838fd1498Szrj 409938fd1498Szrj 410038fd1498Szrj /* Set FAILURE to be the sequence of statements to execute on failure 410138fd1498Szrj for GIMPLE_EH_FILTER EH_FILTER_STMT. */ 410238fd1498Szrj 410338fd1498Szrj static inline void 410438fd1498Szrj gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt, 410538fd1498Szrj gimple_seq failure) 410638fd1498Szrj { 410738fd1498Szrj eh_filter_stmt->failure = failure; 410838fd1498Szrj } 410938fd1498Szrj 411038fd1498Szrj /* Get the function decl to be called by the MUST_NOT_THROW region. */ 411138fd1498Szrj 411238fd1498Szrj static inline tree 411338fd1498Szrj gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt) 411438fd1498Szrj { 411538fd1498Szrj return eh_mnt_stmt->fndecl; 411638fd1498Szrj } 411738fd1498Szrj 411838fd1498Szrj /* Set the function decl to be called by GS to DECL. */ 411938fd1498Szrj 412038fd1498Szrj static inline void 412138fd1498Szrj gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt, 412238fd1498Szrj tree decl) 412338fd1498Szrj { 412438fd1498Szrj eh_mnt_stmt->fndecl = decl; 412538fd1498Szrj } 412638fd1498Szrj 412738fd1498Szrj /* GIMPLE_EH_ELSE accessors. */ 412838fd1498Szrj 412938fd1498Szrj static inline gimple_seq * 413038fd1498Szrj gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt) 413138fd1498Szrj { 413238fd1498Szrj return &eh_else_stmt->n_body; 413338fd1498Szrj } 413438fd1498Szrj 413538fd1498Szrj static inline gimple_seq 413638fd1498Szrj gimple_eh_else_n_body (geh_else *eh_else_stmt) 413738fd1498Szrj { 413838fd1498Szrj return *gimple_eh_else_n_body_ptr (eh_else_stmt); 413938fd1498Szrj } 414038fd1498Szrj 414138fd1498Szrj static inline gimple_seq * 414238fd1498Szrj gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt) 414338fd1498Szrj { 414438fd1498Szrj return &eh_else_stmt->e_body; 414538fd1498Szrj } 414638fd1498Szrj 414738fd1498Szrj static inline gimple_seq 414838fd1498Szrj gimple_eh_else_e_body (geh_else *eh_else_stmt) 414938fd1498Szrj { 415038fd1498Szrj return *gimple_eh_else_e_body_ptr (eh_else_stmt); 415138fd1498Szrj } 415238fd1498Szrj 415338fd1498Szrj static inline void 415438fd1498Szrj gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq) 415538fd1498Szrj { 415638fd1498Szrj eh_else_stmt->n_body = seq; 415738fd1498Szrj } 415838fd1498Szrj 415938fd1498Szrj static inline void 416038fd1498Szrj gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq) 416138fd1498Szrj { 416238fd1498Szrj eh_else_stmt->e_body = seq; 416338fd1498Szrj } 416438fd1498Szrj 416538fd1498Szrj /* GIMPLE_TRY accessors. */ 416638fd1498Szrj 416738fd1498Szrj /* Return the kind of try block represented by GIMPLE_TRY GS. This is 416838fd1498Szrj either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */ 416938fd1498Szrj 417038fd1498Szrj static inline enum gimple_try_flags 417138fd1498Szrj gimple_try_kind (const gimple *gs) 417238fd1498Szrj { 417338fd1498Szrj GIMPLE_CHECK (gs, GIMPLE_TRY); 417438fd1498Szrj return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND); 417538fd1498Szrj } 417638fd1498Szrj 417738fd1498Szrj 417838fd1498Szrj /* Set the kind of try block represented by GIMPLE_TRY GS. */ 417938fd1498Szrj 418038fd1498Szrj static inline void 418138fd1498Szrj gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind) 418238fd1498Szrj { 418338fd1498Szrj gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH 418438fd1498Szrj || kind == GIMPLE_TRY_FINALLY); 418538fd1498Szrj if (gimple_try_kind (gs) != kind) 418638fd1498Szrj gs->subcode = (unsigned int) kind; 418738fd1498Szrj } 418838fd1498Szrj 418938fd1498Szrj 419038fd1498Szrj /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ 419138fd1498Szrj 419238fd1498Szrj static inline bool 419338fd1498Szrj gimple_try_catch_is_cleanup (const gimple *gs) 419438fd1498Szrj { 419538fd1498Szrj gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH); 419638fd1498Szrj return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0; 419738fd1498Szrj } 419838fd1498Szrj 419938fd1498Szrj 420038fd1498Szrj /* Return a pointer to the sequence of statements used as the 420138fd1498Szrj body for GIMPLE_TRY GS. */ 420238fd1498Szrj 420338fd1498Szrj static inline gimple_seq * 420438fd1498Szrj gimple_try_eval_ptr (gimple *gs) 420538fd1498Szrj { 420638fd1498Szrj gtry *try_stmt = as_a <gtry *> (gs); 420738fd1498Szrj return &try_stmt->eval; 420838fd1498Szrj } 420938fd1498Szrj 421038fd1498Szrj 421138fd1498Szrj /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */ 421238fd1498Szrj 421338fd1498Szrj static inline gimple_seq 421438fd1498Szrj gimple_try_eval (gimple *gs) 421538fd1498Szrj { 421638fd1498Szrj return *gimple_try_eval_ptr (gs); 421738fd1498Szrj } 421838fd1498Szrj 421938fd1498Szrj 422038fd1498Szrj /* Return a pointer to the sequence of statements used as the cleanup body for 422138fd1498Szrj GIMPLE_TRY GS. */ 422238fd1498Szrj 422338fd1498Szrj static inline gimple_seq * 422438fd1498Szrj gimple_try_cleanup_ptr (gimple *gs) 422538fd1498Szrj { 422638fd1498Szrj gtry *try_stmt = as_a <gtry *> (gs); 422738fd1498Szrj return &try_stmt->cleanup; 422838fd1498Szrj } 422938fd1498Szrj 423038fd1498Szrj 423138fd1498Szrj /* Return the sequence of statements used as the cleanup body for 423238fd1498Szrj GIMPLE_TRY GS. */ 423338fd1498Szrj 423438fd1498Szrj static inline gimple_seq 423538fd1498Szrj gimple_try_cleanup (gimple *gs) 423638fd1498Szrj { 423738fd1498Szrj return *gimple_try_cleanup_ptr (gs); 423838fd1498Szrj } 423938fd1498Szrj 424038fd1498Szrj 424138fd1498Szrj /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ 424238fd1498Szrj 424338fd1498Szrj static inline void 424438fd1498Szrj gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup) 424538fd1498Szrj { 424638fd1498Szrj gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH); 424738fd1498Szrj if (catch_is_cleanup) 424838fd1498Szrj g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP; 424938fd1498Szrj else 425038fd1498Szrj g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP; 425138fd1498Szrj } 425238fd1498Szrj 425338fd1498Szrj 425438fd1498Szrj /* Set EVAL to be the sequence of statements to use as the body for 425538fd1498Szrj GIMPLE_TRY TRY_STMT. */ 425638fd1498Szrj 425738fd1498Szrj static inline void 425838fd1498Szrj gimple_try_set_eval (gtry *try_stmt, gimple_seq eval) 425938fd1498Szrj { 426038fd1498Szrj try_stmt->eval = eval; 426138fd1498Szrj } 426238fd1498Szrj 426338fd1498Szrj 426438fd1498Szrj /* Set CLEANUP to be the sequence of statements to use as the cleanup 426538fd1498Szrj body for GIMPLE_TRY TRY_STMT. */ 426638fd1498Szrj 426738fd1498Szrj static inline void 426838fd1498Szrj gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup) 426938fd1498Szrj { 427038fd1498Szrj try_stmt->cleanup = cleanup; 427138fd1498Szrj } 427238fd1498Szrj 427338fd1498Szrj 427438fd1498Szrj /* Return a pointer to the cleanup sequence for cleanup statement GS. */ 427538fd1498Szrj 427638fd1498Szrj static inline gimple_seq * 427738fd1498Szrj gimple_wce_cleanup_ptr (gimple *gs) 427838fd1498Szrj { 427938fd1498Szrj gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs); 428038fd1498Szrj return &wce_stmt->cleanup; 428138fd1498Szrj } 428238fd1498Szrj 428338fd1498Szrj 428438fd1498Szrj /* Return the cleanup sequence for cleanup statement GS. */ 428538fd1498Szrj 428638fd1498Szrj static inline gimple_seq 428738fd1498Szrj gimple_wce_cleanup (gimple *gs) 428838fd1498Szrj { 428938fd1498Szrj return *gimple_wce_cleanup_ptr (gs); 429038fd1498Szrj } 429138fd1498Szrj 429238fd1498Szrj 429338fd1498Szrj /* Set CLEANUP to be the cleanup sequence for GS. */ 429438fd1498Szrj 429538fd1498Szrj static inline void 429638fd1498Szrj gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup) 429738fd1498Szrj { 429838fd1498Szrj gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs); 429938fd1498Szrj wce_stmt->cleanup = cleanup; 430038fd1498Szrj } 430138fd1498Szrj 430238fd1498Szrj 430338fd1498Szrj /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */ 430438fd1498Szrj 430538fd1498Szrj static inline bool 430638fd1498Szrj gimple_wce_cleanup_eh_only (const gimple *gs) 430738fd1498Szrj { 430838fd1498Szrj GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); 430938fd1498Szrj return gs->subcode != 0; 431038fd1498Szrj } 431138fd1498Szrj 431238fd1498Szrj 431338fd1498Szrj /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */ 431438fd1498Szrj 431538fd1498Szrj static inline void 431638fd1498Szrj gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p) 431738fd1498Szrj { 431838fd1498Szrj GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); 431938fd1498Szrj gs->subcode = (unsigned int) eh_only_p; 432038fd1498Szrj } 432138fd1498Szrj 432238fd1498Szrj 432338fd1498Szrj /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */ 432438fd1498Szrj 432538fd1498Szrj static inline unsigned 432638fd1498Szrj gimple_phi_capacity (const gimple *gs) 432738fd1498Szrj { 432838fd1498Szrj const gphi *phi_stmt = as_a <const gphi *> (gs); 432938fd1498Szrj return phi_stmt->capacity; 433038fd1498Szrj } 433138fd1498Szrj 433238fd1498Szrj 433338fd1498Szrj /* Return the number of arguments in GIMPLE_PHI GS. This must always 433438fd1498Szrj be exactly the number of incoming edges for the basic block holding 433538fd1498Szrj GS. */ 433638fd1498Szrj 433738fd1498Szrj static inline unsigned 433838fd1498Szrj gimple_phi_num_args (const gimple *gs) 433938fd1498Szrj { 434038fd1498Szrj const gphi *phi_stmt = as_a <const gphi *> (gs); 434138fd1498Szrj return phi_stmt->nargs; 434238fd1498Szrj } 434338fd1498Szrj 434438fd1498Szrj 434538fd1498Szrj /* Return the SSA name created by GIMPLE_PHI GS. */ 434638fd1498Szrj 434738fd1498Szrj static inline tree 434838fd1498Szrj gimple_phi_result (const gphi *gs) 434938fd1498Szrj { 435038fd1498Szrj return gs->result; 435138fd1498Szrj } 435238fd1498Szrj 435338fd1498Szrj static inline tree 435438fd1498Szrj gimple_phi_result (const gimple *gs) 435538fd1498Szrj { 435638fd1498Szrj const gphi *phi_stmt = as_a <const gphi *> (gs); 435738fd1498Szrj return gimple_phi_result (phi_stmt); 435838fd1498Szrj } 435938fd1498Szrj 436038fd1498Szrj /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */ 436138fd1498Szrj 436238fd1498Szrj static inline tree * 436338fd1498Szrj gimple_phi_result_ptr (gphi *gs) 436438fd1498Szrj { 436538fd1498Szrj return &gs->result; 436638fd1498Szrj } 436738fd1498Szrj 436838fd1498Szrj static inline tree * 436938fd1498Szrj gimple_phi_result_ptr (gimple *gs) 437038fd1498Szrj { 437138fd1498Szrj gphi *phi_stmt = as_a <gphi *> (gs); 437238fd1498Szrj return gimple_phi_result_ptr (phi_stmt); 437338fd1498Szrj } 437438fd1498Szrj 437538fd1498Szrj /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */ 437638fd1498Szrj 437738fd1498Szrj static inline void 437838fd1498Szrj gimple_phi_set_result (gphi *phi, tree result) 437938fd1498Szrj { 438038fd1498Szrj phi->result = result; 438138fd1498Szrj if (result && TREE_CODE (result) == SSA_NAME) 438238fd1498Szrj SSA_NAME_DEF_STMT (result) = phi; 438338fd1498Szrj } 438438fd1498Szrj 438538fd1498Szrj 438638fd1498Szrj /* Return the PHI argument corresponding to incoming edge INDEX for 438738fd1498Szrj GIMPLE_PHI GS. */ 438838fd1498Szrj 438938fd1498Szrj static inline struct phi_arg_d * 439038fd1498Szrj gimple_phi_arg (gphi *gs, unsigned index) 439138fd1498Szrj { 439238fd1498Szrj gcc_gimple_checking_assert (index < gs->nargs); 439338fd1498Szrj return &(gs->args[index]); 439438fd1498Szrj } 439538fd1498Szrj 439638fd1498Szrj static inline struct phi_arg_d * 439738fd1498Szrj gimple_phi_arg (gimple *gs, unsigned index) 439838fd1498Szrj { 439938fd1498Szrj gphi *phi_stmt = as_a <gphi *> (gs); 440038fd1498Szrj return gimple_phi_arg (phi_stmt, index); 440138fd1498Szrj } 440238fd1498Szrj 440338fd1498Szrj /* Set PHIARG to be the argument corresponding to incoming edge INDEX 440438fd1498Szrj for GIMPLE_PHI PHI. */ 440538fd1498Szrj 440638fd1498Szrj static inline void 440738fd1498Szrj gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg) 440838fd1498Szrj { 440938fd1498Szrj gcc_gimple_checking_assert (index < phi->nargs); 441038fd1498Szrj phi->args[index] = *phiarg; 441138fd1498Szrj } 441238fd1498Szrj 441338fd1498Szrj /* Return the PHI nodes for basic block BB, or NULL if there are no 441438fd1498Szrj PHI nodes. */ 441538fd1498Szrj 441638fd1498Szrj static inline gimple_seq 441738fd1498Szrj phi_nodes (const_basic_block bb) 441838fd1498Szrj { 441938fd1498Szrj gcc_checking_assert (!(bb->flags & BB_RTL)); 442038fd1498Szrj return bb->il.gimple.phi_nodes; 442138fd1498Szrj } 442238fd1498Szrj 442338fd1498Szrj /* Return a pointer to the PHI nodes for basic block BB. */ 442438fd1498Szrj 442538fd1498Szrj static inline gimple_seq * 442638fd1498Szrj phi_nodes_ptr (basic_block bb) 442738fd1498Szrj { 442838fd1498Szrj gcc_checking_assert (!(bb->flags & BB_RTL)); 442938fd1498Szrj return &bb->il.gimple.phi_nodes; 443038fd1498Szrj } 443138fd1498Szrj 443238fd1498Szrj /* Return the tree operand for argument I of PHI node GS. */ 443338fd1498Szrj 443438fd1498Szrj static inline tree 443538fd1498Szrj gimple_phi_arg_def (gphi *gs, size_t index) 443638fd1498Szrj { 443738fd1498Szrj return gimple_phi_arg (gs, index)->def; 443838fd1498Szrj } 443938fd1498Szrj 444038fd1498Szrj static inline tree 444138fd1498Szrj gimple_phi_arg_def (gimple *gs, size_t index) 444238fd1498Szrj { 444338fd1498Szrj return gimple_phi_arg (gs, index)->def; 444438fd1498Szrj } 444538fd1498Szrj 444638fd1498Szrj 444738fd1498Szrj /* Return a pointer to the tree operand for argument I of phi node PHI. */ 444838fd1498Szrj 444938fd1498Szrj static inline tree * 445038fd1498Szrj gimple_phi_arg_def_ptr (gphi *phi, size_t index) 445138fd1498Szrj { 445238fd1498Szrj return &gimple_phi_arg (phi, index)->def; 445338fd1498Szrj } 445438fd1498Szrj 445538fd1498Szrj /* Return the edge associated with argument I of phi node PHI. */ 445638fd1498Szrj 445738fd1498Szrj static inline edge 445838fd1498Szrj gimple_phi_arg_edge (gphi *phi, size_t i) 445938fd1498Szrj { 446038fd1498Szrj return EDGE_PRED (gimple_bb (phi), i); 446138fd1498Szrj } 446238fd1498Szrj 446338fd1498Szrj /* Return the source location of gimple argument I of phi node PHI. */ 446438fd1498Szrj 446538fd1498Szrj static inline source_location 446638fd1498Szrj gimple_phi_arg_location (gphi *phi, size_t i) 446738fd1498Szrj { 446838fd1498Szrj return gimple_phi_arg (phi, i)->locus; 446938fd1498Szrj } 447038fd1498Szrj 447138fd1498Szrj /* Return the source location of the argument on edge E of phi node PHI. */ 447238fd1498Szrj 447338fd1498Szrj static inline source_location 447438fd1498Szrj gimple_phi_arg_location_from_edge (gphi *phi, edge e) 447538fd1498Szrj { 447638fd1498Szrj return gimple_phi_arg (phi, e->dest_idx)->locus; 447738fd1498Szrj } 447838fd1498Szrj 447938fd1498Szrj /* Set the source location of gimple argument I of phi node PHI to LOC. */ 448038fd1498Szrj 448138fd1498Szrj static inline void 448238fd1498Szrj gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc) 448338fd1498Szrj { 448438fd1498Szrj gimple_phi_arg (phi, i)->locus = loc; 448538fd1498Szrj } 448638fd1498Szrj 448738fd1498Szrj /* Return TRUE if argument I of phi node PHI has a location record. */ 448838fd1498Szrj 448938fd1498Szrj static inline bool 449038fd1498Szrj gimple_phi_arg_has_location (gphi *phi, size_t i) 449138fd1498Szrj { 449238fd1498Szrj return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION; 449338fd1498Szrj } 449438fd1498Szrj 449538fd1498Szrj 449638fd1498Szrj /* Return the region number for GIMPLE_RESX RESX_STMT. */ 449738fd1498Szrj 449838fd1498Szrj static inline int 449938fd1498Szrj gimple_resx_region (const gresx *resx_stmt) 450038fd1498Szrj { 450138fd1498Szrj return resx_stmt->region; 450238fd1498Szrj } 450338fd1498Szrj 450438fd1498Szrj /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */ 450538fd1498Szrj 450638fd1498Szrj static inline void 450738fd1498Szrj gimple_resx_set_region (gresx *resx_stmt, int region) 450838fd1498Szrj { 450938fd1498Szrj resx_stmt->region = region; 451038fd1498Szrj } 451138fd1498Szrj 451238fd1498Szrj /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */ 451338fd1498Szrj 451438fd1498Szrj static inline int 451538fd1498Szrj gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt) 451638fd1498Szrj { 451738fd1498Szrj return eh_dispatch_stmt->region; 451838fd1498Szrj } 451938fd1498Szrj 452038fd1498Szrj /* Set REGION to be the region number for GIMPLE_EH_DISPATCH 452138fd1498Szrj EH_DISPATCH_STMT. */ 452238fd1498Szrj 452338fd1498Szrj static inline void 452438fd1498Szrj gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region) 452538fd1498Szrj { 452638fd1498Szrj eh_dispatch_stmt->region = region; 452738fd1498Szrj } 452838fd1498Szrj 452938fd1498Szrj /* Return the number of labels associated with the switch statement GS. */ 453038fd1498Szrj 453138fd1498Szrj static inline unsigned 453238fd1498Szrj gimple_switch_num_labels (const gswitch *gs) 453338fd1498Szrj { 453438fd1498Szrj unsigned num_ops; 453538fd1498Szrj GIMPLE_CHECK (gs, GIMPLE_SWITCH); 453638fd1498Szrj num_ops = gimple_num_ops (gs); 453738fd1498Szrj gcc_gimple_checking_assert (num_ops > 1); 453838fd1498Szrj return num_ops - 1; 453938fd1498Szrj } 454038fd1498Szrj 454138fd1498Szrj 454238fd1498Szrj /* Set NLABELS to be the number of labels for the switch statement GS. */ 454338fd1498Szrj 454438fd1498Szrj static inline void 454538fd1498Szrj gimple_switch_set_num_labels (gswitch *g, unsigned nlabels) 454638fd1498Szrj { 454738fd1498Szrj GIMPLE_CHECK (g, GIMPLE_SWITCH); 454838fd1498Szrj gimple_set_num_ops (g, nlabels + 1); 454938fd1498Szrj } 455038fd1498Szrj 455138fd1498Szrj 455238fd1498Szrj /* Return the index variable used by the switch statement GS. */ 455338fd1498Szrj 455438fd1498Szrj static inline tree 455538fd1498Szrj gimple_switch_index (const gswitch *gs) 455638fd1498Szrj { 455738fd1498Szrj return gs->op[0]; 455838fd1498Szrj } 455938fd1498Szrj 456038fd1498Szrj 456138fd1498Szrj /* Return a pointer to the index variable for the switch statement GS. */ 456238fd1498Szrj 456338fd1498Szrj static inline tree * 456438fd1498Szrj gimple_switch_index_ptr (gswitch *gs) 456538fd1498Szrj { 456638fd1498Szrj return &gs->op[0]; 456738fd1498Szrj } 456838fd1498Szrj 456938fd1498Szrj 457038fd1498Szrj /* Set INDEX to be the index variable for switch statement GS. */ 457138fd1498Szrj 457238fd1498Szrj static inline void 457338fd1498Szrj gimple_switch_set_index (gswitch *gs, tree index) 457438fd1498Szrj { 457538fd1498Szrj gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index)); 457638fd1498Szrj gs->op[0] = index; 457738fd1498Szrj } 457838fd1498Szrj 457938fd1498Szrj 458038fd1498Szrj /* Return the label numbered INDEX. The default label is 0, followed by any 458138fd1498Szrj labels in a switch statement. */ 458238fd1498Szrj 458338fd1498Szrj static inline tree 458438fd1498Szrj gimple_switch_label (const gswitch *gs, unsigned index) 458538fd1498Szrj { 458638fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1); 458738fd1498Szrj return gs->op[index + 1]; 458838fd1498Szrj } 458938fd1498Szrj 459038fd1498Szrj /* Set the label number INDEX to LABEL. 0 is always the default label. */ 459138fd1498Szrj 459238fd1498Szrj static inline void 459338fd1498Szrj gimple_switch_set_label (gswitch *gs, unsigned index, tree label) 459438fd1498Szrj { 459538fd1498Szrj gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1 459638fd1498Szrj && (label == NULL_TREE 459738fd1498Szrj || TREE_CODE (label) == CASE_LABEL_EXPR)); 459838fd1498Szrj gs->op[index + 1] = label; 459938fd1498Szrj } 460038fd1498Szrj 460138fd1498Szrj /* Return the default label for a switch statement. */ 460238fd1498Szrj 460338fd1498Szrj static inline tree 460438fd1498Szrj gimple_switch_default_label (const gswitch *gs) 460538fd1498Szrj { 460638fd1498Szrj tree label = gimple_switch_label (gs, 0); 460738fd1498Szrj gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label)); 460838fd1498Szrj return label; 460938fd1498Szrj } 461038fd1498Szrj 461138fd1498Szrj /* Set the default label for a switch statement. */ 461238fd1498Szrj 461338fd1498Szrj static inline void 461438fd1498Szrj gimple_switch_set_default_label (gswitch *gs, tree label) 461538fd1498Szrj { 461638fd1498Szrj gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label)); 461738fd1498Szrj gimple_switch_set_label (gs, 0, label); 461838fd1498Szrj } 461938fd1498Szrj 462038fd1498Szrj /* Return true if GS is a GIMPLE_DEBUG statement. */ 462138fd1498Szrj 462238fd1498Szrj static inline bool 462338fd1498Szrj is_gimple_debug (const gimple *gs) 462438fd1498Szrj { 462538fd1498Szrj return gimple_code (gs) == GIMPLE_DEBUG; 462638fd1498Szrj } 462738fd1498Szrj 462838fd1498Szrj 462938fd1498Szrj /* Return the last nondebug statement in GIMPLE sequence S. */ 463038fd1498Szrj 463138fd1498Szrj static inline gimple * 463238fd1498Szrj gimple_seq_last_nondebug_stmt (gimple_seq s) 463338fd1498Szrj { 463438fd1498Szrj gimple_seq_node n; 463538fd1498Szrj for (n = gimple_seq_last (s); 463638fd1498Szrj n && is_gimple_debug (n); 463738fd1498Szrj n = n->prev) 463838fd1498Szrj if (n->prev == s) 463938fd1498Szrj return NULL; 464038fd1498Szrj return n; 464138fd1498Szrj } 464238fd1498Szrj 464338fd1498Szrj 464438fd1498Szrj /* Return true if S is a GIMPLE_DEBUG BIND statement. */ 464538fd1498Szrj 464638fd1498Szrj static inline bool 464738fd1498Szrj gimple_debug_bind_p (const gimple *s) 464838fd1498Szrj { 464938fd1498Szrj if (is_gimple_debug (s)) 465038fd1498Szrj return s->subcode == GIMPLE_DEBUG_BIND; 465138fd1498Szrj 465238fd1498Szrj return false; 465338fd1498Szrj } 465438fd1498Szrj 465538fd1498Szrj /* Return the variable bound in a GIMPLE_DEBUG bind statement. */ 465638fd1498Szrj 465738fd1498Szrj static inline tree 465838fd1498Szrj gimple_debug_bind_get_var (gimple *dbg) 465938fd1498Szrj { 466038fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 466138fd1498Szrj gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 466238fd1498Szrj return gimple_op (dbg, 0); 466338fd1498Szrj } 466438fd1498Szrj 466538fd1498Szrj /* Return the value bound to the variable in a GIMPLE_DEBUG bind 466638fd1498Szrj statement. */ 466738fd1498Szrj 466838fd1498Szrj static inline tree 466938fd1498Szrj gimple_debug_bind_get_value (gimple *dbg) 467038fd1498Szrj { 467138fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 467238fd1498Szrj gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 467338fd1498Szrj return gimple_op (dbg, 1); 467438fd1498Szrj } 467538fd1498Szrj 467638fd1498Szrj /* Return a pointer to the value bound to the variable in a 467738fd1498Szrj GIMPLE_DEBUG bind statement. */ 467838fd1498Szrj 467938fd1498Szrj static inline tree * 468038fd1498Szrj gimple_debug_bind_get_value_ptr (gimple *dbg) 468138fd1498Szrj { 468238fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 468338fd1498Szrj gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 468438fd1498Szrj return gimple_op_ptr (dbg, 1); 468538fd1498Szrj } 468638fd1498Szrj 468738fd1498Szrj /* Set the variable bound in a GIMPLE_DEBUG bind statement. */ 468838fd1498Szrj 468938fd1498Szrj static inline void 469038fd1498Szrj gimple_debug_bind_set_var (gimple *dbg, tree var) 469138fd1498Szrj { 469238fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 469338fd1498Szrj gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 469438fd1498Szrj gimple_set_op (dbg, 0, var); 469538fd1498Szrj } 469638fd1498Szrj 469738fd1498Szrj /* Set the value bound to the variable in a GIMPLE_DEBUG bind 469838fd1498Szrj statement. */ 469938fd1498Szrj 470038fd1498Szrj static inline void 470138fd1498Szrj gimple_debug_bind_set_value (gimple *dbg, tree value) 470238fd1498Szrj { 470338fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 470438fd1498Szrj gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 470538fd1498Szrj gimple_set_op (dbg, 1, value); 470638fd1498Szrj } 470738fd1498Szrj 470838fd1498Szrj /* The second operand of a GIMPLE_DEBUG_BIND, when the value was 470938fd1498Szrj optimized away. */ 471038fd1498Szrj #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */ 471138fd1498Szrj 471238fd1498Szrj /* Remove the value bound to the variable in a GIMPLE_DEBUG bind 471338fd1498Szrj statement. */ 471438fd1498Szrj 471538fd1498Szrj static inline void 471638fd1498Szrj gimple_debug_bind_reset_value (gimple *dbg) 471738fd1498Szrj { 471838fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 471938fd1498Szrj gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 472038fd1498Szrj gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE); 472138fd1498Szrj } 472238fd1498Szrj 472338fd1498Szrj /* Return true if the GIMPLE_DEBUG bind statement is bound to a 472438fd1498Szrj value. */ 472538fd1498Szrj 472638fd1498Szrj static inline bool 472738fd1498Szrj gimple_debug_bind_has_value_p (gimple *dbg) 472838fd1498Szrj { 472938fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 473038fd1498Szrj gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 473138fd1498Szrj return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE; 473238fd1498Szrj } 473338fd1498Szrj 473438fd1498Szrj #undef GIMPLE_DEBUG_BIND_NOVALUE 473538fd1498Szrj 473638fd1498Szrj /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */ 473738fd1498Szrj 473838fd1498Szrj static inline bool 473938fd1498Szrj gimple_debug_source_bind_p (const gimple *s) 474038fd1498Szrj { 474138fd1498Szrj if (is_gimple_debug (s)) 474238fd1498Szrj return s->subcode == GIMPLE_DEBUG_SOURCE_BIND; 474338fd1498Szrj 474438fd1498Szrj return false; 474538fd1498Szrj } 474638fd1498Szrj 474738fd1498Szrj /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */ 474838fd1498Szrj 474938fd1498Szrj static inline tree 475038fd1498Szrj gimple_debug_source_bind_get_var (gimple *dbg) 475138fd1498Szrj { 475238fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 475338fd1498Szrj gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); 475438fd1498Szrj return gimple_op (dbg, 0); 475538fd1498Szrj } 475638fd1498Szrj 475738fd1498Szrj /* Return the value bound to the variable in a GIMPLE_DEBUG source bind 475838fd1498Szrj statement. */ 475938fd1498Szrj 476038fd1498Szrj static inline tree 476138fd1498Szrj gimple_debug_source_bind_get_value (gimple *dbg) 476238fd1498Szrj { 476338fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 476438fd1498Szrj gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); 476538fd1498Szrj return gimple_op (dbg, 1); 476638fd1498Szrj } 476738fd1498Szrj 476838fd1498Szrj /* Return a pointer to the value bound to the variable in a 476938fd1498Szrj GIMPLE_DEBUG source bind statement. */ 477038fd1498Szrj 477138fd1498Szrj static inline tree * 477238fd1498Szrj gimple_debug_source_bind_get_value_ptr (gimple *dbg) 477338fd1498Szrj { 477438fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 477538fd1498Szrj gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); 477638fd1498Szrj return gimple_op_ptr (dbg, 1); 477738fd1498Szrj } 477838fd1498Szrj 477938fd1498Szrj /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */ 478038fd1498Szrj 478138fd1498Szrj static inline void 478238fd1498Szrj gimple_debug_source_bind_set_var (gimple *dbg, tree var) 478338fd1498Szrj { 478438fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 478538fd1498Szrj gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); 478638fd1498Szrj gimple_set_op (dbg, 0, var); 478738fd1498Szrj } 478838fd1498Szrj 478938fd1498Szrj /* Set the value bound to the variable in a GIMPLE_DEBUG source bind 479038fd1498Szrj statement. */ 479138fd1498Szrj 479238fd1498Szrj static inline void 479338fd1498Szrj gimple_debug_source_bind_set_value (gimple *dbg, tree value) 479438fd1498Szrj { 479538fd1498Szrj GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 479638fd1498Szrj gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); 479738fd1498Szrj gimple_set_op (dbg, 1, value); 479838fd1498Szrj } 479938fd1498Szrj 480038fd1498Szrj /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */ 480138fd1498Szrj 480238fd1498Szrj static inline bool 480338fd1498Szrj gimple_debug_begin_stmt_p (const gimple *s) 480438fd1498Szrj { 480538fd1498Szrj if (is_gimple_debug (s)) 480638fd1498Szrj return s->subcode == GIMPLE_DEBUG_BEGIN_STMT; 480738fd1498Szrj 480838fd1498Szrj return false; 480938fd1498Szrj } 481038fd1498Szrj 481138fd1498Szrj /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */ 481238fd1498Szrj 481338fd1498Szrj static inline bool 481438fd1498Szrj gimple_debug_inline_entry_p (const gimple *s) 481538fd1498Szrj { 481638fd1498Szrj if (is_gimple_debug (s)) 481738fd1498Szrj return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY; 481838fd1498Szrj 481938fd1498Szrj return false; 482038fd1498Szrj } 482138fd1498Szrj 482238fd1498Szrj /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */ 482338fd1498Szrj 482438fd1498Szrj static inline bool 482538fd1498Szrj gimple_debug_nonbind_marker_p (const gimple *s) 482638fd1498Szrj { 482738fd1498Szrj if (is_gimple_debug (s)) 482838fd1498Szrj return s->subcode == GIMPLE_DEBUG_BEGIN_STMT 482938fd1498Szrj || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY; 483038fd1498Szrj 483138fd1498Szrj return false; 483238fd1498Szrj } 483338fd1498Szrj 483438fd1498Szrj /* Return the line number for EXPR, or return -1 if we have no line 483538fd1498Szrj number information for it. */ 483638fd1498Szrj static inline int 483738fd1498Szrj get_lineno (const gimple *stmt) 483838fd1498Szrj { 483938fd1498Szrj location_t loc; 484038fd1498Szrj 484138fd1498Szrj if (!stmt) 484238fd1498Szrj return -1; 484338fd1498Szrj 484438fd1498Szrj loc = gimple_location (stmt); 484538fd1498Szrj if (loc == UNKNOWN_LOCATION) 484638fd1498Szrj return -1; 484738fd1498Szrj 484838fd1498Szrj return LOCATION_LINE (loc); 484938fd1498Szrj } 485038fd1498Szrj 485138fd1498Szrj /* Return a pointer to the body for the OMP statement GS. */ 485238fd1498Szrj 485338fd1498Szrj static inline gimple_seq * 485438fd1498Szrj gimple_omp_body_ptr (gimple *gs) 485538fd1498Szrj { 485638fd1498Szrj return &static_cast <gimple_statement_omp *> (gs)->body; 485738fd1498Szrj } 485838fd1498Szrj 485938fd1498Szrj /* Return the body for the OMP statement GS. */ 486038fd1498Szrj 486138fd1498Szrj static inline gimple_seq 486238fd1498Szrj gimple_omp_body (gimple *gs) 486338fd1498Szrj { 486438fd1498Szrj return *gimple_omp_body_ptr (gs); 486538fd1498Szrj } 486638fd1498Szrj 486738fd1498Szrj /* Set BODY to be the body for the OMP statement GS. */ 486838fd1498Szrj 486938fd1498Szrj static inline void 487038fd1498Szrj gimple_omp_set_body (gimple *gs, gimple_seq body) 487138fd1498Szrj { 487238fd1498Szrj static_cast <gimple_statement_omp *> (gs)->body = body; 487338fd1498Szrj } 487438fd1498Szrj 487538fd1498Szrj 487638fd1498Szrj /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */ 487738fd1498Szrj 487838fd1498Szrj static inline tree 487938fd1498Szrj gimple_omp_critical_name (const gomp_critical *crit_stmt) 488038fd1498Szrj { 488138fd1498Szrj return crit_stmt->name; 488238fd1498Szrj } 488338fd1498Szrj 488438fd1498Szrj 488538fd1498Szrj /* Return a pointer to the name associated with OMP critical statement 488638fd1498Szrj CRIT_STMT. */ 488738fd1498Szrj 488838fd1498Szrj static inline tree * 488938fd1498Szrj gimple_omp_critical_name_ptr (gomp_critical *crit_stmt) 489038fd1498Szrj { 489138fd1498Szrj return &crit_stmt->name; 489238fd1498Szrj } 489338fd1498Szrj 489438fd1498Szrj 489538fd1498Szrj /* Set NAME to be the name associated with OMP critical statement 489638fd1498Szrj CRIT_STMT. */ 489738fd1498Szrj 489838fd1498Szrj static inline void 489938fd1498Szrj gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name) 490038fd1498Szrj { 490138fd1498Szrj crit_stmt->name = name; 490238fd1498Szrj } 490338fd1498Szrj 490438fd1498Szrj 490538fd1498Szrj /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */ 490638fd1498Szrj 490738fd1498Szrj static inline tree 490838fd1498Szrj gimple_omp_critical_clauses (const gomp_critical *crit_stmt) 490938fd1498Szrj { 491038fd1498Szrj return crit_stmt->clauses; 491138fd1498Szrj } 491238fd1498Szrj 491338fd1498Szrj 491438fd1498Szrj /* Return a pointer to the clauses associated with OMP critical statement 491538fd1498Szrj CRIT_STMT. */ 491638fd1498Szrj 491738fd1498Szrj static inline tree * 491838fd1498Szrj gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt) 491938fd1498Szrj { 492038fd1498Szrj return &crit_stmt->clauses; 492138fd1498Szrj } 492238fd1498Szrj 492338fd1498Szrj 492438fd1498Szrj /* Set CLAUSES to be the clauses associated with OMP critical statement 492538fd1498Szrj CRIT_STMT. */ 492638fd1498Szrj 492738fd1498Szrj static inline void 492838fd1498Szrj gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses) 492938fd1498Szrj { 493038fd1498Szrj crit_stmt->clauses = clauses; 493138fd1498Szrj } 493238fd1498Szrj 493338fd1498Szrj 493438fd1498Szrj /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */ 493538fd1498Szrj 493638fd1498Szrj static inline tree 493738fd1498Szrj gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt) 493838fd1498Szrj { 493938fd1498Szrj return ord_stmt->clauses; 494038fd1498Szrj } 494138fd1498Szrj 494238fd1498Szrj 494338fd1498Szrj /* Return a pointer to the clauses associated with OMP ordered statement 494438fd1498Szrj ORD_STMT. */ 494538fd1498Szrj 494638fd1498Szrj static inline tree * 494738fd1498Szrj gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt) 494838fd1498Szrj { 494938fd1498Szrj return &ord_stmt->clauses; 495038fd1498Szrj } 495138fd1498Szrj 495238fd1498Szrj 495338fd1498Szrj /* Set CLAUSES to be the clauses associated with OMP ordered statement 495438fd1498Szrj ORD_STMT. */ 495538fd1498Szrj 495638fd1498Szrj static inline void 495738fd1498Szrj gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses) 495838fd1498Szrj { 495938fd1498Szrj ord_stmt->clauses = clauses; 496038fd1498Szrj } 496138fd1498Szrj 496238fd1498Szrj 496338fd1498Szrj /* Return the kind of the OMP_FOR statemement G. */ 496438fd1498Szrj 496538fd1498Szrj static inline int 496638fd1498Szrj gimple_omp_for_kind (const gimple *g) 496738fd1498Szrj { 496838fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_FOR); 496938fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK); 497038fd1498Szrj } 497138fd1498Szrj 497238fd1498Szrj 497338fd1498Szrj /* Set the kind of the OMP_FOR statement G. */ 497438fd1498Szrj 497538fd1498Szrj static inline void 497638fd1498Szrj gimple_omp_for_set_kind (gomp_for *g, int kind) 497738fd1498Szrj { 497838fd1498Szrj g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK) 497938fd1498Szrj | (kind & GF_OMP_FOR_KIND_MASK); 498038fd1498Szrj } 498138fd1498Szrj 498238fd1498Szrj 498338fd1498Szrj /* Return true if OMP_FOR statement G has the 498438fd1498Szrj GF_OMP_FOR_COMBINED flag set. */ 498538fd1498Szrj 498638fd1498Szrj static inline bool 498738fd1498Szrj gimple_omp_for_combined_p (const gimple *g) 498838fd1498Szrj { 498938fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_FOR); 499038fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0; 499138fd1498Szrj } 499238fd1498Szrj 499338fd1498Szrj 499438fd1498Szrj /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on 499538fd1498Szrj the boolean value of COMBINED_P. */ 499638fd1498Szrj 499738fd1498Szrj static inline void 499838fd1498Szrj gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p) 499938fd1498Szrj { 500038fd1498Szrj if (combined_p) 500138fd1498Szrj g->subcode |= GF_OMP_FOR_COMBINED; 500238fd1498Szrj else 500338fd1498Szrj g->subcode &= ~GF_OMP_FOR_COMBINED; 500438fd1498Szrj } 500538fd1498Szrj 500638fd1498Szrj 500738fd1498Szrj /* Return true if the OMP_FOR statement G has the 500838fd1498Szrj GF_OMP_FOR_COMBINED_INTO flag set. */ 500938fd1498Szrj 501038fd1498Szrj static inline bool 501138fd1498Szrj gimple_omp_for_combined_into_p (const gimple *g) 501238fd1498Szrj { 501338fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_FOR); 501438fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0; 501538fd1498Szrj } 501638fd1498Szrj 501738fd1498Szrj 501838fd1498Szrj /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending 501938fd1498Szrj on the boolean value of COMBINED_P. */ 502038fd1498Szrj 502138fd1498Szrj static inline void 502238fd1498Szrj gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p) 502338fd1498Szrj { 502438fd1498Szrj if (combined_p) 502538fd1498Szrj g->subcode |= GF_OMP_FOR_COMBINED_INTO; 502638fd1498Szrj else 502738fd1498Szrj g->subcode &= ~GF_OMP_FOR_COMBINED_INTO; 502838fd1498Szrj } 502938fd1498Szrj 503038fd1498Szrj 503138fd1498Szrj /* Return the clauses associated with the OMP_FOR statement GS. */ 503238fd1498Szrj 503338fd1498Szrj static inline tree 503438fd1498Szrj gimple_omp_for_clauses (const gimple *gs) 503538fd1498Szrj { 503638fd1498Szrj const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); 503738fd1498Szrj return omp_for_stmt->clauses; 503838fd1498Szrj } 503938fd1498Szrj 504038fd1498Szrj 504138fd1498Szrj /* Return a pointer to the clauses associated with the OMP_FOR statement 504238fd1498Szrj GS. */ 504338fd1498Szrj 504438fd1498Szrj static inline tree * 504538fd1498Szrj gimple_omp_for_clauses_ptr (gimple *gs) 504638fd1498Szrj { 504738fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 504838fd1498Szrj return &omp_for_stmt->clauses; 504938fd1498Szrj } 505038fd1498Szrj 505138fd1498Szrj 505238fd1498Szrj /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement 505338fd1498Szrj GS. */ 505438fd1498Szrj 505538fd1498Szrj static inline void 505638fd1498Szrj gimple_omp_for_set_clauses (gimple *gs, tree clauses) 505738fd1498Szrj { 505838fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 505938fd1498Szrj omp_for_stmt->clauses = clauses; 506038fd1498Szrj } 506138fd1498Szrj 506238fd1498Szrj 506338fd1498Szrj /* Get the collapse count of the OMP_FOR statement GS. */ 506438fd1498Szrj 506538fd1498Szrj static inline size_t 506638fd1498Szrj gimple_omp_for_collapse (gimple *gs) 506738fd1498Szrj { 506838fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 506938fd1498Szrj return omp_for_stmt->collapse; 507038fd1498Szrj } 507138fd1498Szrj 507238fd1498Szrj 507338fd1498Szrj /* Return the condition code associated with the OMP_FOR statement GS. */ 507438fd1498Szrj 507538fd1498Szrj static inline enum tree_code 507638fd1498Szrj gimple_omp_for_cond (const gimple *gs, size_t i) 507738fd1498Szrj { 507838fd1498Szrj const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); 507938fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 508038fd1498Szrj return omp_for_stmt->iter[i].cond; 508138fd1498Szrj } 508238fd1498Szrj 508338fd1498Szrj 508438fd1498Szrj /* Set COND to be the condition code for the OMP_FOR statement GS. */ 508538fd1498Szrj 508638fd1498Szrj static inline void 508738fd1498Szrj gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond) 508838fd1498Szrj { 508938fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 509038fd1498Szrj gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison 509138fd1498Szrj && i < omp_for_stmt->collapse); 509238fd1498Szrj omp_for_stmt->iter[i].cond = cond; 509338fd1498Szrj } 509438fd1498Szrj 509538fd1498Szrj 509638fd1498Szrj /* Return the index variable for the OMP_FOR statement GS. */ 509738fd1498Szrj 509838fd1498Szrj static inline tree 509938fd1498Szrj gimple_omp_for_index (const gimple *gs, size_t i) 510038fd1498Szrj { 510138fd1498Szrj const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); 510238fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 510338fd1498Szrj return omp_for_stmt->iter[i].index; 510438fd1498Szrj } 510538fd1498Szrj 510638fd1498Szrj 510738fd1498Szrj /* Return a pointer to the index variable for the OMP_FOR statement GS. */ 510838fd1498Szrj 510938fd1498Szrj static inline tree * 511038fd1498Szrj gimple_omp_for_index_ptr (gimple *gs, size_t i) 511138fd1498Szrj { 511238fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 511338fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 511438fd1498Szrj return &omp_for_stmt->iter[i].index; 511538fd1498Szrj } 511638fd1498Szrj 511738fd1498Szrj 511838fd1498Szrj /* Set INDEX to be the index variable for the OMP_FOR statement GS. */ 511938fd1498Szrj 512038fd1498Szrj static inline void 512138fd1498Szrj gimple_omp_for_set_index (gimple *gs, size_t i, tree index) 512238fd1498Szrj { 512338fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 512438fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 512538fd1498Szrj omp_for_stmt->iter[i].index = index; 512638fd1498Szrj } 512738fd1498Szrj 512838fd1498Szrj 512938fd1498Szrj /* Return the initial value for the OMP_FOR statement GS. */ 513038fd1498Szrj 513138fd1498Szrj static inline tree 513238fd1498Szrj gimple_omp_for_initial (const gimple *gs, size_t i) 513338fd1498Szrj { 513438fd1498Szrj const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); 513538fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 513638fd1498Szrj return omp_for_stmt->iter[i].initial; 513738fd1498Szrj } 513838fd1498Szrj 513938fd1498Szrj 514038fd1498Szrj /* Return a pointer to the initial value for the OMP_FOR statement GS. */ 514138fd1498Szrj 514238fd1498Szrj static inline tree * 514338fd1498Szrj gimple_omp_for_initial_ptr (gimple *gs, size_t i) 514438fd1498Szrj { 514538fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 514638fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 514738fd1498Szrj return &omp_for_stmt->iter[i].initial; 514838fd1498Szrj } 514938fd1498Szrj 515038fd1498Szrj 515138fd1498Szrj /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */ 515238fd1498Szrj 515338fd1498Szrj static inline void 515438fd1498Szrj gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial) 515538fd1498Szrj { 515638fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 515738fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 515838fd1498Szrj omp_for_stmt->iter[i].initial = initial; 515938fd1498Szrj } 516038fd1498Szrj 516138fd1498Szrj 516238fd1498Szrj /* Return the final value for the OMP_FOR statement GS. */ 516338fd1498Szrj 516438fd1498Szrj static inline tree 516538fd1498Szrj gimple_omp_for_final (const gimple *gs, size_t i) 516638fd1498Szrj { 516738fd1498Szrj const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); 516838fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 516938fd1498Szrj return omp_for_stmt->iter[i].final; 517038fd1498Szrj } 517138fd1498Szrj 517238fd1498Szrj 517338fd1498Szrj /* Return a pointer to the final value for the OMP_FOR statement GS. */ 517438fd1498Szrj 517538fd1498Szrj static inline tree * 517638fd1498Szrj gimple_omp_for_final_ptr (gimple *gs, size_t i) 517738fd1498Szrj { 517838fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 517938fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 518038fd1498Szrj return &omp_for_stmt->iter[i].final; 518138fd1498Szrj } 518238fd1498Szrj 518338fd1498Szrj 518438fd1498Szrj /* Set FINAL to be the final value for the OMP_FOR statement GS. */ 518538fd1498Szrj 518638fd1498Szrj static inline void 518738fd1498Szrj gimple_omp_for_set_final (gimple *gs, size_t i, tree final) 518838fd1498Szrj { 518938fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 519038fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 519138fd1498Szrj omp_for_stmt->iter[i].final = final; 519238fd1498Szrj } 519338fd1498Szrj 519438fd1498Szrj 519538fd1498Szrj /* Return the increment value for the OMP_FOR statement GS. */ 519638fd1498Szrj 519738fd1498Szrj static inline tree 519838fd1498Szrj gimple_omp_for_incr (const gimple *gs, size_t i) 519938fd1498Szrj { 520038fd1498Szrj const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); 520138fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 520238fd1498Szrj return omp_for_stmt->iter[i].incr; 520338fd1498Szrj } 520438fd1498Szrj 520538fd1498Szrj 520638fd1498Szrj /* Return a pointer to the increment value for the OMP_FOR statement GS. */ 520738fd1498Szrj 520838fd1498Szrj static inline tree * 520938fd1498Szrj gimple_omp_for_incr_ptr (gimple *gs, size_t i) 521038fd1498Szrj { 521138fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 521238fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 521338fd1498Szrj return &omp_for_stmt->iter[i].incr; 521438fd1498Szrj } 521538fd1498Szrj 521638fd1498Szrj 521738fd1498Szrj /* Set INCR to be the increment value for the OMP_FOR statement GS. */ 521838fd1498Szrj 521938fd1498Szrj static inline void 522038fd1498Szrj gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr) 522138fd1498Szrj { 522238fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 522338fd1498Szrj gcc_gimple_checking_assert (i < omp_for_stmt->collapse); 522438fd1498Szrj omp_for_stmt->iter[i].incr = incr; 522538fd1498Szrj } 522638fd1498Szrj 522738fd1498Szrj 522838fd1498Szrj /* Return a pointer to the sequence of statements to execute before the OMP_FOR 522938fd1498Szrj statement GS starts. */ 523038fd1498Szrj 523138fd1498Szrj static inline gimple_seq * 523238fd1498Szrj gimple_omp_for_pre_body_ptr (gimple *gs) 523338fd1498Szrj { 523438fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 523538fd1498Szrj return &omp_for_stmt->pre_body; 523638fd1498Szrj } 523738fd1498Szrj 523838fd1498Szrj 523938fd1498Szrj /* Return the sequence of statements to execute before the OMP_FOR 524038fd1498Szrj statement GS starts. */ 524138fd1498Szrj 524238fd1498Szrj static inline gimple_seq 524338fd1498Szrj gimple_omp_for_pre_body (gimple *gs) 524438fd1498Szrj { 524538fd1498Szrj return *gimple_omp_for_pre_body_ptr (gs); 524638fd1498Szrj } 524738fd1498Szrj 524838fd1498Szrj 524938fd1498Szrj /* Set PRE_BODY to be the sequence of statements to execute before the 525038fd1498Szrj OMP_FOR statement GS starts. */ 525138fd1498Szrj 525238fd1498Szrj static inline void 525338fd1498Szrj gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body) 525438fd1498Szrj { 525538fd1498Szrj gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 525638fd1498Szrj omp_for_stmt->pre_body = pre_body; 525738fd1498Szrj } 525838fd1498Szrj 525938fd1498Szrj /* Return the kernel_phony of OMP_FOR statement. */ 526038fd1498Szrj 526138fd1498Szrj static inline bool 526238fd1498Szrj gimple_omp_for_grid_phony (const gomp_for *omp_for) 526338fd1498Szrj { 526438fd1498Szrj gcc_checking_assert (gimple_omp_for_kind (omp_for) 526538fd1498Szrj != GF_OMP_FOR_KIND_GRID_LOOP); 526638fd1498Szrj return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0; 526738fd1498Szrj } 526838fd1498Szrj 526938fd1498Szrj /* Set kernel_phony flag of OMP_FOR to VALUE. */ 527038fd1498Szrj 527138fd1498Szrj static inline void 527238fd1498Szrj gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value) 527338fd1498Szrj { 527438fd1498Szrj gcc_checking_assert (gimple_omp_for_kind (omp_for) 527538fd1498Szrj != GF_OMP_FOR_KIND_GRID_LOOP); 527638fd1498Szrj if (value) 527738fd1498Szrj omp_for->subcode |= GF_OMP_FOR_GRID_PHONY; 527838fd1498Szrj else 527938fd1498Szrj omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY; 528038fd1498Szrj } 528138fd1498Szrj 528238fd1498Szrj /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */ 528338fd1498Szrj 528438fd1498Szrj static inline bool 528538fd1498Szrj gimple_omp_for_grid_intra_group (const gomp_for *omp_for) 528638fd1498Szrj { 528738fd1498Szrj gcc_checking_assert (gimple_omp_for_kind (omp_for) 528838fd1498Szrj == GF_OMP_FOR_KIND_GRID_LOOP); 528938fd1498Szrj return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0; 529038fd1498Szrj } 529138fd1498Szrj 529238fd1498Szrj /* Set kernel_intra_group flag of OMP_FOR to VALUE. */ 529338fd1498Szrj 529438fd1498Szrj static inline void 529538fd1498Szrj gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value) 529638fd1498Szrj { 529738fd1498Szrj gcc_checking_assert (gimple_omp_for_kind (omp_for) 529838fd1498Szrj == GF_OMP_FOR_KIND_GRID_LOOP); 529938fd1498Szrj if (value) 530038fd1498Szrj omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP; 530138fd1498Szrj else 530238fd1498Szrj omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP; 530338fd1498Szrj } 530438fd1498Szrj 530538fd1498Szrj /* Return true if iterations of a grid OMP_FOR statement correspond to HSA 530638fd1498Szrj groups. */ 530738fd1498Szrj 530838fd1498Szrj static inline bool 530938fd1498Szrj gimple_omp_for_grid_group_iter (const gomp_for *omp_for) 531038fd1498Szrj { 531138fd1498Szrj gcc_checking_assert (gimple_omp_for_kind (omp_for) 531238fd1498Szrj == GF_OMP_FOR_KIND_GRID_LOOP); 531338fd1498Szrj return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0; 531438fd1498Szrj } 531538fd1498Szrj 531638fd1498Szrj /* Set group_iter flag of OMP_FOR to VALUE. */ 531738fd1498Szrj 531838fd1498Szrj static inline void 531938fd1498Szrj gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value) 532038fd1498Szrj { 532138fd1498Szrj gcc_checking_assert (gimple_omp_for_kind (omp_for) 532238fd1498Szrj == GF_OMP_FOR_KIND_GRID_LOOP); 532338fd1498Szrj if (value) 532438fd1498Szrj omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER; 532538fd1498Szrj else 532638fd1498Szrj omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER; 532738fd1498Szrj } 532838fd1498Szrj 532938fd1498Szrj /* Return the clauses associated with OMP_PARALLEL GS. */ 533038fd1498Szrj 533138fd1498Szrj static inline tree 533238fd1498Szrj gimple_omp_parallel_clauses (const gimple *gs) 533338fd1498Szrj { 533438fd1498Szrj const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs); 533538fd1498Szrj return omp_parallel_stmt->clauses; 533638fd1498Szrj } 533738fd1498Szrj 533838fd1498Szrj 533938fd1498Szrj /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */ 534038fd1498Szrj 534138fd1498Szrj static inline tree * 534238fd1498Szrj gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt) 534338fd1498Szrj { 534438fd1498Szrj return &omp_parallel_stmt->clauses; 534538fd1498Szrj } 534638fd1498Szrj 534738fd1498Szrj 534838fd1498Szrj /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */ 534938fd1498Szrj 535038fd1498Szrj static inline void 535138fd1498Szrj gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt, 535238fd1498Szrj tree clauses) 535338fd1498Szrj { 535438fd1498Szrj omp_parallel_stmt->clauses = clauses; 535538fd1498Szrj } 535638fd1498Szrj 535738fd1498Szrj 535838fd1498Szrj /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */ 535938fd1498Szrj 536038fd1498Szrj static inline tree 536138fd1498Szrj gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt) 536238fd1498Szrj { 536338fd1498Szrj return omp_parallel_stmt->child_fn; 536438fd1498Szrj } 536538fd1498Szrj 536638fd1498Szrj /* Return a pointer to the child function used to hold the body of 536738fd1498Szrj OMP_PARALLEL_STMT. */ 536838fd1498Szrj 536938fd1498Szrj static inline tree * 537038fd1498Szrj gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt) 537138fd1498Szrj { 537238fd1498Szrj return &omp_parallel_stmt->child_fn; 537338fd1498Szrj } 537438fd1498Szrj 537538fd1498Szrj 537638fd1498Szrj /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */ 537738fd1498Szrj 537838fd1498Szrj static inline void 537938fd1498Szrj gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt, 538038fd1498Szrj tree child_fn) 538138fd1498Szrj { 538238fd1498Szrj omp_parallel_stmt->child_fn = child_fn; 538338fd1498Szrj } 538438fd1498Szrj 538538fd1498Szrj 538638fd1498Szrj /* Return the artificial argument used to send variables and values 538738fd1498Szrj from the parent to the children threads in OMP_PARALLEL_STMT. */ 538838fd1498Szrj 538938fd1498Szrj static inline tree 539038fd1498Szrj gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt) 539138fd1498Szrj { 539238fd1498Szrj return omp_parallel_stmt->data_arg; 539338fd1498Szrj } 539438fd1498Szrj 539538fd1498Szrj 539638fd1498Szrj /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */ 539738fd1498Szrj 539838fd1498Szrj static inline tree * 539938fd1498Szrj gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt) 540038fd1498Szrj { 540138fd1498Szrj return &omp_parallel_stmt->data_arg; 540238fd1498Szrj } 540338fd1498Szrj 540438fd1498Szrj 540538fd1498Szrj /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */ 540638fd1498Szrj 540738fd1498Szrj static inline void 540838fd1498Szrj gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt, 540938fd1498Szrj tree data_arg) 541038fd1498Szrj { 541138fd1498Szrj omp_parallel_stmt->data_arg = data_arg; 541238fd1498Szrj } 541338fd1498Szrj 541438fd1498Szrj /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */ 541538fd1498Szrj 541638fd1498Szrj static inline bool 541738fd1498Szrj gimple_omp_parallel_grid_phony (const gomp_parallel *stmt) 541838fd1498Szrj { 541938fd1498Szrj return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0; 542038fd1498Szrj } 542138fd1498Szrj 542238fd1498Szrj /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */ 542338fd1498Szrj 542438fd1498Szrj static inline void 542538fd1498Szrj gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value) 542638fd1498Szrj { 542738fd1498Szrj if (value) 542838fd1498Szrj stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY; 542938fd1498Szrj else 543038fd1498Szrj stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY; 543138fd1498Szrj } 543238fd1498Szrj 543338fd1498Szrj /* Return the clauses associated with OMP_TASK GS. */ 543438fd1498Szrj 543538fd1498Szrj static inline tree 543638fd1498Szrj gimple_omp_task_clauses (const gimple *gs) 543738fd1498Szrj { 543838fd1498Szrj const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); 543938fd1498Szrj return omp_task_stmt->clauses; 544038fd1498Szrj } 544138fd1498Szrj 544238fd1498Szrj 544338fd1498Szrj /* Return a pointer to the clauses associated with OMP_TASK GS. */ 544438fd1498Szrj 544538fd1498Szrj static inline tree * 544638fd1498Szrj gimple_omp_task_clauses_ptr (gimple *gs) 544738fd1498Szrj { 544838fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 544938fd1498Szrj return &omp_task_stmt->clauses; 545038fd1498Szrj } 545138fd1498Szrj 545238fd1498Szrj 545338fd1498Szrj /* Set CLAUSES to be the list of clauses associated with OMP_TASK 545438fd1498Szrj GS. */ 545538fd1498Szrj 545638fd1498Szrj static inline void 545738fd1498Szrj gimple_omp_task_set_clauses (gimple *gs, tree clauses) 545838fd1498Szrj { 545938fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 546038fd1498Szrj omp_task_stmt->clauses = clauses; 546138fd1498Szrj } 546238fd1498Szrj 546338fd1498Szrj 546438fd1498Szrj /* Return true if OMP task statement G has the 546538fd1498Szrj GF_OMP_TASK_TASKLOOP flag set. */ 546638fd1498Szrj 546738fd1498Szrj static inline bool 546838fd1498Szrj gimple_omp_task_taskloop_p (const gimple *g) 546938fd1498Szrj { 547038fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_TASK); 547138fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0; 547238fd1498Szrj } 547338fd1498Szrj 547438fd1498Szrj 547538fd1498Szrj /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean 547638fd1498Szrj value of TASKLOOP_P. */ 547738fd1498Szrj 547838fd1498Szrj static inline void 547938fd1498Szrj gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p) 548038fd1498Szrj { 548138fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_TASK); 548238fd1498Szrj if (taskloop_p) 548338fd1498Szrj g->subcode |= GF_OMP_TASK_TASKLOOP; 548438fd1498Szrj else 548538fd1498Szrj g->subcode &= ~GF_OMP_TASK_TASKLOOP; 548638fd1498Szrj } 548738fd1498Szrj 548838fd1498Szrj 548938fd1498Szrj /* Return the child function used to hold the body of OMP_TASK GS. */ 549038fd1498Szrj 549138fd1498Szrj static inline tree 549238fd1498Szrj gimple_omp_task_child_fn (const gimple *gs) 549338fd1498Szrj { 549438fd1498Szrj const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); 549538fd1498Szrj return omp_task_stmt->child_fn; 549638fd1498Szrj } 549738fd1498Szrj 549838fd1498Szrj /* Return a pointer to the child function used to hold the body of 549938fd1498Szrj OMP_TASK GS. */ 550038fd1498Szrj 550138fd1498Szrj static inline tree * 550238fd1498Szrj gimple_omp_task_child_fn_ptr (gimple *gs) 550338fd1498Szrj { 550438fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 550538fd1498Szrj return &omp_task_stmt->child_fn; 550638fd1498Szrj } 550738fd1498Szrj 550838fd1498Szrj 550938fd1498Szrj /* Set CHILD_FN to be the child function for OMP_TASK GS. */ 551038fd1498Szrj 551138fd1498Szrj static inline void 551238fd1498Szrj gimple_omp_task_set_child_fn (gimple *gs, tree child_fn) 551338fd1498Szrj { 551438fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 551538fd1498Szrj omp_task_stmt->child_fn = child_fn; 551638fd1498Szrj } 551738fd1498Szrj 551838fd1498Szrj 551938fd1498Szrj /* Return the artificial argument used to send variables and values 552038fd1498Szrj from the parent to the children threads in OMP_TASK GS. */ 552138fd1498Szrj 552238fd1498Szrj static inline tree 552338fd1498Szrj gimple_omp_task_data_arg (const gimple *gs) 552438fd1498Szrj { 552538fd1498Szrj const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); 552638fd1498Szrj return omp_task_stmt->data_arg; 552738fd1498Szrj } 552838fd1498Szrj 552938fd1498Szrj 553038fd1498Szrj /* Return a pointer to the data argument for OMP_TASK GS. */ 553138fd1498Szrj 553238fd1498Szrj static inline tree * 553338fd1498Szrj gimple_omp_task_data_arg_ptr (gimple *gs) 553438fd1498Szrj { 553538fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 553638fd1498Szrj return &omp_task_stmt->data_arg; 553738fd1498Szrj } 553838fd1498Szrj 553938fd1498Szrj 554038fd1498Szrj /* Set DATA_ARG to be the data argument for OMP_TASK GS. */ 554138fd1498Szrj 554238fd1498Szrj static inline void 554338fd1498Szrj gimple_omp_task_set_data_arg (gimple *gs, tree data_arg) 554438fd1498Szrj { 554538fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 554638fd1498Szrj omp_task_stmt->data_arg = data_arg; 554738fd1498Szrj } 554838fd1498Szrj 554938fd1498Szrj 555038fd1498Szrj /* Return the clauses associated with OMP_TASK GS. */ 555138fd1498Szrj 555238fd1498Szrj static inline tree 555338fd1498Szrj gimple_omp_taskreg_clauses (const gimple *gs) 555438fd1498Szrj { 555538fd1498Szrj const gimple_statement_omp_taskreg *omp_taskreg_stmt 555638fd1498Szrj = as_a <const gimple_statement_omp_taskreg *> (gs); 555738fd1498Szrj return omp_taskreg_stmt->clauses; 555838fd1498Szrj } 555938fd1498Szrj 556038fd1498Szrj 556138fd1498Szrj /* Return a pointer to the clauses associated with OMP_TASK GS. */ 556238fd1498Szrj 556338fd1498Szrj static inline tree * 556438fd1498Szrj gimple_omp_taskreg_clauses_ptr (gimple *gs) 556538fd1498Szrj { 556638fd1498Szrj gimple_statement_omp_taskreg *omp_taskreg_stmt 556738fd1498Szrj = as_a <gimple_statement_omp_taskreg *> (gs); 556838fd1498Szrj return &omp_taskreg_stmt->clauses; 556938fd1498Szrj } 557038fd1498Szrj 557138fd1498Szrj 557238fd1498Szrj /* Set CLAUSES to be the list of clauses associated with OMP_TASK 557338fd1498Szrj GS. */ 557438fd1498Szrj 557538fd1498Szrj static inline void 557638fd1498Szrj gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses) 557738fd1498Szrj { 557838fd1498Szrj gimple_statement_omp_taskreg *omp_taskreg_stmt 557938fd1498Szrj = as_a <gimple_statement_omp_taskreg *> (gs); 558038fd1498Szrj omp_taskreg_stmt->clauses = clauses; 558138fd1498Szrj } 558238fd1498Szrj 558338fd1498Szrj 558438fd1498Szrj /* Return the child function used to hold the body of OMP_TASK GS. */ 558538fd1498Szrj 558638fd1498Szrj static inline tree 558738fd1498Szrj gimple_omp_taskreg_child_fn (const gimple *gs) 558838fd1498Szrj { 558938fd1498Szrj const gimple_statement_omp_taskreg *omp_taskreg_stmt 559038fd1498Szrj = as_a <const gimple_statement_omp_taskreg *> (gs); 559138fd1498Szrj return omp_taskreg_stmt->child_fn; 559238fd1498Szrj } 559338fd1498Szrj 559438fd1498Szrj /* Return a pointer to the child function used to hold the body of 559538fd1498Szrj OMP_TASK GS. */ 559638fd1498Szrj 559738fd1498Szrj static inline tree * 559838fd1498Szrj gimple_omp_taskreg_child_fn_ptr (gimple *gs) 559938fd1498Szrj { 560038fd1498Szrj gimple_statement_omp_taskreg *omp_taskreg_stmt 560138fd1498Szrj = as_a <gimple_statement_omp_taskreg *> (gs); 560238fd1498Szrj return &omp_taskreg_stmt->child_fn; 560338fd1498Szrj } 560438fd1498Szrj 560538fd1498Szrj 560638fd1498Szrj /* Set CHILD_FN to be the child function for OMP_TASK GS. */ 560738fd1498Szrj 560838fd1498Szrj static inline void 560938fd1498Szrj gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn) 561038fd1498Szrj { 561138fd1498Szrj gimple_statement_omp_taskreg *omp_taskreg_stmt 561238fd1498Szrj = as_a <gimple_statement_omp_taskreg *> (gs); 561338fd1498Szrj omp_taskreg_stmt->child_fn = child_fn; 561438fd1498Szrj } 561538fd1498Szrj 561638fd1498Szrj 561738fd1498Szrj /* Return the artificial argument used to send variables and values 561838fd1498Szrj from the parent to the children threads in OMP_TASK GS. */ 561938fd1498Szrj 562038fd1498Szrj static inline tree 562138fd1498Szrj gimple_omp_taskreg_data_arg (const gimple *gs) 562238fd1498Szrj { 562338fd1498Szrj const gimple_statement_omp_taskreg *omp_taskreg_stmt 562438fd1498Szrj = as_a <const gimple_statement_omp_taskreg *> (gs); 562538fd1498Szrj return omp_taskreg_stmt->data_arg; 562638fd1498Szrj } 562738fd1498Szrj 562838fd1498Szrj 562938fd1498Szrj /* Return a pointer to the data argument for OMP_TASK GS. */ 563038fd1498Szrj 563138fd1498Szrj static inline tree * 563238fd1498Szrj gimple_omp_taskreg_data_arg_ptr (gimple *gs) 563338fd1498Szrj { 563438fd1498Szrj gimple_statement_omp_taskreg *omp_taskreg_stmt 563538fd1498Szrj = as_a <gimple_statement_omp_taskreg *> (gs); 563638fd1498Szrj return &omp_taskreg_stmt->data_arg; 563738fd1498Szrj } 563838fd1498Szrj 563938fd1498Szrj 564038fd1498Szrj /* Set DATA_ARG to be the data argument for OMP_TASK GS. */ 564138fd1498Szrj 564238fd1498Szrj static inline void 564338fd1498Szrj gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg) 564438fd1498Szrj { 564538fd1498Szrj gimple_statement_omp_taskreg *omp_taskreg_stmt 564638fd1498Szrj = as_a <gimple_statement_omp_taskreg *> (gs); 564738fd1498Szrj omp_taskreg_stmt->data_arg = data_arg; 564838fd1498Szrj } 564938fd1498Szrj 565038fd1498Szrj 565138fd1498Szrj /* Return the copy function used to hold the body of OMP_TASK GS. */ 565238fd1498Szrj 565338fd1498Szrj static inline tree 565438fd1498Szrj gimple_omp_task_copy_fn (const gimple *gs) 565538fd1498Szrj { 565638fd1498Szrj const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); 565738fd1498Szrj return omp_task_stmt->copy_fn; 565838fd1498Szrj } 565938fd1498Szrj 566038fd1498Szrj /* Return a pointer to the copy function used to hold the body of 566138fd1498Szrj OMP_TASK GS. */ 566238fd1498Szrj 566338fd1498Szrj static inline tree * 566438fd1498Szrj gimple_omp_task_copy_fn_ptr (gimple *gs) 566538fd1498Szrj { 566638fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 566738fd1498Szrj return &omp_task_stmt->copy_fn; 566838fd1498Szrj } 566938fd1498Szrj 567038fd1498Szrj 567138fd1498Szrj /* Set CHILD_FN to be the copy function for OMP_TASK GS. */ 567238fd1498Szrj 567338fd1498Szrj static inline void 567438fd1498Szrj gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn) 567538fd1498Szrj { 567638fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 567738fd1498Szrj omp_task_stmt->copy_fn = copy_fn; 567838fd1498Szrj } 567938fd1498Szrj 568038fd1498Szrj 568138fd1498Szrj /* Return size of the data block in bytes in OMP_TASK GS. */ 568238fd1498Szrj 568338fd1498Szrj static inline tree 568438fd1498Szrj gimple_omp_task_arg_size (const gimple *gs) 568538fd1498Szrj { 568638fd1498Szrj const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); 568738fd1498Szrj return omp_task_stmt->arg_size; 568838fd1498Szrj } 568938fd1498Szrj 569038fd1498Szrj 569138fd1498Szrj /* Return a pointer to the data block size for OMP_TASK GS. */ 569238fd1498Szrj 569338fd1498Szrj static inline tree * 569438fd1498Szrj gimple_omp_task_arg_size_ptr (gimple *gs) 569538fd1498Szrj { 569638fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 569738fd1498Szrj return &omp_task_stmt->arg_size; 569838fd1498Szrj } 569938fd1498Szrj 570038fd1498Szrj 570138fd1498Szrj /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */ 570238fd1498Szrj 570338fd1498Szrj static inline void 570438fd1498Szrj gimple_omp_task_set_arg_size (gimple *gs, tree arg_size) 570538fd1498Szrj { 570638fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 570738fd1498Szrj omp_task_stmt->arg_size = arg_size; 570838fd1498Szrj } 570938fd1498Szrj 571038fd1498Szrj 571138fd1498Szrj /* Return align of the data block in bytes in OMP_TASK GS. */ 571238fd1498Szrj 571338fd1498Szrj static inline tree 571438fd1498Szrj gimple_omp_task_arg_align (const gimple *gs) 571538fd1498Szrj { 571638fd1498Szrj const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); 571738fd1498Szrj return omp_task_stmt->arg_align; 571838fd1498Szrj } 571938fd1498Szrj 572038fd1498Szrj 572138fd1498Szrj /* Return a pointer to the data block align for OMP_TASK GS. */ 572238fd1498Szrj 572338fd1498Szrj static inline tree * 572438fd1498Szrj gimple_omp_task_arg_align_ptr (gimple *gs) 572538fd1498Szrj { 572638fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 572738fd1498Szrj return &omp_task_stmt->arg_align; 572838fd1498Szrj } 572938fd1498Szrj 573038fd1498Szrj 573138fd1498Szrj /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */ 573238fd1498Szrj 573338fd1498Szrj static inline void 573438fd1498Szrj gimple_omp_task_set_arg_align (gimple *gs, tree arg_align) 573538fd1498Szrj { 573638fd1498Szrj gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); 573738fd1498Szrj omp_task_stmt->arg_align = arg_align; 573838fd1498Szrj } 573938fd1498Szrj 574038fd1498Szrj 574138fd1498Szrj /* Return the clauses associated with OMP_SINGLE GS. */ 574238fd1498Szrj 574338fd1498Szrj static inline tree 574438fd1498Szrj gimple_omp_single_clauses (const gimple *gs) 574538fd1498Szrj { 574638fd1498Szrj const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs); 574738fd1498Szrj return omp_single_stmt->clauses; 574838fd1498Szrj } 574938fd1498Szrj 575038fd1498Szrj 575138fd1498Szrj /* Return a pointer to the clauses associated with OMP_SINGLE GS. */ 575238fd1498Szrj 575338fd1498Szrj static inline tree * 575438fd1498Szrj gimple_omp_single_clauses_ptr (gimple *gs) 575538fd1498Szrj { 575638fd1498Szrj gomp_single *omp_single_stmt = as_a <gomp_single *> (gs); 575738fd1498Szrj return &omp_single_stmt->clauses; 575838fd1498Szrj } 575938fd1498Szrj 576038fd1498Szrj 576138fd1498Szrj /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */ 576238fd1498Szrj 576338fd1498Szrj static inline void 576438fd1498Szrj gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses) 576538fd1498Szrj { 576638fd1498Szrj omp_single_stmt->clauses = clauses; 576738fd1498Szrj } 576838fd1498Szrj 576938fd1498Szrj 577038fd1498Szrj /* Return the clauses associated with OMP_TARGET GS. */ 577138fd1498Szrj 577238fd1498Szrj static inline tree 577338fd1498Szrj gimple_omp_target_clauses (const gimple *gs) 577438fd1498Szrj { 577538fd1498Szrj const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs); 577638fd1498Szrj return omp_target_stmt->clauses; 577738fd1498Szrj } 577838fd1498Szrj 577938fd1498Szrj 578038fd1498Szrj /* Return a pointer to the clauses associated with OMP_TARGET GS. */ 578138fd1498Szrj 578238fd1498Szrj static inline tree * 578338fd1498Szrj gimple_omp_target_clauses_ptr (gimple *gs) 578438fd1498Szrj { 578538fd1498Szrj gomp_target *omp_target_stmt = as_a <gomp_target *> (gs); 578638fd1498Szrj return &omp_target_stmt->clauses; 578738fd1498Szrj } 578838fd1498Szrj 578938fd1498Szrj 579038fd1498Szrj /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */ 579138fd1498Szrj 579238fd1498Szrj static inline void 579338fd1498Szrj gimple_omp_target_set_clauses (gomp_target *omp_target_stmt, 579438fd1498Szrj tree clauses) 579538fd1498Szrj { 579638fd1498Szrj omp_target_stmt->clauses = clauses; 579738fd1498Szrj } 579838fd1498Szrj 579938fd1498Szrj 580038fd1498Szrj /* Return the kind of the OMP_TARGET G. */ 580138fd1498Szrj 580238fd1498Szrj static inline int 580338fd1498Szrj gimple_omp_target_kind (const gimple *g) 580438fd1498Szrj { 580538fd1498Szrj GIMPLE_CHECK (g, GIMPLE_OMP_TARGET); 580638fd1498Szrj return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK); 580738fd1498Szrj } 580838fd1498Szrj 580938fd1498Szrj 581038fd1498Szrj /* Set the kind of the OMP_TARGET G. */ 581138fd1498Szrj 581238fd1498Szrj static inline void 581338fd1498Szrj gimple_omp_target_set_kind (gomp_target *g, int kind) 581438fd1498Szrj { 581538fd1498Szrj g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK) 581638fd1498Szrj | (kind & GF_OMP_TARGET_KIND_MASK); 581738fd1498Szrj } 581838fd1498Szrj 581938fd1498Szrj 582038fd1498Szrj /* Return the child function used to hold the body of OMP_TARGET_STMT. */ 582138fd1498Szrj 582238fd1498Szrj static inline tree 582338fd1498Szrj gimple_omp_target_child_fn (const gomp_target *omp_target_stmt) 582438fd1498Szrj { 582538fd1498Szrj return omp_target_stmt->child_fn; 582638fd1498Szrj } 582738fd1498Szrj 582838fd1498Szrj /* Return a pointer to the child function used to hold the body of 582938fd1498Szrj OMP_TARGET_STMT. */ 583038fd1498Szrj 583138fd1498Szrj static inline tree * 583238fd1498Szrj gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt) 583338fd1498Szrj { 583438fd1498Szrj return &omp_target_stmt->child_fn; 583538fd1498Szrj } 583638fd1498Szrj 583738fd1498Szrj 583838fd1498Szrj /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */ 583938fd1498Szrj 584038fd1498Szrj static inline void 584138fd1498Szrj gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt, 584238fd1498Szrj tree child_fn) 584338fd1498Szrj { 584438fd1498Szrj omp_target_stmt->child_fn = child_fn; 584538fd1498Szrj } 584638fd1498Szrj 584738fd1498Szrj 584838fd1498Szrj /* Return the artificial argument used to send variables and values 584938fd1498Szrj from the parent to the children threads in OMP_TARGET_STMT. */ 585038fd1498Szrj 585138fd1498Szrj static inline tree 585238fd1498Szrj gimple_omp_target_data_arg (const gomp_target *omp_target_stmt) 585338fd1498Szrj { 585438fd1498Szrj return omp_target_stmt->data_arg; 585538fd1498Szrj } 585638fd1498Szrj 585738fd1498Szrj 585838fd1498Szrj /* Return a pointer to the data argument for OMP_TARGET GS. */ 585938fd1498Szrj 586038fd1498Szrj static inline tree * 586138fd1498Szrj gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt) 586238fd1498Szrj { 586338fd1498Szrj return &omp_target_stmt->data_arg; 586438fd1498Szrj } 586538fd1498Szrj 586638fd1498Szrj 586738fd1498Szrj /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */ 586838fd1498Szrj 586938fd1498Szrj static inline void 587038fd1498Szrj gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt, 587138fd1498Szrj tree data_arg) 587238fd1498Szrj { 587338fd1498Szrj omp_target_stmt->data_arg = data_arg; 587438fd1498Szrj } 587538fd1498Szrj 587638fd1498Szrj 587738fd1498Szrj /* Return the clauses associated with OMP_TEAMS GS. */ 587838fd1498Szrj 587938fd1498Szrj static inline tree 588038fd1498Szrj gimple_omp_teams_clauses (const gimple *gs) 588138fd1498Szrj { 588238fd1498Szrj const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs); 588338fd1498Szrj return omp_teams_stmt->clauses; 588438fd1498Szrj } 588538fd1498Szrj 588638fd1498Szrj 588738fd1498Szrj /* Return a pointer to the clauses associated with OMP_TEAMS GS. */ 588838fd1498Szrj 588938fd1498Szrj static inline tree * 589038fd1498Szrj gimple_omp_teams_clauses_ptr (gimple *gs) 589138fd1498Szrj { 589238fd1498Szrj gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs); 589338fd1498Szrj return &omp_teams_stmt->clauses; 589438fd1498Szrj } 589538fd1498Szrj 589638fd1498Szrj 589738fd1498Szrj /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */ 589838fd1498Szrj 589938fd1498Szrj static inline void 590038fd1498Szrj gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses) 590138fd1498Szrj { 590238fd1498Szrj omp_teams_stmt->clauses = clauses; 590338fd1498Szrj } 590438fd1498Szrj 590538fd1498Szrj /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */ 590638fd1498Szrj 590738fd1498Szrj static inline bool 590838fd1498Szrj gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt) 590938fd1498Szrj { 591038fd1498Szrj return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0; 591138fd1498Szrj } 591238fd1498Szrj 591338fd1498Szrj /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */ 591438fd1498Szrj 591538fd1498Szrj static inline void 591638fd1498Szrj gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value) 591738fd1498Szrj { 591838fd1498Szrj if (value) 591938fd1498Szrj omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY; 592038fd1498Szrj else 592138fd1498Szrj omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY; 592238fd1498Szrj } 592338fd1498Szrj 592438fd1498Szrj /* Return the clauses associated with OMP_SECTIONS GS. */ 592538fd1498Szrj 592638fd1498Szrj static inline tree 592738fd1498Szrj gimple_omp_sections_clauses (const gimple *gs) 592838fd1498Szrj { 592938fd1498Szrj const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs); 593038fd1498Szrj return omp_sections_stmt->clauses; 593138fd1498Szrj } 593238fd1498Szrj 593338fd1498Szrj 593438fd1498Szrj /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */ 593538fd1498Szrj 593638fd1498Szrj static inline tree * 593738fd1498Szrj gimple_omp_sections_clauses_ptr (gimple *gs) 593838fd1498Szrj { 593938fd1498Szrj gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs); 594038fd1498Szrj return &omp_sections_stmt->clauses; 594138fd1498Szrj } 594238fd1498Szrj 594338fd1498Szrj 594438fd1498Szrj /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS 594538fd1498Szrj GS. */ 594638fd1498Szrj 594738fd1498Szrj static inline void 594838fd1498Szrj gimple_omp_sections_set_clauses (gimple *gs, tree clauses) 594938fd1498Szrj { 595038fd1498Szrj gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs); 595138fd1498Szrj omp_sections_stmt->clauses = clauses; 595238fd1498Szrj } 595338fd1498Szrj 595438fd1498Szrj 595538fd1498Szrj /* Return the control variable associated with the GIMPLE_OMP_SECTIONS 595638fd1498Szrj in GS. */ 595738fd1498Szrj 595838fd1498Szrj static inline tree 595938fd1498Szrj gimple_omp_sections_control (const gimple *gs) 596038fd1498Szrj { 596138fd1498Szrj const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs); 596238fd1498Szrj return omp_sections_stmt->control; 596338fd1498Szrj } 596438fd1498Szrj 596538fd1498Szrj 596638fd1498Szrj /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS 596738fd1498Szrj GS. */ 596838fd1498Szrj 596938fd1498Szrj static inline tree * 597038fd1498Szrj gimple_omp_sections_control_ptr (gimple *gs) 597138fd1498Szrj { 597238fd1498Szrj gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs); 597338fd1498Szrj return &omp_sections_stmt->control; 597438fd1498Szrj } 597538fd1498Szrj 597638fd1498Szrj 597738fd1498Szrj /* Set CONTROL to be the set of clauses associated with the 597838fd1498Szrj GIMPLE_OMP_SECTIONS in GS. */ 597938fd1498Szrj 598038fd1498Szrj static inline void 598138fd1498Szrj gimple_omp_sections_set_control (gimple *gs, tree control) 598238fd1498Szrj { 598338fd1498Szrj gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs); 598438fd1498Szrj omp_sections_stmt->control = control; 598538fd1498Szrj } 598638fd1498Szrj 598738fd1498Szrj 598838fd1498Szrj /* Set the value being stored in an atomic store. */ 598938fd1498Szrj 599038fd1498Szrj static inline void 599138fd1498Szrj gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val) 599238fd1498Szrj { 599338fd1498Szrj store_stmt->val = val; 599438fd1498Szrj } 599538fd1498Szrj 599638fd1498Szrj 599738fd1498Szrj /* Return the value being stored in an atomic store. */ 599838fd1498Szrj 599938fd1498Szrj static inline tree 600038fd1498Szrj gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt) 600138fd1498Szrj { 600238fd1498Szrj return store_stmt->val; 600338fd1498Szrj } 600438fd1498Szrj 600538fd1498Szrj 600638fd1498Szrj /* Return a pointer to the value being stored in an atomic store. */ 600738fd1498Szrj 600838fd1498Szrj static inline tree * 600938fd1498Szrj gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt) 601038fd1498Szrj { 601138fd1498Szrj return &store_stmt->val; 601238fd1498Szrj } 601338fd1498Szrj 601438fd1498Szrj 601538fd1498Szrj /* Set the LHS of an atomic load. */ 601638fd1498Szrj 601738fd1498Szrj static inline void 601838fd1498Szrj gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs) 601938fd1498Szrj { 602038fd1498Szrj load_stmt->lhs = lhs; 602138fd1498Szrj } 602238fd1498Szrj 602338fd1498Szrj 602438fd1498Szrj /* Get the LHS of an atomic load. */ 602538fd1498Szrj 602638fd1498Szrj static inline tree 602738fd1498Szrj gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt) 602838fd1498Szrj { 602938fd1498Szrj return load_stmt->lhs; 603038fd1498Szrj } 603138fd1498Szrj 603238fd1498Szrj 603338fd1498Szrj /* Return a pointer to the LHS of an atomic load. */ 603438fd1498Szrj 603538fd1498Szrj static inline tree * 603638fd1498Szrj gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt) 603738fd1498Szrj { 603838fd1498Szrj return &load_stmt->lhs; 603938fd1498Szrj } 604038fd1498Szrj 604138fd1498Szrj 604238fd1498Szrj /* Set the RHS of an atomic load. */ 604338fd1498Szrj 604438fd1498Szrj static inline void 604538fd1498Szrj gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs) 604638fd1498Szrj { 604738fd1498Szrj load_stmt->rhs = rhs; 604838fd1498Szrj } 604938fd1498Szrj 605038fd1498Szrj 605138fd1498Szrj /* Get the RHS of an atomic load. */ 605238fd1498Szrj 605338fd1498Szrj static inline tree 605438fd1498Szrj gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt) 605538fd1498Szrj { 605638fd1498Szrj return load_stmt->rhs; 605738fd1498Szrj } 605838fd1498Szrj 605938fd1498Szrj 606038fd1498Szrj /* Return a pointer to the RHS of an atomic load. */ 606138fd1498Szrj 606238fd1498Szrj static inline tree * 606338fd1498Szrj gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt) 606438fd1498Szrj { 606538fd1498Szrj return &load_stmt->rhs; 606638fd1498Szrj } 606738fd1498Szrj 606838fd1498Szrj 606938fd1498Szrj /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ 607038fd1498Szrj 607138fd1498Szrj static inline tree 607238fd1498Szrj gimple_omp_continue_control_def (const gomp_continue *cont_stmt) 607338fd1498Szrj { 607438fd1498Szrj return cont_stmt->control_def; 607538fd1498Szrj } 607638fd1498Szrj 607738fd1498Szrj /* The same as above, but return the address. */ 607838fd1498Szrj 607938fd1498Szrj static inline tree * 608038fd1498Szrj gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt) 608138fd1498Szrj { 608238fd1498Szrj return &cont_stmt->control_def; 608338fd1498Szrj } 608438fd1498Szrj 608538fd1498Szrj /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ 608638fd1498Szrj 608738fd1498Szrj static inline void 608838fd1498Szrj gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def) 608938fd1498Szrj { 609038fd1498Szrj cont_stmt->control_def = def; 609138fd1498Szrj } 609238fd1498Szrj 609338fd1498Szrj 609438fd1498Szrj /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */ 609538fd1498Szrj 609638fd1498Szrj static inline tree 609738fd1498Szrj gimple_omp_continue_control_use (const gomp_continue *cont_stmt) 609838fd1498Szrj { 609938fd1498Szrj return cont_stmt->control_use; 610038fd1498Szrj } 610138fd1498Szrj 610238fd1498Szrj 610338fd1498Szrj /* The same as above, but return the address. */ 610438fd1498Szrj 610538fd1498Szrj static inline tree * 610638fd1498Szrj gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt) 610738fd1498Szrj { 610838fd1498Szrj return &cont_stmt->control_use; 610938fd1498Szrj } 611038fd1498Szrj 611138fd1498Szrj 611238fd1498Szrj /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */ 611338fd1498Szrj 611438fd1498Szrj static inline void 611538fd1498Szrj gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use) 611638fd1498Szrj { 611738fd1498Szrj cont_stmt->control_use = use; 611838fd1498Szrj } 611938fd1498Szrj 612038fd1498Szrj /* Return a pointer to the body for the GIMPLE_TRANSACTION statement 612138fd1498Szrj TRANSACTION_STMT. */ 612238fd1498Szrj 612338fd1498Szrj static inline gimple_seq * 612438fd1498Szrj gimple_transaction_body_ptr (gtransaction *transaction_stmt) 612538fd1498Szrj { 612638fd1498Szrj return &transaction_stmt->body; 612738fd1498Szrj } 612838fd1498Szrj 612938fd1498Szrj /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */ 613038fd1498Szrj 613138fd1498Szrj static inline gimple_seq 613238fd1498Szrj gimple_transaction_body (gtransaction *transaction_stmt) 613338fd1498Szrj { 613438fd1498Szrj return transaction_stmt->body; 613538fd1498Szrj } 613638fd1498Szrj 613738fd1498Szrj /* Return the label associated with a GIMPLE_TRANSACTION. */ 613838fd1498Szrj 613938fd1498Szrj static inline tree 614038fd1498Szrj gimple_transaction_label_norm (const gtransaction *transaction_stmt) 614138fd1498Szrj { 614238fd1498Szrj return transaction_stmt->label_norm; 614338fd1498Szrj } 614438fd1498Szrj 614538fd1498Szrj static inline tree * 614638fd1498Szrj gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt) 614738fd1498Szrj { 614838fd1498Szrj return &transaction_stmt->label_norm; 614938fd1498Szrj } 615038fd1498Szrj 615138fd1498Szrj static inline tree 615238fd1498Szrj gimple_transaction_label_uninst (const gtransaction *transaction_stmt) 615338fd1498Szrj { 615438fd1498Szrj return transaction_stmt->label_uninst; 615538fd1498Szrj } 615638fd1498Szrj 615738fd1498Szrj static inline tree * 615838fd1498Szrj gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt) 615938fd1498Szrj { 616038fd1498Szrj return &transaction_stmt->label_uninst; 616138fd1498Szrj } 616238fd1498Szrj 616338fd1498Szrj static inline tree 616438fd1498Szrj gimple_transaction_label_over (const gtransaction *transaction_stmt) 616538fd1498Szrj { 616638fd1498Szrj return transaction_stmt->label_over; 616738fd1498Szrj } 616838fd1498Szrj 616938fd1498Szrj static inline tree * 617038fd1498Szrj gimple_transaction_label_over_ptr (gtransaction *transaction_stmt) 617138fd1498Szrj { 617238fd1498Szrj return &transaction_stmt->label_over; 617338fd1498Szrj } 617438fd1498Szrj 617538fd1498Szrj /* Return the subcode associated with a GIMPLE_TRANSACTION. */ 617638fd1498Szrj 617738fd1498Szrj static inline unsigned int 617838fd1498Szrj gimple_transaction_subcode (const gtransaction *transaction_stmt) 617938fd1498Szrj { 618038fd1498Szrj return transaction_stmt->subcode; 618138fd1498Szrj } 618238fd1498Szrj 618338fd1498Szrj /* Set BODY to be the body for the GIMPLE_TRANSACTION statement 618438fd1498Szrj TRANSACTION_STMT. */ 618538fd1498Szrj 618638fd1498Szrj static inline void 618738fd1498Szrj gimple_transaction_set_body (gtransaction *transaction_stmt, 618838fd1498Szrj gimple_seq body) 618938fd1498Szrj { 619038fd1498Szrj transaction_stmt->body = body; 619138fd1498Szrj } 619238fd1498Szrj 619338fd1498Szrj /* Set the label associated with a GIMPLE_TRANSACTION. */ 619438fd1498Szrj 619538fd1498Szrj static inline void 619638fd1498Szrj gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label) 619738fd1498Szrj { 619838fd1498Szrj transaction_stmt->label_norm = label; 619938fd1498Szrj } 620038fd1498Szrj 620138fd1498Szrj static inline void 620238fd1498Szrj gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label) 620338fd1498Szrj { 620438fd1498Szrj transaction_stmt->label_uninst = label; 620538fd1498Szrj } 620638fd1498Szrj 620738fd1498Szrj static inline void 620838fd1498Szrj gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label) 620938fd1498Szrj { 621038fd1498Szrj transaction_stmt->label_over = label; 621138fd1498Szrj } 621238fd1498Szrj 621338fd1498Szrj /* Set the subcode associated with a GIMPLE_TRANSACTION. */ 621438fd1498Szrj 621538fd1498Szrj static inline void 621638fd1498Szrj gimple_transaction_set_subcode (gtransaction *transaction_stmt, 621738fd1498Szrj unsigned int subcode) 621838fd1498Szrj { 621938fd1498Szrj transaction_stmt->subcode = subcode; 622038fd1498Szrj } 622138fd1498Szrj 622238fd1498Szrj /* Return a pointer to the return value for GIMPLE_RETURN GS. */ 622338fd1498Szrj 622438fd1498Szrj static inline tree * 622538fd1498Szrj gimple_return_retval_ptr (greturn *gs) 622638fd1498Szrj { 622738fd1498Szrj return &gs->op[0]; 622838fd1498Szrj } 622938fd1498Szrj 623038fd1498Szrj /* Return the return value for GIMPLE_RETURN GS. */ 623138fd1498Szrj 623238fd1498Szrj static inline tree 623338fd1498Szrj gimple_return_retval (const greturn *gs) 623438fd1498Szrj { 623538fd1498Szrj return gs->op[0]; 623638fd1498Szrj } 623738fd1498Szrj 623838fd1498Szrj 623938fd1498Szrj /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */ 624038fd1498Szrj 624138fd1498Szrj static inline void 624238fd1498Szrj gimple_return_set_retval (greturn *gs, tree retval) 624338fd1498Szrj { 624438fd1498Szrj gs->op[0] = retval; 624538fd1498Szrj } 624638fd1498Szrj 624738fd1498Szrj 624838fd1498Szrj /* Return the return bounds for GIMPLE_RETURN GS. */ 624938fd1498Szrj 625038fd1498Szrj static inline tree 625138fd1498Szrj gimple_return_retbnd (const gimple *gs) 625238fd1498Szrj { 625338fd1498Szrj GIMPLE_CHECK (gs, GIMPLE_RETURN); 625438fd1498Szrj return gimple_op (gs, 1); 625538fd1498Szrj } 625638fd1498Szrj 625738fd1498Szrj 625838fd1498Szrj /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */ 625938fd1498Szrj 626038fd1498Szrj static inline void 626138fd1498Szrj gimple_return_set_retbnd (gimple *gs, tree retval) 626238fd1498Szrj { 626338fd1498Szrj GIMPLE_CHECK (gs, GIMPLE_RETURN); 626438fd1498Szrj gimple_set_op (gs, 1, retval); 626538fd1498Szrj } 626638fd1498Szrj 626738fd1498Szrj 626838fd1498Szrj /* Returns true when the gimple statement STMT is any of the OMP types. */ 626938fd1498Szrj 627038fd1498Szrj #define CASE_GIMPLE_OMP \ 627138fd1498Szrj case GIMPLE_OMP_PARALLEL: \ 627238fd1498Szrj case GIMPLE_OMP_TASK: \ 627338fd1498Szrj case GIMPLE_OMP_FOR: \ 627438fd1498Szrj case GIMPLE_OMP_SECTIONS: \ 627538fd1498Szrj case GIMPLE_OMP_SECTIONS_SWITCH: \ 627638fd1498Szrj case GIMPLE_OMP_SINGLE: \ 627738fd1498Szrj case GIMPLE_OMP_TARGET: \ 627838fd1498Szrj case GIMPLE_OMP_TEAMS: \ 627938fd1498Szrj case GIMPLE_OMP_SECTION: \ 628038fd1498Szrj case GIMPLE_OMP_MASTER: \ 628138fd1498Szrj case GIMPLE_OMP_TASKGROUP: \ 628238fd1498Szrj case GIMPLE_OMP_ORDERED: \ 628338fd1498Szrj case GIMPLE_OMP_CRITICAL: \ 628438fd1498Szrj case GIMPLE_OMP_RETURN: \ 628538fd1498Szrj case GIMPLE_OMP_ATOMIC_LOAD: \ 628638fd1498Szrj case GIMPLE_OMP_ATOMIC_STORE: \ 628738fd1498Szrj case GIMPLE_OMP_CONTINUE: \ 628838fd1498Szrj case GIMPLE_OMP_GRID_BODY 628938fd1498Szrj 629038fd1498Szrj static inline bool 629138fd1498Szrj is_gimple_omp (const gimple *stmt) 629238fd1498Szrj { 629338fd1498Szrj switch (gimple_code (stmt)) 629438fd1498Szrj { 629538fd1498Szrj CASE_GIMPLE_OMP: 629638fd1498Szrj return true; 629738fd1498Szrj default: 629838fd1498Szrj return false; 629938fd1498Szrj } 630038fd1498Szrj } 630138fd1498Szrj 630238fd1498Szrj /* Return true if the OMP gimple statement STMT is any of the OpenACC types 630338fd1498Szrj specifically. */ 630438fd1498Szrj 630538fd1498Szrj static inline bool 630638fd1498Szrj is_gimple_omp_oacc (const gimple *stmt) 630738fd1498Szrj { 630838fd1498Szrj gcc_assert (is_gimple_omp (stmt)); 630938fd1498Szrj switch (gimple_code (stmt)) 631038fd1498Szrj { 631138fd1498Szrj case GIMPLE_OMP_FOR: 631238fd1498Szrj switch (gimple_omp_for_kind (stmt)) 631338fd1498Szrj { 631438fd1498Szrj case GF_OMP_FOR_KIND_OACC_LOOP: 631538fd1498Szrj return true; 631638fd1498Szrj default: 631738fd1498Szrj return false; 631838fd1498Szrj } 631938fd1498Szrj case GIMPLE_OMP_TARGET: 632038fd1498Szrj switch (gimple_omp_target_kind (stmt)) 632138fd1498Szrj { 632238fd1498Szrj case GF_OMP_TARGET_KIND_OACC_PARALLEL: 632338fd1498Szrj case GF_OMP_TARGET_KIND_OACC_KERNELS: 632438fd1498Szrj case GF_OMP_TARGET_KIND_OACC_DATA: 632538fd1498Szrj case GF_OMP_TARGET_KIND_OACC_UPDATE: 632638fd1498Szrj case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA: 632738fd1498Szrj case GF_OMP_TARGET_KIND_OACC_DECLARE: 632838fd1498Szrj case GF_OMP_TARGET_KIND_OACC_HOST_DATA: 632938fd1498Szrj return true; 633038fd1498Szrj default: 633138fd1498Szrj return false; 633238fd1498Szrj } 633338fd1498Szrj default: 633438fd1498Szrj return false; 633538fd1498Szrj } 633638fd1498Szrj } 633738fd1498Szrj 633838fd1498Szrj 633938fd1498Szrj /* Return true if the OMP gimple statement STMT is offloaded. */ 634038fd1498Szrj 634138fd1498Szrj static inline bool 634238fd1498Szrj is_gimple_omp_offloaded (const gimple *stmt) 634338fd1498Szrj { 634438fd1498Szrj gcc_assert (is_gimple_omp (stmt)); 634538fd1498Szrj switch (gimple_code (stmt)) 634638fd1498Szrj { 634738fd1498Szrj case GIMPLE_OMP_TARGET: 634838fd1498Szrj switch (gimple_omp_target_kind (stmt)) 634938fd1498Szrj { 635038fd1498Szrj case GF_OMP_TARGET_KIND_REGION: 635138fd1498Szrj case GF_OMP_TARGET_KIND_OACC_PARALLEL: 635238fd1498Szrj case GF_OMP_TARGET_KIND_OACC_KERNELS: 635338fd1498Szrj return true; 635438fd1498Szrj default: 635538fd1498Szrj return false; 635638fd1498Szrj } 635738fd1498Szrj default: 635838fd1498Szrj return false; 635938fd1498Szrj } 636038fd1498Szrj } 636138fd1498Szrj 636238fd1498Szrj 636338fd1498Szrj /* Returns TRUE if statement G is a GIMPLE_NOP. */ 636438fd1498Szrj 636538fd1498Szrj static inline bool 636638fd1498Szrj gimple_nop_p (const gimple *g) 636738fd1498Szrj { 636838fd1498Szrj return gimple_code (g) == GIMPLE_NOP; 636938fd1498Szrj } 637038fd1498Szrj 637138fd1498Szrj 637238fd1498Szrj /* Return true if GS is a GIMPLE_RESX. */ 637338fd1498Szrj 637438fd1498Szrj static inline bool 637538fd1498Szrj is_gimple_resx (const gimple *gs) 637638fd1498Szrj { 637738fd1498Szrj return gimple_code (gs) == GIMPLE_RESX; 637838fd1498Szrj } 637938fd1498Szrj 638038fd1498Szrj /* Return the type of the main expression computed by STMT. Return 638138fd1498Szrj void_type_node if the statement computes nothing. */ 638238fd1498Szrj 638338fd1498Szrj static inline tree 638438fd1498Szrj gimple_expr_type (const gimple *stmt) 638538fd1498Szrj { 638638fd1498Szrj enum gimple_code code = gimple_code (stmt); 638738fd1498Szrj /* In general we want to pass out a type that can be substituted 638838fd1498Szrj for both the RHS and the LHS types if there is a possibly 638938fd1498Szrj useless conversion involved. That means returning the 639038fd1498Szrj original RHS type as far as we can reconstruct it. */ 639138fd1498Szrj if (code == GIMPLE_CALL) 639238fd1498Szrj { 639338fd1498Szrj const gcall *call_stmt = as_a <const gcall *> (stmt); 639438fd1498Szrj if (gimple_call_internal_p (call_stmt)) 639538fd1498Szrj switch (gimple_call_internal_fn (call_stmt)) 639638fd1498Szrj { 639738fd1498Szrj case IFN_MASK_STORE: 639838fd1498Szrj case IFN_SCATTER_STORE: 639938fd1498Szrj return TREE_TYPE (gimple_call_arg (call_stmt, 3)); 640038fd1498Szrj case IFN_MASK_SCATTER_STORE: 640138fd1498Szrj return TREE_TYPE (gimple_call_arg (call_stmt, 4)); 640238fd1498Szrj default: 640338fd1498Szrj break; 640438fd1498Szrj } 640538fd1498Szrj return gimple_call_return_type (call_stmt); 640638fd1498Szrj } 640738fd1498Szrj else if (code == GIMPLE_ASSIGN) 640838fd1498Szrj { 640938fd1498Szrj if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) 641038fd1498Szrj return TREE_TYPE (gimple_assign_rhs1 (stmt)); 641138fd1498Szrj else 641238fd1498Szrj /* As fallback use the type of the LHS. */ 641338fd1498Szrj return TREE_TYPE (gimple_get_lhs (stmt)); 641438fd1498Szrj } 641538fd1498Szrj else if (code == GIMPLE_COND) 641638fd1498Szrj return boolean_type_node; 641738fd1498Szrj else 641838fd1498Szrj return void_type_node; 641938fd1498Szrj } 642038fd1498Szrj 642138fd1498Szrj /* Enum and arrays used for allocation stats. Keep in sync with 642238fd1498Szrj gimple.c:gimple_alloc_kind_names. */ 642338fd1498Szrj enum gimple_alloc_kind 642438fd1498Szrj { 642538fd1498Szrj gimple_alloc_kind_assign, /* Assignments. */ 642638fd1498Szrj gimple_alloc_kind_phi, /* PHI nodes. */ 642738fd1498Szrj gimple_alloc_kind_cond, /* Conditionals. */ 642838fd1498Szrj gimple_alloc_kind_rest, /* Everything else. */ 642938fd1498Szrj gimple_alloc_kind_all 643038fd1498Szrj }; 643138fd1498Szrj 643238fd1498Szrj extern uint64_t gimple_alloc_counts[]; 643338fd1498Szrj extern uint64_t gimple_alloc_sizes[]; 643438fd1498Szrj 643538fd1498Szrj /* Return the allocation kind for a given stmt CODE. */ 643638fd1498Szrj static inline enum gimple_alloc_kind 643738fd1498Szrj gimple_alloc_kind (enum gimple_code code) 643838fd1498Szrj { 643938fd1498Szrj switch (code) 644038fd1498Szrj { 644138fd1498Szrj case GIMPLE_ASSIGN: 644238fd1498Szrj return gimple_alloc_kind_assign; 644338fd1498Szrj case GIMPLE_PHI: 644438fd1498Szrj return gimple_alloc_kind_phi; 644538fd1498Szrj case GIMPLE_COND: 644638fd1498Szrj return gimple_alloc_kind_cond; 644738fd1498Szrj default: 644838fd1498Szrj return gimple_alloc_kind_rest; 644938fd1498Szrj } 645038fd1498Szrj } 645138fd1498Szrj 645238fd1498Szrj /* Return true if a location should not be emitted for this statement 645338fd1498Szrj by annotate_all_with_location. */ 645438fd1498Szrj 645538fd1498Szrj static inline bool 645638fd1498Szrj gimple_do_not_emit_location_p (gimple *g) 645738fd1498Szrj { 645838fd1498Szrj return gimple_plf (g, GF_PLF_1); 645938fd1498Szrj } 646038fd1498Szrj 646138fd1498Szrj /* Mark statement G so a location will not be emitted by 646238fd1498Szrj annotate_one_with_location. */ 646338fd1498Szrj 646438fd1498Szrj static inline void 646538fd1498Szrj gimple_set_do_not_emit_location (gimple *g) 646638fd1498Szrj { 646738fd1498Szrj /* The PLF flags are initialized to 0 when a new tuple is created, 646838fd1498Szrj so no need to initialize it anywhere. */ 646938fd1498Szrj gimple_set_plf (g, GF_PLF_1, true); 647038fd1498Szrj } 647138fd1498Szrj 647238fd1498Szrj 647338fd1498Szrj /* Macros for showing usage statistics. */ 647438fd1498Szrj #define SCALE(x) ((unsigned long) ((x) < 1024*10 \ 647538fd1498Szrj ? (x) \ 647638fd1498Szrj : ((x) < 1024*1024*10 \ 647738fd1498Szrj ? (x) / 1024 \ 647838fd1498Szrj : (x) / (1024*1024)))) 647938fd1498Szrj 648038fd1498Szrj #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M')) 648138fd1498Szrj 648238fd1498Szrj #endif /* GCC_GIMPLE_H */ 6483