IT lexicon › Programming › TableGen

TableGen

Programming På svenska → Updated: 2026-11-05

LLVM's in-house description language for writing down a processor's registers and instructions once and letting a tool generate thousands of lines of C++ from it.

A compiler backend needs the same facts about an instruction in many places: its binary encoding, its assembly syntax, which registers it reads and writes, which IR pattern it matches and how long it takes. Keeping all of that in sync by hand across separate tables is a reliable way to breed bugs. In TableGen it is written once as records and classes in .td files, and the tool's various backends read the same records and emit .inc files that get compiled into LLVM.

The language dates from LLVM's early years and has spread well beyond the code generators: Clang describes its diagnostics and attributes in it, and MLIR defines its operations with it. It is notoriously hard to debug — an error can point into a generated file thirty thousand lines long — but the alternative is worse.

← Back to the lexicon