aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2006-01-26 17:48:20 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2006-01-26 09:48:20 -0800
commit7cc92f92ce6c9da6d65817e52da0991e36c1dacb (patch)
tree06b5a23ba99e5da79607625fab90818be39a49d5 /gcc/tree-ssa-structalias.c
parent4f67dfcf24affdc0336fbfc0ff0611251c9703be (diff)
downloadgcc-7cc92f92ce6c9da6d65817e52da0991e36c1dacb.zip
gcc-7cc92f92ce6c9da6d65817e52da0991e36c1dacb.tar.gz
gcc-7cc92f92ce6c9da6d65817e52da0991e36c1dacb.tar.bz2
tree-ssa-structalias.c (intra_create_variable_infos): Create heap variables for incoming parameters if flag_argument_noalias > 1.
2006-01-26 Richard Guenther <rguenther@suse.de> Andrew Pinski <pinskia@physics.uc.edu> * tree-ssa-structalias.c (intra_create_variable_infos): Create heap variables for incoming parameters if flag_argument_noalias > 1. (find_what_p_points_to): Look through default defs of parameter decls. Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu> From-SVN: r110262
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 923bdb7..5f323ce 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4032,7 +4032,8 @@ intra_create_variable_infos (void)
{
tree t;
- /* For each incoming argument arg, ARG = &ANYTHING */
+ /* For each incoming argument arg, ARG = &ANYTHING or a dummy variable if
+ flag_argument_noalias > 1. */
for (t = DECL_ARGUMENTS (current_function_decl); t; t = TREE_CHAIN (t))
{
struct constraint_expr lhs;
@@ -4041,11 +4042,43 @@ intra_create_variable_infos (void)
lhs.offset = 0;
lhs.type = SCALAR;
lhs.var = create_variable_info_for (t, alias_get_name (t));
-
- for (p = get_varinfo (lhs.var); p; p = p->next)
- make_constraint_to_anything (p);
- }
+ /* With flag_argument_noalias greater than one means that the incomming
+ argument cannot alias anything except for itself so create a HEAP
+ variable. */
+ if (POINTER_TYPE_P (TREE_TYPE (t))
+ && flag_argument_noalias > 1)
+ {
+ varinfo_t vi;
+ struct constraint_expr rhs;
+ tree heapvar = heapvar_lookup (t);
+ unsigned int id;
+ if (heapvar == NULL_TREE)
+ {
+ heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)), "PARM_NOALIAS");
+ DECL_EXTERNAL (heapvar) = 1;
+ add_referenced_tmp_var (heapvar);
+ heapvar_insert (t, heapvar);
+ }
+ id = create_variable_info_for (heapvar,
+ alias_get_name (heapvar));
+ vi = get_varinfo (id);
+ vi->is_artificial_var = 1;
+ vi->is_heap_var = 1;
+ rhs.var = id;
+ rhs.type = ADDRESSOF;
+ rhs.offset = 0;
+ for (p = get_varinfo (lhs.var); p; p = p->next)
+ {
+ struct constraint_expr temp = lhs;
+ temp.var = p->id;
+ process_constraint (new_constraint (temp, rhs));
+ }
+ }
+ else
+ for (p = get_varinfo (lhs.var); p; p = p->next)
+ make_constraint_to_anything (p);
+ }
}
/* Set bits in INTO corresponding to the variable uids in solution set
@@ -4105,11 +4138,19 @@ bool
find_what_p_points_to (tree p)
{
unsigned int id = 0;
+ tree lookup_p = p;
if (!have_alias_info)
return false;
- if (lookup_id_for_tree (p, &id))
+ /* For parameters, get at the points-to set for the actual parm
+ decl. */
+ if (TREE_CODE (p) == SSA_NAME
+ && TREE_CODE (SSA_NAME_VAR (p)) == PARM_DECL
+ && default_def (SSA_NAME_VAR (p)) == p)
+ lookup_p = SSA_NAME_VAR (p);
+
+ if (lookup_id_for_tree (lookup_p, &id))
{
varinfo_t vi = get_varinfo (id);