Message ID | 87r2s798sj.fsf_-_@linaro.org |
---|---|
State | Accepted |
Commit | 44e1aae4dbd8198a26ab0ec5958e073e2c9cc772 |
Headers | show |
Series | Make build_vector static | expand |
On Wed, Dec 6, 2017 at 4:26 PM, Richard Sandiford <richard.sandiford@linaro.org> wrote: > After the previous patches, the only remaining uses of build_vector are > in the selftests in tree.c. This patch makes it static and moves it to > the selftest part of the file. > > Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu. > Also spot-checked on sparc64-linux-gnu. OK to install? Ok. Richard. > Thanks, > Richard > > > 2017-12-06 Richard Sandiford <richard.sandiford@linaro.org> > > gcc/ > * tree.c (build_vector): Delete. > * tree.h (build_vector): Make static and move into the self-testing > block. > > Index: gcc/tree.c > =================================================================== > --- gcc/tree.c 2017-12-06 14:48:52.891162052 +0000 > +++ gcc/tree.c 2017-12-06 14:49:10.295445836 +0000 > @@ -1736,18 +1736,6 @@ make_vector (unsigned log2_npatterns, > } > > /* Return a new VECTOR_CST node whose type is TYPE and whose values > - are given by VALS. */ > - > -tree > -build_vector (tree type, vec<tree> vals MEM_STAT_DECL) > -{ > - gcc_assert (vals.length () == TYPE_VECTOR_SUBPARTS (type)); > - tree_vector_builder builder (type, vals.length (), 1); > - builder.splice (vals); > - return builder.build (); > -} > - > -/* Return a new VECTOR_CST node whose type is TYPE and whose values > are extracted from V, a vector of CONSTRUCTOR_ELT. */ > > tree > @@ -14066,6 +14054,18 @@ test_labels () > ASSERT_FALSE (FORCED_LABEL (label_decl)); > } > > +/* Return a new VECTOR_CST node whose type is TYPE and whose values > + are given by VALS. */ > + > +static tree > +build_vector (tree type, vec<tree> vals MEM_STAT_DECL) > +{ > + gcc_assert (vals.length () == TYPE_VECTOR_SUBPARTS (type)); > + tree_vector_builder builder (type, vals.length (), 1); > + builder.splice (vals); > + return builder.build (); > +} > + > /* Check that VECTOR_CST ACTUAL contains the elements in EXPECTED. */ > > static void > Index: gcc/tree.h > =================================================================== > --- gcc/tree.h 2017-12-06 14:46:14.133599820 +0000 > +++ gcc/tree.h 2017-12-06 14:49:10.296445794 +0000 > @@ -4044,7 +4044,6 @@ extern tree build_int_cst (tree, HOST_WI > extern tree build_int_cstu (tree type, unsigned HOST_WIDE_INT cst); > extern tree build_int_cst_type (tree, HOST_WIDE_INT); > extern tree make_vector (unsigned, unsigned CXX_MEM_STAT_INFO); > -extern tree build_vector (tree, vec<tree> CXX_MEM_STAT_INFO); > extern tree build_vector_from_ctor (tree, vec<constructor_elt, va_gc> *); > extern tree build_vector_from_val (tree, tree); > extern void recompute_constructor_flags (tree);
Index: gcc/tree.c =================================================================== --- gcc/tree.c 2017-12-06 14:48:52.891162052 +0000 +++ gcc/tree.c 2017-12-06 14:49:10.295445836 +0000 @@ -1736,18 +1736,6 @@ make_vector (unsigned log2_npatterns, } /* Return a new VECTOR_CST node whose type is TYPE and whose values - are given by VALS. */ - -tree -build_vector (tree type, vec<tree> vals MEM_STAT_DECL) -{ - gcc_assert (vals.length () == TYPE_VECTOR_SUBPARTS (type)); - tree_vector_builder builder (type, vals.length (), 1); - builder.splice (vals); - return builder.build (); -} - -/* Return a new VECTOR_CST node whose type is TYPE and whose values are extracted from V, a vector of CONSTRUCTOR_ELT. */ tree @@ -14066,6 +14054,18 @@ test_labels () ASSERT_FALSE (FORCED_LABEL (label_decl)); } +/* Return a new VECTOR_CST node whose type is TYPE and whose values + are given by VALS. */ + +static tree +build_vector (tree type, vec<tree> vals MEM_STAT_DECL) +{ + gcc_assert (vals.length () == TYPE_VECTOR_SUBPARTS (type)); + tree_vector_builder builder (type, vals.length (), 1); + builder.splice (vals); + return builder.build (); +} + /* Check that VECTOR_CST ACTUAL contains the elements in EXPECTED. */ static void Index: gcc/tree.h =================================================================== --- gcc/tree.h 2017-12-06 14:46:14.133599820 +0000 +++ gcc/tree.h 2017-12-06 14:49:10.296445794 +0000 @@ -4044,7 +4044,6 @@ extern tree build_int_cst (tree, HOST_WI extern tree build_int_cstu (tree type, unsigned HOST_WIDE_INT cst); extern tree build_int_cst_type (tree, HOST_WIDE_INT); extern tree make_vector (unsigned, unsigned CXX_MEM_STAT_INFO); -extern tree build_vector (tree, vec<tree> CXX_MEM_STAT_INFO); extern tree build_vector_from_ctor (tree, vec<constructor_elt, va_gc> *); extern tree build_vector_from_val (tree, tree); extern void recompute_constructor_flags (tree);