Implementing the DAG instruction selection classes
A large portion of the DAG instruction selector is generated by the llvm-tblgen
tool. We still need to create classes using the generated code and put everything together. Let's begin with a part of the initialization process.
Initializing the target machine
Each backend has to provide at least one TargetMachine
class, usually a subclass of the LLVMTargetMachine
class. The M88kTargetMachine
class holds a lot of the details required for code generation, and it also acts as a factory for other backend classes, most notably for the Subtarget
class and the TargetPassConfig
class. The Subtarget
class holds the configuration for the code generation, such as which features are enabled. The TargetPassConfig
class configures the machine passes of the backend. The declaration for our M88kTargetMachine
class is in the M88ktargetMachine.h
file and looks like this:
class M88kTargetMachine : public LLVMTargetMachine { public: Â ...