Commit b4ada065 by Richard Biener Committed by Richard Biener

alias.h (component_uses_parent_alias_set): Rename to ...

2013-09-26  Richard Biener  <rguenther@suse.de>

	* alias.h (component_uses_parent_alias_set): Rename to ...
	(component_uses_parent_alias_set_from): ... this.
	* alias.c (component_uses_parent_alias_set): Rename to ...
	(component_uses_parent_alias_set_from): ... this and return
	the desired parent.
	(reference_alias_ptr_type_1): Use the result from
	component_uses_parent_alias_set_from instead of stripping
	components one at a time.
	* emit-rtl.c (set_mem_attributes_minus_bitpos): Adjust.

From-SVN: r202948
parent 1aab6678
2013-09-26 Richard Biener <rguenther@suse.de>
* alias.h (component_uses_parent_alias_set): Rename to ...
(component_uses_parent_alias_set_from): ... this.
* alias.c (component_uses_parent_alias_set): Rename to ...
(component_uses_parent_alias_set_from): ... this and return
the desired parent.
(reference_alias_ptr_type_1): Use the result from
component_uses_parent_alias_set_from instead of stripping
components one at a time.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Adjust.
2013-09-26 Andrew MacLeod <amacleod@redhat.com> 2013-09-26 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa-live.h (find_replaceable_exprs, dump_replaceable_exprs): Move * tree-ssa-live.h (find_replaceable_exprs, dump_replaceable_exprs): Move
......
...@@ -500,51 +500,58 @@ objects_must_conflict_p (tree t1, tree t2) ...@@ -500,51 +500,58 @@ objects_must_conflict_p (tree t1, tree t2)
return alias_sets_must_conflict_p (set1, set2); return alias_sets_must_conflict_p (set1, set2);
} }
/* Return true if all nested component references handled by /* Return the outermost parent of component present in the chain of
get_inner_reference in T are such that we should use the alias set component references handled by get_inner_reference in T with the
provided by the object at the heart of T. following property:
- the component is non-addressable, or
- the parent has alias set zero,
or NULL_TREE if no such parent exists. In the former cases, the alias
set of this parent is the alias set that must be used for T itself. */
This is true for non-addressable components (which don't have their tree
own alias set), as well as components of objects in alias set zero. component_uses_parent_alias_set_from (const_tree t)
This later point is a special case wherein we wish to override the
alias set used by the component, but we don't have per-FIELD_DECL
assignable alias sets. */
bool
component_uses_parent_alias_set (const_tree t)
{ {
while (1) const_tree found = NULL_TREE;
{
/* If we're at the end, it vacuously uses its own alias set. */
if (!handled_component_p (t))
return false;
while (handled_component_p (t))
{
switch (TREE_CODE (t)) switch (TREE_CODE (t))
{ {
case COMPONENT_REF: case COMPONENT_REF:
if (DECL_NONADDRESSABLE_P (TREE_OPERAND (t, 1))) if (DECL_NONADDRESSABLE_P (TREE_OPERAND (t, 1)))
return true; found = t;
break; break;
case ARRAY_REF: case ARRAY_REF:
case ARRAY_RANGE_REF: case ARRAY_RANGE_REF:
if (TYPE_NONALIASED_COMPONENT (TREE_TYPE (TREE_OPERAND (t, 0)))) if (TYPE_NONALIASED_COMPONENT (TREE_TYPE (TREE_OPERAND (t, 0))))
return true; found = t;
break; break;
case REALPART_EXPR: case REALPART_EXPR:
case IMAGPART_EXPR: case IMAGPART_EXPR:
break; break;
default: case BIT_FIELD_REF:
case VIEW_CONVERT_EXPR:
/* Bitfields and casts are never addressable. */ /* Bitfields and casts are never addressable. */
return true; found = t;
break;
default:
gcc_unreachable ();
} }
if (get_alias_set (TREE_TYPE (TREE_OPERAND (t, 0))) == 0)
found = t;
t = TREE_OPERAND (t, 0); t = TREE_OPERAND (t, 0);
if (get_alias_set (TREE_TYPE (t)) == 0)
return true;
} }
if (found)
return TREE_OPERAND (found, 0);
return NULL_TREE;
} }
...@@ -645,14 +652,11 @@ reference_alias_ptr_type_1 (tree *t) ...@@ -645,14 +652,11 @@ reference_alias_ptr_type_1 (tree *t)
(TREE_TYPE (TREE_TYPE (TREE_OPERAND (inner, 1)))))) (TREE_TYPE (TREE_TYPE (TREE_OPERAND (inner, 1))))))
return TREE_TYPE (TREE_OPERAND (inner, 1)); return TREE_TYPE (TREE_OPERAND (inner, 1));
/* Otherwise, pick up the outermost object that we could have a pointer /* Otherwise, pick up the outermost object that we could have
to, processing conversions as above. */ a pointer to. */
/* ??? Ick, this is worse than quadratic! */ tree tem = component_uses_parent_alias_set_from (*t);
while (component_uses_parent_alias_set (*t)) if (tem)
{ *t = tem;
*t = TREE_OPERAND (*t, 0);
STRIP_NOPS (*t);
}
return NULL_TREE; return NULL_TREE;
} }
......
...@@ -33,7 +33,7 @@ extern alias_set_type get_alias_set (tree); ...@@ -33,7 +33,7 @@ extern alias_set_type get_alias_set (tree);
extern alias_set_type get_deref_alias_set (tree); extern alias_set_type get_deref_alias_set (tree);
extern alias_set_type get_varargs_alias_set (void); extern alias_set_type get_varargs_alias_set (void);
extern alias_set_type get_frame_alias_set (void); extern alias_set_type get_frame_alias_set (void);
extern bool component_uses_parent_alias_set (const_tree); extern tree component_uses_parent_alias_set_from (const_tree);
extern bool alias_set_subset_of (alias_set_type, alias_set_type); extern bool alias_set_subset_of (alias_set_type, alias_set_type);
extern void record_alias_subset (alias_set_type, alias_set_type); extern void record_alias_subset (alias_set_type, alias_set_type);
extern void record_component_aliases (tree); extern void record_component_aliases (tree);
......
...@@ -1704,7 +1704,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, ...@@ -1704,7 +1704,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
/* If this expression uses it's parent's alias set, mark it such /* If this expression uses it's parent's alias set, mark it such
that we won't change it. */ that we won't change it. */
if (component_uses_parent_alias_set (t)) if (component_uses_parent_alias_set_from (t) != NULL_TREE)
MEM_KEEP_ALIAS_SET_P (ref) = 1; MEM_KEEP_ALIAS_SET_P (ref) = 1;
/* If this is a decl, set the attributes of the MEM from it. */ /* If this is a decl, set the attributes of the MEM from 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