aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-common.c16
-rw-r--r--gcc/c-family/c-gimplify.c2
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/c/c-typeck.c19
5 files changed, 27 insertions, 20 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 512af7c..ffad035 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-27 Marek Polacek <polacek@redhat.com>
+
+ * c-common.c (check_main_parameter_types): Use VECTOR_TYPE_P
+ or VECTOR_INTEGER_TYPE_P throughout.
+ * c-gimplify.c: Likewise.
+
2015-06-26 Marek Polacek <polacek@redhat.com>
* array-notation-common.c (find_rank): Use INDIRECT_REF_P.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 5cc65ec..06d2abc 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -2412,7 +2412,7 @@ check_main_parameter_types (tree decl)
bool
vector_targets_convertible_p (const_tree t1, const_tree t2)
{
- if (TREE_CODE (t1) == VECTOR_TYPE && TREE_CODE (t2) == VECTOR_TYPE
+ if (VECTOR_TYPE_P (t1) && VECTOR_TYPE_P (t2)
&& (TYPE_VECTOR_OPAQUE (t1) || TYPE_VECTOR_OPAQUE (t2))
&& tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2)))
return true;
@@ -2500,8 +2500,7 @@ c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask,
|| mask == error_mark_node)
return error_mark_node;
- if (TREE_CODE (TREE_TYPE (mask)) != VECTOR_TYPE
- || TREE_CODE (TREE_TYPE (TREE_TYPE (mask))) != INTEGER_TYPE)
+ if (!VECTOR_INTEGER_TYPE_P (TREE_TYPE (mask)))
{
if (complain)
error_at (loc, "__builtin_shuffle last argument must "
@@ -2509,8 +2508,8 @@ c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask,
return error_mark_node;
}
- if (TREE_CODE (TREE_TYPE (v0)) != VECTOR_TYPE
- || TREE_CODE (TREE_TYPE (v1)) != VECTOR_TYPE)
+ if (!VECTOR_TYPE_P (TREE_TYPE (v0))
+ || !VECTOR_TYPE_P (TREE_TYPE (v1)))
{
if (complain)
error_at (loc, "__builtin_shuffle arguments must be vectors");
@@ -12482,7 +12481,7 @@ convert_vector_to_pointer_for_subscript (location_t loc,
tree *vecp, tree index)
{
bool ret = false;
- if (TREE_CODE (TREE_TYPE (*vecp)) == VECTOR_TYPE)
+ if (VECTOR_TYPE_P (TREE_TYPE (*vecp)))
{
tree type = TREE_TYPE (*vecp);
tree type1;
@@ -12548,8 +12547,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
bool integer_only_op = false;
enum stv_conv ret = stv_firstarg;
- gcc_assert (TREE_CODE (type0) == VECTOR_TYPE
- || TREE_CODE (type1) == VECTOR_TYPE);
+ gcc_assert (VECTOR_TYPE_P (type0) || VECTOR_TYPE_P (type1));
switch (code)
{
/* Most GENERIC binary expressions require homogeneous arguments.
@@ -12599,7 +12597,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
case LT_EXPR:
case GT_EXPR:
/* What about UNLT_EXPR? */
- if (TREE_CODE (type0) == VECTOR_TYPE)
+ if (VECTOR_TYPE_P (type0))
{
ret = stv_secondarg;
std::swap (type0, type1);
diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c
index 317891f..98a6d53 100644
--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -248,7 +248,7 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
We should get rid of this conversion when we have a proper
type demotion/promotion pass. */
tree *op1_p = &TREE_OPERAND (*expr_p, 1);
- if (TREE_CODE (TREE_TYPE (*op1_p)) != VECTOR_TYPE
+ if (!VECTOR_TYPE_P (TREE_TYPE (*op1_p))
&& !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
unsigned_type_node)
&& !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index f682902..edba3f1 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-27 Marek Polacek <polacek@redhat.com>
+
+ * c-typeck.c: Use VECTOR_TYPE_P throughout.
+
2015-06-26 Marek Polacek <polacek@redhat.com>
* c-array-notation.c (fix_builtin_array_notation_fn): Use
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 60d6ed8..8e2696a 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -2457,7 +2457,7 @@ build_array_ref (location_t loc, tree array, tree index)
if (TREE_CODE (TREE_TYPE (array)) != ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (array)) != POINTER_TYPE
/* Allow vector[index] but not index[vector]. */
- && TREE_CODE (TREE_TYPE (array)) != VECTOR_TYPE)
+ && !VECTOR_TYPE_P (TREE_TYPE (array)))
{
if (TREE_CODE (TREE_TYPE (index)) != ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (index)) != POINTER_TYPE)
@@ -6729,7 +6729,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
vector constructor is not constant (e.g. {1,2,3,foo()}) then punt
below and handle as a constructor. */
if (code == VECTOR_TYPE
- && TREE_CODE (TREE_TYPE (inside_init)) == VECTOR_TYPE
+ && VECTOR_TYPE_P (TREE_TYPE (inside_init))
&& vector_types_convertible_p (TREE_TYPE (inside_init), type, true)
&& TREE_CONSTANT (inside_init))
{
@@ -7180,7 +7180,7 @@ really_start_incremental_init (tree type)
if (type == 0)
type = TREE_TYPE (constructor_decl);
- if (TREE_CODE (type) == VECTOR_TYPE
+ if (VECTOR_TYPE_P (type)
&& TYPE_VECTOR_OPAQUE (type))
error ("opaque vector types cannot be initialized");
@@ -7266,7 +7266,7 @@ really_start_incremental_init (tree type)
constructor_unfilled_index = constructor_index;
}
- else if (TREE_CODE (constructor_type) == VECTOR_TYPE)
+ else if (VECTOR_TYPE_P (constructor_type))
{
/* Vectors are like simple fixed-size arrays. */
constructor_max_index =
@@ -7439,7 +7439,7 @@ push_init_level (location_t loc, int implicit,
constructor_unfilled_fields = constructor_fields;
constructor_bit_index = bitsize_zero_node;
}
- else if (TREE_CODE (constructor_type) == VECTOR_TYPE)
+ else if (VECTOR_TYPE_P (constructor_type))
{
/* Vectors are like simple fixed-size arrays. */
constructor_max_index =
@@ -7619,7 +7619,7 @@ pop_init_level (location_t loc, int implicit,
else if (TREE_CODE (constructor_type) != RECORD_TYPE
&& TREE_CODE (constructor_type) != UNION_TYPE
&& TREE_CODE (constructor_type) != ARRAY_TYPE
- && TREE_CODE (constructor_type) != VECTOR_TYPE)
+ && !VECTOR_TYPE_P (constructor_type))
{
/* A nonincremental scalar initializer--just return
the element, after verifying there is just one. */
@@ -8769,7 +8769,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
pop_init_level (loc, 1, braced_init_obstack),
true, braced_init_obstack);
else if ((TREE_CODE (constructor_type) == ARRAY_TYPE
- || TREE_CODE (constructor_type) == VECTOR_TYPE)
+ || VECTOR_TYPE_P (constructor_type))
&& constructor_max_index
&& tree_int_cst_lt (constructor_max_index,
constructor_index))
@@ -9039,7 +9039,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
constructor_unfilled_index. */
constructor_unfilled_index = constructor_index;
}
- else if (TREE_CODE (constructor_type) == VECTOR_TYPE)
+ else if (VECTOR_TYPE_P (constructor_type))
{
tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
@@ -10302,8 +10302,7 @@ build_binary_op (location_t location, enum tree_code code,
/* Do not apply default conversion in mixed vector/scalar expression. */
if (convert_p
- && !((TREE_CODE (TREE_TYPE (op0)) == VECTOR_TYPE)
- != (TREE_CODE (TREE_TYPE (op1)) == VECTOR_TYPE)))
+ && VECTOR_TYPE_P (TREE_TYPE (op0)) == VECTOR_TYPE_P (TREE_TYPE (op1)))
{
op0 = default_conversion (op0);
op1 = default_conversion (op1);