TBLGEN(1)

πŸ’… tblgen β€” the tblgen family, aka Description to C++ Code ✨

okay so real talk, this is TBLGEN(1) from the LLVM manual, and it's a whole family of little generator programs. Buckle up bestie πŸŽ€

✨ SYNOPSIS ✨

clang-tblgen [options] [filename]

lldb-tblgen [options] [filename]

llvm-tblgen [options] [filename]

mlir-tblgen [options] [filename]

πŸ¦‹ DESCRIPTION πŸ¦‹

So *-tblgen isn't one program, it's a whole squad of programs that translate target description (.td) files into C++ code and other output formats. Translates them. Like a little compiler-adjacent bestie 🫢

Most users of LLVM will not need to use this program, fr fr β€” like, if you're just out here using LLVM you can close this tab. It's used only for writing parts of the compiler, the debugger, and LLVM target backends. So it's giving "for the devs building the thing", not "for everyone using the thing" πŸ‘‘

The details of the input and output of the *-tblgen programs is beyond the scope of this short introduction β€” so please see the TableGen Overview for an introduction and for references to additional TableGen documents. (iykyk, go read those πŸ’œ)

The filename argument specifies the name of the Target Description (.td) file that TableGen processes. That's the one. That's the file. πŸ“

🌸 OPTIONS 🌸

πŸŽ€ General Options

  • -help β€” Print a description of the command line options.
  • -help-list β€” Print a description of the command line options in a simple list format. (the no-frills version, lowkey love that for us)
  • *-D=macroname* β€” Specify the name of a macro to be defined. The name is defined, but it has no particular value. it's just... a name. existing. main character energy of existing ✨
  • *-d=filename* β€” Specify the name of the dependency filename.
  • -debug β€” Enable debug output.
  • -dump-json β€” Print a JSON representation of all records, suitable for further automated processing.
  • -I directory β€” Specify 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.
  • -null-backend β€” Parse the source files and build the records, but do not run any backend. This is useful for timing the frontend. (frontend-only speedrun, slay ⏱️)
  • -o filename β€” Specify the output file name. If filename is -, then *-tblgen sends its output to standard output. lil dash means stdout, iconic 🫢
  • -print-records β€” Print all classes and records to standard output (default backend option).
  • -print-detailed-records β€” Print a detailed report of all global variables, classes, and records to standard output. the detailed one. she's thorough πŸ’…
  • -stats β€” Print a report with any statistics collected by the backend.
  • -time-phases β€” Time the parser and backend phases and print a report.
  • -version β€” Show the version number of the program.
  • -write-if-changed β€” Write the output file only if it is new or has changed. no pointless rewrites, we respect the build system's time 🧚

πŸ‘‘ clang-tblgen Options

okay this section is LONG and it's all -gen- this and -gen- that. every single one is here, don't worry. 🫢

  • -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. (yes that's a whole mouthful, say it with your chest πŸ’€)
  • -gen-clang-attr-impl β€” Generate Clang attribute implementations.
  • -gen-clang-attr-list" β€” Generate a Clang attribute list. (and yes, that trailing quote mark is literally printed in the manual like that, no cap β€” I'm not touching it πŸ™ˆ)
  • -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. (only warnings from that component, keep it focused ✨)
  • -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-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

bestie notice something? these three don't have a leading dash in the manual. not a typo on my end, that's literally how they're printed πŸ’€

  • 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. (only those instructions, gatekept by 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. (so like, comments are ON by default. good to know 🫢)
  • -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. (quotes around "fast" are the manual's, not mine 😭)
  • -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. (she tells you why, we love transparency ✨)
  • -gen-global-isel-combiner β€” Generate GlobalISel combiner.
  • -combiners=list β€” tells -gen-global-isel-combiner to emit the specific combiners you list here πŸ’… you pick the list, it does the emitting.
  • -gicombiner-debug-cxxpreds β€” sprinkles debug comments onto every C++ predicate that -gen-global-isel-combiner emits πŸŽ€ little breadcrumbs so you can actually follow what's happening.
  • -gicombiner-stop-after-parse β€” makes -gen-global-isel-combiner stop right after parsing the rules and dump its state. like, "we're done here bestie, look at what I got" 🫢
  • -gen-instr-info β€” generate instruction descriptions ✨
  • -gen-instr-docs β€” generate instruction documentation πŸ“
  • -gen-intrinsic-enums β€” generate intrinsic enums πŸ”₯
  • -intrinsic-prefix=prefix β€” makes -gen-intrinsic-enums spit out intrinsics carrying this target prefix in front of them.
  • -gen-intrinsic-impl β€” generate intrinsic information πŸ‘‘
  • -gen-opt-parser-defs β€” generate options definitions 🌸
  • -gen-opt-rst β€” generate option RST πŸ’–
  • -gen-pseudo-lowering β€” generate pseudo instruction lowering 🌈
  • -gen-register-bank β€” generate register bank descriptions 🏦✨
  • -gen-register-info β€” generate registers and register classes info πŸ’…
  • -register-info-debug β€” makes -gen-register-info dump register information for debugging πŸ™ˆ peek behind the curtain.
  • -gen-searchable-tables β€” generate generic searchable tables. see TableGen BackEnds <> for a detailed description πŸ¦‹
  • -gen-subtarget β€” generate subtarget enumerations ⭐
  • -gen-x86-EVEX2VEX-tables β€” generate X86 EVEX to VEX compress tables 🧚
  • -gen-x86-fold-tables β€” generate X86 fold tables πŸŽ€
  • -long-string-literals β€” when emitting large string tables, prefer string literals over comma-separated char literals. it's a readability and compile-time performance win, but heads up: it upsets some compilers 😭 so like, know your compiler before you commit.
  • -print-enums β€” print enumeration values for a class πŸ”
  • -class=classname β€” makes -print-enums print the enumeration list for the specified classname πŸ‘‘
  • -print-sets β€” print expanded sets for testing DAG exprs πŸ§ͺ

🌸 mlir-tblgen Options 🌸

a whole other menu of options, slay πŸ’…

  • -gen-avail-interface-decls β€” generate availability interface declarations ✨
  • -gen-avail-interface-defs β€” generate op interface definitions πŸ’–
  • -gen-dialect-doc β€” generate dialect documentation πŸ“–
  • -dialect β€” the dialect to generate πŸŒ€
  • -gen-directive-decl β€” generate declarations for directives (OpenMP, etc.) 🎯
  • -gen-enum-decls β€” generate enum utility declarations πŸŽ€
  • -gen-enum-defs β€” generate enum utility definitions πŸŽ€
  • -gen-enum-from-llvmir-conversions β€” generate conversions of EnumAttrs from LLVM IR πŸ”
  • -gen-enum-to-llvmir-conversions β€” generate conversions of EnumAttrs to LLVM IR πŸ”
  • -gen-llvmir-conversions β€” generate LLVM IR conversions 🌈
  • -gen-llvmir-intrinsics β€” generate LLVM IR intrinsics πŸ”₯
  • -llvmir-intrinsics-filter β€” only keep the intrinsics with the specified substring in their record name 🫢 a lil filter, no big deal.
  • -dialect-opclass-base β€” the base class for the ops in the dialect we're about to emit πŸ‘‘
  • -gen-op-decls β€” generate operation declarations ✨
  • -gen-op-defs β€” generate operation definitions πŸ’œ
  • -asmformat-error-is-fatal β€” emit a fatal error if format parsing fails πŸ’€ like, no silent oopsie, it just straight up dies.
  • -op-exclude-regex β€” regular expression of name of ops to exclude (no filter if empty) πŸ™…β€β™€οΈ
  • -op-include-regex β€” regular expression of name of ops to include (no filter if empty) πŸ™‹β€β™€οΈ
  • -gen-op-doc β€” generate operation documentation πŸ“š
  • -gen-pass-decls β€” generate operation documentation πŸ“ (yes, that's what it says, bestie β€” copying it exactly, not my fault 😭)
  • -name namestring β€” the name of this group of passes 🏷️ note it's a space before the value, not an =.
  • -gen-pass-doc β€” generate pass documentation πŸ“–
  • -gen-rewriters β€” generate pattern rewriters πŸ”
  • -gen-spirv-avail-impls β€” generate SPIR-V operation utility definitions πŸŒ€
  • -gen-spirv-capability-implication β€” generate a utility function to return implied capabilities for a given capability 🧠✨
  • -gen-spirv-enum-avail-decls β€” generate SPIR-V enum availability declarations πŸŽ€
  • -gen-spirv-enum-avail-defs β€” generate SPIR-V enum availability definitions πŸŽ€
  • -gen-spirv-op-utils β€” generate SPIR-V operation utility definitions 🌸
  • -gen-spirv-serialization β€” generate SPIR-V (de)serialization utilities and functions πŸ”„
  • -gen-struct-attr-decls β€” generate struct utility declarations 🧱
  • -gen-struct-attr-defs β€” generate struct utility definitions 🧱
  • -gen-typedef-decls β€” generate TypeDef declarations 🏷️
  • -gen-typedef-defs β€” generate TypeDef definitions 🏷️
  • -typedefs-dialect name β€” generate types for this dialect πŸŒ€

πŸ’– EXIT STATUS πŸ’–

okay so the vibe check: if *-tblgen* succeeds, it exits with 0 πŸ₯³ iconic, no notes.

otherwise, if an error occurs, it exits with a non-zero value 😭 something went wrong and it's telling you loudly.


πŸ’œ Author πŸ’œ

maintained by the LLVM Team (https://llvm.org/) 🫢 they're out here doing the work.

2003-2026, LLVM Project ⭐


and that's the whole page, bestie ✨ this was TBLGEN(1) β€” page 15 of the manual, dated 2026-09-09, in all its LLVM glory. πŸ¦‹πŸ’…πŸŽ€

πŸ“¦ where this page comes from