Vector shifting patch
Nathan Froyd
froydnj@codesourcery.com
Mon Oct 25 20:33:00 GMT 2010
On Mon, Oct 25, 2010 at 04:21:47PM +0100, Artem Shinkarov wrote:
> Does it look better now:
>
> tree
> build_vector_from_val (const tree sc, const tree vectype)
> {
> int i, nunits = TYPE_VECTOR_SUBPARTS (vectype);
> VEC(constructor_elt, gc) *v;
>
> if (sc == error_mark_node)
> return sc;
>
> gcc_assert (TREE_TYPE (sc) == TREE_TYPE (vectype));
>
> v = VEC_alloc (constructor_elt, gc, nunits);
> for (i = 0; i < nunits; ++i)
> CONSTRUCTOR_APPEND_ELT (v, size_int (i), sc);
^^^^^^^^^^^^
You can just pass NULL_TREE here and the Right Thing will happen.
I think the logic looks fine. For consistency's sake, it would probably
be good to have the argument order reversed, i.e.:
tree
build_vector_from_val (const_tree vectype, const_tree sc)
as that would more closely match the existing build_vector* functions.
Please also note that you want const_tree instead of 'const tree' (note
underscore). If there are other instances of that in your patch, you'll
want to fix those too.
-Nathan
More information about the Gcc-patches
mailing list