--- gcc/tree-ssa-structalias.c	(/mirror/gcc-trunk)	(revision 146)
+++ gcc/tree-ssa-structalias.c	(/local/gcc-clean)	(revision 146)
@@ -72,9 +72,10 @@ Foundation, Inc., 51 Franklin Street, Fi
    of C Code in a Second" by ""Nevin Heintze and Olivier Tardieu" at
    http://citeseer.ist.psu.edu/heintze01ultrafast.html 
 
-   There are three types of constraint expressions, DEREF, ADDRESSOF, and
-   SCALAR.  Each constraint expression consists of a constraint type,
-   a variable, and an offset.  
+   There are three types of real constraint expressions, DEREF,
+   ADDRESSOF, and SCALAR.  There is one type of fake constraint
+   expression, called INCLUDES.  Each constraint expression consists
+   of a constraint type, a variable, and an offset.
    
    SCALAR is a constraint expression type used to represent x, whether
    it appears on the LHS or the RHS of a statement.
@@ -82,6 +83,10 @@ Foundation, Inc., 51 Franklin Street, Fi
    it appears on the LHS or the RHS of a statement. 
    ADDRESSOF is a constraint expression used to represent &x, whether
    it appears on the LHS or the RHS of a statement.
+   INCLUDES is a constraint expression type used to represent just a
+   setting of a bit in the points-to set without having the address
+   taken.  It exists mainly for abstraction sake, and is used for
+   initializing fake variables like the ESCAPED_VARS set.
    
    Each pointer variable in the program is assigned an integer id, and
    each field of a structure variable is assigned an integer id as well.
@@ -391,7 +396,7 @@ new_var_info (tree t, unsigned int id, c
   return ret;
 }
 
-typedef enum {SCALAR, DEREF, ADDRESSOF} constraint_expr_type;
+typedef enum {SCALAR, DEREF, ADDRESSOF, INCLUDES} constraint_expr_type;
 
 /* An expression that appears in a constraint.  */
 
@@ -508,7 +513,7 @@ dump_constraint (FILE *file, constraint_
   if (c->lhs.type == ADDRESSOF)
     fprintf (file, "&");
   else if (c->lhs.type == DEREF)
-    fprintf (file, "*");  
+    fprintf (file, "*");
   fprintf (file, "%s", get_varinfo_fc (c->lhs.var)->name);
   if (c->lhs.offset != 0)
     fprintf (file, " + " HOST_WIDE_INT_PRINT_DEC, c->lhs.offset);
@@ -517,9 +522,13 @@ dump_constraint (FILE *file, constraint_
     fprintf (file, "&");
   else if (c->rhs.type == DEREF)
     fprintf (file, "*");
+  else if (c->rhs.type == INCLUDES)
+    fprintf (file, "{");
   fprintf (file, "%s", get_varinfo_fc (c->rhs.var)->name);
   if (c->rhs.offset != 0)
     fprintf (file, " + " HOST_WIDE_INT_PRINT_DEC, c->rhs.offset);
+  if (c->rhs.type == INCLUDES)
+    fprintf (file, "}");
   fprintf (file, "\n");
 }
 
@@ -1227,7 +1236,7 @@ build_constraint_graph (void)
 	  if (!(get_varinfo (lhsvar)->is_special_var))
 	    insert_into_complex (rhsvar, c);
 	}
-      else if (rhs.type == ADDRESSOF)
+      else if (rhs.type == ADDRESSOF || rhs.type == INCLUDES)
 	{
 	  /* x = &y */
 	  bitmap_set_bit (get_varinfo (lhsvar)->solution, rhsvar);
@@ -1878,7 +1887,7 @@ perform_var_substitution (constraint_gra
       bitmap tmp;
       unsigned int k;
       bitmap_iterator bi;
-
+      
       /* We can't eliminate things whose address is taken, or which is
 	 the target of a dereference.  */
       if (vi->address_taken || vi->indirect_target)
@@ -2266,7 +2275,7 @@ get_constraint_exp_from_ssa_var (tree t)
      say it points to readonly memory instead.  */
   if (cexpr.var == anything_id && TREE_READONLY (t))
     {
-      cexpr.type = ADDRESSOF;
+      cexpr.type = INCLUDES;
       cexpr.var = readonly_id;
     }
     
@@ -2285,7 +2294,9 @@ process_constraint (constraint_t t)
   
   gcc_assert (rhs.var < VEC_length (varinfo_t, varmap));
   gcc_assert (lhs.var < VEC_length (varinfo_t, varmap));
-
+  
+  gcc_assert (lhs.type != INCLUDES);
+  
   if (lhs.type == DEREF)
     get_varinfo (lhs.var)->directly_dereferenced = true;
   if (rhs.type == DEREF)
@@ -2296,7 +2307,7 @@ process_constraint (constraint_t t)
     return;
 
   /* If we have &ANYTHING = something, convert to SOMETHING = &ANYTHING) */
-  else if (lhs.var == anything_id && lhs.type == ADDRESSOF)
+  else if (lhs.var == anything_id && lhs.type == INCLUDES)
     {
       rhs = t->lhs;
       t->lhs = t->rhs;
@@ -2327,17 +2338,16 @@ process_constraint (constraint_t t)
       varinfo_t vi;
       gcc_assert (rhs.offset == 0);
       
-      /* No need to mark address taken simply because of escaped vars
-	 constraints.  */
-      if (lhs.var != escaped_vars_id)
+      if (rhs.type == ADDRESSOF)
 	for (vi = get_varinfo (rhs.var); vi != NULL; vi = vi->next)
-	  vi->address_taken = true;
+	vi->address_taken = true;
 
       VEC_safe_push (constraint_t, heap, constraints, t);
     }
   else
     {
-      if (lhs.type != DEREF && rhs.type == DEREF)
+      if (lhs.type != DEREF && rhs.type == DEREF
+	  && (lhs.var != escaped_vars_id))
 	get_varinfo (lhs.var)->indirect_target = true;
       VEC_safe_push (constraint_t, heap, constraints, t);
     }
@@ -2655,7 +2665,7 @@ get_constraint_for (tree t, VEC (ce_s, h
 		vi = get_varinfo (temp.var);
 		vi->is_artificial_var = 1;
 		vi->is_heap_var = 1;
-		temp.type = ADDRESSOF;
+		temp.type = INCLUDES;
 		temp.offset = 0;
 		VEC_safe_push (ce_s, heap, *results, &temp);
 		return;
@@ -3834,7 +3844,9 @@ make_constraint_to_escaped (struct const
   lhs.var = escaped_vars_id;
   lhs.offset = 0;
   lhs.type = SCALAR;
-
+  
+  if (rhs.type == ADDRESSOF)
+    rhs.type = INCLUDES;
   process_constraint (new_constraint (lhs, rhs));
 }
 
@@ -4020,6 +4032,7 @@ find_global_initializers (tree *tp, int 
 	    lhs.type = SCALAR;
 	    lhs.offset = 0;
 	    process_constraint (new_constraint (lhs, *c));
+	    make_constraint_to_escaped (*c);
 	  }
 
 	VEC_free (ce_s, heap, rhsc);
@@ -4107,7 +4120,7 @@ create_variable_info_for (tree decl, con
 	{
 	  struct constraint_expr rhs;
 	  rhs.var = index;
-	  rhs.type = ADDRESSOF;
+	  rhs.type = INCLUDES;
 	  rhs.offset = 0;
 	  make_constraint_to_escaped (rhs);
 	} 
@@ -4206,7 +4219,7 @@ create_variable_info_for (tree decl, con
 		  struct constraint_expr rhs;
 	      
 		  rhs.var = newindex;
-		  rhs.type = ADDRESSOF;
+		  rhs.type = INCLUDES;
 		  rhs.offset = 0;
 		  make_constraint_to_escaped (rhs);
 		} 
@@ -4229,12 +4242,20 @@ dump_solution_for_var (FILE *file, unsig
   unsigned int i;
   bitmap_iterator bi; 
   
-  fprintf (file, "%s = { ", vi->name);
-  EXECUTE_IF_SET_IN_BITMAP (get_varinfo (vi->node)->solution, 0, i, bi)
+  if (vi->node != var)
+    {
+      varinfo_t vipt = get_varinfo (vi->node);
+      fprintf (file, "%s = same as %s\n", vi->name, vipt->name);
+    }
+  else
     {
-      fprintf (file, "%s ", get_varinfo (i)->name);
+      fprintf (file, "%s = { ", vi->name);
+      EXECUTE_IF_SET_IN_BITMAP (get_varinfo (vi->node)->solution, 0, i, bi)
+	{
+	  fprintf (file, "%s ", get_varinfo (i)->name);
+	}
+      fprintf (file, "}\n");
     }
-  fprintf (file, "}\n");
 }
 
 /* Print the points-to solution for VAR to stdout.  */
@@ -4296,7 +4317,7 @@ intra_create_variable_infos (void)
 	  vi->is_artificial_var = 1;
 	  vi->is_heap_var = 1;
 	  rhs.var = id;
-	  rhs.type = ADDRESSOF;
+	  rhs.type = INCLUDES;
 	  rhs.offset = 0;
           for (p = get_varinfo (lhs.var); p; p = p->next)
 	    {
@@ -4325,7 +4346,7 @@ intra_create_variable_infos (void)
   nonlocal_vi->directly_dereferenced = true;
 
   rhs.var = nonlocal_vars_id;
-  rhs.type = ADDRESSOF;
+  rhs.type = INCLUDES;
   rhs.offset = 0;
   
   lhs.var = escaped_vars_id;
@@ -4498,7 +4519,6 @@ find_what_p_points_to (tree p)
 void
 dump_sa_points_to_info (FILE *outfile)
 {
-  unsigned int i;
 
   fprintf (outfile, "\nPoints-to sets\n\n");
 
@@ -4514,9 +4534,13 @@ dump_sa_points_to_info (FILE *outfile)
       fprintf (outfile, "Iterations:               %d\n", stats.iterations);
       fprintf (outfile, "Number of edges:          %d\n", stats.num_edges);
     }
-
-  for (i = 0; i < VEC_length (varinfo_t, varmap); i++)
-    dump_solution_for_var (outfile, i);
+  
+  if (dump_flags & TDF_DETAILS)
+    {
+      unsigned int i;
+      for (i = 0; i < VEC_length (varinfo_t, varmap); i++)
+	dump_solution_for_var (outfile, i);
+    }
 }
 
 
@@ -4570,7 +4594,7 @@ init_base_vars (void)
   lhs.type = SCALAR;
   lhs.var = anything_id;
   lhs.offset = 0;
-  rhs.type = ADDRESSOF;
+  rhs.type = INCLUDES;
   rhs.var = anything_id;
   rhs.offset = 0;
   var_anything->address_taken = true;
@@ -4601,7 +4625,7 @@ init_base_vars (void)
   lhs.type = SCALAR;
   lhs.var = readonly_id;
   lhs.offset = 0;
-  rhs.type = ADDRESSOF;
+  rhs.type = INCLUDES;
   rhs.var = anything_id;
   rhs.offset = 0;
   
@@ -4626,7 +4650,7 @@ init_base_vars (void)
   lhs.type = SCALAR;
   lhs.var = integer_id;
   lhs.offset = 0;
-  rhs.type = ADDRESSOF;
+  rhs.type = INCLUDES;
   rhs.var = anything_id;
   rhs.offset = 0;
   process_constraint (new_constraint (lhs, rhs));

Property changes on: 
___________________________________________________________________
Name: svk:merge
 +138bc75d-0d04-0410-961f-82ee72b054a4:/trunk:118991
 +7dca8dba-45c1-47dc-8958-1a7301c5ed47:/local-gcc/md-constraint:113709
 +f367781f-d768-471e-ba66-e306e17dff77:/local/gen-rework-20060122:110130

