diff options
author | zlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-02-11 01:55:29 +0000 |
---|---|---|
committer | zlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-02-11 01:55:29 +0000 |
commit | 409a160c6b1e0d65e1fe773e93d58265f0d9c773 (patch) | |
tree | 75520a1a2cd2e58f1ac74770fc79b469c81ab6fd /gcc/tree.c | |
parent | 52e5234153b62715add00407f5110ff7a2c75e25 (diff) | |
download | gcc-409a160c6b1e0d65e1fe773e93d58265f0d9c773.tar.gz |
2004-02-10 Ziemowit Laski <zlaski@apple.com>
* c-common.c (vector_size_helper): Remove; call
reconstruct_complex_type() instead.
* tree.c (reconstruct_complex_type): New function
(formerly vector_size_helper() in c-common.c).
(make_vector): Make externally visible.
* tree.h (reconstruct_complex_type, make_vector): Add prototypes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77632 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index 12eabd9361d..c02b1004b91 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -106,7 +106,6 @@ static int type_hash_eq (const void *, const void *); static hashval_t type_hash_hash (const void *); static void print_type_hash_statistics (void); static void finish_vector_type (tree); -static tree make_vector (enum machine_mode, tree, int); static int type_hash_marked_p (const void *); tree global_trees[TI_MAX]; @@ -5030,10 +5029,56 @@ build_common_tree_nodes_2 (int short_double) V4DF_type_node = make_vector (V4DFmode, double_type_node, 0); } +/* HACK. GROSS. This is absolutely disgusting. I wish there was a + better way. + + If we requested a pointer to a vector, build up the pointers that + we stripped off while looking for the inner type. Similarly for + return values from functions. + + The argument TYPE is the top of the chain, and BOTTOM is the + new type which we will point to. */ + +tree +reconstruct_complex_type (tree type, tree bottom) +{ + tree inner, outer; + + if (POINTER_TYPE_P (type)) + { + inner = reconstruct_complex_type (TREE_TYPE (type), bottom); + outer = build_pointer_type (inner); + } + else if (TREE_CODE (type) == ARRAY_TYPE) + { + inner = reconstruct_complex_type (TREE_TYPE (type), bottom); + outer = build_array_type (inner, TYPE_DOMAIN (type)); + } + else if (TREE_CODE (type) == FUNCTION_TYPE) + { + inner = reconstruct_complex_type (TREE_TYPE (type), bottom); + outer = build_function_type (inner, TYPE_ARG_TYPES (type)); + } + else if (TREE_CODE (type) == METHOD_TYPE) + { + inner = reconstruct_complex_type (TREE_TYPE (type), bottom); + outer = build_method_type_directly (TYPE_METHOD_BASETYPE (type), + inner, + TYPE_ARG_TYPES (type)); + } + else + return bottom; + + TREE_READONLY (outer) = TREE_READONLY (type); + TREE_THIS_VOLATILE (outer) = TREE_THIS_VOLATILE (type); + + return outer; +} + /* Returns a vector tree node given a vector mode, the inner type, and the signness. */ -static tree +tree make_vector (enum machine_mode mode, tree innertype, int unsignedp) { tree t; |