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, ...)
return args;
}
/* 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. */
/* Build a METHOD_TYPE for a member of BASETYPE. The RETTYPE (a TYPE)
and ARGTYPES (a TREE_LIST) are the return type and arguments types
for the method. An implicit additional parameter (of type
pointer-to-BASETYPE) is added to the ARGTYPES. */
tree
build_method_type (tree basetype, tree type)
build_method_type_directly (tree basetype,
tree rettype,
tree argtypes)
{
tree t;
unsigned int hashcode;
tree ptype;
int hashcode;
/* Make a node of the sort we want. */
t = make_node (METHOD_TYPE);
if (TREE_CODE (type) != FUNCTION_TYPE)
abort ();
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
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)
= tree_cons (NULL_TREE,
build_pointer_type (basetype), TYPE_ARG_TYPES (type));
/* If we already have such a type, use the old one and free this one.
Note that it also frees up the above cons cell if found. */
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);
if (!COMPLETE_TYPE_P (t))
......@@ -3887,6 +3889,22 @@ build_method_type (tree basetype, tree type)
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
of type TYPE, within an object of type BASETYPE.
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