In this project, you will be creating an LLVM pass in order to get control flow graphs and a call graph of a program.
You will create those graphs automatically (e.g., .dot file). Please refer this document to learn how to create a .dot file. To do that, you need to install graphviz package in Ubuntu (e.g., sudo apt-get install graphviz)
Please read this document.
Project 2 Template Source: Project2_src.zip
Project 2 Template Build Files: Project2_Build.zip
Note that all the shell files are for Linux. If you run them on Mac or other OSes, you may encounter issues. In particular, the files that the shell files download
FILE1: download.sh
wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz
wget http://llvm.org/releases/3.4/clang-3.4.src.tar.gz
tar xvzf llvm-3.4.src.tar.gz
tar xvzf clang-3.4.src.tar.gz
mv llvm-3.4 src
mv clang-3.4 src/tools/clang
FILE2: build.sh
mkdir build
cd build
../src/configure
make
FILE3: compile_project.sh
echo "Moving to the Project2 Folder..."
cd ~/llvm/build/lib/Transforms/Project2
echo "Results:"
ls ~/llvm/build/Release+Asserts/lib/Project2.so -alc
cp ~/llvm/build/Release+Asserts/lib/Project2.so ~/llvm/Project2.so
make
FILE4: runpass.sh
opt -load ~/llvm/Project2.so -Project2 < ~/llvm/testprograms/test.bc > /dev/null
Task 1. Getting a Control Flow Graph:
Task 2. Getting a Call Graph:
You need to report
(1) your code with detailed descriptions,
(2) your basic approach and algorithms used (e.g., how did you identify all possible paths, what data structure you have used, what LLVM primitives you used).
Please organize your report as follows.
Please include three sections: Overview, Details, and Results.
1. Overview section summarizes a work-flow of your submission in high-level.
2. Details section explains each function of your LLVM pass. Provide examples and figures to explain your algorithms.
3. Results section shows the outcomes of the graphs and you will point out which parts in the details section is used to get each graph.