xref: /dflybsd-src/contrib/gcc-8.0/gcc/tree.h (revision 95059079af47f9a66a175f374f2da1a5020e3255)
138fd1498Szrj /* Definitions for the ubiquitous 'tree' type for GNU compilers.
238fd1498Szrj    Copyright (C) 1989-2018 Free Software Foundation, Inc.
338fd1498Szrj 
438fd1498Szrj This file is part of GCC.
538fd1498Szrj 
638fd1498Szrj GCC is free software; you can redistribute it and/or modify it under
738fd1498Szrj the terms of the GNU General Public License as published by the Free
838fd1498Szrj Software Foundation; either version 3, or (at your option) any later
938fd1498Szrj version.
1038fd1498Szrj 
1138fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1238fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or
1338fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1438fd1498Szrj for more details.
1538fd1498Szrj 
1638fd1498Szrj You should have received a copy of the GNU General Public License
1738fd1498Szrj along with GCC; see the file COPYING3.  If not see
1838fd1498Szrj <http://www.gnu.org/licenses/>.  */
1938fd1498Szrj 
2038fd1498Szrj #ifndef GCC_TREE_H
2138fd1498Szrj #define GCC_TREE_H
2238fd1498Szrj 
2338fd1498Szrj #include "tree-core.h"
2438fd1498Szrj 
2538fd1498Szrj /* Convert a target-independent built-in function code to a combined_fn.  */
2638fd1498Szrj 
2738fd1498Szrj inline combined_fn
as_combined_fn(built_in_function fn)2838fd1498Szrj as_combined_fn (built_in_function fn)
2938fd1498Szrj {
3038fd1498Szrj   return combined_fn (int (fn));
3138fd1498Szrj }
3238fd1498Szrj 
3338fd1498Szrj /* Convert an internal function code to a combined_fn.  */
3438fd1498Szrj 
3538fd1498Szrj inline combined_fn
as_combined_fn(internal_fn fn)3638fd1498Szrj as_combined_fn (internal_fn fn)
3738fd1498Szrj {
3838fd1498Szrj   return combined_fn (int (fn) + int (END_BUILTINS));
3938fd1498Szrj }
4038fd1498Szrj 
4138fd1498Szrj /* Return true if CODE is a target-independent built-in function.  */
4238fd1498Szrj 
4338fd1498Szrj inline bool
builtin_fn_p(combined_fn code)4438fd1498Szrj builtin_fn_p (combined_fn code)
4538fd1498Szrj {
4638fd1498Szrj   return int (code) < int (END_BUILTINS);
4738fd1498Szrj }
4838fd1498Szrj 
4938fd1498Szrj /* Return the target-independent built-in function represented by CODE.
5038fd1498Szrj    Only valid if builtin_fn_p (CODE).  */
5138fd1498Szrj 
5238fd1498Szrj inline built_in_function
as_builtin_fn(combined_fn code)5338fd1498Szrj as_builtin_fn (combined_fn code)
5438fd1498Szrj {
5538fd1498Szrj   gcc_checking_assert (builtin_fn_p (code));
5638fd1498Szrj   return built_in_function (int (code));
5738fd1498Szrj }
5838fd1498Szrj 
5938fd1498Szrj /* Return true if CODE is an internal function.  */
6038fd1498Szrj 
6138fd1498Szrj inline bool
internal_fn_p(combined_fn code)6238fd1498Szrj internal_fn_p (combined_fn code)
6338fd1498Szrj {
6438fd1498Szrj   return int (code) >= int (END_BUILTINS);
6538fd1498Szrj }
6638fd1498Szrj 
6738fd1498Szrj /* Return the internal function represented by CODE.  Only valid if
6838fd1498Szrj    internal_fn_p (CODE).  */
6938fd1498Szrj 
7038fd1498Szrj inline internal_fn
as_internal_fn(combined_fn code)7138fd1498Szrj as_internal_fn (combined_fn code)
7238fd1498Szrj {
7338fd1498Szrj   gcc_checking_assert (internal_fn_p (code));
7438fd1498Szrj   return internal_fn (int (code) - int (END_BUILTINS));
7538fd1498Szrj }
7638fd1498Szrj 
7738fd1498Szrj /* Macros for initializing `tree_contains_struct'.  */
7838fd1498Szrj #define MARK_TS_BASE(C)					\
7938fd1498Szrj   (tree_contains_struct[C][TS_BASE] = true)
8038fd1498Szrj 
8138fd1498Szrj #define MARK_TS_TYPED(C)				\
8238fd1498Szrj   (MARK_TS_BASE (C),					\
8338fd1498Szrj    tree_contains_struct[C][TS_TYPED] = true)
8438fd1498Szrj 
8538fd1498Szrj #define MARK_TS_COMMON(C)				\
8638fd1498Szrj   (MARK_TS_TYPED (C),					\
8738fd1498Szrj    tree_contains_struct[C][TS_COMMON] = true)
8838fd1498Szrj 
8938fd1498Szrj #define MARK_TS_TYPE_COMMON(C)				\
9038fd1498Szrj   (MARK_TS_COMMON (C),					\
9138fd1498Szrj    tree_contains_struct[C][TS_TYPE_COMMON] = true)
9238fd1498Szrj 
9338fd1498Szrj #define MARK_TS_TYPE_WITH_LANG_SPECIFIC(C)		\
9438fd1498Szrj   (MARK_TS_TYPE_COMMON (C),				\
9538fd1498Szrj    tree_contains_struct[C][TS_TYPE_WITH_LANG_SPECIFIC] = true)
9638fd1498Szrj 
9738fd1498Szrj #define MARK_TS_DECL_MINIMAL(C)				\
9838fd1498Szrj   (MARK_TS_COMMON (C),					\
9938fd1498Szrj    tree_contains_struct[C][TS_DECL_MINIMAL] = true)
10038fd1498Szrj 
10138fd1498Szrj #define MARK_TS_DECL_COMMON(C)				\
10238fd1498Szrj   (MARK_TS_DECL_MINIMAL (C),				\
10338fd1498Szrj    tree_contains_struct[C][TS_DECL_COMMON] = true)
10438fd1498Szrj 
10538fd1498Szrj #define MARK_TS_DECL_WRTL(C)				\
10638fd1498Szrj   (MARK_TS_DECL_COMMON (C),				\
10738fd1498Szrj    tree_contains_struct[C][TS_DECL_WRTL] = true)
10838fd1498Szrj 
10938fd1498Szrj #define MARK_TS_DECL_WITH_VIS(C)			\
11038fd1498Szrj   (MARK_TS_DECL_WRTL (C),				\
11138fd1498Szrj    tree_contains_struct[C][TS_DECL_WITH_VIS] = true)
11238fd1498Szrj 
11338fd1498Szrj #define MARK_TS_DECL_NON_COMMON(C)			\
11438fd1498Szrj   (MARK_TS_DECL_WITH_VIS (C),				\
11538fd1498Szrj    tree_contains_struct[C][TS_DECL_NON_COMMON] = true)
11638fd1498Szrj 
11738fd1498Szrj /* Returns the string representing CLASS.  */
11838fd1498Szrj 
11938fd1498Szrj #define TREE_CODE_CLASS_STRING(CLASS)\
12038fd1498Szrj         tree_code_class_strings[(int) (CLASS)]
12138fd1498Szrj 
12238fd1498Szrj #define TREE_CODE_CLASS(CODE)	tree_code_type[(int) (CODE)]
12338fd1498Szrj 
12438fd1498Szrj /* Nonzero if NODE represents an exceptional code.  */
12538fd1498Szrj 
12638fd1498Szrj #define EXCEPTIONAL_CLASS_P(NODE)\
12738fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_exceptional)
12838fd1498Szrj 
12938fd1498Szrj /* Nonzero if NODE represents a constant.  */
13038fd1498Szrj 
13138fd1498Szrj #define CONSTANT_CLASS_P(NODE)\
13238fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_constant)
13338fd1498Szrj 
13438fd1498Szrj /* Nonzero if NODE represents a type.  */
13538fd1498Szrj 
13638fd1498Szrj #define TYPE_P(NODE)\
13738fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_type)
13838fd1498Szrj 
13938fd1498Szrj /* Nonzero if NODE represents a declaration.  */
14038fd1498Szrj 
14138fd1498Szrj #define DECL_P(NODE)\
14238fd1498Szrj         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_declaration)
14338fd1498Szrj 
14438fd1498Szrj /* True if NODE designates a variable declaration.  */
14538fd1498Szrj #define VAR_P(NODE) \
14638fd1498Szrj   (TREE_CODE (NODE) == VAR_DECL)
14738fd1498Szrj 
14838fd1498Szrj /* Nonzero if DECL represents a VAR_DECL or FUNCTION_DECL.  */
14938fd1498Szrj 
15038fd1498Szrj #define VAR_OR_FUNCTION_DECL_P(DECL)\
15138fd1498Szrj   (TREE_CODE (DECL) == VAR_DECL || TREE_CODE (DECL) == FUNCTION_DECL)
15238fd1498Szrj 
15338fd1498Szrj /* Nonzero if NODE represents a INDIRECT_REF.  Keep these checks in
15438fd1498Szrj    ascending code order.  */
15538fd1498Szrj 
15638fd1498Szrj #define INDIRECT_REF_P(NODE)\
15738fd1498Szrj   (TREE_CODE (NODE) == INDIRECT_REF)
15838fd1498Szrj 
15938fd1498Szrj /* Nonzero if NODE represents a reference.  */
16038fd1498Szrj 
16138fd1498Szrj #define REFERENCE_CLASS_P(NODE)\
16238fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_reference)
16338fd1498Szrj 
16438fd1498Szrj /* Nonzero if NODE represents a comparison.  */
16538fd1498Szrj 
16638fd1498Szrj #define COMPARISON_CLASS_P(NODE)\
16738fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_comparison)
16838fd1498Szrj 
16938fd1498Szrj /* Nonzero if NODE represents a unary arithmetic expression.  */
17038fd1498Szrj 
17138fd1498Szrj #define UNARY_CLASS_P(NODE)\
17238fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_unary)
17338fd1498Szrj 
17438fd1498Szrj /* Nonzero if NODE represents a binary arithmetic expression.  */
17538fd1498Szrj 
17638fd1498Szrj #define BINARY_CLASS_P(NODE)\
17738fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_binary)
17838fd1498Szrj 
17938fd1498Szrj /* Nonzero if NODE represents a statement expression.  */
18038fd1498Szrj 
18138fd1498Szrj #define STATEMENT_CLASS_P(NODE)\
18238fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_statement)
18338fd1498Szrj 
18438fd1498Szrj /* Nonzero if NODE represents a function call-like expression with a
18538fd1498Szrj    variable-length operand vector.  */
18638fd1498Szrj 
18738fd1498Szrj #define VL_EXP_CLASS_P(NODE)\
18838fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_vl_exp)
18938fd1498Szrj 
19038fd1498Szrj /* Nonzero if NODE represents any other expression.  */
19138fd1498Szrj 
19238fd1498Szrj #define EXPRESSION_CLASS_P(NODE)\
19338fd1498Szrj 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_expression)
19438fd1498Szrj 
19538fd1498Szrj /* Returns nonzero iff NODE represents a type or declaration.  */
19638fd1498Szrj 
19738fd1498Szrj #define IS_TYPE_OR_DECL_P(NODE)\
19838fd1498Szrj 	(TYPE_P (NODE) || DECL_P (NODE))
19938fd1498Szrj 
20038fd1498Szrj /* Returns nonzero iff CLASS is the tree-code class of an
20138fd1498Szrj    expression.  */
20238fd1498Szrj 
20338fd1498Szrj #define IS_EXPR_CODE_CLASS(CLASS)\
20438fd1498Szrj 	((CLASS) >= tcc_reference && (CLASS) <= tcc_expression)
20538fd1498Szrj 
20638fd1498Szrj /* Returns nonzero iff NODE is an expression of some kind.  */
20738fd1498Szrj 
20838fd1498Szrj #define EXPR_P(NODE) IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))
20938fd1498Szrj 
21038fd1498Szrj #define TREE_CODE_LENGTH(CODE)	tree_code_length[(int) (CODE)]
21138fd1498Szrj 
21238fd1498Szrj 
21338fd1498Szrj /* Helper macros for math builtins.  */
21438fd1498Szrj 
21538fd1498Szrj #define CASE_FLT_FN(FN) case FN: case FN##F: case FN##L
21638fd1498Szrj #define CASE_FLT_FN_FLOATN_NX(FN)			   \
21738fd1498Szrj   case FN##F16: case FN##F32: case FN##F64: case FN##F128: \
21838fd1498Szrj   case FN##F32X: case FN##F64X: case FN##F128X
21938fd1498Szrj #define CASE_FLT_FN_REENT(FN) case FN##_R: case FN##F_R: case FN##L_R
22038fd1498Szrj #define CASE_INT_FN(FN) case FN: case FN##L: case FN##LL: case FN##IMAX
22138fd1498Szrj 
22238fd1498Szrj #define NULL_TREE (tree) NULL
22338fd1498Szrj 
22438fd1498Szrj /* Define accessors for the fields that all tree nodes have
22538fd1498Szrj    (though some fields are not used for all kinds of nodes).  */
22638fd1498Szrj 
22738fd1498Szrj /* The tree-code says what kind of node it is.
22838fd1498Szrj    Codes are defined in tree.def.  */
22938fd1498Szrj #define TREE_CODE(NODE) ((enum tree_code) (NODE)->base.code)
23038fd1498Szrj #define TREE_SET_CODE(NODE, VALUE) ((NODE)->base.code = (VALUE))
23138fd1498Szrj 
23238fd1498Szrj /* When checking is enabled, errors will be generated if a tree node
23338fd1498Szrj    is accessed incorrectly. The macros die with a fatal error.  */
23438fd1498Szrj #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
23538fd1498Szrj 
23638fd1498Szrj #define TREE_CHECK(T, CODE) \
23738fd1498Szrj (tree_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE)))
23838fd1498Szrj 
23938fd1498Szrj #define TREE_NOT_CHECK(T, CODE) \
24038fd1498Szrj (tree_not_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE)))
24138fd1498Szrj 
24238fd1498Szrj #define TREE_CHECK2(T, CODE1, CODE2) \
24338fd1498Szrj (tree_check2 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2)))
24438fd1498Szrj 
24538fd1498Szrj #define TREE_NOT_CHECK2(T, CODE1, CODE2) \
24638fd1498Szrj (tree_not_check2 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2)))
24738fd1498Szrj 
24838fd1498Szrj #define TREE_CHECK3(T, CODE1, CODE2, CODE3) \
24938fd1498Szrj (tree_check3 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2), (CODE3)))
25038fd1498Szrj 
25138fd1498Szrj #define TREE_NOT_CHECK3(T, CODE1, CODE2, CODE3) \
25238fd1498Szrj (tree_not_check3 ((T), __FILE__, __LINE__, __FUNCTION__, \
25338fd1498Szrj                                (CODE1), (CODE2), (CODE3)))
25438fd1498Szrj 
25538fd1498Szrj #define TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) \
25638fd1498Szrj (tree_check4 ((T), __FILE__, __LINE__, __FUNCTION__, \
25738fd1498Szrj                            (CODE1), (CODE2), (CODE3), (CODE4)))
25838fd1498Szrj 
25938fd1498Szrj #define TREE_NOT_CHECK4(T, CODE1, CODE2, CODE3, CODE4) \
26038fd1498Szrj (tree_not_check4 ((T), __FILE__, __LINE__, __FUNCTION__, \
26138fd1498Szrj                                (CODE1), (CODE2), (CODE3), (CODE4)))
26238fd1498Szrj 
26338fd1498Szrj #define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) \
26438fd1498Szrj (tree_check5 ((T), __FILE__, __LINE__, __FUNCTION__, \
26538fd1498Szrj                            (CODE1), (CODE2), (CODE3), (CODE4), (CODE5)))
26638fd1498Szrj 
26738fd1498Szrj #define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) \
26838fd1498Szrj (tree_not_check5 ((T), __FILE__, __LINE__, __FUNCTION__, \
26938fd1498Szrj                                (CODE1), (CODE2), (CODE3), (CODE4), (CODE5)))
27038fd1498Szrj 
27138fd1498Szrj #define CONTAINS_STRUCT_CHECK(T, STRUCT) \
27238fd1498Szrj (contains_struct_check ((T), (STRUCT), __FILE__, __LINE__, __FUNCTION__))
27338fd1498Szrj 
27438fd1498Szrj #define TREE_CLASS_CHECK(T, CLASS) \
27538fd1498Szrj (tree_class_check ((T), (CLASS), __FILE__, __LINE__, __FUNCTION__))
27638fd1498Szrj 
27738fd1498Szrj #define TREE_RANGE_CHECK(T, CODE1, CODE2) \
27838fd1498Szrj (tree_range_check ((T), (CODE1), (CODE2), __FILE__, __LINE__, __FUNCTION__))
27938fd1498Szrj 
28038fd1498Szrj #define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) \
28138fd1498Szrj (omp_clause_subcode_check ((T), (CODE), __FILE__, __LINE__, __FUNCTION__))
28238fd1498Szrj 
28338fd1498Szrj #define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) \
28438fd1498Szrj (omp_clause_range_check ((T), (CODE1), (CODE2), \
28538fd1498Szrj                                       __FILE__, __LINE__, __FUNCTION__))
28638fd1498Szrj 
28738fd1498Szrj /* These checks have to be special cased.  */
28838fd1498Szrj #define EXPR_CHECK(T) \
28938fd1498Szrj (expr_check ((T), __FILE__, __LINE__, __FUNCTION__))
29038fd1498Szrj 
29138fd1498Szrj /* These checks have to be special cased.  */
29238fd1498Szrj #define NON_TYPE_CHECK(T) \
29338fd1498Szrj (non_type_check ((T), __FILE__, __LINE__, __FUNCTION__))
29438fd1498Szrj 
29538fd1498Szrj /* These checks have to be special cased.  */
29638fd1498Szrj #define ANY_INTEGRAL_TYPE_CHECK(T) \
29738fd1498Szrj (any_integral_type_check ((T), __FILE__, __LINE__, __FUNCTION__))
29838fd1498Szrj 
29938fd1498Szrj #define TREE_INT_CST_ELT_CHECK(T, I) \
30038fd1498Szrj (*tree_int_cst_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__))
30138fd1498Szrj 
30238fd1498Szrj #define TREE_VEC_ELT_CHECK(T, I) \
30338fd1498Szrj (*(CONST_CAST2 (tree *, typeof (T)*, \
30438fd1498Szrj      tree_vec_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__))))
30538fd1498Szrj 
30638fd1498Szrj #define OMP_CLAUSE_ELT_CHECK(T, I) \
30738fd1498Szrj (*(omp_clause_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__)))
30838fd1498Szrj 
30938fd1498Szrj /* Special checks for TREE_OPERANDs.  */
31038fd1498Szrj #define TREE_OPERAND_CHECK(T, I) \
31138fd1498Szrj (*(CONST_CAST2 (tree*, typeof (T)*, \
31238fd1498Szrj      tree_operand_check ((T), (I), __FILE__, __LINE__, __FUNCTION__))))
31338fd1498Szrj 
31438fd1498Szrj #define TREE_OPERAND_CHECK_CODE(T, CODE, I) \
31538fd1498Szrj (*(tree_operand_check_code ((T), (CODE), (I), \
31638fd1498Szrj                                          __FILE__, __LINE__, __FUNCTION__)))
31738fd1498Szrj 
31838fd1498Szrj /* Nodes are chained together for many purposes.
31938fd1498Szrj    Types are chained together to record them for being output to the debugger
32038fd1498Szrj    (see the function `chain_type').
32138fd1498Szrj    Decls in the same scope are chained together to record the contents
32238fd1498Szrj    of the scope.
32338fd1498Szrj    Statement nodes for successive statements used to be chained together.
32438fd1498Szrj    Often lists of things are represented by TREE_LIST nodes that
32538fd1498Szrj    are chained together.  */
32638fd1498Szrj 
32738fd1498Szrj #define TREE_CHAIN(NODE) \
32838fd1498Szrj (CONTAINS_STRUCT_CHECK (NODE, TS_COMMON)->common.chain)
32938fd1498Szrj 
33038fd1498Szrj /* In all nodes that are expressions, this is the data type of the expression.
33138fd1498Szrj    In POINTER_TYPE nodes, this is the type that the pointer points to.
33238fd1498Szrj    In ARRAY_TYPE nodes, this is the type of the elements.
33338fd1498Szrj    In VECTOR_TYPE nodes, this is the type of the elements.  */
33438fd1498Szrj #define TREE_TYPE(NODE) \
33538fd1498Szrj (CONTAINS_STRUCT_CHECK (NODE, TS_TYPED)->typed.type)
33638fd1498Szrj 
33738fd1498Szrj extern void tree_contains_struct_check_failed (const_tree,
33838fd1498Szrj 					       const enum tree_node_structure_enum,
33938fd1498Szrj 					       const char *, int, const char *)
34038fd1498Szrj   ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
34138fd1498Szrj 
34238fd1498Szrj extern void tree_check_failed (const_tree, const char *, int, const char *,
34338fd1498Szrj 			       ...) ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
34438fd1498Szrj extern void tree_not_check_failed (const_tree, const char *, int, const char *,
34538fd1498Szrj 				   ...) ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
34638fd1498Szrj extern void tree_class_check_failed (const_tree, const enum tree_code_class,
34738fd1498Szrj 				     const char *, int, const char *)
34838fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
34938fd1498Szrj extern void tree_range_check_failed (const_tree, const char *, int,
35038fd1498Szrj 				     const char *, enum tree_code,
35138fd1498Szrj 				     enum tree_code)
35238fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
35338fd1498Szrj extern void tree_not_class_check_failed (const_tree,
35438fd1498Szrj 					 const enum tree_code_class,
35538fd1498Szrj 					 const char *, int, const char *)
35638fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
35738fd1498Szrj extern void tree_int_cst_elt_check_failed (int, int, const char *,
35838fd1498Szrj 					   int, const char *)
35938fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
36038fd1498Szrj extern void tree_vec_elt_check_failed (int, int, const char *,
36138fd1498Szrj 				       int, const char *)
36238fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
36338fd1498Szrj extern void phi_node_elt_check_failed (int, int, const char *,
36438fd1498Szrj 				       int, const char *)
36538fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
36638fd1498Szrj extern void tree_operand_check_failed (int, const_tree,
36738fd1498Szrj 				       const char *, int, const char *)
36838fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
36938fd1498Szrj extern void omp_clause_check_failed (const_tree, const char *, int,
37038fd1498Szrj 				     const char *, enum omp_clause_code)
37138fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
37238fd1498Szrj extern void omp_clause_operand_check_failed (int, const_tree, const char *,
37338fd1498Szrj 				             int, const char *)
37438fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
37538fd1498Szrj extern void omp_clause_range_check_failed (const_tree, const char *, int,
37638fd1498Szrj 			       const char *, enum omp_clause_code,
37738fd1498Szrj 			       enum omp_clause_code)
37838fd1498Szrj     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
37938fd1498Szrj 
38038fd1498Szrj #else /* not ENABLE_TREE_CHECKING, or not gcc */
38138fd1498Szrj 
38238fd1498Szrj #define CONTAINS_STRUCT_CHECK(T, ENUM)          (T)
38338fd1498Szrj #define TREE_CHECK(T, CODE)			(T)
38438fd1498Szrj #define TREE_NOT_CHECK(T, CODE)			(T)
38538fd1498Szrj #define TREE_CHECK2(T, CODE1, CODE2)		(T)
38638fd1498Szrj #define TREE_NOT_CHECK2(T, CODE1, CODE2)	(T)
38738fd1498Szrj #define TREE_CHECK3(T, CODE1, CODE2, CODE3)	(T)
38838fd1498Szrj #define TREE_NOT_CHECK3(T, CODE1, CODE2, CODE3)	(T)
38938fd1498Szrj #define TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) (T)
39038fd1498Szrj #define TREE_NOT_CHECK4(T, CODE1, CODE2, CODE3, CODE4) (T)
39138fd1498Szrj #define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T)
39238fd1498Szrj #define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T)
39338fd1498Szrj #define TREE_CLASS_CHECK(T, CODE)		(T)
39438fd1498Szrj #define TREE_RANGE_CHECK(T, CODE1, CODE2)	(T)
39538fd1498Szrj #define EXPR_CHECK(T)				(T)
39638fd1498Szrj #define NON_TYPE_CHECK(T)			(T)
39738fd1498Szrj #define TREE_INT_CST_ELT_CHECK(T, I)		((T)->int_cst.val[I])
39838fd1498Szrj #define TREE_VEC_ELT_CHECK(T, I)		((T)->vec.a[I])
39938fd1498Szrj #define TREE_OPERAND_CHECK(T, I)		((T)->exp.operands[I])
40038fd1498Szrj #define TREE_OPERAND_CHECK_CODE(T, CODE, I)	((T)->exp.operands[I])
40138fd1498Szrj #define OMP_CLAUSE_ELT_CHECK(T, i)	        ((T)->omp_clause.ops[i])
40238fd1498Szrj #define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2)	(T)
40338fd1498Szrj #define OMP_CLAUSE_SUBCODE_CHECK(T, CODE)	(T)
40438fd1498Szrj #define ANY_INTEGRAL_TYPE_CHECK(T)		(T)
40538fd1498Szrj 
40638fd1498Szrj #define TREE_CHAIN(NODE) ((NODE)->common.chain)
40738fd1498Szrj #define TREE_TYPE(NODE) ((NODE)->typed.type)
40838fd1498Szrj 
40938fd1498Szrj #endif
41038fd1498Szrj 
41138fd1498Szrj #define TREE_BLOCK(NODE)		(tree_block (NODE))
41238fd1498Szrj #define TREE_SET_BLOCK(T, B)		(tree_set_block ((T), (B)))
41338fd1498Szrj 
41438fd1498Szrj #include "tree-check.h"
41538fd1498Szrj 
41638fd1498Szrj #define TYPE_CHECK(T)		TREE_CLASS_CHECK (T, tcc_type)
41738fd1498Szrj #define DECL_MINIMAL_CHECK(T)   CONTAINS_STRUCT_CHECK (T, TS_DECL_MINIMAL)
41838fd1498Szrj #define DECL_COMMON_CHECK(T)    CONTAINS_STRUCT_CHECK (T, TS_DECL_COMMON)
41938fd1498Szrj #define DECL_WRTL_CHECK(T)      CONTAINS_STRUCT_CHECK (T, TS_DECL_WRTL)
42038fd1498Szrj #define DECL_WITH_VIS_CHECK(T)  CONTAINS_STRUCT_CHECK (T, TS_DECL_WITH_VIS)
42138fd1498Szrj #define DECL_NON_COMMON_CHECK(T) CONTAINS_STRUCT_CHECK (T, TS_DECL_NON_COMMON)
42238fd1498Szrj #define CST_CHECK(T)		TREE_CLASS_CHECK (T, tcc_constant)
42338fd1498Szrj #define STMT_CHECK(T)		TREE_CLASS_CHECK (T, tcc_statement)
42438fd1498Szrj #define VL_EXP_CHECK(T)		TREE_CLASS_CHECK (T, tcc_vl_exp)
42538fd1498Szrj #define FUNC_OR_METHOD_CHECK(T)	TREE_CHECK2 (T, FUNCTION_TYPE, METHOD_TYPE)
42638fd1498Szrj #define PTR_OR_REF_CHECK(T)	TREE_CHECK2 (T, POINTER_TYPE, REFERENCE_TYPE)
42738fd1498Szrj 
42838fd1498Szrj #define RECORD_OR_UNION_CHECK(T)	\
42938fd1498Szrj   TREE_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
43038fd1498Szrj #define NOT_RECORD_OR_UNION_CHECK(T) \
43138fd1498Szrj   TREE_NOT_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
43238fd1498Szrj 
43338fd1498Szrj #define NUMERICAL_TYPE_CHECK(T)					\
43438fd1498Szrj   TREE_CHECK5 (T, INTEGER_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, REAL_TYPE,	\
43538fd1498Szrj 	       FIXED_POINT_TYPE)
43638fd1498Szrj 
43738fd1498Szrj /* Here is how primitive or already-canonicalized types' hash codes
43838fd1498Szrj    are made.  */
43938fd1498Szrj #define TYPE_HASH(TYPE) (TYPE_UID (TYPE))
44038fd1498Szrj 
44138fd1498Szrj /* A simple hash function for an arbitrary tree node.  This must not be
44238fd1498Szrj    used in hash tables which are saved to a PCH.  */
44338fd1498Szrj #define TREE_HASH(NODE) ((size_t) (NODE) & 0777777)
44438fd1498Szrj 
44538fd1498Szrj /* Tests if CODE is a conversion expr (NOP_EXPR or CONVERT_EXPR).  */
44638fd1498Szrj #define CONVERT_EXPR_CODE_P(CODE)				\
44738fd1498Szrj   ((CODE) == NOP_EXPR || (CODE) == CONVERT_EXPR)
44838fd1498Szrj 
44938fd1498Szrj /* Similarly, but accept an expression instead of a tree code.  */
45038fd1498Szrj #define CONVERT_EXPR_P(EXP)	CONVERT_EXPR_CODE_P (TREE_CODE (EXP))
45138fd1498Szrj 
45238fd1498Szrj /* Generate case for NOP_EXPR, CONVERT_EXPR.  */
45338fd1498Szrj 
45438fd1498Szrj #define CASE_CONVERT						\
45538fd1498Szrj   case NOP_EXPR:						\
45638fd1498Szrj   case CONVERT_EXPR
45738fd1498Szrj 
45838fd1498Szrj /* Given an expression as a tree, strip any conversion that generates
45938fd1498Szrj    no instruction.  Accepts both tree and const_tree arguments since
46038fd1498Szrj    we are not modifying the tree itself.  */
46138fd1498Szrj 
46238fd1498Szrj #define STRIP_NOPS(EXP) \
46338fd1498Szrj   (EXP) = tree_strip_nop_conversions (CONST_CAST_TREE (EXP))
46438fd1498Szrj 
46538fd1498Szrj /* Like STRIP_NOPS, but don't let the signedness change either.  */
46638fd1498Szrj 
46738fd1498Szrj #define STRIP_SIGN_NOPS(EXP) \
46838fd1498Szrj   (EXP) = tree_strip_sign_nop_conversions (CONST_CAST_TREE (EXP))
46938fd1498Szrj 
47038fd1498Szrj /* Like STRIP_NOPS, but don't alter the TREE_TYPE either.  */
47138fd1498Szrj 
47238fd1498Szrj #define STRIP_TYPE_NOPS(EXP) \
47338fd1498Szrj   while ((CONVERT_EXPR_P (EXP)					\
47438fd1498Szrj 	  || TREE_CODE (EXP) == NON_LVALUE_EXPR)		\
47538fd1498Szrj 	 && TREE_OPERAND (EXP, 0) != error_mark_node		\
47638fd1498Szrj 	 && (TREE_TYPE (EXP)					\
47738fd1498Szrj 	     == TREE_TYPE (TREE_OPERAND (EXP, 0))))		\
47838fd1498Szrj     (EXP) = TREE_OPERAND (EXP, 0)
47938fd1498Szrj 
48038fd1498Szrj /* Remove unnecessary type conversions according to
48138fd1498Szrj    tree_ssa_useless_type_conversion.  */
48238fd1498Szrj 
48338fd1498Szrj #define STRIP_USELESS_TYPE_CONVERSION(EXP) \
48438fd1498Szrj   (EXP) = tree_ssa_strip_useless_type_conversions (EXP)
48538fd1498Szrj 
48638fd1498Szrj /* Remove any VIEW_CONVERT_EXPR or NON_LVALUE_EXPR that's purely
48738fd1498Szrj    in use to provide a location_t.  */
48838fd1498Szrj 
48938fd1498Szrj #define STRIP_ANY_LOCATION_WRAPPER(EXP) \
49038fd1498Szrj   (EXP) = tree_strip_any_location_wrapper (CONST_CAST_TREE (EXP))
49138fd1498Szrj 
49238fd1498Szrj /* Nonzero if TYPE represents a vector type.  */
49338fd1498Szrj 
49438fd1498Szrj #define VECTOR_TYPE_P(TYPE) (TREE_CODE (TYPE) == VECTOR_TYPE)
49538fd1498Szrj 
49638fd1498Szrj /* Nonzero if TYPE represents a vector of booleans.  */
49738fd1498Szrj 
49838fd1498Szrj #define VECTOR_BOOLEAN_TYPE_P(TYPE)				\
49938fd1498Szrj   (TREE_CODE (TYPE) == VECTOR_TYPE			\
50038fd1498Szrj    && TREE_CODE (TREE_TYPE (TYPE)) == BOOLEAN_TYPE)
50138fd1498Szrj 
50238fd1498Szrj /* Nonzero if TYPE represents an integral type.  Note that we do not
50338fd1498Szrj    include COMPLEX types here.  Keep these checks in ascending code
50438fd1498Szrj    order.  */
50538fd1498Szrj 
50638fd1498Szrj #define INTEGRAL_TYPE_P(TYPE)  \
50738fd1498Szrj   (TREE_CODE (TYPE) == ENUMERAL_TYPE  \
50838fd1498Szrj    || TREE_CODE (TYPE) == BOOLEAN_TYPE \
50938fd1498Szrj    || TREE_CODE (TYPE) == INTEGER_TYPE)
51038fd1498Szrj 
51138fd1498Szrj /* Nonzero if TYPE represents an integral type, including complex
51238fd1498Szrj    and vector integer types.  */
51338fd1498Szrj 
51438fd1498Szrj #define ANY_INTEGRAL_TYPE_P(TYPE)		\
51538fd1498Szrj   (INTEGRAL_TYPE_P (TYPE)			\
51638fd1498Szrj    || ((TREE_CODE (TYPE) == COMPLEX_TYPE 	\
51738fd1498Szrj         || VECTOR_TYPE_P (TYPE))		\
51838fd1498Szrj        && INTEGRAL_TYPE_P (TREE_TYPE (TYPE))))
51938fd1498Szrj 
52038fd1498Szrj /* Nonzero if TYPE represents a non-saturating fixed-point type.  */
52138fd1498Szrj 
52238fd1498Szrj #define NON_SAT_FIXED_POINT_TYPE_P(TYPE) \
52338fd1498Szrj   (TREE_CODE (TYPE) == FIXED_POINT_TYPE && !TYPE_SATURATING (TYPE))
52438fd1498Szrj 
52538fd1498Szrj /* Nonzero if TYPE represents a saturating fixed-point type.  */
52638fd1498Szrj 
52738fd1498Szrj #define SAT_FIXED_POINT_TYPE_P(TYPE) \
52838fd1498Szrj   (TREE_CODE (TYPE) == FIXED_POINT_TYPE && TYPE_SATURATING (TYPE))
52938fd1498Szrj 
53038fd1498Szrj /* Nonzero if TYPE represents a fixed-point type.  */
53138fd1498Szrj 
53238fd1498Szrj #define FIXED_POINT_TYPE_P(TYPE)	(TREE_CODE (TYPE) == FIXED_POINT_TYPE)
53338fd1498Szrj 
53438fd1498Szrj /* Nonzero if TYPE represents a scalar floating-point type.  */
53538fd1498Szrj 
53638fd1498Szrj #define SCALAR_FLOAT_TYPE_P(TYPE) (TREE_CODE (TYPE) == REAL_TYPE)
53738fd1498Szrj 
53838fd1498Szrj /* Nonzero if TYPE represents a complex floating-point type.  */
53938fd1498Szrj 
54038fd1498Szrj #define COMPLEX_FLOAT_TYPE_P(TYPE)	\
54138fd1498Szrj   (TREE_CODE (TYPE) == COMPLEX_TYPE	\
54238fd1498Szrj    && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE)
54338fd1498Szrj 
54438fd1498Szrj /* Nonzero if TYPE represents a vector integer type.  */
54538fd1498Szrj 
54638fd1498Szrj #define VECTOR_INTEGER_TYPE_P(TYPE)			\
54738fd1498Szrj   (VECTOR_TYPE_P (TYPE)					\
54838fd1498Szrj    && TREE_CODE (TREE_TYPE (TYPE)) == INTEGER_TYPE)
54938fd1498Szrj 
55038fd1498Szrj 
55138fd1498Szrj /* Nonzero if TYPE represents a vector floating-point type.  */
55238fd1498Szrj 
55338fd1498Szrj #define VECTOR_FLOAT_TYPE_P(TYPE)	\
55438fd1498Szrj   (VECTOR_TYPE_P (TYPE)			\
55538fd1498Szrj    && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE)
55638fd1498Szrj 
55738fd1498Szrj /* Nonzero if TYPE represents a floating-point type, including complex
55838fd1498Szrj    and vector floating-point types.  The vector and complex check does
55938fd1498Szrj    not use the previous two macros to enable early folding.  */
56038fd1498Szrj 
56138fd1498Szrj #define FLOAT_TYPE_P(TYPE)			\
56238fd1498Szrj   (SCALAR_FLOAT_TYPE_P (TYPE)			\
56338fd1498Szrj    || ((TREE_CODE (TYPE) == COMPLEX_TYPE 	\
56438fd1498Szrj         || VECTOR_TYPE_P (TYPE))		\
56538fd1498Szrj        && SCALAR_FLOAT_TYPE_P (TREE_TYPE (TYPE))))
56638fd1498Szrj 
56738fd1498Szrj /* Nonzero if TYPE represents a decimal floating-point type.  */
56838fd1498Szrj #define DECIMAL_FLOAT_TYPE_P(TYPE)		\
56938fd1498Szrj   (SCALAR_FLOAT_TYPE_P (TYPE)			\
57038fd1498Szrj    && DECIMAL_FLOAT_MODE_P (TYPE_MODE (TYPE)))
57138fd1498Szrj 
57238fd1498Szrj /* Nonzero if TYPE is a record or union type.  */
57338fd1498Szrj #define RECORD_OR_UNION_TYPE_P(TYPE)		\
57438fd1498Szrj   (TREE_CODE (TYPE) == RECORD_TYPE		\
57538fd1498Szrj    || TREE_CODE (TYPE) == UNION_TYPE		\
57638fd1498Szrj    || TREE_CODE (TYPE) == QUAL_UNION_TYPE)
57738fd1498Szrj 
57838fd1498Szrj /* Nonzero if TYPE represents an aggregate (multi-component) type.
57938fd1498Szrj    Keep these checks in ascending code order.  */
58038fd1498Szrj 
58138fd1498Szrj #define AGGREGATE_TYPE_P(TYPE) \
58238fd1498Szrj   (TREE_CODE (TYPE) == ARRAY_TYPE || RECORD_OR_UNION_TYPE_P (TYPE))
58338fd1498Szrj 
58438fd1498Szrj /* Nonzero if TYPE represents a pointer or reference type.
58538fd1498Szrj    (It should be renamed to INDIRECT_TYPE_P.)  Keep these checks in
58638fd1498Szrj    ascending code order.  */
58738fd1498Szrj 
58838fd1498Szrj #define POINTER_TYPE_P(TYPE) \
58938fd1498Szrj   (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE)
59038fd1498Szrj 
59138fd1498Szrj /* Nonzero if TYPE represents a pointer to function.  */
59238fd1498Szrj #define FUNCTION_POINTER_TYPE_P(TYPE) \
59338fd1498Szrj   (POINTER_TYPE_P (TYPE) && TREE_CODE (TREE_TYPE (TYPE)) == FUNCTION_TYPE)
59438fd1498Szrj 
59538fd1498Szrj /* Nonzero if this type is a complete type.  */
59638fd1498Szrj #define COMPLETE_TYPE_P(NODE) (TYPE_SIZE (NODE) != NULL_TREE)
59738fd1498Szrj 
59838fd1498Szrj /* Nonzero if this type is a pointer bounds type.  */
59938fd1498Szrj #define POINTER_BOUNDS_TYPE_P(NODE) \
60038fd1498Szrj   (TREE_CODE (NODE) == POINTER_BOUNDS_TYPE)
60138fd1498Szrj 
60238fd1498Szrj /* Nonzero if this node has a pointer bounds type.  */
60338fd1498Szrj #define POINTER_BOUNDS_P(NODE) \
60438fd1498Szrj   (POINTER_BOUNDS_TYPE_P (TREE_TYPE (NODE)))
60538fd1498Szrj 
60638fd1498Szrj /* Nonzero if this type supposes bounds existence.  */
60738fd1498Szrj #define BOUNDED_TYPE_P(type) (POINTER_TYPE_P (type))
60838fd1498Szrj 
60938fd1498Szrj /* Nonzero for objects with bounded type.  */
61038fd1498Szrj #define BOUNDED_P(node) \
61138fd1498Szrj   BOUNDED_TYPE_P (TREE_TYPE (node))
61238fd1498Szrj 
61338fd1498Szrj /* Nonzero if this type is the (possibly qualified) void type.  */
61438fd1498Szrj #define VOID_TYPE_P(NODE) (TREE_CODE (NODE) == VOID_TYPE)
61538fd1498Szrj 
61638fd1498Szrj /* Nonzero if this type is complete or is cv void.  */
61738fd1498Szrj #define COMPLETE_OR_VOID_TYPE_P(NODE) \
61838fd1498Szrj   (COMPLETE_TYPE_P (NODE) || VOID_TYPE_P (NODE))
61938fd1498Szrj 
62038fd1498Szrj /* Nonzero if this type is complete or is an array with unspecified bound.  */
62138fd1498Szrj #define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \
62238fd1498Szrj   (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE)))
62338fd1498Szrj 
62438fd1498Szrj #define FUNC_OR_METHOD_TYPE_P(NODE) \
62538fd1498Szrj   (TREE_CODE (NODE) == FUNCTION_TYPE || TREE_CODE (NODE) == METHOD_TYPE)
62638fd1498Szrj 
62738fd1498Szrj /* Define many boolean fields that all tree nodes have.  */
62838fd1498Szrj 
62938fd1498Szrj /* In VAR_DECL, PARM_DECL and RESULT_DECL nodes, nonzero means address
63038fd1498Szrj    of this is needed.  So it cannot be in a register.
63138fd1498Szrj    In a FUNCTION_DECL it has no meaning.
63238fd1498Szrj    In LABEL_DECL nodes, it means a goto for this label has been seen
63338fd1498Szrj    from a place outside all binding contours that restore stack levels.
63438fd1498Szrj    In an artificial SSA_NAME that points to a stack partition with at least
63538fd1498Szrj    two variables, it means that at least one variable has TREE_ADDRESSABLE.
63638fd1498Szrj    In ..._TYPE nodes, it means that objects of this type must be fully
63738fd1498Szrj    addressable.  This means that pieces of this object cannot go into
63838fd1498Szrj    register parameters, for example.  If this a function type, this
63938fd1498Szrj    means that the value must be returned in memory.
64038fd1498Szrj    In CONSTRUCTOR nodes, it means object constructed must be in memory.
64138fd1498Szrj    In IDENTIFIER_NODEs, this means that some extern decl for this name
64238fd1498Szrj    had its address taken.  That matters for inline functions.
64338fd1498Szrj    In a STMT_EXPR, it means we want the result of the enclosed expression.  */
64438fd1498Szrj #define TREE_ADDRESSABLE(NODE) ((NODE)->base.addressable_flag)
64538fd1498Szrj 
64638fd1498Szrj /* Set on a CALL_EXPR if the call is in a tail position, ie. just before the
64738fd1498Szrj    exit of a function.  Calls for which this is true are candidates for tail
64838fd1498Szrj    call optimizations.  */
64938fd1498Szrj #define CALL_EXPR_TAILCALL(NODE) \
65038fd1498Szrj   (CALL_EXPR_CHECK (NODE)->base.addressable_flag)
65138fd1498Szrj 
65238fd1498Szrj /* Set on a CALL_EXPR if the call has been marked as requiring tail call
65338fd1498Szrj    optimization for correctness.  */
65438fd1498Szrj #define CALL_EXPR_MUST_TAIL_CALL(NODE) \
65538fd1498Szrj   (CALL_EXPR_CHECK (NODE)->base.static_flag)
65638fd1498Szrj 
65738fd1498Szrj /* Used as a temporary field on a CASE_LABEL_EXPR to indicate that the
65838fd1498Szrj    CASE_LOW operand has been processed.  */
65938fd1498Szrj #define CASE_LOW_SEEN(NODE) \
66038fd1498Szrj   (CASE_LABEL_EXPR_CHECK (NODE)->base.addressable_flag)
66138fd1498Szrj 
66238fd1498Szrj #define PREDICT_EXPR_OUTCOME(NODE) \
66338fd1498Szrj   ((enum prediction) (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag))
66438fd1498Szrj #define SET_PREDICT_EXPR_OUTCOME(NODE, OUTCOME) \
66538fd1498Szrj   (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag = (int) OUTCOME)
66638fd1498Szrj #define PREDICT_EXPR_PREDICTOR(NODE) \
66738fd1498Szrj   ((enum br_predictor)tree_to_shwi (TREE_OPERAND (PREDICT_EXPR_CHECK (NODE), 0)))
66838fd1498Szrj 
66938fd1498Szrj /* In a VAR_DECL, nonzero means allocate static storage.
67038fd1498Szrj    In a FUNCTION_DECL, nonzero if function has been defined.
67138fd1498Szrj    In a CONSTRUCTOR, nonzero means allocate static storage.  */
67238fd1498Szrj #define TREE_STATIC(NODE) ((NODE)->base.static_flag)
67338fd1498Szrj 
67438fd1498Szrj /* In an ADDR_EXPR, nonzero means do not use a trampoline.  */
67538fd1498Szrj #define TREE_NO_TRAMPOLINE(NODE) (ADDR_EXPR_CHECK (NODE)->base.static_flag)
67638fd1498Szrj 
67738fd1498Szrj /* In a TARGET_EXPR or WITH_CLEANUP_EXPR, means that the pertinent cleanup
67838fd1498Szrj    should only be executed if an exception is thrown, not on normal exit
67938fd1498Szrj    of its scope.  */
68038fd1498Szrj #define CLEANUP_EH_ONLY(NODE) ((NODE)->base.static_flag)
68138fd1498Szrj 
68238fd1498Szrj /* In a TRY_CATCH_EXPR, means that the handler should be considered a
68338fd1498Szrj    separate cleanup in honor_protect_cleanup_actions.  */
68438fd1498Szrj #define TRY_CATCH_IS_CLEANUP(NODE) \
68538fd1498Szrj   (TRY_CATCH_EXPR_CHECK (NODE)->base.static_flag)
68638fd1498Szrj 
68738fd1498Szrj /* Used as a temporary field on a CASE_LABEL_EXPR to indicate that the
68838fd1498Szrj    CASE_HIGH operand has been processed.  */
68938fd1498Szrj #define CASE_HIGH_SEEN(NODE) \
69038fd1498Szrj   (CASE_LABEL_EXPR_CHECK (NODE)->base.static_flag)
69138fd1498Szrj 
69238fd1498Szrj /* Used to mark scoped enums.  */
69338fd1498Szrj #define ENUM_IS_SCOPED(NODE) (ENUMERAL_TYPE_CHECK (NODE)->base.static_flag)
69438fd1498Szrj 
69538fd1498Szrj /* Determines whether an ENUMERAL_TYPE has defined the list of constants. */
69638fd1498Szrj #define ENUM_IS_OPAQUE(NODE) (ENUMERAL_TYPE_CHECK (NODE)->base.private_flag)
69738fd1498Szrj 
69838fd1498Szrj /* In an expr node (usually a conversion) this means the node was made
69938fd1498Szrj    implicitly and should not lead to any sort of warning.  In a decl node,
70038fd1498Szrj    warnings concerning the decl should be suppressed.  This is used at
70138fd1498Szrj    least for used-before-set warnings, and it set after one warning is
70238fd1498Szrj    emitted.  */
70338fd1498Szrj #define TREE_NO_WARNING(NODE) ((NODE)->base.nowarning_flag)
70438fd1498Szrj 
70538fd1498Szrj /* Nonzero if we should warn about the change in empty class parameter
70638fd1498Szrj    passing ABI in this TU.  */
70738fd1498Szrj #define TRANSLATION_UNIT_WARN_EMPTY_P(NODE) \
70838fd1498Szrj   (TRANSLATION_UNIT_DECL_CHECK (NODE)->decl_common.decl_flag_0)
70938fd1498Szrj 
71038fd1498Szrj /* Nonzero if this type is "empty" according to the particular psABI.  */
71138fd1498Szrj #define TYPE_EMPTY_P(NODE) (TYPE_CHECK (NODE)->type_common.empty_flag)
71238fd1498Szrj 
71338fd1498Szrj /* Used to indicate that this TYPE represents a compiler-generated entity.  */
71438fd1498Szrj #define TYPE_ARTIFICIAL(NODE) (TYPE_CHECK (NODE)->base.nowarning_flag)
71538fd1498Szrj 
71638fd1498Szrj /* In an IDENTIFIER_NODE, this means that assemble_name was called with
71738fd1498Szrj    this string as an argument.  */
71838fd1498Szrj #define TREE_SYMBOL_REFERENCED(NODE) \
71938fd1498Szrj   (IDENTIFIER_NODE_CHECK (NODE)->base.static_flag)
72038fd1498Szrj 
72138fd1498Szrj /* Nonzero in a pointer or reference type means the data pointed to
72238fd1498Szrj    by this type can alias anything.  */
72338fd1498Szrj #define TYPE_REF_CAN_ALIAS_ALL(NODE) \
72438fd1498Szrj   (PTR_OR_REF_CHECK (NODE)->base.static_flag)
72538fd1498Szrj 
72638fd1498Szrj /* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST, this means
72738fd1498Szrj    there was an overflow in folding.  */
72838fd1498Szrj 
72938fd1498Szrj #define TREE_OVERFLOW(NODE) (CST_CHECK (NODE)->base.public_flag)
73038fd1498Szrj 
73138fd1498Szrj /* TREE_OVERFLOW can only be true for EXPR of CONSTANT_CLASS_P.  */
73238fd1498Szrj 
73338fd1498Szrj #define TREE_OVERFLOW_P(EXPR) \
73438fd1498Szrj  (CONSTANT_CLASS_P (EXPR) && TREE_OVERFLOW (EXPR))
73538fd1498Szrj 
73638fd1498Szrj /* In a VAR_DECL, FUNCTION_DECL, NAMESPACE_DECL or TYPE_DECL,
73738fd1498Szrj    nonzero means name is to be accessible from outside this translation unit.
73838fd1498Szrj    In an IDENTIFIER_NODE, nonzero means an external declaration
73938fd1498Szrj    accessible from outside this translation unit was previously seen
74038fd1498Szrj    for this name in an inner scope.  */
74138fd1498Szrj #define TREE_PUBLIC(NODE) ((NODE)->base.public_flag)
74238fd1498Szrj 
74338fd1498Szrj /* In a _TYPE, indicates whether TYPE_CACHED_VALUES contains a vector
74438fd1498Szrj    of cached values, or is something else.  */
74538fd1498Szrj #define TYPE_CACHED_VALUES_P(NODE) (TYPE_CHECK (NODE)->base.public_flag)
74638fd1498Szrj 
74738fd1498Szrj /* In a SAVE_EXPR, indicates that the original expression has already
74838fd1498Szrj    been substituted with a VAR_DECL that contains the value.  */
74938fd1498Szrj #define SAVE_EXPR_RESOLVED_P(NODE) \
75038fd1498Szrj   (SAVE_EXPR_CHECK (NODE)->base.public_flag)
75138fd1498Szrj 
75238fd1498Szrj /* Set on a CALL_EXPR if this stdarg call should be passed the argument
75338fd1498Szrj    pack.  */
75438fd1498Szrj #define CALL_EXPR_VA_ARG_PACK(NODE) \
75538fd1498Szrj   (CALL_EXPR_CHECK (NODE)->base.public_flag)
75638fd1498Szrj 
75738fd1498Szrj /* In any expression, decl, or constant, nonzero means it has side effects or
75838fd1498Szrj    reevaluation of the whole expression could produce a different value.
75938fd1498Szrj    This is set if any subexpression is a function call, a side effect or a
76038fd1498Szrj    reference to a volatile variable.  In a ..._DECL, this is set only if the
76138fd1498Szrj    declaration said `volatile'.  This will never be set for a constant.  */
76238fd1498Szrj #define TREE_SIDE_EFFECTS(NODE) \
76338fd1498Szrj   (NON_TYPE_CHECK (NODE)->base.side_effects_flag)
76438fd1498Szrj 
76538fd1498Szrj /* In a LABEL_DECL, nonzero means this label had its address taken
76638fd1498Szrj    and therefore can never be deleted and is a jump target for
76738fd1498Szrj    computed gotos.  */
76838fd1498Szrj #define FORCED_LABEL(NODE) (LABEL_DECL_CHECK (NODE)->base.side_effects_flag)
76938fd1498Szrj 
77038fd1498Szrj /* Whether a case or a user-defined label is allowed to fall through to.
77138fd1498Szrj    This is used to implement -Wimplicit-fallthrough.  */
77238fd1498Szrj #define FALLTHROUGH_LABEL_P(NODE) \
77338fd1498Szrj   (LABEL_DECL_CHECK (NODE)->base.private_flag)
77438fd1498Szrj 
77538fd1498Szrj /* Set on the artificial label created for break; stmt from a switch.
77638fd1498Szrj    This is used to implement -Wimplicit-fallthrough.  */
77738fd1498Szrj #define SWITCH_BREAK_LABEL_P(NODE) \
77838fd1498Szrj   (LABEL_DECL_CHECK (NODE)->base.protected_flag)
77938fd1498Szrj 
78038fd1498Szrj /* Nonzero means this expression is volatile in the C sense:
78138fd1498Szrj    its address should be of type `volatile WHATEVER *'.
78238fd1498Szrj    In other words, the declared item is volatile qualified.
78338fd1498Szrj    This is used in _DECL nodes and _REF nodes.
78438fd1498Szrj    On a FUNCTION_DECL node, this means the function does not
78538fd1498Szrj    return normally.  This is the same effect as setting
78638fd1498Szrj    the attribute noreturn on the function in C.
78738fd1498Szrj 
78838fd1498Szrj    In a ..._TYPE node, means this type is volatile-qualified.
78938fd1498Szrj    But use TYPE_VOLATILE instead of this macro when the node is a type,
79038fd1498Szrj    because eventually we may make that a different bit.
79138fd1498Szrj 
79238fd1498Szrj    If this bit is set in an expression, so is TREE_SIDE_EFFECTS.  */
79338fd1498Szrj #define TREE_THIS_VOLATILE(NODE) ((NODE)->base.volatile_flag)
79438fd1498Szrj 
79538fd1498Szrj /* Nonzero means this node will not trap.  In an INDIRECT_REF, means
79638fd1498Szrj    accessing the memory pointed to won't generate a trap.  However,
79738fd1498Szrj    this only applies to an object when used appropriately: it doesn't
79838fd1498Szrj    mean that writing a READONLY mem won't trap.
79938fd1498Szrj 
80038fd1498Szrj    In ARRAY_REF and ARRAY_RANGE_REF means that we know that the index
80138fd1498Szrj    (or slice of the array) always belongs to the range of the array.
80238fd1498Szrj    I.e. that the access will not trap, provided that the access to
80338fd1498Szrj    the base to the array will not trap.  */
80438fd1498Szrj #define TREE_THIS_NOTRAP(NODE) \
80538fd1498Szrj   (TREE_CHECK5 (NODE, INDIRECT_REF, MEM_REF, TARGET_MEM_REF, ARRAY_REF,	\
80638fd1498Szrj 		ARRAY_RANGE_REF)->base.nothrow_flag)
80738fd1498Szrj 
80838fd1498Szrj /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
80938fd1498Szrj    nonzero means it may not be the lhs of an assignment.
81038fd1498Szrj    Nonzero in a FUNCTION_DECL means this function should be treated
81138fd1498Szrj    as "const" function (can only read its arguments).  */
81238fd1498Szrj #define TREE_READONLY(NODE) (NON_TYPE_CHECK (NODE)->base.readonly_flag)
81338fd1498Szrj 
81438fd1498Szrj /* Value of expression is constant.  Always on in all ..._CST nodes.  May
81538fd1498Szrj    also appear in an expression or decl where the value is constant.  */
81638fd1498Szrj #define TREE_CONSTANT(NODE) (NON_TYPE_CHECK (NODE)->base.constant_flag)
81738fd1498Szrj 
81838fd1498Szrj /* Nonzero if NODE, a type, has had its sizes gimplified.  */
81938fd1498Szrj #define TYPE_SIZES_GIMPLIFIED(NODE) \
82038fd1498Szrj   (TYPE_CHECK (NODE)->base.constant_flag)
82138fd1498Szrj 
82238fd1498Szrj /* In a decl (most significantly a FIELD_DECL), means an unsigned field.  */
82338fd1498Szrj #define DECL_UNSIGNED(NODE) \
82438fd1498Szrj   (DECL_COMMON_CHECK (NODE)->base.u.bits.unsigned_flag)
82538fd1498Szrj 
82638fd1498Szrj /* In integral and pointer types, means an unsigned type.  */
82738fd1498Szrj #define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.u.bits.unsigned_flag)
82838fd1498Szrj 
82938fd1498Szrj /* Same as TYPE_UNSIGNED but converted to SIGNOP.  */
83038fd1498Szrj #define TYPE_SIGN(NODE) ((signop) TYPE_UNSIGNED (NODE))
83138fd1498Szrj 
83238fd1498Szrj /* True if overflow wraps around for the given integral or pointer type.  That
83338fd1498Szrj    is, TYPE_MAX + 1 == TYPE_MIN.  */
83438fd1498Szrj #define TYPE_OVERFLOW_WRAPS(TYPE) \
83538fd1498Szrj   (POINTER_TYPE_P (TYPE)					\
83638fd1498Szrj    ? flag_wrapv_pointer						\
83738fd1498Szrj    : (ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag	\
83838fd1498Szrj       || flag_wrapv))
83938fd1498Szrj 
84038fd1498Szrj /* True if overflow is undefined for the given integral or pointer type.
84138fd1498Szrj    We may optimize on the assumption that values in the type never overflow.
84238fd1498Szrj 
84338fd1498Szrj    IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
84438fd1498Szrj    must issue a warning based on warn_strict_overflow.  In some cases
84538fd1498Szrj    it will be appropriate to issue the warning immediately, and in
84638fd1498Szrj    other cases it will be appropriate to simply set a flag and let the
84738fd1498Szrj    caller decide whether a warning is appropriate or not.  */
84838fd1498Szrj #define TYPE_OVERFLOW_UNDEFINED(TYPE)				\
84938fd1498Szrj   (POINTER_TYPE_P (TYPE)					\
85038fd1498Szrj    ? !flag_wrapv_pointer					\
85138fd1498Szrj    : (!ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag	\
85238fd1498Szrj       && !flag_wrapv && !flag_trapv))
85338fd1498Szrj 
85438fd1498Szrj /* True if overflow for the given integral type should issue a
85538fd1498Szrj    trap.  */
85638fd1498Szrj #define TYPE_OVERFLOW_TRAPS(TYPE) \
85738fd1498Szrj   (!ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag && flag_trapv)
85838fd1498Szrj 
85938fd1498Szrj /* True if an overflow is to be preserved for sanitization.  */
86038fd1498Szrj #define TYPE_OVERFLOW_SANITIZED(TYPE)			\
86138fd1498Szrj   (INTEGRAL_TYPE_P (TYPE)				\
86238fd1498Szrj    && !TYPE_OVERFLOW_WRAPS (TYPE)			\
86338fd1498Szrj    && (flag_sanitize & SANITIZE_SI_OVERFLOW))
86438fd1498Szrj 
86538fd1498Szrj /* Nonzero in a VAR_DECL or STRING_CST means assembler code has been written.
86638fd1498Szrj    Nonzero in a FUNCTION_DECL means that the function has been compiled.
86738fd1498Szrj    This is interesting in an inline function, since it might not need
86838fd1498Szrj    to be compiled separately.
86938fd1498Szrj    Nonzero in a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ENUMERAL_TYPE
87038fd1498Szrj    or TYPE_DECL if the debugging info for the type has been written.
87138fd1498Szrj    In a BLOCK node, nonzero if reorder_blocks has already seen this block.
87238fd1498Szrj    In an SSA_NAME node, nonzero if the SSA_NAME occurs in an abnormal
87338fd1498Szrj    PHI node.  */
87438fd1498Szrj #define TREE_ASM_WRITTEN(NODE) ((NODE)->base.asm_written_flag)
87538fd1498Szrj 
87638fd1498Szrj /* Nonzero in a _DECL if the name is used in its scope.
87738fd1498Szrj    Nonzero in an expr node means inhibit warning if value is unused.
87838fd1498Szrj    In IDENTIFIER_NODEs, this means that some extern decl for this name
87938fd1498Szrj    was used.
88038fd1498Szrj    In a BLOCK, this means that the block contains variables that are used.  */
88138fd1498Szrj #define TREE_USED(NODE) ((NODE)->base.used_flag)
88238fd1498Szrj 
88338fd1498Szrj /* In a FUNCTION_DECL, nonzero means a call to the function cannot
88438fd1498Szrj    throw an exception.  In a CALL_EXPR, nonzero means the call cannot
88538fd1498Szrj    throw.  We can't easily check the node type here as the C++
88638fd1498Szrj    frontend also uses this flag (for AGGR_INIT_EXPR).  */
88738fd1498Szrj #define TREE_NOTHROW(NODE) ((NODE)->base.nothrow_flag)
88838fd1498Szrj 
88938fd1498Szrj /* In a CALL_EXPR, means that it's safe to use the target of the call
89038fd1498Szrj    expansion as the return slot for a call that returns in memory.  */
89138fd1498Szrj #define CALL_EXPR_RETURN_SLOT_OPT(NODE) \
89238fd1498Szrj   (CALL_EXPR_CHECK (NODE)->base.private_flag)
89338fd1498Szrj 
89438fd1498Szrj /* In a RESULT_DECL, PARM_DECL and VAR_DECL, means that it is
89538fd1498Szrj    passed by invisible reference (and the TREE_TYPE is a pointer to the true
89638fd1498Szrj    type).  */
89738fd1498Szrj #define DECL_BY_REFERENCE(NODE) \
89838fd1498Szrj   (TREE_CHECK3 (NODE, VAR_DECL, PARM_DECL, \
89938fd1498Szrj 		RESULT_DECL)->decl_common.decl_by_reference_flag)
90038fd1498Szrj 
90138fd1498Szrj /* In VAR_DECL and PARM_DECL, set when the decl has been used except for
90238fd1498Szrj    being set.  */
90338fd1498Szrj #define DECL_READ_P(NODE) \
90438fd1498Szrj   (TREE_CHECK2 (NODE, VAR_DECL, PARM_DECL)->decl_common.decl_read_flag)
90538fd1498Szrj 
90638fd1498Szrj /* In VAR_DECL or RESULT_DECL, set when significant code movement precludes
90738fd1498Szrj    attempting to share the stack slot with some other variable.  */
90838fd1498Szrj #define DECL_NONSHAREABLE(NODE) \
90938fd1498Szrj   (TREE_CHECK2 (NODE, VAR_DECL, \
91038fd1498Szrj 		RESULT_DECL)->decl_common.decl_nonshareable_flag)
91138fd1498Szrj 
91238fd1498Szrj /* In a CALL_EXPR, means that the call is the jump from a thunk to the
91338fd1498Szrj    thunked-to function.  */
91438fd1498Szrj #define CALL_FROM_THUNK_P(NODE) (CALL_EXPR_CHECK (NODE)->base.protected_flag)
91538fd1498Szrj 
91638fd1498Szrj /* In a CALL_EXPR, if the function being called is BUILT_IN_ALLOCA, means that
91738fd1498Szrj    it has been built for the declaration of a variable-sized object.  */
91838fd1498Szrj #define CALL_ALLOCA_FOR_VAR_P(NODE) \
91938fd1498Szrj   (CALL_EXPR_CHECK (NODE)->base.protected_flag)
92038fd1498Szrj 
92138fd1498Szrj /* In a CALL_EXPR, means call was instrumented by Pointer Bounds Checker.  */
92238fd1498Szrj #define CALL_WITH_BOUNDS_P(NODE) (CALL_EXPR_CHECK (NODE)->base.deprecated_flag)
92338fd1498Szrj 
92438fd1498Szrj /* Used in classes in C++.  */
92538fd1498Szrj #define TREE_PRIVATE(NODE) ((NODE)->base.private_flag)
92638fd1498Szrj /* Used in classes in C++. */
92738fd1498Szrj #define TREE_PROTECTED(NODE) ((NODE)->base.protected_flag)
92838fd1498Szrj 
92938fd1498Szrj /* True if reference type NODE is a C++ rvalue reference.  */
93038fd1498Szrj #define TYPE_REF_IS_RVALUE(NODE) \
93138fd1498Szrj   (REFERENCE_TYPE_CHECK (NODE)->base.private_flag)
93238fd1498Szrj 
93338fd1498Szrj /* Nonzero in a _DECL if the use of the name is defined as a
93438fd1498Szrj    deprecated feature by __attribute__((deprecated)).  */
93538fd1498Szrj #define TREE_DEPRECATED(NODE) \
93638fd1498Szrj   ((NODE)->base.deprecated_flag)
93738fd1498Szrj 
93838fd1498Szrj /* Nonzero in an IDENTIFIER_NODE if the name is a local alias, whose
93938fd1498Szrj    uses are to be substituted for uses of the TREE_CHAINed identifier.  */
94038fd1498Szrj #define IDENTIFIER_TRANSPARENT_ALIAS(NODE) \
94138fd1498Szrj   (IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)
94238fd1498Szrj 
94338fd1498Szrj /* In an aggregate type, indicates that the scalar fields of the type are
94438fd1498Szrj    stored in reverse order from the target order.  This effectively
94538fd1498Szrj    toggles BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN within the type.  */
94638fd1498Szrj #define TYPE_REVERSE_STORAGE_ORDER(NODE) \
94738fd1498Szrj   (TREE_CHECK4 (NODE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ARRAY_TYPE)->base.u.bits.saturating_flag)
94838fd1498Szrj 
94938fd1498Szrj /* In a non-aggregate type, indicates a saturating type.  */
95038fd1498Szrj #define TYPE_SATURATING(NODE) \
95138fd1498Szrj   (TREE_NOT_CHECK4 (NODE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ARRAY_TYPE)->base.u.bits.saturating_flag)
95238fd1498Szrj 
95338fd1498Szrj /* In a BIT_FIELD_REF and MEM_REF, indicates that the reference is to a group
95438fd1498Szrj    of bits stored in reverse order from the target order.  This effectively
95538fd1498Szrj    toggles both BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN for the reference.
95638fd1498Szrj 
95738fd1498Szrj    The overall strategy is to preserve the invariant that every scalar in
95838fd1498Szrj    memory is associated with a single storage order, i.e. all accesses to
95938fd1498Szrj    this scalar are done with the same storage order.  This invariant makes
96038fd1498Szrj    it possible to factor out the storage order in most transformations, as
96138fd1498Szrj    only the address and/or the value (in target order) matter for them.
96238fd1498Szrj    But, of course, the storage order must be preserved when the accesses
96338fd1498Szrj    themselves are rewritten or transformed.  */
96438fd1498Szrj #define REF_REVERSE_STORAGE_ORDER(NODE) \
96538fd1498Szrj   (TREE_CHECK2 (NODE, BIT_FIELD_REF, MEM_REF)->base.default_def_flag)
96638fd1498Szrj 
96738fd1498Szrj   /* In an ADDR_EXPR, indicates that this is a pointer to nested function
96838fd1498Szrj    represented by a descriptor instead of a trampoline.  */
96938fd1498Szrj #define FUNC_ADDR_BY_DESCRIPTOR(NODE) \
97038fd1498Szrj   (TREE_CHECK (NODE, ADDR_EXPR)->base.default_def_flag)
97138fd1498Szrj 
97238fd1498Szrj /* In a CALL_EXPR, indicates that this is an indirect call for which
97338fd1498Szrj    pointers to nested function are descriptors instead of trampolines.  */
97438fd1498Szrj #define CALL_EXPR_BY_DESCRIPTOR(NODE) \
97538fd1498Szrj   (TREE_CHECK (NODE, CALL_EXPR)->base.default_def_flag)
97638fd1498Szrj 
97738fd1498Szrj /* These flags are available for each language front end to use internally.  */
97838fd1498Szrj #define TREE_LANG_FLAG_0(NODE) \
97938fd1498Szrj   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_0)
98038fd1498Szrj #define TREE_LANG_FLAG_1(NODE) \
98138fd1498Szrj   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_1)
98238fd1498Szrj #define TREE_LANG_FLAG_2(NODE) \
98338fd1498Szrj   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_2)
98438fd1498Szrj #define TREE_LANG_FLAG_3(NODE) \
98538fd1498Szrj   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_3)
98638fd1498Szrj #define TREE_LANG_FLAG_4(NODE) \
98738fd1498Szrj   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_4)
98838fd1498Szrj #define TREE_LANG_FLAG_5(NODE) \
98938fd1498Szrj   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_5)
99038fd1498Szrj #define TREE_LANG_FLAG_6(NODE) \
99138fd1498Szrj   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_6)
99238fd1498Szrj 
99338fd1498Szrj /* Define additional fields and accessors for nodes representing constants.  */
99438fd1498Szrj 
99538fd1498Szrj #define TREE_INT_CST_NUNITS(NODE) \
99638fd1498Szrj   (INTEGER_CST_CHECK (NODE)->base.u.int_length.unextended)
99738fd1498Szrj #define TREE_INT_CST_EXT_NUNITS(NODE) \
99838fd1498Szrj   (INTEGER_CST_CHECK (NODE)->base.u.int_length.extended)
99938fd1498Szrj #define TREE_INT_CST_OFFSET_NUNITS(NODE) \
100038fd1498Szrj   (INTEGER_CST_CHECK (NODE)->base.u.int_length.offset)
100138fd1498Szrj #define TREE_INT_CST_ELT(NODE, I) TREE_INT_CST_ELT_CHECK (NODE, I)
100238fd1498Szrj #define TREE_INT_CST_LOW(NODE) \
100338fd1498Szrj   ((unsigned HOST_WIDE_INT) TREE_INT_CST_ELT (NODE, 0))
100438fd1498Szrj 
100538fd1498Szrj /* Return true if NODE is a POLY_INT_CST.  This is only ever true on
100638fd1498Szrj    targets with variable-sized modes.  */
100738fd1498Szrj #define POLY_INT_CST_P(NODE) \
100838fd1498Szrj   (NUM_POLY_INT_COEFFS > 1 && TREE_CODE (NODE) == POLY_INT_CST)
100938fd1498Szrj 
101038fd1498Szrj /* In a POLY_INT_CST node.  */
101138fd1498Szrj #define POLY_INT_CST_COEFF(NODE, I) \
101238fd1498Szrj   (POLY_INT_CST_CHECK (NODE)->poly_int_cst.coeffs[I])
101338fd1498Szrj 
101438fd1498Szrj #define TREE_REAL_CST_PTR(NODE) (REAL_CST_CHECK (NODE)->real_cst.real_cst_ptr)
101538fd1498Szrj #define TREE_REAL_CST(NODE) (*TREE_REAL_CST_PTR (NODE))
101638fd1498Szrj 
101738fd1498Szrj #define TREE_FIXED_CST_PTR(NODE) \
101838fd1498Szrj   (FIXED_CST_CHECK (NODE)->fixed_cst.fixed_cst_ptr)
101938fd1498Szrj #define TREE_FIXED_CST(NODE) (*TREE_FIXED_CST_PTR (NODE))
102038fd1498Szrj 
102138fd1498Szrj /* In a STRING_CST */
102238fd1498Szrj /* In C terms, this is sizeof, not strlen.  */
102338fd1498Szrj #define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length)
102438fd1498Szrj #define TREE_STRING_POINTER(NODE) \
102538fd1498Szrj   ((const char *)(STRING_CST_CHECK (NODE)->string.str))
102638fd1498Szrj 
102738fd1498Szrj /* In a COMPLEX_CST node.  */
102838fd1498Szrj #define TREE_REALPART(NODE) (COMPLEX_CST_CHECK (NODE)->complex.real)
102938fd1498Szrj #define TREE_IMAGPART(NODE) (COMPLEX_CST_CHECK (NODE)->complex.imag)
103038fd1498Szrj 
103138fd1498Szrj /* In a VECTOR_CST node.  See generic.texi for details.  */
103238fd1498Szrj #define VECTOR_CST_NELTS(NODE) (TYPE_VECTOR_SUBPARTS (TREE_TYPE (NODE)))
103338fd1498Szrj #define VECTOR_CST_ELT(NODE,IDX) vector_cst_elt (NODE, IDX)
103438fd1498Szrj 
103538fd1498Szrj #define VECTOR_CST_LOG2_NPATTERNS(NODE) \
103638fd1498Szrj   (VECTOR_CST_CHECK (NODE)->base.u.vector_cst.log2_npatterns)
103738fd1498Szrj #define VECTOR_CST_NPATTERNS(NODE) \
103838fd1498Szrj   (1U << VECTOR_CST_LOG2_NPATTERNS (NODE))
103938fd1498Szrj #define VECTOR_CST_NELTS_PER_PATTERN(NODE) \
104038fd1498Szrj   (VECTOR_CST_CHECK (NODE)->base.u.vector_cst.nelts_per_pattern)
104138fd1498Szrj #define VECTOR_CST_DUPLICATE_P(NODE) \
104238fd1498Szrj   (VECTOR_CST_NELTS_PER_PATTERN (NODE) == 1)
104338fd1498Szrj #define VECTOR_CST_STEPPED_P(NODE) \
104438fd1498Szrj   (VECTOR_CST_NELTS_PER_PATTERN (NODE) == 3)
104538fd1498Szrj #define VECTOR_CST_ENCODED_ELTS(NODE) \
104638fd1498Szrj   (VECTOR_CST_CHECK (NODE)->vector.elts)
104738fd1498Szrj #define VECTOR_CST_ENCODED_ELT(NODE, ELT) \
104838fd1498Szrj   (VECTOR_CST_CHECK (NODE)->vector.elts[ELT])
104938fd1498Szrj 
105038fd1498Szrj /* Define fields and accessors for some special-purpose tree nodes.  */
105138fd1498Szrj 
105238fd1498Szrj #define IDENTIFIER_LENGTH(NODE) \
105338fd1498Szrj   (IDENTIFIER_NODE_CHECK (NODE)->identifier.id.len)
105438fd1498Szrj #define IDENTIFIER_POINTER(NODE) \
105538fd1498Szrj   ((const char *) IDENTIFIER_NODE_CHECK (NODE)->identifier.id.str)
105638fd1498Szrj #define IDENTIFIER_HASH_VALUE(NODE) \
105738fd1498Szrj   (IDENTIFIER_NODE_CHECK (NODE)->identifier.id.hash_value)
105838fd1498Szrj 
105938fd1498Szrj /* Translate a hash table identifier pointer to a tree_identifier
106038fd1498Szrj    pointer, and vice versa.  */
106138fd1498Szrj 
106238fd1498Szrj #define HT_IDENT_TO_GCC_IDENT(NODE) \
106338fd1498Szrj   ((tree) ((char *) (NODE) - sizeof (struct tree_common)))
106438fd1498Szrj #define GCC_IDENT_TO_HT_IDENT(NODE) (&((struct tree_identifier *) (NODE))->id)
106538fd1498Szrj 
106638fd1498Szrj /* In a TREE_LIST node.  */
106738fd1498Szrj #define TREE_PURPOSE(NODE) (TREE_LIST_CHECK (NODE)->list.purpose)
106838fd1498Szrj #define TREE_VALUE(NODE) (TREE_LIST_CHECK (NODE)->list.value)
106938fd1498Szrj 
107038fd1498Szrj /* In a TREE_VEC node.  */
107138fd1498Szrj #define TREE_VEC_LENGTH(NODE) (TREE_VEC_CHECK (NODE)->base.u.length)
107238fd1498Szrj #define TREE_VEC_END(NODE) \
107338fd1498Szrj   ((void) TREE_VEC_CHECK (NODE), &((NODE)->vec.a[(NODE)->vec.base.u.length]))
107438fd1498Szrj 
107538fd1498Szrj #define TREE_VEC_ELT(NODE,I) TREE_VEC_ELT_CHECK (NODE, I)
107638fd1498Szrj 
107738fd1498Szrj /* In a CONSTRUCTOR node.  */
107838fd1498Szrj #define CONSTRUCTOR_ELTS(NODE) (CONSTRUCTOR_CHECK (NODE)->constructor.elts)
107938fd1498Szrj #define CONSTRUCTOR_ELT(NODE,IDX) \
108038fd1498Szrj   (&(*CONSTRUCTOR_ELTS (NODE))[IDX])
108138fd1498Szrj #define CONSTRUCTOR_NELTS(NODE) \
108238fd1498Szrj   (vec_safe_length (CONSTRUCTOR_ELTS (NODE)))
108338fd1498Szrj #define CONSTRUCTOR_NO_CLEARING(NODE) \
108438fd1498Szrj   (CONSTRUCTOR_CHECK (NODE)->base.public_flag)
108538fd1498Szrj 
108638fd1498Szrj /* Iterate through the vector V of CONSTRUCTOR_ELT elements, yielding the
108738fd1498Szrj    value of each element (stored within VAL). IX must be a scratch variable
108838fd1498Szrj    of unsigned integer type.  */
108938fd1498Szrj #define FOR_EACH_CONSTRUCTOR_VALUE(V, IX, VAL) \
109038fd1498Szrj   for (IX = 0; (IX >= vec_safe_length (V)) \
109138fd1498Szrj 	       ? false \
109238fd1498Szrj 	       : ((VAL = (*(V))[IX].value), \
109338fd1498Szrj 	       true); \
109438fd1498Szrj        (IX)++)
109538fd1498Szrj 
109638fd1498Szrj /* Iterate through the vector V of CONSTRUCTOR_ELT elements, yielding both
109738fd1498Szrj    the value of each element (stored within VAL) and its index (stored
109838fd1498Szrj    within INDEX). IX must be a scratch variable of unsigned integer type.  */
109938fd1498Szrj #define FOR_EACH_CONSTRUCTOR_ELT(V, IX, INDEX, VAL) \
110038fd1498Szrj   for (IX = 0; (IX >= vec_safe_length (V)) \
110138fd1498Szrj 	       ? false \
110238fd1498Szrj 	       : (((void) (VAL = (*V)[IX].value)), \
110338fd1498Szrj 		  (INDEX = (*V)[IX].index), \
110438fd1498Szrj 		  true); \
110538fd1498Szrj        (IX)++)
110638fd1498Szrj 
110738fd1498Szrj /* Append a new constructor element to V, with the specified INDEX and VAL.  */
110838fd1498Szrj #define CONSTRUCTOR_APPEND_ELT(V, INDEX, VALUE) \
110938fd1498Szrj   do { \
111038fd1498Szrj     constructor_elt _ce___ = {INDEX, VALUE}; \
111138fd1498Szrj     vec_safe_push ((V), _ce___); \
111238fd1498Szrj   } while (0)
111338fd1498Szrj 
111438fd1498Szrj /* True if NODE, a FIELD_DECL, is to be processed as a bitfield for
111538fd1498Szrj    constructor output purposes.  */
111638fd1498Szrj #define CONSTRUCTOR_BITFIELD_P(NODE) \
111738fd1498Szrj   (DECL_BIT_FIELD (FIELD_DECL_CHECK (NODE)) && DECL_MODE (NODE) != BLKmode)
111838fd1498Szrj 
111938fd1498Szrj /* True if NODE is a clobber right hand side, an expression of indeterminate
112038fd1498Szrj    value that clobbers the LHS in a copy instruction.  We use a volatile
112138fd1498Szrj    empty CONSTRUCTOR for this, as it matches most of the necessary semantic.
112238fd1498Szrj    In particular the volatile flag causes us to not prematurely remove
112338fd1498Szrj    such clobber instructions.  */
112438fd1498Szrj #define TREE_CLOBBER_P(NODE) \
112538fd1498Szrj   (TREE_CODE (NODE) == CONSTRUCTOR && TREE_THIS_VOLATILE (NODE))
112638fd1498Szrj 
112738fd1498Szrj /* Define fields and accessors for some nodes that represent expressions.  */
112838fd1498Szrj 
112938fd1498Szrj /* Nonzero if NODE is an empty statement (NOP_EXPR <0>).  */
113038fd1498Szrj #define IS_EMPTY_STMT(NODE)	(TREE_CODE (NODE) == NOP_EXPR \
113138fd1498Szrj 				 && VOID_TYPE_P (TREE_TYPE (NODE)) \
113238fd1498Szrj 				 && integer_zerop (TREE_OPERAND (NODE, 0)))
113338fd1498Szrj 
113438fd1498Szrj /* In ordinary expression nodes.  */
113538fd1498Szrj #define TREE_OPERAND_LENGTH(NODE) tree_operand_length (NODE)
113638fd1498Szrj #define TREE_OPERAND(NODE, I) TREE_OPERAND_CHECK (NODE, I)
113738fd1498Szrj 
113838fd1498Szrj /* In a tcc_vl_exp node, operand 0 is an INT_CST node holding the operand
113938fd1498Szrj    length.  Its value includes the length operand itself; that is,
114038fd1498Szrj    the minimum valid length is 1.
114138fd1498Szrj    Note that we have to bypass the use of TREE_OPERAND to access
114238fd1498Szrj    that field to avoid infinite recursion in expanding the macros.  */
114338fd1498Szrj #define VL_EXP_OPERAND_LENGTH(NODE) \
114438fd1498Szrj   ((int)TREE_INT_CST_LOW (VL_EXP_CHECK (NODE)->exp.operands[0]))
114538fd1498Szrj 
114638fd1498Szrj /* Nonzero if gimple_debug_nonbind_marker_p() may possibly hold.  */
114738fd1498Szrj #define MAY_HAVE_DEBUG_MARKER_STMTS debug_nonbind_markers_p
114838fd1498Szrj /* Nonzero if gimple_debug_bind_p() (and thus
114938fd1498Szrj    gimple_debug_source_bind_p()) may possibly hold.  */
115038fd1498Szrj #define MAY_HAVE_DEBUG_BIND_STMTS flag_var_tracking_assignments
115138fd1498Szrj /* Nonzero if is_gimple_debug() may possibly hold.  */
115238fd1498Szrj #define MAY_HAVE_DEBUG_STMTS					\
115338fd1498Szrj   (MAY_HAVE_DEBUG_MARKER_STMTS || MAY_HAVE_DEBUG_BIND_STMTS)
115438fd1498Szrj 
115538fd1498Szrj /* In a LOOP_EXPR node.  */
115638fd1498Szrj #define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)
115738fd1498Szrj 
115838fd1498Szrj /* The source location of this expression.  Non-tree_exp nodes such as
115938fd1498Szrj    decls and constants can be shared among multiple locations, so
116038fd1498Szrj    return nothing.  */
116138fd1498Szrj #define EXPR_LOCATION(NODE) \
116238fd1498Szrj   (CAN_HAVE_LOCATION_P ((NODE)) ? (NODE)->exp.locus : UNKNOWN_LOCATION)
116338fd1498Szrj #define SET_EXPR_LOCATION(NODE, LOCUS) EXPR_CHECK ((NODE))->exp.locus = (LOCUS)
116438fd1498Szrj #define EXPR_HAS_LOCATION(NODE) (LOCATION_LOCUS (EXPR_LOCATION (NODE))	\
116538fd1498Szrj   != UNKNOWN_LOCATION)
116638fd1498Szrj /* The location to be used in a diagnostic about this expression.  Do not
116738fd1498Szrj    use this macro if the location will be assigned to other expressions.  */
116838fd1498Szrj #define EXPR_LOC_OR_LOC(NODE, LOCUS) (EXPR_HAS_LOCATION (NODE) \
116938fd1498Szrj 				      ? (NODE)->exp.locus : (LOCUS))
117038fd1498Szrj #define EXPR_FILENAME(NODE) LOCATION_FILE (EXPR_CHECK ((NODE))->exp.locus)
117138fd1498Szrj #define EXPR_LINENO(NODE) LOCATION_LINE (EXPR_CHECK (NODE)->exp.locus)
117238fd1498Szrj 
117338fd1498Szrj #define CAN_HAVE_RANGE_P(NODE) (CAN_HAVE_LOCATION_P (NODE))
117438fd1498Szrj #define EXPR_LOCATION_RANGE(NODE) (get_expr_source_range (EXPR_CHECK ((NODE))))
117538fd1498Szrj 
117638fd1498Szrj #define EXPR_HAS_RANGE(NODE) \
117738fd1498Szrj     (CAN_HAVE_RANGE_P (NODE) \
117838fd1498Szrj      ? EXPR_LOCATION_RANGE (NODE).m_start != UNKNOWN_LOCATION \
117938fd1498Szrj      : false)
118038fd1498Szrj 
118138fd1498Szrj /* True if a tree is an expression or statement that can have a
118238fd1498Szrj    location.  */
118338fd1498Szrj #define CAN_HAVE_LOCATION_P(NODE) ((NODE) && EXPR_P (NODE))
118438fd1498Szrj 
118538fd1498Szrj static inline source_range
get_expr_source_range(tree expr)118638fd1498Szrj get_expr_source_range (tree expr)
118738fd1498Szrj {
118838fd1498Szrj   location_t loc = EXPR_LOCATION (expr);
118938fd1498Szrj   return get_range_from_loc (line_table, loc);
119038fd1498Szrj }
119138fd1498Szrj 
119238fd1498Szrj extern void protected_set_expr_location (tree, location_t);
119338fd1498Szrj 
119438fd1498Szrj extern tree maybe_wrap_with_location (tree, location_t);
119538fd1498Szrj 
119638fd1498Szrj /* In a TARGET_EXPR node.  */
119738fd1498Szrj #define TARGET_EXPR_SLOT(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 0)
119838fd1498Szrj #define TARGET_EXPR_INITIAL(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 1)
119938fd1498Szrj #define TARGET_EXPR_CLEANUP(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 2)
120038fd1498Szrj /* Don't elide the initialization of TARGET_EXPR_SLOT for this TARGET_EXPR
120138fd1498Szrj    on rhs of MODIFY_EXPR.  */
120238fd1498Szrj #define TARGET_EXPR_NO_ELIDE(NODE) (TARGET_EXPR_CHECK (NODE)->base.private_flag)
120338fd1498Szrj 
120438fd1498Szrj /* DECL_EXPR accessor. This gives access to the DECL associated with
120538fd1498Szrj    the given declaration statement.  */
120638fd1498Szrj #define DECL_EXPR_DECL(NODE)    TREE_OPERAND (DECL_EXPR_CHECK (NODE), 0)
120738fd1498Szrj 
120838fd1498Szrj #define EXIT_EXPR_COND(NODE)	     TREE_OPERAND (EXIT_EXPR_CHECK (NODE), 0)
120938fd1498Szrj 
121038fd1498Szrj /* COMPOUND_LITERAL_EXPR accessors.  */
121138fd1498Szrj #define COMPOUND_LITERAL_EXPR_DECL_EXPR(NODE)		\
121238fd1498Szrj   TREE_OPERAND (COMPOUND_LITERAL_EXPR_CHECK (NODE), 0)
121338fd1498Szrj #define COMPOUND_LITERAL_EXPR_DECL(NODE)			\
121438fd1498Szrj   DECL_EXPR_DECL (COMPOUND_LITERAL_EXPR_DECL_EXPR (NODE))
121538fd1498Szrj 
121638fd1498Szrj /* SWITCH_EXPR accessors. These give access to the condition and body.  */
121738fd1498Szrj #define SWITCH_COND(NODE)       TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 0)
121838fd1498Szrj #define SWITCH_BODY(NODE)       TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 1)
121938fd1498Szrj /* True if there are case labels for all possible values of SWITCH_COND, either
122038fd1498Szrj    because there is a default: case label or because the case label ranges cover
122138fd1498Szrj    all values.  */
122238fd1498Szrj #define SWITCH_ALL_CASES_P(NODE) (SWITCH_EXPR_CHECK (NODE)->base.private_flag)
122338fd1498Szrj 
122438fd1498Szrj /* CASE_LABEL_EXPR accessors. These give access to the high and low values
122538fd1498Szrj    of a case label, respectively.  */
122638fd1498Szrj #define CASE_LOW(NODE)          	TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 0)
122738fd1498Szrj #define CASE_HIGH(NODE)         	TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 1)
122838fd1498Szrj #define CASE_LABEL(NODE)		TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 2)
122938fd1498Szrj #define CASE_CHAIN(NODE)		TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 3)
123038fd1498Szrj 
123138fd1498Szrj /* The operands of a TARGET_MEM_REF.  Operands 0 and 1 have to match
123238fd1498Szrj    corresponding MEM_REF operands.  */
123338fd1498Szrj #define TMR_BASE(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 0))
123438fd1498Szrj #define TMR_OFFSET(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 1))
123538fd1498Szrj #define TMR_INDEX(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 2))
123638fd1498Szrj #define TMR_STEP(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 3))
123738fd1498Szrj #define TMR_INDEX2(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 4))
123838fd1498Szrj 
123938fd1498Szrj #define MR_DEPENDENCE_CLIQUE(NODE) \
124038fd1498Szrj   (TREE_CHECK2 (NODE, MEM_REF, TARGET_MEM_REF)->base.u.dependence_info.clique)
124138fd1498Szrj #define MR_DEPENDENCE_BASE(NODE) \
124238fd1498Szrj   (TREE_CHECK2 (NODE, MEM_REF, TARGET_MEM_REF)->base.u.dependence_info.base)
124338fd1498Szrj 
124438fd1498Szrj /* The operands of a BIND_EXPR.  */
124538fd1498Szrj #define BIND_EXPR_VARS(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 0))
124638fd1498Szrj #define BIND_EXPR_BODY(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 1))
124738fd1498Szrj #define BIND_EXPR_BLOCK(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 2))
124838fd1498Szrj 
124938fd1498Szrj /* GOTO_EXPR accessor. This gives access to the label associated with
125038fd1498Szrj    a goto statement.  */
125138fd1498Szrj #define GOTO_DESTINATION(NODE)  TREE_OPERAND (GOTO_EXPR_CHECK (NODE), 0)
125238fd1498Szrj 
125338fd1498Szrj /* ASM_EXPR accessors. ASM_STRING returns a STRING_CST for the
125438fd1498Szrj    instruction (e.g., "mov x, y"). ASM_OUTPUTS, ASM_INPUTS, and
125538fd1498Szrj    ASM_CLOBBERS represent the outputs, inputs, and clobbers for the
125638fd1498Szrj    statement.  */
125738fd1498Szrj #define ASM_STRING(NODE)        TREE_OPERAND (ASM_EXPR_CHECK (NODE), 0)
125838fd1498Szrj #define ASM_OUTPUTS(NODE)       TREE_OPERAND (ASM_EXPR_CHECK (NODE), 1)
125938fd1498Szrj #define ASM_INPUTS(NODE)        TREE_OPERAND (ASM_EXPR_CHECK (NODE), 2)
126038fd1498Szrj #define ASM_CLOBBERS(NODE)      TREE_OPERAND (ASM_EXPR_CHECK (NODE), 3)
126138fd1498Szrj #define ASM_LABELS(NODE)	TREE_OPERAND (ASM_EXPR_CHECK (NODE), 4)
126238fd1498Szrj /* Nonzero if we want to create an ASM_INPUT instead of an
126338fd1498Szrj    ASM_OPERAND with no operands.  */
126438fd1498Szrj #define ASM_INPUT_P(NODE) (ASM_EXPR_CHECK (NODE)->base.static_flag)
126538fd1498Szrj #define ASM_VOLATILE_P(NODE) (ASM_EXPR_CHECK (NODE)->base.public_flag)
1266*58e805e6Szrj /* Nonzero if we want to consider this asm as minimum length and cost
1267*58e805e6Szrj    for inlining decisions.  */
1268*58e805e6Szrj #define ASM_INLINE_P(NODE) (ASM_EXPR_CHECK (NODE)->base.protected_flag)
126938fd1498Szrj 
127038fd1498Szrj /* COND_EXPR accessors.  */
127138fd1498Szrj #define COND_EXPR_COND(NODE)	(TREE_OPERAND (COND_EXPR_CHECK (NODE), 0))
127238fd1498Szrj #define COND_EXPR_THEN(NODE)	(TREE_OPERAND (COND_EXPR_CHECK (NODE), 1))
127338fd1498Szrj #define COND_EXPR_ELSE(NODE)	(TREE_OPERAND (COND_EXPR_CHECK (NODE), 2))
127438fd1498Szrj 
127538fd1498Szrj /* Accessors for the chains of recurrences.  */
127638fd1498Szrj #define CHREC_LEFT(NODE)          TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 0)
127738fd1498Szrj #define CHREC_RIGHT(NODE)         TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 1)
127838fd1498Szrj #define CHREC_VARIABLE(NODE)      POLYNOMIAL_CHREC_CHECK (NODE)->base.u.chrec_var
127938fd1498Szrj 
128038fd1498Szrj /* LABEL_EXPR accessor. This gives access to the label associated with
128138fd1498Szrj    the given label expression.  */
128238fd1498Szrj #define LABEL_EXPR_LABEL(NODE)  TREE_OPERAND (LABEL_EXPR_CHECK (NODE), 0)
128338fd1498Szrj 
128438fd1498Szrj /* CATCH_EXPR accessors.  */
128538fd1498Szrj #define CATCH_TYPES(NODE)	TREE_OPERAND (CATCH_EXPR_CHECK (NODE), 0)
128638fd1498Szrj #define CATCH_BODY(NODE)	TREE_OPERAND (CATCH_EXPR_CHECK (NODE), 1)
128738fd1498Szrj 
128838fd1498Szrj /* EH_FILTER_EXPR accessors.  */
128938fd1498Szrj #define EH_FILTER_TYPES(NODE)	TREE_OPERAND (EH_FILTER_EXPR_CHECK (NODE), 0)
129038fd1498Szrj #define EH_FILTER_FAILURE(NODE)	TREE_OPERAND (EH_FILTER_EXPR_CHECK (NODE), 1)
129138fd1498Szrj 
129238fd1498Szrj /* OBJ_TYPE_REF accessors.  */
129338fd1498Szrj #define OBJ_TYPE_REF_EXPR(NODE)	  TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 0)
129438fd1498Szrj #define OBJ_TYPE_REF_OBJECT(NODE) TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 1)
129538fd1498Szrj #define OBJ_TYPE_REF_TOKEN(NODE)  TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 2)
129638fd1498Szrj 
129738fd1498Szrj /* ASSERT_EXPR accessors.  */
129838fd1498Szrj #define ASSERT_EXPR_VAR(NODE)	TREE_OPERAND (ASSERT_EXPR_CHECK (NODE), 0)
129938fd1498Szrj #define ASSERT_EXPR_COND(NODE)	TREE_OPERAND (ASSERT_EXPR_CHECK (NODE), 1)
130038fd1498Szrj 
130138fd1498Szrj /* CALL_EXPR accessors.  */
130238fd1498Szrj #define CALL_EXPR_FN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 1)
130338fd1498Szrj #define CALL_EXPR_STATIC_CHAIN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 2)
130438fd1498Szrj #define CALL_EXPR_ARG(NODE, I) TREE_OPERAND (CALL_EXPR_CHECK (NODE), (I) + 3)
130538fd1498Szrj #define call_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH (NODE) - 3)
130638fd1498Szrj #define CALL_EXPR_IFN(NODE) (CALL_EXPR_CHECK (NODE)->base.u.ifn)
130738fd1498Szrj 
130838fd1498Szrj /* CALL_EXPR_ARGP returns a pointer to the argument vector for NODE.
130938fd1498Szrj    We can't use &CALL_EXPR_ARG (NODE, 0) because that will complain if
131038fd1498Szrj    the argument count is zero when checking is enabled.  Instead, do
131138fd1498Szrj    the pointer arithmetic to advance past the 3 fixed operands in a
131238fd1498Szrj    CALL_EXPR.  That produces a valid pointer to just past the end of the
131338fd1498Szrj    operand array, even if it's not valid to dereference it.  */
131438fd1498Szrj #define CALL_EXPR_ARGP(NODE) \
131538fd1498Szrj   (&(TREE_OPERAND (CALL_EXPR_CHECK (NODE), 0)) + 3)
131638fd1498Szrj 
131738fd1498Szrj /* TM directives and accessors.  */
131838fd1498Szrj #define TRANSACTION_EXPR_BODY(NODE) \
131938fd1498Szrj   TREE_OPERAND (TRANSACTION_EXPR_CHECK (NODE), 0)
132038fd1498Szrj #define TRANSACTION_EXPR_OUTER(NODE) \
132138fd1498Szrj   (TRANSACTION_EXPR_CHECK (NODE)->base.static_flag)
132238fd1498Szrj #define TRANSACTION_EXPR_RELAXED(NODE) \
132338fd1498Szrj   (TRANSACTION_EXPR_CHECK (NODE)->base.public_flag)
132438fd1498Szrj 
132538fd1498Szrj /* OpenMP and OpenACC directive and clause accessors.  */
132638fd1498Szrj 
132738fd1498Szrj /* Generic accessors for OMP nodes that keep the body as operand 0, and clauses
132838fd1498Szrj    as operand 1.  */
132938fd1498Szrj #define OMP_BODY(NODE) \
133038fd1498Szrj   TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_PARALLEL, OMP_TASKGROUP), 0)
133138fd1498Szrj #define OMP_CLAUSES(NODE) \
133238fd1498Szrj   TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_PARALLEL, OMP_SINGLE), 1)
133338fd1498Szrj 
133438fd1498Szrj /* Generic accessors for OMP nodes that keep clauses as operand 0.  */
133538fd1498Szrj #define OMP_STANDALONE_CLAUSES(NODE) \
133638fd1498Szrj   TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_CACHE, OMP_TARGET_EXIT_DATA), 0)
133738fd1498Szrj 
133838fd1498Szrj #define OACC_DATA_BODY(NODE) \
133938fd1498Szrj   TREE_OPERAND (OACC_DATA_CHECK (NODE), 0)
134038fd1498Szrj #define OACC_DATA_CLAUSES(NODE) \
134138fd1498Szrj   TREE_OPERAND (OACC_DATA_CHECK (NODE), 1)
134238fd1498Szrj 
134338fd1498Szrj #define OACC_HOST_DATA_BODY(NODE) \
134438fd1498Szrj   TREE_OPERAND (OACC_HOST_DATA_CHECK (NODE), 0)
134538fd1498Szrj #define OACC_HOST_DATA_CLAUSES(NODE) \
134638fd1498Szrj   TREE_OPERAND (OACC_HOST_DATA_CHECK (NODE), 1)
134738fd1498Szrj 
134838fd1498Szrj #define OACC_CACHE_CLAUSES(NODE) \
134938fd1498Szrj   TREE_OPERAND (OACC_CACHE_CHECK (NODE), 0)
135038fd1498Szrj 
135138fd1498Szrj #define OACC_DECLARE_CLAUSES(NODE) \
135238fd1498Szrj   TREE_OPERAND (OACC_DECLARE_CHECK (NODE), 0)
135338fd1498Szrj 
135438fd1498Szrj #define OACC_ENTER_DATA_CLAUSES(NODE) \
135538fd1498Szrj   TREE_OPERAND (OACC_ENTER_DATA_CHECK (NODE), 0)
135638fd1498Szrj 
135738fd1498Szrj #define OACC_EXIT_DATA_CLAUSES(NODE) \
135838fd1498Szrj   TREE_OPERAND (OACC_EXIT_DATA_CHECK (NODE), 0)
135938fd1498Szrj 
136038fd1498Szrj #define OACC_UPDATE_CLAUSES(NODE) \
136138fd1498Szrj   TREE_OPERAND (OACC_UPDATE_CHECK (NODE), 0)
136238fd1498Szrj 
136338fd1498Szrj #define OMP_PARALLEL_BODY(NODE)    TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 0)
136438fd1498Szrj #define OMP_PARALLEL_CLAUSES(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 1)
136538fd1498Szrj 
136638fd1498Szrj #define OMP_TASK_BODY(NODE)	   TREE_OPERAND (OMP_TASK_CHECK (NODE), 0)
136738fd1498Szrj #define OMP_TASK_CLAUSES(NODE)	   TREE_OPERAND (OMP_TASK_CHECK (NODE), 1)
136838fd1498Szrj 
136938fd1498Szrj #define OMP_TASKREG_CHECK(NODE)	  TREE_RANGE_CHECK (NODE, OMP_PARALLEL, OMP_TASK)
137038fd1498Szrj #define OMP_TASKREG_BODY(NODE)    TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 0)
137138fd1498Szrj #define OMP_TASKREG_CLAUSES(NODE) TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 1)
137238fd1498Szrj 
137338fd1498Szrj #define OMP_LOOP_CHECK(NODE) TREE_RANGE_CHECK (NODE, OMP_FOR, OACC_LOOP)
137438fd1498Szrj #define OMP_FOR_BODY(NODE)	   TREE_OPERAND (OMP_LOOP_CHECK (NODE), 0)
137538fd1498Szrj #define OMP_FOR_CLAUSES(NODE)	   TREE_OPERAND (OMP_LOOP_CHECK (NODE), 1)
137638fd1498Szrj #define OMP_FOR_INIT(NODE)	   TREE_OPERAND (OMP_LOOP_CHECK (NODE), 2)
137738fd1498Szrj #define OMP_FOR_COND(NODE)	   TREE_OPERAND (OMP_LOOP_CHECK (NODE), 3)
137838fd1498Szrj #define OMP_FOR_INCR(NODE)	   TREE_OPERAND (OMP_LOOP_CHECK (NODE), 4)
137938fd1498Szrj #define OMP_FOR_PRE_BODY(NODE)	   TREE_OPERAND (OMP_LOOP_CHECK (NODE), 5)
138038fd1498Szrj #define OMP_FOR_ORIG_DECLS(NODE)   TREE_OPERAND (OMP_LOOP_CHECK (NODE), 6)
138138fd1498Szrj 
138238fd1498Szrj #define OMP_SECTIONS_BODY(NODE)    TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 0)
138338fd1498Szrj #define OMP_SECTIONS_CLAUSES(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 1)
138438fd1498Szrj 
138538fd1498Szrj #define OMP_SECTION_BODY(NODE)	   TREE_OPERAND (OMP_SECTION_CHECK (NODE), 0)
138638fd1498Szrj 
138738fd1498Szrj #define OMP_SINGLE_BODY(NODE)	   TREE_OPERAND (OMP_SINGLE_CHECK (NODE), 0)
138838fd1498Szrj #define OMP_SINGLE_CLAUSES(NODE)   TREE_OPERAND (OMP_SINGLE_CHECK (NODE), 1)
138938fd1498Szrj 
139038fd1498Szrj #define OMP_MASTER_BODY(NODE)	   TREE_OPERAND (OMP_MASTER_CHECK (NODE), 0)
139138fd1498Szrj 
139238fd1498Szrj #define OMP_TASKGROUP_BODY(NODE)   TREE_OPERAND (OMP_TASKGROUP_CHECK (NODE), 0)
139338fd1498Szrj 
139438fd1498Szrj #define OMP_ORDERED_BODY(NODE)	   TREE_OPERAND (OMP_ORDERED_CHECK (NODE), 0)
139538fd1498Szrj #define OMP_ORDERED_CLAUSES(NODE)  TREE_OPERAND (OMP_ORDERED_CHECK (NODE), 1)
139638fd1498Szrj 
139738fd1498Szrj #define OMP_CRITICAL_BODY(NODE)    TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 0)
139838fd1498Szrj #define OMP_CRITICAL_CLAUSES(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 1)
139938fd1498Szrj #define OMP_CRITICAL_NAME(NODE)    TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 2)
140038fd1498Szrj 
140138fd1498Szrj #define OMP_TEAMS_BODY(NODE)	   TREE_OPERAND (OMP_TEAMS_CHECK (NODE), 0)
140238fd1498Szrj #define OMP_TEAMS_CLAUSES(NODE)	   TREE_OPERAND (OMP_TEAMS_CHECK (NODE), 1)
140338fd1498Szrj 
140438fd1498Szrj #define OMP_TARGET_DATA_BODY(NODE) \
140538fd1498Szrj   TREE_OPERAND (OMP_TARGET_DATA_CHECK (NODE), 0)
140638fd1498Szrj #define OMP_TARGET_DATA_CLAUSES(NODE)\
140738fd1498Szrj   TREE_OPERAND (OMP_TARGET_DATA_CHECK (NODE), 1)
140838fd1498Szrj 
140938fd1498Szrj #define OMP_TARGET_BODY(NODE)	   TREE_OPERAND (OMP_TARGET_CHECK (NODE), 0)
141038fd1498Szrj #define OMP_TARGET_CLAUSES(NODE)   TREE_OPERAND (OMP_TARGET_CHECK (NODE), 1)
141138fd1498Szrj 
141238fd1498Szrj #define OMP_TARGET_UPDATE_CLAUSES(NODE)\
141338fd1498Szrj   TREE_OPERAND (OMP_TARGET_UPDATE_CHECK (NODE), 0)
141438fd1498Szrj 
141538fd1498Szrj #define OMP_TARGET_ENTER_DATA_CLAUSES(NODE)\
141638fd1498Szrj   TREE_OPERAND (OMP_TARGET_ENTER_DATA_CHECK (NODE), 0)
141738fd1498Szrj 
141838fd1498Szrj #define OMP_TARGET_EXIT_DATA_CLAUSES(NODE)\
141938fd1498Szrj   TREE_OPERAND (OMP_TARGET_EXIT_DATA_CHECK (NODE), 0)
142038fd1498Szrj 
142138fd1498Szrj #define OMP_CLAUSE_SIZE(NODE)						\
142238fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE),	\
142338fd1498Szrj 					      OMP_CLAUSE_FROM,		\
142438fd1498Szrj 					      OMP_CLAUSE__CACHE_), 1)
142538fd1498Szrj 
142638fd1498Szrj #define OMP_CLAUSE_CHAIN(NODE)     TREE_CHAIN (OMP_CLAUSE_CHECK (NODE))
142738fd1498Szrj #define OMP_CLAUSE_DECL(NODE)      					\
142838fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE),	\
142938fd1498Szrj 					      OMP_CLAUSE_PRIVATE,	\
143038fd1498Szrj 					      OMP_CLAUSE__LOOPTEMP_), 0)
143138fd1498Szrj #define OMP_CLAUSE_HAS_LOCATION(NODE) \
143238fd1498Szrj   (LOCATION_LOCUS ((OMP_CLAUSE_CHECK (NODE))->omp_clause.locus)		\
143338fd1498Szrj   != UNKNOWN_LOCATION)
143438fd1498Szrj #define OMP_CLAUSE_LOCATION(NODE)  (OMP_CLAUSE_CHECK (NODE))->omp_clause.locus
143538fd1498Szrj 
143638fd1498Szrj /* True on an OMP_SECTION statement that was the last lexical member.
143738fd1498Szrj    This status is meaningful in the implementation of lastprivate.  */
143838fd1498Szrj #define OMP_SECTION_LAST(NODE) \
143938fd1498Szrj   (OMP_SECTION_CHECK (NODE)->base.private_flag)
144038fd1498Szrj 
144138fd1498Szrj /* True on an OMP_PARALLEL statement if it represents an explicit
144238fd1498Szrj    combined parallel work-sharing constructs.  */
144338fd1498Szrj #define OMP_PARALLEL_COMBINED(NODE) \
144438fd1498Szrj   (OMP_PARALLEL_CHECK (NODE)->base.private_flag)
144538fd1498Szrj 
144638fd1498Szrj /* True on an OMP_TEAMS statement if it represents an explicit
144738fd1498Szrj    combined teams distribute constructs.  */
144838fd1498Szrj #define OMP_TEAMS_COMBINED(NODE) \
144938fd1498Szrj   (OMP_TEAMS_CHECK (NODE)->base.private_flag)
145038fd1498Szrj 
145138fd1498Szrj /* True on an OMP_TARGET statement if it represents explicit
145238fd1498Szrj    combined target teams, target parallel or target simd constructs.  */
145338fd1498Szrj #define OMP_TARGET_COMBINED(NODE) \
145438fd1498Szrj   (OMP_TARGET_CHECK (NODE)->base.private_flag)
145538fd1498Szrj 
145638fd1498Szrj /* True if OMP_ATOMIC* is supposed to be sequentially consistent
145738fd1498Szrj    as opposed to relaxed.  */
145838fd1498Szrj #define OMP_ATOMIC_SEQ_CST(NODE) \
145938fd1498Szrj   (TREE_RANGE_CHECK (NODE, OMP_ATOMIC, \
146038fd1498Szrj 		     OMP_ATOMIC_CAPTURE_NEW)->base.private_flag)
146138fd1498Szrj 
146238fd1498Szrj /* True on a PRIVATE clause if its decl is kept around for debugging
146338fd1498Szrj    information only and its DECL_VALUE_EXPR is supposed to point
146438fd1498Szrj    to what it has been remapped to.  */
146538fd1498Szrj #define OMP_CLAUSE_PRIVATE_DEBUG(NODE) \
146638fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE)->base.public_flag)
146738fd1498Szrj 
146838fd1498Szrj /* True on a PRIVATE clause if ctor needs access to outer region's
146938fd1498Szrj    variable.  */
147038fd1498Szrj #define OMP_CLAUSE_PRIVATE_OUTER_REF(NODE) \
147138fd1498Szrj   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE))
147238fd1498Szrj 
147338fd1498Szrj /* True if a PRIVATE clause is for a C++ class IV on taskloop construct
147438fd1498Szrj    (thus should be private on the outer taskloop and firstprivate on
147538fd1498Szrj    task).  */
147638fd1498Szrj #define OMP_CLAUSE_PRIVATE_TASKLOOP_IV(NODE) \
147738fd1498Szrj   TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE))
147838fd1498Szrj 
147938fd1498Szrj /* True on a FIRSTPRIVATE clause if it has been added implicitly.  */
148038fd1498Szrj #define OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT(NODE) \
148138fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FIRSTPRIVATE)->base.public_flag)
148238fd1498Szrj 
148338fd1498Szrj /* True on a LASTPRIVATE clause if a FIRSTPRIVATE clause for the same
148438fd1498Szrj    decl is present in the chain.  */
148538fd1498Szrj #define OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE(NODE) \
148638fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LASTPRIVATE)->base.public_flag)
148738fd1498Szrj #define OMP_CLAUSE_LASTPRIVATE_STMT(NODE) \
148838fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE,			\
148938fd1498Szrj 						OMP_CLAUSE_LASTPRIVATE),\
149038fd1498Szrj 		      1)
149138fd1498Szrj #define OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ(NODE) \
149238fd1498Szrj   (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init
149338fd1498Szrj 
149438fd1498Szrj /* True if a LASTPRIVATE clause is for a C++ class IV on taskloop construct
149538fd1498Szrj    (thus should be lastprivate on the outer taskloop and firstprivate on
149638fd1498Szrj    task).  */
149738fd1498Szrj #define OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV(NODE) \
149838fd1498Szrj   TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LASTPRIVATE))
149938fd1498Szrj 
150038fd1498Szrj /* True on a SHARED clause if a FIRSTPRIVATE clause for the same
150138fd1498Szrj    decl is present in the chain (this can happen only for taskloop
150238fd1498Szrj    with FIRSTPRIVATE/LASTPRIVATE on it originally.  */
150338fd1498Szrj #define OMP_CLAUSE_SHARED_FIRSTPRIVATE(NODE) \
150438fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SHARED)->base.public_flag)
150538fd1498Szrj 
150638fd1498Szrj /* True on a SHARED clause if a scalar is not modified in the body and
150738fd1498Szrj    thus could be optimized as firstprivate.  */
150838fd1498Szrj #define OMP_CLAUSE_SHARED_READONLY(NODE) \
150938fd1498Szrj   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SHARED))
151038fd1498Szrj 
151138fd1498Szrj #define OMP_CLAUSE_IF_MODIFIER(NODE)	\
151238fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF)->omp_clause.subcode.if_modifier)
151338fd1498Szrj 
151438fd1498Szrj #define OMP_CLAUSE_FINAL_EXPR(NODE) \
151538fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FINAL), 0)
151638fd1498Szrj #define OMP_CLAUSE_IF_EXPR(NODE) \
151738fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF), 0)
151838fd1498Szrj #define OMP_CLAUSE_NUM_THREADS_EXPR(NODE) \
151938fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_THREADS),0)
152038fd1498Szrj #define OMP_CLAUSE_SCHEDULE_CHUNK_EXPR(NODE) \
152138fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE), 0)
152238fd1498Szrj #define OMP_CLAUSE_NUM_TASKS_EXPR(NODE) \
152338fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_TASKS), 0)
152438fd1498Szrj #define OMP_CLAUSE_HINT_EXPR(NODE) \
152538fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_HINT), 0)
152638fd1498Szrj 
152738fd1498Szrj #define OMP_CLAUSE_GRAINSIZE_EXPR(NODE) \
152838fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GRAINSIZE),0)
152938fd1498Szrj 
153038fd1498Szrj #define OMP_CLAUSE_PRIORITY_EXPR(NODE) \
153138fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIORITY),0)
153238fd1498Szrj 
153338fd1498Szrj /* OpenACC clause expressions  */
153438fd1498Szrj #define OMP_CLAUSE_EXPR(NODE, CLAUSE) \
153538fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, CLAUSE), 0)
153638fd1498Szrj #define OMP_CLAUSE_GANG_EXPR(NODE) \
153738fd1498Szrj   OMP_CLAUSE_OPERAND ( \
153838fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GANG), 0)
153938fd1498Szrj #define OMP_CLAUSE_GANG_STATIC_EXPR(NODE) \
154038fd1498Szrj   OMP_CLAUSE_OPERAND ( \
154138fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GANG), 1)
154238fd1498Szrj #define OMP_CLAUSE_ASYNC_EXPR(NODE) \
154338fd1498Szrj   OMP_CLAUSE_OPERAND ( \
154438fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ASYNC), 0)
154538fd1498Szrj #define OMP_CLAUSE_WAIT_EXPR(NODE) \
154638fd1498Szrj   OMP_CLAUSE_OPERAND ( \
154738fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_WAIT), 0)
154838fd1498Szrj #define OMP_CLAUSE_VECTOR_EXPR(NODE) \
154938fd1498Szrj   OMP_CLAUSE_OPERAND ( \
155038fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_VECTOR), 0)
155138fd1498Szrj #define OMP_CLAUSE_WORKER_EXPR(NODE) \
155238fd1498Szrj   OMP_CLAUSE_OPERAND ( \
155338fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_WORKER), 0)
155438fd1498Szrj #define OMP_CLAUSE_NUM_GANGS_EXPR(NODE) \
155538fd1498Szrj   OMP_CLAUSE_OPERAND ( \
155638fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_GANGS), 0)
155738fd1498Szrj #define OMP_CLAUSE_NUM_WORKERS_EXPR(NODE) \
155838fd1498Szrj   OMP_CLAUSE_OPERAND ( \
155938fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_WORKERS), 0)
156038fd1498Szrj #define OMP_CLAUSE_VECTOR_LENGTH_EXPR(NODE) \
156138fd1498Szrj   OMP_CLAUSE_OPERAND ( \
156238fd1498Szrj     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_VECTOR_LENGTH), 0)
156338fd1498Szrj 
156438fd1498Szrj #define OMP_CLAUSE_DEPEND_KIND(NODE) \
156538fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEPEND)->omp_clause.subcode.depend_kind)
156638fd1498Szrj 
156738fd1498Szrj #define OMP_CLAUSE_DEPEND_SINK_NEGATIVE(NODE) \
156838fd1498Szrj   TREE_PUBLIC (TREE_LIST_CHECK (NODE))
156938fd1498Szrj 
157038fd1498Szrj #define OMP_CLAUSE_MAP_KIND(NODE) \
157138fd1498Szrj   ((enum gomp_map_kind) OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind)
157238fd1498Szrj #define OMP_CLAUSE_SET_MAP_KIND(NODE, MAP_KIND) \
157338fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind \
157438fd1498Szrj    = (unsigned int) (MAP_KIND))
157538fd1498Szrj 
157638fd1498Szrj /* Nonzero if this map clause is for array (rather than pointer) based array
157738fd1498Szrj    section with zero bias.  Both the non-decl OMP_CLAUSE_MAP and corresponding
157838fd1498Szrj    OMP_CLAUSE_MAP with GOMP_MAP_POINTER are marked with this flag.  */
157938fd1498Szrj #define OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION(NODE) \
158038fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->base.public_flag)
158138fd1498Szrj /* Nonzero if this is a mapped array section, that might need special
158238fd1498Szrj    treatment if OMP_CLAUSE_SIZE is zero.  */
158338fd1498Szrj #define OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION(NODE) \
158438fd1498Szrj   TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP))
158538fd1498Szrj /* Nonzero if this map clause is for an ACC parallel reduction variable.  */
158638fd1498Szrj #define OMP_CLAUSE_MAP_IN_REDUCTION(NODE) \
158738fd1498Szrj   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP))
158838fd1498Szrj 
158938fd1498Szrj #define OMP_CLAUSE_PROC_BIND_KIND(NODE) \
159038fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PROC_BIND)->omp_clause.subcode.proc_bind_kind)
159138fd1498Szrj 
159238fd1498Szrj #define OMP_CLAUSE_COLLAPSE_EXPR(NODE) \
159338fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 0)
159438fd1498Szrj #define OMP_CLAUSE_COLLAPSE_ITERVAR(NODE) \
159538fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 1)
159638fd1498Szrj #define OMP_CLAUSE_COLLAPSE_COUNT(NODE) \
159738fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 2)
159838fd1498Szrj 
159938fd1498Szrj #define OMP_CLAUSE_ORDERED_EXPR(NODE) \
160038fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ORDERED), 0)
160138fd1498Szrj 
160238fd1498Szrj #define OMP_CLAUSE_REDUCTION_CODE(NODE)	\
160338fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION)->omp_clause.subcode.reduction_code)
160438fd1498Szrj #define OMP_CLAUSE_REDUCTION_INIT(NODE) \
160538fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 1)
160638fd1498Szrj #define OMP_CLAUSE_REDUCTION_MERGE(NODE) \
160738fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 2)
160838fd1498Szrj #define OMP_CLAUSE_REDUCTION_GIMPLE_INIT(NODE) \
160938fd1498Szrj   (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init
161038fd1498Szrj #define OMP_CLAUSE_REDUCTION_GIMPLE_MERGE(NODE) \
161138fd1498Szrj   (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_merge
161238fd1498Szrj #define OMP_CLAUSE_REDUCTION_PLACEHOLDER(NODE) \
161338fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 3)
161438fd1498Szrj #define OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER(NODE) \
161538fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 4)
161638fd1498Szrj 
161738fd1498Szrj /* True if a REDUCTION clause may reference the original list item (omp_orig)
161838fd1498Szrj    in its OMP_CLAUSE_REDUCTION_{,GIMPLE_}INIT.  */
161938fd1498Szrj #define OMP_CLAUSE_REDUCTION_OMP_ORIG_REF(NODE) \
162038fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION)->base.public_flag)
162138fd1498Szrj 
162238fd1498Szrj /* True if a LINEAR clause doesn't need copy in.  True for iterator vars which
162338fd1498Szrj    are always initialized inside of the loop construct, false otherwise.  */
162438fd1498Szrj #define OMP_CLAUSE_LINEAR_NO_COPYIN(NODE) \
162538fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->base.public_flag)
162638fd1498Szrj 
162738fd1498Szrj /* True if a LINEAR clause doesn't need copy out.  True for iterator vars which
162838fd1498Szrj    are declared inside of the simd construct.  */
162938fd1498Szrj #define OMP_CLAUSE_LINEAR_NO_COPYOUT(NODE) \
163038fd1498Szrj   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR))
163138fd1498Szrj 
163238fd1498Szrj /* True if a LINEAR clause has a stride that is variable.  */
163338fd1498Szrj #define OMP_CLAUSE_LINEAR_VARIABLE_STRIDE(NODE) \
163438fd1498Szrj   TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR))
163538fd1498Szrj 
163638fd1498Szrj /* True if a LINEAR clause is for an array or allocatable variable that
163738fd1498Szrj    needs special handling by the frontend.  */
163838fd1498Szrj #define OMP_CLAUSE_LINEAR_ARRAY(NODE) \
163938fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->base.deprecated_flag)
164038fd1498Szrj 
164138fd1498Szrj #define OMP_CLAUSE_LINEAR_STEP(NODE) \
164238fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR), 1)
164338fd1498Szrj 
164438fd1498Szrj #define OMP_CLAUSE_LINEAR_STMT(NODE) \
164538fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR), 2)
164638fd1498Szrj 
164738fd1498Szrj #define OMP_CLAUSE_LINEAR_GIMPLE_SEQ(NODE) \
164838fd1498Szrj   (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init
164938fd1498Szrj 
165038fd1498Szrj #define OMP_CLAUSE_LINEAR_KIND(NODE) \
165138fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->omp_clause.subcode.linear_kind)
165238fd1498Szrj 
165338fd1498Szrj #define OMP_CLAUSE_ALIGNED_ALIGNMENT(NODE) \
165438fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ALIGNED), 1)
165538fd1498Szrj 
165638fd1498Szrj #define OMP_CLAUSE_NUM_TEAMS_EXPR(NODE) \
165738fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_TEAMS), 0)
165838fd1498Szrj 
165938fd1498Szrj #define OMP_CLAUSE_THREAD_LIMIT_EXPR(NODE) \
166038fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, \
166138fd1498Szrj 						OMP_CLAUSE_THREAD_LIMIT), 0)
166238fd1498Szrj 
166338fd1498Szrj #define OMP_CLAUSE_DEVICE_ID(NODE) \
166438fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEVICE), 0)
166538fd1498Szrj 
166638fd1498Szrj #define OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR(NODE) \
166738fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, \
166838fd1498Szrj 						OMP_CLAUSE_DIST_SCHEDULE), 0)
166938fd1498Szrj 
167038fd1498Szrj #define OMP_CLAUSE_SAFELEN_EXPR(NODE) \
167138fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SAFELEN), 0)
167238fd1498Szrj 
167338fd1498Szrj #define OMP_CLAUSE_SIMDLEN_EXPR(NODE) \
167438fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SIMDLEN), 0)
167538fd1498Szrj 
167638fd1498Szrj #define OMP_CLAUSE__SIMDUID__DECL(NODE) \
167738fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__SIMDUID_), 0)
167838fd1498Szrj 
167938fd1498Szrj #define OMP_CLAUSE_SCHEDULE_KIND(NODE) \
168038fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->omp_clause.subcode.schedule_kind)
168138fd1498Szrj 
168238fd1498Szrj /* True if a SCHEDULE clause has the simd modifier on it.  */
168338fd1498Szrj #define OMP_CLAUSE_SCHEDULE_SIMD(NODE) \
168438fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->base.public_flag)
168538fd1498Szrj 
168638fd1498Szrj #define OMP_CLAUSE_DEFAULT_KIND(NODE) \
168738fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEFAULT)->omp_clause.subcode.default_kind)
168838fd1498Szrj 
168938fd1498Szrj #define OMP_CLAUSE_TILE_LIST(NODE) \
169038fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_TILE), 0)
169138fd1498Szrj #define OMP_CLAUSE_TILE_ITERVAR(NODE) \
169238fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_TILE), 1)
169338fd1498Szrj #define OMP_CLAUSE_TILE_COUNT(NODE) \
169438fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_TILE), 2)
169538fd1498Szrj 
169638fd1498Szrj #define OMP_CLAUSE__GRIDDIM__DIMENSION(NODE) \
169738fd1498Szrj   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_)\
169838fd1498Szrj    ->omp_clause.subcode.dimension)
169938fd1498Szrj #define OMP_CLAUSE__GRIDDIM__SIZE(NODE) \
170038fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_), 0)
170138fd1498Szrj #define OMP_CLAUSE__GRIDDIM__GROUP(NODE) \
170238fd1498Szrj   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_), 1)
170338fd1498Szrj 
170438fd1498Szrj /* SSA_NAME accessors.  */
170538fd1498Szrj 
170638fd1498Szrj /* Whether SSA_NAME NODE is a virtual operand.  This simply caches the
170738fd1498Szrj    information in the underlying SSA_NAME_VAR for efficiency.  */
170838fd1498Szrj #define SSA_NAME_IS_VIRTUAL_OPERAND(NODE) \
170938fd1498Szrj   SSA_NAME_CHECK (NODE)->base.public_flag
171038fd1498Szrj 
171138fd1498Szrj /* Returns the IDENTIFIER_NODE giving the SSA name a name or NULL_TREE
171238fd1498Szrj    if there is no name associated with it.  */
171338fd1498Szrj #define SSA_NAME_IDENTIFIER(NODE)				\
171438fd1498Szrj   (SSA_NAME_CHECK (NODE)->ssa_name.var != NULL_TREE		\
171538fd1498Szrj    ? (TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE	\
171638fd1498Szrj       ? (NODE)->ssa_name.var					\
171738fd1498Szrj       : DECL_NAME ((NODE)->ssa_name.var))			\
171838fd1498Szrj    : NULL_TREE)
171938fd1498Szrj 
172038fd1498Szrj /* Returns the variable being referenced.  This can be NULL_TREE for
172138fd1498Szrj    temporaries not associated with any user variable.
172238fd1498Szrj    Once released, this is the only field that can be relied upon.  */
172338fd1498Szrj #define SSA_NAME_VAR(NODE)					\
172438fd1498Szrj   (SSA_NAME_CHECK (NODE)->ssa_name.var == NULL_TREE		\
172538fd1498Szrj    || TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE	\
172638fd1498Szrj    ? NULL_TREE : (NODE)->ssa_name.var)
172738fd1498Szrj 
172838fd1498Szrj #define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE,VAR) \
172938fd1498Szrj   do \
173038fd1498Szrj     { \
173138fd1498Szrj       tree var_ = (VAR); \
173238fd1498Szrj       SSA_NAME_CHECK (NODE)->ssa_name.var = var_; \
173338fd1498Szrj       SSA_NAME_IS_VIRTUAL_OPERAND (NODE) \
173438fd1498Szrj 	= (var_ \
173538fd1498Szrj 	   && TREE_CODE (var_) == VAR_DECL \
173638fd1498Szrj 	   && VAR_DECL_IS_VIRTUAL_OPERAND (var_)); \
173738fd1498Szrj     } \
173838fd1498Szrj   while (0)
173938fd1498Szrj 
174038fd1498Szrj /* Returns the statement which defines this SSA name.  */
174138fd1498Szrj #define SSA_NAME_DEF_STMT(NODE)	SSA_NAME_CHECK (NODE)->ssa_name.def_stmt
174238fd1498Szrj 
174338fd1498Szrj /* Returns the SSA version number of this SSA name.  Note that in
174438fd1498Szrj    tree SSA, version numbers are not per variable and may be recycled.  */
174538fd1498Szrj #define SSA_NAME_VERSION(NODE)	SSA_NAME_CHECK (NODE)->base.u.version
174638fd1498Szrj 
174738fd1498Szrj /* Nonzero if this SSA name occurs in an abnormal PHI.  SSA_NAMES are
174838fd1498Szrj    never output, so we can safely use the ASM_WRITTEN_FLAG for this
174938fd1498Szrj    status bit.  */
175038fd1498Szrj #define SSA_NAME_OCCURS_IN_ABNORMAL_PHI(NODE) \
175138fd1498Szrj     SSA_NAME_CHECK (NODE)->base.asm_written_flag
175238fd1498Szrj 
175338fd1498Szrj /* Nonzero if this SSA_NAME expression is currently on the free list of
175438fd1498Szrj    SSA_NAMES.  Using NOTHROW_FLAG seems reasonably safe since throwing
175538fd1498Szrj    has no meaning for an SSA_NAME.  */
175638fd1498Szrj #define SSA_NAME_IN_FREE_LIST(NODE) \
175738fd1498Szrj     SSA_NAME_CHECK (NODE)->base.nothrow_flag
175838fd1498Szrj 
175938fd1498Szrj /* Nonzero if this SSA_NAME is the default definition for the
176038fd1498Szrj    underlying symbol.  A default SSA name is created for symbol S if
176138fd1498Szrj    the very first reference to S in the function is a read operation.
176238fd1498Szrj    Default definitions are always created by an empty statement and
176338fd1498Szrj    belong to no basic block.  */
176438fd1498Szrj #define SSA_NAME_IS_DEFAULT_DEF(NODE) \
176538fd1498Szrj     SSA_NAME_CHECK (NODE)->base.default_def_flag
176638fd1498Szrj 
176738fd1498Szrj /* Attributes for SSA_NAMEs for pointer-type variables.  */
176838fd1498Szrj #define SSA_NAME_PTR_INFO(N) \
176938fd1498Szrj    SSA_NAME_CHECK (N)->ssa_name.info.ptr_info
177038fd1498Szrj 
177138fd1498Szrj /* True if SSA_NAME_RANGE_INFO describes an anti-range.  */
177238fd1498Szrj #define SSA_NAME_ANTI_RANGE_P(N) \
177338fd1498Szrj     SSA_NAME_CHECK (N)->base.static_flag
177438fd1498Szrj 
177538fd1498Szrj /* The type of range described by SSA_NAME_RANGE_INFO.  */
177638fd1498Szrj #define SSA_NAME_RANGE_TYPE(N) \
177738fd1498Szrj     (SSA_NAME_ANTI_RANGE_P (N) ? VR_ANTI_RANGE : VR_RANGE)
177838fd1498Szrj 
177938fd1498Szrj /* Value range info attributes for SSA_NAMEs of non pointer-type variables.  */
178038fd1498Szrj #define SSA_NAME_RANGE_INFO(N) \
178138fd1498Szrj     SSA_NAME_CHECK (N)->ssa_name.info.range_info
178238fd1498Szrj 
178338fd1498Szrj /* Return the immediate_use information for an SSA_NAME. */
178438fd1498Szrj #define SSA_NAME_IMM_USE_NODE(NODE) SSA_NAME_CHECK (NODE)->ssa_name.imm_uses
178538fd1498Szrj 
178638fd1498Szrj #define OMP_CLAUSE_CODE(NODE)					\
178738fd1498Szrj 	(OMP_CLAUSE_CHECK (NODE))->omp_clause.code
178838fd1498Szrj 
178938fd1498Szrj #define OMP_CLAUSE_SET_CODE(NODE, CODE)				\
179038fd1498Szrj 	((OMP_CLAUSE_CHECK (NODE))->omp_clause.code = (CODE))
179138fd1498Szrj 
179238fd1498Szrj #define OMP_CLAUSE_OPERAND(NODE, I)				\
179338fd1498Szrj 	OMP_CLAUSE_ELT_CHECK (NODE, I)
179438fd1498Szrj 
179538fd1498Szrj /* In a BLOCK node.  */
179638fd1498Szrj #define BLOCK_VARS(NODE) (BLOCK_CHECK (NODE)->block.vars)
179738fd1498Szrj #define BLOCK_NONLOCALIZED_VARS(NODE) \
179838fd1498Szrj   (BLOCK_CHECK (NODE)->block.nonlocalized_vars)
179938fd1498Szrj #define BLOCK_NUM_NONLOCALIZED_VARS(NODE) \
180038fd1498Szrj   vec_safe_length (BLOCK_NONLOCALIZED_VARS (NODE))
180138fd1498Szrj #define BLOCK_NONLOCALIZED_VAR(NODE,N) (*BLOCK_NONLOCALIZED_VARS (NODE))[N]
180238fd1498Szrj #define BLOCK_SUBBLOCKS(NODE) (BLOCK_CHECK (NODE)->block.subblocks)
180338fd1498Szrj #define BLOCK_SUPERCONTEXT(NODE) (BLOCK_CHECK (NODE)->block.supercontext)
180438fd1498Szrj #define BLOCK_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.chain)
180538fd1498Szrj #define BLOCK_ABSTRACT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.abstract_origin)
180638fd1498Szrj #define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
180738fd1498Szrj #define BLOCK_DIE(NODE) (BLOCK_CHECK (NODE)->block.die)
180838fd1498Szrj 
180938fd1498Szrj /* True if BLOCK has the same ranges as its BLOCK_SUPERCONTEXT.  */
181038fd1498Szrj #define BLOCK_SAME_RANGE(NODE) (BLOCK_CHECK (NODE)->base.u.bits.nameless_flag)
181138fd1498Szrj 
181238fd1498Szrj /* True if BLOCK appears in cold section.  */
181338fd1498Szrj #define BLOCK_IN_COLD_SECTION_P(NODE) \
181438fd1498Szrj   (BLOCK_CHECK (NODE)->base.u.bits.atomic_flag)
181538fd1498Szrj 
181638fd1498Szrj /* An index number for this block.  These values are not guaranteed to
181738fd1498Szrj    be unique across functions -- whether or not they are depends on
181838fd1498Szrj    the debugging output format in use.  */
181938fd1498Szrj #define BLOCK_NUMBER(NODE) (BLOCK_CHECK (NODE)->block.block_num)
182038fd1498Szrj 
182138fd1498Szrj /* If block reordering splits a lexical block into discontiguous
182238fd1498Szrj    address ranges, we'll make a copy of the original block.
182338fd1498Szrj 
182438fd1498Szrj    Note that this is logically distinct from BLOCK_ABSTRACT_ORIGIN.
182538fd1498Szrj    In that case, we have one source block that has been replicated
182638fd1498Szrj    (through inlining or unrolling) into many logical blocks, and that
182738fd1498Szrj    these logical blocks have different physical variables in them.
182838fd1498Szrj 
182938fd1498Szrj    In this case, we have one logical block split into several
183038fd1498Szrj    non-contiguous address ranges.  Most debug formats can't actually
183138fd1498Szrj    represent this idea directly, so we fake it by creating multiple
183238fd1498Szrj    logical blocks with the same variables in them.  However, for those
183338fd1498Szrj    that do support non-contiguous regions, these allow the original
183438fd1498Szrj    logical block to be reconstructed, along with the set of address
183538fd1498Szrj    ranges.
183638fd1498Szrj 
183738fd1498Szrj    One of the logical block fragments is arbitrarily chosen to be
183838fd1498Szrj    the ORIGIN.  The other fragments will point to the origin via
183938fd1498Szrj    BLOCK_FRAGMENT_ORIGIN; the origin itself will have this pointer
184038fd1498Szrj    be null.  The list of fragments will be chained through
184138fd1498Szrj    BLOCK_FRAGMENT_CHAIN from the origin.  */
184238fd1498Szrj 
184338fd1498Szrj #define BLOCK_FRAGMENT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.fragment_origin)
184438fd1498Szrj #define BLOCK_FRAGMENT_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.fragment_chain)
184538fd1498Szrj 
184638fd1498Szrj /* For an inlined function, this gives the location where it was called
184738fd1498Szrj    from.  This is only set in the top level block, which corresponds to the
184838fd1498Szrj    inlined function scope.  This is used in the debug output routines.  */
184938fd1498Szrj 
185038fd1498Szrj #define BLOCK_SOURCE_LOCATION(NODE) (BLOCK_CHECK (NODE)->block.locus)
185138fd1498Szrj 
185238fd1498Szrj /* This gives the location of the end of the block, useful to attach
185338fd1498Szrj    code implicitly generated for outgoing paths.  */
185438fd1498Szrj 
185538fd1498Szrj #define BLOCK_SOURCE_END_LOCATION(NODE) (BLOCK_CHECK (NODE)->block.end_locus)
185638fd1498Szrj 
185738fd1498Szrj /* Define fields and accessors for nodes representing data types.  */
185838fd1498Szrj 
185938fd1498Szrj /* See tree.def for documentation of the use of these fields.
186038fd1498Szrj    Look at the documentation of the various ..._TYPE tree codes.
186138fd1498Szrj 
186238fd1498Szrj    Note that the type.values, type.minval, and type.maxval fields are
186338fd1498Szrj    overloaded and used for different macros in different kinds of types.
186438fd1498Szrj    Each macro must check to ensure the tree node is of the proper kind of
186538fd1498Szrj    type.  Note also that some of the front-ends also overload these fields,
186638fd1498Szrj    so they must be checked as well.  */
186738fd1498Szrj 
186838fd1498Szrj #define TYPE_UID(NODE) (TYPE_CHECK (NODE)->type_common.uid)
186938fd1498Szrj #define TYPE_SIZE(NODE) (TYPE_CHECK (NODE)->type_common.size)
187038fd1498Szrj #define TYPE_SIZE_UNIT(NODE) (TYPE_CHECK (NODE)->type_common.size_unit)
187138fd1498Szrj #define TYPE_POINTER_TO(NODE) (TYPE_CHECK (NODE)->type_common.pointer_to)
187238fd1498Szrj #define TYPE_REFERENCE_TO(NODE) (TYPE_CHECK (NODE)->type_common.reference_to)
187338fd1498Szrj #define TYPE_PRECISION(NODE) (TYPE_CHECK (NODE)->type_common.precision)
187438fd1498Szrj #define TYPE_NAME(NODE) (TYPE_CHECK (NODE)->type_common.name)
187538fd1498Szrj #define TYPE_NEXT_VARIANT(NODE) (TYPE_CHECK (NODE)->type_common.next_variant)
187638fd1498Szrj #define TYPE_MAIN_VARIANT(NODE) (TYPE_CHECK (NODE)->type_common.main_variant)
187738fd1498Szrj #define TYPE_CONTEXT(NODE) (TYPE_CHECK (NODE)->type_common.context)
187838fd1498Szrj 
187938fd1498Szrj #define TYPE_MODE_RAW(NODE) (TYPE_CHECK (NODE)->type_common.mode)
188038fd1498Szrj #define TYPE_MODE(NODE) \
188138fd1498Szrj   (VECTOR_TYPE_P (TYPE_CHECK (NODE)) \
188238fd1498Szrj    ? vector_type_mode (NODE) : (NODE)->type_common.mode)
188338fd1498Szrj #define SCALAR_TYPE_MODE(NODE) \
188438fd1498Szrj   (as_a <scalar_mode> (TYPE_CHECK (NODE)->type_common.mode))
188538fd1498Szrj #define SCALAR_INT_TYPE_MODE(NODE) \
188638fd1498Szrj   (as_a <scalar_int_mode> (TYPE_CHECK (NODE)->type_common.mode))
188738fd1498Szrj #define SCALAR_FLOAT_TYPE_MODE(NODE) \
188838fd1498Szrj   (as_a <scalar_float_mode> (TYPE_CHECK (NODE)->type_common.mode))
188938fd1498Szrj #define SET_TYPE_MODE(NODE, MODE) \
189038fd1498Szrj   (TYPE_CHECK (NODE)->type_common.mode = (MODE))
189138fd1498Szrj 
189238fd1498Szrj extern machine_mode element_mode (const_tree);
189338fd1498Szrj extern machine_mode vector_type_mode (const_tree);
189438fd1498Szrj 
189538fd1498Szrj /* The "canonical" type for this type node, which is used by frontends to
189638fd1498Szrj    compare the type for equality with another type.  If two types are
189738fd1498Szrj    equal (based on the semantics of the language), then they will have
189838fd1498Szrj    equivalent TYPE_CANONICAL entries.
189938fd1498Szrj 
190038fd1498Szrj    As a special case, if TYPE_CANONICAL is NULL_TREE, and thus
190138fd1498Szrj    TYPE_STRUCTURAL_EQUALITY_P is true, then it cannot
190238fd1498Szrj    be used for comparison against other types.  Instead, the type is
190338fd1498Szrj    said to require structural equality checks, described in
190438fd1498Szrj    TYPE_STRUCTURAL_EQUALITY_P.
190538fd1498Szrj 
190638fd1498Szrj    For unqualified aggregate and function types the middle-end relies on
190738fd1498Szrj    TYPE_CANONICAL to tell whether two variables can be assigned
190838fd1498Szrj    to each other without a conversion.  The middle-end also makes sure
190938fd1498Szrj    to assign the same alias-sets to the type partition with equal
191038fd1498Szrj    TYPE_CANONICAL of their unqualified variants.  */
191138fd1498Szrj #define TYPE_CANONICAL(NODE) (TYPE_CHECK (NODE)->type_common.canonical)
191238fd1498Szrj /* Indicates that the type node requires structural equality
191338fd1498Szrj    checks.  The compiler will need to look at the composition of the
191438fd1498Szrj    type to determine whether it is equal to another type, rather than
191538fd1498Szrj    just comparing canonical type pointers.  For instance, we would need
191638fd1498Szrj    to look at the return and parameter types of a FUNCTION_TYPE
191738fd1498Szrj    node.  */
191838fd1498Szrj #define TYPE_STRUCTURAL_EQUALITY_P(NODE) (TYPE_CANONICAL (NODE) == NULL_TREE)
191938fd1498Szrj /* Sets the TYPE_CANONICAL field to NULL_TREE, indicating that the
192038fd1498Szrj    type node requires structural equality.  */
192138fd1498Szrj #define SET_TYPE_STRUCTURAL_EQUALITY(NODE) (TYPE_CANONICAL (NODE) = NULL_TREE)
192238fd1498Szrj 
192338fd1498Szrj #define TYPE_IBIT(NODE) (GET_MODE_IBIT (TYPE_MODE (NODE)))
192438fd1498Szrj #define TYPE_FBIT(NODE) (GET_MODE_FBIT (TYPE_MODE (NODE)))
192538fd1498Szrj 
192638fd1498Szrj /* The (language-specific) typed-based alias set for this type.
192738fd1498Szrj    Objects whose TYPE_ALIAS_SETs are different cannot alias each
192838fd1498Szrj    other.  If the TYPE_ALIAS_SET is -1, no alias set has yet been
192938fd1498Szrj    assigned to this type.  If the TYPE_ALIAS_SET is 0, objects of this
193038fd1498Szrj    type can alias objects of any type.  */
193138fd1498Szrj #define TYPE_ALIAS_SET(NODE) (TYPE_CHECK (NODE)->type_common.alias_set)
193238fd1498Szrj 
193338fd1498Szrj /* Nonzero iff the typed-based alias set for this type has been
193438fd1498Szrj    calculated.  */
193538fd1498Szrj #define TYPE_ALIAS_SET_KNOWN_P(NODE) \
193638fd1498Szrj   (TYPE_CHECK (NODE)->type_common.alias_set != -1)
193738fd1498Szrj 
193838fd1498Szrj /* A TREE_LIST of IDENTIFIER nodes of the attributes that apply
193938fd1498Szrj    to this type.  */
194038fd1498Szrj #define TYPE_ATTRIBUTES(NODE) (TYPE_CHECK (NODE)->type_common.attributes)
194138fd1498Szrj 
194238fd1498Szrj /* The alignment necessary for objects of this type.
194338fd1498Szrj    The value is an int, measured in bits and must be a power of two.
194438fd1498Szrj    We support also an "alignment" of zero.  */
194538fd1498Szrj #define TYPE_ALIGN(NODE) \
194638fd1498Szrj     (TYPE_CHECK (NODE)->type_common.align \
194738fd1498Szrj      ? ((unsigned)1) << ((NODE)->type_common.align - 1) : 0)
194838fd1498Szrj 
194938fd1498Szrj /* Specify that TYPE_ALIGN(NODE) is X.  */
195038fd1498Szrj #define SET_TYPE_ALIGN(NODE, X) \
195138fd1498Szrj     (TYPE_CHECK (NODE)->type_common.align = ffs_hwi (X))
195238fd1498Szrj 
195338fd1498Szrj /* 1 if the alignment for this type was requested by "aligned" attribute,
195438fd1498Szrj    0 if it is the default for this type.  */
195538fd1498Szrj #define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->base.u.bits.user_align)
195638fd1498Szrj 
195738fd1498Szrj /* The alignment for NODE, in bytes.  */
195838fd1498Szrj #define TYPE_ALIGN_UNIT(NODE) (TYPE_ALIGN (NODE) / BITS_PER_UNIT)
195938fd1498Szrj 
196038fd1498Szrj /* The minimum alignment necessary for objects of this type without
196138fd1498Szrj    warning.  The value is an int, measured in bits.  */
196238fd1498Szrj #define TYPE_WARN_IF_NOT_ALIGN(NODE) \
196338fd1498Szrj     (TYPE_CHECK (NODE)->type_common.warn_if_not_align \
196438fd1498Szrj      ? ((unsigned)1) << ((NODE)->type_common.warn_if_not_align - 1) : 0)
196538fd1498Szrj 
196638fd1498Szrj /* Specify that TYPE_WARN_IF_NOT_ALIGN(NODE) is X.  */
196738fd1498Szrj #define SET_TYPE_WARN_IF_NOT_ALIGN(NODE, X) \
196838fd1498Szrj     (TYPE_CHECK (NODE)->type_common.warn_if_not_align = ffs_hwi (X))
196938fd1498Szrj 
197038fd1498Szrj /* If your language allows you to declare types, and you want debug info
197138fd1498Szrj    for them, then you need to generate corresponding TYPE_DECL nodes.
197238fd1498Szrj    These "stub" TYPE_DECL nodes have no name, and simply point at the
197338fd1498Szrj    type node.  You then set the TYPE_STUB_DECL field of the type node
197438fd1498Szrj    to point back at the TYPE_DECL node.  This allows the debug routines
197538fd1498Szrj    to know that the two nodes represent the same type, so that we only
197638fd1498Szrj    get one debug info record for them.  */
197738fd1498Szrj #define TYPE_STUB_DECL(NODE) (TREE_CHAIN (TYPE_CHECK (NODE)))
197838fd1498Szrj 
197938fd1498Szrj /* In a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE or ARRAY_TYPE, it means
198038fd1498Szrj    the type has BLKmode only because it lacks the alignment required for
198138fd1498Szrj    its size.  */
198238fd1498Szrj #define TYPE_NO_FORCE_BLK(NODE) \
198338fd1498Szrj   (TYPE_CHECK (NODE)->type_common.no_force_blk_flag)
198438fd1498Szrj 
198538fd1498Szrj /* Nonzero in a type considered volatile as a whole.  */
198638fd1498Szrj #define TYPE_VOLATILE(NODE) (TYPE_CHECK (NODE)->base.volatile_flag)
198738fd1498Szrj 
198838fd1498Szrj /* Nonzero in a type considered atomic as a whole.  */
198938fd1498Szrj #define TYPE_ATOMIC(NODE) (TYPE_CHECK (NODE)->base.u.bits.atomic_flag)
199038fd1498Szrj 
199138fd1498Szrj /* Means this type is const-qualified.  */
199238fd1498Szrj #define TYPE_READONLY(NODE) (TYPE_CHECK (NODE)->base.readonly_flag)
199338fd1498Szrj 
199438fd1498Szrj /* If nonzero, this type is `restrict'-qualified, in the C sense of
199538fd1498Szrj    the term.  */
199638fd1498Szrj #define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type_common.restrict_flag)
199738fd1498Szrj 
199838fd1498Szrj /* If nonzero, type's name shouldn't be emitted into debug info.  */
199938fd1498Szrj #define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.u.bits.nameless_flag)
200038fd1498Szrj 
200138fd1498Szrj /* The address space the type is in.  */
200238fd1498Szrj #define TYPE_ADDR_SPACE(NODE) (TYPE_CHECK (NODE)->base.u.bits.address_space)
200338fd1498Szrj 
200438fd1498Szrj /* Encode/decode the named memory support as part of the qualifier.  If more
200538fd1498Szrj    than 8 qualifiers are added, these macros need to be adjusted.  */
200638fd1498Szrj #define ENCODE_QUAL_ADDR_SPACE(NUM) ((NUM & 0xFF) << 8)
200738fd1498Szrj #define DECODE_QUAL_ADDR_SPACE(X) (((X) >> 8) & 0xFF)
200838fd1498Szrj 
200938fd1498Szrj /* Return all qualifiers except for the address space qualifiers.  */
201038fd1498Szrj #define CLEAR_QUAL_ADDR_SPACE(X) ((X) & ~0xFF00)
201138fd1498Szrj 
201238fd1498Szrj /* Only keep the address space out of the qualifiers and discard the other
201338fd1498Szrj    qualifiers.  */
201438fd1498Szrj #define KEEP_QUAL_ADDR_SPACE(X) ((X) & 0xFF00)
201538fd1498Szrj 
201638fd1498Szrj /* The set of type qualifiers for this type.  */
201738fd1498Szrj #define TYPE_QUALS(NODE)					\
201838fd1498Szrj   ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST)		\
201938fd1498Szrj 	  | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE)		\
202038fd1498Szrj 	  | (TYPE_ATOMIC (NODE) * TYPE_QUAL_ATOMIC)		\
202138fd1498Szrj 	  | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)		\
202238fd1498Szrj 	  | (ENCODE_QUAL_ADDR_SPACE (TYPE_ADDR_SPACE (NODE)))))
202338fd1498Szrj 
202438fd1498Szrj /* The same as TYPE_QUALS without the address space qualifications.  */
202538fd1498Szrj #define TYPE_QUALS_NO_ADDR_SPACE(NODE)				\
202638fd1498Szrj   ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST)		\
202738fd1498Szrj 	  | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE)		\
202838fd1498Szrj 	  | (TYPE_ATOMIC (NODE) * TYPE_QUAL_ATOMIC)		\
202938fd1498Szrj 	  | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)))
203038fd1498Szrj 
203138fd1498Szrj /* The same as TYPE_QUALS without the address space and atomic
203238fd1498Szrj    qualifications.  */
203338fd1498Szrj #define TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC(NODE)		\
203438fd1498Szrj   ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST)		\
203538fd1498Szrj 	  | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE)		\
203638fd1498Szrj 	  | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)))
203738fd1498Szrj 
203838fd1498Szrj /* These flags are available for each language front end to use internally.  */
203938fd1498Szrj #define TYPE_LANG_FLAG_0(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_0)
204038fd1498Szrj #define TYPE_LANG_FLAG_1(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_1)
204138fd1498Szrj #define TYPE_LANG_FLAG_2(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_2)
204238fd1498Szrj #define TYPE_LANG_FLAG_3(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_3)
204338fd1498Szrj #define TYPE_LANG_FLAG_4(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_4)
204438fd1498Szrj #define TYPE_LANG_FLAG_5(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_5)
204538fd1498Szrj #define TYPE_LANG_FLAG_6(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_6)
204638fd1498Szrj #define TYPE_LANG_FLAG_7(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_7)
204738fd1498Szrj 
204838fd1498Szrj /* Used to keep track of visited nodes in tree traversals.  This is set to
204938fd1498Szrj    0 by copy_node and make_node.  */
205038fd1498Szrj #define TREE_VISITED(NODE) ((NODE)->base.visited)
205138fd1498Szrj 
205238fd1498Szrj /* If set in an ARRAY_TYPE, indicates a string type (for languages
205338fd1498Szrj    that distinguish string from array of char).
205438fd1498Szrj    If set in a INTEGER_TYPE, indicates a character type.  */
205538fd1498Szrj #define TYPE_STRING_FLAG(NODE) (TYPE_CHECK (NODE)->type_common.string_flag)
205638fd1498Szrj 
205738fd1498Szrj /* Nonzero in a VECTOR_TYPE if the frontends should not emit warnings
205838fd1498Szrj    about missing conversions to other vector types of the same size.  */
205938fd1498Szrj #define TYPE_VECTOR_OPAQUE(NODE) \
206038fd1498Szrj   (VECTOR_TYPE_CHECK (NODE)->base.default_def_flag)
206138fd1498Szrj 
206238fd1498Szrj /* Indicates that objects of this type must be initialized by calling a
206338fd1498Szrj    function when they are created.  */
206438fd1498Szrj #define TYPE_NEEDS_CONSTRUCTING(NODE) \
206538fd1498Szrj   (TYPE_CHECK (NODE)->type_common.needs_constructing_flag)
206638fd1498Szrj 
206738fd1498Szrj /* Indicates that a UNION_TYPE object should be passed the same way that
206838fd1498Szrj    the first union alternative would be passed, or that a RECORD_TYPE
206938fd1498Szrj    object should be passed the same way that the first (and only) member
207038fd1498Szrj    would be passed.  */
207138fd1498Szrj #define TYPE_TRANSPARENT_AGGR(NODE) \
207238fd1498Szrj   (RECORD_OR_UNION_CHECK (NODE)->type_common.transparent_aggr_flag)
207338fd1498Szrj 
207438fd1498Szrj /* For an ARRAY_TYPE, indicates that it is not permitted to take the
207538fd1498Szrj    address of a component of the type.  This is the counterpart of
207638fd1498Szrj    DECL_NONADDRESSABLE_P for arrays, see the definition of this flag.  */
207738fd1498Szrj #define TYPE_NONALIASED_COMPONENT(NODE) \
207838fd1498Szrj   (ARRAY_TYPE_CHECK (NODE)->type_common.transparent_aggr_flag)
207938fd1498Szrj 
208038fd1498Szrj /* For an ARRAY_TYPE, a RECORD_TYPE, a UNION_TYPE or a QUAL_UNION_TYPE
208138fd1498Szrj    whether the array is typeless storage or the type contains a member
208238fd1498Szrj    with this flag set.  Such types are exempt from type-based alias
208338fd1498Szrj    analysis.  For ARRAY_TYPEs with AGGREGATE_TYPE_P element types
208438fd1498Szrj    the flag should be inherited from the element type, can change
208538fd1498Szrj    when type is finalized and because of that should not be used in
208638fd1498Szrj    type hashing.  For ARRAY_TYPEs with non-AGGREGATE_TYPE_P element types
208738fd1498Szrj    the flag should not be changed after the array is created and should
208838fd1498Szrj    be used in type hashing.  */
208938fd1498Szrj #define TYPE_TYPELESS_STORAGE(NODE) \
209038fd1498Szrj   (TREE_CHECK4 (NODE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, \
209138fd1498Szrj 		ARRAY_TYPE)->type_common.typeless_storage)
209238fd1498Szrj 
209338fd1498Szrj /* Indicated that objects of this type should be laid out in as
209438fd1498Szrj    compact a way as possible.  */
209538fd1498Szrj #define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.u.bits.packed_flag)
209638fd1498Szrj 
209738fd1498Szrj /* Used by type_contains_placeholder_p to avoid recomputation.
209838fd1498Szrj    Values are: 0 (unknown), 1 (false), 2 (true).  Never access
209938fd1498Szrj    this field directly.  */
210038fd1498Szrj #define TYPE_CONTAINS_PLACEHOLDER_INTERNAL(NODE) \
210138fd1498Szrj   (TYPE_CHECK (NODE)->type_common.contains_placeholder_bits)
210238fd1498Szrj 
210338fd1498Szrj /* Nonzero if RECORD_TYPE represents a final derivation of class.  */
210438fd1498Szrj #define TYPE_FINAL_P(NODE) \
210538fd1498Szrj   (RECORD_OR_UNION_CHECK (NODE)->base.default_def_flag)
210638fd1498Szrj 
210738fd1498Szrj /* The debug output functions use the symtab union field to store
210838fd1498Szrj    information specific to the debugging format.  The different debug
210938fd1498Szrj    output hooks store different types in the union field.  These three
211038fd1498Szrj    macros are used to access different fields in the union.  The debug
211138fd1498Szrj    hooks are responsible for consistently using only a specific
211238fd1498Szrj    macro.  */
211338fd1498Szrj 
211438fd1498Szrj /* Symtab field as an integer.  Used by stabs generator in dbxout.c to
211538fd1498Szrj    hold the type's number in the generated stabs.  */
211638fd1498Szrj #define TYPE_SYMTAB_ADDRESS(NODE) \
211738fd1498Szrj   (TYPE_CHECK (NODE)->type_common.symtab.address)
211838fd1498Szrj 
211938fd1498Szrj /* Symtab field as a pointer to a DWARF DIE.  Used by DWARF generator
212038fd1498Szrj    in dwarf2out.c to point to the DIE generated for the type.  */
212138fd1498Szrj #define TYPE_SYMTAB_DIE(NODE) \
212238fd1498Szrj   (TYPE_CHECK (NODE)->type_common.symtab.die)
212338fd1498Szrj 
212438fd1498Szrj /* The garbage collector needs to know the interpretation of the
212538fd1498Szrj    symtab field.  These constants represent the different types in the
212638fd1498Szrj    union.  */
212738fd1498Szrj 
212838fd1498Szrj #define TYPE_SYMTAB_IS_ADDRESS (0)
212938fd1498Szrj #define TYPE_SYMTAB_IS_DIE (1)
213038fd1498Szrj 
213138fd1498Szrj #define TYPE_LANG_SPECIFIC(NODE) \
213238fd1498Szrj   (TYPE_CHECK (NODE)->type_with_lang_specific.lang_specific)
213338fd1498Szrj 
213438fd1498Szrj #define TYPE_VALUES(NODE) (ENUMERAL_TYPE_CHECK (NODE)->type_non_common.values)
213538fd1498Szrj #define TYPE_DOMAIN(NODE) (ARRAY_TYPE_CHECK (NODE)->type_non_common.values)
213638fd1498Szrj #define TYPE_FIELDS(NODE)				\
213738fd1498Szrj   (RECORD_OR_UNION_CHECK (NODE)->type_non_common.values)
213838fd1498Szrj #define TYPE_CACHED_VALUES(NODE) (TYPE_CHECK (NODE)->type_non_common.values)
213938fd1498Szrj #define TYPE_ARG_TYPES(NODE)				\
214038fd1498Szrj   (FUNC_OR_METHOD_CHECK (NODE)->type_non_common.values)
214138fd1498Szrj #define TYPE_VALUES_RAW(NODE) (TYPE_CHECK (NODE)->type_non_common.values)
214238fd1498Szrj 
214338fd1498Szrj #define TYPE_MIN_VALUE(NODE)				\
214438fd1498Szrj   (NUMERICAL_TYPE_CHECK (NODE)->type_non_common.minval)
214538fd1498Szrj #define TYPE_NEXT_PTR_TO(NODE)				\
214638fd1498Szrj   (POINTER_TYPE_CHECK (NODE)->type_non_common.minval)
214738fd1498Szrj #define TYPE_NEXT_REF_TO(NODE)				\
214838fd1498Szrj   (REFERENCE_TYPE_CHECK (NODE)->type_non_common.minval)
214938fd1498Szrj #define TYPE_VFIELD(NODE)				\
215038fd1498Szrj   (RECORD_OR_UNION_CHECK (NODE)->type_non_common.minval)
215138fd1498Szrj #define TYPE_MIN_VALUE_RAW(NODE) (TYPE_CHECK (NODE)->type_non_common.minval)
215238fd1498Szrj 
215338fd1498Szrj #define TYPE_MAX_VALUE(NODE) \
215438fd1498Szrj   (NUMERICAL_TYPE_CHECK (NODE)->type_non_common.maxval)
215538fd1498Szrj #define TYPE_METHOD_BASETYPE(NODE)			\
215638fd1498Szrj   (FUNC_OR_METHOD_CHECK (NODE)->type_non_common.maxval)
215738fd1498Szrj #define TYPE_OFFSET_BASETYPE(NODE)			\
215838fd1498Szrj   (OFFSET_TYPE_CHECK (NODE)->type_non_common.maxval)
215938fd1498Szrj /* If non-NULL, this is an upper bound of the size (in bytes) of an
216038fd1498Szrj    object of the given ARRAY_TYPE_NON_COMMON.  This allows temporaries to be
216138fd1498Szrj    allocated.  */
216238fd1498Szrj #define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) \
216338fd1498Szrj   (ARRAY_TYPE_CHECK (ARRAY_TYPE)->type_non_common.maxval)
216438fd1498Szrj #define TYPE_MAX_VALUE_RAW(NODE) (TYPE_CHECK (NODE)->type_non_common.maxval)
216538fd1498Szrj /* For record and union types, information about this type, as a base type
216638fd1498Szrj    for itself.  */
216738fd1498Szrj #define TYPE_BINFO(NODE) (RECORD_OR_UNION_CHECK (NODE)->type_non_common.maxval)
216838fd1498Szrj 
216938fd1498Szrj /* For types, used in a language-dependent way.  */
217038fd1498Szrj #define TYPE_LANG_SLOT_1(NODE) \
217138fd1498Szrj   (TYPE_CHECK (NODE)->type_non_common.lang_1)
217238fd1498Szrj 
217338fd1498Szrj /* Define accessor macros for information about type inheritance
217438fd1498Szrj    and basetypes.
217538fd1498Szrj 
217638fd1498Szrj    A "basetype" means a particular usage of a data type for inheritance
217738fd1498Szrj    in another type.  Each such basetype usage has its own "binfo"
217838fd1498Szrj    object to describe it.  The binfo object is a TREE_VEC node.
217938fd1498Szrj 
218038fd1498Szrj    Inheritance is represented by the binfo nodes allocated for a
218138fd1498Szrj    given type.  For example, given types C and D, such that D is
218238fd1498Szrj    inherited by C, 3 binfo nodes will be allocated: one for describing
218338fd1498Szrj    the binfo properties of C, similarly one for D, and one for
218438fd1498Szrj    describing the binfo properties of D as a base type for C.
218538fd1498Szrj    Thus, given a pointer to class C, one can get a pointer to the binfo
218638fd1498Szrj    of D acting as a basetype for C by looking at C's binfo's basetypes.  */
218738fd1498Szrj 
218838fd1498Szrj /* BINFO specific flags.  */
218938fd1498Szrj 
219038fd1498Szrj /* Nonzero means that the derivation chain is via a `virtual' declaration.  */
219138fd1498Szrj #define BINFO_VIRTUAL_P(NODE) (TREE_BINFO_CHECK (NODE)->base.static_flag)
219238fd1498Szrj 
219338fd1498Szrj /* Flags for language dependent use.  */
219438fd1498Szrj #define BINFO_FLAG_0(NODE) TREE_LANG_FLAG_0 (TREE_BINFO_CHECK (NODE))
219538fd1498Szrj #define BINFO_FLAG_1(NODE) TREE_LANG_FLAG_1 (TREE_BINFO_CHECK (NODE))
219638fd1498Szrj #define BINFO_FLAG_2(NODE) TREE_LANG_FLAG_2 (TREE_BINFO_CHECK (NODE))
219738fd1498Szrj #define BINFO_FLAG_3(NODE) TREE_LANG_FLAG_3 (TREE_BINFO_CHECK (NODE))
219838fd1498Szrj #define BINFO_FLAG_4(NODE) TREE_LANG_FLAG_4 (TREE_BINFO_CHECK (NODE))
219938fd1498Szrj #define BINFO_FLAG_5(NODE) TREE_LANG_FLAG_5 (TREE_BINFO_CHECK (NODE))
220038fd1498Szrj #define BINFO_FLAG_6(NODE) TREE_LANG_FLAG_6 (TREE_BINFO_CHECK (NODE))
220138fd1498Szrj 
220238fd1498Szrj /* The actual data type node being inherited in this basetype.  */
220338fd1498Szrj #define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK (NODE))
220438fd1498Szrj 
220538fd1498Szrj /* The offset where this basetype appears in its containing type.
220638fd1498Szrj    BINFO_OFFSET slot holds the offset (in bytes)
220738fd1498Szrj    from the base of the complete object to the base of the part of the
220838fd1498Szrj    object that is allocated on behalf of this `type'.
220938fd1498Szrj    This is always 0 except when there is multiple inheritance.  */
221038fd1498Szrj 
221138fd1498Szrj #define BINFO_OFFSET(NODE) (TREE_BINFO_CHECK (NODE)->binfo.offset)
221238fd1498Szrj #define BINFO_OFFSET_ZEROP(NODE) (integer_zerop (BINFO_OFFSET (NODE)))
221338fd1498Szrj 
221438fd1498Szrj /* The virtual function table belonging to this basetype.  Virtual
221538fd1498Szrj    function tables provide a mechanism for run-time method dispatching.
221638fd1498Szrj    The entries of a virtual function table are language-dependent.  */
221738fd1498Szrj 
221838fd1498Szrj #define BINFO_VTABLE(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtable)
221938fd1498Szrj 
222038fd1498Szrj /* The virtual functions in the virtual function table.  This is
222138fd1498Szrj    a TREE_LIST that is used as an initial approximation for building
222238fd1498Szrj    a virtual function table for this basetype.  */
222338fd1498Szrj #define BINFO_VIRTUALS(NODE) (TREE_BINFO_CHECK (NODE)->binfo.virtuals)
222438fd1498Szrj 
222538fd1498Szrj /* A vector of binfos for the direct basetypes inherited by this
222638fd1498Szrj    basetype.
222738fd1498Szrj 
222838fd1498Szrj    If this basetype describes type D as inherited in C, and if the
222938fd1498Szrj    basetypes of D are E and F, then this vector contains binfos for
223038fd1498Szrj    inheritance of E and F by C.  */
223138fd1498Szrj #define BINFO_BASE_BINFOS(NODE) (&TREE_BINFO_CHECK (NODE)->binfo.base_binfos)
223238fd1498Szrj 
223338fd1498Szrj /* The number of basetypes for NODE.  */
223438fd1498Szrj #define BINFO_N_BASE_BINFOS(NODE) (BINFO_BASE_BINFOS (NODE)->length ())
223538fd1498Szrj 
223638fd1498Szrj /* Accessor macro to get to the Nth base binfo of this binfo.  */
223738fd1498Szrj #define BINFO_BASE_BINFO(NODE,N) \
223838fd1498Szrj  ((*BINFO_BASE_BINFOS (NODE))[(N)])
223938fd1498Szrj #define BINFO_BASE_ITERATE(NODE,N,B) \
224038fd1498Szrj  (BINFO_BASE_BINFOS (NODE)->iterate ((N), &(B)))
224138fd1498Szrj #define BINFO_BASE_APPEND(NODE,T) \
224238fd1498Szrj  (BINFO_BASE_BINFOS (NODE)->quick_push ((T)))
224338fd1498Szrj 
224438fd1498Szrj /* For a BINFO record describing a virtual base class, i.e., one where
224538fd1498Szrj    TREE_VIA_VIRTUAL is set, this field assists in locating the virtual
224638fd1498Szrj    base.  The actual contents are language-dependent.  In the C++
224738fd1498Szrj    front-end this field is an INTEGER_CST giving an offset into the
224838fd1498Szrj    vtable where the offset to the virtual base can be found.  */
224938fd1498Szrj #define BINFO_VPTR_FIELD(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vptr_field)
225038fd1498Szrj 
225138fd1498Szrj /* Indicates the accesses this binfo has to its bases. The values are
225238fd1498Szrj    access_public_node, access_protected_node or access_private_node.
225338fd1498Szrj    If this array is not present, public access is implied.  */
225438fd1498Szrj #define BINFO_BASE_ACCESSES(NODE) \
225538fd1498Szrj   (TREE_BINFO_CHECK (NODE)->binfo.base_accesses)
225638fd1498Szrj 
225738fd1498Szrj #define BINFO_BASE_ACCESS(NODE,N) \
225838fd1498Szrj   (*BINFO_BASE_ACCESSES (NODE))[(N)]
225938fd1498Szrj #define BINFO_BASE_ACCESS_APPEND(NODE,T) \
226038fd1498Szrj   BINFO_BASE_ACCESSES (NODE)->quick_push ((T))
226138fd1498Szrj 
226238fd1498Szrj /* The index in the VTT where this subobject's sub-VTT can be found.
226338fd1498Szrj    NULL_TREE if there is no sub-VTT.  */
226438fd1498Szrj #define BINFO_SUBVTT_INDEX(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtt_subvtt)
226538fd1498Szrj 
226638fd1498Szrj /* The index in the VTT where the vptr for this subobject can be
226738fd1498Szrj    found.  NULL_TREE if there is no secondary vptr in the VTT.  */
226838fd1498Szrj #define BINFO_VPTR_INDEX(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtt_vptr)
226938fd1498Szrj 
227038fd1498Szrj /* The BINFO_INHERITANCE_CHAIN points at the binfo for the base
227138fd1498Szrj    inheriting this base for non-virtual bases. For virtual bases it
227238fd1498Szrj    points either to the binfo for which this is a primary binfo, or to
227338fd1498Szrj    the binfo of the most derived type.  */
227438fd1498Szrj #define BINFO_INHERITANCE_CHAIN(NODE) \
227538fd1498Szrj 	(TREE_BINFO_CHECK (NODE)->binfo.inheritance)
227638fd1498Szrj 
227738fd1498Szrj 
227838fd1498Szrj /* Define fields and accessors for nodes representing declared names.  */
227938fd1498Szrj 
228038fd1498Szrj /* Nonzero if DECL represents an SSA name or a variable that can possibly
228138fd1498Szrj    have an associated SSA name.  */
228238fd1498Szrj #define SSA_VAR_P(DECL)							\
228338fd1498Szrj 	(TREE_CODE (DECL) == VAR_DECL					\
228438fd1498Szrj 	 || TREE_CODE (DECL) == PARM_DECL				\
228538fd1498Szrj 	 || TREE_CODE (DECL) == RESULT_DECL				\
228638fd1498Szrj 	 || TREE_CODE (DECL) == SSA_NAME)
228738fd1498Szrj 
228838fd1498Szrj 
228938fd1498Szrj #define DECL_CHAIN(NODE) (TREE_CHAIN (DECL_MINIMAL_CHECK (NODE)))
229038fd1498Szrj 
229138fd1498Szrj /* This is the name of the object as written by the user.
229238fd1498Szrj    It is an IDENTIFIER_NODE.  */
229338fd1498Szrj #define DECL_NAME(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.name)
229438fd1498Szrj 
229538fd1498Szrj /* The IDENTIFIER_NODE associated with the TYPE_NAME field.  */
229638fd1498Szrj #define TYPE_IDENTIFIER(NODE) \
229738fd1498Szrj   (TYPE_NAME (NODE) && DECL_P (TYPE_NAME (NODE)) \
229838fd1498Szrj    ? DECL_NAME (TYPE_NAME (NODE)) : TYPE_NAME (NODE))
229938fd1498Szrj 
230038fd1498Szrj /* Every ..._DECL node gets a unique number.  */
230138fd1498Szrj #define DECL_UID(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.uid)
230238fd1498Szrj 
230338fd1498Szrj /* DEBUG_EXPR_DECLs get negative UID numbers, to catch erroneous
230438fd1498Szrj    uses.  */
230538fd1498Szrj #define DEBUG_TEMP_UID(NODE) (-DECL_UID (TREE_CHECK ((NODE), DEBUG_EXPR_DECL)))
230638fd1498Szrj 
230738fd1498Szrj /* Every ..._DECL node gets a unique number that stays the same even
230838fd1498Szrj    when the decl is copied by the inliner once it is set.  */
230938fd1498Szrj #define DECL_PT_UID(NODE) \
231038fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid == -1u \
231138fd1498Szrj    ? (NODE)->decl_minimal.uid : (NODE)->decl_common.pt_uid)
231238fd1498Szrj /* Initialize the ..._DECL node pt-uid to the decls uid.  */
231338fd1498Szrj #define SET_DECL_PT_UID(NODE, UID) \
231438fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid = (UID))
231538fd1498Szrj /* Whether the ..._DECL node pt-uid has been initialized and thus needs to
231638fd1498Szrj    be preserved when copyin the decl.  */
231738fd1498Szrj #define DECL_PT_UID_SET_P(NODE) \
231838fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid != -1u)
231938fd1498Szrj 
232038fd1498Szrj /* These two fields describe where in the source code the declaration
232138fd1498Szrj    was.  If the declaration appears in several places (as for a C
232238fd1498Szrj    function that is declared first and then defined later), this
232338fd1498Szrj    information should refer to the definition.  */
232438fd1498Szrj #define DECL_SOURCE_LOCATION(NODE) \
232538fd1498Szrj   (DECL_MINIMAL_CHECK (NODE)->decl_minimal.locus)
232638fd1498Szrj #define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
232738fd1498Szrj #define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
232838fd1498Szrj #define DECL_SOURCE_COLUMN(NODE) LOCATION_COLUMN (DECL_SOURCE_LOCATION (NODE))
232938fd1498Szrj /* This accessor returns TRUE if the decl it operates on was created
233038fd1498Szrj    by a front-end or back-end rather than by user code.  In this case
233138fd1498Szrj    builtin-ness is indicated by source location.  */
233238fd1498Szrj #define DECL_IS_BUILTIN(DECL) \
233338fd1498Szrj   (LOCATION_LOCUS (DECL_SOURCE_LOCATION (DECL)) <= BUILTINS_LOCATION)
233438fd1498Szrj 
233538fd1498Szrj #define DECL_LOCATION_RANGE(NODE) \
233638fd1498Szrj   (get_decl_source_range (DECL_MINIMAL_CHECK (NODE)))
233738fd1498Szrj 
233838fd1498Szrj /*  For FIELD_DECLs, this is the RECORD_TYPE, UNION_TYPE, or
233938fd1498Szrj     QUAL_UNION_TYPE node that the field is a member of.  For VAR_DECL,
234038fd1498Szrj     PARM_DECL, FUNCTION_DECL, LABEL_DECL, RESULT_DECL, and CONST_DECL
234138fd1498Szrj     nodes, this points to either the FUNCTION_DECL for the containing
234238fd1498Szrj     function, the RECORD_TYPE or UNION_TYPE for the containing type, or
234338fd1498Szrj     NULL_TREE or a TRANSLATION_UNIT_DECL if the given decl has "file
234438fd1498Szrj     scope".  In particular, for VAR_DECLs which are virtual table pointers
234538fd1498Szrj     (they have DECL_VIRTUAL set), we use DECL_CONTEXT to determine the type
234638fd1498Szrj     they belong to.  */
234738fd1498Szrj #define DECL_CONTEXT(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.context)
234838fd1498Szrj #define DECL_FIELD_CONTEXT(NODE) \
234938fd1498Szrj   (FIELD_DECL_CHECK (NODE)->decl_minimal.context)
235038fd1498Szrj 
235138fd1498Szrj /* If nonzero, decl's name shouldn't be emitted into debug info.  */
235238fd1498Szrj #define DECL_NAMELESS(NODE) (DECL_MINIMAL_CHECK (NODE)->base.u.bits.nameless_flag)
235338fd1498Szrj 
235438fd1498Szrj /* For any sort of a ..._DECL node, this points to the original (abstract)
235538fd1498Szrj    decl node which this decl is an inlined/cloned instance of, or else it
235638fd1498Szrj    is NULL indicating that this decl is not an instance of some other decl.
235738fd1498Szrj 
235838fd1498Szrj    The C front-end also uses this in a nested declaration of an inline
235938fd1498Szrj    function, to point back to the definition.  */
236038fd1498Szrj #define DECL_ABSTRACT_ORIGIN(NODE) \
236138fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.abstract_origin)
236238fd1498Szrj 
236338fd1498Szrj /* Like DECL_ABSTRACT_ORIGIN, but returns NODE if there's no abstract
236438fd1498Szrj    origin.  This is useful when setting the DECL_ABSTRACT_ORIGIN.  */
236538fd1498Szrj #define DECL_ORIGIN(NODE) \
236638fd1498Szrj   (DECL_ABSTRACT_ORIGIN (NODE) ? DECL_ABSTRACT_ORIGIN (NODE) : (NODE))
236738fd1498Szrj 
236838fd1498Szrj /* Nonzero for any sort of ..._DECL node means this decl node represents an
236938fd1498Szrj    inline instance of some original (abstract) decl from an inline function;
237038fd1498Szrj    suppress any warnings about shadowing some other variable.  FUNCTION_DECL
237138fd1498Szrj    nodes can also have their abstract origin set to themselves.  */
237238fd1498Szrj #define DECL_FROM_INLINE(NODE) \
237338fd1498Szrj   (DECL_ABSTRACT_ORIGIN (NODE) != NULL_TREE \
237438fd1498Szrj    && DECL_ABSTRACT_ORIGIN (NODE) != (NODE))
237538fd1498Szrj 
237638fd1498Szrj /* In a DECL this is the field where attributes are stored.  */
237738fd1498Szrj #define DECL_ATTRIBUTES(NODE) \
237838fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.attributes)
237938fd1498Szrj 
238038fd1498Szrj /* For a FUNCTION_DECL, holds the tree of BINDINGs.
238138fd1498Szrj    For a TRANSLATION_UNIT_DECL, holds the namespace's BLOCK.
238238fd1498Szrj    For a VAR_DECL, holds the initial value.
238338fd1498Szrj    For a PARM_DECL, used for DECL_ARG_TYPE--default
238438fd1498Szrj    values for parameters are encoded in the type of the function,
238538fd1498Szrj    not in the PARM_DECL slot.
238638fd1498Szrj    For a FIELD_DECL, this is used for enumeration values and the C
238738fd1498Szrj    frontend uses it for temporarily storing bitwidth of bitfields.
238838fd1498Szrj 
238938fd1498Szrj    ??? Need to figure out some way to check this isn't a PARM_DECL.  */
239038fd1498Szrj #define DECL_INITIAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.initial)
239138fd1498Szrj 
239238fd1498Szrj /* Holds the size of the datum, in bits, as a tree expression.
239338fd1498Szrj    Need not be constant.  */
239438fd1498Szrj #define DECL_SIZE(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size)
239538fd1498Szrj /* Likewise for the size in bytes.  */
239638fd1498Szrj #define DECL_SIZE_UNIT(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size_unit)
239738fd1498Szrj /* Returns the alignment required for the datum, in bits.  It must
239838fd1498Szrj    be a power of two, but an "alignment" of zero is supported
239938fd1498Szrj    (e.g. as "uninitialized" sentinel).  */
240038fd1498Szrj #define DECL_ALIGN(NODE) \
240138fd1498Szrj     (DECL_COMMON_CHECK (NODE)->decl_common.align \
240238fd1498Szrj      ? ((unsigned)1) << ((NODE)->decl_common.align - 1) : 0)
240338fd1498Szrj /* Specify that DECL_ALIGN(NODE) is X.  */
240438fd1498Szrj #define SET_DECL_ALIGN(NODE, X) \
240538fd1498Szrj     (DECL_COMMON_CHECK (NODE)->decl_common.align = ffs_hwi (X))
240638fd1498Szrj 
240738fd1498Szrj /* The minimum alignment necessary for the datum, in bits, without
240838fd1498Szrj    warning.  */
240938fd1498Szrj #define DECL_WARN_IF_NOT_ALIGN(NODE) \
241038fd1498Szrj     (DECL_COMMON_CHECK (NODE)->decl_common.warn_if_not_align \
241138fd1498Szrj      ? ((unsigned)1) << ((NODE)->decl_common.warn_if_not_align - 1) : 0)
241238fd1498Szrj 
241338fd1498Szrj /* Specify that DECL_WARN_IF_NOT_ALIGN(NODE) is X.  */
241438fd1498Szrj #define SET_DECL_WARN_IF_NOT_ALIGN(NODE, X) \
241538fd1498Szrj     (DECL_COMMON_CHECK (NODE)->decl_common.warn_if_not_align = ffs_hwi (X))
241638fd1498Szrj 
241738fd1498Szrj /* The alignment of NODE, in bytes.  */
241838fd1498Szrj #define DECL_ALIGN_UNIT(NODE) (DECL_ALIGN (NODE) / BITS_PER_UNIT)
241938fd1498Szrj /* Set if the alignment of this DECL has been set by the user, for
242038fd1498Szrj    example with an 'aligned' attribute.  */
242138fd1498Szrj #define DECL_USER_ALIGN(NODE) \
242238fd1498Szrj   (DECL_COMMON_CHECK (NODE)->base.u.bits.user_align)
242338fd1498Szrj /* Holds the machine mode corresponding to the declaration of a variable or
242438fd1498Szrj    field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
242538fd1498Szrj    FIELD_DECL.  */
242638fd1498Szrj #define DECL_MODE(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.mode)
242738fd1498Szrj #define SET_DECL_MODE(NODE, MODE) \
242838fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.mode = (MODE))
242938fd1498Szrj 
243038fd1498Szrj /* For FUNCTION_DECL, if it is built-in, this identifies which built-in
243138fd1498Szrj    operation it is.  Note, however, that this field is overloaded, with
243238fd1498Szrj    DECL_BUILT_IN_CLASS as the discriminant, so the latter must always be
243338fd1498Szrj    checked before any access to the former.  */
243438fd1498Szrj #define DECL_FUNCTION_CODE(NODE) \
243538fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.function_code)
243638fd1498Szrj 
243738fd1498Szrj /* Test if FCODE is a function code for an alloca operation.  */
243838fd1498Szrj #define ALLOCA_FUNCTION_CODE_P(FCODE)				\
243938fd1498Szrj   ((FCODE) == BUILT_IN_ALLOCA					\
244038fd1498Szrj    || (FCODE) == BUILT_IN_ALLOCA_WITH_ALIGN			\
244138fd1498Szrj    || (FCODE) == BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX)
244238fd1498Szrj 
244338fd1498Szrj /* Generate case for an alloca operation.  */
244438fd1498Szrj #define CASE_BUILT_IN_ALLOCA			\
244538fd1498Szrj   case BUILT_IN_ALLOCA:				\
244638fd1498Szrj   case BUILT_IN_ALLOCA_WITH_ALIGN:		\
244738fd1498Szrj   case BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX
244838fd1498Szrj 
244938fd1498Szrj #define DECL_FUNCTION_PERSONALITY(NODE) \
245038fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.personality)
245138fd1498Szrj 
245238fd1498Szrj /* Nonzero for a given ..._DECL node means that the name of this node should
245338fd1498Szrj    be ignored for symbolic debug purposes.  For a TYPE_DECL, this means that
245438fd1498Szrj    the associated type should be ignored.  For a FUNCTION_DECL, the body of
245538fd1498Szrj    the function should also be ignored.  */
245638fd1498Szrj #define DECL_IGNORED_P(NODE) \
245738fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.ignored_flag)
245838fd1498Szrj 
245938fd1498Szrj /* Nonzero for a given ..._DECL node means that this node represents an
246038fd1498Szrj    "abstract instance" of the given declaration (e.g. in the original
246138fd1498Szrj    declaration of an inline function).  When generating symbolic debugging
246238fd1498Szrj    information, we mustn't try to generate any address information for nodes
246338fd1498Szrj    marked as "abstract instances" because we don't actually generate
246438fd1498Szrj    any code or allocate any data space for such instances.  */
246538fd1498Szrj #define DECL_ABSTRACT_P(NODE) \
246638fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.abstract_flag)
246738fd1498Szrj 
246838fd1498Szrj /* Language-specific decl information.  */
246938fd1498Szrj #define DECL_LANG_SPECIFIC(NODE) \
247038fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_specific)
247138fd1498Szrj 
247238fd1498Szrj /* In a VAR_DECL or FUNCTION_DECL, nonzero means external reference:
247338fd1498Szrj    do not allocate storage, and refer to a definition elsewhere.  Note that
247438fd1498Szrj    this does not necessarily imply the entity represented by NODE
247538fd1498Szrj    has no program source-level definition in this translation unit.  For
247638fd1498Szrj    example, for a FUNCTION_DECL, DECL_SAVED_TREE may be non-NULL and
247738fd1498Szrj    DECL_EXTERNAL may be true simultaneously; that can be the case for
247838fd1498Szrj    a C99 "extern inline" function.  */
247938fd1498Szrj #define DECL_EXTERNAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.decl_flag_1)
248038fd1498Szrj 
248138fd1498Szrj /* Nonzero in a ..._DECL means this variable is ref'd from a nested function.
248238fd1498Szrj    For VAR_DECL nodes, PARM_DECL nodes, and FUNCTION_DECL nodes.
248338fd1498Szrj 
248438fd1498Szrj    For LABEL_DECL nodes, nonzero if nonlocal gotos to the label are permitted.
248538fd1498Szrj 
248638fd1498Szrj    Also set in some languages for variables, etc., outside the normal
248738fd1498Szrj    lexical scope, such as class instance variables.  */
248838fd1498Szrj #define DECL_NONLOCAL(NODE) \
248938fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.nonlocal_flag)
249038fd1498Szrj 
249138fd1498Szrj /* Used in VAR_DECLs to indicate that the variable is a vtable.
249238fd1498Szrj    Used in FIELD_DECLs for vtable pointers.
249338fd1498Szrj    Used in FUNCTION_DECLs to indicate that the function is virtual.  */
249438fd1498Szrj #define DECL_VIRTUAL_P(NODE) \
249538fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.virtual_flag)
249638fd1498Szrj 
249738fd1498Szrj /* Used to indicate that this DECL represents a compiler-generated entity.  */
249838fd1498Szrj #define DECL_ARTIFICIAL(NODE) \
249938fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.artificial_flag)
250038fd1498Szrj 
250138fd1498Szrj /* Additional flags for language-specific uses.  */
250238fd1498Szrj #define DECL_LANG_FLAG_0(NODE) \
250338fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_0)
250438fd1498Szrj #define DECL_LANG_FLAG_1(NODE) \
250538fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_1)
250638fd1498Szrj #define DECL_LANG_FLAG_2(NODE) \
250738fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_2)
250838fd1498Szrj #define DECL_LANG_FLAG_3(NODE) \
250938fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_3)
251038fd1498Szrj #define DECL_LANG_FLAG_4(NODE) \
251138fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_4)
251238fd1498Szrj #define DECL_LANG_FLAG_5(NODE) \
251338fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_5)
251438fd1498Szrj #define DECL_LANG_FLAG_6(NODE) \
251538fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_6)
251638fd1498Szrj #define DECL_LANG_FLAG_7(NODE) \
251738fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_7)
251838fd1498Szrj #define DECL_LANG_FLAG_8(NODE) \
251938fd1498Szrj   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_8)
252038fd1498Szrj 
252138fd1498Szrj /* Nonzero for a scope which is equal to file scope.  */
252238fd1498Szrj #define SCOPE_FILE_SCOPE_P(EXP)	\
252338fd1498Szrj   (! (EXP) || TREE_CODE (EXP) == TRANSLATION_UNIT_DECL)
252438fd1498Szrj /* Nonzero for a decl which is at file scope.  */
252538fd1498Szrj #define DECL_FILE_SCOPE_P(EXP) SCOPE_FILE_SCOPE_P (DECL_CONTEXT (EXP))
252638fd1498Szrj /* Nonzero for a type which is at file scope.  */
252738fd1498Szrj #define TYPE_FILE_SCOPE_P(EXP) SCOPE_FILE_SCOPE_P (TYPE_CONTEXT (EXP))
252838fd1498Szrj 
252938fd1498Szrj /* Nonzero for a decl that is decorated using attribute used.
253038fd1498Szrj    This indicates to compiler tools that this decl needs to be preserved.  */
253138fd1498Szrj #define DECL_PRESERVE_P(DECL) \
253238fd1498Szrj   DECL_COMMON_CHECK (DECL)->decl_common.preserve_flag
253338fd1498Szrj 
253438fd1498Szrj /* For function local variables of COMPLEX and VECTOR types,
253538fd1498Szrj    indicates that the variable is not aliased, and that all
253638fd1498Szrj    modifications to the variable have been adjusted so that
253738fd1498Szrj    they are killing assignments.  Thus the variable may now
253838fd1498Szrj    be treated as a GIMPLE register, and use real instead of
253938fd1498Szrj    virtual ops in SSA form.  */
254038fd1498Szrj #define DECL_GIMPLE_REG_P(DECL) \
254138fd1498Szrj   DECL_COMMON_CHECK (DECL)->decl_common.gimple_reg_flag
254238fd1498Szrj 
254338fd1498Szrj extern tree decl_value_expr_lookup (tree);
254438fd1498Szrj extern void decl_value_expr_insert (tree, tree);
254538fd1498Szrj 
254638fd1498Szrj /* In a VAR_DECL or PARM_DECL, the location at which the value may be found,
254738fd1498Szrj    if transformations have made this more complicated than evaluating the
254838fd1498Szrj    decl itself.  */
254938fd1498Szrj #define DECL_HAS_VALUE_EXPR_P(NODE) \
255038fd1498Szrj   (TREE_CHECK3 (NODE, VAR_DECL, PARM_DECL, RESULT_DECL) \
255138fd1498Szrj    ->decl_common.decl_flag_2)
255238fd1498Szrj #define DECL_VALUE_EXPR(NODE) \
255338fd1498Szrj   (decl_value_expr_lookup (DECL_WRTL_CHECK (NODE)))
255438fd1498Szrj #define SET_DECL_VALUE_EXPR(NODE, VAL) \
255538fd1498Szrj   (decl_value_expr_insert (DECL_WRTL_CHECK (NODE), VAL))
255638fd1498Szrj 
255738fd1498Szrj /* Holds the RTL expression for the value of a variable or function.
255838fd1498Szrj    This value can be evaluated lazily for functions, variables with
255938fd1498Szrj    static storage duration, and labels.  */
256038fd1498Szrj #define DECL_RTL(NODE)					\
256138fd1498Szrj   (DECL_WRTL_CHECK (NODE)->decl_with_rtl.rtl		\
256238fd1498Szrj    ? (NODE)->decl_with_rtl.rtl					\
256338fd1498Szrj    : (make_decl_rtl (NODE), (NODE)->decl_with_rtl.rtl))
256438fd1498Szrj 
256538fd1498Szrj /* Set the DECL_RTL for NODE to RTL.  */
256638fd1498Szrj #define SET_DECL_RTL(NODE, RTL) set_decl_rtl (NODE, RTL)
256738fd1498Szrj 
256838fd1498Szrj /* Returns nonzero if NODE is a tree node that can contain RTL.  */
256938fd1498Szrj #define HAS_RTL_P(NODE) (CODE_CONTAINS_STRUCT (TREE_CODE (NODE), TS_DECL_WRTL))
257038fd1498Szrj 
257138fd1498Szrj /* Returns nonzero if the DECL_RTL for NODE has already been set.  */
257238fd1498Szrj #define DECL_RTL_SET_P(NODE) \
257338fd1498Szrj   (HAS_RTL_P (NODE) && DECL_WRTL_CHECK (NODE)->decl_with_rtl.rtl != NULL)
257438fd1498Szrj 
257538fd1498Szrj /* Copy the RTL from SRC_DECL to DST_DECL.  If the RTL was not set for
257638fd1498Szrj    SRC_DECL, it will not be set for DST_DECL; this is a lazy copy.  */
257738fd1498Szrj #define COPY_DECL_RTL(SRC_DECL, DST_DECL) \
257838fd1498Szrj   (DECL_WRTL_CHECK (DST_DECL)->decl_with_rtl.rtl \
257938fd1498Szrj    = DECL_WRTL_CHECK (SRC_DECL)->decl_with_rtl.rtl)
258038fd1498Szrj 
258138fd1498Szrj /* The DECL_RTL for NODE, if it is set, or NULL, if it is not set.  */
258238fd1498Szrj #define DECL_RTL_IF_SET(NODE) (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL)
258338fd1498Szrj 
258438fd1498Szrj #if (GCC_VERSION >= 2007)
258538fd1498Szrj #define DECL_RTL_KNOWN_SET(decl) __extension__				\
258638fd1498Szrj ({  tree const __d = (decl);						\
258738fd1498Szrj     gcc_checking_assert (DECL_RTL_SET_P (__d));				\
258838fd1498Szrj     /* Dereference it so the compiler knows it can't be NULL even	\
258938fd1498Szrj        without assertion checking.  */					\
259038fd1498Szrj     &*DECL_RTL_IF_SET (__d); })
259138fd1498Szrj #else
259238fd1498Szrj #define DECL_RTL_KNOWN_SET(decl) (&*DECL_RTL_IF_SET (decl))
259338fd1498Szrj #endif
259438fd1498Szrj 
259538fd1498Szrj /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'.  */
259638fd1498Szrj #define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0)
259738fd1498Szrj 
259838fd1498Szrj /* In a FIELD_DECL, this is the field position, counting in bytes, of the
259938fd1498Szrj    DECL_OFFSET_ALIGN-bit-sized word containing the bit closest to the beginning
260038fd1498Szrj    of the structure.  */
260138fd1498Szrj #define DECL_FIELD_OFFSET(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.offset)
260238fd1498Szrj 
260338fd1498Szrj /* In a FIELD_DECL, this is the offset, in bits, of the first bit of the
260438fd1498Szrj    field from DECL_FIELD_OFFSET.  This field may be nonzero even for fields
260538fd1498Szrj    that are not bit fields (since DECL_OFFSET_ALIGN may be larger than the
260638fd1498Szrj    natural alignment of the field's type).  */
260738fd1498Szrj #define DECL_FIELD_BIT_OFFSET(NODE) \
260838fd1498Szrj   (FIELD_DECL_CHECK (NODE)->field_decl.bit_offset)
260938fd1498Szrj 
261038fd1498Szrj /* In a FIELD_DECL, this indicates whether the field was a bit-field and
261138fd1498Szrj    if so, the type that was originally specified for it.
261238fd1498Szrj    TREE_TYPE may have been modified (in finish_struct).  */
261338fd1498Szrj #define DECL_BIT_FIELD_TYPE(NODE) \
261438fd1498Szrj   (FIELD_DECL_CHECK (NODE)->field_decl.bit_field_type)
261538fd1498Szrj 
261638fd1498Szrj /* In a FIELD_DECL of a RECORD_TYPE, this is a pointer to the storage
261738fd1498Szrj    representative FIELD_DECL.  */
261838fd1498Szrj #define DECL_BIT_FIELD_REPRESENTATIVE(NODE) \
261938fd1498Szrj   (FIELD_DECL_CHECK (NODE)->field_decl.qualifier)
262038fd1498Szrj 
262138fd1498Szrj /* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which
262238fd1498Szrj    if nonzero, indicates that the field occupies the type.  */
262338fd1498Szrj #define DECL_QUALIFIER(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.qualifier)
262438fd1498Szrj 
262538fd1498Szrj /* For FIELD_DECLs, off_align holds the number of low-order bits of
262638fd1498Szrj    DECL_FIELD_OFFSET which are known to be always zero.
262738fd1498Szrj    DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET
262838fd1498Szrj    has.  */
262938fd1498Szrj #define DECL_OFFSET_ALIGN(NODE) \
263038fd1498Szrj   (((unsigned HOST_WIDE_INT)1) << FIELD_DECL_CHECK (NODE)->decl_common.off_align)
263138fd1498Szrj 
263238fd1498Szrj /* Specify that DECL_OFFSET_ALIGN(NODE) is X.  */
263338fd1498Szrj #define SET_DECL_OFFSET_ALIGN(NODE, X) \
263438fd1498Szrj   (FIELD_DECL_CHECK (NODE)->decl_common.off_align = ffs_hwi (X) - 1)
263538fd1498Szrj 
263638fd1498Szrj /* For FIELD_DECLS, DECL_FCONTEXT is the *first* baseclass in
263738fd1498Szrj    which this FIELD_DECL is defined.  This information is needed when
263838fd1498Szrj    writing debugging information about vfield and vbase decls for C++.  */
263938fd1498Szrj #define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.fcontext)
264038fd1498Szrj 
264138fd1498Szrj /* In a FIELD_DECL, indicates this field should be bit-packed.  */
264238fd1498Szrj #define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->base.u.bits.packed_flag)
264338fd1498Szrj 
264438fd1498Szrj /* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
264538fd1498Szrj    specially.  */
264638fd1498Szrj #define DECL_BIT_FIELD(NODE) (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_1)
264738fd1498Szrj 
264838fd1498Szrj /* Used in a FIELD_DECL to indicate that we cannot form the address of
264938fd1498Szrj    this component.  This makes it possible for Type-Based Alias Analysis
265038fd1498Szrj    to disambiguate accesses to this field with indirect accesses using
265138fd1498Szrj    the field's type:
265238fd1498Szrj 
265338fd1498Szrj      struct S { int i; } s;
265438fd1498Szrj      int *p;
265538fd1498Szrj 
265638fd1498Szrj    If the flag is set on 'i', TBAA computes that s.i and *p never conflict.
265738fd1498Szrj 
265838fd1498Szrj    From the implementation's viewpoint, the alias set of the type of the
265938fd1498Szrj    field 'i' (int) will not be recorded as a subset of that of the type of
266038fd1498Szrj    's' (struct S) in record_component_aliases.  The counterpart is that
266138fd1498Szrj    accesses to s.i must not be given the alias set of the type of 'i'
266238fd1498Szrj    (int) but instead directly that of the type of 's' (struct S).  */
266338fd1498Szrj #define DECL_NONADDRESSABLE_P(NODE) \
266438fd1498Szrj   (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_2)
266538fd1498Szrj 
266638fd1498Szrj /* Used in a FIELD_DECL to indicate that this field is padding.  */
266738fd1498Szrj #define DECL_PADDING_P(NODE) \
266838fd1498Szrj   (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_3)
266938fd1498Szrj 
267038fd1498Szrj /* A numeric unique identifier for a LABEL_DECL.  The UID allocation is
267138fd1498Szrj    dense, unique within any one function, and may be used to index arrays.
267238fd1498Szrj    If the value is -1, then no UID has been assigned.  */
267338fd1498Szrj #define LABEL_DECL_UID(NODE) \
267438fd1498Szrj   (LABEL_DECL_CHECK (NODE)->label_decl.label_decl_uid)
267538fd1498Szrj 
267638fd1498Szrj /* In a LABEL_DECL, the EH region number for which the label is the
267738fd1498Szrj    post_landing_pad.  */
267838fd1498Szrj #define EH_LANDING_PAD_NR(NODE) \
267938fd1498Szrj   (LABEL_DECL_CHECK (NODE)->label_decl.eh_landing_pad_nr)
268038fd1498Szrj 
268138fd1498Szrj /* For a PARM_DECL, records the data type used to pass the argument,
268238fd1498Szrj    which may be different from the type seen in the program.  */
268338fd1498Szrj #define DECL_ARG_TYPE(NODE) (PARM_DECL_CHECK (NODE)->decl_common.initial)
268438fd1498Szrj 
268538fd1498Szrj /* For PARM_DECL, holds an RTL for the stack slot or register
268638fd1498Szrj    where the data was actually passed.  */
268738fd1498Szrj #define DECL_INCOMING_RTL(NODE) \
268838fd1498Szrj   (PARM_DECL_CHECK (NODE)->parm_decl.incoming_rtl)
268938fd1498Szrj 
269038fd1498Szrj /* Nonzero for a given ..._DECL node means that no warnings should be
269138fd1498Szrj    generated just because this node is unused.  */
269238fd1498Szrj #define DECL_IN_SYSTEM_HEADER(NODE) \
269338fd1498Szrj   (in_system_header_at (DECL_SOURCE_LOCATION (NODE)))
269438fd1498Szrj 
269538fd1498Szrj /* Used to indicate that the linkage status of this DECL is not yet known,
269638fd1498Szrj    so it should not be output now.  */
269738fd1498Szrj #define DECL_DEFER_OUTPUT(NODE) \
269838fd1498Szrj   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.defer_output)
269938fd1498Szrj 
270038fd1498Szrj /* In a VAR_DECL that's static,
270138fd1498Szrj    nonzero if the space is in the text section.  */
270238fd1498Szrj #define DECL_IN_TEXT_SECTION(NODE) \
270338fd1498Szrj   (VAR_DECL_CHECK (NODE)->decl_with_vis.in_text_section)
270438fd1498Szrj 
270538fd1498Szrj /* In a VAR_DECL that's static,
270638fd1498Szrj    nonzero if it belongs to the global constant pool.  */
270738fd1498Szrj #define DECL_IN_CONSTANT_POOL(NODE) \
270838fd1498Szrj   (VAR_DECL_CHECK (NODE)->decl_with_vis.in_constant_pool)
270938fd1498Szrj 
271038fd1498Szrj /* Nonzero for a given ..._DECL node means that this node should be
271138fd1498Szrj    put in .common, if possible.  If a DECL_INITIAL is given, and it
271238fd1498Szrj    is not error_mark_node, then the decl cannot be put in .common.  */
271338fd1498Szrj #define DECL_COMMON(NODE) \
271438fd1498Szrj   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.common_flag)
271538fd1498Szrj 
271638fd1498Szrj /* In a VAR_DECL, nonzero if the decl is a register variable with
271738fd1498Szrj    an explicit asm specification.  */
271838fd1498Szrj #define DECL_HARD_REGISTER(NODE)  \
271938fd1498Szrj   (VAR_DECL_CHECK (NODE)->decl_with_vis.hard_register)
272038fd1498Szrj 
272138fd1498Szrj   /* Used to indicate that this DECL has weak linkage.  */
272238fd1498Szrj #define DECL_WEAK(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.weak_flag)
272338fd1498Szrj 
272438fd1498Szrj /* Used to indicate that the DECL is a dllimport.  */
272538fd1498Szrj #define DECL_DLLIMPORT_P(NODE) \
272638fd1498Szrj   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.dllimport_flag)
272738fd1498Szrj 
272838fd1498Szrj /* Used in a DECL to indicate that, even if it TREE_PUBLIC, it need
272938fd1498Szrj    not be put out unless it is needed in this translation unit.
273038fd1498Szrj    Entities like this are shared across translation units (like weak
273138fd1498Szrj    entities), but are guaranteed to be generated by any translation
273238fd1498Szrj    unit that needs them, and therefore need not be put out anywhere
273338fd1498Szrj    where they are not needed.  DECL_COMDAT is just a hint to the
273438fd1498Szrj    back-end; it is up to front-ends which set this flag to ensure
273538fd1498Szrj    that there will never be any harm, other than bloat, in putting out
273638fd1498Szrj    something which is DECL_COMDAT.  */
273738fd1498Szrj #define DECL_COMDAT(NODE) \
273838fd1498Szrj   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.comdat_flag)
273938fd1498Szrj 
274038fd1498Szrj #define DECL_COMDAT_GROUP(NODE) \
274138fd1498Szrj   decl_comdat_group (NODE)
274238fd1498Szrj 
274338fd1498Szrj /* Used in TREE_PUBLIC decls to indicate that copies of this DECL in
274438fd1498Szrj    multiple translation units should be merged.  */
274538fd1498Szrj #define DECL_ONE_ONLY(NODE) (DECL_COMDAT_GROUP (NODE) != NULL_TREE \
274638fd1498Szrj 			     && (TREE_PUBLIC (NODE) || DECL_EXTERNAL (NODE)))
274738fd1498Szrj 
274838fd1498Szrj /* The name of the object as the assembler will see it (but before any
274938fd1498Szrj    translations made by ASM_OUTPUT_LABELREF).  Often this is the same
275038fd1498Szrj    as DECL_NAME.  It is an IDENTIFIER_NODE.
275138fd1498Szrj 
275238fd1498Szrj    ASSEMBLER_NAME of TYPE_DECLS may store global name of type used for
275338fd1498Szrj    One Definition Rule based type merging at LTO.  It is computed only for
275438fd1498Szrj    LTO compilation and C++.  */
275538fd1498Szrj #define DECL_ASSEMBLER_NAME(NODE) decl_assembler_name (NODE)
275638fd1498Szrj 
275738fd1498Szrj /* Raw accessor for DECL_ASSEMBLE_NAME.  */
275838fd1498Szrj #define DECL_ASSEMBLER_NAME_RAW(NODE) \
275938fd1498Szrj   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.assembler_name)
276038fd1498Szrj 
276138fd1498Szrj /* Return true if NODE is a NODE that can contain a DECL_ASSEMBLER_NAME.
276238fd1498Szrj    This is true of all DECL nodes except FIELD_DECL.  */
276338fd1498Szrj #define HAS_DECL_ASSEMBLER_NAME_P(NODE) \
276438fd1498Szrj   (CODE_CONTAINS_STRUCT (TREE_CODE (NODE), TS_DECL_WITH_VIS))
276538fd1498Szrj 
276638fd1498Szrj /* Returns nonzero if the DECL_ASSEMBLER_NAME for NODE has been set.  If zero,
276738fd1498Szrj    the NODE might still have a DECL_ASSEMBLER_NAME -- it just hasn't been set
276838fd1498Szrj    yet.  */
276938fd1498Szrj #define DECL_ASSEMBLER_NAME_SET_P(NODE) \
277038fd1498Szrj   (DECL_ASSEMBLER_NAME_RAW (NODE) != NULL_TREE)
277138fd1498Szrj 
277238fd1498Szrj /* Set the DECL_ASSEMBLER_NAME for NODE to NAME.  */
277338fd1498Szrj #define SET_DECL_ASSEMBLER_NAME(NODE, NAME) \
277438fd1498Szrj   overwrite_decl_assembler_name (NODE, NAME)
277538fd1498Szrj 
277638fd1498Szrj /* Copy the DECL_ASSEMBLER_NAME from SRC_DECL to DST_DECL.  Note that
277738fd1498Szrj    if SRC_DECL's DECL_ASSEMBLER_NAME has not yet been set, using this
277838fd1498Szrj    macro will not cause the DECL_ASSEMBLER_NAME to be set, but will
277938fd1498Szrj    clear DECL_ASSEMBLER_NAME of DST_DECL, if it was already set.  In
278038fd1498Szrj    other words, the semantics of using this macro, are different than
278138fd1498Szrj    saying:
278238fd1498Szrj 
278338fd1498Szrj      SET_DECL_ASSEMBLER_NAME(DST_DECL, DECL_ASSEMBLER_NAME (SRC_DECL))
278438fd1498Szrj 
278538fd1498Szrj    which will try to set the DECL_ASSEMBLER_NAME for SRC_DECL.  */
278638fd1498Szrj 
278738fd1498Szrj #define COPY_DECL_ASSEMBLER_NAME(SRC_DECL, DST_DECL)			\
278838fd1498Szrj   SET_DECL_ASSEMBLER_NAME (DST_DECL, DECL_ASSEMBLER_NAME_RAW (SRC_DECL))
278938fd1498Szrj 
279038fd1498Szrj /* Records the section name in a section attribute.  Used to pass
279138fd1498Szrj    the name from decl_attributes to make_function_rtl and make_decl_rtl.  */
279238fd1498Szrj #define DECL_SECTION_NAME(NODE) decl_section_name (NODE)
279338fd1498Szrj 
279438fd1498Szrj /* Nonzero in a decl means that the gimplifier has seen (or placed)
279538fd1498Szrj    this variable in a BIND_EXPR.  */
279638fd1498Szrj #define DECL_SEEN_IN_BIND_EXPR_P(NODE) \
279738fd1498Szrj   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.seen_in_bind_expr)
279838fd1498Szrj 
279938fd1498Szrj /* Value of the decls's visibility attribute */
280038fd1498Szrj #define DECL_VISIBILITY(NODE) \
280138fd1498Szrj   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.visibility)
280238fd1498Szrj 
280338fd1498Szrj /* Nonzero means that the decl had its visibility specified rather than
280438fd1498Szrj    being inferred.  */
280538fd1498Szrj #define DECL_VISIBILITY_SPECIFIED(NODE) \
280638fd1498Szrj   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.visibility_specified)
280738fd1498Szrj 
280838fd1498Szrj /* In a VAR_DECL, the model to use if the data should be allocated from
280938fd1498Szrj    thread-local storage.  */
281038fd1498Szrj #define DECL_TLS_MODEL(NODE) decl_tls_model (NODE)
281138fd1498Szrj 
281238fd1498Szrj /* In a VAR_DECL, nonzero if the data should be allocated from
281338fd1498Szrj    thread-local storage.  */
281438fd1498Szrj #define DECL_THREAD_LOCAL_P(NODE) \
281538fd1498Szrj   ((TREE_STATIC (NODE) || DECL_EXTERNAL (NODE)) && decl_tls_model (NODE) >= TLS_MODEL_REAL)
281638fd1498Szrj 
281738fd1498Szrj /* In a non-local VAR_DECL with static storage duration, true if the
281838fd1498Szrj    variable has an initialization priority.  If false, the variable
281938fd1498Szrj    will be initialized at the DEFAULT_INIT_PRIORITY.  */
282038fd1498Szrj #define DECL_HAS_INIT_PRIORITY_P(NODE) \
282138fd1498Szrj   (VAR_DECL_CHECK (NODE)->decl_with_vis.init_priority_p)
282238fd1498Szrj 
282338fd1498Szrj extern tree decl_debug_expr_lookup (tree);
282438fd1498Szrj extern void decl_debug_expr_insert (tree, tree);
282538fd1498Szrj 
282638fd1498Szrj /* For VAR_DECL, this is set to an expression that it was split from.  */
282738fd1498Szrj #define DECL_HAS_DEBUG_EXPR_P(NODE) \
282838fd1498Szrj   (VAR_DECL_CHECK (NODE)->decl_common.debug_expr_is_from)
282938fd1498Szrj #define DECL_DEBUG_EXPR(NODE) \
283038fd1498Szrj   (decl_debug_expr_lookup (VAR_DECL_CHECK (NODE)))
283138fd1498Szrj 
283238fd1498Szrj #define SET_DECL_DEBUG_EXPR(NODE, VAL) \
283338fd1498Szrj   (decl_debug_expr_insert (VAR_DECL_CHECK (NODE), VAL))
283438fd1498Szrj 
283538fd1498Szrj extern priority_type decl_init_priority_lookup (tree);
283638fd1498Szrj extern priority_type decl_fini_priority_lookup (tree);
283738fd1498Szrj extern void decl_init_priority_insert (tree, priority_type);
283838fd1498Szrj extern void decl_fini_priority_insert (tree, priority_type);
283938fd1498Szrj 
284038fd1498Szrj /* For a VAR_DECL or FUNCTION_DECL the initialization priority of
284138fd1498Szrj    NODE.  */
284238fd1498Szrj #define DECL_INIT_PRIORITY(NODE) \
284338fd1498Szrj   (decl_init_priority_lookup (NODE))
284438fd1498Szrj /* Set the initialization priority for NODE to VAL.  */
284538fd1498Szrj #define SET_DECL_INIT_PRIORITY(NODE, VAL) \
284638fd1498Szrj   (decl_init_priority_insert (NODE, VAL))
284738fd1498Szrj 
284838fd1498Szrj /* For a FUNCTION_DECL the finalization priority of NODE.  */
284938fd1498Szrj #define DECL_FINI_PRIORITY(NODE) \
285038fd1498Szrj   (decl_fini_priority_lookup (NODE))
285138fd1498Szrj /* Set the finalization priority for NODE to VAL.  */
285238fd1498Szrj #define SET_DECL_FINI_PRIORITY(NODE, VAL) \
285338fd1498Szrj   (decl_fini_priority_insert (NODE, VAL))
285438fd1498Szrj 
285538fd1498Szrj /* The initialization priority for entities for which no explicit
285638fd1498Szrj    initialization priority has been specified.  */
285738fd1498Szrj #define DEFAULT_INIT_PRIORITY 65535
285838fd1498Szrj 
285938fd1498Szrj /* The maximum allowed initialization priority.  */
286038fd1498Szrj #define MAX_INIT_PRIORITY 65535
286138fd1498Szrj 
286238fd1498Szrj /* The largest priority value reserved for use by system runtime
286338fd1498Szrj    libraries.  */
286438fd1498Szrj #define MAX_RESERVED_INIT_PRIORITY 100
286538fd1498Szrj 
286638fd1498Szrj /* In a VAR_DECL, nonzero if this is a global variable for VOPs.  */
286738fd1498Szrj #define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \
286838fd1498Szrj   (VAR_DECL_CHECK (NODE)->base.u.bits.saturating_flag)
286938fd1498Szrj 
287038fd1498Szrj /* In a VAR_DECL, nonzero if this is a non-local frame structure.  */
287138fd1498Szrj #define DECL_NONLOCAL_FRAME(NODE)  \
287238fd1498Szrj   (VAR_DECL_CHECK (NODE)->base.default_def_flag)
287338fd1498Szrj 
287438fd1498Szrj /* In a VAR_DECL, nonzero if this variable is not aliased by any pointer.  */
287538fd1498Szrj #define DECL_NONALIASED(NODE) \
287638fd1498Szrj   (VAR_DECL_CHECK (NODE)->base.nothrow_flag)
287738fd1498Szrj 
287838fd1498Szrj /* This field is used to reference anything in decl.result and is meant only
287938fd1498Szrj    for use by the garbage collector.  */
288038fd1498Szrj #define DECL_RESULT_FLD(NODE) \
288138fd1498Szrj   (DECL_NON_COMMON_CHECK (NODE)->decl_non_common.result)
288238fd1498Szrj 
288338fd1498Szrj /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
288438fd1498Szrj    Before the struct containing the FUNCTION_DECL is laid out,
288538fd1498Szrj    DECL_VINDEX may point to a FUNCTION_DECL in a base class which
288638fd1498Szrj    is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
288738fd1498Szrj    function.  When the class is laid out, this pointer is changed
288838fd1498Szrj    to an INTEGER_CST node which is suitable for use as an index
288938fd1498Szrj    into the virtual function table. */
289038fd1498Szrj #define DECL_VINDEX(NODE) \
289138fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.vindex)
289238fd1498Szrj 
289338fd1498Szrj /* In FUNCTION_DECL, holds the decl for the return value.  */
289438fd1498Szrj #define DECL_RESULT(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_non_common.result)
289538fd1498Szrj 
289638fd1498Szrj /* In a FUNCTION_DECL, nonzero if the function cannot be inlined.  */
289738fd1498Szrj #define DECL_UNINLINABLE(NODE) \
289838fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.uninlinable)
289938fd1498Szrj 
290038fd1498Szrj /* In a FUNCTION_DECL, the saved representation of the body of the
290138fd1498Szrj    entire function.  */
290238fd1498Szrj #define DECL_SAVED_TREE(NODE) \
290338fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.saved_tree)
290438fd1498Szrj 
290538fd1498Szrj /* Nonzero in a FUNCTION_DECL means this function should be treated
290638fd1498Szrj    as if it were a malloc, meaning it returns a pointer that is
290738fd1498Szrj    not an alias.  */
290838fd1498Szrj #define DECL_IS_MALLOC(NODE) \
290938fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.malloc_flag)
291038fd1498Szrj 
291138fd1498Szrj /* Nonzero in a FUNCTION_DECL means this function should be treated as
291238fd1498Szrj    C++ operator new, meaning that it returns a pointer for which we
291338fd1498Szrj    should not use type based aliasing.  */
291438fd1498Szrj #define DECL_IS_OPERATOR_NEW(NODE) \
291538fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.operator_new_flag)
291638fd1498Szrj 
291738fd1498Szrj /* Nonzero in a FUNCTION_DECL means this function may return more
291838fd1498Szrj    than once.  */
291938fd1498Szrj #define DECL_IS_RETURNS_TWICE(NODE) \
292038fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.returns_twice_flag)
292138fd1498Szrj 
292238fd1498Szrj /* Nonzero in a FUNCTION_DECL means this function should be treated
292338fd1498Szrj    as "pure" function (like const function, but may read global memory).  */
292438fd1498Szrj #define DECL_PURE_P(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.pure_flag)
292538fd1498Szrj 
292638fd1498Szrj /* Nonzero only if one of TREE_READONLY or DECL_PURE_P is nonzero AND
292738fd1498Szrj    the const or pure function may not terminate.  When this is nonzero
292838fd1498Szrj    for a const or pure function, it can be dealt with by cse passes
292938fd1498Szrj    but cannot be removed by dce passes since you are not allowed to
293038fd1498Szrj    change an infinite looping program into one that terminates without
293138fd1498Szrj    error.  */
293238fd1498Szrj #define DECL_LOOPING_CONST_OR_PURE_P(NODE) \
293338fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.looping_const_or_pure_flag)
293438fd1498Szrj 
293538fd1498Szrj /* Nonzero in a FUNCTION_DECL means this function should be treated
293638fd1498Szrj    as "novops" function (function that does not read global memory,
293738fd1498Szrj    but may have arbitrary side effects).  */
293838fd1498Szrj #define DECL_IS_NOVOPS(NODE) \
293938fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.novops_flag)
294038fd1498Szrj 
294138fd1498Szrj /* Used in FUNCTION_DECLs to indicate that they should be run automatically
294238fd1498Szrj    at the beginning or end of execution.  */
294338fd1498Szrj #define DECL_STATIC_CONSTRUCTOR(NODE) \
294438fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.static_ctor_flag)
294538fd1498Szrj 
294638fd1498Szrj #define DECL_STATIC_DESTRUCTOR(NODE) \
294738fd1498Szrj (FUNCTION_DECL_CHECK (NODE)->function_decl.static_dtor_flag)
294838fd1498Szrj 
294938fd1498Szrj /* Used in FUNCTION_DECLs to indicate that function entry and exit should
295038fd1498Szrj    be instrumented with calls to support routines.  */
295138fd1498Szrj #define DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT(NODE) \
295238fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.no_instrument_function_entry_exit)
295338fd1498Szrj 
295438fd1498Szrj /* Used in FUNCTION_DECLs to indicate that limit-stack-* should be
295538fd1498Szrj    disabled in this function.  */
295638fd1498Szrj #define DECL_NO_LIMIT_STACK(NODE) \
295738fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.no_limit_stack)
295838fd1498Szrj 
295938fd1498Szrj /* In a FUNCTION_DECL indicates that a static chain is needed.  */
296038fd1498Szrj #define DECL_STATIC_CHAIN(NODE) \
296138fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.regdecl_flag)
296238fd1498Szrj 
296338fd1498Szrj /* Nonzero for a decl that cgraph has decided should be inlined into
296438fd1498Szrj    at least one call site.  It is not meaningful to look at this
296538fd1498Szrj    directly; always use cgraph_function_possibly_inlined_p.  */
296638fd1498Szrj #define DECL_POSSIBLY_INLINED(DECL) \
296738fd1498Szrj   FUNCTION_DECL_CHECK (DECL)->function_decl.possibly_inlined
296838fd1498Szrj 
296938fd1498Szrj /* Nonzero in a FUNCTION_DECL means that this function was declared inline,
297038fd1498Szrj    such as via the `inline' keyword in C/C++.  This flag controls the linkage
297138fd1498Szrj    semantics of 'inline'  */
297238fd1498Szrj #define DECL_DECLARED_INLINE_P(NODE) \
297338fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.declared_inline_flag)
297438fd1498Szrj 
297538fd1498Szrj /* Nonzero in a FUNCTION_DECL means this function should not get
297638fd1498Szrj    -Winline warnings.  */
297738fd1498Szrj #define DECL_NO_INLINE_WARNING_P(NODE) \
297838fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.no_inline_warning_flag)
297938fd1498Szrj 
298038fd1498Szrj /* Nonzero if a FUNCTION_CODE is a TM load/store.  */
298138fd1498Szrj #define BUILTIN_TM_LOAD_STORE_P(FN) \
298238fd1498Szrj   ((FN) >= BUILT_IN_TM_STORE_1 && (FN) <= BUILT_IN_TM_LOAD_RFW_LDOUBLE)
298338fd1498Szrj 
298438fd1498Szrj /* Nonzero if a FUNCTION_CODE is a TM load.  */
298538fd1498Szrj #define BUILTIN_TM_LOAD_P(FN) \
298638fd1498Szrj   ((FN) >= BUILT_IN_TM_LOAD_1 && (FN) <= BUILT_IN_TM_LOAD_RFW_LDOUBLE)
298738fd1498Szrj 
298838fd1498Szrj /* Nonzero if a FUNCTION_CODE is a TM store.  */
298938fd1498Szrj #define BUILTIN_TM_STORE_P(FN) \
299038fd1498Szrj   ((FN) >= BUILT_IN_TM_STORE_1 && (FN) <= BUILT_IN_TM_STORE_WAW_LDOUBLE)
299138fd1498Szrj 
299238fd1498Szrj #define CASE_BUILT_IN_TM_LOAD(FN)	\
299338fd1498Szrj   case BUILT_IN_TM_LOAD_##FN:		\
299438fd1498Szrj   case BUILT_IN_TM_LOAD_RAR_##FN:	\
299538fd1498Szrj   case BUILT_IN_TM_LOAD_RAW_##FN:	\
299638fd1498Szrj   case BUILT_IN_TM_LOAD_RFW_##FN
299738fd1498Szrj 
299838fd1498Szrj #define CASE_BUILT_IN_TM_STORE(FN)	\
299938fd1498Szrj   case BUILT_IN_TM_STORE_##FN:		\
300038fd1498Szrj   case BUILT_IN_TM_STORE_WAR_##FN:	\
300138fd1498Szrj   case BUILT_IN_TM_STORE_WAW_##FN
300238fd1498Szrj 
300338fd1498Szrj /* Nonzero in a FUNCTION_DECL that should be always inlined by the inliner
300438fd1498Szrj    disregarding size and cost heuristics.  This is equivalent to using
300538fd1498Szrj    the always_inline attribute without the required diagnostics if the
300638fd1498Szrj    function cannot be inlined.  */
300738fd1498Szrj #define DECL_DISREGARD_INLINE_LIMITS(NODE) \
300838fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.disregard_inline_limits)
300938fd1498Szrj 
301038fd1498Szrj extern vec<tree, va_gc> **decl_debug_args_lookup (tree);
301138fd1498Szrj extern vec<tree, va_gc> **decl_debug_args_insert (tree);
301238fd1498Szrj 
301338fd1498Szrj /* Nonzero if a FUNCTION_DECL has DEBUG arguments attached to it.  */
301438fd1498Szrj #define DECL_HAS_DEBUG_ARGS_P(NODE) \
301538fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.has_debug_args_flag)
301638fd1498Szrj 
301738fd1498Szrj /* For FUNCTION_DECL, this holds a pointer to a structure ("struct function")
301838fd1498Szrj    that describes the status of this function.  */
301938fd1498Szrj #define DECL_STRUCT_FUNCTION(NODE) \
302038fd1498Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.f)
302138fd1498Szrj 
302238fd1498Szrj /* In a FUNCTION_DECL, nonzero means a built in function of a
302338fd1498Szrj    standard library or more generally a built in function that is
302438fd1498Szrj    recognized by optimizers and expanders.
302538fd1498Szrj 
302638fd1498Szrj    Note that it is different from the DECL_IS_BUILTIN accessor.  For
302738fd1498Szrj    instance, user declared prototypes of C library functions are not
302838fd1498Szrj    DECL_IS_BUILTIN but may be DECL_BUILT_IN.  */
302938fd1498Szrj #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN)
303038fd1498Szrj 
303138fd1498Szrj /* For a builtin function, identify which part of the compiler defined it.  */
303238fd1498Szrj #define DECL_BUILT_IN_CLASS(NODE) \
303338fd1498Szrj    (FUNCTION_DECL_CHECK (NODE)->function_decl.built_in_class)
303438fd1498Szrj 
303538fd1498Szrj /* In FUNCTION_DECL, a chain of ..._DECL nodes.  */
303638fd1498Szrj #define DECL_ARGUMENTS(NODE) \
303738fd1498Szrj    (FUNCTION_DECL_CHECK (NODE)->function_decl.arguments)
303838fd1498Szrj 
303938fd1498Szrj /* In FUNCTION_DECL, the function specific target options to use when compiling
304038fd1498Szrj    this function.  */
304138fd1498Szrj #define DECL_FUNCTION_SPECIFIC_TARGET(NODE) \
304238fd1498Szrj    (FUNCTION_DECL_CHECK (NODE)->function_decl.function_specific_target)
304338fd1498Szrj 
304438fd1498Szrj /* In FUNCTION_DECL, the function specific optimization options to use when
304538fd1498Szrj    compiling this function.  */
304638fd1498Szrj #define DECL_FUNCTION_SPECIFIC_OPTIMIZATION(NODE) \
304738fd1498Szrj    (FUNCTION_DECL_CHECK (NODE)->function_decl.function_specific_optimization)
304838fd1498Szrj 
304938fd1498Szrj /* In FUNCTION_DECL, this is set if this function has other versions generated
305038fd1498Szrj    using "target" attributes.  The default version is the one which does not
305138fd1498Szrj    have any "target" attribute set. */
305238fd1498Szrj #define DECL_FUNCTION_VERSIONED(NODE)\
305338fd1498Szrj    (FUNCTION_DECL_CHECK (NODE)->function_decl.versioned_function)
305438fd1498Szrj 
305538fd1498Szrj /* In FUNCTION_DECL, this is set if this function is a C++ constructor.
305638fd1498Szrj    Devirtualization machinery uses this knowledge for determing type of the
305738fd1498Szrj    object constructed.  Also we assume that constructor address is not
305838fd1498Szrj    important.  */
305938fd1498Szrj #define DECL_CXX_CONSTRUCTOR_P(NODE)\
306038fd1498Szrj    (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.cxx_constructor)
306138fd1498Szrj 
306238fd1498Szrj /* In FUNCTION_DECL, this is set if this function is a C++ destructor.
306338fd1498Szrj    Devirtualization machinery uses this to track types in destruction.  */
306438fd1498Szrj #define DECL_CXX_DESTRUCTOR_P(NODE)\
306538fd1498Szrj    (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.cxx_destructor)
306638fd1498Szrj 
3067*58e805e6Szrj /* In FUNCTION_DECL, this is set if this function is a lambda function.  */
3068*58e805e6Szrj #define DECL_LAMBDA_FUNCTION(NODE) \
3069*58e805e6Szrj   (FUNCTION_DECL_CHECK (NODE)->function_decl.lambda_function)
3070*58e805e6Szrj 
307138fd1498Szrj /* In FUNCTION_DECL that represent an virtual method this is set when
307238fd1498Szrj    the method is final.  */
307338fd1498Szrj #define DECL_FINAL_P(NODE)\
307438fd1498Szrj    (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.final)
307538fd1498Szrj 
307638fd1498Szrj /* The source language of the translation-unit.  */
307738fd1498Szrj #define TRANSLATION_UNIT_LANGUAGE(NODE) \
307838fd1498Szrj   (TRANSLATION_UNIT_DECL_CHECK (NODE)->translation_unit_decl.language)
307938fd1498Szrj 
308038fd1498Szrj /* TRANSLATION_UNIT_DECL inherits from DECL_MINIMAL.  */
308138fd1498Szrj 
308238fd1498Szrj /* For a TYPE_DECL, holds the "original" type.  (TREE_TYPE has the copy.) */
308338fd1498Szrj #define DECL_ORIGINAL_TYPE(NODE) \
308438fd1498Szrj   (TYPE_DECL_CHECK (NODE)->decl_non_common.result)
308538fd1498Szrj 
308638fd1498Szrj /* In a TYPE_DECL nonzero means the detail info about this type is not dumped
308738fd1498Szrj    into stabs.  Instead it will generate cross reference ('x') of names.
308838fd1498Szrj    This uses the same flag as DECL_EXTERNAL.  */
308938fd1498Szrj #define TYPE_DECL_SUPPRESS_DEBUG(NODE) \
309038fd1498Szrj   (TYPE_DECL_CHECK (NODE)->decl_common.decl_flag_1)
309138fd1498Szrj 
309238fd1498Szrj /* Getter of the imported declaration associated to the
309338fd1498Szrj    IMPORTED_DECL node.  */
309438fd1498Szrj #define IMPORTED_DECL_ASSOCIATED_DECL(NODE) \
309538fd1498Szrj (DECL_INITIAL (IMPORTED_DECL_CHECK (NODE)))
309638fd1498Szrj 
309738fd1498Szrj /* Getter of the symbol declaration associated with the
309838fd1498Szrj    NAMELIST_DECL node.  */
309938fd1498Szrj #define NAMELIST_DECL_ASSOCIATED_DECL(NODE) \
310038fd1498Szrj   (DECL_INITIAL (NODE))
310138fd1498Szrj 
310238fd1498Szrj /* A STATEMENT_LIST chains statements together in GENERIC and GIMPLE.
310338fd1498Szrj    To reduce overhead, the nodes containing the statements are not trees.
310438fd1498Szrj    This avoids the overhead of tree_common on all linked list elements.
310538fd1498Szrj 
310638fd1498Szrj    Use the interface in tree-iterator.h to access this node.  */
310738fd1498Szrj 
310838fd1498Szrj #define STATEMENT_LIST_HEAD(NODE) \
310938fd1498Szrj   (STATEMENT_LIST_CHECK (NODE)->stmt_list.head)
311038fd1498Szrj #define STATEMENT_LIST_TAIL(NODE) \
311138fd1498Szrj   (STATEMENT_LIST_CHECK (NODE)->stmt_list.tail)
311238fd1498Szrj 
311338fd1498Szrj #define TREE_OPTIMIZATION(NODE) \
311438fd1498Szrj   (OPTIMIZATION_NODE_CHECK (NODE)->optimization.opts)
311538fd1498Szrj 
311638fd1498Szrj #define TREE_OPTIMIZATION_OPTABS(NODE) \
311738fd1498Szrj   (OPTIMIZATION_NODE_CHECK (NODE)->optimization.optabs)
311838fd1498Szrj 
311938fd1498Szrj #define TREE_OPTIMIZATION_BASE_OPTABS(NODE) \
312038fd1498Szrj   (OPTIMIZATION_NODE_CHECK (NODE)->optimization.base_optabs)
312138fd1498Szrj 
312238fd1498Szrj /* Return a tree node that encapsulates the optimization options in OPTS.  */
312338fd1498Szrj extern tree build_optimization_node (struct gcc_options *opts);
312438fd1498Szrj 
312538fd1498Szrj #define TREE_TARGET_OPTION(NODE) \
312638fd1498Szrj   (TARGET_OPTION_NODE_CHECK (NODE)->target_option.opts)
312738fd1498Szrj 
312838fd1498Szrj #define TREE_TARGET_GLOBALS(NODE) \
312938fd1498Szrj   (TARGET_OPTION_NODE_CHECK (NODE)->target_option.globals)
313038fd1498Szrj 
313138fd1498Szrj /* Return a tree node that encapsulates the target options in OPTS.  */
313238fd1498Szrj extern tree build_target_option_node (struct gcc_options *opts);
313338fd1498Szrj 
313438fd1498Szrj extern void prepare_target_option_nodes_for_pch (void);
313538fd1498Szrj 
313638fd1498Szrj #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
313738fd1498Szrj 
313838fd1498Szrj inline tree
tree_check(tree __t,const char * __f,int __l,const char * __g,tree_code __c)313938fd1498Szrj tree_check (tree __t, const char *__f, int __l, const char *__g, tree_code __c)
314038fd1498Szrj {
314138fd1498Szrj   if (TREE_CODE (__t) != __c)
314238fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c, 0);
314338fd1498Szrj   return __t;
314438fd1498Szrj }
314538fd1498Szrj 
314638fd1498Szrj inline tree
tree_not_check(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c)314738fd1498Szrj tree_not_check (tree __t, const char *__f, int __l, const char *__g,
314838fd1498Szrj                 enum tree_code __c)
314938fd1498Szrj {
315038fd1498Szrj   if (TREE_CODE (__t) == __c)
315138fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c, 0);
315238fd1498Szrj   return __t;
315338fd1498Szrj }
315438fd1498Szrj 
315538fd1498Szrj inline tree
tree_check2(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2)315638fd1498Szrj tree_check2 (tree __t, const char *__f, int __l, const char *__g,
315738fd1498Szrj              enum tree_code __c1, enum tree_code __c2)
315838fd1498Szrj {
315938fd1498Szrj   if (TREE_CODE (__t) != __c1
316038fd1498Szrj       && TREE_CODE (__t) != __c2)
316138fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c1, __c2, 0);
316238fd1498Szrj   return __t;
316338fd1498Szrj }
316438fd1498Szrj 
316538fd1498Szrj inline tree
tree_not_check2(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2)316638fd1498Szrj tree_not_check2 (tree __t, const char *__f, int __l, const char *__g,
316738fd1498Szrj                  enum tree_code __c1, enum tree_code __c2)
316838fd1498Szrj {
316938fd1498Szrj   if (TREE_CODE (__t) == __c1
317038fd1498Szrj       || TREE_CODE (__t) == __c2)
317138fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, 0);
317238fd1498Szrj   return __t;
317338fd1498Szrj }
317438fd1498Szrj 
317538fd1498Szrj inline tree
tree_check3(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3)317638fd1498Szrj tree_check3 (tree __t, const char *__f, int __l, const char *__g,
317738fd1498Szrj              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3)
317838fd1498Szrj {
317938fd1498Szrj   if (TREE_CODE (__t) != __c1
318038fd1498Szrj       && TREE_CODE (__t) != __c2
318138fd1498Szrj       && TREE_CODE (__t) != __c3)
318238fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0);
318338fd1498Szrj   return __t;
318438fd1498Szrj }
318538fd1498Szrj 
318638fd1498Szrj inline tree
tree_not_check3(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3)318738fd1498Szrj tree_not_check3 (tree __t, const char *__f, int __l, const char *__g,
318838fd1498Szrj                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3)
318938fd1498Szrj {
319038fd1498Szrj   if (TREE_CODE (__t) == __c1
319138fd1498Szrj       || TREE_CODE (__t) == __c2
319238fd1498Szrj       || TREE_CODE (__t) == __c3)
319338fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0);
319438fd1498Szrj   return __t;
319538fd1498Szrj }
319638fd1498Szrj 
319738fd1498Szrj inline tree
tree_check4(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3,enum tree_code __c4)319838fd1498Szrj tree_check4 (tree __t, const char *__f, int __l, const char *__g,
319938fd1498Szrj              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
320038fd1498Szrj              enum tree_code __c4)
320138fd1498Szrj {
320238fd1498Szrj   if (TREE_CODE (__t) != __c1
320338fd1498Szrj       && TREE_CODE (__t) != __c2
320438fd1498Szrj       && TREE_CODE (__t) != __c3
320538fd1498Szrj       && TREE_CODE (__t) != __c4)
320638fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0);
320738fd1498Szrj   return __t;
320838fd1498Szrj }
320938fd1498Szrj 
321038fd1498Szrj inline tree
tree_not_check4(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3,enum tree_code __c4)321138fd1498Szrj tree_not_check4 (tree __t, const char *__f, int __l, const char *__g,
321238fd1498Szrj                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
321338fd1498Szrj                  enum tree_code __c4)
321438fd1498Szrj {
321538fd1498Szrj   if (TREE_CODE (__t) == __c1
321638fd1498Szrj       || TREE_CODE (__t) == __c2
321738fd1498Szrj       || TREE_CODE (__t) == __c3
321838fd1498Szrj       || TREE_CODE (__t) == __c4)
321938fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0);
322038fd1498Szrj   return __t;
322138fd1498Szrj }
322238fd1498Szrj 
322338fd1498Szrj inline tree
tree_check5(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3,enum tree_code __c4,enum tree_code __c5)322438fd1498Szrj tree_check5 (tree __t, const char *__f, int __l, const char *__g,
322538fd1498Szrj              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
322638fd1498Szrj              enum tree_code __c4, enum tree_code __c5)
322738fd1498Szrj {
322838fd1498Szrj   if (TREE_CODE (__t) != __c1
322938fd1498Szrj       && TREE_CODE (__t) != __c2
323038fd1498Szrj       && TREE_CODE (__t) != __c3
323138fd1498Szrj       && TREE_CODE (__t) != __c4
323238fd1498Szrj       && TREE_CODE (__t) != __c5)
323338fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0);
323438fd1498Szrj   return __t;
323538fd1498Szrj }
323638fd1498Szrj 
323738fd1498Szrj inline tree
tree_not_check5(tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3,enum tree_code __c4,enum tree_code __c5)323838fd1498Szrj tree_not_check5 (tree __t, const char *__f, int __l, const char *__g,
323938fd1498Szrj                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
324038fd1498Szrj                  enum tree_code __c4, enum tree_code __c5)
324138fd1498Szrj {
324238fd1498Szrj   if (TREE_CODE (__t) == __c1
324338fd1498Szrj       || TREE_CODE (__t) == __c2
324438fd1498Szrj       || TREE_CODE (__t) == __c3
324538fd1498Szrj       || TREE_CODE (__t) == __c4
324638fd1498Szrj       || TREE_CODE (__t) == __c5)
324738fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0);
324838fd1498Szrj   return __t;
324938fd1498Szrj }
325038fd1498Szrj 
325138fd1498Szrj inline tree
contains_struct_check(tree __t,const enum tree_node_structure_enum __s,const char * __f,int __l,const char * __g)325238fd1498Szrj contains_struct_check (tree __t, const enum tree_node_structure_enum __s,
325338fd1498Szrj                        const char *__f, int __l, const char *__g)
325438fd1498Szrj {
325538fd1498Szrj   if (tree_contains_struct[TREE_CODE (__t)][__s] != 1)
325638fd1498Szrj       tree_contains_struct_check_failed (__t, __s, __f, __l, __g);
325738fd1498Szrj   return __t;
325838fd1498Szrj }
325938fd1498Szrj 
326038fd1498Szrj inline tree
tree_class_check(tree __t,const enum tree_code_class __class,const char * __f,int __l,const char * __g)326138fd1498Szrj tree_class_check (tree __t, const enum tree_code_class __class,
326238fd1498Szrj                   const char *__f, int __l, const char *__g)
326338fd1498Szrj {
326438fd1498Szrj   if (TREE_CODE_CLASS (TREE_CODE (__t)) != __class)
326538fd1498Szrj     tree_class_check_failed (__t, __class, __f, __l, __g);
326638fd1498Szrj   return __t;
326738fd1498Szrj }
326838fd1498Szrj 
326938fd1498Szrj inline tree
tree_range_check(tree __t,enum tree_code __code1,enum tree_code __code2,const char * __f,int __l,const char * __g)327038fd1498Szrj tree_range_check (tree __t,
327138fd1498Szrj                   enum tree_code __code1, enum tree_code __code2,
327238fd1498Szrj                   const char *__f, int __l, const char *__g)
327338fd1498Szrj {
327438fd1498Szrj   if (TREE_CODE (__t) < __code1 || TREE_CODE (__t) > __code2)
327538fd1498Szrj     tree_range_check_failed (__t, __f, __l, __g, __code1, __code2);
327638fd1498Szrj   return __t;
327738fd1498Szrj }
327838fd1498Szrj 
327938fd1498Szrj inline tree
omp_clause_subcode_check(tree __t,enum omp_clause_code __code,const char * __f,int __l,const char * __g)328038fd1498Szrj omp_clause_subcode_check (tree __t, enum omp_clause_code __code,
328138fd1498Szrj                           const char *__f, int __l, const char *__g)
328238fd1498Szrj {
328338fd1498Szrj   if (TREE_CODE (__t) != OMP_CLAUSE)
328438fd1498Szrj     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
328538fd1498Szrj   if (__t->omp_clause.code != __code)
328638fd1498Szrj     omp_clause_check_failed (__t, __f, __l, __g, __code);
328738fd1498Szrj   return __t;
328838fd1498Szrj }
328938fd1498Szrj 
329038fd1498Szrj inline tree
omp_clause_range_check(tree __t,enum omp_clause_code __code1,enum omp_clause_code __code2,const char * __f,int __l,const char * __g)329138fd1498Szrj omp_clause_range_check (tree __t,
329238fd1498Szrj                         enum omp_clause_code __code1,
329338fd1498Szrj                         enum omp_clause_code __code2,
329438fd1498Szrj                         const char *__f, int __l, const char *__g)
329538fd1498Szrj {
329638fd1498Szrj   if (TREE_CODE (__t) != OMP_CLAUSE)
329738fd1498Szrj     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
329838fd1498Szrj   if ((int) __t->omp_clause.code < (int) __code1
329938fd1498Szrj       || (int) __t->omp_clause.code > (int) __code2)
330038fd1498Szrj     omp_clause_range_check_failed (__t, __f, __l, __g, __code1, __code2);
330138fd1498Szrj   return __t;
330238fd1498Szrj }
330338fd1498Szrj 
330438fd1498Szrj /* These checks have to be special cased.  */
330538fd1498Szrj 
330638fd1498Szrj inline tree
expr_check(tree __t,const char * __f,int __l,const char * __g)330738fd1498Szrj expr_check (tree __t, const char *__f, int __l, const char *__g)
330838fd1498Szrj {
330938fd1498Szrj   char const __c = TREE_CODE_CLASS (TREE_CODE (__t));
331038fd1498Szrj   if (!IS_EXPR_CODE_CLASS (__c))
331138fd1498Szrj     tree_class_check_failed (__t, tcc_expression, __f, __l, __g);
331238fd1498Szrj   return __t;
331338fd1498Szrj }
331438fd1498Szrj 
331538fd1498Szrj /* These checks have to be special cased.  */
331638fd1498Szrj 
331738fd1498Szrj inline tree
non_type_check(tree __t,const char * __f,int __l,const char * __g)331838fd1498Szrj non_type_check (tree __t, const char *__f, int __l, const char *__g)
331938fd1498Szrj {
332038fd1498Szrj   if (TYPE_P (__t))
332138fd1498Szrj     tree_not_class_check_failed (__t, tcc_type, __f, __l, __g);
332238fd1498Szrj   return __t;
332338fd1498Szrj }
332438fd1498Szrj 
332538fd1498Szrj inline const HOST_WIDE_INT *
tree_int_cst_elt_check(const_tree __t,int __i,const char * __f,int __l,const char * __g)332638fd1498Szrj tree_int_cst_elt_check (const_tree __t, int __i,
332738fd1498Szrj 			const char *__f, int __l, const char *__g)
332838fd1498Szrj {
332938fd1498Szrj   if (TREE_CODE (__t) != INTEGER_CST)
333038fd1498Szrj     tree_check_failed (__t, __f, __l, __g, INTEGER_CST, 0);
333138fd1498Szrj   if (__i < 0 || __i >= __t->base.u.int_length.extended)
333238fd1498Szrj     tree_int_cst_elt_check_failed (__i, __t->base.u.int_length.extended,
333338fd1498Szrj 				   __f, __l, __g);
333438fd1498Szrj   return &CONST_CAST_TREE (__t)->int_cst.val[__i];
333538fd1498Szrj }
333638fd1498Szrj 
333738fd1498Szrj inline HOST_WIDE_INT *
tree_int_cst_elt_check(tree __t,int __i,const char * __f,int __l,const char * __g)333838fd1498Szrj tree_int_cst_elt_check (tree __t, int __i,
333938fd1498Szrj 			const char *__f, int __l, const char *__g)
334038fd1498Szrj {
334138fd1498Szrj   if (TREE_CODE (__t) != INTEGER_CST)
334238fd1498Szrj     tree_check_failed (__t, __f, __l, __g, INTEGER_CST, 0);
334338fd1498Szrj   if (__i < 0 || __i >= __t->base.u.int_length.extended)
334438fd1498Szrj     tree_int_cst_elt_check_failed (__i, __t->base.u.int_length.extended,
334538fd1498Szrj 				   __f, __l, __g);
334638fd1498Szrj   return &CONST_CAST_TREE (__t)->int_cst.val[__i];
334738fd1498Szrj }
334838fd1498Szrj 
334938fd1498Szrj /* Workaround -Wstrict-overflow false positive during profiledbootstrap.  */
335038fd1498Szrj 
335138fd1498Szrj # if GCC_VERSION >= 4006
335238fd1498Szrj #pragma GCC diagnostic push
335338fd1498Szrj #pragma GCC diagnostic ignored "-Wstrict-overflow"
335438fd1498Szrj #endif
335538fd1498Szrj 
335638fd1498Szrj inline tree *
tree_vec_elt_check(tree __t,int __i,const char * __f,int __l,const char * __g)335738fd1498Szrj tree_vec_elt_check (tree __t, int __i,
335838fd1498Szrj                     const char *__f, int __l, const char *__g)
335938fd1498Szrj {
336038fd1498Szrj   if (TREE_CODE (__t) != TREE_VEC)
336138fd1498Szrj     tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
336238fd1498Szrj   if (__i < 0 || __i >= __t->base.u.length)
336338fd1498Szrj     tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g);
336438fd1498Szrj   return &CONST_CAST_TREE (__t)->vec.a[__i];
336538fd1498Szrj }
336638fd1498Szrj 
336738fd1498Szrj # if GCC_VERSION >= 4006
336838fd1498Szrj #pragma GCC diagnostic pop
336938fd1498Szrj #endif
337038fd1498Szrj 
337138fd1498Szrj inline tree *
omp_clause_elt_check(tree __t,int __i,const char * __f,int __l,const char * __g)337238fd1498Szrj omp_clause_elt_check (tree __t, int __i,
337338fd1498Szrj                       const char *__f, int __l, const char *__g)
337438fd1498Szrj {
337538fd1498Szrj   if (TREE_CODE (__t) != OMP_CLAUSE)
337638fd1498Szrj     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
337738fd1498Szrj   if (__i < 0 || __i >= omp_clause_num_ops [__t->omp_clause.code])
337838fd1498Szrj     omp_clause_operand_check_failed (__i, __t, __f, __l, __g);
337938fd1498Szrj   return &__t->omp_clause.ops[__i];
338038fd1498Szrj }
338138fd1498Szrj 
338238fd1498Szrj /* These checks have to be special cased.  */
338338fd1498Szrj 
338438fd1498Szrj inline tree
any_integral_type_check(tree __t,const char * __f,int __l,const char * __g)338538fd1498Szrj any_integral_type_check (tree __t, const char *__f, int __l, const char *__g)
338638fd1498Szrj {
338738fd1498Szrj   if (!ANY_INTEGRAL_TYPE_P (__t))
338838fd1498Szrj     tree_check_failed (__t, __f, __l, __g, BOOLEAN_TYPE, ENUMERAL_TYPE,
338938fd1498Szrj 		       INTEGER_TYPE, 0);
339038fd1498Szrj   return __t;
339138fd1498Szrj }
339238fd1498Szrj 
339338fd1498Szrj inline const_tree
tree_check(const_tree __t,const char * __f,int __l,const char * __g,tree_code __c)339438fd1498Szrj tree_check (const_tree __t, const char *__f, int __l, const char *__g,
339538fd1498Szrj 	    tree_code __c)
339638fd1498Szrj {
339738fd1498Szrj   if (TREE_CODE (__t) != __c)
339838fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c, 0);
339938fd1498Szrj   return __t;
340038fd1498Szrj }
340138fd1498Szrj 
340238fd1498Szrj inline const_tree
tree_not_check(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c)340338fd1498Szrj tree_not_check (const_tree __t, const char *__f, int __l, const char *__g,
340438fd1498Szrj                 enum tree_code __c)
340538fd1498Szrj {
340638fd1498Szrj   if (TREE_CODE (__t) == __c)
340738fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c, 0);
340838fd1498Szrj   return __t;
340938fd1498Szrj }
341038fd1498Szrj 
341138fd1498Szrj inline const_tree
tree_check2(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2)341238fd1498Szrj tree_check2 (const_tree __t, const char *__f, int __l, const char *__g,
341338fd1498Szrj              enum tree_code __c1, enum tree_code __c2)
341438fd1498Szrj {
341538fd1498Szrj   if (TREE_CODE (__t) != __c1
341638fd1498Szrj       && TREE_CODE (__t) != __c2)
341738fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c1, __c2, 0);
341838fd1498Szrj   return __t;
341938fd1498Szrj }
342038fd1498Szrj 
342138fd1498Szrj inline const_tree
tree_not_check2(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2)342238fd1498Szrj tree_not_check2 (const_tree __t, const char *__f, int __l, const char *__g,
342338fd1498Szrj                  enum tree_code __c1, enum tree_code __c2)
342438fd1498Szrj {
342538fd1498Szrj   if (TREE_CODE (__t) == __c1
342638fd1498Szrj       || TREE_CODE (__t) == __c2)
342738fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, 0);
342838fd1498Szrj   return __t;
342938fd1498Szrj }
343038fd1498Szrj 
343138fd1498Szrj inline const_tree
tree_check3(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3)343238fd1498Szrj tree_check3 (const_tree __t, const char *__f, int __l, const char *__g,
343338fd1498Szrj              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3)
343438fd1498Szrj {
343538fd1498Szrj   if (TREE_CODE (__t) != __c1
343638fd1498Szrj       && TREE_CODE (__t) != __c2
343738fd1498Szrj       && TREE_CODE (__t) != __c3)
343838fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0);
343938fd1498Szrj   return __t;
344038fd1498Szrj }
344138fd1498Szrj 
344238fd1498Szrj inline const_tree
tree_not_check3(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3)344338fd1498Szrj tree_not_check3 (const_tree __t, const char *__f, int __l, const char *__g,
344438fd1498Szrj                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3)
344538fd1498Szrj {
344638fd1498Szrj   if (TREE_CODE (__t) == __c1
344738fd1498Szrj       || TREE_CODE (__t) == __c2
344838fd1498Szrj       || TREE_CODE (__t) == __c3)
344938fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0);
345038fd1498Szrj   return __t;
345138fd1498Szrj }
345238fd1498Szrj 
345338fd1498Szrj inline const_tree
tree_check4(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3,enum tree_code __c4)345438fd1498Szrj tree_check4 (const_tree __t, const char *__f, int __l, const char *__g,
345538fd1498Szrj              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
345638fd1498Szrj              enum tree_code __c4)
345738fd1498Szrj {
345838fd1498Szrj   if (TREE_CODE (__t) != __c1
345938fd1498Szrj       && TREE_CODE (__t) != __c2
346038fd1498Szrj       && TREE_CODE (__t) != __c3
346138fd1498Szrj       && TREE_CODE (__t) != __c4)
346238fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0);
346338fd1498Szrj   return __t;
346438fd1498Szrj }
346538fd1498Szrj 
346638fd1498Szrj inline const_tree
tree_not_check4(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3,enum tree_code __c4)346738fd1498Szrj tree_not_check4 (const_tree __t, const char *__f, int __l, const char *__g,
346838fd1498Szrj                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
346938fd1498Szrj                  enum tree_code __c4)
347038fd1498Szrj {
347138fd1498Szrj   if (TREE_CODE (__t) == __c1
347238fd1498Szrj       || TREE_CODE (__t) == __c2
347338fd1498Szrj       || TREE_CODE (__t) == __c3
347438fd1498Szrj       || TREE_CODE (__t) == __c4)
347538fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0);
347638fd1498Szrj   return __t;
347738fd1498Szrj }
347838fd1498Szrj 
347938fd1498Szrj inline const_tree
tree_check5(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3,enum tree_code __c4,enum tree_code __c5)348038fd1498Szrj tree_check5 (const_tree __t, const char *__f, int __l, const char *__g,
348138fd1498Szrj              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
348238fd1498Szrj              enum tree_code __c4, enum tree_code __c5)
348338fd1498Szrj {
348438fd1498Szrj   if (TREE_CODE (__t) != __c1
348538fd1498Szrj       && TREE_CODE (__t) != __c2
348638fd1498Szrj       && TREE_CODE (__t) != __c3
348738fd1498Szrj       && TREE_CODE (__t) != __c4
348838fd1498Szrj       && TREE_CODE (__t) != __c5)
348938fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0);
349038fd1498Szrj   return __t;
349138fd1498Szrj }
349238fd1498Szrj 
349338fd1498Szrj inline const_tree
tree_not_check5(const_tree __t,const char * __f,int __l,const char * __g,enum tree_code __c1,enum tree_code __c2,enum tree_code __c3,enum tree_code __c4,enum tree_code __c5)349438fd1498Szrj tree_not_check5 (const_tree __t, const char *__f, int __l, const char *__g,
349538fd1498Szrj                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
349638fd1498Szrj                  enum tree_code __c4, enum tree_code __c5)
349738fd1498Szrj {
349838fd1498Szrj   if (TREE_CODE (__t) == __c1
349938fd1498Szrj       || TREE_CODE (__t) == __c2
350038fd1498Szrj       || TREE_CODE (__t) == __c3
350138fd1498Szrj       || TREE_CODE (__t) == __c4
350238fd1498Szrj       || TREE_CODE (__t) == __c5)
350338fd1498Szrj     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0);
350438fd1498Szrj   return __t;
350538fd1498Szrj }
350638fd1498Szrj 
350738fd1498Szrj inline const_tree
contains_struct_check(const_tree __t,const enum tree_node_structure_enum __s,const char * __f,int __l,const char * __g)350838fd1498Szrj contains_struct_check (const_tree __t, const enum tree_node_structure_enum __s,
350938fd1498Szrj                        const char *__f, int __l, const char *__g)
351038fd1498Szrj {
351138fd1498Szrj   if (tree_contains_struct[TREE_CODE (__t)][__s] != 1)
351238fd1498Szrj       tree_contains_struct_check_failed (__t, __s, __f, __l, __g);
351338fd1498Szrj   return __t;
351438fd1498Szrj }
351538fd1498Szrj 
351638fd1498Szrj inline const_tree
tree_class_check(const_tree __t,const enum tree_code_class __class,const char * __f,int __l,const char * __g)351738fd1498Szrj tree_class_check (const_tree __t, const enum tree_code_class __class,
351838fd1498Szrj                   const char *__f, int __l, const char *__g)
351938fd1498Szrj {
352038fd1498Szrj   if (TREE_CODE_CLASS (TREE_CODE (__t)) != __class)
352138fd1498Szrj     tree_class_check_failed (__t, __class, __f, __l, __g);
352238fd1498Szrj   return __t;
352338fd1498Szrj }
352438fd1498Szrj 
352538fd1498Szrj inline const_tree
tree_range_check(const_tree __t,enum tree_code __code1,enum tree_code __code2,const char * __f,int __l,const char * __g)352638fd1498Szrj tree_range_check (const_tree __t,
352738fd1498Szrj                   enum tree_code __code1, enum tree_code __code2,
352838fd1498Szrj                   const char *__f, int __l, const char *__g)
352938fd1498Szrj {
353038fd1498Szrj   if (TREE_CODE (__t) < __code1 || TREE_CODE (__t) > __code2)
353138fd1498Szrj     tree_range_check_failed (__t, __f, __l, __g, __code1, __code2);
353238fd1498Szrj   return __t;
353338fd1498Szrj }
353438fd1498Szrj 
353538fd1498Szrj inline const_tree
omp_clause_subcode_check(const_tree __t,enum omp_clause_code __code,const char * __f,int __l,const char * __g)353638fd1498Szrj omp_clause_subcode_check (const_tree __t, enum omp_clause_code __code,
353738fd1498Szrj                           const char *__f, int __l, const char *__g)
353838fd1498Szrj {
353938fd1498Szrj   if (TREE_CODE (__t) != OMP_CLAUSE)
354038fd1498Szrj     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
354138fd1498Szrj   if (__t->omp_clause.code != __code)
354238fd1498Szrj     omp_clause_check_failed (__t, __f, __l, __g, __code);
354338fd1498Szrj   return __t;
354438fd1498Szrj }
354538fd1498Szrj 
354638fd1498Szrj inline const_tree
omp_clause_range_check(const_tree __t,enum omp_clause_code __code1,enum omp_clause_code __code2,const char * __f,int __l,const char * __g)354738fd1498Szrj omp_clause_range_check (const_tree __t,
354838fd1498Szrj                         enum omp_clause_code __code1,
354938fd1498Szrj                         enum omp_clause_code __code2,
355038fd1498Szrj                         const char *__f, int __l, const char *__g)
355138fd1498Szrj {
355238fd1498Szrj   if (TREE_CODE (__t) != OMP_CLAUSE)
355338fd1498Szrj     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
355438fd1498Szrj   if ((int) __t->omp_clause.code < (int) __code1
355538fd1498Szrj       || (int) __t->omp_clause.code > (int) __code2)
355638fd1498Szrj     omp_clause_range_check_failed (__t, __f, __l, __g, __code1, __code2);
355738fd1498Szrj   return __t;
355838fd1498Szrj }
355938fd1498Szrj 
356038fd1498Szrj inline const_tree
expr_check(const_tree __t,const char * __f,int __l,const char * __g)356138fd1498Szrj expr_check (const_tree __t, const char *__f, int __l, const char *__g)
356238fd1498Szrj {
356338fd1498Szrj   char const __c = TREE_CODE_CLASS (TREE_CODE (__t));
356438fd1498Szrj   if (!IS_EXPR_CODE_CLASS (__c))
356538fd1498Szrj     tree_class_check_failed (__t, tcc_expression, __f, __l, __g);
356638fd1498Szrj   return __t;
356738fd1498Szrj }
356838fd1498Szrj 
356938fd1498Szrj inline const_tree
non_type_check(const_tree __t,const char * __f,int __l,const char * __g)357038fd1498Szrj non_type_check (const_tree __t, const char *__f, int __l, const char *__g)
357138fd1498Szrj {
357238fd1498Szrj   if (TYPE_P (__t))
357338fd1498Szrj     tree_not_class_check_failed (__t, tcc_type, __f, __l, __g);
357438fd1498Szrj   return __t;
357538fd1498Szrj }
357638fd1498Szrj 
357738fd1498Szrj # if GCC_VERSION >= 4006
357838fd1498Szrj #pragma GCC diagnostic push
357938fd1498Szrj #pragma GCC diagnostic ignored "-Wstrict-overflow"
358038fd1498Szrj #endif
358138fd1498Szrj 
358238fd1498Szrj inline const_tree *
tree_vec_elt_check(const_tree __t,int __i,const char * __f,int __l,const char * __g)358338fd1498Szrj tree_vec_elt_check (const_tree __t, int __i,
358438fd1498Szrj                     const char *__f, int __l, const char *__g)
358538fd1498Szrj {
358638fd1498Szrj   if (TREE_CODE (__t) != TREE_VEC)
358738fd1498Szrj     tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
358838fd1498Szrj   if (__i < 0 || __i >= __t->base.u.length)
358938fd1498Szrj     tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g);
359038fd1498Szrj   return CONST_CAST (const_tree *, &__t->vec.a[__i]);
359138fd1498Szrj   //return &__t->vec.a[__i];
359238fd1498Szrj }
359338fd1498Szrj 
359438fd1498Szrj # if GCC_VERSION >= 4006
359538fd1498Szrj #pragma GCC diagnostic pop
359638fd1498Szrj #endif
359738fd1498Szrj 
359838fd1498Szrj inline const_tree *
omp_clause_elt_check(const_tree __t,int __i,const char * __f,int __l,const char * __g)359938fd1498Szrj omp_clause_elt_check (const_tree __t, int __i,
360038fd1498Szrj                       const char *__f, int __l, const char *__g)
360138fd1498Szrj {
360238fd1498Szrj   if (TREE_CODE (__t) != OMP_CLAUSE)
360338fd1498Szrj     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
360438fd1498Szrj   if (__i < 0 || __i >= omp_clause_num_ops [__t->omp_clause.code])
360538fd1498Szrj     omp_clause_operand_check_failed (__i, __t, __f, __l, __g);
360638fd1498Szrj   return CONST_CAST (const_tree *, &__t->omp_clause.ops[__i]);
360738fd1498Szrj }
360838fd1498Szrj 
360938fd1498Szrj inline const_tree
any_integral_type_check(const_tree __t,const char * __f,int __l,const char * __g)361038fd1498Szrj any_integral_type_check (const_tree __t, const char *__f, int __l,
361138fd1498Szrj 			 const char *__g)
361238fd1498Szrj {
361338fd1498Szrj   if (!ANY_INTEGRAL_TYPE_P (__t))
361438fd1498Szrj     tree_check_failed (__t, __f, __l, __g, BOOLEAN_TYPE, ENUMERAL_TYPE,
361538fd1498Szrj 		       INTEGER_TYPE, 0);
361638fd1498Szrj   return __t;
361738fd1498Szrj }
361838fd1498Szrj 
361938fd1498Szrj #endif
362038fd1498Szrj 
362138fd1498Szrj /* Compute the number of operands in an expression node NODE.  For
362238fd1498Szrj    tcc_vl_exp nodes like CALL_EXPRs, this is stored in the node itself,
362338fd1498Szrj    otherwise it is looked up from the node's code.  */
362438fd1498Szrj static inline int
tree_operand_length(const_tree node)362538fd1498Szrj tree_operand_length (const_tree node)
362638fd1498Szrj {
362738fd1498Szrj   if (VL_EXP_CLASS_P (node))
362838fd1498Szrj     return VL_EXP_OPERAND_LENGTH (node);
362938fd1498Szrj   else
363038fd1498Szrj     return TREE_CODE_LENGTH (TREE_CODE (node));
363138fd1498Szrj }
363238fd1498Szrj 
363338fd1498Szrj #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
363438fd1498Szrj 
363538fd1498Szrj /* Special checks for TREE_OPERANDs.  */
363638fd1498Szrj inline tree *
tree_operand_check(tree __t,int __i,const char * __f,int __l,const char * __g)363738fd1498Szrj tree_operand_check (tree __t, int __i,
363838fd1498Szrj                     const char *__f, int __l, const char *__g)
363938fd1498Szrj {
364038fd1498Szrj   const_tree __u = EXPR_CHECK (__t);
364138fd1498Szrj   if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__u))
364238fd1498Szrj     tree_operand_check_failed (__i, __u, __f, __l, __g);
364338fd1498Szrj   return &CONST_CAST_TREE (__u)->exp.operands[__i];
364438fd1498Szrj }
364538fd1498Szrj 
364638fd1498Szrj inline tree *
tree_operand_check_code(tree __t,enum tree_code __code,int __i,const char * __f,int __l,const char * __g)364738fd1498Szrj tree_operand_check_code (tree __t, enum tree_code __code, int __i,
364838fd1498Szrj                          const char *__f, int __l, const char *__g)
364938fd1498Szrj {
365038fd1498Szrj   if (TREE_CODE (__t) != __code)
365138fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __code, 0);
365238fd1498Szrj   if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__t))
365338fd1498Szrj     tree_operand_check_failed (__i, __t, __f, __l, __g);
365438fd1498Szrj   return &__t->exp.operands[__i];
365538fd1498Szrj }
365638fd1498Szrj 
365738fd1498Szrj inline const_tree *
tree_operand_check(const_tree __t,int __i,const char * __f,int __l,const char * __g)365838fd1498Szrj tree_operand_check (const_tree __t, int __i,
365938fd1498Szrj                     const char *__f, int __l, const char *__g)
366038fd1498Szrj {
366138fd1498Szrj   const_tree __u = EXPR_CHECK (__t);
366238fd1498Szrj   if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__u))
366338fd1498Szrj     tree_operand_check_failed (__i, __u, __f, __l, __g);
366438fd1498Szrj   return CONST_CAST (const_tree *, &__u->exp.operands[__i]);
366538fd1498Szrj }
366638fd1498Szrj 
366738fd1498Szrj inline const_tree *
tree_operand_check_code(const_tree __t,enum tree_code __code,int __i,const char * __f,int __l,const char * __g)366838fd1498Szrj tree_operand_check_code (const_tree __t, enum tree_code __code, int __i,
366938fd1498Szrj                          const char *__f, int __l, const char *__g)
367038fd1498Szrj {
367138fd1498Szrj   if (TREE_CODE (__t) != __code)
367238fd1498Szrj     tree_check_failed (__t, __f, __l, __g, __code, 0);
367338fd1498Szrj   if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__t))
367438fd1498Szrj     tree_operand_check_failed (__i, __t, __f, __l, __g);
367538fd1498Szrj   return CONST_CAST (const_tree *, &__t->exp.operands[__i]);
367638fd1498Szrj }
367738fd1498Szrj 
367838fd1498Szrj #endif
367938fd1498Szrj 
368038fd1498Szrj /* True iff an identifier matches a C string.  */
368138fd1498Szrj 
368238fd1498Szrj inline bool
id_equal(const_tree id,const char * str)368338fd1498Szrj id_equal (const_tree id, const char *str)
368438fd1498Szrj {
368538fd1498Szrj   return !strcmp (IDENTIFIER_POINTER (id), str);
368638fd1498Szrj }
368738fd1498Szrj 
368838fd1498Szrj inline bool
id_equal(const char * str,const_tree id)368938fd1498Szrj id_equal (const char *str, const_tree id)
369038fd1498Szrj {
369138fd1498Szrj   return !strcmp (str, IDENTIFIER_POINTER (id));
369238fd1498Szrj }
369338fd1498Szrj 
369438fd1498Szrj /* Return the number of elements in the VECTOR_TYPE given by NODE.  */
369538fd1498Szrj 
369638fd1498Szrj inline poly_uint64
TYPE_VECTOR_SUBPARTS(const_tree node)369738fd1498Szrj TYPE_VECTOR_SUBPARTS (const_tree node)
369838fd1498Szrj {
369938fd1498Szrj   STATIC_ASSERT (NUM_POLY_INT_COEFFS <= 2);
370038fd1498Szrj   unsigned int precision = VECTOR_TYPE_CHECK (node)->type_common.precision;
370138fd1498Szrj   if (NUM_POLY_INT_COEFFS == 2)
370238fd1498Szrj     {
370338fd1498Szrj       poly_uint64 res = 0;
370438fd1498Szrj       res.coeffs[0] = 1 << (precision & 0xff);
370538fd1498Szrj       if (precision & 0x100)
370638fd1498Szrj 	res.coeffs[1] = 1 << (precision & 0xff);
370738fd1498Szrj       return res;
370838fd1498Szrj     }
370938fd1498Szrj   else
371038fd1498Szrj     return 1 << precision;
371138fd1498Szrj }
371238fd1498Szrj 
371338fd1498Szrj /* Set the number of elements in VECTOR_TYPE NODE to SUBPARTS, which must
371438fd1498Szrj    satisfy valid_vector_subparts_p.  */
371538fd1498Szrj 
371638fd1498Szrj inline void
SET_TYPE_VECTOR_SUBPARTS(tree node,poly_uint64 subparts)371738fd1498Szrj SET_TYPE_VECTOR_SUBPARTS (tree node, poly_uint64 subparts)
371838fd1498Szrj {
371938fd1498Szrj   STATIC_ASSERT (NUM_POLY_INT_COEFFS <= 2);
372038fd1498Szrj   unsigned HOST_WIDE_INT coeff0 = subparts.coeffs[0];
372138fd1498Szrj   int index = exact_log2 (coeff0);
372238fd1498Szrj   gcc_assert (index >= 0);
372338fd1498Szrj   if (NUM_POLY_INT_COEFFS == 2)
372438fd1498Szrj     {
372538fd1498Szrj       unsigned HOST_WIDE_INT coeff1 = subparts.coeffs[1];
372638fd1498Szrj       gcc_assert (coeff1 == 0 || coeff1 == coeff0);
372738fd1498Szrj       VECTOR_TYPE_CHECK (node)->type_common.precision
372838fd1498Szrj 	= index + (coeff1 != 0 ? 0x100 : 0);
372938fd1498Szrj     }
373038fd1498Szrj   else
373138fd1498Szrj     VECTOR_TYPE_CHECK (node)->type_common.precision = index;
373238fd1498Szrj }
373338fd1498Szrj 
373438fd1498Szrj /* Return true if we can construct vector types with the given number
373538fd1498Szrj    of subparts.  */
373638fd1498Szrj 
373738fd1498Szrj static inline bool
valid_vector_subparts_p(poly_uint64 subparts)373838fd1498Szrj valid_vector_subparts_p (poly_uint64 subparts)
373938fd1498Szrj {
374038fd1498Szrj   unsigned HOST_WIDE_INT coeff0 = subparts.coeffs[0];
374138fd1498Szrj   if (!pow2p_hwi (coeff0))
374238fd1498Szrj     return false;
374338fd1498Szrj   if (NUM_POLY_INT_COEFFS == 2)
374438fd1498Szrj     {
374538fd1498Szrj       unsigned HOST_WIDE_INT coeff1 = subparts.coeffs[1];
374638fd1498Szrj       if (coeff1 != 0 && coeff1 != coeff0)
374738fd1498Szrj 	return false;
374838fd1498Szrj     }
374938fd1498Szrj   return true;
375038fd1498Szrj }
375138fd1498Szrj 
375238fd1498Szrj /* In NON_LVALUE_EXPR and VIEW_CONVERT_EXPR, set when this node is merely a
375338fd1498Szrj    wrapper added to express a location_t on behalf of the node's child
375438fd1498Szrj    (e.g. by maybe_wrap_with_location).  */
375538fd1498Szrj 
375638fd1498Szrj #define EXPR_LOCATION_WRAPPER_P(NODE) \
375738fd1498Szrj   (TREE_CHECK2(NODE, NON_LVALUE_EXPR, VIEW_CONVERT_EXPR)->base.public_flag)
375838fd1498Szrj 
375938fd1498Szrj /* Test if EXP is merely a wrapper node, added to express a location_t
376038fd1498Szrj    on behalf of the node's child (e.g. by maybe_wrap_with_location).  */
376138fd1498Szrj 
376238fd1498Szrj inline bool
location_wrapper_p(const_tree exp)376338fd1498Szrj location_wrapper_p (const_tree exp)
376438fd1498Szrj {
376538fd1498Szrj   /* A wrapper node has code NON_LVALUE_EXPR or VIEW_CONVERT_EXPR, and
376638fd1498Szrj      the flag EXPR_LOCATION_WRAPPER_P is set.
376738fd1498Szrj      It normally has the same type as its operand, but it can have a
376838fd1498Szrj      different one if the type of the operand has changed (e.g. when
376938fd1498Szrj      merging duplicate decls).
377038fd1498Szrj 
377138fd1498Szrj      NON_LVALUE_EXPR is used for wrapping constants, apart from STRING_CST.
377238fd1498Szrj      VIEW_CONVERT_EXPR is used for wrapping non-constants and STRING_CST.  */
377338fd1498Szrj   if ((TREE_CODE (exp) == NON_LVALUE_EXPR
377438fd1498Szrj        || TREE_CODE (exp) == VIEW_CONVERT_EXPR)
377538fd1498Szrj       && EXPR_LOCATION_WRAPPER_P (exp))
377638fd1498Szrj     return true;
377738fd1498Szrj   return false;
377838fd1498Szrj }
377938fd1498Szrj 
378038fd1498Szrj /* Implementation of STRIP_ANY_LOCATION_WRAPPER.  */
378138fd1498Szrj 
378238fd1498Szrj inline tree
tree_strip_any_location_wrapper(tree exp)378338fd1498Szrj tree_strip_any_location_wrapper (tree exp)
378438fd1498Szrj {
378538fd1498Szrj   if (location_wrapper_p (exp))
378638fd1498Szrj     return TREE_OPERAND (exp, 0);
378738fd1498Szrj   else
378838fd1498Szrj     return exp;
378938fd1498Szrj }
379038fd1498Szrj 
379138fd1498Szrj #define error_mark_node			global_trees[TI_ERROR_MARK]
379238fd1498Szrj 
379338fd1498Szrj #define intQI_type_node			global_trees[TI_INTQI_TYPE]
379438fd1498Szrj #define intHI_type_node			global_trees[TI_INTHI_TYPE]
379538fd1498Szrj #define intSI_type_node			global_trees[TI_INTSI_TYPE]
379638fd1498Szrj #define intDI_type_node			global_trees[TI_INTDI_TYPE]
379738fd1498Szrj #define intTI_type_node			global_trees[TI_INTTI_TYPE]
379838fd1498Szrj 
379938fd1498Szrj #define unsigned_intQI_type_node	global_trees[TI_UINTQI_TYPE]
380038fd1498Szrj #define unsigned_intHI_type_node	global_trees[TI_UINTHI_TYPE]
380138fd1498Szrj #define unsigned_intSI_type_node	global_trees[TI_UINTSI_TYPE]
380238fd1498Szrj #define unsigned_intDI_type_node	global_trees[TI_UINTDI_TYPE]
380338fd1498Szrj #define unsigned_intTI_type_node	global_trees[TI_UINTTI_TYPE]
380438fd1498Szrj 
380538fd1498Szrj #define atomicQI_type_node	global_trees[TI_ATOMICQI_TYPE]
380638fd1498Szrj #define atomicHI_type_node	global_trees[TI_ATOMICHI_TYPE]
380738fd1498Szrj #define atomicSI_type_node	global_trees[TI_ATOMICSI_TYPE]
380838fd1498Szrj #define atomicDI_type_node	global_trees[TI_ATOMICDI_TYPE]
380938fd1498Szrj #define atomicTI_type_node	global_trees[TI_ATOMICTI_TYPE]
381038fd1498Szrj 
381138fd1498Szrj #define uint16_type_node		global_trees[TI_UINT16_TYPE]
381238fd1498Szrj #define uint32_type_node		global_trees[TI_UINT32_TYPE]
381338fd1498Szrj #define uint64_type_node		global_trees[TI_UINT64_TYPE]
381438fd1498Szrj 
381538fd1498Szrj #define void_node			global_trees[TI_VOID]
381638fd1498Szrj 
381738fd1498Szrj #define integer_zero_node		global_trees[TI_INTEGER_ZERO]
381838fd1498Szrj #define integer_one_node		global_trees[TI_INTEGER_ONE]
381938fd1498Szrj #define integer_three_node              global_trees[TI_INTEGER_THREE]
382038fd1498Szrj #define integer_minus_one_node		global_trees[TI_INTEGER_MINUS_ONE]
382138fd1498Szrj #define size_zero_node			global_trees[TI_SIZE_ZERO]
382238fd1498Szrj #define size_one_node			global_trees[TI_SIZE_ONE]
382338fd1498Szrj #define bitsize_zero_node		global_trees[TI_BITSIZE_ZERO]
382438fd1498Szrj #define bitsize_one_node		global_trees[TI_BITSIZE_ONE]
382538fd1498Szrj #define bitsize_unit_node		global_trees[TI_BITSIZE_UNIT]
382638fd1498Szrj 
382738fd1498Szrj /* Base access nodes.  */
382838fd1498Szrj #define access_public_node		global_trees[TI_PUBLIC]
382938fd1498Szrj #define access_protected_node	        global_trees[TI_PROTECTED]
383038fd1498Szrj #define access_private_node		global_trees[TI_PRIVATE]
383138fd1498Szrj 
383238fd1498Szrj #define null_pointer_node		global_trees[TI_NULL_POINTER]
383338fd1498Szrj 
383438fd1498Szrj #define float_type_node			global_trees[TI_FLOAT_TYPE]
383538fd1498Szrj #define double_type_node		global_trees[TI_DOUBLE_TYPE]
383638fd1498Szrj #define long_double_type_node		global_trees[TI_LONG_DOUBLE_TYPE]
383738fd1498Szrj 
383838fd1498Szrj /* Nodes for particular _FloatN and _FloatNx types in sequence.  */
383938fd1498Szrj #define FLOATN_TYPE_NODE(IDX)		global_trees[TI_FLOATN_TYPE_FIRST + (IDX)]
384038fd1498Szrj #define FLOATN_NX_TYPE_NODE(IDX)	global_trees[TI_FLOATN_NX_TYPE_FIRST + (IDX)]
384138fd1498Szrj #define FLOATNX_TYPE_NODE(IDX)		global_trees[TI_FLOATNX_TYPE_FIRST + (IDX)]
384238fd1498Szrj 
384338fd1498Szrj /* Names for individual types (code should normally iterate over all
384438fd1498Szrj    such types; these are only for back-end use, or in contexts such as
384538fd1498Szrj    *.def where iteration is not possible).  */
384638fd1498Szrj #define float16_type_node		global_trees[TI_FLOAT16_TYPE]
384738fd1498Szrj #define float32_type_node		global_trees[TI_FLOAT32_TYPE]
384838fd1498Szrj #define float64_type_node		global_trees[TI_FLOAT64_TYPE]
384938fd1498Szrj #define float128_type_node		global_trees[TI_FLOAT128_TYPE]
385038fd1498Szrj #define float32x_type_node		global_trees[TI_FLOAT32X_TYPE]
385138fd1498Szrj #define float64x_type_node		global_trees[TI_FLOAT64X_TYPE]
385238fd1498Szrj #define float128x_type_node		global_trees[TI_FLOAT128X_TYPE]
385338fd1498Szrj 
385438fd1498Szrj #define float_ptr_type_node		global_trees[TI_FLOAT_PTR_TYPE]
385538fd1498Szrj #define double_ptr_type_node		global_trees[TI_DOUBLE_PTR_TYPE]
385638fd1498Szrj #define long_double_ptr_type_node	global_trees[TI_LONG_DOUBLE_PTR_TYPE]
385738fd1498Szrj #define integer_ptr_type_node		global_trees[TI_INTEGER_PTR_TYPE]
385838fd1498Szrj 
385938fd1498Szrj #define complex_integer_type_node	global_trees[TI_COMPLEX_INTEGER_TYPE]
386038fd1498Szrj #define complex_float_type_node		global_trees[TI_COMPLEX_FLOAT_TYPE]
386138fd1498Szrj #define complex_double_type_node	global_trees[TI_COMPLEX_DOUBLE_TYPE]
386238fd1498Szrj #define complex_long_double_type_node	global_trees[TI_COMPLEX_LONG_DOUBLE_TYPE]
386338fd1498Szrj 
386438fd1498Szrj #define COMPLEX_FLOATN_NX_TYPE_NODE(IDX)	global_trees[TI_COMPLEX_FLOATN_NX_TYPE_FIRST + (IDX)]
386538fd1498Szrj 
386638fd1498Szrj #define pointer_bounds_type_node        global_trees[TI_POINTER_BOUNDS_TYPE]
386738fd1498Szrj 
386838fd1498Szrj #define void_type_node			global_trees[TI_VOID_TYPE]
386938fd1498Szrj /* The C type `void *'.  */
387038fd1498Szrj #define ptr_type_node			global_trees[TI_PTR_TYPE]
387138fd1498Szrj /* The C type `const void *'.  */
387238fd1498Szrj #define const_ptr_type_node		global_trees[TI_CONST_PTR_TYPE]
387338fd1498Szrj /* The C type `size_t'.  */
387438fd1498Szrj #define size_type_node                  global_trees[TI_SIZE_TYPE]
387538fd1498Szrj #define pid_type_node                   global_trees[TI_PID_TYPE]
387638fd1498Szrj #define ptrdiff_type_node		global_trees[TI_PTRDIFF_TYPE]
387738fd1498Szrj #define va_list_type_node		global_trees[TI_VA_LIST_TYPE]
387838fd1498Szrj #define va_list_gpr_counter_field	global_trees[TI_VA_LIST_GPR_COUNTER_FIELD]
387938fd1498Szrj #define va_list_fpr_counter_field	global_trees[TI_VA_LIST_FPR_COUNTER_FIELD]
388038fd1498Szrj /* The C type `FILE *'.  */
388138fd1498Szrj #define fileptr_type_node		global_trees[TI_FILEPTR_TYPE]
388238fd1498Szrj /* The C type `const struct tm *'.  */
388338fd1498Szrj #define const_tm_ptr_type_node		global_trees[TI_CONST_TM_PTR_TYPE]
388438fd1498Szrj /* The C type `fenv_t *'.  */
388538fd1498Szrj #define fenv_t_ptr_type_node		global_trees[TI_FENV_T_PTR_TYPE]
388638fd1498Szrj #define const_fenv_t_ptr_type_node	global_trees[TI_CONST_FENV_T_PTR_TYPE]
388738fd1498Szrj /* The C type `fexcept_t *'.  */
388838fd1498Szrj #define fexcept_t_ptr_type_node		global_trees[TI_FEXCEPT_T_PTR_TYPE]
388938fd1498Szrj #define const_fexcept_t_ptr_type_node	global_trees[TI_CONST_FEXCEPT_T_PTR_TYPE]
389038fd1498Szrj #define pointer_sized_int_node		global_trees[TI_POINTER_SIZED_TYPE]
389138fd1498Szrj 
389238fd1498Szrj #define boolean_type_node		global_trees[TI_BOOLEAN_TYPE]
389338fd1498Szrj #define boolean_false_node		global_trees[TI_BOOLEAN_FALSE]
389438fd1498Szrj #define boolean_true_node		global_trees[TI_BOOLEAN_TRUE]
389538fd1498Szrj 
389638fd1498Szrj /* The decimal floating point types. */
389738fd1498Szrj #define dfloat32_type_node              global_trees[TI_DFLOAT32_TYPE]
389838fd1498Szrj #define dfloat64_type_node              global_trees[TI_DFLOAT64_TYPE]
389938fd1498Szrj #define dfloat128_type_node             global_trees[TI_DFLOAT128_TYPE]
390038fd1498Szrj #define dfloat32_ptr_type_node          global_trees[TI_DFLOAT32_PTR_TYPE]
390138fd1498Szrj #define dfloat64_ptr_type_node          global_trees[TI_DFLOAT64_PTR_TYPE]
390238fd1498Szrj #define dfloat128_ptr_type_node         global_trees[TI_DFLOAT128_PTR_TYPE]
390338fd1498Szrj 
390438fd1498Szrj /* The fixed-point types.  */
390538fd1498Szrj #define sat_short_fract_type_node       global_trees[TI_SAT_SFRACT_TYPE]
390638fd1498Szrj #define sat_fract_type_node             global_trees[TI_SAT_FRACT_TYPE]
390738fd1498Szrj #define sat_long_fract_type_node        global_trees[TI_SAT_LFRACT_TYPE]
390838fd1498Szrj #define sat_long_long_fract_type_node   global_trees[TI_SAT_LLFRACT_TYPE]
390938fd1498Szrj #define sat_unsigned_short_fract_type_node \
391038fd1498Szrj 					global_trees[TI_SAT_USFRACT_TYPE]
391138fd1498Szrj #define sat_unsigned_fract_type_node    global_trees[TI_SAT_UFRACT_TYPE]
391238fd1498Szrj #define sat_unsigned_long_fract_type_node \
391338fd1498Szrj 					global_trees[TI_SAT_ULFRACT_TYPE]
391438fd1498Szrj #define sat_unsigned_long_long_fract_type_node \
391538fd1498Szrj 					global_trees[TI_SAT_ULLFRACT_TYPE]
391638fd1498Szrj #define short_fract_type_node           global_trees[TI_SFRACT_TYPE]
391738fd1498Szrj #define fract_type_node                 global_trees[TI_FRACT_TYPE]
391838fd1498Szrj #define long_fract_type_node            global_trees[TI_LFRACT_TYPE]
391938fd1498Szrj #define long_long_fract_type_node       global_trees[TI_LLFRACT_TYPE]
392038fd1498Szrj #define unsigned_short_fract_type_node  global_trees[TI_USFRACT_TYPE]
392138fd1498Szrj #define unsigned_fract_type_node        global_trees[TI_UFRACT_TYPE]
392238fd1498Szrj #define unsigned_long_fract_type_node   global_trees[TI_ULFRACT_TYPE]
392338fd1498Szrj #define unsigned_long_long_fract_type_node \
392438fd1498Szrj 					global_trees[TI_ULLFRACT_TYPE]
392538fd1498Szrj #define sat_short_accum_type_node       global_trees[TI_SAT_SACCUM_TYPE]
392638fd1498Szrj #define sat_accum_type_node             global_trees[TI_SAT_ACCUM_TYPE]
392738fd1498Szrj #define sat_long_accum_type_node        global_trees[TI_SAT_LACCUM_TYPE]
392838fd1498Szrj #define sat_long_long_accum_type_node   global_trees[TI_SAT_LLACCUM_TYPE]
392938fd1498Szrj #define sat_unsigned_short_accum_type_node \
393038fd1498Szrj 					global_trees[TI_SAT_USACCUM_TYPE]
393138fd1498Szrj #define sat_unsigned_accum_type_node    global_trees[TI_SAT_UACCUM_TYPE]
393238fd1498Szrj #define sat_unsigned_long_accum_type_node \
393338fd1498Szrj 					global_trees[TI_SAT_ULACCUM_TYPE]
393438fd1498Szrj #define sat_unsigned_long_long_accum_type_node \
393538fd1498Szrj 					global_trees[TI_SAT_ULLACCUM_TYPE]
393638fd1498Szrj #define short_accum_type_node           global_trees[TI_SACCUM_TYPE]
393738fd1498Szrj #define accum_type_node                 global_trees[TI_ACCUM_TYPE]
393838fd1498Szrj #define long_accum_type_node            global_trees[TI_LACCUM_TYPE]
393938fd1498Szrj #define long_long_accum_type_node       global_trees[TI_LLACCUM_TYPE]
394038fd1498Szrj #define unsigned_short_accum_type_node  global_trees[TI_USACCUM_TYPE]
394138fd1498Szrj #define unsigned_accum_type_node        global_trees[TI_UACCUM_TYPE]
394238fd1498Szrj #define unsigned_long_accum_type_node   global_trees[TI_ULACCUM_TYPE]
394338fd1498Szrj #define unsigned_long_long_accum_type_node \
394438fd1498Szrj 					global_trees[TI_ULLACCUM_TYPE]
394538fd1498Szrj #define qq_type_node                    global_trees[TI_QQ_TYPE]
394638fd1498Szrj #define hq_type_node                    global_trees[TI_HQ_TYPE]
394738fd1498Szrj #define sq_type_node                    global_trees[TI_SQ_TYPE]
394838fd1498Szrj #define dq_type_node                    global_trees[TI_DQ_TYPE]
394938fd1498Szrj #define tq_type_node                    global_trees[TI_TQ_TYPE]
395038fd1498Szrj #define uqq_type_node                   global_trees[TI_UQQ_TYPE]
395138fd1498Szrj #define uhq_type_node                   global_trees[TI_UHQ_TYPE]
395238fd1498Szrj #define usq_type_node                   global_trees[TI_USQ_TYPE]
395338fd1498Szrj #define udq_type_node                   global_trees[TI_UDQ_TYPE]
395438fd1498Szrj #define utq_type_node                   global_trees[TI_UTQ_TYPE]
395538fd1498Szrj #define sat_qq_type_node                global_trees[TI_SAT_QQ_TYPE]
395638fd1498Szrj #define sat_hq_type_node                global_trees[TI_SAT_HQ_TYPE]
395738fd1498Szrj #define sat_sq_type_node                global_trees[TI_SAT_SQ_TYPE]
395838fd1498Szrj #define sat_dq_type_node                global_trees[TI_SAT_DQ_TYPE]
395938fd1498Szrj #define sat_tq_type_node                global_trees[TI_SAT_TQ_TYPE]
396038fd1498Szrj #define sat_uqq_type_node               global_trees[TI_SAT_UQQ_TYPE]
396138fd1498Szrj #define sat_uhq_type_node               global_trees[TI_SAT_UHQ_TYPE]
396238fd1498Szrj #define sat_usq_type_node               global_trees[TI_SAT_USQ_TYPE]
396338fd1498Szrj #define sat_udq_type_node               global_trees[TI_SAT_UDQ_TYPE]
396438fd1498Szrj #define sat_utq_type_node               global_trees[TI_SAT_UTQ_TYPE]
396538fd1498Szrj #define ha_type_node                    global_trees[TI_HA_TYPE]
396638fd1498Szrj #define sa_type_node                    global_trees[TI_SA_TYPE]
396738fd1498Szrj #define da_type_node                    global_trees[TI_DA_TYPE]
396838fd1498Szrj #define ta_type_node                    global_trees[TI_TA_TYPE]
396938fd1498Szrj #define uha_type_node                   global_trees[TI_UHA_TYPE]
397038fd1498Szrj #define usa_type_node                   global_trees[TI_USA_TYPE]
397138fd1498Szrj #define uda_type_node                   global_trees[TI_UDA_TYPE]
397238fd1498Szrj #define uta_type_node                   global_trees[TI_UTA_TYPE]
397338fd1498Szrj #define sat_ha_type_node                global_trees[TI_SAT_HA_TYPE]
397438fd1498Szrj #define sat_sa_type_node                global_trees[TI_SAT_SA_TYPE]
397538fd1498Szrj #define sat_da_type_node                global_trees[TI_SAT_DA_TYPE]
397638fd1498Szrj #define sat_ta_type_node                global_trees[TI_SAT_TA_TYPE]
397738fd1498Szrj #define sat_uha_type_node               global_trees[TI_SAT_UHA_TYPE]
397838fd1498Szrj #define sat_usa_type_node               global_trees[TI_SAT_USA_TYPE]
397938fd1498Szrj #define sat_uda_type_node               global_trees[TI_SAT_UDA_TYPE]
398038fd1498Szrj #define sat_uta_type_node               global_trees[TI_SAT_UTA_TYPE]
398138fd1498Szrj 
398238fd1498Szrj /* The node that should be placed at the end of a parameter list to
398338fd1498Szrj    indicate that the function does not take a variable number of
398438fd1498Szrj    arguments.  The TREE_VALUE will be void_type_node and there will be
398538fd1498Szrj    no TREE_CHAIN.  Language-independent code should not assume
398638fd1498Szrj    anything else about this node.  */
398738fd1498Szrj #define void_list_node                  global_trees[TI_VOID_LIST_NODE]
398838fd1498Szrj 
398938fd1498Szrj #define main_identifier_node		global_trees[TI_MAIN_IDENTIFIER]
399038fd1498Szrj #define MAIN_NAME_P(NODE) \
399138fd1498Szrj   (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node)
399238fd1498Szrj 
399338fd1498Szrj /* Optimization options (OPTIMIZATION_NODE) to use for default and current
399438fd1498Szrj    functions.  */
399538fd1498Szrj #define optimization_default_node	global_trees[TI_OPTIMIZATION_DEFAULT]
399638fd1498Szrj #define optimization_current_node	global_trees[TI_OPTIMIZATION_CURRENT]
399738fd1498Szrj 
399838fd1498Szrj /* Default/current target options (TARGET_OPTION_NODE).  */
399938fd1498Szrj #define target_option_default_node	global_trees[TI_TARGET_OPTION_DEFAULT]
400038fd1498Szrj #define target_option_current_node	global_trees[TI_TARGET_OPTION_CURRENT]
400138fd1498Szrj 
400238fd1498Szrj /* Default tree list option(), optimize() pragmas to be linked into the
400338fd1498Szrj    attribute list.  */
400438fd1498Szrj #define current_target_pragma		global_trees[TI_CURRENT_TARGET_PRAGMA]
400538fd1498Szrj #define current_optimize_pragma		global_trees[TI_CURRENT_OPTIMIZE_PRAGMA]
400638fd1498Szrj 
400738fd1498Szrj #define char_type_node			integer_types[itk_char]
400838fd1498Szrj #define signed_char_type_node		integer_types[itk_signed_char]
400938fd1498Szrj #define unsigned_char_type_node		integer_types[itk_unsigned_char]
401038fd1498Szrj #define short_integer_type_node		integer_types[itk_short]
401138fd1498Szrj #define short_unsigned_type_node	integer_types[itk_unsigned_short]
401238fd1498Szrj #define integer_type_node		integer_types[itk_int]
401338fd1498Szrj #define unsigned_type_node		integer_types[itk_unsigned_int]
401438fd1498Szrj #define long_integer_type_node		integer_types[itk_long]
401538fd1498Szrj #define long_unsigned_type_node		integer_types[itk_unsigned_long]
401638fd1498Szrj #define long_long_integer_type_node	integer_types[itk_long_long]
401738fd1498Szrj #define long_long_unsigned_type_node	integer_types[itk_unsigned_long_long]
401838fd1498Szrj 
401938fd1498Szrj /* True if NODE is an erroneous expression.  */
402038fd1498Szrj 
402138fd1498Szrj #define error_operand_p(NODE)					\
402238fd1498Szrj   ((NODE) == error_mark_node					\
402338fd1498Szrj    || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
402438fd1498Szrj 
402538fd1498Szrj /* Return the number of elements encoded directly in a VECTOR_CST.  */
402638fd1498Szrj 
402738fd1498Szrj inline unsigned int
vector_cst_encoded_nelts(const_tree t)402838fd1498Szrj vector_cst_encoded_nelts (const_tree t)
402938fd1498Szrj {
403038fd1498Szrj   return VECTOR_CST_NPATTERNS (t) * VECTOR_CST_NELTS_PER_PATTERN (t);
403138fd1498Szrj }
403238fd1498Szrj 
403338fd1498Szrj extern tree decl_assembler_name (tree);
403438fd1498Szrj extern void overwrite_decl_assembler_name (tree decl, tree name);
403538fd1498Szrj extern tree decl_comdat_group (const_tree);
403638fd1498Szrj extern tree decl_comdat_group_id (const_tree);
403738fd1498Szrj extern const char *decl_section_name (const_tree);
403838fd1498Szrj extern void set_decl_section_name (tree, const char *);
403938fd1498Szrj extern enum tls_model decl_tls_model (const_tree);
404038fd1498Szrj extern void set_decl_tls_model (tree, enum tls_model);
404138fd1498Szrj 
404238fd1498Szrj /* Compute the number of bytes occupied by 'node'.  This routine only
404338fd1498Szrj    looks at TREE_CODE and, if the code is TREE_VEC, TREE_VEC_LENGTH.  */
404438fd1498Szrj 
404538fd1498Szrj extern size_t tree_size (const_tree);
404638fd1498Szrj 
404738fd1498Szrj /* Compute the number of bytes occupied by a tree with code CODE.
404838fd1498Szrj    This function cannot be used for TREE_VEC or INTEGER_CST nodes,
404938fd1498Szrj    which are of variable length.  */
405038fd1498Szrj extern size_t tree_code_size (enum tree_code);
405138fd1498Szrj 
405238fd1498Szrj /* Allocate and return a new UID from the DECL_UID namespace.  */
405338fd1498Szrj extern int allocate_decl_uid (void);
405438fd1498Szrj 
405538fd1498Szrj /* Lowest level primitive for allocating a node.
405638fd1498Szrj    The TREE_CODE is the only argument.  Contents are initialized
405738fd1498Szrj    to zero except for a few of the common fields.  */
405838fd1498Szrj 
405938fd1498Szrj extern tree make_node (enum tree_code CXX_MEM_STAT_INFO);
406038fd1498Szrj 
406138fd1498Szrj /* Free tree node.  */
406238fd1498Szrj 
406338fd1498Szrj extern void free_node (tree);
406438fd1498Szrj 
406538fd1498Szrj /* Make a copy of a node, with all the same contents.  */
406638fd1498Szrj 
406738fd1498Szrj extern tree copy_node (tree CXX_MEM_STAT_INFO);
406838fd1498Szrj 
406938fd1498Szrj /* Make a copy of a chain of TREE_LIST nodes.  */
407038fd1498Szrj 
407138fd1498Szrj extern tree copy_list (tree);
407238fd1498Szrj 
407338fd1498Szrj /* Make a CASE_LABEL_EXPR.  */
407438fd1498Szrj 
407538fd1498Szrj extern tree build_case_label (tree, tree, tree);
407638fd1498Szrj 
407738fd1498Szrj /* Make a BINFO.  */
407838fd1498Szrj extern tree make_tree_binfo (unsigned CXX_MEM_STAT_INFO);
407938fd1498Szrj 
408038fd1498Szrj /* Make an INTEGER_CST.  */
408138fd1498Szrj 
408238fd1498Szrj extern tree make_int_cst (int, int CXX_MEM_STAT_INFO);
408338fd1498Szrj 
408438fd1498Szrj /* Make a TREE_VEC.  */
408538fd1498Szrj 
408638fd1498Szrj extern tree make_tree_vec (int CXX_MEM_STAT_INFO);
408738fd1498Szrj 
408838fd1498Szrj /* Grow a TREE_VEC.  */
408938fd1498Szrj 
409038fd1498Szrj extern tree grow_tree_vec (tree v, int CXX_MEM_STAT_INFO);
409138fd1498Szrj 
409238fd1498Szrj /* Construct various types of nodes.  */
409338fd1498Szrj 
409438fd1498Szrj extern tree build_nt (enum tree_code, ...);
409538fd1498Szrj extern tree build_nt_call_vec (tree, vec<tree, va_gc> *);
409638fd1498Szrj 
409738fd1498Szrj extern tree build0 (enum tree_code, tree CXX_MEM_STAT_INFO);
409838fd1498Szrj extern tree build1 (enum tree_code, tree, tree CXX_MEM_STAT_INFO);
409938fd1498Szrj extern tree build2 (enum tree_code, tree, tree, tree CXX_MEM_STAT_INFO);
410038fd1498Szrj extern tree build3 (enum tree_code, tree, tree, tree, tree CXX_MEM_STAT_INFO);
410138fd1498Szrj extern tree build4 (enum tree_code, tree, tree, tree, tree,
410238fd1498Szrj 		    tree CXX_MEM_STAT_INFO);
410338fd1498Szrj extern tree build5 (enum tree_code, tree, tree, tree, tree, tree,
410438fd1498Szrj 		    tree CXX_MEM_STAT_INFO);
410538fd1498Szrj 
410638fd1498Szrj /* _loc versions of build[1-5].  */
410738fd1498Szrj 
410838fd1498Szrj static inline tree
build1_loc(location_t loc,enum tree_code code,tree type,tree arg1 CXX_MEM_STAT_INFO)410938fd1498Szrj build1_loc (location_t loc, enum tree_code code, tree type,
411038fd1498Szrj 	    tree arg1 CXX_MEM_STAT_INFO)
411138fd1498Szrj {
411238fd1498Szrj   tree t = build1 (code, type, arg1 PASS_MEM_STAT);
411338fd1498Szrj   if (CAN_HAVE_LOCATION_P (t))
411438fd1498Szrj     SET_EXPR_LOCATION (t, loc);
411538fd1498Szrj   return t;
411638fd1498Szrj }
411738fd1498Szrj 
411838fd1498Szrj static inline tree
build2_loc(location_t loc,enum tree_code code,tree type,tree arg0,tree arg1 CXX_MEM_STAT_INFO)411938fd1498Szrj build2_loc (location_t loc, enum tree_code code, tree type, tree arg0,
412038fd1498Szrj 	    tree arg1 CXX_MEM_STAT_INFO)
412138fd1498Szrj {
412238fd1498Szrj   tree t = build2 (code, type, arg0, arg1 PASS_MEM_STAT);
412338fd1498Szrj   if (CAN_HAVE_LOCATION_P (t))
412438fd1498Szrj     SET_EXPR_LOCATION (t, loc);
412538fd1498Szrj   return t;
412638fd1498Szrj }
412738fd1498Szrj 
412838fd1498Szrj static inline tree
build3_loc(location_t loc,enum tree_code code,tree type,tree arg0,tree arg1,tree arg2 CXX_MEM_STAT_INFO)412938fd1498Szrj build3_loc (location_t loc, enum tree_code code, tree type, tree arg0,
413038fd1498Szrj 	    tree arg1, tree arg2 CXX_MEM_STAT_INFO)
413138fd1498Szrj {
413238fd1498Szrj   tree t = build3 (code, type, arg0, arg1, arg2 PASS_MEM_STAT);
413338fd1498Szrj   if (CAN_HAVE_LOCATION_P (t))
413438fd1498Szrj     SET_EXPR_LOCATION (t, loc);
413538fd1498Szrj   return t;
413638fd1498Szrj }
413738fd1498Szrj 
413838fd1498Szrj static inline tree
build4_loc(location_t loc,enum tree_code code,tree type,tree arg0,tree arg1,tree arg2,tree arg3 CXX_MEM_STAT_INFO)413938fd1498Szrj build4_loc (location_t loc, enum tree_code code, tree type, tree arg0,
414038fd1498Szrj 	    tree arg1, tree arg2, tree arg3 CXX_MEM_STAT_INFO)
414138fd1498Szrj {
414238fd1498Szrj   tree t = build4 (code, type, arg0, arg1, arg2, arg3 PASS_MEM_STAT);
414338fd1498Szrj   if (CAN_HAVE_LOCATION_P (t))
414438fd1498Szrj     SET_EXPR_LOCATION (t, loc);
414538fd1498Szrj   return t;
414638fd1498Szrj }
414738fd1498Szrj 
414838fd1498Szrj static inline tree
build5_loc(location_t loc,enum tree_code code,tree type,tree arg0,tree arg1,tree arg2,tree arg3,tree arg4 CXX_MEM_STAT_INFO)414938fd1498Szrj build5_loc (location_t loc, enum tree_code code, tree type, tree arg0,
415038fd1498Szrj 	    tree arg1, tree arg2, tree arg3, tree arg4 CXX_MEM_STAT_INFO)
415138fd1498Szrj {
415238fd1498Szrj   tree t = build5 (code, type, arg0, arg1, arg2, arg3,
415338fd1498Szrj 			arg4 PASS_MEM_STAT);
415438fd1498Szrj   if (CAN_HAVE_LOCATION_P (t))
415538fd1498Szrj     SET_EXPR_LOCATION (t, loc);
415638fd1498Szrj   return t;
415738fd1498Szrj }
415838fd1498Szrj 
415938fd1498Szrj /* Constructs double_int from tree CST.  */
416038fd1498Szrj 
416138fd1498Szrj extern tree double_int_to_tree (tree, double_int);
416238fd1498Szrj 
416338fd1498Szrj extern tree wide_int_to_tree (tree type, const poly_wide_int_ref &cst);
416438fd1498Szrj extern tree force_fit_type (tree, const poly_wide_int_ref &, int, bool);
416538fd1498Szrj 
416638fd1498Szrj /* Create an INT_CST node with a CST value zero extended.  */
416738fd1498Szrj 
416838fd1498Szrj /* static inline */
416938fd1498Szrj extern tree build_int_cst (tree, poly_int64);
417038fd1498Szrj extern tree build_int_cstu (tree type, poly_uint64);
417138fd1498Szrj extern tree build_int_cst_type (tree, poly_int64);
417238fd1498Szrj extern tree make_vector (unsigned, unsigned CXX_MEM_STAT_INFO);
417338fd1498Szrj extern tree build_vector_from_ctor (tree, vec<constructor_elt, va_gc> *);
417438fd1498Szrj extern tree build_vector_from_val (tree, tree);
417538fd1498Szrj extern tree build_vec_series (tree, tree, tree);
417638fd1498Szrj extern tree build_index_vector (tree, poly_uint64, poly_uint64);
417738fd1498Szrj extern void recompute_constructor_flags (tree);
417838fd1498Szrj extern void verify_constructor_flags (tree);
417938fd1498Szrj extern tree build_constructor (tree, vec<constructor_elt, va_gc> *);
418038fd1498Szrj extern tree build_constructor_single (tree, tree, tree);
418138fd1498Szrj extern tree build_constructor_from_list (tree, tree);
418238fd1498Szrj extern tree build_constructor_va (tree, int, ...);
418338fd1498Szrj extern tree build_real_from_int_cst (tree, const_tree);
418438fd1498Szrj extern tree build_complex (tree, tree, tree);
418538fd1498Szrj extern tree build_complex_inf (tree, bool);
418638fd1498Szrj extern tree build_each_one_cst (tree);
418738fd1498Szrj extern tree build_one_cst (tree);
418838fd1498Szrj extern tree build_minus_one_cst (tree);
418938fd1498Szrj extern tree build_all_ones_cst (tree);
419038fd1498Szrj extern tree build_zero_cst (tree);
419138fd1498Szrj extern tree build_string (int, const char *);
419238fd1498Szrj extern tree build_poly_int_cst (tree, const poly_wide_int_ref &);
419338fd1498Szrj extern tree build_tree_list (tree, tree CXX_MEM_STAT_INFO);
419438fd1498Szrj extern tree build_tree_list_vec (const vec<tree, va_gc> * CXX_MEM_STAT_INFO);
419538fd1498Szrj extern tree build_decl (location_t, enum tree_code,
419638fd1498Szrj 			tree, tree CXX_MEM_STAT_INFO);
419738fd1498Szrj extern tree build_fn_decl (const char *, tree);
419838fd1498Szrj extern tree build_translation_unit_decl (tree);
419938fd1498Szrj extern tree build_block (tree, tree, tree, tree);
420038fd1498Szrj extern tree build_empty_stmt (location_t);
420138fd1498Szrj extern tree build_omp_clause (location_t, enum omp_clause_code);
420238fd1498Szrj 
420338fd1498Szrj extern tree build_vl_exp (enum tree_code, int CXX_MEM_STAT_INFO);
420438fd1498Szrj 
420538fd1498Szrj extern tree build_call_nary (tree, tree, int, ...);
420638fd1498Szrj extern tree build_call_valist (tree, tree, int, va_list);
420738fd1498Szrj #define build_call_array(T1,T2,N,T3)\
420838fd1498Szrj    build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T3)
420938fd1498Szrj extern tree build_call_array_loc (location_t, tree, tree, int, const tree *);
421038fd1498Szrj extern tree build_call_vec (tree, tree, vec<tree, va_gc> *);
421138fd1498Szrj extern tree build_call_expr_loc_array (location_t, tree, int, tree *);
421238fd1498Szrj extern tree build_call_expr_loc_vec (location_t, tree, vec<tree, va_gc> *);
421338fd1498Szrj extern tree build_call_expr_loc (location_t, tree, int, ...);
421438fd1498Szrj extern tree build_call_expr (tree, int, ...);
421538fd1498Szrj extern tree build_call_expr_internal_loc (location_t, enum internal_fn,
421638fd1498Szrj 					  tree, int, ...);
421738fd1498Szrj extern tree build_call_expr_internal_loc_array (location_t, enum internal_fn,
421838fd1498Szrj 						tree, int, const tree *);
421938fd1498Szrj extern tree maybe_build_call_expr_loc (location_t, combined_fn, tree,
422038fd1498Szrj 				       int, ...);
422138fd1498Szrj extern tree build_alloca_call_expr (tree, unsigned int, HOST_WIDE_INT);
422238fd1498Szrj extern tree build_string_literal (int, const char *);
422338fd1498Szrj 
422438fd1498Szrj /* Construct various nodes representing data types.  */
422538fd1498Szrj 
422638fd1498Szrj extern tree signed_or_unsigned_type_for (int, tree);
422738fd1498Szrj extern tree signed_type_for (tree);
422838fd1498Szrj extern tree unsigned_type_for (tree);
422938fd1498Szrj extern tree truth_type_for (tree);
423038fd1498Szrj extern tree build_pointer_type_for_mode (tree, machine_mode, bool);
423138fd1498Szrj extern tree build_pointer_type (tree);
423238fd1498Szrj extern tree build_reference_type_for_mode (tree, machine_mode, bool);
423338fd1498Szrj extern tree build_reference_type (tree);
423438fd1498Szrj extern tree build_vector_type_for_mode (tree, machine_mode);
423538fd1498Szrj extern tree build_vector_type (tree, poly_int64);
423638fd1498Szrj extern tree build_truth_vector_type (poly_uint64, poly_uint64);
423738fd1498Szrj extern tree build_same_sized_truth_vector_type (tree vectype);
423838fd1498Szrj extern tree build_opaque_vector_type (tree, poly_int64);
423938fd1498Szrj extern tree build_index_type (tree);
424038fd1498Szrj extern tree build_array_type (tree, tree, bool = false);
424138fd1498Szrj extern tree build_nonshared_array_type (tree, tree);
424238fd1498Szrj extern tree build_array_type_nelts (tree, poly_uint64);
424338fd1498Szrj extern tree build_function_type (tree, tree);
424438fd1498Szrj extern tree build_function_type_list (tree, ...);
424538fd1498Szrj extern tree build_varargs_function_type_list (tree, ...);
424638fd1498Szrj extern tree build_function_type_array (tree, int, tree *);
424738fd1498Szrj extern tree build_varargs_function_type_array (tree, int, tree *);
424838fd1498Szrj #define build_function_type_vec(RET, V) \
424938fd1498Szrj   build_function_type_array (RET, vec_safe_length (V), vec_safe_address (V))
425038fd1498Szrj #define build_varargs_function_type_vec(RET, V) \
425138fd1498Szrj   build_varargs_function_type_array (RET, vec_safe_length (V), \
425238fd1498Szrj 				     vec_safe_address (V))
425338fd1498Szrj extern tree build_method_type_directly (tree, tree, tree);
425438fd1498Szrj extern tree build_method_type (tree, tree);
425538fd1498Szrj extern tree build_offset_type (tree, tree);
425638fd1498Szrj extern tree build_complex_type (tree, bool named = false);
425738fd1498Szrj extern tree array_type_nelts (const_tree);
425838fd1498Szrj 
425938fd1498Szrj extern tree value_member (tree, tree);
426038fd1498Szrj extern tree purpose_member (const_tree, tree);
426138fd1498Szrj extern bool vec_member (const_tree, vec<tree, va_gc> *);
426238fd1498Szrj extern tree chain_index (int, tree);
426338fd1498Szrj 
426438fd1498Szrj extern int tree_int_cst_equal (const_tree, const_tree);
426538fd1498Szrj 
426638fd1498Szrj extern bool tree_fits_shwi_p (const_tree) ATTRIBUTE_PURE;
426738fd1498Szrj extern bool tree_fits_poly_int64_p (const_tree) ATTRIBUTE_PURE;
426838fd1498Szrj extern bool tree_fits_uhwi_p (const_tree) ATTRIBUTE_PURE;
426938fd1498Szrj extern bool tree_fits_poly_uint64_p (const_tree) ATTRIBUTE_PURE;
427038fd1498Szrj extern HOST_WIDE_INT tree_to_shwi (const_tree);
427138fd1498Szrj extern poly_int64 tree_to_poly_int64 (const_tree);
427238fd1498Szrj extern unsigned HOST_WIDE_INT tree_to_uhwi (const_tree);
427338fd1498Szrj extern poly_uint64 tree_to_poly_uint64 (const_tree);
427438fd1498Szrj #if !defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 4003)
427538fd1498Szrj extern inline __attribute__ ((__gnu_inline__)) HOST_WIDE_INT
tree_to_shwi(const_tree t)427638fd1498Szrj tree_to_shwi (const_tree t)
427738fd1498Szrj {
427838fd1498Szrj   gcc_assert (tree_fits_shwi_p (t));
427938fd1498Szrj   return TREE_INT_CST_LOW (t);
428038fd1498Szrj }
428138fd1498Szrj 
428238fd1498Szrj extern inline __attribute__ ((__gnu_inline__)) unsigned HOST_WIDE_INT
tree_to_uhwi(const_tree t)428338fd1498Szrj tree_to_uhwi (const_tree t)
428438fd1498Szrj {
428538fd1498Szrj   gcc_assert (tree_fits_uhwi_p (t));
428638fd1498Szrj   return TREE_INT_CST_LOW (t);
428738fd1498Szrj }
428838fd1498Szrj #if NUM_POLY_INT_COEFFS == 1
428938fd1498Szrj extern inline __attribute__ ((__gnu_inline__)) poly_int64
tree_to_poly_int64(const_tree t)429038fd1498Szrj tree_to_poly_int64 (const_tree t)
429138fd1498Szrj {
429238fd1498Szrj   gcc_assert (tree_fits_poly_int64_p (t));
429338fd1498Szrj   return TREE_INT_CST_LOW (t);
429438fd1498Szrj }
429538fd1498Szrj 
429638fd1498Szrj extern inline __attribute__ ((__gnu_inline__)) poly_uint64
tree_to_poly_uint64(const_tree t)429738fd1498Szrj tree_to_poly_uint64 (const_tree t)
429838fd1498Szrj {
429938fd1498Szrj   gcc_assert (tree_fits_poly_uint64_p (t));
430038fd1498Szrj   return TREE_INT_CST_LOW (t);
430138fd1498Szrj }
430238fd1498Szrj #endif
430338fd1498Szrj #endif
430438fd1498Szrj extern int tree_int_cst_sgn (const_tree);
430538fd1498Szrj extern int tree_int_cst_sign_bit (const_tree);
430638fd1498Szrj extern unsigned int tree_int_cst_min_precision (tree, signop);
430738fd1498Szrj extern tree strip_array_types (tree);
430838fd1498Szrj extern tree excess_precision_type (tree);
430938fd1498Szrj extern bool valid_constant_size_p (const_tree);
431038fd1498Szrj 
431138fd1498Szrj /* Return true if T holds a value that can be represented as a poly_int64
431238fd1498Szrj    without loss of precision.  Store the value in *VALUE if so.  */
431338fd1498Szrj 
431438fd1498Szrj inline bool
poly_int_tree_p(const_tree t,poly_int64_pod * value)431538fd1498Szrj poly_int_tree_p (const_tree t, poly_int64_pod *value)
431638fd1498Szrj {
431738fd1498Szrj   if (tree_fits_poly_int64_p (t))
431838fd1498Szrj     {
431938fd1498Szrj       *value = tree_to_poly_int64 (t);
432038fd1498Szrj       return true;
432138fd1498Szrj     }
432238fd1498Szrj   return false;
432338fd1498Szrj }
432438fd1498Szrj 
432538fd1498Szrj /* Return true if T holds a value that can be represented as a poly_uint64
432638fd1498Szrj    without loss of precision.  Store the value in *VALUE if so.  */
432738fd1498Szrj 
432838fd1498Szrj inline bool
poly_int_tree_p(const_tree t,poly_uint64_pod * value)432938fd1498Szrj poly_int_tree_p (const_tree t, poly_uint64_pod *value)
433038fd1498Szrj {
433138fd1498Szrj   if (tree_fits_poly_uint64_p (t))
433238fd1498Szrj     {
433338fd1498Szrj       *value = tree_to_poly_uint64 (t);
433438fd1498Szrj       return true;
433538fd1498Szrj     }
433638fd1498Szrj   return false;
433738fd1498Szrj }
433838fd1498Szrj 
433938fd1498Szrj /* From expmed.c.  Since rtl.h is included after tree.h, we can't
434038fd1498Szrj    put the prototype here.  Rtl.h does declare the prototype if
434138fd1498Szrj    tree.h had been included.  */
434238fd1498Szrj 
434338fd1498Szrj extern tree make_tree (tree, rtx);
434438fd1498Szrj 
434538fd1498Szrj /* Returns true iff CAND and BASE have equivalent language-specific
434638fd1498Szrj    qualifiers.  */
434738fd1498Szrj 
434838fd1498Szrj extern bool check_lang_type (const_tree cand, const_tree base);
434938fd1498Szrj 
435038fd1498Szrj /* Returns true iff unqualified CAND and BASE are equivalent.  */
435138fd1498Szrj 
435238fd1498Szrj extern bool check_base_type (const_tree cand, const_tree base);
435338fd1498Szrj 
435438fd1498Szrj /* Check whether CAND is suitable to be returned from get_qualified_type
435538fd1498Szrj    (BASE, TYPE_QUALS).  */
435638fd1498Szrj 
435738fd1498Szrj extern bool check_qualified_type (const_tree, const_tree, int);
435838fd1498Szrj 
435938fd1498Szrj /* Return a version of the TYPE, qualified as indicated by the
436038fd1498Szrj    TYPE_QUALS, if one exists.  If no qualified version exists yet,
436138fd1498Szrj    return NULL_TREE.  */
436238fd1498Szrj 
436338fd1498Szrj extern tree get_qualified_type (tree, int);
436438fd1498Szrj 
436538fd1498Szrj /* Like get_qualified_type, but creates the type if it does not
436638fd1498Szrj    exist.  This function never returns NULL_TREE.  */
436738fd1498Szrj 
436838fd1498Szrj extern tree build_qualified_type (tree, int CXX_MEM_STAT_INFO);
436938fd1498Szrj 
437038fd1498Szrj /* Create a variant of type T with alignment ALIGN.  */
437138fd1498Szrj 
437238fd1498Szrj extern tree build_aligned_type (tree, unsigned int);
437338fd1498Szrj 
437438fd1498Szrj /* Like build_qualified_type, but only deals with the `const' and
437538fd1498Szrj    `volatile' qualifiers.  This interface is retained for backwards
437638fd1498Szrj    compatibility with the various front-ends; new code should use
437738fd1498Szrj    build_qualified_type instead.  */
437838fd1498Szrj 
437938fd1498Szrj #define build_type_variant(TYPE, CONST_P, VOLATILE_P)			\
438038fd1498Szrj   build_qualified_type ((TYPE),						\
438138fd1498Szrj 			((CONST_P) ? TYPE_QUAL_CONST : 0)		\
438238fd1498Szrj 			| ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
438338fd1498Szrj 
438438fd1498Szrj /* Make a copy of a type node.  */
438538fd1498Szrj 
438638fd1498Szrj extern tree build_distinct_type_copy (tree CXX_MEM_STAT_INFO);
438738fd1498Szrj extern tree build_variant_type_copy (tree CXX_MEM_STAT_INFO);
438838fd1498Szrj 
438938fd1498Szrj /* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
439038fd1498Szrj    return a canonicalized ..._TYPE node, so that duplicates are not made.
439138fd1498Szrj    How the hash code is computed is up to the caller, as long as any two
439238fd1498Szrj    callers that could hash identical-looking type nodes agree.  */
439338fd1498Szrj 
439438fd1498Szrj extern hashval_t type_hash_canon_hash (tree);
439538fd1498Szrj extern tree type_hash_canon (unsigned int, tree);
439638fd1498Szrj 
439738fd1498Szrj extern tree convert (tree, tree);
439838fd1498Szrj extern unsigned int expr_align (const_tree);
439938fd1498Szrj extern tree size_in_bytes_loc (location_t, const_tree);
440038fd1498Szrj inline tree
size_in_bytes(const_tree t)440138fd1498Szrj size_in_bytes (const_tree t)
440238fd1498Szrj {
440338fd1498Szrj   return size_in_bytes_loc (input_location, t);
440438fd1498Szrj }
440538fd1498Szrj 
440638fd1498Szrj extern HOST_WIDE_INT int_size_in_bytes (const_tree);
440738fd1498Szrj extern HOST_WIDE_INT max_int_size_in_bytes (const_tree);
440838fd1498Szrj extern tree bit_position (const_tree);
440938fd1498Szrj extern tree byte_position (const_tree);
441038fd1498Szrj extern HOST_WIDE_INT int_byte_position (const_tree);
441138fd1498Szrj 
441238fd1498Szrj /* Type for sizes of data-type.  */
441338fd1498Szrj 
441438fd1498Szrj #define sizetype sizetype_tab[(int) stk_sizetype]
441538fd1498Szrj #define bitsizetype sizetype_tab[(int) stk_bitsizetype]
441638fd1498Szrj #define ssizetype sizetype_tab[(int) stk_ssizetype]
441738fd1498Szrj #define sbitsizetype sizetype_tab[(int) stk_sbitsizetype]
441838fd1498Szrj #define size_int(L) size_int_kind (L, stk_sizetype)
441938fd1498Szrj #define ssize_int(L) size_int_kind (L, stk_ssizetype)
442038fd1498Szrj #define bitsize_int(L) size_int_kind (L, stk_bitsizetype)
442138fd1498Szrj #define sbitsize_int(L) size_int_kind (L, stk_sbitsizetype)
442238fd1498Szrj 
442338fd1498Szrj /* Log2 of BITS_PER_UNIT.  */
442438fd1498Szrj 
442538fd1498Szrj #if BITS_PER_UNIT == 8
442638fd1498Szrj #define LOG2_BITS_PER_UNIT 3
442738fd1498Szrj #elif BITS_PER_UNIT == 16
442838fd1498Szrj #define LOG2_BITS_PER_UNIT 4
442938fd1498Szrj #else
443038fd1498Szrj #error Unknown BITS_PER_UNIT
443138fd1498Szrj #endif
443238fd1498Szrj 
443338fd1498Szrj /* Concatenate two lists (chains of TREE_LIST nodes) X and Y
443438fd1498Szrj    by making the last node in X point to Y.
443538fd1498Szrj    Returns X, except if X is 0 returns Y.  */
443638fd1498Szrj 
443738fd1498Szrj extern tree chainon (tree, tree);
443838fd1498Szrj 
443938fd1498Szrj /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN.  */
444038fd1498Szrj 
444138fd1498Szrj extern tree tree_cons (tree, tree, tree CXX_MEM_STAT_INFO);
444238fd1498Szrj 
444338fd1498Szrj /* Return the last tree node in a chain.  */
444438fd1498Szrj 
444538fd1498Szrj extern tree tree_last (tree);
444638fd1498Szrj 
444738fd1498Szrj /* Reverse the order of elements in a chain, and return the new head.  */
444838fd1498Szrj 
444938fd1498Szrj extern tree nreverse (tree);
445038fd1498Szrj 
445138fd1498Szrj /* Returns the length of a chain of nodes
445238fd1498Szrj    (number of chain pointers to follow before reaching a null pointer).  */
445338fd1498Szrj 
445438fd1498Szrj extern int list_length (const_tree);
445538fd1498Szrj 
445638fd1498Szrj /* Returns the first FIELD_DECL in a type.  */
445738fd1498Szrj 
445838fd1498Szrj extern tree first_field (const_tree);
445938fd1498Szrj 
446038fd1498Szrj /* Given an initializer INIT, return TRUE if INIT is zero or some
446138fd1498Szrj    aggregate of zeros.  Otherwise return FALSE.  */
446238fd1498Szrj 
446338fd1498Szrj extern bool initializer_zerop (const_tree);
446438fd1498Szrj 
446538fd1498Szrj extern wide_int vector_cst_int_elt (const_tree, unsigned int);
446638fd1498Szrj extern tree vector_cst_elt (const_tree, unsigned int);
446738fd1498Szrj 
446838fd1498Szrj /* Given a vector VEC, return its first element if all elements are
446938fd1498Szrj    the same.  Otherwise return NULL_TREE.  */
447038fd1498Szrj 
447138fd1498Szrj extern tree uniform_vector_p (const_tree);
447238fd1498Szrj 
447338fd1498Szrj /* Given a CONSTRUCTOR CTOR, return the element values as a vector.  */
447438fd1498Szrj 
447538fd1498Szrj extern vec<tree, va_gc> *ctor_to_vec (tree);
447638fd1498Szrj 
447738fd1498Szrj /* zerop (tree x) is nonzero if X is a constant of value 0.  */
447838fd1498Szrj 
447938fd1498Szrj extern int zerop (const_tree);
448038fd1498Szrj 
448138fd1498Szrj /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0.  */
448238fd1498Szrj 
448338fd1498Szrj extern int integer_zerop (const_tree);
448438fd1498Szrj 
448538fd1498Szrj /* integer_onep (tree x) is nonzero if X is an integer constant of value 1.  */
448638fd1498Szrj 
448738fd1498Szrj extern int integer_onep (const_tree);
448838fd1498Szrj 
448938fd1498Szrj /* integer_onep (tree x) is nonzero if X is an integer constant of value 1, or
449038fd1498Szrj    a vector or complex where each part is 1.  */
449138fd1498Szrj 
449238fd1498Szrj extern int integer_each_onep (const_tree);
449338fd1498Szrj 
449438fd1498Szrj /* integer_all_onesp (tree x) is nonzero if X is an integer constant
449538fd1498Szrj    all of whose significant bits are 1.  */
449638fd1498Szrj 
449738fd1498Szrj extern int integer_all_onesp (const_tree);
449838fd1498Szrj 
449938fd1498Szrj /* integer_minus_onep (tree x) is nonzero if X is an integer constant of
450038fd1498Szrj    value -1.  */
450138fd1498Szrj 
450238fd1498Szrj extern int integer_minus_onep (const_tree);
450338fd1498Szrj 
450438fd1498Szrj /* integer_pow2p (tree x) is nonzero is X is an integer constant with
450538fd1498Szrj    exactly one bit 1.  */
450638fd1498Szrj 
450738fd1498Szrj extern int integer_pow2p (const_tree);
450838fd1498Szrj 
450938fd1498Szrj /* integer_nonzerop (tree x) is nonzero if X is an integer constant
451038fd1498Szrj    with a nonzero value.  */
451138fd1498Szrj 
451238fd1498Szrj extern int integer_nonzerop (const_tree);
451338fd1498Szrj 
451438fd1498Szrj /* integer_truep (tree x) is nonzero if X is an integer constant of value 1 or
451538fd1498Szrj    a vector where each element is an integer constant of value -1.  */
451638fd1498Szrj 
451738fd1498Szrj extern int integer_truep (const_tree);
451838fd1498Szrj 
451938fd1498Szrj extern bool cst_and_fits_in_hwi (const_tree);
452038fd1498Szrj extern tree num_ending_zeros (const_tree);
452138fd1498Szrj 
452238fd1498Szrj /* fixed_zerop (tree x) is nonzero if X is a fixed-point constant of
452338fd1498Szrj    value 0.  */
452438fd1498Szrj 
452538fd1498Szrj extern int fixed_zerop (const_tree);
452638fd1498Szrj 
452738fd1498Szrj /* staticp (tree x) is nonzero if X is a reference to data allocated
452838fd1498Szrj    at a fixed address in memory.  Returns the outermost data.  */
452938fd1498Szrj 
453038fd1498Szrj extern tree staticp (tree);
453138fd1498Szrj 
453238fd1498Szrj /* save_expr (EXP) returns an expression equivalent to EXP
453338fd1498Szrj    but it can be used multiple times within context CTX
453438fd1498Szrj    and only evaluate EXP once.  */
453538fd1498Szrj 
453638fd1498Szrj extern tree save_expr (tree);
453738fd1498Szrj 
453838fd1498Szrj /* Return true if T is function-invariant.  */
453938fd1498Szrj 
454038fd1498Szrj extern bool tree_invariant_p (tree);
454138fd1498Szrj 
454238fd1498Szrj /* Look inside EXPR into any simple arithmetic operations.  Return the
454338fd1498Szrj    outermost non-arithmetic or non-invariant node.  */
454438fd1498Szrj 
454538fd1498Szrj extern tree skip_simple_arithmetic (tree);
454638fd1498Szrj 
454738fd1498Szrj /* Look inside EXPR into simple arithmetic operations involving constants.
454838fd1498Szrj    Return the outermost non-arithmetic or non-constant node.  */
454938fd1498Szrj 
455038fd1498Szrj extern tree skip_simple_constant_arithmetic (tree);
455138fd1498Szrj 
455238fd1498Szrj /* Return which tree structure is used by T.  */
455338fd1498Szrj 
455438fd1498Szrj enum tree_node_structure_enum tree_node_structure (const_tree);
455538fd1498Szrj 
455638fd1498Szrj /* Return true if EXP contains a PLACEHOLDER_EXPR, i.e. if it represents a
455738fd1498Szrj    size or offset that depends on a field within a record.  */
455838fd1498Szrj 
455938fd1498Szrj extern bool contains_placeholder_p (const_tree);
456038fd1498Szrj 
456138fd1498Szrj /* This macro calls the above function but short-circuits the common
456238fd1498Szrj    case of a constant to save time.  Also check for null.  */
456338fd1498Szrj 
456438fd1498Szrj #define CONTAINS_PLACEHOLDER_P(EXP) \
456538fd1498Szrj   ((EXP) != 0 && ! TREE_CONSTANT (EXP) && contains_placeholder_p (EXP))
456638fd1498Szrj 
456738fd1498Szrj /* Return true if any part of the structure of TYPE involves a PLACEHOLDER_EXPR
456838fd1498Szrj    directly.  This includes size, bounds, qualifiers (for QUAL_UNION_TYPE) and
456938fd1498Szrj    field positions.  */
457038fd1498Szrj 
457138fd1498Szrj extern bool type_contains_placeholder_p (tree);
457238fd1498Szrj 
457338fd1498Szrj /* Given a tree EXP, find all occurrences of references to fields
457438fd1498Szrj    in a PLACEHOLDER_EXPR and place them in vector REFS without
457538fd1498Szrj    duplicates.  Also record VAR_DECLs and CONST_DECLs.  Note that
457638fd1498Szrj    we assume here that EXP contains only arithmetic expressions
457738fd1498Szrj    or CALL_EXPRs with PLACEHOLDER_EXPRs occurring only in their
457838fd1498Szrj    argument list.  */
457938fd1498Szrj 
458038fd1498Szrj extern void find_placeholder_in_expr (tree, vec<tree> *);
458138fd1498Szrj 
458238fd1498Szrj /* This macro calls the above function but short-circuits the common
458338fd1498Szrj    case of a constant to save time and also checks for NULL.  */
458438fd1498Szrj 
458538fd1498Szrj #define FIND_PLACEHOLDER_IN_EXPR(EXP, V) \
458638fd1498Szrj do {					 \
458738fd1498Szrj   if((EXP) && !TREE_CONSTANT (EXP))	 \
458838fd1498Szrj     find_placeholder_in_expr (EXP, V);	 \
458938fd1498Szrj } while (0)
459038fd1498Szrj 
459138fd1498Szrj /* Given a tree EXP, a FIELD_DECL F, and a replacement value R,
459238fd1498Szrj    return a tree with all occurrences of references to F in a
459338fd1498Szrj    PLACEHOLDER_EXPR replaced by R.  Also handle VAR_DECLs and
459438fd1498Szrj    CONST_DECLs.  Note that we assume here that EXP contains only
459538fd1498Szrj    arithmetic expressions or CALL_EXPRs with PLACEHOLDER_EXPRs
459638fd1498Szrj    occurring only in their argument list.  */
459738fd1498Szrj 
459838fd1498Szrj extern tree substitute_in_expr (tree, tree, tree);
459938fd1498Szrj 
460038fd1498Szrj /* This macro calls the above function but short-circuits the common
460138fd1498Szrj    case of a constant to save time and also checks for NULL.  */
460238fd1498Szrj 
460338fd1498Szrj #define SUBSTITUTE_IN_EXPR(EXP, F, R) \
460438fd1498Szrj   ((EXP) == 0 || TREE_CONSTANT (EXP) ? (EXP) : substitute_in_expr (EXP, F, R))
460538fd1498Szrj 
460638fd1498Szrj /* Similar, but look for a PLACEHOLDER_EXPR in EXP and find a replacement
460738fd1498Szrj    for it within OBJ, a tree that is an object or a chain of references.  */
460838fd1498Szrj 
460938fd1498Szrj extern tree substitute_placeholder_in_expr (tree, tree);
461038fd1498Szrj 
461138fd1498Szrj /* This macro calls the above function but short-circuits the common
461238fd1498Szrj    case of a constant to save time and also checks for NULL.  */
461338fd1498Szrj 
461438fd1498Szrj #define SUBSTITUTE_PLACEHOLDER_IN_EXPR(EXP, OBJ) \
461538fd1498Szrj   ((EXP) == 0 || TREE_CONSTANT (EXP) ? (EXP)	\
461638fd1498Szrj    : substitute_placeholder_in_expr (EXP, OBJ))
461738fd1498Szrj 
461838fd1498Szrj 
461938fd1498Szrj /* stabilize_reference (EXP) returns a reference equivalent to EXP
462038fd1498Szrj    but it can be used multiple times
462138fd1498Szrj    and only evaluate the subexpressions once.  */
462238fd1498Szrj 
462338fd1498Szrj extern tree stabilize_reference (tree);
462438fd1498Szrj 
462538fd1498Szrj /* Return EXP, stripped of any conversions to wider types
462638fd1498Szrj    in such a way that the result of converting to type FOR_TYPE
462738fd1498Szrj    is the same as if EXP were converted to FOR_TYPE.
462838fd1498Szrj    If FOR_TYPE is 0, it signifies EXP's type.  */
462938fd1498Szrj 
463038fd1498Szrj extern tree get_unwidened (tree, tree);
463138fd1498Szrj 
463238fd1498Szrj /* Return OP or a simpler expression for a narrower value
463338fd1498Szrj    which can be sign-extended or zero-extended to give back OP.
463438fd1498Szrj    Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
463538fd1498Szrj    or 0 if the value should be sign-extended.  */
463638fd1498Szrj 
463738fd1498Szrj extern tree get_narrower (tree, int *);
463838fd1498Szrj 
463938fd1498Szrj /* Return true if T is an expression that get_inner_reference handles.  */
464038fd1498Szrj 
464138fd1498Szrj static inline bool
handled_component_p(const_tree t)464238fd1498Szrj handled_component_p (const_tree t)
464338fd1498Szrj {
464438fd1498Szrj   switch (TREE_CODE (t))
464538fd1498Szrj     {
464638fd1498Szrj     case COMPONENT_REF:
464738fd1498Szrj     case BIT_FIELD_REF:
464838fd1498Szrj     case ARRAY_REF:
464938fd1498Szrj     case ARRAY_RANGE_REF:
465038fd1498Szrj     case REALPART_EXPR:
465138fd1498Szrj     case IMAGPART_EXPR:
465238fd1498Szrj     case VIEW_CONVERT_EXPR:
465338fd1498Szrj       return true;
465438fd1498Szrj 
465538fd1498Szrj     default:
465638fd1498Szrj       return false;
465738fd1498Szrj     }
465838fd1498Szrj }
465938fd1498Szrj 
466038fd1498Szrj /* Return true T is a component with reverse storage order.  */
466138fd1498Szrj 
466238fd1498Szrj static inline bool
reverse_storage_order_for_component_p(tree t)466338fd1498Szrj reverse_storage_order_for_component_p (tree t)
466438fd1498Szrj {
466538fd1498Szrj   /* The storage order only applies to scalar components.  */
466638fd1498Szrj   if (AGGREGATE_TYPE_P (TREE_TYPE (t)) || VECTOR_TYPE_P (TREE_TYPE (t)))
466738fd1498Szrj     return false;
466838fd1498Szrj 
466938fd1498Szrj   if (TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR)
467038fd1498Szrj     t = TREE_OPERAND (t, 0);
467138fd1498Szrj 
467238fd1498Szrj   switch (TREE_CODE (t))
467338fd1498Szrj     {
467438fd1498Szrj     case ARRAY_REF:
467538fd1498Szrj     case COMPONENT_REF:
467638fd1498Szrj       /* ??? Fortran can take COMPONENT_REF of a VOID_TYPE.  */
467738fd1498Szrj       /* ??? UBSan can take COMPONENT_REF of a REFERENCE_TYPE.  */
467838fd1498Szrj       return AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0)))
467938fd1498Szrj 	     && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (TREE_OPERAND (t, 0)));
468038fd1498Szrj 
468138fd1498Szrj     case BIT_FIELD_REF:
468238fd1498Szrj     case MEM_REF:
468338fd1498Szrj       return REF_REVERSE_STORAGE_ORDER (t);
468438fd1498Szrj 
468538fd1498Szrj     case ARRAY_RANGE_REF:
468638fd1498Szrj     case VIEW_CONVERT_EXPR:
468738fd1498Szrj     default:
468838fd1498Szrj       return false;
468938fd1498Szrj     }
469038fd1498Szrj 
469138fd1498Szrj   gcc_unreachable ();
469238fd1498Szrj }
469338fd1498Szrj 
469438fd1498Szrj /* Return true if T is a storage order barrier, i.e. a VIEW_CONVERT_EXPR
469538fd1498Szrj    that can modify the storage order of objects.  Note that, even if the
469638fd1498Szrj    TYPE_REVERSE_STORAGE_ORDER flag is set on both the inner type and the
469738fd1498Szrj    outer type, a VIEW_CONVERT_EXPR can modify the storage order because
469838fd1498Szrj    it can change the partition of the aggregate object into scalars.  */
469938fd1498Szrj 
470038fd1498Szrj static inline bool
storage_order_barrier_p(const_tree t)470138fd1498Szrj storage_order_barrier_p (const_tree t)
470238fd1498Szrj {
470338fd1498Szrj   if (TREE_CODE (t) != VIEW_CONVERT_EXPR)
470438fd1498Szrj     return false;
470538fd1498Szrj 
470638fd1498Szrj   if (AGGREGATE_TYPE_P (TREE_TYPE (t))
470738fd1498Szrj       && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (t)))
470838fd1498Szrj     return true;
470938fd1498Szrj 
471038fd1498Szrj   tree op = TREE_OPERAND (t, 0);
471138fd1498Szrj 
471238fd1498Szrj   if (AGGREGATE_TYPE_P (TREE_TYPE (op))
471338fd1498Szrj       && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (op)))
471438fd1498Szrj     return true;
471538fd1498Szrj 
471638fd1498Szrj   return false;
471738fd1498Szrj }
471838fd1498Szrj 
471938fd1498Szrj /* Given a DECL or TYPE, return the scope in which it was declared, or
472038fd1498Szrj    NUL_TREE if there is no containing scope.  */
472138fd1498Szrj 
472238fd1498Szrj extern tree get_containing_scope (const_tree);
472338fd1498Szrj 
472438fd1498Szrj /* Returns the ultimate TRANSLATION_UNIT_DECL context of DECL or NULL.  */
472538fd1498Szrj 
472638fd1498Szrj extern const_tree get_ultimate_context (const_tree);
472738fd1498Szrj 
472838fd1498Szrj /* Return the FUNCTION_DECL which provides this _DECL with its context,
472938fd1498Szrj    or zero if none.  */
473038fd1498Szrj extern tree decl_function_context (const_tree);
473138fd1498Szrj 
473238fd1498Szrj /* Return the RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE which provides
473338fd1498Szrj    this _DECL with its context, or zero if none.  */
473438fd1498Szrj extern tree decl_type_context (const_tree);
473538fd1498Szrj 
473638fd1498Szrj /* Return 1 if EXPR is the real constant zero.  */
473738fd1498Szrj extern int real_zerop (const_tree);
473838fd1498Szrj 
473938fd1498Szrj /* Initialize the iterator I with arguments from function FNDECL  */
474038fd1498Szrj 
474138fd1498Szrj static inline void
function_args_iter_init(function_args_iterator * i,const_tree fntype)474238fd1498Szrj function_args_iter_init (function_args_iterator *i, const_tree fntype)
474338fd1498Szrj {
474438fd1498Szrj   i->next = TYPE_ARG_TYPES (fntype);
474538fd1498Szrj }
474638fd1498Szrj 
474738fd1498Szrj /* Return a pointer that holds the next argument if there are more arguments to
474838fd1498Szrj    handle, otherwise return NULL.  */
474938fd1498Szrj 
475038fd1498Szrj static inline tree *
function_args_iter_cond_ptr(function_args_iterator * i)475138fd1498Szrj function_args_iter_cond_ptr (function_args_iterator *i)
475238fd1498Szrj {
475338fd1498Szrj   return (i->next) ? &TREE_VALUE (i->next) : NULL;
475438fd1498Szrj }
475538fd1498Szrj 
475638fd1498Szrj /* Return the next argument if there are more arguments to handle, otherwise
475738fd1498Szrj    return NULL.  */
475838fd1498Szrj 
475938fd1498Szrj static inline tree
function_args_iter_cond(function_args_iterator * i)476038fd1498Szrj function_args_iter_cond (function_args_iterator *i)
476138fd1498Szrj {
476238fd1498Szrj   return (i->next) ? TREE_VALUE (i->next) : NULL_TREE;
476338fd1498Szrj }
476438fd1498Szrj 
476538fd1498Szrj /* Advance to the next argument.  */
476638fd1498Szrj static inline void
function_args_iter_next(function_args_iterator * i)476738fd1498Szrj function_args_iter_next (function_args_iterator *i)
476838fd1498Szrj {
476938fd1498Szrj   gcc_assert (i->next != NULL_TREE);
477038fd1498Szrj   i->next = TREE_CHAIN (i->next);
477138fd1498Szrj }
477238fd1498Szrj 
477338fd1498Szrj /* We set BLOCK_SOURCE_LOCATION only to inlined function entry points.  */
477438fd1498Szrj 
477538fd1498Szrj static inline bool
inlined_function_outer_scope_p(const_tree block)477638fd1498Szrj inlined_function_outer_scope_p (const_tree block)
477738fd1498Szrj {
477838fd1498Szrj  return LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block)) != UNKNOWN_LOCATION;
477938fd1498Szrj }
478038fd1498Szrj 
478138fd1498Szrj /* Loop over all function arguments of FNTYPE.  In each iteration, PTR is set
478238fd1498Szrj    to point to the next tree element.  ITER is an instance of
478338fd1498Szrj    function_args_iterator used to iterate the arguments.  */
478438fd1498Szrj #define FOREACH_FUNCTION_ARGS_PTR(FNTYPE, PTR, ITER)			\
478538fd1498Szrj   for (function_args_iter_init (&(ITER), (FNTYPE));			\
478638fd1498Szrj        (PTR = function_args_iter_cond_ptr (&(ITER))) != NULL;		\
478738fd1498Szrj        function_args_iter_next (&(ITER)))
478838fd1498Szrj 
478938fd1498Szrj /* Loop over all function arguments of FNTYPE.  In each iteration, TREE is set
479038fd1498Szrj    to the next tree element.  ITER is an instance of function_args_iterator
479138fd1498Szrj    used to iterate the arguments.  */
479238fd1498Szrj #define FOREACH_FUNCTION_ARGS(FNTYPE, TREE, ITER)			\
479338fd1498Szrj   for (function_args_iter_init (&(ITER), (FNTYPE));			\
479438fd1498Szrj        (TREE = function_args_iter_cond (&(ITER))) != NULL_TREE;		\
479538fd1498Szrj        function_args_iter_next (&(ITER)))
479638fd1498Szrj 
479738fd1498Szrj /* In tree.c */
479838fd1498Szrj extern unsigned crc32_unsigned_n (unsigned, unsigned, unsigned);
479938fd1498Szrj extern unsigned crc32_string (unsigned, const char *);
480038fd1498Szrj inline unsigned
crc32_unsigned(unsigned chksum,unsigned value)480138fd1498Szrj crc32_unsigned (unsigned chksum, unsigned value)
480238fd1498Szrj {
480338fd1498Szrj   return crc32_unsigned_n (chksum, value, 4);
480438fd1498Szrj }
480538fd1498Szrj inline unsigned
crc32_byte(unsigned chksum,char byte)480638fd1498Szrj crc32_byte (unsigned chksum, char byte)
480738fd1498Szrj {
480838fd1498Szrj   return crc32_unsigned_n (chksum, byte, 1);
480938fd1498Szrj }
481038fd1498Szrj extern void clean_symbol_name (char *);
481138fd1498Szrj extern tree get_file_function_name (const char *);
481238fd1498Szrj extern tree get_callee_fndecl (const_tree);
481338fd1498Szrj extern combined_fn get_call_combined_fn (const_tree);
481438fd1498Szrj extern int type_num_arguments (const_tree);
481538fd1498Szrj extern bool associative_tree_code (enum tree_code);
481638fd1498Szrj extern bool commutative_tree_code (enum tree_code);
481738fd1498Szrj extern bool commutative_ternary_tree_code (enum tree_code);
481838fd1498Szrj extern bool operation_can_overflow (enum tree_code);
481938fd1498Szrj extern bool operation_no_trapping_overflow (tree, enum tree_code);
482038fd1498Szrj extern tree upper_bound_in_type (tree, tree);
482138fd1498Szrj extern tree lower_bound_in_type (tree, tree);
482238fd1498Szrj extern int operand_equal_for_phi_arg_p (const_tree, const_tree);
482338fd1498Szrj extern tree create_artificial_label (location_t);
482438fd1498Szrj extern const char *get_name (tree);
482538fd1498Szrj extern bool stdarg_p (const_tree);
482638fd1498Szrj extern bool prototype_p (const_tree);
482738fd1498Szrj extern bool is_typedef_decl (const_tree x);
482838fd1498Szrj extern bool typedef_variant_p (const_tree);
482938fd1498Szrj extern bool auto_var_in_fn_p (const_tree, const_tree);
483038fd1498Szrj extern tree build_low_bits_mask (tree, unsigned);
483138fd1498Szrj extern bool tree_nop_conversion_p (const_tree, const_tree);
483238fd1498Szrj extern tree tree_strip_nop_conversions (tree);
483338fd1498Szrj extern tree tree_strip_sign_nop_conversions (tree);
483438fd1498Szrj extern const_tree strip_invariant_refs (const_tree);
483538fd1498Szrj extern tree lhd_gcc_personality (void);
483638fd1498Szrj extern void assign_assembler_name_if_needed (tree);
483738fd1498Szrj extern void warn_deprecated_use (tree, tree);
483838fd1498Szrj extern void cache_integer_cst (tree);
483938fd1498Szrj extern const char *combined_fn_name (combined_fn);
484038fd1498Szrj 
484138fd1498Szrj /* Compare and hash for any structure which begins with a canonical
484238fd1498Szrj    pointer.  Assumes all pointers are interchangeable, which is sort
484338fd1498Szrj    of already assumed by gcc elsewhere IIRC.  */
484438fd1498Szrj 
484538fd1498Szrj static inline int
struct_ptr_eq(const void * a,const void * b)484638fd1498Szrj struct_ptr_eq (const void *a, const void *b)
484738fd1498Szrj {
484838fd1498Szrj   const void * const * x = (const void * const *) a;
484938fd1498Szrj   const void * const * y = (const void * const *) b;
485038fd1498Szrj   return *x == *y;
485138fd1498Szrj }
485238fd1498Szrj 
485338fd1498Szrj static inline hashval_t
struct_ptr_hash(const void * a)485438fd1498Szrj struct_ptr_hash (const void *a)
485538fd1498Szrj {
485638fd1498Szrj   const void * const * x = (const void * const *) a;
485738fd1498Szrj   return (intptr_t)*x >> 4;
485838fd1498Szrj }
485938fd1498Szrj 
486038fd1498Szrj /* Return nonzero if CODE is a tree code that represents a truth value.  */
486138fd1498Szrj static inline bool
truth_value_p(enum tree_code code)486238fd1498Szrj truth_value_p (enum tree_code code)
486338fd1498Szrj {
486438fd1498Szrj   return (TREE_CODE_CLASS (code) == tcc_comparison
486538fd1498Szrj 	  || code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR
486638fd1498Szrj 	  || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
486738fd1498Szrj 	  || code == TRUTH_XOR_EXPR || code == TRUTH_NOT_EXPR);
486838fd1498Szrj }
486938fd1498Szrj 
487038fd1498Szrj /* Return whether TYPE is a type suitable for an offset for
487138fd1498Szrj    a POINTER_PLUS_EXPR.  */
487238fd1498Szrj static inline bool
ptrofftype_p(tree type)487338fd1498Szrj ptrofftype_p (tree type)
487438fd1498Szrj {
487538fd1498Szrj   return (INTEGRAL_TYPE_P (type)
487638fd1498Szrj 	  && TYPE_PRECISION (type) == TYPE_PRECISION (sizetype)
487738fd1498Szrj 	  && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (sizetype));
487838fd1498Szrj }
487938fd1498Szrj 
488038fd1498Szrj /* Return true if the argument is a complete type or an array
488138fd1498Szrj    of unknown bound (whose type is incomplete but) whose elements
488238fd1498Szrj    have complete type.  */
488338fd1498Szrj static inline bool
complete_or_array_type_p(const_tree type)488438fd1498Szrj complete_or_array_type_p (const_tree type)
488538fd1498Szrj {
488638fd1498Szrj   return COMPLETE_TYPE_P (type)
488738fd1498Szrj          || (TREE_CODE (type) == ARRAY_TYPE
488838fd1498Szrj 	     && COMPLETE_TYPE_P (TREE_TYPE (type)));
488938fd1498Szrj }
489038fd1498Szrj 
489138fd1498Szrj /* Return true if the value of T could be represented as a poly_widest_int.  */
489238fd1498Szrj 
489338fd1498Szrj inline bool
poly_int_tree_p(const_tree t)489438fd1498Szrj poly_int_tree_p (const_tree t)
489538fd1498Szrj {
489638fd1498Szrj   return (TREE_CODE (t) == INTEGER_CST || POLY_INT_CST_P (t));
489738fd1498Szrj }
489838fd1498Szrj 
489938fd1498Szrj /* Return the bit size of BIT_FIELD_REF T, in cases where it is known
490038fd1498Szrj    to be a poly_uint64.  (This is always true at the gimple level.)  */
490138fd1498Szrj 
490238fd1498Szrj inline poly_uint64
bit_field_size(const_tree t)490338fd1498Szrj bit_field_size (const_tree t)
490438fd1498Szrj {
490538fd1498Szrj   return tree_to_poly_uint64 (TREE_OPERAND (t, 1));
490638fd1498Szrj }
490738fd1498Szrj 
490838fd1498Szrj /* Return the starting bit offset of BIT_FIELD_REF T, in cases where it is
490938fd1498Szrj    known to be a poly_uint64.  (This is always true at the gimple level.)  */
491038fd1498Szrj 
491138fd1498Szrj inline poly_uint64
bit_field_offset(const_tree t)491238fd1498Szrj bit_field_offset (const_tree t)
491338fd1498Szrj {
491438fd1498Szrj   return tree_to_poly_uint64 (TREE_OPERAND (t, 2));
491538fd1498Szrj }
491638fd1498Szrj 
491738fd1498Szrj extern tree strip_float_extensions (tree);
491838fd1498Szrj extern int really_constant_p (const_tree);
491938fd1498Szrj extern bool ptrdiff_tree_p (const_tree, poly_int64_pod *);
492038fd1498Szrj extern bool decl_address_invariant_p (const_tree);
492138fd1498Szrj extern bool decl_address_ip_invariant_p (const_tree);
492238fd1498Szrj extern bool int_fits_type_p (const_tree, const_tree);
492338fd1498Szrj #ifndef GENERATOR_FILE
492438fd1498Szrj extern void get_type_static_bounds (const_tree, mpz_t, mpz_t);
492538fd1498Szrj #endif
492638fd1498Szrj extern bool variably_modified_type_p (tree, tree);
492738fd1498Szrj extern int tree_log2 (const_tree);
492838fd1498Szrj extern int tree_floor_log2 (const_tree);
492938fd1498Szrj extern unsigned int tree_ctz (const_tree);
493038fd1498Szrj extern int simple_cst_equal (const_tree, const_tree);
493138fd1498Szrj 
493238fd1498Szrj namespace inchash
493338fd1498Szrj {
493438fd1498Szrj 
493538fd1498Szrj extern void add_expr (const_tree, hash &, unsigned int = 0);
493638fd1498Szrj 
493738fd1498Szrj }
493838fd1498Szrj 
493938fd1498Szrj /* Compat version until all callers are converted. Return hash for
494038fd1498Szrj    TREE with SEED.  */
iterative_hash_expr(const_tree tree,hashval_t seed)494138fd1498Szrj static inline hashval_t iterative_hash_expr(const_tree tree, hashval_t seed)
494238fd1498Szrj {
494338fd1498Szrj   inchash::hash hstate (seed);
494438fd1498Szrj   inchash::add_expr (tree, hstate);
494538fd1498Szrj   return hstate.end ();
494638fd1498Szrj }
494738fd1498Szrj 
494838fd1498Szrj extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT);
494938fd1498Szrj extern int type_list_equal (const_tree, const_tree);
495038fd1498Szrj extern int chain_member (const_tree, const_tree);
495138fd1498Szrj extern void dump_tree_statistics (void);
495238fd1498Szrj extern void recompute_tree_invariant_for_addr_expr (tree);
495338fd1498Szrj extern bool needs_to_live_in_memory (const_tree);
495438fd1498Szrj extern tree reconstruct_complex_type (tree, tree);
495538fd1498Szrj extern int real_onep (const_tree);
495638fd1498Szrj extern int real_minus_onep (const_tree);
495738fd1498Szrj extern void init_ttree (void);
495838fd1498Szrj extern void build_common_tree_nodes (bool);
495938fd1498Szrj extern void build_common_builtin_nodes (void);
496038fd1498Szrj extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int);
496138fd1498Szrj extern tree build_nonstandard_boolean_type (unsigned HOST_WIDE_INT);
496238fd1498Szrj extern tree build_range_type (tree, tree, tree);
496338fd1498Szrj extern tree build_nonshared_range_type (tree, tree, tree);
496438fd1498Szrj extern bool subrange_type_for_debug_p (const_tree, tree *, tree *);
496538fd1498Szrj extern HOST_WIDE_INT int_cst_value (const_tree);
496638fd1498Szrj extern tree tree_block (tree);
496738fd1498Szrj extern void tree_set_block (tree, tree);
496838fd1498Szrj extern location_t *block_nonartificial_location (tree);
496938fd1498Szrj extern location_t tree_nonartificial_location (tree);
497038fd1498Szrj extern tree block_ultimate_origin (const_tree);
497138fd1498Szrj extern tree get_binfo_at_offset (tree, poly_int64, tree);
497238fd1498Szrj extern bool virtual_method_call_p (const_tree);
497338fd1498Szrj extern tree obj_type_ref_class (const_tree ref);
497438fd1498Szrj extern bool types_same_for_odr (const_tree type1, const_tree type2,
497538fd1498Szrj 				bool strict=false);
497638fd1498Szrj extern bool contains_bitfld_component_ref_p (const_tree);
497738fd1498Szrj extern bool block_may_fallthru (const_tree);
497838fd1498Szrj extern void using_eh_for_cleanups (void);
497938fd1498Szrj extern bool using_eh_for_cleanups_p (void);
498038fd1498Szrj extern const char *get_tree_code_name (enum tree_code);
498138fd1498Szrj extern void set_call_expr_flags (tree, int);
498238fd1498Szrj extern tree walk_tree_1 (tree*, walk_tree_fn, void*, hash_set<tree>*,
498338fd1498Szrj 			 walk_tree_lh);
498438fd1498Szrj extern tree walk_tree_without_duplicates_1 (tree*, walk_tree_fn, void*,
498538fd1498Szrj 					    walk_tree_lh);
498638fd1498Szrj #define walk_tree(a,b,c,d) \
498738fd1498Szrj 	walk_tree_1 (a, b, c, d, NULL)
498838fd1498Szrj #define walk_tree_without_duplicates(a,b,c) \
498938fd1498Szrj 	walk_tree_without_duplicates_1 (a, b, c, NULL)
499038fd1498Szrj 
499138fd1498Szrj extern tree drop_tree_overflow (tree);
499238fd1498Szrj 
499338fd1498Szrj /* Given a memory reference expression T, return its base address.
499438fd1498Szrj    The base address of a memory reference expression is the main
499538fd1498Szrj    object being referenced.  */
499638fd1498Szrj extern tree get_base_address (tree t);
499738fd1498Szrj 
499838fd1498Szrj /* Return a tree of sizetype representing the size, in bytes, of the element
499938fd1498Szrj    of EXP, an ARRAY_REF or an ARRAY_RANGE_REF.  */
500038fd1498Szrj extern tree array_ref_element_size (tree);
500138fd1498Szrj 
500238fd1498Szrj /* Return a tree representing the upper bound of the array mentioned in
500338fd1498Szrj    EXP, an ARRAY_REF or an ARRAY_RANGE_REF.  */
500438fd1498Szrj extern tree array_ref_up_bound (tree);
500538fd1498Szrj 
500638fd1498Szrj /* Return a tree representing the lower bound of the array mentioned in
500738fd1498Szrj    EXP, an ARRAY_REF or an ARRAY_RANGE_REF.  */
500838fd1498Szrj extern tree array_ref_low_bound (tree);
500938fd1498Szrj 
501038fd1498Szrj /* Returns true if REF is an array reference or a component reference
501138fd1498Szrj    to an array at the end of a structure.  If this is the case, the array
501238fd1498Szrj    may be allocated larger than its upper bound implies.  */
501338fd1498Szrj extern bool array_at_struct_end_p (tree);
501438fd1498Szrj 
501538fd1498Szrj /* Return a tree representing the offset, in bytes, of the field referenced
501638fd1498Szrj    by EXP.  This does not include any offset in DECL_FIELD_BIT_OFFSET.  */
501738fd1498Szrj extern tree component_ref_field_offset (tree);
501838fd1498Szrj 
501938fd1498Szrj extern int tree_map_base_eq (const void *, const void *);
502038fd1498Szrj extern unsigned int tree_map_base_hash (const void *);
502138fd1498Szrj extern int tree_map_base_marked_p (const void *);
502238fd1498Szrj extern void DEBUG_FUNCTION verify_type (const_tree t);
502338fd1498Szrj extern bool gimple_canonical_types_compatible_p (const_tree, const_tree,
502438fd1498Szrj 						 bool trust_type_canonical = true);
502538fd1498Szrj extern bool type_with_interoperable_signedness (const_tree);
502638fd1498Szrj extern bitmap get_nonnull_args (const_tree);
502738fd1498Szrj extern int get_range_pos_neg (tree);
502838fd1498Szrj 
502938fd1498Szrj /* Return simplified tree code of type that is used for canonical type
503038fd1498Szrj    merging.  */
503138fd1498Szrj inline enum tree_code
tree_code_for_canonical_type_merging(enum tree_code code)503238fd1498Szrj tree_code_for_canonical_type_merging (enum tree_code code)
503338fd1498Szrj {
503438fd1498Szrj   /* By C standard, each enumerated type shall be compatible with char,
503538fd1498Szrj      a signed integer, or an unsigned integer.  The choice of type is
503638fd1498Szrj      implementation defined (in our case it depends on -fshort-enum).
503738fd1498Szrj 
503838fd1498Szrj      For this reason we make no distinction between ENUMERAL_TYPE and INTEGER
503938fd1498Szrj      type and compare only by their signedness and precision.  */
504038fd1498Szrj   if (code == ENUMERAL_TYPE)
504138fd1498Szrj     return INTEGER_TYPE;
504238fd1498Szrj   /* To allow inter-operability between languages having references and
504338fd1498Szrj      C, we consider reference types and pointers alike.  Note that this is
504438fd1498Szrj      not strictly necessary for C-Fortran 2008 interoperability because
504538fd1498Szrj      Fortran define C_PTR type that needs to be compatible with C pointers
504638fd1498Szrj      and we handle this one as ptr_type_node.  */
504738fd1498Szrj   if (code == REFERENCE_TYPE)
504838fd1498Szrj     return POINTER_TYPE;
504938fd1498Szrj   return code;
505038fd1498Szrj }
505138fd1498Szrj 
505238fd1498Szrj /* Return ture if get_alias_set care about TYPE_CANONICAL of given type.
505338fd1498Szrj    We don't define the types for pointers, arrays and vectors.  The reason is
505438fd1498Szrj    that pointers are handled specially: ptr_type_node accesses conflict with
505538fd1498Szrj    accesses to all other pointers.  This is done by alias.c.
505638fd1498Szrj    Because alias sets of arrays and vectors are the same as types of their
505738fd1498Szrj    elements, we can't compute canonical type either.  Otherwise we could go
505838fd1498Szrj    form void *[10] to int *[10] (because they are equivalent for canonical type
505938fd1498Szrj    machinery) and get wrong TBAA.  */
506038fd1498Szrj 
506138fd1498Szrj inline bool
canonical_type_used_p(const_tree t)506238fd1498Szrj canonical_type_used_p (const_tree t)
506338fd1498Szrj {
506438fd1498Szrj   return !(POINTER_TYPE_P (t)
506538fd1498Szrj 	   || TREE_CODE (t) == ARRAY_TYPE
506638fd1498Szrj 	   || TREE_CODE (t) == VECTOR_TYPE);
506738fd1498Szrj }
506838fd1498Szrj 
506938fd1498Szrj #define tree_map_eq tree_map_base_eq
507038fd1498Szrj extern unsigned int tree_map_hash (const void *);
507138fd1498Szrj #define tree_map_marked_p tree_map_base_marked_p
507238fd1498Szrj 
507338fd1498Szrj #define tree_decl_map_eq tree_map_base_eq
507438fd1498Szrj extern unsigned int tree_decl_map_hash (const void *);
507538fd1498Szrj #define tree_decl_map_marked_p tree_map_base_marked_p
507638fd1498Szrj 
507738fd1498Szrj struct tree_decl_map_cache_hasher : ggc_cache_ptr_hash<tree_decl_map>
507838fd1498Szrj {
hashtree_decl_map_cache_hasher507938fd1498Szrj   static hashval_t hash (tree_decl_map *m) { return tree_decl_map_hash (m); }
508038fd1498Szrj   static bool
equaltree_decl_map_cache_hasher508138fd1498Szrj   equal (tree_decl_map *a, tree_decl_map *b)
508238fd1498Szrj   {
508338fd1498Szrj     return tree_decl_map_eq (a, b);
508438fd1498Szrj   }
508538fd1498Szrj 
508638fd1498Szrj   static int
keep_cache_entrytree_decl_map_cache_hasher508738fd1498Szrj   keep_cache_entry (tree_decl_map *&m)
508838fd1498Szrj   {
508938fd1498Szrj     return ggc_marked_p (m->base.from);
509038fd1498Szrj   }
509138fd1498Szrj };
509238fd1498Szrj 
509338fd1498Szrj #define tree_int_map_eq tree_map_base_eq
509438fd1498Szrj #define tree_int_map_hash tree_map_base_hash
509538fd1498Szrj #define tree_int_map_marked_p tree_map_base_marked_p
509638fd1498Szrj 
509738fd1498Szrj #define tree_vec_map_eq tree_map_base_eq
509838fd1498Szrj #define tree_vec_map_hash tree_decl_map_hash
509938fd1498Szrj #define tree_vec_map_marked_p tree_map_base_marked_p
510038fd1498Szrj 
510138fd1498Szrj /* A hash_map of two trees for use with GTY((cache)).  Garbage collection for
510238fd1498Szrj    such a map will not mark keys, and will mark values if the key is already
510338fd1498Szrj    marked.  */
510438fd1498Szrj struct tree_cache_traits
510538fd1498Szrj   : simple_cache_map_traits<default_hash_traits<tree>, tree> { };
510638fd1498Szrj typedef hash_map<tree,tree,tree_cache_traits> tree_cache_map;
510738fd1498Szrj 
510838fd1498Szrj /* Initialize the abstract argument list iterator object ITER with the
510938fd1498Szrj    arguments from CALL_EXPR node EXP.  */
511038fd1498Szrj static inline void
init_call_expr_arg_iterator(tree exp,call_expr_arg_iterator * iter)511138fd1498Szrj init_call_expr_arg_iterator (tree exp, call_expr_arg_iterator *iter)
511238fd1498Szrj {
511338fd1498Szrj   iter->t = exp;
511438fd1498Szrj   iter->n = call_expr_nargs (exp);
511538fd1498Szrj   iter->i = 0;
511638fd1498Szrj }
511738fd1498Szrj 
511838fd1498Szrj static inline void
init_const_call_expr_arg_iterator(const_tree exp,const_call_expr_arg_iterator * iter)511938fd1498Szrj init_const_call_expr_arg_iterator (const_tree exp, const_call_expr_arg_iterator *iter)
512038fd1498Szrj {
512138fd1498Szrj   iter->t = exp;
512238fd1498Szrj   iter->n = call_expr_nargs (exp);
512338fd1498Szrj   iter->i = 0;
512438fd1498Szrj }
512538fd1498Szrj 
512638fd1498Szrj /* Return the next argument from abstract argument list iterator object ITER,
512738fd1498Szrj    and advance its state.  Return NULL_TREE if there are no more arguments.  */
512838fd1498Szrj static inline tree
next_call_expr_arg(call_expr_arg_iterator * iter)512938fd1498Szrj next_call_expr_arg (call_expr_arg_iterator *iter)
513038fd1498Szrj {
513138fd1498Szrj   tree result;
513238fd1498Szrj   if (iter->i >= iter->n)
513338fd1498Szrj     return NULL_TREE;
513438fd1498Szrj   result = CALL_EXPR_ARG (iter->t, iter->i);
513538fd1498Szrj   iter->i++;
513638fd1498Szrj   return result;
513738fd1498Szrj }
513838fd1498Szrj 
513938fd1498Szrj static inline const_tree
next_const_call_expr_arg(const_call_expr_arg_iterator * iter)514038fd1498Szrj next_const_call_expr_arg (const_call_expr_arg_iterator *iter)
514138fd1498Szrj {
514238fd1498Szrj   const_tree result;
514338fd1498Szrj   if (iter->i >= iter->n)
514438fd1498Szrj     return NULL_TREE;
514538fd1498Szrj   result = CALL_EXPR_ARG (iter->t, iter->i);
514638fd1498Szrj   iter->i++;
514738fd1498Szrj   return result;
514838fd1498Szrj }
514938fd1498Szrj 
515038fd1498Szrj /* Initialize the abstract argument list iterator object ITER, then advance
515138fd1498Szrj    past and return the first argument.  Useful in for expressions, e.g.
515238fd1498Szrj      for (arg = first_call_expr_arg (exp, &iter); arg;
515338fd1498Szrj           arg = next_call_expr_arg (&iter))   */
515438fd1498Szrj static inline tree
first_call_expr_arg(tree exp,call_expr_arg_iterator * iter)515538fd1498Szrj first_call_expr_arg (tree exp, call_expr_arg_iterator *iter)
515638fd1498Szrj {
515738fd1498Szrj   init_call_expr_arg_iterator (exp, iter);
515838fd1498Szrj   return next_call_expr_arg (iter);
515938fd1498Szrj }
516038fd1498Szrj 
516138fd1498Szrj static inline const_tree
first_const_call_expr_arg(const_tree exp,const_call_expr_arg_iterator * iter)516238fd1498Szrj first_const_call_expr_arg (const_tree exp, const_call_expr_arg_iterator *iter)
516338fd1498Szrj {
516438fd1498Szrj   init_const_call_expr_arg_iterator (exp, iter);
516538fd1498Szrj   return next_const_call_expr_arg (iter);
516638fd1498Szrj }
516738fd1498Szrj 
516838fd1498Szrj /* Test whether there are more arguments in abstract argument list iterator
516938fd1498Szrj    ITER, without changing its state.  */
517038fd1498Szrj static inline bool
more_call_expr_args_p(const call_expr_arg_iterator * iter)517138fd1498Szrj more_call_expr_args_p (const call_expr_arg_iterator *iter)
517238fd1498Szrj {
517338fd1498Szrj   return (iter->i < iter->n);
517438fd1498Szrj }
517538fd1498Szrj 
517638fd1498Szrj /* Iterate through each argument ARG of CALL_EXPR CALL, using variable ITER
517738fd1498Szrj    (of type call_expr_arg_iterator) to hold the iteration state.  */
517838fd1498Szrj #define FOR_EACH_CALL_EXPR_ARG(arg, iter, call)			\
517938fd1498Szrj   for ((arg) = first_call_expr_arg ((call), &(iter)); (arg);	\
518038fd1498Szrj        (arg) = next_call_expr_arg (&(iter)))
518138fd1498Szrj 
518238fd1498Szrj #define FOR_EACH_CONST_CALL_EXPR_ARG(arg, iter, call)			\
518338fd1498Szrj   for ((arg) = first_const_call_expr_arg ((call), &(iter)); (arg);	\
518438fd1498Szrj        (arg) = next_const_call_expr_arg (&(iter)))
518538fd1498Szrj 
518638fd1498Szrj /* Return true if tree node T is a language-specific node.  */
518738fd1498Szrj static inline bool
is_lang_specific(const_tree t)518838fd1498Szrj is_lang_specific (const_tree t)
518938fd1498Szrj {
519038fd1498Szrj   return TREE_CODE (t) == LANG_TYPE || TREE_CODE (t) >= NUM_TREE_CODES;
519138fd1498Szrj }
519238fd1498Szrj 
519338fd1498Szrj /* Valid builtin number.  */
519438fd1498Szrj #define BUILTIN_VALID_P(FNCODE) \
519538fd1498Szrj   (IN_RANGE ((int)FNCODE, ((int)BUILT_IN_NONE) + 1, ((int) END_BUILTINS) - 1))
519638fd1498Szrj 
519738fd1498Szrj /* Return the tree node for an explicit standard builtin function or NULL.  */
519838fd1498Szrj static inline tree
builtin_decl_explicit(enum built_in_function fncode)519938fd1498Szrj builtin_decl_explicit (enum built_in_function fncode)
520038fd1498Szrj {
520138fd1498Szrj   gcc_checking_assert (BUILTIN_VALID_P (fncode));
520238fd1498Szrj 
520338fd1498Szrj   return builtin_info[(size_t)fncode].decl;
520438fd1498Szrj }
520538fd1498Szrj 
520638fd1498Szrj /* Return the tree node for an implicit builtin function or NULL.  */
520738fd1498Szrj static inline tree
builtin_decl_implicit(enum built_in_function fncode)520838fd1498Szrj builtin_decl_implicit (enum built_in_function fncode)
520938fd1498Szrj {
521038fd1498Szrj   size_t uns_fncode = (size_t)fncode;
521138fd1498Szrj   gcc_checking_assert (BUILTIN_VALID_P (fncode));
521238fd1498Szrj 
521338fd1498Szrj   if (!builtin_info[uns_fncode].implicit_p)
521438fd1498Szrj     return NULL_TREE;
521538fd1498Szrj 
521638fd1498Szrj   return builtin_info[uns_fncode].decl;
521738fd1498Szrj }
521838fd1498Szrj 
521938fd1498Szrj /* Set explicit builtin function nodes and whether it is an implicit
522038fd1498Szrj    function.  */
522138fd1498Szrj 
522238fd1498Szrj static inline void
set_builtin_decl(enum built_in_function fncode,tree decl,bool implicit_p)522338fd1498Szrj set_builtin_decl (enum built_in_function fncode, tree decl, bool implicit_p)
522438fd1498Szrj {
522538fd1498Szrj   size_t ufncode = (size_t)fncode;
522638fd1498Szrj 
522738fd1498Szrj   gcc_checking_assert (BUILTIN_VALID_P (fncode)
522838fd1498Szrj 		       && (decl != NULL_TREE || !implicit_p));
522938fd1498Szrj 
523038fd1498Szrj   builtin_info[ufncode].decl = decl;
523138fd1498Szrj   builtin_info[ufncode].implicit_p = implicit_p;
523238fd1498Szrj   builtin_info[ufncode].declared_p = false;
523338fd1498Szrj }
523438fd1498Szrj 
523538fd1498Szrj /* Set the implicit flag for a builtin function.  */
523638fd1498Szrj 
523738fd1498Szrj static inline void
set_builtin_decl_implicit_p(enum built_in_function fncode,bool implicit_p)523838fd1498Szrj set_builtin_decl_implicit_p (enum built_in_function fncode, bool implicit_p)
523938fd1498Szrj {
524038fd1498Szrj   size_t uns_fncode = (size_t)fncode;
524138fd1498Szrj 
524238fd1498Szrj   gcc_checking_assert (BUILTIN_VALID_P (fncode)
524338fd1498Szrj 		       && builtin_info[uns_fncode].decl != NULL_TREE);
524438fd1498Szrj 
524538fd1498Szrj   builtin_info[uns_fncode].implicit_p = implicit_p;
524638fd1498Szrj }
524738fd1498Szrj 
524838fd1498Szrj /* Set the declared flag for a builtin function.  */
524938fd1498Szrj 
525038fd1498Szrj static inline void
set_builtin_decl_declared_p(enum built_in_function fncode,bool declared_p)525138fd1498Szrj set_builtin_decl_declared_p (enum built_in_function fncode, bool declared_p)
525238fd1498Szrj {
525338fd1498Szrj   size_t uns_fncode = (size_t)fncode;
525438fd1498Szrj 
525538fd1498Szrj   gcc_checking_assert (BUILTIN_VALID_P (fncode)
525638fd1498Szrj 		       && builtin_info[uns_fncode].decl != NULL_TREE);
525738fd1498Szrj 
525838fd1498Szrj   builtin_info[uns_fncode].declared_p = declared_p;
525938fd1498Szrj }
526038fd1498Szrj 
526138fd1498Szrj /* Return whether the standard builtin function can be used as an explicit
526238fd1498Szrj    function.  */
526338fd1498Szrj 
526438fd1498Szrj static inline bool
builtin_decl_explicit_p(enum built_in_function fncode)526538fd1498Szrj builtin_decl_explicit_p (enum built_in_function fncode)
526638fd1498Szrj {
526738fd1498Szrj   gcc_checking_assert (BUILTIN_VALID_P (fncode));
526838fd1498Szrj   return (builtin_info[(size_t)fncode].decl != NULL_TREE);
526938fd1498Szrj }
527038fd1498Szrj 
527138fd1498Szrj /* Return whether the standard builtin function can be used implicitly.  */
527238fd1498Szrj 
527338fd1498Szrj static inline bool
builtin_decl_implicit_p(enum built_in_function fncode)527438fd1498Szrj builtin_decl_implicit_p (enum built_in_function fncode)
527538fd1498Szrj {
527638fd1498Szrj   size_t uns_fncode = (size_t)fncode;
527738fd1498Szrj 
527838fd1498Szrj   gcc_checking_assert (BUILTIN_VALID_P (fncode));
527938fd1498Szrj   return (builtin_info[uns_fncode].decl != NULL_TREE
528038fd1498Szrj 	  && builtin_info[uns_fncode].implicit_p);
528138fd1498Szrj }
528238fd1498Szrj 
528338fd1498Szrj /* Return whether the standard builtin function was declared.  */
528438fd1498Szrj 
528538fd1498Szrj static inline bool
builtin_decl_declared_p(enum built_in_function fncode)528638fd1498Szrj builtin_decl_declared_p (enum built_in_function fncode)
528738fd1498Szrj {
528838fd1498Szrj   size_t uns_fncode = (size_t)fncode;
528938fd1498Szrj 
529038fd1498Szrj   gcc_checking_assert (BUILTIN_VALID_P (fncode));
529138fd1498Szrj   return (builtin_info[uns_fncode].decl != NULL_TREE
529238fd1498Szrj 	  && builtin_info[uns_fncode].declared_p);
529338fd1498Szrj }
529438fd1498Szrj 
529538fd1498Szrj /* Return true if T (assumed to be a DECL) is a global variable.
529638fd1498Szrj    A variable is considered global if its storage is not automatic.  */
529738fd1498Szrj 
529838fd1498Szrj static inline bool
is_global_var(const_tree t)529938fd1498Szrj is_global_var (const_tree t)
530038fd1498Szrj {
530138fd1498Szrj   return (TREE_STATIC (t) || DECL_EXTERNAL (t));
530238fd1498Szrj }
530338fd1498Szrj 
530438fd1498Szrj /* Return true if VAR may be aliased.  A variable is considered as
530538fd1498Szrj    maybe aliased if it has its address taken by the local TU
530638fd1498Szrj    or possibly by another TU and might be modified through a pointer.  */
530738fd1498Szrj 
530838fd1498Szrj static inline bool
may_be_aliased(const_tree var)530938fd1498Szrj may_be_aliased (const_tree var)
531038fd1498Szrj {
531138fd1498Szrj   return (TREE_CODE (var) != CONST_DECL
531238fd1498Szrj 	  && (TREE_PUBLIC (var)
531338fd1498Szrj 	      || DECL_EXTERNAL (var)
531438fd1498Szrj 	      || TREE_ADDRESSABLE (var))
531538fd1498Szrj 	  && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
531638fd1498Szrj 	       && ((TREE_READONLY (var)
531738fd1498Szrj 		    && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
531838fd1498Szrj 		   || (TREE_CODE (var) == VAR_DECL
531938fd1498Szrj 		       && DECL_NONALIASED (var)))));
532038fd1498Szrj }
532138fd1498Szrj 
532238fd1498Szrj /* Return pointer to optimization flags of FNDECL.  */
532338fd1498Szrj static inline struct cl_optimization *
opts_for_fn(const_tree fndecl)532438fd1498Szrj opts_for_fn (const_tree fndecl)
532538fd1498Szrj {
532638fd1498Szrj   tree fn_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl);
532738fd1498Szrj   if (fn_opts == NULL_TREE)
532838fd1498Szrj     fn_opts = optimization_default_node;
532938fd1498Szrj   return TREE_OPTIMIZATION (fn_opts);
533038fd1498Szrj }
533138fd1498Szrj 
533238fd1498Szrj /* Return pointer to target flags of FNDECL.  */
533338fd1498Szrj static inline cl_target_option *
target_opts_for_fn(const_tree fndecl)533438fd1498Szrj target_opts_for_fn (const_tree fndecl)
533538fd1498Szrj {
533638fd1498Szrj   tree fn_opts = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
533738fd1498Szrj   if (fn_opts == NULL_TREE)
533838fd1498Szrj     fn_opts = target_option_default_node;
533938fd1498Szrj   return fn_opts == NULL_TREE ? NULL : TREE_TARGET_OPTION (fn_opts);
534038fd1498Szrj }
534138fd1498Szrj 
534238fd1498Szrj /* opt flag for function FNDECL, e.g. opts_for_fn (fndecl, optimize) is
534338fd1498Szrj    the optimization level of function fndecl.  */
534438fd1498Szrj #define opt_for_fn(fndecl, opt) (opts_for_fn (fndecl)->x_##opt)
534538fd1498Szrj 
534638fd1498Szrj /* For anonymous aggregate types, we need some sort of name to
534738fd1498Szrj    hold on to.  In practice, this should not appear, but it should
534838fd1498Szrj    not be harmful if it does.  */
534938fd1498Szrj extern const char *anon_aggrname_format();
535038fd1498Szrj extern bool anon_aggrname_p (const_tree);
535138fd1498Szrj 
535238fd1498Szrj /* The tree and const_tree overload templates.   */
535338fd1498Szrj namespace wi
535438fd1498Szrj {
535538fd1498Szrj   class unextended_tree
535638fd1498Szrj   {
535738fd1498Szrj   private:
535838fd1498Szrj     const_tree m_t;
535938fd1498Szrj 
536038fd1498Szrj   public:
unextended_tree()536138fd1498Szrj     unextended_tree () {}
unextended_tree(const_tree t)536238fd1498Szrj     unextended_tree (const_tree t) : m_t (t) {}
536338fd1498Szrj 
536438fd1498Szrj     unsigned int get_precision () const;
536538fd1498Szrj     const HOST_WIDE_INT *get_val () const;
536638fd1498Szrj     unsigned int get_len () const;
get_tree()536738fd1498Szrj     const_tree get_tree () const { return m_t; }
536838fd1498Szrj   };
536938fd1498Szrj 
537038fd1498Szrj   template <>
537138fd1498Szrj   struct int_traits <unextended_tree>
537238fd1498Szrj   {
537338fd1498Szrj     static const enum precision_type precision_type = VAR_PRECISION;
537438fd1498Szrj     static const bool host_dependent_precision = false;
537538fd1498Szrj     static const bool is_sign_extended = false;
537638fd1498Szrj   };
537738fd1498Szrj 
537838fd1498Szrj   template <int N>
537938fd1498Szrj   class extended_tree
538038fd1498Szrj   {
538138fd1498Szrj   private:
538238fd1498Szrj     const_tree m_t;
538338fd1498Szrj 
538438fd1498Szrj   public:
538538fd1498Szrj     extended_tree () {}
538638fd1498Szrj     extended_tree (const_tree);
538738fd1498Szrj 
538838fd1498Szrj     unsigned int get_precision () const;
538938fd1498Szrj     const HOST_WIDE_INT *get_val () const;
539038fd1498Szrj     unsigned int get_len () const;
539138fd1498Szrj     const_tree get_tree () const { return m_t; }
539238fd1498Szrj   };
539338fd1498Szrj 
539438fd1498Szrj   template <int N>
539538fd1498Szrj   struct int_traits <extended_tree <N> >
539638fd1498Szrj   {
539738fd1498Szrj     static const enum precision_type precision_type = CONST_PRECISION;
539838fd1498Szrj     static const bool host_dependent_precision = false;
539938fd1498Szrj     static const bool is_sign_extended = true;
540038fd1498Szrj     static const unsigned int precision = N;
540138fd1498Szrj   };
540238fd1498Szrj 
540338fd1498Szrj   typedef extended_tree <WIDE_INT_MAX_PRECISION> widest_extended_tree;
540438fd1498Szrj   typedef extended_tree <ADDR_MAX_PRECISION> offset_extended_tree;
540538fd1498Szrj 
540638fd1498Szrj   typedef const generic_wide_int <widest_extended_tree> tree_to_widest_ref;
540738fd1498Szrj   typedef const generic_wide_int <offset_extended_tree> tree_to_offset_ref;
540838fd1498Szrj   typedef const generic_wide_int<wide_int_ref_storage<false, false> >
540938fd1498Szrj     tree_to_wide_ref;
541038fd1498Szrj 
541138fd1498Szrj   tree_to_widest_ref to_widest (const_tree);
541238fd1498Szrj   tree_to_offset_ref to_offset (const_tree);
541338fd1498Szrj   tree_to_wide_ref to_wide (const_tree);
541438fd1498Szrj   wide_int to_wide (const_tree, unsigned int);
541538fd1498Szrj 
541638fd1498Szrj   typedef const poly_int <NUM_POLY_INT_COEFFS,
541738fd1498Szrj 			  generic_wide_int <widest_extended_tree> >
541838fd1498Szrj     tree_to_poly_widest_ref;
541938fd1498Szrj   typedef const poly_int <NUM_POLY_INT_COEFFS,
542038fd1498Szrj 			  generic_wide_int <offset_extended_tree> >
542138fd1498Szrj     tree_to_poly_offset_ref;
542238fd1498Szrj   typedef const poly_int <NUM_POLY_INT_COEFFS,
542338fd1498Szrj 			  generic_wide_int <unextended_tree> >
542438fd1498Szrj     tree_to_poly_wide_ref;
542538fd1498Szrj 
542638fd1498Szrj   tree_to_poly_widest_ref to_poly_widest (const_tree);
542738fd1498Szrj   tree_to_poly_offset_ref to_poly_offset (const_tree);
542838fd1498Szrj   tree_to_poly_wide_ref to_poly_wide (const_tree);
542938fd1498Szrj 
543038fd1498Szrj   template <int N>
543138fd1498Szrj   struct ints_for <generic_wide_int <extended_tree <N> >, CONST_PRECISION>
543238fd1498Szrj   {
543338fd1498Szrj     typedef generic_wide_int <extended_tree <N> > extended;
543438fd1498Szrj     static extended zero (const extended &);
543538fd1498Szrj   };
543638fd1498Szrj 
543738fd1498Szrj   template <>
543838fd1498Szrj   struct ints_for <generic_wide_int <unextended_tree>, VAR_PRECISION>
543938fd1498Szrj   {
544038fd1498Szrj     typedef generic_wide_int <unextended_tree> unextended;
544138fd1498Szrj     static unextended zero (const unextended &);
544238fd1498Szrj   };
544338fd1498Szrj }
544438fd1498Szrj 
544538fd1498Szrj /* Refer to INTEGER_CST T as though it were a widest_int.
544638fd1498Szrj 
544738fd1498Szrj    This function gives T's actual numerical value, influenced by the
544838fd1498Szrj    signedness of its type.  For example, a signed byte with just the
544938fd1498Szrj    top bit set would be -128 while an unsigned byte with the same
545038fd1498Szrj    bit pattern would be 128.
545138fd1498Szrj 
545238fd1498Szrj    This is the right choice when operating on groups of INTEGER_CSTs
545338fd1498Szrj    that might have different signedness or precision.  It is also the
545438fd1498Szrj    right choice in code that specifically needs an approximation of
545538fd1498Szrj    infinite-precision arithmetic instead of normal modulo arithmetic.
545638fd1498Szrj 
545738fd1498Szrj    The approximation of infinite precision is good enough for realistic
545838fd1498Szrj    numbers of additions and subtractions of INTEGER_CSTs (where
545938fd1498Szrj    "realistic" includes any number less than 1 << 31) but it cannot
546038fd1498Szrj    represent the result of multiplying the two largest supported
546138fd1498Szrj    INTEGER_CSTs.  The overflow-checking form of wi::mul provides a way
546238fd1498Szrj    of multiplying two arbitrary INTEGER_CSTs and checking that the
546338fd1498Szrj    result is representable as a widest_int.
546438fd1498Szrj 
546538fd1498Szrj    Note that any overflow checking done on these values is relative to
546638fd1498Szrj    the range of widest_int rather than the range of a TREE_TYPE.
546738fd1498Szrj 
546838fd1498Szrj    Calling this function should have no overhead in release builds,
546938fd1498Szrj    so it is OK to call it several times for the same tree.  If it is
547038fd1498Szrj    useful for readability reasons to reduce the number of calls,
547138fd1498Szrj    it is more efficient to use:
547238fd1498Szrj 
547338fd1498Szrj      wi::tree_to_widest_ref wt = wi::to_widest (t);
547438fd1498Szrj 
547538fd1498Szrj    instead of:
547638fd1498Szrj 
547738fd1498Szrj      widest_int wt = wi::to_widest (t).  */
547838fd1498Szrj 
547938fd1498Szrj inline wi::tree_to_widest_ref
548038fd1498Szrj wi::to_widest (const_tree t)
548138fd1498Szrj {
548238fd1498Szrj   return t;
548338fd1498Szrj }
548438fd1498Szrj 
548538fd1498Szrj /* Refer to INTEGER_CST T as though it were an offset_int.
548638fd1498Szrj 
548738fd1498Szrj    This function is an optimisation of wi::to_widest for cases
548838fd1498Szrj    in which T is known to be a bit or byte count in the range
548938fd1498Szrj    (-(2 ^ (N + BITS_PER_UNIT)), 2 ^ (N + BITS_PER_UNIT)), where N is
549038fd1498Szrj    the target's address size in bits.
549138fd1498Szrj 
549238fd1498Szrj    This is the right choice when operating on bit or byte counts as
549338fd1498Szrj    untyped numbers rather than M-bit values.  The wi::to_widest comments
549438fd1498Szrj    about addition, subtraction and multiplication apply here: sequences
549538fd1498Szrj    of 1 << 31 additions and subtractions do not induce overflow, but
549638fd1498Szrj    multiplying the largest sizes might.  Again,
549738fd1498Szrj 
549838fd1498Szrj      wi::tree_to_offset_ref wt = wi::to_offset (t);
549938fd1498Szrj 
550038fd1498Szrj    is more efficient than:
550138fd1498Szrj 
550238fd1498Szrj      offset_int wt = wi::to_offset (t).  */
550338fd1498Szrj 
550438fd1498Szrj inline wi::tree_to_offset_ref
550538fd1498Szrj wi::to_offset (const_tree t)
550638fd1498Szrj {
550738fd1498Szrj   return t;
550838fd1498Szrj }
550938fd1498Szrj 
551038fd1498Szrj /* Refer to INTEGER_CST T as though it were a wide_int.
551138fd1498Szrj 
551238fd1498Szrj    In contrast to the approximation of infinite-precision numbers given
551338fd1498Szrj    by wi::to_widest and wi::to_offset, this function treats T as a
551438fd1498Szrj    signless collection of N bits, where N is the precision of T's type.
551538fd1498Szrj    As with machine registers, signedness is determined by the operation
551638fd1498Szrj    rather than the operands; for example, there is a distinction between
551738fd1498Szrj    signed and unsigned division.
551838fd1498Szrj 
551938fd1498Szrj    This is the right choice when operating on values with the same type
552038fd1498Szrj    using normal modulo arithmetic.  The overflow-checking forms of things
552138fd1498Szrj    like wi::add check whether the result can be represented in T's type.
552238fd1498Szrj 
552338fd1498Szrj    Calling this function should have no overhead in release builds,
552438fd1498Szrj    so it is OK to call it several times for the same tree.  If it is
552538fd1498Szrj    useful for readability reasons to reduce the number of calls,
552638fd1498Szrj    it is more efficient to use:
552738fd1498Szrj 
552838fd1498Szrj      wi::tree_to_wide_ref wt = wi::to_wide (t);
552938fd1498Szrj 
553038fd1498Szrj    instead of:
553138fd1498Szrj 
553238fd1498Szrj      wide_int wt = wi::to_wide (t).  */
553338fd1498Szrj 
553438fd1498Szrj inline wi::tree_to_wide_ref
553538fd1498Szrj wi::to_wide (const_tree t)
553638fd1498Szrj {
553738fd1498Szrj   return wi::storage_ref (&TREE_INT_CST_ELT (t, 0), TREE_INT_CST_NUNITS (t),
553838fd1498Szrj 			  TYPE_PRECISION (TREE_TYPE (t)));
553938fd1498Szrj }
554038fd1498Szrj 
554138fd1498Szrj /* Convert INTEGER_CST T to a wide_int of precision PREC, extending or
554238fd1498Szrj    truncating as necessary.  When extending, use sign extension if T's
554338fd1498Szrj    type is signed and zero extension if T's type is unsigned.  */
554438fd1498Szrj 
554538fd1498Szrj inline wide_int
554638fd1498Szrj wi::to_wide (const_tree t, unsigned int prec)
554738fd1498Szrj {
554838fd1498Szrj   return wide_int::from (wi::to_wide (t), prec, TYPE_SIGN (TREE_TYPE (t)));
554938fd1498Szrj }
555038fd1498Szrj 
555138fd1498Szrj template <int N>
555238fd1498Szrj inline wi::extended_tree <N>::extended_tree (const_tree t)
555338fd1498Szrj   : m_t (t)
555438fd1498Szrj {
555538fd1498Szrj   gcc_checking_assert (TYPE_PRECISION (TREE_TYPE (t)) <= N);
555638fd1498Szrj }
555738fd1498Szrj 
555838fd1498Szrj template <int N>
555938fd1498Szrj inline unsigned int
556038fd1498Szrj wi::extended_tree <N>::get_precision () const
556138fd1498Szrj {
556238fd1498Szrj   return N;
556338fd1498Szrj }
556438fd1498Szrj 
556538fd1498Szrj template <int N>
556638fd1498Szrj inline const HOST_WIDE_INT *
556738fd1498Szrj wi::extended_tree <N>::get_val () const
556838fd1498Szrj {
556938fd1498Szrj   return &TREE_INT_CST_ELT (m_t, 0);
557038fd1498Szrj }
557138fd1498Szrj 
557238fd1498Szrj template <int N>
557338fd1498Szrj inline unsigned int
557438fd1498Szrj wi::extended_tree <N>::get_len () const
557538fd1498Szrj {
557638fd1498Szrj   if (N == ADDR_MAX_PRECISION)
557738fd1498Szrj     return TREE_INT_CST_OFFSET_NUNITS (m_t);
557838fd1498Szrj   else if (N >= WIDE_INT_MAX_PRECISION)
557938fd1498Szrj     return TREE_INT_CST_EXT_NUNITS (m_t);
558038fd1498Szrj   else
558138fd1498Szrj     /* This class is designed to be used for specific output precisions
558238fd1498Szrj        and needs to be as fast as possible, so there is no fallback for
558338fd1498Szrj        other casees.  */
558438fd1498Szrj     gcc_unreachable ();
558538fd1498Szrj }
558638fd1498Szrj 
558738fd1498Szrj inline unsigned int
558838fd1498Szrj wi::unextended_tree::get_precision () const
558938fd1498Szrj {
559038fd1498Szrj   return TYPE_PRECISION (TREE_TYPE (m_t));
559138fd1498Szrj }
559238fd1498Szrj 
559338fd1498Szrj inline const HOST_WIDE_INT *
559438fd1498Szrj wi::unextended_tree::get_val () const
559538fd1498Szrj {
559638fd1498Szrj   return &TREE_INT_CST_ELT (m_t, 0);
559738fd1498Szrj }
559838fd1498Szrj 
559938fd1498Szrj inline unsigned int
560038fd1498Szrj wi::unextended_tree::get_len () const
560138fd1498Szrj {
560238fd1498Szrj   return TREE_INT_CST_NUNITS (m_t);
560338fd1498Szrj }
560438fd1498Szrj 
560538fd1498Szrj /* Return the value of a POLY_INT_CST in its native precision.  */
560638fd1498Szrj 
560738fd1498Szrj inline wi::tree_to_poly_wide_ref
560838fd1498Szrj poly_int_cst_value (const_tree x)
560938fd1498Szrj {
561038fd1498Szrj   poly_int <NUM_POLY_INT_COEFFS, generic_wide_int <wi::unextended_tree> > res;
561138fd1498Szrj   for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
561238fd1498Szrj     res.coeffs[i] = POLY_INT_CST_COEFF (x, i);
561338fd1498Szrj   return res;
561438fd1498Szrj }
561538fd1498Szrj 
561638fd1498Szrj /* Access INTEGER_CST or POLY_INT_CST tree T as if it were a
561738fd1498Szrj    poly_widest_int.  See wi::to_widest for more details.  */
561838fd1498Szrj 
561938fd1498Szrj inline wi::tree_to_poly_widest_ref
562038fd1498Szrj wi::to_poly_widest (const_tree t)
562138fd1498Szrj {
562238fd1498Szrj   if (POLY_INT_CST_P (t))
562338fd1498Szrj     {
562438fd1498Szrj       poly_int <NUM_POLY_INT_COEFFS,
562538fd1498Szrj 		generic_wide_int <widest_extended_tree> > res;
562638fd1498Szrj       for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
562738fd1498Szrj 	res.coeffs[i] = POLY_INT_CST_COEFF (t, i);
562838fd1498Szrj       return res;
562938fd1498Szrj     }
563038fd1498Szrj   return t;
563138fd1498Szrj }
563238fd1498Szrj 
563338fd1498Szrj /* Access INTEGER_CST or POLY_INT_CST tree T as if it were a
563438fd1498Szrj    poly_offset_int.  See wi::to_offset for more details.  */
563538fd1498Szrj 
563638fd1498Szrj inline wi::tree_to_poly_offset_ref
563738fd1498Szrj wi::to_poly_offset (const_tree t)
563838fd1498Szrj {
563938fd1498Szrj   if (POLY_INT_CST_P (t))
564038fd1498Szrj     {
564138fd1498Szrj       poly_int <NUM_POLY_INT_COEFFS,
564238fd1498Szrj 		generic_wide_int <offset_extended_tree> > res;
564338fd1498Szrj       for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
564438fd1498Szrj 	res.coeffs[i] = POLY_INT_CST_COEFF (t, i);
564538fd1498Szrj       return res;
564638fd1498Szrj     }
564738fd1498Szrj   return t;
564838fd1498Szrj }
564938fd1498Szrj 
565038fd1498Szrj /* Access INTEGER_CST or POLY_INT_CST tree T as if it were a
565138fd1498Szrj    poly_wide_int.  See wi::to_wide for more details.  */
565238fd1498Szrj 
565338fd1498Szrj inline wi::tree_to_poly_wide_ref
565438fd1498Szrj wi::to_poly_wide (const_tree t)
565538fd1498Szrj {
565638fd1498Szrj   if (POLY_INT_CST_P (t))
565738fd1498Szrj     return poly_int_cst_value (t);
565838fd1498Szrj   return t;
565938fd1498Szrj }
566038fd1498Szrj 
566138fd1498Szrj template <int N>
566238fd1498Szrj inline generic_wide_int <wi::extended_tree <N> >
566338fd1498Szrj wi::ints_for <generic_wide_int <wi::extended_tree <N> >,
566438fd1498Szrj 	      wi::CONST_PRECISION>::zero (const extended &x)
566538fd1498Szrj {
566638fd1498Szrj   return build_zero_cst (TREE_TYPE (x.get_tree ()));
566738fd1498Szrj }
566838fd1498Szrj 
566938fd1498Szrj inline generic_wide_int <wi::unextended_tree>
567038fd1498Szrj wi::ints_for <generic_wide_int <wi::unextended_tree>,
567138fd1498Szrj 	      wi::VAR_PRECISION>::zero (const unextended &x)
567238fd1498Szrj {
567338fd1498Szrj   return build_zero_cst (TREE_TYPE (x.get_tree ()));
567438fd1498Szrj }
567538fd1498Szrj 
567638fd1498Szrj namespace wi
567738fd1498Szrj {
567838fd1498Szrj   template <typename T>
567938fd1498Szrj   bool fits_to_boolean_p (const T &x, const_tree);
568038fd1498Szrj 
568138fd1498Szrj   template <typename T>
568238fd1498Szrj   bool fits_to_tree_p (const T &x, const_tree);
568338fd1498Szrj 
568438fd1498Szrj   wide_int min_value (const_tree);
568538fd1498Szrj   wide_int max_value (const_tree);
568638fd1498Szrj   wide_int from_mpz (const_tree, mpz_t, bool);
568738fd1498Szrj }
568838fd1498Szrj 
568938fd1498Szrj template <typename T>
569038fd1498Szrj bool
569138fd1498Szrj wi::fits_to_boolean_p (const T &x, const_tree type)
569238fd1498Szrj {
569338fd1498Szrj   typedef typename poly_int_traits<T>::int_type int_type;
569438fd1498Szrj   return (known_eq (x, int_type (0))
569538fd1498Szrj 	  || known_eq (x, int_type (TYPE_UNSIGNED (type) ? 1 : -1)));
569638fd1498Szrj }
569738fd1498Szrj 
569838fd1498Szrj template <typename T>
569938fd1498Szrj bool
570038fd1498Szrj wi::fits_to_tree_p (const T &x, const_tree type)
570138fd1498Szrj {
570238fd1498Szrj   /* Non-standard boolean types can have arbitrary precision but various
570338fd1498Szrj      transformations assume that they can only take values 0 and +/-1.  */
570438fd1498Szrj   if (TREE_CODE (type) == BOOLEAN_TYPE)
570538fd1498Szrj     return fits_to_boolean_p (x, type);
570638fd1498Szrj 
570738fd1498Szrj   if (TYPE_UNSIGNED (type))
570838fd1498Szrj     return known_eq (x, zext (x, TYPE_PRECISION (type)));
570938fd1498Szrj   else
571038fd1498Szrj     return known_eq (x, sext (x, TYPE_PRECISION (type)));
571138fd1498Szrj }
571238fd1498Szrj 
571338fd1498Szrj /* Produce the smallest number that is represented in TYPE.  The precision
571438fd1498Szrj    and sign are taken from TYPE.  */
571538fd1498Szrj inline wide_int
571638fd1498Szrj wi::min_value (const_tree type)
571738fd1498Szrj {
571838fd1498Szrj   return min_value (TYPE_PRECISION (type), TYPE_SIGN (type));
571938fd1498Szrj }
572038fd1498Szrj 
572138fd1498Szrj /* Produce the largest number that is represented in TYPE.  The precision
572238fd1498Szrj    and sign are taken from TYPE.  */
572338fd1498Szrj inline wide_int
572438fd1498Szrj wi::max_value (const_tree type)
572538fd1498Szrj {
572638fd1498Szrj   return max_value (TYPE_PRECISION (type), TYPE_SIGN (type));
572738fd1498Szrj }
572838fd1498Szrj 
572938fd1498Szrj /* Return true if INTEGER_CST T1 is less than INTEGER_CST T2,
573038fd1498Szrj    extending both according to their respective TYPE_SIGNs.  */
573138fd1498Szrj 
573238fd1498Szrj inline bool
573338fd1498Szrj tree_int_cst_lt (const_tree t1, const_tree t2)
573438fd1498Szrj {
573538fd1498Szrj   return wi::to_widest (t1) < wi::to_widest (t2);
573638fd1498Szrj }
573738fd1498Szrj 
573838fd1498Szrj /* Return true if INTEGER_CST T1 is less than or equal to INTEGER_CST T2,
573938fd1498Szrj    extending both according to their respective TYPE_SIGNs.  */
574038fd1498Szrj 
574138fd1498Szrj inline bool
574238fd1498Szrj tree_int_cst_le (const_tree t1, const_tree t2)
574338fd1498Szrj {
574438fd1498Szrj   return wi::to_widest (t1) <= wi::to_widest (t2);
574538fd1498Szrj }
574638fd1498Szrj 
574738fd1498Szrj /* Returns -1 if T1 < T2, 0 if T1 == T2, and 1 if T1 > T2.  T1 and T2
574838fd1498Szrj    are both INTEGER_CSTs and their values are extended according to their
574938fd1498Szrj    respective TYPE_SIGNs.  */
575038fd1498Szrj 
575138fd1498Szrj inline int
575238fd1498Szrj tree_int_cst_compare (const_tree t1, const_tree t2)
575338fd1498Szrj {
575438fd1498Szrj   return wi::cmps (wi::to_widest (t1), wi::to_widest (t2));
575538fd1498Szrj }
575638fd1498Szrj 
575738fd1498Szrj /* FIXME - These declarations belong in builtins.h, expr.h and emit-rtl.h,
575838fd1498Szrj    but none of these files are allowed to be included from front ends.
575938fd1498Szrj    They should be split in two. One suitable for the FEs, the other suitable
576038fd1498Szrj    for the BE.  */
576138fd1498Szrj 
576238fd1498Szrj /* Assign the RTX to declaration.  */
576338fd1498Szrj extern void set_decl_rtl (tree, rtx);
576438fd1498Szrj extern bool complete_ctor_at_level_p (const_tree, HOST_WIDE_INT, const_tree);
576538fd1498Szrj 
576638fd1498Szrj /* Given an expression EXP that is a handled_component_p,
576738fd1498Szrj    look for the ultimate containing object, which is returned and specify
576838fd1498Szrj    the access position and size.  */
576938fd1498Szrj extern tree get_inner_reference (tree, poly_int64_pod *, poly_int64_pod *,
577038fd1498Szrj 				 tree *, machine_mode *, int *, int *, int *);
577138fd1498Szrj 
577238fd1498Szrj extern tree build_personality_function (const char *);
577338fd1498Szrj 
577438fd1498Szrj struct GTY(()) int_n_trees_t {
577538fd1498Szrj   /* These parts are initialized at runtime */
577638fd1498Szrj   tree signed_type;
577738fd1498Szrj   tree unsigned_type;
577838fd1498Szrj };
577938fd1498Szrj 
578038fd1498Szrj /* This is also in machmode.h */
578138fd1498Szrj extern bool int_n_enabled_p[NUM_INT_N_ENTS];
578238fd1498Szrj extern GTY(()) struct int_n_trees_t int_n_trees[NUM_INT_N_ENTS];
578338fd1498Szrj 
578438fd1498Szrj /* Like bit_position, but return as an integer.  It must be representable in
578538fd1498Szrj    that way (since it could be a signed value, we don't have the
578638fd1498Szrj    option of returning -1 like int_size_in_byte can.  */
578738fd1498Szrj 
578838fd1498Szrj inline HOST_WIDE_INT
578938fd1498Szrj int_bit_position (const_tree field)
579038fd1498Szrj {
579138fd1498Szrj   return ((wi::to_offset (DECL_FIELD_OFFSET (field)) << LOG2_BITS_PER_UNIT)
579238fd1498Szrj 	  + wi::to_offset (DECL_FIELD_BIT_OFFSET (field))).to_shwi ();
579338fd1498Szrj }
579438fd1498Szrj 
579538fd1498Szrj /* Return true if it makes sense to consider alias set for a type T.  */
579638fd1498Szrj 
579738fd1498Szrj inline bool
579838fd1498Szrj type_with_alias_set_p (const_tree t)
579938fd1498Szrj {
580038fd1498Szrj   /* Function and method types are never accessed as memory locations.  */
580138fd1498Szrj   if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE)
580238fd1498Szrj     return false;
580338fd1498Szrj 
580438fd1498Szrj   if (COMPLETE_TYPE_P (t))
580538fd1498Szrj     return true;
580638fd1498Szrj 
580738fd1498Szrj   /* Incomplete types can not be accessed in general except for arrays
580838fd1498Szrj      where we can fetch its element despite we have no array bounds.  */
580938fd1498Szrj   if (TREE_CODE (t) == ARRAY_TYPE && COMPLETE_TYPE_P (TREE_TYPE (t)))
581038fd1498Szrj     return true;
581138fd1498Szrj 
581238fd1498Szrj   return false;
581338fd1498Szrj }
581438fd1498Szrj 
581538fd1498Szrj extern location_t set_block (location_t loc, tree block);
581638fd1498Szrj 
581738fd1498Szrj extern void gt_ggc_mx (tree &);
581838fd1498Szrj extern void gt_pch_nx (tree &);
581938fd1498Szrj extern void gt_pch_nx (tree &, gt_pointer_operator, void *);
582038fd1498Szrj 
582138fd1498Szrj extern bool nonnull_arg_p (const_tree);
582238fd1498Szrj extern bool is_redundant_typedef (const_tree);
582338fd1498Szrj extern bool default_is_empty_record (const_tree);
582438fd1498Szrj extern HOST_WIDE_INT arg_int_size_in_bytes (const_tree);
582538fd1498Szrj extern tree arg_size_in_bytes (const_tree);
582638fd1498Szrj extern bool expr_type_first_operand_type_p (tree_code);
582738fd1498Szrj 
582838fd1498Szrj extern location_t
582938fd1498Szrj set_source_range (tree expr, location_t start, location_t finish);
583038fd1498Szrj 
583138fd1498Szrj extern location_t
583238fd1498Szrj set_source_range (tree expr, source_range src_range);
583338fd1498Szrj 
583438fd1498Szrj static inline source_range
583538fd1498Szrj get_decl_source_range (tree decl)
583638fd1498Szrj {
583738fd1498Szrj   location_t loc = DECL_SOURCE_LOCATION (decl);
583838fd1498Szrj   return get_range_from_loc (line_table, loc);
583938fd1498Szrj }
584038fd1498Szrj 
584138fd1498Szrj /* Return true if it makes sense to promote/demote from_type to to_type. */
584238fd1498Szrj inline bool
584338fd1498Szrj desired_pro_or_demotion_p (const_tree to_type, const_tree from_type)
584438fd1498Szrj {
584538fd1498Szrj   unsigned int to_type_precision = TYPE_PRECISION (to_type);
584638fd1498Szrj 
584738fd1498Szrj   /* OK to promote if to_type is no bigger than word_mode. */
584838fd1498Szrj   if (to_type_precision <= GET_MODE_PRECISION (word_mode))
584938fd1498Szrj     return true;
585038fd1498Szrj 
585138fd1498Szrj   /* Otherwise, allow only if narrowing or same precision conversions. */
585238fd1498Szrj   return to_type_precision <= TYPE_PRECISION (from_type);
585338fd1498Szrj }
585438fd1498Szrj 
585538fd1498Szrj /* Pointer type used to declare builtins before we have seen its real
585638fd1498Szrj    declaration.  */
585738fd1498Szrj struct builtin_structptr_type
585838fd1498Szrj {
585938fd1498Szrj   tree& node;
586038fd1498Szrj   tree& base;
586138fd1498Szrj   const char *str;
586238fd1498Szrj };
586338fd1498Szrj extern const builtin_structptr_type builtin_structptr_types[6];
586438fd1498Szrj 
586538fd1498Szrj /* Return true if type T has the same precision as its underlying mode.  */
586638fd1498Szrj 
586738fd1498Szrj inline bool
586838fd1498Szrj type_has_mode_precision_p (const_tree t)
586938fd1498Szrj {
587038fd1498Szrj   return known_eq (TYPE_PRECISION (t), GET_MODE_PRECISION (TYPE_MODE (t)));
587138fd1498Szrj }
587238fd1498Szrj 
587338fd1498Szrj #endif  /* GCC_TREE_H  */
5874