Summary
In this chapter, you learned how to develop a new backend target for LLVM. You first collected the required documentation and made LLVM aware of the new architecture by enhancing the Triple
class. The documentation also includes the relocation definition for the ELF file format, and you added support for that to LLVM.
You learned about the different parts the target description contains, and using the C++ source generated from it, you learned how to implement an instruction selection. For outputting the generated code, you developed an assembler printer and learned which support classes are needed to write to an object file. You also learned how to add support for disassembling, which is used to turn an object file back into assembler text. Lastly, you extended the build system to include the new target in the build.
You are now equipped with everything you need to use LLVM in creative ways in your own projects. The LLVM ecosystem is very active, and new features are...