Commit 5b56d3bb by Eric Botcazou Committed by Eric Botcazou

varasm.c (decode_addr_const): Handle special case of INDIRECT_REF.

	* varasm.c (decode_addr_const): Handle special case of INDIRECT_REF.
	(const_hash_1) <VECTOR_CST>: New case.
	(compare_constant) <VECTOR_CST>: Likewise.
	<ADDR_EXPR>: Deal with LABEL_REFs.
	(copy_constant) <VECTOR_CST>: New case.

From-SVN: r158776
parent fa5f5e27
2010-04-27 Eric Botcazou <ebotcazou@adacore.com>
* varasm.c (decode_addr_const): Handle special case of INDIRECT_REF.
(const_hash_1) <VECTOR_CST>: New case.
(compare_constant) <VECTOR_CST>: Likewise.
<ADDR_EXPR>: Deal with LABEL_REFs.
(copy_constant) <VECTOR_CST>: New case.
2010-04-27 Jan Hubicka <jh@suse.cz> 2010-04-27 Jan Hubicka <jh@suse.cz>
* cgraph.c (cgraph_propagate_frequency): New function. * cgraph.c (cgraph_propagate_frequency): New function.
......
...@@ -2802,6 +2802,11 @@ decode_addr_const (tree exp, struct addr_const *value) ...@@ -2802,6 +2802,11 @@ decode_addr_const (tree exp, struct addr_const *value)
* tree_low_cst (TREE_OPERAND (target, 1), 0)); * tree_low_cst (TREE_OPERAND (target, 1), 0));
target = TREE_OPERAND (target, 0); target = TREE_OPERAND (target, 0);
} }
else if (TREE_CODE (target) == INDIRECT_REF
&& TREE_CODE (TREE_OPERAND (target, 0)) == NOP_EXPR
&& TREE_CODE (TREE_OPERAND (TREE_OPERAND (target, 0), 0))
== ADDR_EXPR)
target = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (target, 0), 0), 0);
else else
break; break;
} }
...@@ -2894,6 +2899,18 @@ const_hash_1 (const tree exp) ...@@ -2894,6 +2899,18 @@ const_hash_1 (const tree exp)
return (const_hash_1 (TREE_REALPART (exp)) * 5 return (const_hash_1 (TREE_REALPART (exp)) * 5
+ const_hash_1 (TREE_IMAGPART (exp))); + const_hash_1 (TREE_IMAGPART (exp)));
case VECTOR_CST:
{
tree link;
hi = 7 + TYPE_VECTOR_SUBPARTS (TREE_TYPE (exp));
for (link = TREE_VECTOR_CST_ELTS (exp); link; link = TREE_CHAIN (link))
hi = hi * 563 + const_hash_1 (TREE_VALUE (link));
return hi;
}
case CONSTRUCTOR: case CONSTRUCTOR:
{ {
unsigned HOST_WIDE_INT idx; unsigned HOST_WIDE_INT idx;
...@@ -3022,6 +3039,27 @@ compare_constant (const tree t1, const tree t2) ...@@ -3022,6 +3039,27 @@ compare_constant (const tree t1, const tree t2)
return (compare_constant (TREE_REALPART (t1), TREE_REALPART (t2)) return (compare_constant (TREE_REALPART (t1), TREE_REALPART (t2))
&& compare_constant (TREE_IMAGPART (t1), TREE_IMAGPART (t2))); && compare_constant (TREE_IMAGPART (t1), TREE_IMAGPART (t2)));
case VECTOR_CST:
{
tree link1, link2;
if (TYPE_VECTOR_SUBPARTS (TREE_TYPE (t1))
!= TYPE_VECTOR_SUBPARTS (TREE_TYPE (t2)))
return 0;
link2 = TREE_VECTOR_CST_ELTS (t2);
for (link1 = TREE_VECTOR_CST_ELTS (t1);
link1;
link1 = TREE_CHAIN (link1))
{
if (!compare_constant (TREE_VALUE (link1), TREE_VALUE (link2)))
return 0;
link2 = TREE_CHAIN (link2);
}
return 1;
}
case CONSTRUCTOR: case CONSTRUCTOR:
{ {
VEC(constructor_elt, gc) *v1, *v2; VEC(constructor_elt, gc) *v1, *v2;
...@@ -3082,11 +3120,34 @@ compare_constant (const tree t1, const tree t2) ...@@ -3082,11 +3120,34 @@ compare_constant (const tree t1, const tree t2)
case FDESC_EXPR: case FDESC_EXPR:
{ {
struct addr_const value1, value2; struct addr_const value1, value2;
enum rtx_code code;
int ret;
decode_addr_const (t1, &value1); decode_addr_const (t1, &value1);
decode_addr_const (t2, &value2); decode_addr_const (t2, &value2);
return (value1.offset == value2.offset
&& strcmp (XSTR (value1.base, 0), XSTR (value2.base, 0)) == 0); if (value1.offset != value2.offset)
return 0;
code = GET_CODE (value1.base);
if (code != GET_CODE (value2.base))
return 0;
switch (code)
{
case SYMBOL_REF:
ret = (strcmp (XSTR (value1.base, 0), XSTR (value2.base, 0)) == 0);
break;
case LABEL_REF:
ret = (CODE_LABEL_NUMBER (XEXP (value1.base, 0))
== CODE_LABEL_NUMBER (XEXP (value2.base, 0)));
break;
default:
gcc_unreachable ();
}
return ret;
} }
case PLUS_EXPR: case PLUS_EXPR:
...@@ -3147,6 +3208,10 @@ copy_constant (tree exp) ...@@ -3147,6 +3208,10 @@ copy_constant (tree exp)
return build1 (TREE_CODE (exp), TREE_TYPE (exp), return build1 (TREE_CODE (exp), TREE_TYPE (exp),
copy_constant (TREE_OPERAND (exp, 0))); copy_constant (TREE_OPERAND (exp, 0)));
case VECTOR_CST:
return build_vector (TREE_TYPE (exp),
copy_list (TREE_VECTOR_CST_ELTS (exp)));
case CONSTRUCTOR: case CONSTRUCTOR:
{ {
tree copy = copy_node (exp); tree copy = copy_node (exp);
......
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