Piecing it all together
Our new target, located in the llvm/lib/Target/M88k
directory, needs to be integrated into the build system. To make development easy, we add it as an experimental target in the llvm/CMakeLists.txt
file. We replace the existing empty string with the name of our target:
set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "M88k" … )
We also need to provide a llvm/lib/Target/M88k/CMakeLists.txt
file to build our target. Besides listing the C++ files for the target, it also defines the generation of the source from the target description.
Generating all the types of sources from the target description
Different runs of the llvm-tblgen
tool generate different portions of C++ code. However, I recommend adding the generation of all parts to the CMakeLists.txt
file. The reason for this is that it provides better checking. For example, if you make an error with the instruction encoding, then this is only caught during the generation of the...