call.c: Use VECTOR_TYPE_P.

* call.c: Use VECTOR_TYPE_P.
	* constexpr.c: Likewise.
	* cvt.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* init.c: Likewise.
	* semantics.c: Likewise.
	* tree.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.

From-SVN: r225099
This commit is contained in:
Marek Polacek 2015-06-27 10:40:21 +00:00 committed by Marek Polacek
parent 56a6f1d33f
commit b55b02ead4
11 changed files with 42 additions and 31 deletions

View File

@ -1,3 +1,16 @@
2015-06-27 Marek Polacek <polacek@redhat.com>
* call.c: Use VECTOR_TYPE_P.
* constexpr.c: Likewise.
* cvt.c: Likewise.
* decl.c: Likewise.
* decl2.c: Likewise.
* init.c: Likewise.
* semantics.c: Likewise.
* tree.c: Likewise.
* typeck.c: Likewise.
* typeck2.c: Likewise.
2015-06-27 Marek Polacek <polacek@redhat.com> 2015-06-27 Marek Polacek <polacek@redhat.com>
* call.c (set_up_extended_ref_temp): Use VAR_P. * call.c (set_up_extended_ref_temp): Use VAR_P.

View File

@ -4559,8 +4559,8 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
arg2_type = TREE_TYPE (arg2); arg2_type = TREE_TYPE (arg2);
arg3_type = TREE_TYPE (arg3); arg3_type = TREE_TYPE (arg3);
if (TREE_CODE (arg2_type) != VECTOR_TYPE if (!VECTOR_TYPE_P (arg2_type)
&& TREE_CODE (arg3_type) != VECTOR_TYPE) && !VECTOR_TYPE_P (arg3_type))
{ {
/* Rely on the error messages of the scalar version. */ /* Rely on the error messages of the scalar version. */
tree scal = build_conditional_expr_1 (loc, integer_one_node, tree scal = build_conditional_expr_1 (loc, integer_one_node,
@ -4612,8 +4612,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
arg3_type = vtype; arg3_type = vtype;
} }
if ((TREE_CODE (arg2_type) == VECTOR_TYPE) if (VECTOR_TYPE_P (arg2_type) != VECTOR_TYPE_P (arg3_type))
!= (TREE_CODE (arg3_type) == VECTOR_TYPE))
{ {
enum stv_conv convert_flag = enum stv_conv convert_flag =
scalar_to_vector (loc, VEC_COND_EXPR, arg2, arg3, scalar_to_vector (loc, VEC_COND_EXPR, arg2, arg3,

View File

@ -61,7 +61,7 @@ bool
literal_type_p (tree t) literal_type_p (tree t)
{ {
if (SCALAR_TYPE_P (t) if (SCALAR_TYPE_P (t)
|| TREE_CODE (t) == VECTOR_TYPE || VECTOR_TYPE_P (t)
|| TREE_CODE (t) == REFERENCE_TYPE || TREE_CODE (t) == REFERENCE_TYPE
|| (VOID_TYPE_P (t) && cxx_dialect >= cxx14)) || (VOID_TYPE_P (t) && cxx_dialect >= cxx14))
return true; return true;
@ -2101,7 +2101,7 @@ cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t,
/* We're done building this CONSTRUCTOR, so now we can interpret an /* We're done building this CONSTRUCTOR, so now we can interpret an
element without an explicit initializer as value-initialized. */ element without an explicit initializer as value-initialized. */
CONSTRUCTOR_NO_IMPLICIT_ZERO (t) = false; CONSTRUCTOR_NO_IMPLICIT_ZERO (t) = false;
if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) if (VECTOR_TYPE_P (TREE_TYPE (t)))
t = fold (t); t = fold (t);
return t; return t;
} }
@ -2289,7 +2289,7 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
(type, TREE_TYPE (optype)))) (type, TREE_TYPE (optype))))
return fold_build1_loc (loc, REALPART_EXPR, type, op); return fold_build1_loc (loc, REALPART_EXPR, type, op);
/* *(foo *)&vectorfoo => BIT_FIELD_REF<vectorfoo,...> */ /* *(foo *)&vectorfoo => BIT_FIELD_REF<vectorfoo,...> */
else if (TREE_CODE (optype) == VECTOR_TYPE else if (VECTOR_TYPE_P (optype)
&& (same_type_ignoring_top_level_qualifiers_p && (same_type_ignoring_top_level_qualifiers_p
(type, TREE_TYPE (optype)))) (type, TREE_TYPE (optype))))
{ {
@ -2335,7 +2335,7 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
op00type = TREE_TYPE (op00); op00type = TREE_TYPE (op00);
/* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF<vectorfoo,...> */ /* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF<vectorfoo,...> */
if (TREE_CODE (op00type) == VECTOR_TYPE if (VECTOR_TYPE_P (op00type)
&& (same_type_ignoring_top_level_qualifiers_p && (same_type_ignoring_top_level_qualifiers_p
(type, TREE_TYPE (op00type)))) (type, TREE_TYPE (op00type))))
{ {

View File

@ -708,7 +708,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
conversion. */ conversion. */
else if (TREE_CODE (type) == COMPLEX_TYPE) else if (TREE_CODE (type) == COMPLEX_TYPE)
return fold_if_not_in_template (convert_to_complex (type, e)); return fold_if_not_in_template (convert_to_complex (type, e));
else if (TREE_CODE (type) == VECTOR_TYPE) else if (VECTOR_TYPE_P (type))
return fold_if_not_in_template (convert_to_vector (type, e)); return fold_if_not_in_template (convert_to_vector (type, e));
else if (TREE_CODE (e) == TARGET_EXPR) else if (TREE_CODE (e) == TARGET_EXPR)
{ {

View File

@ -5392,7 +5392,7 @@ reshape_init_vector (tree type, reshape_iter *d, tsubst_flags_t complain)
{ {
tree max_index = NULL_TREE; tree max_index = NULL_TREE;
gcc_assert (TREE_CODE (type) == VECTOR_TYPE); gcc_assert (VECTOR_TYPE_P (type));
if (COMPOUND_LITERAL_P (d->cur->value)) if (COMPOUND_LITERAL_P (d->cur->value))
{ {
@ -5409,7 +5409,7 @@ reshape_init_vector (tree type, reshape_iter *d, tsubst_flags_t complain)
} }
/* For a vector, we initialize it as an array of the appropriate size. */ /* For a vector, we initialize it as an array of the appropriate size. */
if (TREE_CODE (type) == VECTOR_TYPE) if (VECTOR_TYPE_P (type))
max_index = size_int (TYPE_VECTOR_SUBPARTS (type) - 1); max_index = size_int (TYPE_VECTOR_SUBPARTS (type) - 1);
return reshape_init_array_1 (TREE_TYPE (type), max_index, d, complain); return reshape_init_array_1 (TREE_TYPE (type), max_index, d, complain);
@ -5717,7 +5717,7 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p,
return reshape_init_class (type, d, first_initializer_p, complain); return reshape_init_class (type, d, first_initializer_p, complain);
else if (TREE_CODE (type) == ARRAY_TYPE) else if (TREE_CODE (type) == ARRAY_TYPE)
return reshape_init_array (type, d, complain); return reshape_init_array (type, d, complain);
else if (TREE_CODE (type) == VECTOR_TYPE) else if (VECTOR_TYPE_P (type))
return reshape_init_vector (type, d, complain); return reshape_init_vector (type, d, complain);
else else
gcc_unreachable(); gcc_unreachable();
@ -5919,7 +5919,7 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups)
"not by %<{...}%>", "not by %<{...}%>",
decl); decl);
} }
else if (TREE_CODE (type) == VECTOR_TYPE && TYPE_VECTOR_OPAQUE (type)) else if (VECTOR_TYPE_P (type) && TYPE_VECTOR_OPAQUE (type))
{ {
error ("opaque vector types cannot be initialized"); error ("opaque vector types cannot be initialized");
init = error_mark_node; init = error_mark_node;

View File

@ -395,7 +395,7 @@ grok_array_decl (location_t loc, tree array_expr, tree index_exp,
It is a little-known fact that, if `a' is an array and `i' is It is a little-known fact that, if `a' is an array and `i' is
an int, you can write `i[a]', which means the same thing as an int, you can write `i[a]', which means the same thing as
`a[i]'. */ `a[i]'. */
if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == VECTOR_TYPE) if (TREE_CODE (type) == ARRAY_TYPE || VECTOR_TYPE_P (type))
p1 = array_expr; p1 = array_expr;
else else
p1 = build_expr_type_conversion (WANT_POINTER, array_expr, false); p1 = build_expr_type_conversion (WANT_POINTER, array_expr, false);

View File

@ -280,7 +280,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
/* Build a constructor to contain the initializations. */ /* Build a constructor to contain the initializations. */
init = build_constructor (type, v); init = build_constructor (type, v);
} }
else if (TREE_CODE (type) == VECTOR_TYPE) else if (VECTOR_TYPE_P (type))
init = build_zero_cst (type); init = build_zero_cst (type);
else else
gcc_assert (TREE_CODE (type) == REFERENCE_TYPE); gcc_assert (TREE_CODE (type) == REFERENCE_TYPE);

View File

@ -7357,7 +7357,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
gcc_assert (TREE_CODE (type) != REFERENCE_TYPE); gcc_assert (TREE_CODE (type) != REFERENCE_TYPE);
/* For vector types, pick a non-opaque variant. */ /* For vector types, pick a non-opaque variant. */
if (TREE_CODE (type) == VECTOR_TYPE) if (VECTOR_TYPE_P (type))
type = strip_typedefs (type); type = strip_typedefs (type);
if (clk != clk_none && !(clk & clk_class)) if (clk != clk_none && !(clk & clk_class))

View File

@ -3239,8 +3239,7 @@ scalarish_type_p (const_tree t)
if (t == error_mark_node) if (t == error_mark_node)
return 1; return 1;
return (SCALAR_TYPE_P (t) return (SCALAR_TYPE_P (t) || VECTOR_TYPE_P (t));
|| TREE_CODE (t) == VECTOR_TYPE);
} }
/* Returns true iff T requires non-trivial default initialization. */ /* Returns true iff T requires non-trivial default initialization. */

View File

@ -293,10 +293,10 @@ cp_common_type (tree t1, tree t2)
/* FIXME: Attributes. */ /* FIXME: Attributes. */
gcc_assert (ARITHMETIC_TYPE_P (t1) gcc_assert (ARITHMETIC_TYPE_P (t1)
|| TREE_CODE (t1) == VECTOR_TYPE || VECTOR_TYPE_P (t1)
|| UNSCOPED_ENUM_P (t1)); || UNSCOPED_ENUM_P (t1));
gcc_assert (ARITHMETIC_TYPE_P (t2) gcc_assert (ARITHMETIC_TYPE_P (t2)
|| TREE_CODE (t2) == VECTOR_TYPE || VECTOR_TYPE_P (t2)
|| UNSCOPED_ENUM_P (t2)); || UNSCOPED_ENUM_P (t2));
/* If one type is complex, form the common type of the non-complex /* If one type is complex, form the common type of the non-complex
@ -441,10 +441,10 @@ tree
type_after_usual_arithmetic_conversions (tree t1, tree t2) type_after_usual_arithmetic_conversions (tree t1, tree t2)
{ {
gcc_assert (ARITHMETIC_TYPE_P (t1) gcc_assert (ARITHMETIC_TYPE_P (t1)
|| TREE_CODE (t1) == VECTOR_TYPE || VECTOR_TYPE_P (t1)
|| UNSCOPED_ENUM_P (t1)); || UNSCOPED_ENUM_P (t1));
gcc_assert (ARITHMETIC_TYPE_P (t2) gcc_assert (ARITHMETIC_TYPE_P (t2)
|| TREE_CODE (t2) == VECTOR_TYPE || VECTOR_TYPE_P (t2)
|| UNSCOPED_ENUM_P (t2)); || UNSCOPED_ENUM_P (t2));
/* Perform the integral promotions. We do not promote real types here. */ /* Perform the integral promotions. We do not promote real types here. */
@ -6979,9 +6979,9 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
"is conditionally-supported"); "is conditionally-supported");
return fold_if_not_in_template (build_nop (type, expr)); return fold_if_not_in_template (build_nop (type, expr));
} }
else if (TREE_CODE (type) == VECTOR_TYPE) else if (VECTOR_TYPE_P (type))
return fold_if_not_in_template (convert_to_vector (type, expr)); return fold_if_not_in_template (convert_to_vector (type, expr));
else if (TREE_CODE (intype) == VECTOR_TYPE else if (VECTOR_TYPE_P (intype)
&& INTEGRAL_OR_ENUMERATION_TYPE_P (type)) && INTEGRAL_OR_ENUMERATION_TYPE_P (type))
return fold_if_not_in_template (convert_to_integer (type, expr)); return fold_if_not_in_template (convert_to_integer (type, expr));
else else
@ -8115,7 +8115,7 @@ convert_for_assignment (tree type, tree rhs,
rhstype = TREE_TYPE (rhs); rhstype = TREE_TYPE (rhs);
coder = TREE_CODE (rhstype); coder = TREE_CODE (rhstype);
if (TREE_CODE (type) == VECTOR_TYPE && coder == VECTOR_TYPE if (VECTOR_TYPE_P (type) && coder == VECTOR_TYPE
&& vector_types_convertible_p (type, rhstype, true)) && vector_types_convertible_p (type, rhstype, true))
{ {
rhs = mark_rvalue_use (rhs); rhs = mark_rvalue_use (rhs);
@ -8819,7 +8819,7 @@ comp_ptr_ttypes_real (tree to, tree from, int constp)
constp &= TYPE_READONLY (to); constp &= TYPE_READONLY (to);
} }
if (TREE_CODE (to) == VECTOR_TYPE) if (VECTOR_TYPE_P (to))
is_opaque_pointer = vector_targets_convertible_p (to, from); is_opaque_pointer = vector_targets_convertible_p (to, from);
if (!TYPE_PTR_P (to) && !TYPE_PTRDATAMEM_P (to)) if (!TYPE_PTR_P (to) && !TYPE_PTRDATAMEM_P (to))
@ -8900,7 +8900,7 @@ ptr_reasonably_similar (const_tree to, const_tree from)
COMPARE_BASE | COMPARE_DERIVED)) COMPARE_BASE | COMPARE_DERIVED))
continue; continue;
if (TREE_CODE (to) == VECTOR_TYPE if (VECTOR_TYPE_P (to)
&& vector_types_convertible_p (to, from, false)) && vector_types_convertible_p (to, from, false))
return true; return true;
@ -8942,7 +8942,7 @@ comp_ptr_ttypes_const (tree to, tree from)
TYPE_OFFSET_BASETYPE (to))) TYPE_OFFSET_BASETYPE (to)))
continue; continue;
if (TREE_CODE (to) == VECTOR_TYPE) if (VECTOR_TYPE_P (to))
is_opaque_pointer = vector_targets_convertible_p (to, from); is_opaque_pointer = vector_targets_convertible_p (to, from);
if (!TYPE_PTR_P (to)) if (!TYPE_PTR_P (to))

View File

@ -1083,7 +1083,7 @@ digest_init_r (tree type, tree init, bool nested, int flags,
/* Come here only for aggregates: records, arrays, unions, complex numbers /* Come here only for aggregates: records, arrays, unions, complex numbers
and vectors. */ and vectors. */
gcc_assert (TREE_CODE (type) == ARRAY_TYPE gcc_assert (TREE_CODE (type) == ARRAY_TYPE
|| TREE_CODE (type) == VECTOR_TYPE || VECTOR_TYPE_P (type)
|| TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == COMPLEX_TYPE); || TREE_CODE (type) == COMPLEX_TYPE);
@ -1236,7 +1236,7 @@ process_init_constructor_array (tree type, tree init,
vec<constructor_elt, va_gc> *v = CONSTRUCTOR_ELTS (init); vec<constructor_elt, va_gc> *v = CONSTRUCTOR_ELTS (init);
gcc_assert (TREE_CODE (type) == ARRAY_TYPE gcc_assert (TREE_CODE (type) == ARRAY_TYPE
|| TREE_CODE (type) == VECTOR_TYPE); || VECTOR_TYPE_P (type));
if (TREE_CODE (type) == ARRAY_TYPE) if (TREE_CODE (type) == ARRAY_TYPE)
{ {
@ -1572,7 +1572,7 @@ process_init_constructor (tree type, tree init, tsubst_flags_t complain)
gcc_assert (BRACE_ENCLOSED_INITIALIZER_P (init)); gcc_assert (BRACE_ENCLOSED_INITIALIZER_P (init));
if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == VECTOR_TYPE) if (TREE_CODE (type) == ARRAY_TYPE || VECTOR_TYPE_P (type))
flags = process_init_constructor_array (type, init, complain); flags = process_init_constructor_array (type, init, complain);
else if (TREE_CODE (type) == RECORD_TYPE) else if (TREE_CODE (type) == RECORD_TYPE)
flags = process_init_constructor_record (type, init, complain); flags = process_init_constructor_record (type, init, complain);