summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authordberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-20 13:38:01 +0000
committerdberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-20 13:38:01 +0000
commitabd433a73a0d509e9769dfb35dd2af57edc1ca48 (patch)
tree16d20e32d96535b3c2b5c91db8c2382c5b3fb541 /gcc/tree-ssa-alias.c
parent1ed004b714e2f2f646040e6fde2100dbe1f79e1d (diff)
downloadgcc-abd433a73a0d509e9769dfb35dd2af57edc1ca48.tar.gz
2006-02-20 Daniel Berlin <dberlin@dberlin.org>
* tree.h (struct tree_memory_tag): Add is_used_alone member. (TMT_USED_ALONE): New macro. * tree-pass.h (PROP_tmt_usage): New property. (TODO_update_tmt_usage): New todo. * tree-ssa-alias.c (updating_used_alone): New variable. (recalculate_used_alone): New function. (compute_may_aliases): Set updating_used_alone, call recalculate_used_alone. * tree-sra.c (pass_sra): Note that this pass destroys PROP_tmt_usage, and add TODO_update_tmt_usage. * tree-ssa-forwprop.c (pass_forwprop): Ditto. * tree-flow.h (updating_used_alone): Prototype. (recalculate_used_alone): Ditto. * passes.c (execute_todo): Add code to set updating_used_alone, and call recalculate. * tree-ssa-operands.c (add_virtual_operand): Only append bare def for clobber if used alone, and add assert to verify used_alone status. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111300 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c81
1 files changed, 80 insertions, 1 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index bb2c3ce5c9e..a32c8439657 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -392,6 +392,12 @@ set_initial_properties (struct alias_info *ai)
}
}
+/* This variable is set to true if we are updating the used alone
+ information for TMT's, or are in a pass that is going to break it
+ temporarily. */
+
+bool updating_used_alone;
+
/* Compute which variables need to be marked call clobbered because
their tag is call clobbered, and which tags need to be marked
global because they contain global variables. */
@@ -417,6 +423,76 @@ compute_call_clobbered (struct alias_info *ai)
compute_tag_properties ();
}
+
+/* Recalculate the used_alone information for TMT's . */
+void
+recalculate_used_alone (void)
+{
+ VEC (tree, heap) *calls = NULL;
+ block_stmt_iterator bsi;
+ basic_block bb;
+ tree stmt;
+ size_t i;
+ referenced_var_iterator rvi;
+ tree var;
+
+ /* First, reset all the TMT used alone bits to zero. */
+ updating_used_alone = true;
+ FOR_EACH_REFERENCED_VAR (var, rvi)
+ if (TREE_CODE (var) == TYPE_MEMORY_TAG)
+ TMT_USED_ALONE (var) = 0;
+
+ /* Walk all the statements.
+ Calls get put into a list of statements to update, since we will
+ need to update operands on them if we make any changes.
+ If we see a bare use of a TMT anywhere in a real virtual use or virtual
+ def, mark the TMT as used alone, and for renaming. */
+
+
+ FOR_EACH_BB (bb)
+ {
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ stmt = bsi_stmt (bsi);
+ if (TREE_CODE (stmt) == CALL_EXPR
+ || (TREE_CODE (stmt) == MODIFY_EXPR
+ && TREE_CODE (TREE_OPERAND (stmt, 1)) == CALL_EXPR))
+ VEC_safe_push (tree, heap, calls, stmt);
+ else
+ {
+ ssa_op_iter iter;
+
+ FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter,
+ SSA_OP_VUSE | SSA_OP_VIRTUAL_DEFS)
+ {
+ tree svar = var;
+
+ if(TREE_CODE (var) == SSA_NAME)
+ svar = SSA_NAME_VAR (var);
+
+ if (TREE_CODE (svar) == TYPE_MEMORY_TAG)
+ {
+ if (!TMT_USED_ALONE (svar))
+ {
+ TMT_USED_ALONE (svar) = true;
+ mark_sym_for_renaming (svar);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* Update the operands on all the calls we saw. */
+ if (calls)
+ {
+ for (i = 0; VEC_iterate (tree, calls, i, stmt); i++)
+ update_stmt (stmt);
+ }
+ VEC_free (tree, heap, calls);
+ updating_used_alone = false;
+}
+
/* Compute may-alias information for every variable referenced in function
FNDECL.
@@ -585,6 +661,7 @@ compute_may_aliases (void)
/* Deallocate memory used by aliasing data structures. */
delete_alias_info (ai);
+ updating_used_alone = true;
{
block_stmt_iterator bsi;
basic_block bb;
@@ -596,9 +673,11 @@ compute_may_aliases (void)
}
}
}
-
+ recalculate_used_alone ();
+ updating_used_alone = false;
}
+
struct tree_opt_pass pass_may_alias =
{
"alias", /* name */