This repo started as the code support for a workshop that we organized at the KTH School of Information and Communication Technology in Stockholm in December 2017.
The purpose of the workshop was to introduce people to the LLVM IR and middle end (the target-independent optimizer). We assumed no previous knowledge about the LLVM IR or the LLVM APIs. We tried to keep it simple and focus on the basic concepts that would allow people to write a pass that understands and transforms the IR. We did not cover complex topics such as pass management internals, def-use chains, using existing analysis passes etc, but we think the materials here are enough to get someone started.
We used a virtual machine for the workshop. You can reproduce that setup by following these instructions.
You can find the tasks for the workshop and an LLVM cheatsheet here. We also had some slides.
We're going to slowly move all that information into this repo. Stay tuned.
Special thanks to Adrian Sampson, whose excellent tutorial we have used as a starting point. Note that we have updated the original code to work with LLVM 5.0.
A completely useless LLVM pass. It's for LLVM 3.8.
Build:
$ cd llvm-pass-skeleton
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cd ..
Run:
$ clang -Xclang -load -Xclang build/skeleton/libSkeletonPass.* something.c