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