Getting Started with the Assembler
In a compiler toolchain, the assembler is the tool that is responsible for taking assembly code in textual format and producing an object file, that is, a binary file that encodes everything there is to know about this assembly code.
The assembler is at the frontier between a compiler backend and the binary tools, and you could argue that implementing one does not fall within the scope of a compiler engineer.
While there is some truth to this, we wanted to give you a glimpse of what it takes to produce object files with the LLVM infrastructure since you already went through the trouble of learning how to describe the encoding of the instructions in Chapter 12. In other words, we wanted to show you how the work you did in Chapter 12 connects to the bigger picture of a full compiler toolchain.
In this chapter, you will learn how to leverage the LLVM infrastructure to build an assembler. More specifically, we will teach you about the following...