-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-all-stats.sh
executable file
·149 lines (131 loc) · 4.23 KB
/
run-all-stats.sh
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/bash
# A simple for running benchmarks and checking them script
# replace "YOUR/ABSOLUTE/PATH" with the absolute path to antlr as well as the project
printf "Running benchmarks.....\n\n"
cd benchmarks
printf "Running Clang with No Optimizations.....\n"
printf "~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n\n"
for file in * ;
do
[ -e a.out ] && rm a.out
if [ $file != "a.out" ];
then
printf "clang no-opt time for $file:\n"
gcc -w -S -O0 -emit-llvm $file/$file.c
clang $file.ll
if [ -e a.out ];
then
chmod 777 $file/input.longer
time ./a.out < $file/input.longer > /dev/null 2>&1
# diff $file.results $file/output | head -n 15
# [ -e $file.results ] && rm $file.results
fi
[ -e $file.ll ] && rm $file.ll
[ -e $file.s ] && rm $file.s
printf "\n"
fi
done
printf "Running Clang with Optimizations.....\n"
printf "~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n\n"
for file in * ;
do
[ -e a.out ] && rm a.out
if [ $file != "a.out" ];
then
printf "clang opt time for $file:\n"
gcc -w -S -O3 -emit-llvm $file/$file.c
clang $file.ll
if [ -e a.out ];
then
chmod 777 $file/input.longer
time ./a.out < $file/input.longer > /dev/null 2>&1
# diff $file.results $file/output | head -n 15
# [ -e $file.results ] && rm $file.results
fi
[ -e $file.ll ] && rm $file.ll
[ -e $file.s ] && rm $file.s
printf "\n"
fi
done
printf "Running LLVM Stack Based Implementation Benchmark Tests.....\n"
printf "~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n\n"
for file in * ;
do
[ -e a.out ] && rm a.out
if [ $file != "a.out" ];
then
printf "$file test:\n\n"
java -cp ${CLASSPATH}:/YOUR/ABSOLUTE/PATH/.m2/repository/org/antlr/antlr4-runtime/4.7.1/antlr4-runtime-4.7.1.jar:/YOUR/ABSOLUTE/PATH/mini-compiler-java/target/classes mini.MiniCompiler $file/$file.mini -s -no
if [ -e $file.ll ];
then
printf "word count for non-ssa: "
wc -l $file.ll
printf "\n\n"
clang $file.ll ../src/main/java/mini/malloc_helper.c ../src/main/java/mini/read_helper.c
if [ -e a.out ];
then
chmod 777 $file/input.longer
time ./a.out < $file/input.longer > /dev/null 2>&1
# diff $file.results $file/output | head -n 15
# [ -e $file.results ] && rm $file.results
fi
[ -e $file.ll ] && rm $file.ll
[ -e $file.s ] && rm $file.s
fi
printf "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
fi
done
printf "Running LLVM SSA Benchmark Tests.....\n"
printf "~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n\n"
for file in * ;
do
[ -e a.out ] && rm a.out
if [ $file != "a.out" ];
then
printf "$file test:\n\n"
java -cp ${CLASSPATH}:/YOUR/ABSOLUTE/PATH/.m2/repository/org/antlr/antlr4-runtime/4.7.1/antlr4-runtime-4.7.1.jar:/YOUR/ABSOLUTE/PATH/mini-compiler-java/target/classes mini.MiniCompiler $file/$file.mini -no
if [ -e $file.ll ];
then
printf "word count for ssa: "
wc -l $file.ll
printf "\n\n"
clang $file.ll ../src/main/java/mini/malloc_helper.c ../src/main/java/mini/read_helper.c
if [ -e a.out ];
then
chmod 777 $file/input.longer
time ./a.out < $file/input.longer > /dev/null 2>&1
# diff $file.results $file/output | head -n 15
# [ -e $file.results ] && rm $file.results
fi
[ -e $file.ll ] && rm $file.ll
[ -e $file.s ] && rm $file.s
fi
printf "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
fi
done
printf "Running LLVM SSA Benchmark Tests with Optimizations.....\n"
printf "~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n~\n\n"
for file in * ;
do
[ -e a.out ] && rm a.out
if [ $file != "a.out" ];
then
printf "$file test:\n\n"
java -cp ${CLASSPATH}:/YOUR/ABSOLUTE/PATH/.m2/repository/org/antlr/antlr4-runtime/4.7.1/antlr4-runtime-4.7.1.jar:/YOUR/ABSOLUTE/PATH/mini-compiler-java/target/classes mini.MiniCompiler $file/$file.mini
if [ -e $file.ll ];
then
clang $file.ll ../src/main/java/mini/malloc_helper.c ../src/main/java/mini/read_helper.c
if [ -e a.out ];
then
chmod 777 $file/input.longer
time ./a.out < $file/input.longer > /dev/null 2>&1
# diff $file.results $file/output | head -n 15
# [ -e $file.results ] && rm $file.results
fi
[ -e $file.ll ] && rm $file.ll
[ -e $file.s ] && rm $file.s
fi
printf "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
fi
done
exit