Understanding LLVM IR
In previous chapters, you learned how a compiler is structured around an intermediate representation (IR) and how IRs map to the C++ classes used in LLVM.
You are now ready to go even deeper into the LLVM infrastructure!
In this chapter, you will learn the syntax and semantics of the IR that powers most of the tools built with and around the LLVM infrastructure. This IR is so pervasive in the LLVM ecosystem that it is simply called LLVM IR.
The goal of this chapter is to give you enough knowledge to be able to do the following:
- Understand basic LLVM IR programs
- Find the information you need to understand what not-yet-seen LLVM IR constructs do
- Write simple LLVM IR programs
These skills are key to being able to think about the legality of the transformations you will write or modify. Indeed, by understanding what is representable in the IR, you will be able to think of ways to alter it while preserving the semantics...