- Download and install LLVM-3.4 and the Clang frontend (version 3.4) following the instructions given in the Getting Started manual.
- Compile LLVM with the debug flag set (e.g.
./configure --disable-optimized
followed bymake -j4
)
- Following the Getting Started Quickly (A Summary) you should have a
build
directory in/path_to_llvm_directory
. - Check, if the HelloWorld Example is working. (optionally)
- Create a new directory in
/path_to_llvm_directory/build/lib/Transforms
. - Clone the code of DFGenTool into that directory.
- Execute
make
in the newly created directoryDFGenTool
. - A shared object file named
loop_graph_analysis_0.so
will be created in/path_to_llvm_directory/build/Debug+Asserts/lib
.
Examples are supplied in the example
directory of the repository (currently residing in /path_to_llvm_directory/build/lib/Transforms/DFGenTool/
). In this section we walk through the simpleAdder
- Generate a file containing the intemediate code (
.ll
) execute:/path_to_llvm_directory/build/bin/clang -O1 -emit-llvm simpleAdder.c -S -o simpleAdder_generated.ll
- To create a
dot
file from the intermediate code which can be further processed by graphviz tools, use the following command:/path_to_llvm_directory/build/bin/opt -load /path_to_llvm_directory/built/Debug+Asserts/lib/loop_graph_analysis_0.so -loop-graph-analysis-0 simpleAdder_generated.ll
- Two new files are created in the same directory:
0.loop_analysis_graph.dot
and0.loop_analysis_graph.graph
. Compare both dot files containing the flow graphs.