diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-04-29 06:29:20 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-04-29 06:29:20 +0000 |
commit | b6a7c8d76b2ba25ab29e18dcddc056f858e71b4a (patch) | |
tree | c2416811255e29d9c65a3aac0ad1c0a42d3a72f1 /polly/utils | |
parent | b0927ea141e5e3f79e94ca911c31281acbbb6173 (diff) | |
download | bcm5719-llvm-b6a7c8d76b2ba25ab29e18dcddc056f858e71b4a.tar.gz bcm5719-llvm-b6a7c8d76b2ba25ab29e18dcddc056f858e71b4a.zip |
Add a converter from jscop to iscc input
llvm-svn: 130478
Diffstat (limited to 'polly/utils')
-rwxr-xr-x | polly/utils/pyscop/jscop2iscc.py | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/polly/utils/pyscop/jscop2iscc.py b/polly/utils/pyscop/jscop2iscc.py new file mode 100755 index 00000000000..3267e8ebc3c --- /dev/null +++ b/polly/utils/pyscop/jscop2iscc.py @@ -0,0 +1,68 @@ +#!/usr/bin/python +import argparse, isl, os +import json + +def printDomain(scop): + + domain = isl.USet('{}') + + for statement in scop['statements']: + domain = domain.union(isl.USet(statement['domain'])) + + print "D :=", + print str(domain) + ";" + +def printAccesses(scop): + + read = isl.UMap('{}') + + for statement in scop['statements']: + for access in statement['accesses']: + if access['kind'] == 'read': + read = read.union(isl.UMap(access['relation'])) + + print "R :=", + print str(read) + ";" + + write = isl.UMap('{}') + + for statement in scop['statements']: + for access in statement['accesses']: + if access['kind'] == 'write': + write = write.union(isl.UMap(access['relation'])) + + print "W :=", + print str(write) + ";" + +def printSchedule(scop): + + schedule = isl.UMap('{}') + + for statement in scop['statements']: + schedule = schedule.union(isl.UMap(statement['schedule'])) + + print "S :=", + print str(schedule) + ";" + +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) + + printDomain(scop) + printAccesses(scop) + printSchedule(scop) + + print 'R := R * D;' + print 'W := W * D;' + print 'Dep := (last W before R under S)[0];' + print 'schedule D respecting Dep minimizing Dep;' + + +__main__() + |