diff mbox

[graphite] Remove sese_adjust_liveout_phis

Message ID AANLkTikdVlDst_Zqcq0-uMqk_diKqA15doXGPiB3qx4G@mail.gmail.com
State New
Headers show

Commit Message

Sebastian Pop June 12, 2010, 8:19 a.m. UTC
On Sat, Jun 12, 2010 at 02:53, Sebastian Pop <sebpop@gmail.com> wrote:
> Hi,
>
> with the attached patches we no longer need to use the rename_map to
> substitute the arguments of the phi nodes created after the code
> generated by Graphite.  I committed these patches to the graphite
> branch, and I will commit them to trunk once they pass the usual
> graphite branch tests.
>
> The aim is to replace the rename_map with the map that CLooG exposes
> for each user statement: associating to a loop level an expression.
> The expand_* functions will be replaced by the code generation from a
> chrec that is obtained from the original scev by chrec_applying the
> loop level -> expression map on each varying loop.  This will then
> allow us to remove the call to the IV canonicalization from Graphite.
>

The attached patch removes two uses of rename_map from gloog.
Committed to the graphite branch.

Sebastian
diff mbox

Patch

From be9a6b386261452607f5440a46bbfb10700bf3d3 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Sat, 12 Jun 2010 03:12:04 -0500
Subject: [PATCH] Remove rename_nb_iterations and rename_sese_parameters

2010-06-12  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-clast-to-gimple.c (gloog): Do not pass scops in parameter.
	Remove calls to rename_nb_iterations and rename_sese_parameters.
	* graphite-clast-to-gimple.h (gloog): Update declaration.
	* graphite.c (graphite_transform_loops): Update call to gloog.
	* sese.c (rename_variables_in_expr): Removed.
	(rename_nb_iterations): Removed.
	(rename_sese_parameters): Removed.
	* sese.h (rename_nb_iterations): Removed.
	(rename_sese_parameters): Removed.
---
 gcc/ChangeLog.graphite         |   12 ++++++++
 gcc/graphite-clast-to-gimple.c |    8 +-----
 gcc/graphite-clast-to-gimple.h |    2 +-
 gcc/graphite.c                 |    2 +-
 gcc/sese.c                     |   56 ----------------------------------------
 gcc/sese.h                     |    2 -
 6 files changed, 15 insertions(+), 67 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index d703048..b4e2700 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,17 @@ 
 2010-06-12  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-clast-to-gimple.c (gloog): Do not pass scops in parameter.
+	Remove calls to rename_nb_iterations and rename_sese_parameters.
+	* graphite-clast-to-gimple.h (gloog): Update declaration.
+	* graphite.c (graphite_transform_loops): Update call to gloog.
+	* sese.c (rename_variables_in_expr): Removed.
+	(rename_nb_iterations): Removed.
+	(rename_sese_parameters): Removed.
+	* sese.h (rename_nb_iterations): Removed.
+	(rename_sese_parameters): Removed.
+
+2010-06-12  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-clast-to-gimple.c (gloog): Remove call to
 	sese_adjust_liveout_phis.
 	* graphite-sese-to-poly.c (scev_analyzable_p): When scev returns an
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 01adba0..54801ce 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1531,7 +1531,7 @@  create_params_index (htab_t index_table, CloogProgram *prog) {
 */
 
 bool
-gloog (scop_p scop, VEC (scop_p, heap) *scops, htab_t bb_pbb_mapping)
+gloog (scop_p scop, htab_t bb_pbb_mapping)
 {
   VEC (tree, heap) *newivs = VEC_alloc (tree, heap, 10);
   loop_p context_loop;
@@ -1539,7 +1539,6 @@  gloog (scop_p scop, VEC (scop_p, heap) *scops, htab_t bb_pbb_mapping)
   ifsese if_region = NULL;
   htab_t rename_map, newivs_index, params_index;
   cloog_prog_clast pc;
-  int i;
 
   timevar_push (TV_GRAPHITE_CODE_GEN);
   gloog_error = false;
@@ -1579,11 +1578,6 @@  gloog (scop_p scop, VEC (scop_p, heap) *scops, htab_t bb_pbb_mapping)
 		   bb_pbb_mapping, 1, params_index);
   graphite_verify ();
   scev_reset_htab ();
-  rename_nb_iterations (rename_map);
-
-  for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
-    rename_sese_parameters (rename_map, SCOP_REGION (scop));
-
   recompute_all_dominators ();
   graphite_verify ();
 
diff --git a/gcc/graphite-clast-to-gimple.h b/gcc/graphite-clast-to-gimple.h
index f6557f6..c90cfc0 100644
--- a/gcc/graphite-clast-to-gimple.h
+++ b/gcc/graphite-clast-to-gimple.h
@@ -36,7 +36,7 @@  typedef struct bb_pbb_def
   poly_bb_p pbb;
 }bb_pbb_def;
 
-extern bool gloog (scop_p, VEC (scop_p, heap) *, htab_t);
+extern bool gloog (scop_p, htab_t);
 extern cloog_prog_clast scop_to_clast (scop_p);
 extern void debug_clast_stmt (struct clast_stmt *);
 extern void print_clast_stmt (FILE *, struct clast_stmt *);
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 5f28aeb..51bf800 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -289,7 +289,7 @@  graphite_transform_loops (void)
   for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
     if (POLY_SCOP_P (scop)
 	&& apply_poly_transforms (scop)
-	&& gloog (scop, scops, bb_pbb_mapping))
+	&& gloog (scop, bb_pbb_mapping))
       need_cfg_cleanup_p = true;
 
   htab_delete (bb_pbb_mapping);
diff --git a/gcc/sese.c b/gcc/sese.c
index 051599e..361c9b6 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -435,62 +435,6 @@  set_rename (htab_t map, tree old_name, tree expr)
   *slot = new_rename_map_elt (old_name, expr);
 }
 
-/* Renames the expression T following the tuples (OLD_NAME, EXPR) in
-   the rename map M.  Returns the expression T after renaming.  */
-
-static tree
-rename_variables_in_expr (htab_t m, tree t)
-{
-  if (!t)
-    return t;
-
- if (TREE_CODE (t) == SSA_NAME)
-   return get_rename (m, t);
-
-  switch (TREE_CODE_LENGTH (TREE_CODE (t)))
-    {
-    case 3:
-      TREE_OPERAND (t, 2) = rename_variables_in_expr (m, TREE_OPERAND (t, 2));
-
-    case 2:
-      TREE_OPERAND (t, 1) = rename_variables_in_expr (m, TREE_OPERAND (t, 1));
-
-    case 1:
-      TREE_OPERAND (t, 0) = rename_variables_in_expr (m, TREE_OPERAND (t, 0));
-
-    default:
-      return t;
-    }
-}
-
-/* Renames all the loop->nb_iterations expressions following the
-   tuples (OLD_NAME, EXPR) in RENAME_MAP.  */
-
-void
-rename_nb_iterations (htab_t rename_map)
-{
-  loop_iterator li;
-  struct loop *loop;
-
-  FOR_EACH_LOOP (li, loop, 0)
-    loop->nb_iterations = rename_variables_in_expr (rename_map,
-						    loop->nb_iterations);
-}
-
-/* Renames all the parameters of SESE following the tuples (OLD_NAME,
-   EXPR) in RENAME_MAP.  */
-
-void
-rename_sese_parameters (htab_t rename_map, sese region)
-{
-  int i;
-  tree p;
-
-  for (i = 0; VEC_iterate (tree, SESE_PARAMS (region), i, p); i++)
-    VEC_replace (tree, SESE_PARAMS (region), i,
-		 rename_variables_in_expr (rename_map, p));
-}
-
 /* Rename the SSA_NAMEs used in STMT and that appear in MAP.  */
 
 static void
diff --git a/gcc/sese.h b/gcc/sese.h
index 4b2e5c2..d0d829f 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -262,8 +262,6 @@  extern void debug_rename_map (htab_t);
 extern hashval_t rename_map_elt_info (const void *);
 extern int eq_rename_map_elts (const void *, const void *);
 extern void set_rename (htab_t, tree, tree);
-extern void rename_nb_iterations (htab_t);
-extern void rename_sese_parameters (htab_t, sese);
 
 /* Constructs a new SCEV_INFO_STR structure for VAR and INSTANTIATED_BELOW.  */
 
-- 
1.7.0.4