mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-16 10:51:21 +08:00
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
This commit is contained in:
parent
43dc123f52
commit
1281fe1103
66
gcc/tree.c
66
gcc/tree.c
@ -3850,6 +3850,45 @@ build_function_type_list (tree return_type, ...)
|
||||
return args;
|
||||
}
|
||||
|
||||
/* 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_directly (tree basetype,
|
||||
tree rettype,
|
||||
tree argtypes)
|
||||
{
|
||||
tree t;
|
||||
tree ptype;
|
||||
int hashcode;
|
||||
|
||||
/* Make a node of the sort we want. */
|
||||
t = make_node (METHOD_TYPE);
|
||||
|
||||
TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
|
||||
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;
|
||||
|
||||
/* 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);
|
||||
|
||||
t = type_hash_canon (hashcode, t);
|
||||
|
||||
if (!COMPLETE_TYPE_P (t))
|
||||
layout_type (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.
|
||||
@ -3858,33 +3897,12 @@ build_function_type_list (tree return_type, ...)
|
||||
tree
|
||||
build_method_type (tree basetype, tree type)
|
||||
{
|
||||
tree t;
|
||||
unsigned 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);
|
||||
|
||||
/* The actual arglist for this function includes a "hidden" argument
|
||||
which is "this". Put it into the list of argument types. */
|
||||
|
||||
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. */
|
||||
hashcode = TYPE_HASH (basetype) + TYPE_HASH (type);
|
||||
t = type_hash_canon (hashcode, t);
|
||||
|
||||
if (!COMPLETE_TYPE_P (t))
|
||||
layout_type (t);
|
||||
|
||||
return t;
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user