The LLVM Intermediate Representation (IR) is the backbone that connects frontends and backends, allowing LLVM to parse multiple source languages and generate code to multiple targets. Frontends produce the IR, while backends consume it. The IR is also the point where the majority of LLVM target-independent optimizations takes place. In this chapter, we will cover the following topics:
The characteristics of the LLVM IR
The LLVM IR language syntax
How to write a tool that generates the LLVM IR
The LLVM IR pass structure
How to write your own IR pass