Commit ea395a11 by Martin Jambor Committed by Martin Jambor

tree-sra.c (generate_subtree_copies): Updated comment.

2010-09-15  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (generate_subtree_copies): Updated comment.
	(handle_unscalarized_data_in_subtree): Removed parameter lhs which is
	obtained from the statement iterator instead.
	(load_assign_lhs_subreplacements): Removed parameters lhs and
	right_offset, which is obtained from top_racc instead.  Parameter lacc
	is now expected to be the root of the processed tree rather than root's
	first child.  Updated all callers.

From-SVN: r164304
parent 6d96b48b
2010-09-15 Martin Jambor <mjambor@suse.cz>
* tree-sra.c (generate_subtree_copies): Updated comment.
(handle_unscalarized_data_in_subtree): Removed parameter lhs which is
obtained from the statement iterator instead.
(load_assign_lhs_subreplacements): Removed parameters lhs and
right_offset, which is obtained from top_racc instead. Parameter lacc
is now expected to be the root of the processed tree rather than root's
first child. Updated all callers.
2010-09-15 Joseph Myers <joseph@codesourcery.com> 2010-09-15 Joseph Myers <joseph@codesourcery.com>
* config/pdp11/pdp11.c (register_move_cost): Rename to * config/pdp11/pdp11.c (register_move_cost): Rename to
......
...@@ -2169,12 +2169,12 @@ analyze_all_variable_accesses (void) ...@@ -2169,12 +2169,12 @@ analyze_all_variable_accesses (void)
} }
/* Generate statements copying scalar replacements of accesses within a subtree /* Generate statements copying scalar replacements of accesses within a subtree
into or out of AGG. ACCESS is the first child of the root of the subtree to into or out of AGG. ACCESS, all its children, siblings and their children
be processed. AGG is an aggregate type expression (can be a declaration but are to be processed. AGG is an aggregate type expression (can be a
does not have to be, it can for example also be a mem_ref or a series of declaration but does not have to be, it can for example also be a mem_ref or
handled components). TOP_OFFSET is the offset of the processed subtree a series of handled components). TOP_OFFSET is the offset of the processed
which has to be subtracted from offsets of individual accesses to get subtree which has to be subtracted from offsets of individual accesses to
corresponding offsets for AGG. If CHUNK_SIZE is non-null, copy only get corresponding offsets for AGG. If CHUNK_SIZE is non-null, copy only
replacements in the interval <start_offset, start_offset + chunk_size>, replacements in the interval <start_offset, start_offset + chunk_size>,
otherwise copy all. GSI is a statement iterator used to place the new otherwise copy all. GSI is a statement iterator used to place the new
statements. WRITE should be true when the statements should write from AGG statements. WRITE should be true when the statements should write from AGG
...@@ -2405,11 +2405,11 @@ enum unscalarized_data_handling { SRA_UDH_NONE, /* Nothing done so far. */ ...@@ -2405,11 +2405,11 @@ enum unscalarized_data_handling { SRA_UDH_NONE, /* Nothing done so far. */
SRA_UDH_LEFT }; /* Data flushed to the LHS. */ SRA_UDH_LEFT }; /* Data flushed to the LHS. */
/* Store all replacements in the access tree rooted in TOP_RACC either to their /* Store all replacements in the access tree rooted in TOP_RACC either to their
base aggregate if there are unscalarized data or directly to LHS base aggregate if there are unscalarized data or directly to LHS of the
otherwise. */ statement that is pointed to by GSI otherwise. */
static enum unscalarized_data_handling static enum unscalarized_data_handling
handle_unscalarized_data_in_subtree (struct access *top_racc, tree lhs, handle_unscalarized_data_in_subtree (struct access *top_racc,
gimple_stmt_iterator *gsi) gimple_stmt_iterator *gsi)
{ {
if (top_racc->grp_unscalarized_data) if (top_racc->grp_unscalarized_data)
...@@ -2421,6 +2421,7 @@ handle_unscalarized_data_in_subtree (struct access *top_racc, tree lhs, ...@@ -2421,6 +2421,7 @@ handle_unscalarized_data_in_subtree (struct access *top_racc, tree lhs,
} }
else else
{ {
tree lhs = gimple_assign_lhs (gsi_stmt (*gsi));
generate_subtree_copies (top_racc->first_child, lhs, top_racc->offset, generate_subtree_copies (top_racc->first_child, lhs, top_racc->offset,
0, 0, gsi, false, false, 0, 0, gsi, false, false,
gimple_location (gsi_stmt (*gsi))); gimple_location (gsi_stmt (*gsi)));
...@@ -2429,33 +2430,30 @@ handle_unscalarized_data_in_subtree (struct access *top_racc, tree lhs, ...@@ -2429,33 +2430,30 @@ handle_unscalarized_data_in_subtree (struct access *top_racc, tree lhs,
} }
/* Try to generate statements to load all sub-replacements in an access /* Try to generate statements to load all sub-replacements in an access subtree
(sub)tree (LACC is the first child) from scalar replacements in the TOP_RACC formed by children of LACC from scalar replacements in the TOP_RACC subtree.
(sub)tree. If that is not possible, refresh the TOP_RACC base aggregate and If that is not possible, refresh the TOP_RACC base aggregate and load the
load the accesses from it. LEFT_OFFSET is the offset of the left whole accesses from it. LEFT_OFFSET is the offset of the left whole subtree being
subtree being copied, RIGHT_OFFSET is the same thing for the right subtree. copied. NEW_GSI is stmt iterator used for statement insertions after the
NEW_GSI is stmt iterator used for statement insertions after the original original assignment, OLD_GSI is used to insert statements before the
assignment, OLD_GSI is used to insert statements before the assignment. assignment. *REFRESHED keeps the information whether we have needed to
*REFRESHED keeps the information whether we have needed to refresh refresh replacements of the LHS and from which side of the assignments this
replacements of the LHS and from which side of the assignments this takes takes place. */
place. */
static void static void
load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc, load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc,
HOST_WIDE_INT left_offset, HOST_WIDE_INT left_offset,
HOST_WIDE_INT right_offset,
gimple_stmt_iterator *old_gsi, gimple_stmt_iterator *old_gsi,
gimple_stmt_iterator *new_gsi, gimple_stmt_iterator *new_gsi,
enum unscalarized_data_handling *refreshed, enum unscalarized_data_handling *refreshed)
tree lhs)
{ {
location_t loc = gimple_location (gsi_stmt (*old_gsi)); location_t loc = gimple_location (gsi_stmt (*old_gsi));
do for (lacc = lacc->first_child; lacc; lacc = lacc->next_sibling)
{ {
if (lacc->grp_to_be_replaced) if (lacc->grp_to_be_replaced)
{ {
struct access *racc; struct access *racc;
HOST_WIDE_INT offset = lacc->offset - left_offset + right_offset; HOST_WIDE_INT offset = lacc->offset - left_offset + top_racc->offset;
gimple stmt; gimple stmt;
tree rhs; tree rhs;
...@@ -2471,7 +2469,7 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc, ...@@ -2471,7 +2469,7 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc,
/* No suitable access on the right hand side, need to load from /* No suitable access on the right hand side, need to load from
the aggregate. See if we have to update it first... */ the aggregate. See if we have to update it first... */
if (*refreshed == SRA_UDH_NONE) if (*refreshed == SRA_UDH_NONE)
*refreshed = handle_unscalarized_data_in_subtree (top_racc, lhs, *refreshed = handle_unscalarized_data_in_subtree (top_racc,
old_gsi); old_gsi);
if (*refreshed == SRA_UDH_LEFT) if (*refreshed == SRA_UDH_LEFT)
...@@ -2490,16 +2488,13 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc, ...@@ -2490,16 +2488,13 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc,
} }
else if (*refreshed == SRA_UDH_NONE else if (*refreshed == SRA_UDH_NONE
&& lacc->grp_read && !lacc->grp_covered) && lacc->grp_read && !lacc->grp_covered)
*refreshed = handle_unscalarized_data_in_subtree (top_racc, lhs, *refreshed = handle_unscalarized_data_in_subtree (top_racc,
old_gsi); old_gsi);
if (lacc->first_child) if (lacc->first_child)
load_assign_lhs_subreplacements (lacc->first_child, top_racc, load_assign_lhs_subreplacements (lacc, top_racc, left_offset,
left_offset, right_offset, old_gsi, new_gsi, refreshed);
old_gsi, new_gsi, refreshed, lhs);
lacc = lacc->next_sibling;
} }
while (lacc);
} }
/* Result code for SRA assignment modification. */ /* Result code for SRA assignment modification. */
...@@ -2714,14 +2709,12 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi) ...@@ -2714,14 +2709,12 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi)
enum unscalarized_data_handling refreshed; enum unscalarized_data_handling refreshed;
if (lacc->grp_read && !lacc->grp_covered) if (lacc->grp_read && !lacc->grp_covered)
refreshed = handle_unscalarized_data_in_subtree (racc, lhs, gsi); refreshed = handle_unscalarized_data_in_subtree (racc, gsi);
else else
refreshed = SRA_UDH_NONE; refreshed = SRA_UDH_NONE;
load_assign_lhs_subreplacements (lacc->first_child, racc, load_assign_lhs_subreplacements (lacc, racc, lacc->offset,
lacc->offset, racc->offset, &orig_gsi, gsi, &refreshed);
&orig_gsi, gsi, &refreshed,
lhs);
if (refreshed != SRA_UDH_RIGHT) if (refreshed != SRA_UDH_RIGHT)
{ {
gsi_next (gsi); gsi_next (gsi);
......
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