[Support] Use C++11 attribute syntax for visibility attributes
[llvm-project.git] / polly / utils / jscop2cloog.py
blob29383974f26780ce13a91ca71dc2d8edf321269a
1 #!/usr/bin/env python
2 import argparse, os
3 import json
5 def getDomains(scop):
6 statements = scop['statements'];
7 numStatements = len(statements)
9 output = "%s\n\n" % str(numStatements)
11 for statement in scop['statements']:
12 output += "%s\n\n" % statement['domain']
13 output += "0 0 0 # for future options\n\n"
16 return output
18 def getSchedules(scop):
19 statements = scop['statements'];
20 numStatements = len(statements)
22 output = "%s\n\n" % str(numStatements)
24 for statement in scop['statements']:
25 output += "%s\n\n" % statement['schedule']
27 return output
29 def writeCloog(scop):
30 template = """
31 # ---------------------- CONTEXT ----------------------
32 c # language is C
34 # Context (no constraints on two parameters)
37 0 # We do not want to set manually the parameter names
39 # --------------------- STATEMENTS --------------------
42 0 # We do not want to set manually the iterator names
44 # --------------------- SCATTERING --------------------
47 0 # We do not want to set manually the schedule dimension names
48 """
50 context = scop['context']
51 domains = getDomains(scop)
52 schedules = getSchedules(scop)
53 print template % (context, domains, schedules)
55 def __main__():
56 description = 'Translate JSCoP into iscc input'
57 parser = argparse.ArgumentParser(description)
58 parser.add_argument('inputFile', metavar='N', type=file,
59 help='The JSCoP file')
61 args = parser.parse_args()
62 inputFile = args.inputFile
63 scop = json.load(inputFile)
65 writeCloog(scop)
67 __main__()