Assignment 1: Introduction to LLVM
Due: 1:00pm, Friday, September 25
We will be using the Low Level Virtual Machine (LLVM) compiler infrastructure developed at the University of Illinois Urbana-Champaign for our project work. We assume you have access to an x86 based machine (preferably running Linux, although Windows and Mac OS X should work as well).
In this project you will write a simple program analysis and familiarize yourself with the LLVM source code. You will write a liveness dataflow analysis from which you will produce a histogram of simultaneously live values.
Install LLVM
First download, install, and build the LLVM 2.4 source code from llvm.org. Follow the instructions on the website for your particular machine configuration. You do not need to build the gcc frontend from source; you can use the prebuilt binaries. We recommend that you install the LLVM gcc frontend in a different directory than your existing gcc install (e.g., /usr0/local instead of /usr/local).
Do not get the source from SVN; we will be working off of the 2.1 release. Make sure you can build LLVM from within your preferred development environment (Eclipse for C++ kind of works, emacs is better if you're already an expert).
Note that in order use a debugger on the LLVM binaries you will need to pass {\tt --enable-debug-runtime --disable-optimized} to the configure script.
Peruse through the documentation. The LLVM Programmer's Manual and Writing an LLVM Pass tutorial are particularly useful.
The rest of the assignment is provided in the above pdf file.
Updates
- If you build the gcc frontend from source, then instead of an llvm-gcc binary you will just have gcc binary.
- If you get an error like this: Symbol
not found:
__ZN4llvm10ModulePass17assignPassManagerERNS_7PMStackENS_15PassManagerTypeE
when trying to run opt with your LivenessHist pass, use the copy of opt in your llvm directory instead of from the install directory.