Commit 6a20ce76 by Richard Guenther Committed by Richard Biener

gimple.c (compare_type_names_p): Remove for_completion_p arg.

2011-05-24  Richard Guenther  <rguenther@suse.de>

	* gimple.c (compare_type_names_p): Remove for_completion_p arg.
	(gimple_compatible_complete_and_incomplete_subtype_p): Remove.
	(gimple_types_compatible_p_1): Adjust.
	(iterative_hash_canonical_type): Do not bother about complete vs.
	incomplete types.
	(gimple_canonical_types_compatible_p): Likewise.

From-SVN: r174118
parent 87d426f8
2011-05-24 Richard Guenther <rguenther@suse.de>
* gimple.c (compare_type_names_p): Remove for_completion_p arg.
(gimple_compatible_complete_and_incomplete_subtype_p): Remove.
(gimple_types_compatible_p_1): Adjust.
(iterative_hash_canonical_type): Do not bother about complete vs.
incomplete types.
(gimple_canonical_types_compatible_p): Likewise.
2011-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2011-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* config/i386/sol2.h (FORCE_CODE_SECTION_ALIGN): Remove. * config/i386/sol2.h (FORCE_CODE_SECTION_ALIGN): Remove.
......
...@@ -3333,33 +3333,18 @@ gimple_lookup_type_leader (tree t) ...@@ -3333,33 +3333,18 @@ gimple_lookup_type_leader (tree t)
true if both types have no names. */ true if both types have no names. */
static bool static bool
compare_type_names_p (tree t1, tree t2, bool for_completion_p) compare_type_names_p (tree t1, tree t2)
{ {
tree name1 = TYPE_NAME (t1); tree name1 = TYPE_NAME (t1);
tree name2 = TYPE_NAME (t2); tree name2 = TYPE_NAME (t2);
/* Consider anonymous types all unique for completion. */
if (for_completion_p
&& (!name1 || !name2))
return false;
if (name1 && TREE_CODE (name1) == TYPE_DECL) if (name1 && TREE_CODE (name1) == TYPE_DECL)
{ name1 = DECL_NAME (name1);
name1 = DECL_NAME (name1); gcc_checking_assert (!name1 || TREE_CODE (name1) == IDENTIFIER_NODE);
if (for_completion_p
&& !name1)
return false;
}
gcc_assert (!name1 || TREE_CODE (name1) == IDENTIFIER_NODE);
if (name2 && TREE_CODE (name2) == TYPE_DECL) if (name2 && TREE_CODE (name2) == TYPE_DECL)
{ name2 = DECL_NAME (name2);
name2 = DECL_NAME (name2); gcc_checking_assert (!name2 || TREE_CODE (name2) == IDENTIFIER_NODE);
if (for_completion_p
&& !name2)
return false;
}
gcc_assert (!name2 || TREE_CODE (name2) == IDENTIFIER_NODE);
/* Identifiers can be compared with pointer equality rather /* Identifiers can be compared with pointer equality rather
than a string comparison. */ than a string comparison. */
...@@ -3420,25 +3405,6 @@ gimple_compare_field_offset (tree f1, tree f2) ...@@ -3420,25 +3405,6 @@ gimple_compare_field_offset (tree f1, tree f2)
return false; return false;
} }
/* If the type T1 and the type T2 are a complete and an incomplete
variant of the same type return true. */
static bool
gimple_compatible_complete_and_incomplete_subtype_p (tree t1, tree t2)
{
/* If one pointer points to an incomplete type variant of
the other pointed-to type they are the same. */
if (TREE_CODE (t1) == TREE_CODE (t2)
&& RECORD_OR_UNION_TYPE_P (t1)
&& (!COMPLETE_TYPE_P (t1)
|| !COMPLETE_TYPE_P (t2))
&& TYPE_QUALS (t1) == TYPE_QUALS (t2)
&& compare_type_names_p (TYPE_MAIN_VARIANT (t1),
TYPE_MAIN_VARIANT (t2), true))
return true;
return false;
}
static bool static bool
gimple_types_compatible_p_1 (tree, tree, type_pair_t, gimple_types_compatible_p_1 (tree, tree, type_pair_t,
VEC(type_pair_t, heap) **, VEC(type_pair_t, heap) **,
...@@ -3588,7 +3554,7 @@ gimple_types_compatible_p_1 (tree t1, tree t2, type_pair_t p, ...@@ -3588,7 +3554,7 @@ gimple_types_compatible_p_1 (tree t1, tree t2, type_pair_t p,
state->u.same_p = 1; state->u.same_p = 1;
/* The struct tags shall compare equal. */ /* The struct tags shall compare equal. */
if (!compare_type_names_p (t1, t2, false)) if (!compare_type_names_p (t1, t2))
goto different_types; goto different_types;
/* If their attributes are not the same they can't be the same type. */ /* If their attributes are not the same they can't be the same type. */
...@@ -4391,27 +4357,11 @@ iterative_hash_canonical_type (tree type, hashval_t val) ...@@ -4391,27 +4357,11 @@ iterative_hash_canonical_type (tree type, hashval_t val)
if (TREE_CODE (type) == METHOD_TYPE) if (TREE_CODE (type) == METHOD_TYPE)
v = iterative_hash_canonical_type (TYPE_METHOD_BASETYPE (type), v); v = iterative_hash_canonical_type (TYPE_METHOD_BASETYPE (type), v);
/* For result types allow mismatch in completeness. */ v = iterative_hash_canonical_type (TREE_TYPE (type), v);
if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (type)))
{
v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
v = iterative_hash_name
(TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (type))), v);
}
else
v = iterative_hash_canonical_type (TREE_TYPE (type), v);
for (p = TYPE_ARG_TYPES (type), na = 0; p; p = TREE_CHAIN (p)) for (p = TYPE_ARG_TYPES (type), na = 0; p; p = TREE_CHAIN (p))
{ {
/* For argument types allow mismatch in completeness. */ v = iterative_hash_canonical_type (TREE_VALUE (p), v);
if (RECORD_OR_UNION_TYPE_P (TREE_VALUE (p)))
{
v = iterative_hash_hashval_t (TREE_CODE (TREE_VALUE (p)), v);
v = iterative_hash_name
(TYPE_NAME (TYPE_MAIN_VARIANT (TREE_VALUE (p))), v);
}
else
v = iterative_hash_canonical_type (TREE_VALUE (p), v);
na++; na++;
} }
...@@ -4700,10 +4650,7 @@ gimple_canonical_types_compatible_p (tree t1, tree t2) ...@@ -4700,10 +4650,7 @@ gimple_canonical_types_compatible_p (tree t1, tree t2)
case FUNCTION_TYPE: case FUNCTION_TYPE:
/* Function types are the same if the return type and arguments types /* Function types are the same if the return type and arguments types
are the same. */ are the same. */
if (!gimple_compatible_complete_and_incomplete_subtype_p if (!gimple_canonical_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2)))
(TREE_TYPE (t1), TREE_TYPE (t2))
&& !gimple_canonical_types_compatible_p
(TREE_TYPE (t1), TREE_TYPE (t2)))
return false; return false;
if (!comp_type_attributes (t1, t2)) if (!comp_type_attributes (t1, t2))
...@@ -4719,10 +4666,8 @@ gimple_canonical_types_compatible_p (tree t1, tree t2) ...@@ -4719,10 +4666,8 @@ gimple_canonical_types_compatible_p (tree t1, tree t2)
parms1 && parms2; parms1 && parms2;
parms1 = TREE_CHAIN (parms1), parms2 = TREE_CHAIN (parms2)) parms1 = TREE_CHAIN (parms1), parms2 = TREE_CHAIN (parms2))
{ {
if (!gimple_compatible_complete_and_incomplete_subtype_p if (!gimple_canonical_types_compatible_p
(TREE_VALUE (parms1), TREE_VALUE (parms2)) (TREE_VALUE (parms1), TREE_VALUE (parms2)))
&& !gimple_canonical_types_compatible_p
(TREE_VALUE (parms1), TREE_VALUE (parms2)))
return false; return false;
} }
......
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