-
Notifications
You must be signed in to change notification settings - Fork 0
/
polycc.sh.in
82 lines (68 loc) · 2.04 KB
/
polycc.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
#
# Top-level script that runs all components of the end-to-end
# system
#
# Just run 'polycc <C code>' when the program section to
# be parallelized/optimized around special comments as described
# in the `README'
#
# Copyright (C) 2007-2008 Uday Bondhugula
#
# Available under GNU GPL version 3 or (at your option) any later version
#
pluto=@SOURCE_DIR@/src/pluto
vloog=@SOURCE_DIR@/vloog
plann=@SOURCE_DIR@/plann
plorc=@SOURCE_DIR@/plorc
# check for command-line options
for arg in $*; do
if [ $arg == "--parallel" ]; then
PARALLEL=1
elif [ $arg == "--parallelize" ]; then
PARALLEL=1
elif [ $arg == "--unroll" ]; then
UNROLL=1
elif [ $arg == "--debug" ]; then
DEBUG=1
elif [ $arg == "--moredebug" ]; then
DEBUG=1
elif [ $arg == "-i" ]; then
INDENT=1
elif [ $arg == "--indent" ]; then
INDENT=1
elif [ $arg == "--silent" ]; then
SILENT=1
fi
done
# some special processing for linearized accesses
#if [ "$SOURCEFILE" != "" ]; then
#grep __SPECIAL $SOURCEFILE > .nonlinearized
#grep __SPECIAL $SOURCEFILE | sed -e "s/.*__SPECIAL//" > .linearized
#fi
$pluto $* || exit 1
SOURCEFILE=`cat .srcfilename`
OUTFILE=`cat .outfilename`
dirname=`dirname $SOURCEFILE`
basename=`basename $SOURCEFILE`
prefix=`basename $SOURCEFILE .c`
CLOOGFILE=$prefix.pluto.cloog
PLUTOOUT=$OUTFILE
# generate and insert unrolling annotations, run ancc on it,
if [ "$UNROLL" == 1 ]; then
$plorc $PLUTOOUT @SOURCE_DIR@/orio-0.1.0
fi
#if [ "$UNROLL" == 1 ]; then
#$plann $PLUTOOUT @SOURCE_DIR@/annotations
#fi
# pre vectorize (#pragma ivdep and scalar bound rep for the
# vectorizable innermost loop if it was detected)
$vloog $PLUTOOUT
# put the original skeleton around the transformed code
@SOURCE_DIR@/inscop $SOURCEFILE $OUTFILE $OUTFILE
if [ "$DEBUG" != 1 ]; then
rm -rf .unroll .vectorize .pragmas .params .orcc .linearized .nonlinearized $CLOOGFILE .srcfilename .outfilename
fi
if [ "$INDENT" == 1 ] && [ -x /usr/bin/indent ]; then
indent -kr -br -ce -l125 $OUTFILE
fi