4.5 LLVM supporting tools
The LLVM project has its own tooling support. The most important LLVM tools are TableGen and LIT (which stands for LLVM Integrated Tester). We will look into them with examples from the Clang code. These examples should help us understand the purpose of the tooling and how they can be used.
4.5.1 TableGen
TableGen is a domain-specific language (DSL) and associated tool used in the LLVM project for the purpose of describing and generating tables, particularly those that describe a target architecture. This is highly useful for compiler infrastructure, where one frequently needs to describe things such as instruction sets, registers, and various other target-specific attributes in a structured manner.
TableGen is employed in various parts of the Clang compiler. It’s primarily used where there’s a need to generate large amounts of similar code. For instance, it can be used for supporting cast operations that necessitate extensive enum declarations...