diff mbox

[3/6] Add recursion to make_param_constraints

Message ID 5636561E.2030200@mentor.com
State New
Headers show

Commit Message

Tom de Vries Nov. 1, 2015, 6:12 p.m. UTC
On 01/11/15 19:03, Tom de Vries wrote:
>
> So, the new patch series is:
>
>       1    Rename make_restrict_var_constraints to make_param_constraints
>       2    Handle recursive restrict in function parameter
>
> I'll repost in reply to this message.

This no-functional-changes patch:
- moves the one constraint handling loop left in
    intra_create_variable_infos to make_restrict_var_constraints
- renames make_restrict_var_constraints to make_param_constraints
- adds a parameter toplevel to make_param_constraints to distinguish
    between the two calling contexts
- adds a parmeter restrict_name that allows to pass in the name of
   restrict vars

This patch was posted before at 
https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03111.html .

Thanks,
- Tom

Comments

Richard Biener Nov. 2, 2015, 3:25 p.m. UTC | #1
On Sun, 1 Nov 2015, Tom de Vries wrote:

> On 01/11/15 19:03, Tom de Vries wrote:
> > 
> > So, the new patch series is:
> > 
> >       1    Rename make_restrict_var_constraints to make_param_constraints
> >       2    Handle recursive restrict in function parameter
> > 
> > I'll repost in reply to this message.
> 
> This no-functional-changes patch:
> - moves the one constraint handling loop left in
>    intra_create_variable_infos to make_restrict_var_constraints
> - renames make_restrict_var_constraints to make_param_constraints
> - adds a parameter toplevel to make_param_constraints to distinguish
>    between the two calling contexts
> - adds a parmeter restrict_name that allows to pass in the name of
>   restrict vars
> 
> This patch was posted before at
> https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03111.html .

+         if (toplevel)
+           make_constraint_from (vi, nonlocal_id);
+         else
+           make_copy_constraint (vi, nonlocal_id);

I think make_constraint_from is what we want in both cases.

Ok with this change (thus drop the toplevel parameter).

Richard.
diff mbox

Patch

Rename make_restrict_var_constraints to make_param_constraints

2015-10-27  Tom de Vries  <tom@codesourcery.com>

	* tree-ssa-structalias.c (make_restrict_var_constraints): Rename to ...
	(make_param_constraints): ... this.  Add toplevel and restrict_name
	parameter.
	(intra_create_variable_infos): Use make_param_constraints.
---
 gcc/tree-ssa-structalias.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index d409727..ea34764 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -5892,19 +5892,28 @@  debug_solution_for_var (unsigned int var)
   dump_solution_for_var (stderr, var);
 }
 
-/* Register the constraints for restrict var VI.  */
+/* Register the constraints for VI.  If TOPLEVEL then VI is a function
+   parameter, otherwise VI is part of a function parameter.  Use RESTRICT_NAME
+   as the base name of created restrict vars.  */
 
 static void
-make_restrict_var_constraints (varinfo_t vi)
+make_param_constraints (varinfo_t vi, bool toplevel, const char *restrict_name)
 {
   for (; vi; vi = vi_next (vi))
-    if (vi->may_have_pointers)
-      {
-	if (vi->only_restrict_pointers)
-	  make_constraint_from_global_restrict (vi, "GLOBAL_RESTRICT", true);
-	else
-	  make_copy_constraint (vi, nonlocal_id);
-      }
+    {
+      if (vi->only_restrict_pointers)
+	make_constraint_from_global_restrict (vi, restrict_name, true);
+      else if (vi->may_have_pointers)
+	{
+	  if (toplevel)
+	    make_constraint_from (vi, nonlocal_id);
+	  else
+	    make_copy_constraint (vi, nonlocal_id);
+	}
+
+    if (vi->is_full_var)
+      break;
+    }
 }
 
 /* Create varinfo structures for all of the variables in the
@@ -5941,19 +5950,11 @@  intra_create_variable_infos (struct function *fn)
 	  vi->is_restrict_var = 1;
 	  insert_vi_for_tree (heapvar, vi);
 	  make_constraint_from (p, vi->id);
-	  make_restrict_var_constraints (vi);
+	  make_param_constraints (vi, false, "GLOBAL_RESTRICT");
 	  continue;
 	}
 
-      for (; p; p = vi_next (p))
-	{
-	  if (p->only_restrict_pointers)
-	    make_constraint_from_global_restrict (p, "PARM_RESTRICT", true);
-	  else if (p->may_have_pointers)
-	    make_constraint_from (p, nonlocal_id);
-	  if (p->is_full_var)
-	    break;
-	}
+      make_param_constraints (p, true, "PARM_RESTRICT");
     }
 
   /* Add a constraint for a result decl that is passed by reference.  */
-- 
1.9.1