Groundwork to connect the codegen pipeline
Up until this chapter, we connected (and faked) enough pieces to get a frontend such as Clang to invoke our backend on the LLVM IR to LLVM IR passes. To get beyond that point and exercise the instruction selector of a backend, we need to connect (or fake the connection of) the full codegen pipeline.
From the frontend point of view, the codegen pipeline is responsible for taking some LLVM IR as input and generating code in either textual form (assembly .s
file) or binary form (object .o
file).
There are three pieces involved in creating this pipeline:
- You need to build the codegen pass pipeline for your target.
- You need to provide the LLVM infrastructure with some key target-specific information for the generic codegen passes to work.
- You need to connect your instruction selector or your instruction selectors if you want to offer more than one selector.
Let us start with the connection of the codegen...