From 74715a9bf6a5c2e4732b6e9e848048498251c19e Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebastian.pop@amd.com>
Date: Wed, 25 Nov 2009 05:20:58 +0000
Subject: [PATCH] graphite-poly.h (struct scop): Add a field saved_schedule.

2009-10-22  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-poly.h (struct scop): Add a field saved_schedule.
	(SCOP_SAVED_SCHEDULE): New.
	(store_lst_schedule): New.
	(restore_lst_schedule): New.
	(store_scattering): Call store_lst_schedule.
	(restore_scattering): Call restore_lst_schedule.

From-SVN: r154617
---
 gcc/ChangeLog.graphite |  9 +++++++++
 gcc/graphite-poly.h    | 25 +++++++++++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index b932dd0d1e5f..2450045b0182 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,12 @@
+2009-10-22  Sebastian Pop  <sebastian.pop@amd.com>
+
+	* graphite-poly.h (struct scop): Add a field saved_schedule.
+	(SCOP_SAVED_SCHEDULE): New.
+	(store_lst_schedule): New.
+	(restore_lst_schedule): New.
+	(store_scattering): Call store_lst_schedule.
+	(restore_scattering): Call restore_lst_schedule.
+
 2009-10-20  Sebastian Pop  <sebastian.pop@amd.com>
 
 	* graphite-sese-to-poly.c (free_data_refs_aux): Fix formatting.
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 8165d35fb49c..3782c788463e 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -823,8 +823,8 @@ struct scop
      representation.  */
   VEC (poly_bb_p, heap) *bbs;
 
-  /* Original and transformed schedules.  */
-  lst_p original_schedule, transformed_schedule;
+  /* Original, transformed and saved schedules.  */
+  lst_p original_schedule, transformed_schedule, saved_schedule;
 
   /* The context describes known restrictions concerning the parameters
      and relations in between the parameters.
@@ -852,6 +852,7 @@ struct scop
 #define SCOP_ORIGINAL_PDDRS(S) (S->original_pddrs)
 #define SCOP_ORIGINAL_SCHEDULE(S) (S->original_schedule)
 #define SCOP_TRANSFORMED_SCHEDULE(S) (S->transformed_schedule)
+#define SCOP_SAVED_SCHEDULE(S) (S->saved_schedule)
 
 extern scop_p new_scop (void *);
 extern void free_scop (scop_p);
@@ -939,6 +940,22 @@ store_scattering_pbb (poly_bb_p pbb)
   PBB_SAVED (pbb) = poly_scattering_copy (PBB_TRANSFORMED (pbb));
 }
 
+/* Stores the SCOP_TRANSFORMED_SCHEDULE to SCOP_SAVED_SCHEDULE.  */
+
+static inline void
+store_lst_schedule (scop_p scop)
+{
+  SCOP_SAVED_SCHEDULE (scop) = copy_lst (SCOP_TRANSFORMED_SCHEDULE (scop));
+}
+
+/* Restores the SCOP_TRANSFORMED_SCHEDULE from SCOP_SAVED_SCHEDULE.  */
+
+static inline void
+restore_lst_schedule (scop_p scop)
+{
+  SCOP_TRANSFORMED_SCHEDULE (scop) = copy_lst (SCOP_SAVED_SCHEDULE (scop));
+}
+
 /* Saves the scattering for all the pbbs in the SCOP.  */
 
 static inline void
@@ -949,6 +966,8 @@ store_scattering (scop_p scop)
 
   for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
     store_scattering_pbb (pbb);
+
+  store_lst_schedule (scop);
 }
 
 /* Restores the scattering of PBB.  */
@@ -972,6 +991,8 @@ restore_scattering (scop_p scop)
 
   for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
     restore_scattering_pbb (pbb);
+
+  restore_lst_schedule (scop);
 }
 
 #endif
-- 
GitLab