Writing Your First Optimization
This chapter introduces advanced compiler topics that you will need to work with the LLVM infrastructure and compilers in general. Similar to Chapter 3, you will see how these concepts map to LLVM application programming interfaces (APIs).
To help you build confidence in writing your own programs, we will build a program together that performs a simple optimization called constant propagation. If you are not familiar with this optimization, do not worry – this is mainly an excuse to manipulate LLVM APIs, and we will explain it in due time.
This chapter will cover the following key topics:
- The concepts involved in a modern compiler framework like LLVM to write optimizations
- How to write an optimization in LLVM
Before we get started, let us review the software that you will need for this chapter.