diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-29 11:26:46 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-29 11:26:46 +0000 |
commit | 0a4bf03b6b1237b6f3974c8d1a39f6e7fb8b4306 (patch) | |
tree | 8e4792c5afb79495862d51086e8f761ee701d601 /gcc/tree.c | |
parent | a2aea2c142475e2b757f6bfdf1956586be6c94dd (diff) | |
download | gcc-0a4bf03b6b1237b6f3974c8d1a39f6e7fb8b4306.tar.gz |
2011-09-29 Richard Guenther <rguenther@suse.de>
* tree.c (build_opaque_vector_type): Make opaque vectors
variant types of the corresponding non-opaque type. Make
sure to share opaque vector types properly.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179341 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index a53c9f432ee..bcdda5034aa 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9752,17 +9752,29 @@ build_vector_type (tree innertype, int nunits) return make_vector_type (innertype, nunits, VOIDmode); } -/* Similarly, but takes the inner type and number of units, which must be - a power of two. */ +/* Similarly, but builds a variant type with TYPE_VECTOR_OPAQUE set. */ tree build_opaque_vector_type (tree innertype, int nunits) { - tree t; - innertype = build_distinct_type_copy (innertype); - t = make_vector_type (innertype, nunits, VOIDmode); - TYPE_VECTOR_OPAQUE (t) = true; - return t; + tree t = make_vector_type (innertype, nunits, VOIDmode); + tree cand; + /* We always build the non-opaque variant before the opaque one, + so if it already exists, it is TYPE_NEXT_VARIANT of this one. */ + cand = TYPE_NEXT_VARIANT (t); + if (cand + && TYPE_VECTOR_OPAQUE (cand) + && check_qualified_type (cand, t, TYPE_QUALS (t))) + return cand; + /* Othewise build a variant type and make sure to queue it after + the non-opaque type. */ + cand = build_distinct_type_copy (t); + TYPE_VECTOR_OPAQUE (cand) = true; + TYPE_CANONICAL (cand) = TYPE_CANONICAL (t); + TYPE_NEXT_VARIANT (cand) = TYPE_NEXT_VARIANT (t); + TYPE_NEXT_VARIANT (t) = cand; + TYPE_MAIN_VARIANT (cand) = TYPE_MAIN_VARIANT (t); + return cand; } |