Writing an LLVM Pass
  1. Introduction - What is a pass?
  2. Quick Start - Writing hello world
  3. Pass classes and requirements
  4. Pass Registration
  5. Specifying interactions between passes
  6. Implementing Analysis Groups
  7. What PassManager does
  8. Using GDB with dynamically loaded passes
  9. Future extensions planned

    Written by Chris Lattner

Introduction - What is a pass?

Quick Start - Writing hello world
   Setting up the build environment


   Basic code required
   Running a pass with opt or analyze
Pass classes and requirements
   The ImmutablePass class
   The Pass class


The run method

   The FunctionPass class


The doInitialization(Module &) method


The runOnFunction method


The doFinalization(Module &) method

   The BasicBlockPass class


The doInitialization(Function &) method


The runOnBasicBlock method


The doFinalization(Function &) method

   The MachineFunctionPass class


The runOnMachineFunction(MachineFunction &MF) method

Pass registration


The print method

Specifying interactions between passes


The getAnalysisUsage method


The getAnalysis<> method

Implementing Analysis Groups


Analysis Group Concepts


Using RegisterAnalysisGroup

What PassManager does


The releaseMemory method

Using GDB with dynamically loaded passes


Setting a breakpoint in your pass


Miscellaneous Problems

Future extensions planned


Multithreaded LLVM


A new ModuleSource interface


Pass's requiring FunctionPass's


Chris Lattner
The LLVM Compiler Infrastructure
Last modified: Mon Oct 27 12:00:00 CDT 2003