diff mbox

[ssa-coalesce] Rename register_ssa_partition

Message ID cc9aa0e1-72c7-f45f-4514-6e41151595c6@linaro.org
State New
Headers show

Commit Message

Kugan Vivekanandarajah Nov. 8, 2016, 2:32 a.m. UTC
Hi,

In tree-ssa-coalesce, register_ssa_partition ) and
register_ssa_partition_check have lost their meaning over various 
commits and now just verifies that ssa_var is indeed a SSA_NAME and not 
a virtual_operand_p. It is confusing when one look at if for the fist 
time and would expect more while reading the register_ssa_partition.

Attached patch just changes it to verify_ssa_for_coalesce to better 
reflect what it is doing now.

Bootstrap and regression testing is ongoing. Is this OK for trunk if no 
regressions?

Thanks,
Kugan



gcc/ChangeLog:

2016-11-08  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* tree-ssa-coalesce.c (register_default_def): Remove usage of arg
	map which is not used at all.
	(create_outofssa_var_map): Use renamed verify_ssa_for_coalesce from
	register_ssa_partition.
	* tree-ssa-live.c (verify_ssa_for_coalesce): Renamed 
register_ssa_partition.
	(register_ssa_partition_check): Remove.
	* tree-ssa-live.h (register_ssa_partition): Renamed to 
verify_ssa_for_coalesce

Comments

Richard Biener Nov. 8, 2016, 12:45 p.m. UTC | #1
On Tue, Nov 8, 2016 at 3:32 AM, kugan <kugan.vivekanandarajah@linaro.org> wrote:
> Hi,
>
> In tree-ssa-coalesce, register_ssa_partition ) and
> register_ssa_partition_check have lost their meaning over various commits
> and now just verifies that ssa_var is indeed a SSA_NAME and not a
> virtual_operand_p. It is confusing when one look at if for the fist time and
> would expect more while reading the register_ssa_partition.
>
> Attached patch just changes it to verify_ssa_for_coalesce to better reflect
> what it is doing now.
>
> Bootstrap and regression testing is ongoing. Is this OK for trunk if no
> regressions?

Hum, can you retain the inline wrapper please?  I find the new name
verify_ssa_for_coalesce bad as tree-ssa-live.h is something generic,
not just coalescing related.  I'd say a better improvement would be to remove
register_ssa_partition completely.

Richard.

> Thanks,
> Kugan
>
>
>
> gcc/ChangeLog:
>
> 2016-11-08  Kugan Vivekanandarajah  <kuganv@linaro.org>
>
>         * tree-ssa-coalesce.c (register_default_def): Remove usage of arg
>         map which is not used at all.
>         (create_outofssa_var_map): Use renamed verify_ssa_for_coalesce from
>         register_ssa_partition.
>         * tree-ssa-live.c (verify_ssa_for_coalesce): Renamed
> register_ssa_partition.
>         (register_ssa_partition_check): Remove.
>         * tree-ssa-live.h (register_ssa_partition): Renamed to
> verify_ssa_for_coalesce
diff mbox

Patch

diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 6423cdd..8adbd62 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -1040,17 +1040,15 @@  create_default_def (tree var, void *arg ATTRIBUTE_UNUSED)
 /* Register VAR's default def in MAP.  */
 
 static void
-register_default_def (tree var, void *map_)
+register_default_def (tree var, void *arg ATTRIBUTE_UNUSED)
 {
-  var_map map = (var_map)map_;
-
   if (!is_gimple_reg (var))
     return;
 
   tree ssa = ssa_default_def (cfun, var);
   gcc_assert (ssa);
 
-  register_ssa_partition (map, ssa);
+  verify_ssa_for_coalesce (ssa);
 }
 
 /* If VAR is an SSA_NAME associated with a PARM_DECL or a RESULT_DECL,
@@ -1096,7 +1094,7 @@  create_outofssa_var_map (coalesce_list *cl, bitmap used_in_copy)
 
   map = init_var_map (num_ssa_names);
 
-  for_all_parms (register_default_def, map);
+  for_all_parms (register_default_def, NULL);
 
   FOR_EACH_BB_FN (bb, cfun)
     {
@@ -1114,7 +1112,7 @@  create_outofssa_var_map (coalesce_list *cl, bitmap used_in_copy)
 
 	  res = gimple_phi_result (phi);
 	  ver = SSA_NAME_VERSION (res);
-	  register_ssa_partition (map, res);
+	  verify_ssa_for_coalesce (res);
 
 	  /* Register ssa_names and coalesces between the args and the result
 	     of all PHI.  */
@@ -1125,7 +1123,7 @@  create_outofssa_var_map (coalesce_list *cl, bitmap used_in_copy)
 	      if (TREE_CODE (arg) != SSA_NAME)
 		continue;
 
-	      register_ssa_partition (map, arg);
+	      verify_ssa_for_coalesce (arg);
 	      if (gimple_can_coalesce_p (arg, res)
 		  || (e->flags & EDGE_ABNORMAL))
 		{
@@ -1154,7 +1152,7 @@  create_outofssa_var_map (coalesce_list *cl, bitmap used_in_copy)
 
 	  /* Register USE and DEF operands in each statement.  */
 	  FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, (SSA_OP_DEF|SSA_OP_USE))
-	    register_ssa_partition (map, var);
+	    verify_ssa_for_coalesce (var);
 
 	  /* Check for copy coalesces.  */
 	  switch (gimple_code (stmt))
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index b9eef20..1fadf86 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -102,6 +102,26 @@  delete_var_map (var_map map)
 }
 
 
+/* Verify that SSA_VAR is a non-virtual SSA_NAME when
+   flag_checking is enabled.  */
+
+void
+verify_ssa_for_coalesce (tree ssa_var)
+{
+  if (flag_checking)
+    {
+      gcc_assert (TREE_CODE (ssa_var) == SSA_NAME);
+      if (virtual_operand_p (ssa_var))
+	{
+	  fprintf (stderr, "Illegally registering a virtual SSA name :");
+	  print_generic_expr (stderr, ssa_var, TDF_SLIM);
+	  fprintf (stderr, " in the SSA->Normal phase.\n");
+	  internal_error ("SSA corruption");
+	}
+    }
+}
+
+
 /* This function will combine the partitions in MAP for VAR1 and VAR2.  It
    Returns the partition which represents the new partition.  If the two
    partitions cannot be combined, NO_PARTITION is returned.  */
@@ -1276,22 +1296,6 @@  debug (tree_live_info_d *ptr)
 }
 
 
-/* Verify that SSA_VAR is a non-virtual SSA_NAME.  */
-
-void
-register_ssa_partition_check (tree ssa_var)
-{
-  gcc_assert (TREE_CODE (ssa_var) == SSA_NAME);
-  if (virtual_operand_p (ssa_var))
-    {
-      fprintf (stderr, "Illegally registering a virtual SSA name :");
-      print_generic_expr (stderr, ssa_var, TDF_SLIM);
-      fprintf (stderr, " in the SSA->Normal phase.\n");
-      internal_error ("SSA corruption");
-    }
-}
-
-
 /* Verify that the info in LIVE matches the current cfg.  */
 
 static void
diff --git a/gcc/tree-ssa-live.h b/gcc/tree-ssa-live.h
index 6df102a..6fc0895 100644
--- a/gcc/tree-ssa-live.h
+++ b/gcc/tree-ssa-live.h
@@ -80,7 +80,7 @@  extern void remove_unused_locals (void);
 extern void dump_var_map (FILE *, var_map);
 extern void debug (_var_map &ref);
 extern void debug (_var_map *ptr);
-extern void register_ssa_partition_check (tree ssa_var);
+extern void verify_ssa_for_coalesce (tree ssa_var);
 
 
 /* Return number of partitions in MAP.  */
@@ -175,17 +175,6 @@  num_basevars (var_map map)
 
 
 
-/* This routine registers a partition for SSA_VAR with MAP.  Any unregistered
-   partitions may be filtered out by a view later.  */
-
-static inline void
-register_ssa_partition (var_map map ATTRIBUTE_UNUSED, tree ssa_var)
-{
-  if (flag_checking)
-    register_ssa_partition_check (ssa_var);
-}
-
-
 /*  ---------------- live on entry/exit info ------------------------------
 
     This structure is used to represent live range information on SSA based