llvm-capstone/polly/utils/jscop2cloog.py
Tobias Grosser 5483931117 Rename 'scattering' to 'schedule'
In Polly we used both the term 'scattering' and the term 'schedule' to describe
the execution order of a statement without actually distinguishing between them.
We now uniformly use the term 'schedule' for the execution order.  This
corresponds to the terminology of isl.

History: CLooG introduced the term scattering as the generated code can be used
as a sequential execution order (schedule) or as a parallel dimension
enumerating different threads of execution (placement). In Polly and/or isl the
term placement was never used, but we uniformly refer to an execution order as a
schedule and only later introduce parallelism. When doing so we do not talk
about about specific placement dimensions.

llvm-svn: 235380
2015-04-21 11:37:25 +00:00

69 lines
1.5 KiB
Python
Executable File

#!/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 schedule 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__()