The web tool outputs an optimized LLVM assembly file. Before linking it with the other modules of your C/C++/Objective-C program, you need to compile it for your specific machine.
For this, you need to have installed the LLVM binaries. These can be acquired by either building LLVM yourself (see Installation), or by installing them using a package manager of your operating system:
apt-get install clang llvm
brew install llvm
After having LLVM binaries installed, you can translate from the LLVM assembly to native assembly:
llc optimized.ll -o module.s
And finally compile the native assembly to an object file:
g++ module.s -o module.o
clang++ module.s -o module.o
This tool works on LLVM version 3.6. Compatibility with older versions is not guaranteed.
You are required to build LLVM yourself. A very good guide for this can be found here. We recommend that you also build Clang, the C/C++/Obj-C frontend, alongside with LLVM, using this guide.
After building LLVM and Clang, it's the turn of building Restrictifier itself. This process is the same as building any custom LLVM pass. As such, this guide can help you in this effort.
Assuming you've correctly installed LLVM and Clang, it's pretty simple to use Restrictifier. You should have the LLVM binaries in your path.
First, we can translate a C/C++ file into an LLVM bitcode using Clang:
clang -c -emit-llvm file.c -o file.bc ${CFLAGS}
clang++ -c -emit-llvm file.cpp -o file.bc ${CXXFLAGS}
After all units have been compiled, you need to link them together:
llvm-link file1.bc file2.bc file3.bc -o program.bc ${LDFLAGS}
Now it's time to optimize your program. As such, use the LLVM optimizer:
opt -mem2reg -cfl-aa -libcall-aa -globalsmodref-aa -scev-aa -scoped-noalias -basicaa -tbaa
-load PATH_TO_RESTRICTIFICATION/AliasFunctionCloning.(so|dylib) -afc -O3 -disable-inlining
-o program.optimized.bc
This is quite a long command. Let's break it down:
What is left to do is just translating it from LLVM assembly to native assembly:
llc program.optimized.bc -o program.s
And assemble it:
g++ program.s -o program.exe
Now you have an optimized version of your program.