Adding the M88k backend to LLVM
We have not yet discussed where to place the target description files. Each backend in LLVM has a subdirectory in llvm/lib/Target
. We create the M88k
directory here and copy the target description files into it.
Of course, just adding the TableGen files is not enough. LLVM uses a registry to look up instances of a target implementation, and it expects certain global functions to register those instances. And since some parts are generated, we can already provide an implementation.
All information about a target, like the target triple and factory function for the target machine, assembler, disassembler, and so on, are stored in an instance of the Target
class. Each target holds a static instance of this class, and this instance is registered in the central registry:
- The implementation is in the
M88kTargetInfo.cpp
file in theTargetInfo
subdirectory in our target. The single instance of theTarget
class is held inside thegetTheM88kTarget...