[llvm-commits] [polly] r145401 - /polly/trunk/utils/jscop2cloog.py

Tobias Grosser grosser at fim.uni-passau.de
Tue Nov 29 06:50:53 PST 2011


Author: grosser
Date: Tue Nov 29 08:50:52 2011
New Revision: 145401

URL: http://llvm.org/viewvc/llvm-project?rev=145401&view=rev
Log:
Add utils/jscop2cloog.py

This tool takes a jscop file and translates it into a cloog input file.

Added:
    polly/trunk/utils/jscop2cloog.py   (with props)

Added: polly/trunk/utils/jscop2cloog.py
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/utils/jscop2cloog.py?rev=145401&view=auto
==============================================================================
--- polly/trunk/utils/jscop2cloog.py (added)
+++ polly/trunk/utils/jscop2cloog.py Tue Nov 29 08:50:52 2011
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+import argparse, os
+import json
+
+def getDomains(scop):
+  statements = scop['statements'];
+  numStatements = len(statements)
+
+  output = "%s\n\n" % str(numStatements)
+
+  for statement in scop['statements']:
+    output += "%s\n\n" % statement['domain']
+    output += "0  0  0               # for future options\n\n"
+
+
+  return output
+
+def getSchedules(scop):
+  statements = scop['statements'];
+  numStatements = len(statements)
+
+  output = "%s\n\n" % str(numStatements)
+
+  for statement in scop['statements']:
+    output += "%s\n\n" % statement['schedule']
+
+  return output
+
+def writeCloog(scop):
+  template = """
+# ---------------------- CONTEXT ----------------------
+c # language is C
+
+# Context (no constraints on two parameters)
+%s
+
+0 # We do not want to set manually the parameter names
+
+# --------------------- STATEMENTS --------------------
+%s
+
+0 # We do not want to set manually the iterator names
+
+# --------------------- SCATTERING --------------------
+%s
+
+0 # We do not want to set manually the scattering dimension names
+"""
+
+  context = scop['context']
+  domains = getDomains(scop)
+  schedules = getSchedules(scop)
+  print template % (context, domains, schedules)
+
+def __main__():
+  description = 'Translate JSCoP into iscc input'
+  parser = argparse.ArgumentParser(description)
+  parser.add_argument('inputFile', metavar='N', type=file,
+                      help='The JSCoP file')
+
+  args = parser.parse_args()
+  inputFile = args.inputFile
+  scop = json.load(inputFile)
+
+  writeCloog(scop)
+
+__main__()
+

Propchange: polly/trunk/utils/jscop2cloog.py
------------------------------------------------------------------------------
    svn:executable = *





More information about the llvm-commits mailing list