llvm Resources

Getting started with llvm.

Before getting started with LLVM you will need to read several documents to become familiar with llvm. First you should read the getting started guide: http://llvm.org/docs/GettingStarted.html

This should show you how to write a pass in llvm. Finally, as a reference, you will need the llvm doxygen document to write code for your passes and/or make changes to llvm. It is here: http://llvm.org/doxygen/

This document should be read very thoroughly. It contains important information about the directory structure of llvm. It also explains how to build llvm and use some of the programs you will need to work with llvm (clang, opt, llc, etc…)

 

Writing passes in llvm

1. Writing a hello world llvm pass – LLVM works with passes to optimize code that is being compiled. Since our work is on optimizations and analysis in the compiler you will need to learn to write passes. Make this hello world pass: http://llvm.org/docs/WritingAnLLVMPass.html. This will not give you all of the information you need, but will get you started.

2. Writing a more complicated front end pass – project.

3. Writing a backend pass – project.

 

More advanced stuff

Since llvm is developed as a library of C++ objects it uses inheritance and polymorphism in its infrastructure. Use the following tutorial to write your own classes in llvm that can use inheritance and polymorphism.
http://aviral.lab.asu.edu/?p=1683

Some useful utilities and hacks for llvm.
http://aviral.lab.asu.edu/?p=1692

Pointer Analysis – To do pointer analysis on llvm you will need to use use-def and def-use chains to trace pointers throughout the program.
http://aviral.lab.asu.edu/?p=1699