Getting started with TableGen
The name TableGen stems from its original usage – generating tables. For instance, TableGen generates the table that represents all the registers of a target. TableGen outgrew this purpose and is now used to model a wide range of things, from Clang’s command-line options to multi-level intermediate representation (MLIR) operations’ boilerplate C++ code, or used directly within LLVM to generate the instruction selection tables, and so on.
Fundamentally, TableGen is a DSL to produce records. A record is an entity with a name and an arbitrary number of fields, where each field has its own type.
How these records are used and what output TableGen generates from them depends on the specific TableGen backend.
We will survey one of the TableGen backends used in this book in the Discovering a TableGen backend section, but you will learn how to use this backend and the other ones in the relevant upcoming chapters.
TableGen...