TBLGEN(1)
π tblgen β Description to C++ Code π
okay bestie, buckle up, this is the LLVM manual page for the tblgen family, and she's a big one π«Ά
β¨ NAME β¨
tblgen β Description to C++ Code
πΈ SYNOPSIS πΈ
clang-tblgen [options] [filename]
lldb-tblgen [options] [filename]
llvm-tblgen [options] [filename]
mlir-tblgen [options] [filename]
π¦ DESCRIPTION π¦
so *-tblgen is literally a whole family of programs π
they take target description files (.td files, iconic extension) and translate them into C++ code and other output formats. that's the whole vibe.
ngl, most people using LLVM will never need to touch this program. it's for writing parts of the compiler, the debugger, and the LLVM target backends. so if you're just out here compiling stuff, this ain't your moment π
the details of what goes in and what comes out of the *-tblgen programs? that's beyond the scope of this short little intro, bestie. go check out the TableGen Overview for an introduction and for pointers to more TableGen docs. iykyk πβ¨
the filename argument specifies the name of the Target Description (.td) file that TableGen processes. that's it, that's the tea β
π OPTIONS π
π General Options
-helpβ prints a description of the command line options. your classic "wait what do i do" button.-help-listβ same energy as-helpbut in a simple list format. no frills, just list.-D=macronameβ specifies the name of a macro to be defined. the name gets defined, but it has no particular value β it's giving "i exist and that's enough" π-d=filenameβ specifies the name of the dependency filename.-debugβ enable debug output. the lights come on β¨-dump-jsonβ prints a JSON representation of all records, suitable for further automated processing. very slay for scripting.-Idirectory β tells it where to find other target description files for inclusion. the directory value should be a full or partial path to a directory that contains target description files. think of it as "girl where are your friends at" π-null-backendβ parses the source files and builds the records, but does not run any backend. useful for timing the frontend. it's the "just vibes, no output" mode.-ofilename β specifies the output file name. and here's the cute part: if filename is-, then*-tblgensends its output to standard output. periodt.-print-recordsβ prints all classes and records to standard output. this is the default backend option, so she's the main character π-print-detailed-recordsβ prints a detailed report of all global variables, classes, and records to standard output. more detail, more drama.-statsβ prints a report with any statistics collected by the backend. numbers girlies rise π-time-phasesβ times the parser and backend phases and prints a report. clock it β±οΈ-versionβ shows the version number of the program.-write-if-changedβ writes the output file only if it is new or has changed. no unnecessary rewrites, she's efficient π
π clang-tblgen Options π
-gen-clang-attr-classesβ generate Clang attribute classes.-gen-clang-attr-parser-string-switchesβ generate all parser-related attribute string switches.-gen-clang-attr-subject-match-rules-parser-string-switchesβ generate all parser-related attribute subject match rule string switches.-gen-clang-attr-implβ generate Clang attribute implementations.-gen-clang-attr-list"β generate a Clang attribute list. (yes bestie, the quote is in the original, we keep the lore intact π)-gen-clang-attr-subject-match-rule-listβ generate a Clang attribute subject match rule list.-gen-clang-attr-pch-readβ generate Clang PCH attribute reader.-gen-clang-attr-pch-writeβ generate Clang PCH attribute writer.-gen-clang-attr-has-attribute-implβ generate a Clang attribute spelling list.-gen-clang-attr-spelling-indexβ generate a Clang attribute spelling index.-gen-clang-attr-ast-visitorβ generate a recursive AST visitor for Clang attributes.-gen-clang-attr-template-instantiateβ generate a Clang template instantiate code.-gen-clang-attr-parsed-attr-listβ generate a Clang parsed attribute list.-gen-clang-attr-parsed-attr-implβ generate the Clang parsed attribute helpers.-gen-clang-attr-parsed-attr-kindsβ generate a Clang parsed attribute kinds.-gen-clang-attr-text-node-dumpβ generate Clang attribute text node dumper.-gen-clang-attr-node-traverseβ generate Clang attribute traverser.-gen-clang-diags-defsβ generate Clang diagnostics definitions.-clang-componentcomponent β only use warnings from specified component.-gen-clang-diag-groupsβ generate Clang diagnostic groups.-gen-clang-diags-index-nameβ generate Clang diagnostic name index.-gen-clang-basic-readerβ generate Clang BasicReader classes.-gen-clang-basic-writerβ generate Clang BasicWriter classes.-gen-clang-comment-nodesβ generate Clang AST comment nodes.-gen-clang-decl-nodesβ generate Clang AST declaration nodes.-gen-clang-stmt-nodesβ generate Clang AST statement nodes.-gen-clang-type-nodesβ generate Clang AST type nodes.-gen-clang-type-readerβ generate Clang AbstractTypeReader class.-gen-clang-type-writerβ generate Clang AbstractTypeWriter class.-gen-clang-opcodesβ generate Clang constexpr interpreter opcodes.-gen-clang-sa-checkersβ generate Clang static analyzer checkers.-gen-clang-comment-html-tagsβ generate efficient matchers for HTML tag names that are used in documentation comments.-gen-clang-comment-html-tags-propertiesβ generate efficient matchers for HTML tag properties.-gen-clang-comment-html-named-character-referencesβ generate function to translate named character references to UTF-8 sequences.-gen-clang-comment-command-infoβ generate command properties for commands that are used in documentation comments.-gen-clang-comment-command-listβ generate list of commands that are used in documentation comments.-gen-clang-opencl-builtinsβ generate OpenCL builtin declaration handlers.-gen-arm-neonβ generatearm_neon.hfor Clang.-gen-arm-fp16β generatearm_fp16.hfor Clang.-gen-arm-bf16β generatearm_bf16.hfor Clang.-gen-arm-neon-semaβ generate ARM NEON sema support for Clang.-gen-arm-neon-testβ generate ARM NEON tests for Clang.-gen-arm-immcheck-typesβ generatearm_immcheck_types.incfor Clang.-gen-arm-sve-headerβ generatearm_sve.hfor Clang.-gen-arm-sve-builtinsβ generatearm_sve_builtins.incfor Clang.-gen-arm-sve-builtin-codegenβ generatearm_sve_builtin_cg_map.incfor Clang.-gen-arm-sve-typeflagsβ generatearm_sve_typeflags.incfor Clang.-gen-arm-sve-sema-rangechecksβ generatearm_sve_sema_rangechecks.incfor Clang.-gen-arm-mve-headerβ generatearm_mve.hfor Clang.-gen-arm-mve-builtin-defβ generate ARM MVE builtin definitions for Clang.-gen-arm-mve-builtin-semaβ generate ARM MVE builtin sema checks for Clang.-gen-arm-mve-builtin-codegenβ generate ARM MVE builtin code-generator for Clang.-gen-arm-mve-builtin-aliasesβ generate list of valid ARM MVE builtin aliases for Clang.-gen-arm-cde-headerβ generatearm_cde.hfor Clang.-gen-arm-cde-builtin-defβ generate ARM CDE builtin definitions for Clang.-gen-arm-cde-builtin-semaβ generate ARM CDE builtin sema checks for Clang.-gen-arm-cde-builtin-codegenβ generate ARM CDE builtin code-generator for Clang.-gen-arm-cde-builtin-aliasesβ generate list of valid ARM CDE builtin aliases for Clang.-gen-riscv-vector-headerβ generateriscv_vector.hfor Clang.-gen-riscv-vector-builtinsβ generateriscv_vector_builtins.incfor Clang.-gen-riscv-vector-builtin-codegenβ generateriscv_vector_builtin_cg.incfor Clang.-gen-riscv-sifive-vector-builtinsβ generateriscv_sifive_vector_builtins.incfor Clang.-gen-riscv-sifive-vector-builtin-codegenβ generateriscv_sifive_vector_builtin_cg.incfor Clang.-gen-attr-docsβ generate attribute documentation.-gen-diag-docsβ generate diagnostic documentation.-gen-opt-docsβ generate option documentation.-gen-clang-data-collectorsβ generate data collectors for AST nodes.-gen-clang-test-pragma-attribute-supported-attributesβ generate a list of attributes supported by#pragma Clang attributefor testing purposes.
π§ lldb-tblgen Options π§
heads up bestie, these ones are written without leading dashes in the original, and we are keeping them exactly as they are π
gen-lldb-option-defsβ generate lldbOptionDefinitionvalues.gen-lldb-property-defsβ generate lldbPropertyDefinitionvalues.gen-lldb-property-enum-defsβ generate lldbPropertyDefinitionenum values.
π₯ llvm-tblgen Options π₯
-gen-asm-matcherβ generate assembly instruction matcher.-match-prefix=prefix β make-gen-asm-matchermatch only instructions with the given prefix.-gen-asm-parserβ generate assembly instruction parser.-asmparsernum=n β make-gen-asm-parseremit assembly parser number n.-gen-asm-writerβ generate assembly writer.-asmwriternum=n β make-gen-asm-writeremit assembly writer number n.-gen-attrsβ generate attributes.-gen-automataβ generate generic automata.-gen-callingconvβ generate calling convention descriptions.-gen-compress-inst-emitterβ generate RISC-V compressed instructions.-gen-ctagsβ generate ctags-compatible index.-gen-dag-iselβ generate a DAG (directed acyclic graph) instruction selector.-instrument-coverageβ make-gen-dag-iselgenerate tables to help identify the patterns matched.-omit-commentsβ make-gen-dag-iselomit comments. the default isfalse.-gen-dfa-packetizerβ generate DFA Packetizer for VLIW targets.-gen-directive-declβ generate directive related declaration code (header file).-gen-directive-genβ generate directive related implementation code part.-gen-directive-implβ generate directive related implementation code.-gen-disassemblerβ generate disassembler.-gen-emitterβ generate machine code emitter.-gen-exegesisβ generatellvm-exegesistables.-gen-fast-iselβ generate a "fast" instruction selector.-gen-global-iselβ generate GlobalISel selector.-gisel-coverage-file=filename β specify the file from which to retrieve coverage information.-instrument-gisel-coverageβ make-gen-global-iselgenerate coverage instrumentation.-optimize-match-tableβ make-gen-global-iselgenerate an optimized version of the match table.-warn-on-skipped-patternsβ make-gen-global-iselexplain why a pattern was skipped for inclusion.
ok bestie that's where this part wraps π but we are not done β more of this manual is coming, so don't go anywhere π
-gen-global-isel-combinerβ bestie this one generates the GlobalISel combiner. that's it, that's the job β¨-combiners=listβ makes-gen-global-isel-combineremit the specific combiners you list out. you're the one picking, not the machine π-gicombiner-debug-cxxpredsβ sprinkles debug comments on every single C++ predicate that-gen-global-isel-combinerspits out. little notes for future you π-gicombiner-stop-after-parseβ tells-gen-global-isel-combinerto stop doing stuff right after it parses the rules, and then dump the state. like pausing the movie to scream about the plot π₯-gen-instr-infoβ generates instruction descriptions. the lore drops here π-gen-instr-docsβ generates instruction documentation. for the people who actually read π-gen-intrinsic-enumsβ generates intrinsic enums. enum era π-intrinsic-prefix=prefixβ makes-gen-intrinsic-enumsgenerate intrinsics carrying this target prefix. so they know where they belong πΈ-gen-intrinsic-implβ generates intrinsic information. the details, the tea π«-gen-opt-parser-defsβ generates options definitions. defined, periodt β¨-gen-opt-rstβ generates option RST. fancy formatted docs, we love to see it π-gen-pseudo-loweringβ generates pseudo instruction lowering. pseudos getting real π-gen-register-bankβ generates register bank descriptions. banks but make it registers π¦-gen-register-infoβ generates registers and register classes info. the full register lore dump π-register-info-debugβ makes-gen-register-infodump register information for debugging. peek behind the curtain π«£-gen-searchable-tablesβ generates generic searchable tables. and hey, for a detailed description go check out TableGen BackEnds <> β yes the manpage literally has empty angle brackets there, i'm not making it up π-gen-subtargetβ generates subtarget enumerations. sub-characters get their moment π-gen-x86-EVEX2VEX-tablesβ generates X86 EVEX to VEX compress tables. very specific, very x86 of it π§-gen-x86-fold-tablesβ generates X86 fold tables. folding, but architectural β¨-long-string-literalsβ when it's emitting big string tables, it'll prefer string literals over comma-separated char literals. can be a readability win and a compile-time performance win β but heads up bestie, it upsets some compilers π¬
fr fr, "upsets some compilers" is doing a lot of heavy lifting there. tread carefully.
-print-enumsβ prints enumeration values for a class. show me the numbers π’-class=classnameβ makes-print-enumsprint the enumeration list for classname, the class you named. specificity is a love language π-print-setsβ prints expanded sets, for testing DAG exprs. test girlies rise π
π mlir-tblgen Options π
okay so now we're in the mlir-tblgen era. different tool energy, same chaotic-genius vibe. let's go π
-gen-avail-interface-declsβ generates availability interface declarations. decls first, always β¨-gen-avail-interface-defsβ generates op interface definitions. and then the defs show up π-gen-dialect-docβ generates dialect documentation. docs, but for your dialect πΈ-dialectβ the dialect to generate. just... the dialect. your main character π-gen-directive-declβ generates declarations for directives (OpenMP, etc.). directives said their piece π£-gen-enum-declsβ generates enum utility declarations. utility enum decls, slay π¦-gen-enum-defsβ generates enum utility definitions. the sequel β¨-gen-enum-from-llvmir-conversionsβ generates conversions ofEnumAttrsfrom LLVM IR. coming from LLVM IR π₯-gen-enum-to-llvmir-conversionsβ generates conversions ofEnumAttrsto LLVM IR. and going to LLVM IR. a round trip, iconic π-gen-llvmir-conversionsβ generates LLVM IR conversions. general-purpose conversion generation π-gen-llvmir-intrinsicsβ generates LLVM IR intrinsics. intrinsics, but LLVM IR flavored π-llvmir-intrinsics-filterβ only keeps the intrinsics whose record name contains the substring you specify. filtering, but make it β¨selectiveβ¨-dialect-opclass-baseβ the base class for the ops in the dialect we're about to emit. the blueprint, the blueprint π-gen-op-declsβ generates operation declarations. ops said hi π-gen-op-defsβ generates operation definitions. ops said it again, in full π«Ά-asmformat-error-is-fatalβ emits a fatal error if format parsing fails. not a warning. fatal. the drama is the point π-op-exclude-regexβ regular expression of the names of ops to exclude (no filter if empty). bye felicia π-op-include-regexβ regular expression of the names of ops to include (no filter if empty). come here bestie π«-gen-op-docβ generates operation documentation. op docs, get into it π-gen-pass-declsβ generates operation documentation. yes, the manpage really says "operation documentation" here too. i am reporting, not judging π-name namestringβ the name of this group of passes. name it like you mean it, namestring π-gen-pass-docβ generates pass documentation. pass the docs π-gen-rewritersβ generates pattern rewriters. rewriting patterns, rewriting my whole personality π-gen-spirv-avail-implsβ generates SPIR-V operation utility definitions. spir-v said "utility" and "definitions" twice in a row, look above π-gen-spirv-capability-implicationβ generates a utility function that returns the implied capabilities for a given capability. implication station π-gen-spirv-enum-avail-declsβ generates SPIR-V enum availability declarations. decls, spir-v style β¨-gen-spirv-enum-avail-defsβ generates SPIR-V enum availability definitions. and the defs, obviously π-gen-spirv-op-utilsβ generates SPIR-V operation utility definitions. utility definitions, the remix π¦-gen-spirv-serializationβ generates SPIR-V (de)serialization utilities and functions. both directions, balanced queen π-gen-struct-attr-declsβ generates struct utility declarations. structs, but useful π-gen-struct-attr-defsβ generates struct utility definitions. the definitions arc πΈ-gen-typedef-declsβ generatesTypeDefdeclarations. typedef bestie π-gen-typedef-defsβ generatesTypeDefdefinitions. typedef part two β¨-typedefs-dialect nameβ generates types for name, that dialect. tell it which dialect and it'll do the types π
π EXIT STATUS π
okay so if -tblgen succeeds, it exits with 0. and if an error happens? it exits with a non-zero value. that's the whole tea. simple. clean. no cap β
π Author π
Maintained by the LLVM Team (https://llvm.org/). they're out here keeping it running, respect π«Ά
π Copyright π
2003-2026, LLVM Project β a two-decade-plus run, that's longevity for real ππ
and that's the page bestie!! it's from the LLVM crew, dated 2026-07-16, and it's giving very much "i know my toolchain" energy. go forth and tblgen responsibly πβ¨π
π¦ where this page comes from
- fedora 44: llvm 22.1.8-4.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm 22.1.8-4.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms