Chapter 8: Optimizing IR
LLVM uses a series of Passes to optimize the intermediate representation (IR). A Pass performs an operation on a unit of IR, either a function or a module. The operation can be a transformation, which changes the IR in a defined way, or an analysis, which collects information such as dependencies. A series of Passes is called the Pass pipeline. The Pass manager executes the Pass pipeline on the IR that our compiler produces. Therefore, it is important that we know what the Pass manager does and how to construct a Pass pipeline. The semantics of a programming language might require the development of new Passes, and we must add these Passes to the pipeline.
In this chapter, we will cover the following topics:
- Introducing the LLVM Pass manager
- Implementing a Pass using the new Pass manager
- Adapting a Pass for use with the old Pass manager
- Adding an optimization pipeline to your compiler
By the end of the chapter, you will know how...