120 likes | 470 Views
Rupesh Nasre. Jan 12, 2011. LLVM Primer. Slides and examples available at http://clweb.csa.iisc.ernet.in/nasre/tech/research/. Outline. Introduction Writing a pass Writing an analysis. Introduction. What is LLVM? More information: llvm.org. Is LLVM active?. Current version: 2.8.
E N D
Rupesh Nasre. Jan 12, 2011 LLVM Primer Slides and examples available at http://clweb.csa.iisc.ernet.in/nasre/tech/research/
Outline • Introduction • Writing a pass • Writing an analysis
Introduction • What is LLVM? • More information: llvm.org
Is LLVM active? Current version: 2.8
LLVM reach Used by Adobe, Apple, Cray, NIC, Siemens, Sun, etc. Used in CMU, Ghent, NTU, Rice, Stanford, UC, UIUC, Upenn, Utexas, etc.
Compilation Phases • Frontend: Source -> IR • Optimizations: IR -> IR • Code generation: IR -> x86 In this course
Compilation Phases • Frontend: Source -> IR • Optimizations: IR -> IR • Code generation: IR -> x86 In this talk
Outline • Introduction • Writing a pass • Writing an analysis
Writing a pass • Install: doesn't require root privileges. • LLVM • LLVM-GCC • Compile example to bytecode. • Create the pass • compile to .so • load using opt • run on the example bytecode
Outline • Introduction • Writing a pass • Writing an analysis
Summary • LLVM is a thick forest, you can easily get lost. • After initial warm-up, it is better to look at the documentation on demand-basis. • Use LLVM mailing lists; first search for your question. • It is C++, compilation errors are non-decipherable. • LLVM type system is strong. Avoid a quick type-cast now and you will save 2 hours of debugging tomorrow. • Your assignments would take time: start early.
Rupesh Nasre. nasre@csa.iisc.ernet.in Jan 12, 2011 LLVM Primer