tree: 4bc4a50217c3c0d4b049496257de3d760b38c61e [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. OptParserEmitter.cpp
  34. OptRSTEmitter.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. X86CompressEVEXTablesEmitter.cpp
  49. X86DisassemblerShared.h
  50. X86DisassemblerTables.cpp
  51. X86DisassemblerTables.h
  52. X86FoldTablesEmitter.cpp
  53. X86ManualCompressEVEXTables.def
  54. X86ManualFoldTables.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: