3 # Top-level script that runs all components of the end-to-end
6 # Just run 'polycc <C code>' when the program section to
7 # be parallelized/optimized around special comments as described
10 # Copyright (C) 2007-2008 Uday Bondhugula
12 # Available under GNU GPL version 3 or (at your option) any later version
15 pluto
=@SOURCE_DIR@
/src
/pluto
16 plann
=@SOURCE_DIR@
/plann
17 plorc
=@SOURCE_DIR@
/plorc
19 # Some additional setup here to ensure that variables are visible outside of the run function
25 # check for command-line options
27 if [ $arg == "--parallel" ]; then
29 elif [ $arg == "--parallelize" ]; then
31 elif [ $arg == "--unroll" ]; then
33 elif [ $arg == "--debug" ]; then
35 elif [ $arg == "--moredebug" ]; then
37 elif [ $arg == "-i" ]; then
39 elif [ $arg == "--indent" ]; then
41 elif [ $arg == "--silent" ]; then
46 # some special processing for linearized accesses
47 #if [ "$SOURCEFILE" != "" ]; then
48 #grep __SPECIAL $SOURCEFILE > .nonlinearized
49 #grep __SPECIAL $SOURCEFILE | sed -e "s/.*__SPECIAL//" > .linearized
56 SOURCEFILE
=`cat .srcfilename`
57 OUTFILE
=`cat .outfilename`
59 dirname=`dirname $SOURCEFILE`
60 basename=`basename $SOURCEFILE`
61 prefix
=`basename $SOURCEFILE .c`
63 CLOOGFILE
=`basename $OUTFILE`.pluto.cloog
66 # generate and insert unrolling annotations, run ancc on it,
67 if [ "$UNROLL" == 1 ]; then
68 $plorc $PLUTOOUT @SOURCE_DIR@
/orio-0.1
.0
71 #if [ "$UNROLL" == 1 ]; then
72 #$plann $PLUTOOUT @SOURCE_DIR@/annotations
76 # put the original skeleton around the transformed code
77 @SOURCE_DIR@
/inscop
$SOURCEFILE $OUTFILE $OUTFILE
80 if [ "$INDENT" == 1 ] && [ -x /usr
/bin
/indent
]; then
81 indent
-kr -br -ce -l125 $OUTFILE
91 if grep -q "#pragma scop" "$PLUTOOUT"
93 # Move the original file into a temporary location
94 TEMPFILE
="$SOURCEFILE""_temp"
95 mv $SOURCEFILE $TEMPFILE
97 # Move the file that still has scope in it into
98 # place of the original source file, so $* will pick the
100 mv $PLUTOOUT $SOURCEFILE
105 # Move the original back in place
106 mv $TEMPFILE $SOURCEFILE
115 # An attempt to move the original file back in place
116 # in the event of an exception
117 if [ -f "$TEMPFILE" ]
119 mv $TEMPFILE $SOURCEFILE
121 if [ "$DEBUG" != 1 ]; then
122 rm -rf .unroll .vectorize .pragmas .params .orcc .linearized .nonlinearized\
123 $CLOOGFILE .srcfilename .outfilename .distmem pi.cloog sigma.cloog \
124 *.sysloog .appendfilename
128 trap cleanup SIGINT
exit