tree: 9836665597a2d186d2b32bf4d786aef77da4952a [path history] [tgz]
  1. Basic/
  2. Common/
  3. jupyter/
  4. AsmMatcherEmitter.cpp
  5. AsmWriterEmitter.cpp
  6. Attributes.cpp
  7. CallingConvEmitter.cpp
  8. CMakeLists.txt
  9. CodeEmitterGen.cpp
  10. CodeGenMapTable.cpp
  11. CompressInstEmitter.cpp
  12. CTagsEmitter.cpp
  13. DAGISelEmitter.cpp
  14. DAGISelMatcherEmitter.cpp
  15. DAGISelMatcherGen.cpp
  16. DAGISelMatcherOpt.cpp
  17. DecoderEmitter.cpp
  18. DFAEmitter.cpp
  19. DFAEmitter.h
  20. DFAPacketizerEmitter.cpp
  21. DirectiveEmitter.cpp
  22. DisassemblerEmitter.cpp
  23. DXILEmitter.cpp
  24. ExegesisEmitter.cpp
  25. FastISelEmitter.cpp
  26. GlobalISelCombinerEmitter.cpp
  27. GlobalISelEmitter.cpp
  28. InstrDocsEmitter.cpp
  29. InstrInfoEmitter.cpp
  30. IntrinsicEmitter.cpp
  31. MacroFusionPredicatorEmitter.cpp
  32. OptParserEmitter.cpp
  33. OptRSTEmitter.cpp
  34. PseudoLoweringEmitter.cpp
  35. README.md
  36. RegisterBankEmitter.cpp
  37. RegisterInfoEmitter.cpp
  38. RISCVTargetDefEmitter.cpp
  39. SearchableTableEmitter.cpp
  40. SubtargetEmitter.cpp
  41. TableGen.cpp
  42. TableGenBackends.h
  43. tdtags
  44. VTEmitter.cpp
  45. WebAssemblyDisassemblerEmitter.cpp
  46. WebAssemblyDisassemblerEmitter.h
  47. X86CompressEVEXTablesEmitter.cpp
  48. X86DisassemblerShared.h
  49. X86DisassemblerTables.cpp
  50. X86DisassemblerTables.h
  51. X86FoldTablesEmitter.cpp
  52. X86ManualCompressEVEXTables.def
  53. X86ManualFoldTables.def
  54. X86MnemonicTables.cpp
  55. X86ModRMFilters.cpp
  56. X86ModRMFilters.h
  57. X86RecognizableInstr.cpp
  58. X86RecognizableInstr.h
utils/TableGen/README.md

LLVM TableGen

The purpose of TableGen is to generate complex output files based on information from source files that are significantly easier to code than the output files would be, and also easier to maintain and modify over time.

The information is coded in a declarative style involving classes and records, which are then processed by TableGen.

class Hello <string _msg> {
  string msg = !strconcat("Hello ", _msg);
}

def HelloWorld: Hello<"world!"> {}
------------- Classes -----------------
class Hello<string Hello:_msg = ?> {
  string msg = !strconcat("Hello ", Hello:_msg);
}
------------- Defs -----------------
def HelloWorld {        // Hello
  string msg = "Hello world!";
}

Try this example on Compiler Explorer.

The internalized records are passed on to various backends, which extract information from a subset of the records and generate one or more output files.

These output files are typically .inc files for C++, but may be any type of file that the backend developer needs.

Resources for learning the language:

Writing TableGen backends:

TableGen in MLIR:

Useful tools: