Getting Started with Instruction Selection
Instruction selection (ISel) plays a key role in a Low Level Virtual Machine (LLVM) backend. It is responsible for lowering the LLVM intermediate representation (IR) down to the Machine IR with the limited set of instructions a backend has to offer.
The set of instructions of a backend is prescribed by the instruction set architecture (ISA) of the related architecture, and two different architectures may have very different ISAs. For instance, some architectures support floating-point arithmetic, whereas others do not. Therefore, the way you lower the LLVM IR for one architecture may be completely different for another.
The LLVM target-independent code generator, or codegen, provides a lot of infrastructure that you will learn to leverage across the next few chapters to implement your own instruction selector.
In this chapter, we focus on teaching you about the following:
- General ways these selectors work
- How...