2022-04-19 10:56:42 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
clean () {
|
|
|
|
echo "==== Cleaning build folder ===="
|
|
|
|
rm -rf build/
|
2022-04-20 13:38:54 +02:00
|
|
|
rm compile_commands.json
|
2022-04-19 10:56:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
config () {
|
2022-05-24 21:53:15 +02:00
|
|
|
echo "==== Creating build folder ===="
|
2022-04-19 10:56:42 +02:00
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
echo "==== Configuring cmake ===="
|
2022-05-16 13:38:48 +02:00
|
|
|
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DLT_LLVM_INSTALL_DIR=/usr ..
|
2022-04-20 09:55:54 +02:00
|
|
|
cd ..
|
2022-04-21 20:40:39 +02:00
|
|
|
cp build/compile_commands.json compile_commands.json
|
2022-04-19 10:56:42 +02:00
|
|
|
echo "==== Done! ===="
|
|
|
|
}
|
|
|
|
|
|
|
|
compile () {
|
|
|
|
cd build
|
|
|
|
echo "==== Compiling Project ===="
|
|
|
|
ninja
|
|
|
|
cd ..
|
|
|
|
echo "==== Done! ===="
|
|
|
|
}
|
|
|
|
|
|
|
|
run () {
|
|
|
|
echo "==== Running $1 ===="
|
2022-05-17 08:20:52 +02:00
|
|
|
opt -load-pass-plugin build/lib/libCacheAnalysisPass.so \
|
2022-04-19 10:56:42 +02:00
|
|
|
-passes='lru-misses(function(loop-unroll-and-jam))' \
|
|
|
|
test/$1.ll -o /dev/null
|
|
|
|
#llvm-dis < out.bc > out.ll
|
|
|
|
}
|
|
|
|
|
|
|
|
allBenchs=( "adpcm"
|
|
|
|
"bs"
|
|
|
|
"bsort100"
|
|
|
|
"cnt"
|
|
|
|
"compress"
|
|
|
|
"cover"
|
|
|
|
"crc"
|
|
|
|
"dijkstra"
|
|
|
|
"duff"
|
|
|
|
"edn"
|
|
|
|
"expint"
|
|
|
|
"fdct"
|
|
|
|
"fft1"
|
|
|
|
"fibcall"
|
|
|
|
"fir"
|
|
|
|
"hello"
|
|
|
|
"insertsort"
|
|
|
|
"janne_complex"
|
|
|
|
"jfdctint"
|
|
|
|
"lcdnum"
|
|
|
|
"lms"
|
|
|
|
"ludcmp"
|
|
|
|
"matmult"
|
|
|
|
"minver"
|
|
|
|
"ndes"
|
|
|
|
"nsichneu"
|
|
|
|
"ns"
|
|
|
|
"prime"
|
|
|
|
"qsort-exam"
|
|
|
|
"qurt"
|
|
|
|
"recursion"
|
|
|
|
"select"
|
|
|
|
"sqrt"
|
|
|
|
"statemate"
|
|
|
|
"ud"
|
|
|
|
"whet"
|
|
|
|
)
|
|
|
|
|
|
|
|
runall () {
|
|
|
|
for str in ${allBenchs[@]}; do
|
|
|
|
echo
|
|
|
|
run $str
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
clean)
|
|
|
|
clean
|
|
|
|
;;
|
|
|
|
config)
|
|
|
|
config
|
|
|
|
;;
|
|
|
|
c | compile)
|
|
|
|
compile
|
|
|
|
;;
|
|
|
|
cr)
|
|
|
|
compile
|
|
|
|
if [ $2 ]; then
|
|
|
|
run $2
|
|
|
|
else
|
|
|
|
echo "==== Please provide name of the test as second argument! ===="
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
r | run)
|
|
|
|
if [ $2 ]; then
|
|
|
|
run $2
|
|
|
|
else
|
|
|
|
echo "==== Please provide name of the test as second argument! ===="
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
ra | runall)
|
|
|
|
runall
|
|
|
|
;;
|
|
|
|
docker)
|
|
|
|
docker build -t rtsalab01cacheanalysis:latest .
|
|
|
|
docker run -i -d -v "$(pwd)"/.:/root:rw --name RTSAlab01 rtsalab01cacheanalysis
|
|
|
|
;;
|
|
|
|
evaluation | eval)
|
2022-05-06 10:04:45 +02:00
|
|
|
run "crc"
|
|
|
|
echo "==== Correct crc ===="
|
|
|
|
echo "MustHits: 90"
|
2022-05-03 11:13:37 +02:00
|
|
|
echo
|
|
|
|
run "cnt"
|
|
|
|
echo "==== Correct cnt ===="
|
2022-05-06 10:04:45 +02:00
|
|
|
echo "MustHits: 28"
|
2022-05-03 11:13:37 +02:00
|
|
|
echo
|
|
|
|
run "duff"
|
|
|
|
echo "==== Correct duff ===="
|
2022-05-06 10:04:45 +02:00
|
|
|
echo "MustHits: 78"
|
|
|
|
echo
|
|
|
|
run "fft1"
|
|
|
|
echo "==== Correct fft1 ===="
|
|
|
|
echo "MustHits: 74"
|
2022-05-03 11:13:37 +02:00
|
|
|
echo
|
|
|
|
run "insertsort"
|
|
|
|
echo "==== Correct insertsort ===="
|
2022-05-06 10:04:45 +02:00
|
|
|
echo "MustHits: 61"
|
2022-05-03 11:13:37 +02:00
|
|
|
echo
|
|
|
|
run "matmult"
|
|
|
|
echo "==== Correct matmult ===="
|
2022-05-06 10:04:45 +02:00
|
|
|
echo "MustHits: 34"
|
2022-05-03 11:13:37 +02:00
|
|
|
echo
|
2022-04-19 10:56:42 +02:00
|
|
|
;;
|
|
|
|
a | all)
|
|
|
|
clean
|
|
|
|
config
|
2022-04-20 13:32:39 +02:00
|
|
|
cd build
|
2022-04-19 10:56:42 +02:00
|
|
|
ninja
|
|
|
|
echo "==== Done! ===="
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ $1 ]; then
|
|
|
|
echo "Unknown argument: $1"
|
|
|
|
fi
|
|
|
|
echo "Please provide one of the following arguments:"
|
|
|
|
echo " clean Deletes the build folder"
|
|
|
|
echo " config Creates build folder and configures build System"
|
2022-04-19 12:04:12 +02:00
|
|
|
echo " docker Build and Run Docker container for development"
|
|
|
|
echo " eval Run a subset of tests for evaluation of your implementation"
|
2022-04-19 10:56:42 +02:00
|
|
|
echo " c | compile Compiles the Project"
|
|
|
|
echo " a | all Cleans, configures and compiles the project"
|
|
|
|
echo " r | run [name] Run pass on test/[name] from the test folder"
|
|
|
|
echo " cr [name] Compile and run pass on test/[name] from the test folder"
|
|
|
|
echo " ra | runall Run pass on all tests from the test folder"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|