aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index dc4a82e..df7cb03 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5461,10 +5461,11 @@ categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts,
case VECTOR_CST:
{
- tree v;
- for (v = TREE_VECTOR_CST_ELTS (value); v; v = TREE_CHAIN (v))
+ unsigned i;
+ for (i = 0; i < VECTOR_CST_NELTS (value); ++i)
{
- if (!initializer_zerop (TREE_VALUE (v)))
+ tree v = VECTOR_CST_ELT (value, i);
+ if (!initializer_zerop (v))
nz_elts += mult;
init_elts += mult;
}
@@ -9122,8 +9123,14 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
tmp = fold_unary_loc (loc, VIEW_CONVERT_EXPR, type_for_mode, exp);
}
if (!tmp)
- tmp = build_constructor_from_list (type,
- TREE_VECTOR_CST_ELTS (exp));
+ {
+ VEC(constructor_elt,gc) *v;
+ unsigned i;
+ v = VEC_alloc (constructor_elt, gc, VECTOR_CST_NELTS (exp));
+ for (i = 0; i < VECTOR_CST_NELTS (exp); ++i)
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, VECTOR_CST_ELT (exp, i));
+ tmp = build_constructor (type, v);
+ }
return expand_expr (tmp, ignore ? const0_rtx : target,
tmode, modifier);
}
@@ -10767,8 +10774,9 @@ static rtx
const_vector_from_tree (tree exp)
{
rtvec v;
- int units, i;
- tree link, elt;
+ unsigned i;
+ int units;
+ tree elt;
enum machine_mode inner, mode;
mode = TYPE_MODE (TREE_TYPE (exp));
@@ -10781,10 +10789,9 @@ const_vector_from_tree (tree exp)
v = rtvec_alloc (units);
- link = TREE_VECTOR_CST_ELTS (exp);
- for (i = 0; link; link = TREE_CHAIN (link), ++i)
+ for (i = 0; i < VECTOR_CST_NELTS (exp); ++i)
{
- elt = TREE_VALUE (link);
+ elt = VECTOR_CST_ELT (exp, i);
if (TREE_CODE (elt) == REAL_CST)
RTVEC_ELT (v, i) = CONST_DOUBLE_FROM_REAL_VALUE (TREE_REAL_CST (elt),
@@ -10797,10 +10804,6 @@ const_vector_from_tree (tree exp)
inner);
}
- /* Initialize remaining elements to 0. */
- for (; i < units; ++i)
- RTVEC_ELT (v, i) = CONST0_RTX (inner);
-
return gen_rtx_CONST_VECTOR (mode, v);
}