diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-07 18:40:50 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-07 18:40:50 +0000 |
commit | 5ebaa4774fb6de458422c660ae11f1c3b7d96262 (patch) | |
tree | 7f5cb9043bbc4cb3bbc2359234b0e6bd0eb216f1 /gcc/tree.c | |
parent | 734914b6e230b78eb6c34fbd5a2d93b1a919d36a (diff) | |
download | gcc-5ebaa4774fb6de458422c660ae11f1c3b7d96262.zip gcc-5ebaa4774fb6de458422c660ae11f1c3b7d96262.tar.gz gcc-5ebaa4774fb6de458422c660ae11f1c3b7d96262.tar.bz2 |
Use tree_vector_builder instead of build_vector
This patch switches most build_vector calls over to tree_vector_builder,
using explicit encodings where appropriate. Later patches handle
the remaining uses of build_vector.
2017-12-07 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* config/sparc/sparc.c: Include tree-vector-builder.h.
(sparc_fold_builtin): Use tree_vector_builder instead of build_vector.
* expmed.c: Include tree-vector-builder.h.
(make_tree): Use tree_vector_builder instead of build_vector.
* fold-const.c: Include tree-vector-builder.h.
(const_binop): Use tree_vector_builder instead of build_vector.
(const_unop): Likewise.
(native_interpret_vector): Likewise.
(fold_vec_perm): Likewise.
(fold_ternary_loc): Likewise.
* gimple-fold.c: Include tree-vector-builder.h.
(gimple_fold_stmt_to_constant_1): Use tree_vector_builder instead
of build_vector.
* tree-ssa-forwprop.c: Include tree-vector-builder.h.
(simplify_vector_constructor): Use tree_vector_builder instead
of build_vector.
* tree-vect-generic.c: Include tree-vector-builder.h.
(add_rshift): Use tree_vector_builder instead of build_vector.
(expand_vector_divmod): Likewise.
(optimize_vector_constructor): Likewise.
* tree-vect-loop.c: Include tree-vector-builder.h.
(vect_create_epilog_for_reduction): Use tree_vector_builder instead
of build_vector. Explicitly use a stepped encoding for
{ 1, 2, 3, ... }.
* tree-vect-slp.c: Include tree-vector-builder.h.
(vect_get_constant_vectors): Use tree_vector_builder instead
of build_vector.
(vect_transform_slp_perm_load): Likewise.
(vect_schedule_slp_instance): Likewise.
* tree-vect-stmts.c: Include tree-vector-builder.h.
(vectorizable_bswap): Use tree_vector_builder instead of build_vector.
(vect_gen_perm_mask_any): Likewise.
(vectorizable_call): Likewise. Explicitly use a stepped encoding.
* tree.c: (build_vector_from_ctor): Use tree_vector_builder instead
of build_vector.
(build_vector_from_val): Likewise. Explicitly use a duplicate
encoding.
From-SVN: r255475
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -1757,7 +1757,7 @@ build_vector_from_ctor (tree type, vec<constructor_elt, va_gc> *v) unsigned HOST_WIDE_INT idx; tree value; - auto_vec<tree, 32> vec (nelts); + tree_vector_builder vec (type, nelts, 1); FOR_EACH_CONSTRUCTOR_VALUE (v, idx, value) { if (TREE_CODE (value) == VECTOR_CST) @@ -1769,7 +1769,7 @@ build_vector_from_ctor (tree type, vec<constructor_elt, va_gc> *v) while (vec.length () < nelts) vec.quick_push (build_zero_cst (TREE_TYPE (type))); - return build_vector (type, vec); + return vec.build (); } /* Build a vector of type VECTYPE where all the elements are SCs. */ @@ -1792,10 +1792,9 @@ build_vector_from_val (tree vectype, tree sc) if (CONSTANT_CLASS_P (sc)) { - auto_vec<tree, 32> v (nunits); - for (i = 0; i < nunits; ++i) - v.quick_push (sc); - return build_vector (vectype, v); + tree_vector_builder v (vectype, 1, 1); + v.quick_push (sc); + return v.build (); } else { |