tree: 66ab6fab2ead732917db394464d2f240ea817667 [path history] [tgz]
  1. GlobalISel/
  2. jupyter/
  3. AsmMatcherEmitter.cpp
  4. AsmWriterEmitter.cpp
  5. AsmWriterInst.cpp
  6. AsmWriterInst.h
  7. Attributes.cpp
  8. CallingConvEmitter.cpp
  9. CMakeLists.txt
  10. CodeEmitterGen.cpp
  11. CodeGenDAGPatterns.cpp
  12. CodeGenDAGPatterns.h
  13. CodeGenHwModes.cpp
  14. CodeGenHwModes.h
  15. CodeGenInstAlias.cpp
  16. CodeGenInstAlias.h
  17. CodeGenInstruction.cpp
  18. CodeGenInstruction.h
  19. CodeGenIntrinsics.cpp
  20. CodeGenIntrinsics.h
  21. CodeGenMapTable.cpp
  22. CodeGenRegisters.cpp
  23. CodeGenRegisters.h
  24. CodeGenSchedule.cpp
  25. CodeGenSchedule.h
  26. CodeGenTarget.cpp
  27. CodeGenTarget.h
  28. CompressInstEmitter.cpp
  29. CTagsEmitter.cpp
  30. DAGISelEmitter.cpp
  31. DAGISelMatcher.cpp
  32. DAGISelMatcher.h
  33. DAGISelMatcherEmitter.cpp
  34. DAGISelMatcherGen.cpp
  35. DAGISelMatcherOpt.cpp
  36. DecoderEmitter.cpp
  37. DFAEmitter.cpp
  38. DFAEmitter.h
  39. DFAPacketizerEmitter.cpp
  40. DirectiveEmitter.cpp
  41. DisassemblerEmitter.cpp
  42. DXILEmitter.cpp
  43. ExegesisEmitter.cpp
  44. FastISelEmitter.cpp
  45. GlobalISelCombinerEmitter.cpp
  46. GlobalISelEmitter.cpp
  47. GlobalISelMatchTable.cpp
  48. GlobalISelMatchTable.h
  49. GlobalISelMatchTableExecutorEmitter.cpp
  50. GlobalISelMatchTableExecutorEmitter.h
  51. InfoByHwMode.cpp
  52. InfoByHwMode.h
  53. InstrDocsEmitter.cpp
  54. InstrInfoEmitter.cpp
  55. IntrinsicEmitter.cpp
  56. OptEmitter.cpp
  57. OptEmitter.h
  58. OptParserEmitter.cpp
  59. OptRSTEmitter.cpp
  60. PredicateExpander.cpp
  61. PredicateExpander.h
  62. PseudoLoweringEmitter.cpp
  63. README.md
  64. RegisterBankEmitter.cpp
  65. RegisterInfoEmitter.cpp
  66. RISCVTargetDefEmitter.cpp
  67. SDNodeProperties.cpp
  68. SDNodeProperties.h
  69. SearchableTableEmitter.cpp
  70. SequenceToOffsetTable.h
  71. SubtargetEmitter.cpp
  72. SubtargetFeatureInfo.cpp
  73. SubtargetFeatureInfo.h
  74. TableGen.cpp
  75. TableGenBackends.h
  76. tdtags
  77. Types.cpp
  78. Types.h
  79. VarLenCodeEmitterGen.cpp
  80. VarLenCodeEmitterGen.h
  81. VTEmitter.cpp
  82. WebAssemblyDisassemblerEmitter.cpp
  83. WebAssemblyDisassemblerEmitter.h
  84. X86DisassemblerShared.h
  85. X86DisassemblerTables.cpp
  86. X86DisassemblerTables.h
  87. X86EVEX2VEXTablesEmitter.cpp
  88. X86FoldTablesEmitter.cpp
  89. X86ManualFoldTables.def
  90. X86MnemonicTables.cpp
  91. X86ModRMFilters.cpp
  92. X86ModRMFilters.h
  93. X86RecognizableInstr.cpp
  94. X86RecognizableInstr.h
llvm/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: