Patchwork [7/8] Add cloog_checksum.

login
register
mail settings
Submitter Sebastian Pop
Date Sept. 9, 2010, 7:30 p.m.
Message ID <1284060606-26216-7-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/64327/
State New
Headers show

Comments

Sebastian Pop - Sept. 9, 2010, 7:30 p.m.
2010-09-09  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-poly.c (cloog_checksum): New.
	* graphite-poly.h (cloog_checksum): Declared.
---
 gcc/ChangeLog.graphite |    5 +++++
 gcc/graphite-poly.c    |   18 ++++++++++++++++++
 gcc/graphite-poly.h    |    1 +
 3 files changed, 24 insertions(+), 0 deletions(-)

Patch

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index ea2c115..f2c4127 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,10 @@ 
 2010-09-09  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-poly.c (cloog_checksum): New.
+	* graphite-poly.h (cloog_checksum): Declared.
+
+2010-09-09  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-poly.c (pbb_number_of_iterations): Removed.
 	(pbb_number_of_iterations_at_time): Correctly compute the number
 	of iterations in the transformed loop.
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 0a3cc1f..2fc7124 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -1911,5 +1911,23 @@  dot_lst (lst_p lst)
 #endif
 }
 
+/* Computes a checksum for the code generated by CLooG for SCOP.  */
+
+DEBUG_FUNCTION void
+cloog_checksum (scop_p scop ATTRIBUTE_UNUSED)
+{
+  /* When debugging, enable the following code.  This cannot be used
+     in production compilers because it calls "system".  */
+#if 1
+  FILE *stream = fopen ("/tmp/scop.cloog", "w");
+  gcc_assert (stream);
+  print_cloog (stream, scop, 0);
+  fclose (stream);
+
+  fputs ("\n", stdout);
+  system ("cloog -compilable 1 /tmp/scop.cloog > /tmp/scop.c ; gcc -O0 -g /tmp/scop.c -lm -o /tmp/scop; /tmp/scop | md5sum ");
+#endif
+}
+
 #endif
 
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 98ce124..b9bf1ed 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -1398,6 +1398,7 @@  extern int scop_max_loop_depth (scop_p);
 extern int unify_scattering_dimensions (scop_p);
 extern bool apply_poly_transforms (scop_p);
 extern bool graphite_legal_transform (scop_p);
+extern void cloog_checksum (scop_p);
 
 /* Set the region of SCOP to REGION.  */