Optimizing IR
LLVM uses a series of passes to optimize the IR. A pass operates on a unit of IR, such as 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. This series of passes is called the pass pipeline. The pass manager executes the pass pipeline on the IR, which our compiler produces. Therefore, you need to know what the pass manager does and how to construct a pass pipeline. The semantics of a programming language may require the development of new passes, and we must add these passes to the pipeline.
In this chapter, you will learn about the following:
- How to leverage the LLVM pass manager to implement passes within LLVM
- How to implement an instrumentation pass, as an example, within the LLVM project, as well as a separate plugin
- In using the ppprofiler pass with LLVM tools, you will learn how to use a pass plugin with
opt
andclang
- In adding...