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 -help but 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.
  • -I directory β€” 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.
  • -o filename β€” specifies the output file name. and here's the cute part: if filename is -, then *-tblgen sends 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-component component β€” 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 β€” generate arm_neon.h for Clang.
  • -gen-arm-fp16 β€” generate arm_fp16.h for Clang.
  • -gen-arm-bf16 β€” generate arm_bf16.h for 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 β€” generate arm_immcheck_types.inc for Clang.
  • -gen-arm-sve-header β€” generate arm_sve.h for Clang.
  • -gen-arm-sve-builtins β€” generate arm_sve_builtins.inc for Clang.
  • -gen-arm-sve-builtin-codegen β€” generate arm_sve_builtin_cg_map.inc for Clang.
  • -gen-arm-sve-typeflags β€” generate arm_sve_typeflags.inc for Clang.
  • -gen-arm-sve-sema-rangechecks β€” generate arm_sve_sema_rangechecks.inc for Clang.
  • -gen-arm-mve-header β€” generate arm_mve.h for 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 β€” generate arm_cde.h for 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 β€” generate riscv_vector.h for Clang.
  • -gen-riscv-vector-builtins β€” generate riscv_vector_builtins.inc for Clang.
  • -gen-riscv-vector-builtin-codegen β€” generate riscv_vector_builtin_cg.inc for Clang.
  • -gen-riscv-sifive-vector-builtins β€” generate riscv_sifive_vector_builtins.inc for Clang.
  • -gen-riscv-sifive-vector-builtin-codegen β€” generate riscv_sifive_vector_builtin_cg.inc for 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 attribute for 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 lldb OptionDefinition values.
  • gen-lldb-property-defs β€” generate lldb PropertyDefinition values.
  • gen-lldb-property-enum-defs β€” generate lldb PropertyDefinition enum values.

πŸ”₯ llvm-tblgen Options πŸ”₯

  • -gen-asm-matcher β€” generate assembly instruction matcher.
  • -match-prefix=prefix β€” make -gen-asm-matcher match only instructions with the given prefix.
  • -gen-asm-parser β€” generate assembly instruction parser.
  • -asmparsernum=n β€” make -gen-asm-parser emit assembly parser number n.
  • -gen-asm-writer β€” generate assembly writer.
  • -asmwriternum=n β€” make -gen-asm-writer emit 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-isel generate tables to help identify the patterns matched.
  • -omit-comments β€” make -gen-dag-isel omit comments. the default is false.
  • -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 β€” generate llvm-exegesis tables.
  • -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-isel generate coverage instrumentation.
  • -optimize-match-table β€” make -gen-global-isel generate an optimized version of the match table.
  • -warn-on-skipped-patterns β€” make -gen-global-isel explain 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-combiner emit 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-combiner spits out. little notes for future you πŸŽ€
  • -gicombiner-stop-after-parse β€” tells -gen-global-isel-combiner to 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-enums generate 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-info dump 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-enums print 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 of EnumAttrs from LLVM IR. coming from LLVM IR πŸ”₯
  • -gen-enum-to-llvmir-conversions β€” generates conversions of EnumAttrs to 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 β€” generates TypeDef declarations. typedef bestie πŸŽ€
  • -gen-typedef-defs β€” generates TypeDef definitions. 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 🫢


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