aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZiemowit Laski <zlaski@apple.com>2004-02-11 01:55:29 +0000
committerZiemowit Laski <zlaski@gcc.gnu.org>2004-02-11 01:55:29 +0000
commitb34417a407f5f98338c532295860f07d99a3c38a (patch)
tree75520a1a2cd2e58f1ac74770fc79b469c81ab6fd
parent3d2dbfbb308063e87b67d5ba8e36d25d06416c13 (diff)
downloadgcc-b34417a407f5f98338c532295860f07d99a3c38a.zip
gcc-b34417a407f5f98338c532295860f07d99a3c38a.tar.gz
gcc-b34417a407f5f98338c532295860f07d99a3c38a.tar.bz2
c-common.c (vector_size_helper): Remove; call reconstruct_complex_type() instead.
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. From-SVN: r77632
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/c-common.c49
-rw-r--r--gcc/tree.c49
-rw-r--r--gcc/tree.h2
4 files changed, 59 insertions, 50 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bafbbb6..90cad63 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2004-02-10 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300-protos.h: Add a prototype for
diff --git a/gcc/c-common.c b/gcc/c-common.c
index e8370d5..184f26e 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -784,7 +784,6 @@ static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
static tree handle_cleanup_attribute (tree *, tree, tree, int, bool *);
static tree handle_warn_unused_result_attribute (tree *, tree, tree, int,
bool *);
-static tree vector_size_helper (tree, tree);
static void check_function_nonnull (tree, tree);
static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT);
@@ -5246,57 +5245,11 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
}
/* Build back pointers if needed. */
- *node = vector_size_helper (*node, new_type);
+ *node = reconstruct_complex_type (*node, new_type);
return NULL_TREE;
}
-/* 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. */
-
-static tree
-vector_size_helper (tree type, tree bottom)
-{
- tree inner, outer;
-
- if (POINTER_TYPE_P (type))
- {
- inner = vector_size_helper (TREE_TYPE (type), bottom);
- outer = build_pointer_type (inner);
- }
- else if (TREE_CODE (type) == ARRAY_TYPE)
- {
- inner = vector_size_helper (TREE_TYPE (type), bottom);
- outer = build_array_type (inner, TYPE_DOMAIN (type));
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- inner = vector_size_helper (TREE_TYPE (type), bottom);
- outer = build_function_type (inner, TYPE_ARG_TYPES (type));
- }
- else if (TREE_CODE (type) == METHOD_TYPE)
- {
- inner = vector_size_helper (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;
-}
-
/* Handle the "nonnull" attribute. */
static tree
handle_nonnull_attribute (tree *node, tree name ATTRIBUTE_UNUSED,
diff --git a/gcc/tree.c b/gcc/tree.c
index 12eabd9..c02b100 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;
diff --git a/gcc/tree.h b/gcc/tree.h
index 6f19cab..d8bbb86 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2852,6 +2852,8 @@ extern void dump_tree_statistics (void);
extern void expand_function_end (void);
extern void expand_function_start (tree, int);
extern void expand_pending_sizes (tree);
+extern tree make_vector (enum machine_mode, tree, int);
+extern tree reconstruct_complex_type (tree, tree);
extern int real_onep (tree);
extern int real_twop (tree);