@@ -785,7 +785,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
if ((TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE
&& No (gnat_renamed_obj))
|| TYPE_IS_DUMMY_P (gnu_type)
- || TREE_CODE (gnu_type) == VOID_TYPE)
+ || VOID_TYPE_P (gnu_type))
{
gcc_assert (type_annotate_only);
if (this_global)
@@ -840,7 +840,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
if (TREE_CODE (gnu_expr) == COMPONENT_REF
&& TYPE_IS_PADDING_P
(TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))
- && TREE_CODE (TREE_OPERAND (gnu_expr, 0)) == VAR_DECL
+ && VAR_P (TREE_OPERAND (gnu_expr, 0))
&& (TREE_READONLY (TREE_OPERAND (gnu_expr, 0))
|| DECL_READONLY_ONCE_ELAB
(TREE_OPERAND (gnu_expr, 0))))
@@ -1077,7 +1077,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* We need to detect the case where a temporary is created to
hold the return value, since we cannot safely rename it at
top level as it lives only in the elaboration routine. */
- || (TREE_CODE (inner) == VAR_DECL
+ || (VAR_P (inner)
&& DECL_RETURN_VALUE_P (inner))
/* We also need to detect the case where the front-end creates
a dangling 'reference to a function call at top level and
@@ -1093,10 +1093,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
We cannot safely rename the rewritten expression since the
underlying object lives only in the elaboration routine. */
- || (TREE_CODE (inner) == INDIRECT_REF
+ || (INDIRECT_REF_P (inner)
&& (inner
= remove_conversions (TREE_OPERAND (inner, 0), true))
- && TREE_CODE (inner) == VAR_DECL
+ && VAR_P (inner)
&& DECL_RETURN_VALUE_P (inner)))
;
@@ -1611,7 +1611,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
and optimization isn't enabled, then force it in memory so that
a register won't be allocated to it with possible subparts left
uninitialized and reaching the register allocator. */
- else if (TREE_CODE (gnu_decl) == VAR_DECL
+ else if (VAR_P (gnu_decl)
&& !DECL_EXTERNAL (gnu_decl)
&& !TREE_STATIC (gnu_decl)
&& DECL_MODE (gnu_decl) != BLKmode
@@ -6717,8 +6717,7 @@ range_cannot_be_superflat (Node_Id gnat_range)
static bool
constructor_address_p (tree gnu_expr)
{
- while (TREE_CODE (gnu_expr) == NOP_EXPR
- || TREE_CODE (gnu_expr) == CONVERT_EXPR
+ while (CONVERT_EXPR_P (gnu_expr)
|| TREE_CODE (gnu_expr) == NON_LVALUE_EXPR)
gnu_expr = TREE_OPERAND (gnu_expr, 0);
@@ -7061,7 +7060,7 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, const char *s,
expr_variable_p
= !(inner
- && TREE_CODE (inner) == VAR_DECL
+ && VAR_P (inner)
&& (TREE_READONLY (inner) || DECL_READONLY_ONCE_ELAB (inner)));
}
@@ -1241,7 +1241,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
/* Do the final dereference. */
gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
- if ((TREE_CODE (gnu_result) == INDIRECT_REF
+ if ((INDIRECT_REF_P (gnu_result)
|| TREE_CODE (gnu_result) == UNCONSTRAINED_ARRAY_REF)
&& No (Address_Clause (gnat_entity)))
TREE_THIS_NOTRAP (gnu_result) = 1;
@@ -3391,7 +3391,7 @@ struct nrv_data
static inline bool
is_nrv_p (bitmap nrv, tree t)
{
- return TREE_CODE (t) == VAR_DECL && bitmap_bit_p (nrv, DECL_UID (t));
+ return VAR_P (t) && bitmap_bit_p (nrv, DECL_UID (t));
}
/* Helper function for walk_tree, used by finalize_nrv below. */
@@ -4136,7 +4136,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnat_param = Next_Formal_With_Extras (gnat_param))
{
tree gnu_param = get_gnu_tree (gnat_param);
- bool is_var_decl = (TREE_CODE (gnu_param) == VAR_DECL);
+ bool is_var_decl = VAR_P (gnu_param);
annotate_object (gnat_param, TREE_TYPE (gnu_param), NULL_TREE,
DECL_BY_REF_P (gnu_param));
@@ -6908,7 +6908,7 @@ gnat_to_gnu (Node_Id gnat_node)
&& TYPE_CONTAINS_TEMPLATE_P (gnu_result_type))
gnu_aggr_type
= TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_result_type)));
- else if (TREE_CODE (gnu_result_type) == VECTOR_TYPE)
+ else if (VECTOR_TYPE_P (gnu_result_type))
gnu_aggr_type = TYPE_REPRESENTATIVE_ARRAY (gnu_result_type);
else
gnu_aggr_type = gnu_result_type;
@@ -7740,7 +7740,7 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result = build2 (INIT_EXPR, void_type_node,
gnu_ret_deref, gnu_ret_val);
/* Avoid a useless copy with __builtin_return_slot. */
- if (TREE_CODE (gnu_ret_val) == INDIRECT_REF)
+ if (INDIRECT_REF_P (gnu_ret_val))
gnu_result
= build3 (COND_EXPR, void_type_node,
fold_build2 (NE_EXPR, boolean_type_node,
@@ -8415,7 +8415,7 @@ gnat_to_gnu (Node_Id gnat_node)
/* If we're supposed to return something of void_type, it means we have
something we're elaborating for effect, so just return. */
- if (TREE_CODE (gnu_result_type) == VOID_TYPE)
+ if (VOID_TYPE_P (gnu_result_type))
return gnu_result;
/* If the result is a constant that overflowed, raise Constraint_Error. */
@@ -8588,7 +8588,7 @@ gnat_to_gnu_external (Node_Id gnat_node)
current_function_decl = NULL_TREE;
/* Do not import locations from external units. */
- if (gnu_result && EXPR_P (gnu_result))
+ if (CAN_HAVE_LOCATION_P (gnu_result))
SET_EXPR_LOCATION (gnu_result, UNKNOWN_LOCATION);
return gnu_result;
@@ -8722,7 +8722,7 @@ add_decl_expr (tree gnu_decl, Node_Id gnat_node)
Note that walk_tree knows how to deal with TYPE_DECL, but neither
VAR_DECL nor CONST_DECL. This appears to be somewhat arbitrary. */
MARK_VISITED (gnu_stmt);
- if (TREE_CODE (gnu_decl) == VAR_DECL
+ if (VAR_P (gnu_decl)
|| TREE_CODE (gnu_decl) == CONST_DECL)
{
MARK_VISITED (DECL_SIZE (gnu_decl));
@@ -8739,7 +8739,7 @@ add_decl_expr (tree gnu_decl, Node_Id gnat_node)
&& !TYPE_FAT_POINTER_P (type))
MARK_VISITED (TYPE_ADA_SIZE (type));
- if (TREE_CODE (gnu_decl) == VAR_DECL && (gnu_init = DECL_INITIAL (gnu_decl)))
+ if (VAR_P (gnu_decl) && (gnu_init = DECL_INITIAL (gnu_decl)))
{
/* If this is a variable and an initializer is attached to it, it must be
valid for the context. Similar to init_const in create_var_decl. */
@@ -9000,7 +9000,7 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
/* The expressions for the RM bounds must be gimplified to ensure that
they are properly elaborated. See gimplify_decl_expr. */
- if ((TREE_CODE (op) == TYPE_DECL || TREE_CODE (op) == VAR_DECL)
+ if ((TREE_CODE (op) == TYPE_DECL || VAR_P (op))
&& !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (op))
&& (INTEGRAL_TYPE_P (TREE_TYPE (op))
|| SCALAR_FLOAT_TYPE_P (TREE_TYPE (op))))
@@ -1966,7 +1966,7 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
bool debug_info_p)
{
const enum tree_code orig_code = TREE_CODE (record_type);
- const bool had_size = TYPE_SIZE (record_type) != NULL_TREE;
+ const bool had_size = COMPLETE_TYPE_P (record_type);
const bool had_align = TYPE_ALIGN (record_type) > 0;
/* For all-repped records with a size specified, lay the QUAL_UNION_TYPE
out just like a UNION_TYPE, since the size will be fixed. */
@@ -2802,7 +2802,7 @@ create_var_decl (tree name, tree asm_name, tree type, tree init,
if (TREE_CODE (inner) == ADDR_EXPR
&& ((TREE_CODE (TREE_OPERAND (inner, 0)) == CALL_EXPR
&& !call_is_atomic_load (TREE_OPERAND (inner, 0)))
- || (TREE_CODE (TREE_OPERAND (inner, 0)) == VAR_DECL
+ || (VAR_P (TREE_OPERAND (inner, 0))
&& DECL_RETURN_VALUE_P (TREE_OPERAND (inner, 0)))))
DECL_RETURN_VALUE_P (var_decl) = 1;
}
@@ -2853,7 +2853,7 @@ create_var_decl (tree name, tree asm_name, tree type, tree init,
support global BSS sections, uninitialized global variables would
go in DATA instead, thus increasing the size of the executable. */
if (!flag_no_common
- && TREE_CODE (var_decl) == VAR_DECL
+ && VAR_P (var_decl)
&& TREE_PUBLIC (var_decl)
&& !have_global_bss_p ())
DECL_COMMON (var_decl) = 1;
@@ -2871,13 +2871,13 @@ create_var_decl (tree name, tree asm_name, tree type, tree init,
DECL_IGNORED_P (var_decl) = 1;
/* ??? Some attributes cannot be applied to CONST_DECLs. */
- if (TREE_CODE (var_decl) == VAR_DECL)
+ if (VAR_P (var_decl))
process_attributes (&var_decl, &attr_list, true, gnat_node);
/* Add this decl to the current binding level. */
gnat_pushdecl (var_decl, gnat_node);
- if (TREE_CODE (var_decl) == VAR_DECL && asm_name)
+ if (VAR_P (var_decl) && asm_name)
{
/* Let the target mangle the name if this isn't a verbatim asm. */
if (*IDENTIFIER_POINTER (asm_name) != '*')
@@ -68,7 +68,7 @@ get_base_type (tree type)
while (TREE_TYPE (type)
&& (TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == REAL_TYPE))
+ || SCALAR_FLOAT_TYPE_P (type)))
type = TREE_TYPE (type);
return type;
@@ -986,7 +986,7 @@ build_binary_op (enum tree_code op_code, tree result_type,
break;
}
- gcc_assert (TREE_CODE (result) == INDIRECT_REF
+ gcc_assert (INDIRECT_REF_P (result)
|| TREE_CODE (result) == NULL_EXPR
|| TREE_CODE (result) == SAVE_EXPR
|| DECL_P (result));
@@ -1423,7 +1423,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
the corresponding address, e.g. for an allocator. However do
it for a return value to expose it for later recognition. */
if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE
- || (TREE_CODE (TREE_OPERAND (operand, 1)) == VAR_DECL
+ || (VAR_P (TREE_OPERAND (operand, 1))
&& DECL_RETURN_VALUE_P (TREE_OPERAND (operand, 1))))
{
result = build_unary_op (ADDR_EXPR, result_type,
@@ -1597,11 +1597,11 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
if (!TYPE_IS_FAT_POINTER_P (type) && TYPE_VOLATILE (TREE_TYPE (type)))
{
TREE_SIDE_EFFECTS (result) = 1;
- if (TREE_CODE (result) == INDIRECT_REF)
+ if (INDIRECT_REF_P (result))
TREE_THIS_VOLATILE (result) = TYPE_VOLATILE (TREE_TYPE (result));
}
- if ((TREE_CODE (result) == INDIRECT_REF
+ if ((INDIRECT_REF_P (result)
|| TREE_CODE (result) == UNCONSTRAINED_ARRAY_REF)
&& can_never_be_null)
TREE_THIS_NOTRAP (result) = 1;
@@ -2926,7 +2926,7 @@ gnat_protect_expr (tree exp)
/* Likewise if we're indirectly referencing part of something. */
if (code == COMPONENT_REF
- && TREE_CODE (TREE_OPERAND (exp, 0)) == INDIRECT_REF)
+ && INDIRECT_REF_P (TREE_OPERAND (exp, 0)))
return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)),
TREE_OPERAND (exp, 1), NULL_TREE);
@@ -3263,7 +3263,7 @@ gnat_invariant_expr (tree expr)
/* Look through temporaries created to capture values. */
while ((TREE_CODE (expr) == CONST_DECL
- || (TREE_CODE (expr) == VAR_DECL && TREE_READONLY (expr)))
+ || (VAR_P (expr) && TREE_READONLY (expr)))
&& decl_function_context (expr) == current_function_decl
&& DECL_INITIAL (expr))
{
@@ -3362,7 +3362,7 @@ object:
if (TREE_CODE (t) == PARM_DECL)
return fold_convert (type, expr);
- if (TREE_CODE (t) == VAR_DECL
+ if (VAR_P (t)
&& (DECL_EXTERNAL (t)
|| decl_function_context (t) != current_function_decl))
return fold_convert (type, expr);