summaryrefslogtreecommitdiff
path: root/gcc/graphite-poly.h
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2009-11-25 05:21:26 +0000
committerSebastian Pop <spop@gcc.gnu.org>2009-11-25 05:21:26 +0000
commitf70de156ee79126bdb86837e6a2e41930c531836 (patch)
treef077f119e5b664d698f1c0e679293ab62b894687 /gcc/graphite-poly.h
parent74715a9bf6a5c2e4732b6e9e848048498251c19e (diff)
downloadgcc-f70de156ee79126bdb86837e6a2e41930c531836.tar.gz
graphite-poly.c (new_scop): Initialize SCOP_ORIGINAL_SCHEDULE...
2009-10-22 Sebastian Pop <sebastian.pop@amd.com> * graphite-poly.c (new_scop): Initialize SCOP_ORIGINAL_SCHEDULE, SCOP_TRANSFORMED_SCHEDULE, and SCOP_SAVED_SCHEDULE. (free_scop): Call free_lst on SCOP_ORIGINAL_SCHEDULE, SCOP_TRANSFORMED_SCHEDULE, and SCOP_SAVED_SCHEDULE. * graphite-poly.h (free_lst): New. (store_lst_schedule): Free SCOP_SAVED_SCHEDULE. (restore_lst_schedule): Free SCOP_TRANSFORMED_SCHEDULE. From-SVN: r154618
Diffstat (limited to 'gcc/graphite-poly.h')
-rw-r--r--gcc/graphite-poly.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 3782c788463..0de58ba519d 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -670,6 +670,28 @@ new_lst_stmt (poly_bb_p pbb)
return lst;
}
+/* Frees the memory used by LST. */
+
+static inline void
+free_lst (lst_p lst)
+{
+ if (!lst)
+ return;
+
+ if (LST_LOOP_P (lst))
+ {
+ int i;
+ lst_p l;
+
+ for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ free_lst (l);
+
+ VEC_free (lst_p, heap, LST_SEQ (lst));
+ }
+
+ free (lst);
+}
+
/* Returns a copy of LST. */
static inline lst_p
@@ -945,6 +967,9 @@ store_scattering_pbb (poly_bb_p pbb)
static inline void
store_lst_schedule (scop_p scop)
{
+ if (SCOP_SAVED_SCHEDULE (scop))
+ free_lst (SCOP_SAVED_SCHEDULE (scop));
+
SCOP_SAVED_SCHEDULE (scop) = copy_lst (SCOP_TRANSFORMED_SCHEDULE (scop));
}
@@ -953,6 +978,9 @@ store_lst_schedule (scop_p scop)
static inline void
restore_lst_schedule (scop_p scop)
{
+ if (SCOP_TRANSFORMED_SCHEDULE (scop))
+ free_lst (SCOP_TRANSFORMED_SCHEDULE (scop));
+
SCOP_TRANSFORMED_SCHEDULE (scop) = copy_lst (SCOP_SAVED_SCHEDULE (scop));
}