diff options
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index e2829491ca4..764aa798ed8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -558,6 +558,35 @@ build_int_2_wide (low, hi) return t; } +/* Return a new VECTOR_CST node whose type is TYPE and whose values + are in a list pointed by VALS. */ + +tree +build_vector (type, vals) + tree type, vals; +{ + tree v = make_node (VECTOR_CST); + int over1 = 0, over2 = 0; + tree link; + + TREE_VECTOR_CST_ELTS (v) = vals; + TREE_TYPE (v) = type; + + /* Iterate through elements and check for overflow. */ + for (link = vals; link; link = TREE_CHAIN (link)) + { + tree value = TREE_VALUE (link); + + over1 |= TREE_OVERFLOW (value); + over2 |= TREE_CONSTANT_OVERFLOW (value); + } + + TREE_OVERFLOW (v) = over1; + TREE_CONSTANT_OVERFLOW (v) = over2; + + return v; +} + /* Return a new REAL_CST node whose type is TYPE and value is D. */ tree |