diff options
author | Roger Sayle <roger@eyesopen.com> | 2006-06-20 15:02:05 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2006-06-20 15:02:05 +0000 |
commit | 1000b34d95a6319206389feb136879d42d4675f2 (patch) | |
tree | c9dae92eb51b59b6f01612dfb8113ea758cf617a /gcc/tree.c | |
parent | c82f61c591c903d2faab8e9e0257c2fbb004c1fc (diff) | |
download | gcc-1000b34d95a6319206389feb136879d42d4675f2.zip gcc-1000b34d95a6319206389feb136879d42d4675f2.tar.gz gcc-1000b34d95a6319206389feb136879d42d4675f2.tar.bz2 |
expr.c (expand_expr_real_1): For vector constants with integer modes...
* expr.c (expand_expr_real_1) <VECTOR_CST>: For vector constants with
integer modes, attempt to directly construct an integer constant.
* fold-const.c (native_encode_vector): Determine the size of each
element from the vector type instead of the first vector element.
* tree.c (build_constructor_single): Mark a CONSTRUCTOR as constant,
if all of its elements/components are constant.
(build_constructor_from_list): Likewise.
From-SVN: r114815
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -1013,13 +1013,16 @@ build_constructor_single (tree type, tree index, tree value) { VEC(constructor_elt,gc) *v; constructor_elt *elt; + tree t; v = VEC_alloc (constructor_elt, gc, 1); elt = VEC_quick_push (constructor_elt, v, NULL); elt->index = index; elt->value = value; - return build_constructor (type, v); + t = build_constructor (type, v); + TREE_CONSTANT (t) = TREE_CONSTANT (value); + return t; } @@ -1028,8 +1031,9 @@ build_constructor_single (tree type, tree index, tree value) tree build_constructor_from_list (tree type, tree vals) { - tree t; + tree t, val; VEC(constructor_elt,gc) *v = NULL; + bool constant_p = true; if (vals) { @@ -1037,12 +1041,17 @@ build_constructor_from_list (tree type, tree vals) for (t = vals; t; t = TREE_CHAIN (t)) { constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL); + val = TREE_VALUE (t); elt->index = TREE_PURPOSE (t); - elt->value = TREE_VALUE (t); + elt->value = val; + if (!TREE_CONSTANT (val)) + constant_p = false; } } - return build_constructor (type, v); + t = build_constructor (type, v); + TREE_CONSTANT (t) = constant_p; + return t; } |