Commit 1281fe11 by Mark Mitchell

re PR target/8795 ([PPC] Altivec related bugs concerning gcc 3.3 and mainline)

	PR c++/8795
	* tree.h (build_method_type_directly): Declare.
	* c-common.c (handle_vector_size_attributes): Handle METHOD_TYPEs.
	(vector_size_helper): Likewise.
	* tree.c (build_method_type_directly): New function.
	(build_method_type): Use it.

From-SVN: r70774
parent 43dc123f
...@@ -3850,35 +3850,37 @@ build_function_type_list (tree return_type, ...) ...@@ -3850,35 +3850,37 @@ build_function_type_list (tree return_type, ...)
return args; return args;
} }
/* Construct, lay out and return the type of methods belonging to class /* Build a METHOD_TYPE for a member of BASETYPE. The RETTYPE (a TYPE)
BASETYPE and whose arguments and values are described by TYPE. and ARGTYPES (a TREE_LIST) are the return type and arguments types
If that type exists already, reuse it. for the method. An implicit additional parameter (of type
TYPE must be a FUNCTION_TYPE node. */ pointer-to-BASETYPE) is added to the ARGTYPES. */
tree tree
build_method_type (tree basetype, tree type) build_method_type_directly (tree basetype,
tree rettype,
tree argtypes)
{ {
tree t; tree t;
unsigned int hashcode; tree ptype;
int hashcode;
/* Make a node of the sort we want. */ /* Make a node of the sort we want. */
t = make_node (METHOD_TYPE); t = make_node (METHOD_TYPE);
if (TREE_CODE (type) != FUNCTION_TYPE)
abort ();
TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype); TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
TREE_TYPE (t) = TREE_TYPE (type); TREE_TYPE (t) = rettype;
ptype = build_pointer_type (basetype);
/* The actual arglist for this function includes a "hidden" argument /* The actual arglist for this function includes a "hidden" argument
which is "this". Put it into the list of argument types. */ which is "this". Put it into the list of argument types. */
argtypes = tree_cons (NULL_TREE, ptype, argtypes);
TYPE_ARG_TYPES (t) = argtypes;
TYPE_ARG_TYPES (t) /* If we already have such a type, use the old one and free this one.
= tree_cons (NULL_TREE, Note that it also frees up the above cons cell if found. */
build_pointer_type (basetype), TYPE_ARG_TYPES (type)); hashcode = TYPE_HASH (basetype) + TYPE_HASH (rettype) +
type_hash_list (argtypes);
/* If we already have such a type, use the old one and free this one. */
hashcode = TYPE_HASH (basetype) + TYPE_HASH (type);
t = type_hash_canon (hashcode, t); t = type_hash_canon (hashcode, t);
if (!COMPLETE_TYPE_P (t)) if (!COMPLETE_TYPE_P (t))
...@@ -3887,6 +3889,22 @@ build_method_type (tree basetype, tree type) ...@@ -3887,6 +3889,22 @@ build_method_type (tree basetype, tree type)
return t; return t;
} }
/* Construct, lay out and return the type of methods belonging to class
BASETYPE and whose arguments and values are described by TYPE.
If that type exists already, reuse it.
TYPE must be a FUNCTION_TYPE node. */
tree
build_method_type (tree basetype, tree type)
{
if (TREE_CODE (type) != FUNCTION_TYPE)
abort ();
return build_method_type_directly (basetype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
}
/* Construct, lay out and return the type of offsets to a value /* Construct, lay out and return the type of offsets to a value
of type TYPE, within an object of type BASETYPE. of type TYPE, within an object of type BASETYPE.
If a suitable offset type exists already, reuse it. */ If a suitable offset type exists already, reuse it. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment