Commit 30a20e97 by Martin Jambor Committed by Martin Jambor

tree-sra.c (struct access): Changed comment of next_sibling field.

2009-11-04  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (struct access): Changed comment of next_sibling field.
	(analyze_modified_params): Loop over accesses of a group rather than
	over all with the ame base, pass a common bitmap to
	walk_aliased_vdefs.
	(unmodified_by_ref_scalar_representative): Build link lists of
	accesses of a group.
	(splice_param_accesses): Likewise.

From-SVN: r153935
parent 8bae6273
2009-11-05 Martin Jambor <mjambor@suse.cz>
* tree-sra.c (struct access): Changed comment of next_sibling field.
(analyze_modified_params): Loop over accesses of a group rather than
over all with the ame base, pass a common bitmap to
walk_aliased_vdefs.
(unmodified_by_ref_scalar_representative): Build link lists of
accesses of a group.
(splice_param_accesses): Likewise.
2009-11-04 Kenneth Zadeck <zadeck@naturalbridge.com> 2009-11-04 Kenneth Zadeck <zadeck@naturalbridge.com>
* df-scan.c (df-uses-record): Add case zero_extract of mem. * df-scan.c (df-uses-record): Add case zero_extract of mem.
...@@ -144,7 +144,9 @@ struct access ...@@ -144,7 +144,9 @@ struct access
points to the first one. */ points to the first one. */
struct access *first_child; struct access *first_child;
/* Pointer to the next sibling in the access tree as described above. */ /* In intraprocedural SRA, pointer to the next sibling in the access tree as
described above. In IPA-SRA this is a pointer to the next access
belonging to the same group (having the same representative). */
struct access *next_sibling; struct access *next_sibling;
/* Pointers to the first and last element in the linked list of assign /* Pointers to the first and last element in the linked list of assign
...@@ -2824,33 +2826,28 @@ analyze_modified_params (VEC (access_p, heap) *representatives) ...@@ -2824,33 +2826,28 @@ analyze_modified_params (VEC (access_p, heap) *representatives)
repr; repr;
repr = repr->next_grp) repr = repr->next_grp)
{ {
VEC (access_p, heap) *access_vec; struct access *access;
int j, access_count; bitmap visited;
tree parm; ao_ref ar;
if (no_accesses_p (repr)) if (no_accesses_p (repr))
continue; continue;
parm = repr->base; if (!POINTER_TYPE_P (TREE_TYPE (repr->base))
if (!POINTER_TYPE_P (TREE_TYPE (parm))
|| repr->grp_maybe_modified) || repr->grp_maybe_modified)
continue; continue;
access_vec = get_base_access_vector (parm); ao_ref_init (&ar, repr->expr);
access_count = VEC_length (access_p, access_vec); visited = BITMAP_ALLOC (NULL);
for (j = 0; j < access_count; j++) for (access = repr; access; access = access->next_sibling)
{ {
struct access *access;
ao_ref ar;
/* All accesses are read ones, otherwise grp_maybe_modified would /* All accesses are read ones, otherwise grp_maybe_modified would
be trivially set. */ be trivially set. */
access = VEC_index (access_p, access_vec, j);
ao_ref_init (&ar, access->expr);
walk_aliased_vdefs (&ar, gimple_vuse (access->stmt), walk_aliased_vdefs (&ar, gimple_vuse (access->stmt),
mark_maybe_modified, repr, NULL); mark_maybe_modified, repr, &visited);
if (repr->grp_maybe_modified) if (repr->grp_maybe_modified)
break; break;
} }
BITMAP_FREE (visited);
} }
} }
} }
...@@ -3019,24 +3016,30 @@ static struct access * ...@@ -3019,24 +3016,30 @@ static struct access *
unmodified_by_ref_scalar_representative (tree parm) unmodified_by_ref_scalar_representative (tree parm)
{ {
int i, access_count; int i, access_count;
struct access *access; struct access *repr;
VEC (access_p, heap) *access_vec; VEC (access_p, heap) *access_vec;
access_vec = get_base_access_vector (parm); access_vec = get_base_access_vector (parm);
gcc_assert (access_vec); gcc_assert (access_vec);
access_count = VEC_length (access_p, access_vec); repr = VEC_index (access_p, access_vec, 0);
if (repr->write)
return NULL;
repr->group_representative = repr;
for (i = 0; i < access_count; i++) access_count = VEC_length (access_p, access_vec);
for (i = 1; i < access_count; i++)
{ {
access = VEC_index (access_p, access_vec, i); struct access *access = VEC_index (access_p, access_vec, i);
if (access->write) if (access->write)
return NULL; return NULL;
access->group_representative = repr;
access->next_sibling = repr->next_sibling;
repr->next_sibling = access;
} }
access = VEC_index (access_p, access_vec, 0); repr->grp_read = 1;
access->grp_read = 1; repr->grp_scalar_ptr = 1;
access->grp_scalar_ptr = 1; return repr;
return access;
} }
/* Sort collected accesses for parameter PARM, identify representatives for /* Sort collected accesses for parameter PARM, identify representatives for
...@@ -3091,6 +3094,9 @@ splice_param_accesses (tree parm, bool *ro_grp) ...@@ -3091,6 +3094,9 @@ splice_param_accesses (tree parm, bool *ro_grp)
return NULL; return NULL;
modification |= ac2->write; modification |= ac2->write;
ac2->group_representative = access;
ac2->next_sibling = access->next_sibling;
access->next_sibling = ac2;
j++; j++;
} }
......
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