TBLGEN(1)

πŸ’– TBLGEN(1) πŸ’–

LLVM Β· tblgen β€” Description to C++ Code

okay bestie, sit down, hydrate, because we're about to talk about one of the most behind-the-scenes little icons in the whole LLVM universe πŸŽ€ she's not famous, she's not in your face, but literally half the compiler is built on her. her name is -tblgen and she eats .td files for breakfast πŸ’…


✨ NAME ✨

tblgen β€” Description to C++ Code πŸ¦‹


🌸 SYNOPSIS 🌸

clang-tblgen [options] [filename]

lldb-tblgen [options] [filename]

llvm-tblgen [options] [filename]

mlir-tblgen [options] [filename]

four siblings, one vibe, four different jobs, all wearing the same [options] [filename] fit 🫢


πŸ’œ DESCRIPTION πŸ’œ

so *-tblgen is actually a whole family of programs, not just one. what they do is take target description files (that's the .td files, keep up bestie) and translate them into C++ code and other output formats. no cap.

and listen β€” most people using LLVM will never need to touch this program. it's not for you unless you're literally writing parts of the compiler, the debugger, or LLVM target backends. it's giving backstage pass only energy. iykyk.

the tea on exactly what goes in and what comes out of the *-tblgen programs is way beyond the scope of this short intro β€” that's the official word, not me being lazy β€” so if you want the real lore, go read the TableGen Overview for an introduction and for pointers to more TableGen docs πŸ“šβœ¨

and the filename argument? that's just the name of the Target Description (.td) file that TableGen processes. that's it. that's the whole job of that one little word πŸŽ€


πŸ‘‘ OPTIONS πŸ‘‘

🧚 General Options 🧚

these are the ones everybody gets, no matter which sibling you're running πŸ’–

  • -help β€” prints a description of the command line options. the classic cry for help, but make it useful.
  • -help-list β€” same tea, but in a simple list format. streamlined, minimal, cute.
  • -D=macroname β€” names a macro to be defined. and yes, it gets defined, but it doesn't get any particular value. she's defined and valueless, and honestly? relatable πŸ’€
  • -d=filename β€” tells it the name of the dependency filename.
  • -debug β€” turns on debug output. chaos mode, but make it informative πŸ”₯
  • -dump-json β€” prints a JSON representation of all records, suitable for further automated processing. robots love this one πŸ€–βœ¨
  • -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. your little include-hunting map πŸ—ΊοΈ
  • -null-backend β€” parses the source files and builds the records, but does not run any backend. super useful for timing the frontend. all vibes, no output πŸ’…
  • -o filename β€” sets the output file name. and if filename is -, then *-tblgen sends its output to standard output. dash means stdout, always has, always will 🫢
  • -print-records β€” prints all classes and records to standard output. this one is the default backend option, so if you don't pick anything, this is what you get πŸŽ€
  • -print-detailed-records β€” prints a detailed report of all global variables, classes, and records to standard output. the deluxe version. the director's cut. πŸ‘‘
  • -stats β€” prints a report with any statistics collected by the backend. numbers, bestie, numbers πŸ“Š
  • -time-phases β€” times the parser and backend phases and prints a report. stopwatch out, we're measuring πŸ•°οΈ
  • -version β€” shows the version number of the program. who are you, where did you come from πŸ¦‹
  • -write-if-changed β€” writes the output file only if it is new or has changed. eco-friendly queen, no wasted writes ♻️

πŸŽ€ clang-tblgen Options πŸŽ€

the clang sibling's personal stash. she has a lot of them and she's not sorry πŸ’…

  • -gen-clang-attr-classes β€” generates Clang attribute classes.
  • -gen-clang-attr-parser-string-switches β€” generates all parser-related attribute string switches.
  • -gen-clang-attr-subject-match-rules-parser-string-switches β€” generates all parser-related attribute subject match rule string switches.
  • -gen-clang-attr-impl β€” generates Clang attribute implementations.
  • -gen-clang-attr-list" β€” generates a Clang attribute list. (yes the stray " is in there, i don't make the rules, i just report them πŸ™ˆ)
  • -gen-clang-attr-subject-match-rule-list β€” generates a Clang attribute subject match rule list.
  • -gen-clang-attr-pch-read β€” generates Clang PCH attribute reader.
  • -gen-clang-attr-pch-write β€” generates Clang PCH attribute writer.
  • -gen-clang-attr-has-attribute-impl β€” generates a Clang attribute spelling list.
  • -gen-clang-attr-spelling-index β€” generates a Clang attribute spelling index.
  • -gen-clang-attr-ast-visitor β€” generates a recursive AST visitor for Clang attributes.
  • -gen-clang-attr-template-instantiate β€” generates a Clang template instantiate code.
  • -gen-clang-attr-parsed-attr-list β€” generates a Clang parsed attribute list.
  • -gen-clang-attr-parsed-attr-impl β€” generates the Clang parsed attribute helpers.
  • -gen-clang-attr-parsed-attr-kinds β€” generates a Clang parsed attribute kinds.
  • -gen-clang-attr-text-node-dump β€” generates Clang attribute text node dumper.
  • -gen-clang-attr-node-traverse β€” generates Clang attribute traverser.
  • -gen-clang-diags-defs β€” generates Clang diagnostics definitions.
  • -clang-component component β€” only use warnings from the specified component. picky, and honestly? valid.
  • -gen-clang-diag-groups β€” generates Clang diagnostic groups.
  • -gen-clang-diags-index-name β€” generates Clang diagnostic name index.
  • -gen-clang-basic-reader β€” generates Clang BasicReader classes.
  • -gen-clang-basic-writer β€” generates Clang BasicWriter classes.
  • -gen-clang-comment-nodes β€” generates Clang AST comment nodes.
  • -gen-clang-decl-nodes β€” generates Clang AST declaration nodes.
  • -gen-clang-stmt-nodes β€” generates Clang AST statement nodes.
  • -gen-clang-type-nodes β€” generates Clang AST type nodes.
  • -gen-clang-type-reader β€” generates Clang AbstractTypeReader class.
  • -gen-clang-type-writer β€” generates Clang AbstractTypeWriter class.
  • -gen-clang-opcodes β€” generates Clang constexpr interpreter opcodes.
  • -gen-clang-sa-checkers β€” generates Clang static analyzer checkers.
  • -gen-clang-comment-html-tags β€” generates efficient matchers for HTML tag names that are used in documentation comments.
  • -gen-clang-comment-html-tags-properties β€” generates efficient matchers for HTML tag properties.
  • -gen-clang-comment-html-named-character-references β€” generates a function to translate named character references to UTF-8 sequences.
  • -gen-clang-comment-command-info β€” generates command properties for commands that are used in documentation comments.
  • -gen-clang-comment-command-list β€” generates a list of commands that are used in documentation comments.
  • -gen-clang-opencl-builtins β€” generates OpenCL builtin declaration handlers.
  • -gen-arm-neon β€” generates arm_neon.h for Clang.
  • -gen-arm-fp16 β€” generates arm_fp16.h for Clang.
  • -gen-arm-bf16 β€” generates arm_bf16.h for Clang.
  • -gen-arm-neon-sema β€” generates ARM NEON sema support for Clang.
  • -gen-arm-neon-test β€” generates ARM NEON tests for Clang.
  • -gen-arm-immcheck-types β€” generates arm_immcheck_types.inc for Clang.
  • -gen-arm-sve-header β€” generates arm_sve.h for Clang.
  • -gen-arm-sve-builtins β€” generates arm_sve_builtins.inc for Clang.
  • -gen-arm-sve-builtin-codegen β€” generates arm_sve_builtin_cg_map.inc for Clang.
  • -gen-arm-sve-typeflags β€” generates arm_sve_typeflags.inc for Clang.
  • -gen-arm-sve-sema-rangechecks β€” generates arm_sve_sema_rangechecks.inc for Clang.
  • -gen-arm-mve-header β€” generates arm_mve.h for Clang.
  • -gen-arm-mve-builtin-def β€” generates ARM MVE builtin definitions for Clang.
  • -gen-arm-mve-builtin-sema β€” generates ARM MVE builtin sema checks for Clang.
  • -gen-arm-mve-builtin-codegen β€” generates ARM MVE builtin code-generator for Clang.
  • -gen-arm-mve-builtin-aliases β€” generates a list of valid ARM MVE builtin aliases for Clang.
  • -gen-arm-cde-header β€” generates arm_cde.h for Clang.
  • -gen-arm-cde-builtin-def β€” generates ARM CDE builtin definitions for Clang.
  • -gen-arm-cde-builtin-sema β€” generates ARM CDE builtin sema checks for Clang.
  • -gen-arm-cde-builtin-codegen β€” generates ARM CDE builtin code-generator for Clang.
  • -gen-arm-cde-builtin-aliases β€” generates a list of valid ARM CDE builtin aliases for Clang.
  • -gen-riscv-vector-header β€” generates riscv_vector.h for Clang.
  • -gen-riscv-vector-builtins β€” generates riscv_vector_builtins.inc for Clang.
  • -gen-riscv-vector-builtin-codegen β€” generates riscv_vector_builtin_cg.inc for Clang.
  • -gen-riscv-sifive-vector-builtins β€” generates riscv_sifive_vector_builtins.inc for Clang.
  • -gen-riscv-sifive-vector-builtin-codegen β€” generates riscv_sifive_vector_builtin_cg.inc for Clang.
  • -gen-attr-docs β€” generates attribute documentation.
  • -gen-diag-docs β€” generates diagnostic documentation.
  • -gen-opt-docs β€” generates option documentation.
  • -gen-clang-data-collectors β€” generates data collectors for AST nodes.
  • -gen-clang-test-pragma-attribute-supported-attributes β€” generates a list of attributes supported by #pragma Clang attribute for testing purposes.
bestie that was like sixty options in a row, i hope you're still with me, drink some water πŸ“

🌈 lldb-tblgen Options 🌈

the lldb sibling. only three options. she's mysterious, she's lowkey, she's unbothered, she's thriving πŸ¦‹

  • gen-lldb-option-defs β€” generates lldb OptionDefinition values.
  • gen-lldb-property-defs β€” generates lldb PropertyDefinition values.
  • gen-lldb-property-enum-defs β€” generates lldb PropertyDefinition enum values.

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

the main character of the family. this is where the real machinery lives, bestie πŸ’…

  • -gen-asm-matcher β€” generates assembly instruction matcher.
  • -match-prefix=prefix β€” makes -gen-asm-matcher match only instructions with the given prefix. filter, bestie, filter.
  • -gen-asm-parser β€” generates assembly instruction parser.
  • -asmparsernum=n β€” makes -gen-asm-parser emit assembly parser number n.
  • -gen-asm-writer β€” generates assembly writer.
  • -asmwriternum=n β€” makes -gen-asm-writer emit assembly writer number n.
  • -gen-attrs β€” generates attributes.
  • -gen-automata β€” generates generic automata.
  • -gen-callingconv β€” generates calling convention descriptions.
  • -gen-compress-inst-emitter β€” generates RISC-V compressed instructions.
  • -gen-ctags β€” generates a ctags-compatible index.
  • -gen-dag-isel β€” generates a DAG (directed acyclic graph) instruction selector.
  • -instrument-coverage β€” makes -gen-dag-isel generate tables to help identify the patterns matched.
  • -omit-comments β€” makes -gen-dag-isel omit comments. the default is false. (so by default, comments stay. they're staying. periodt.)
  • -gen-dfa-packetizer β€” generates DFA Packetizer for VLIW targets.
  • -gen-directive-decl β€” generates directive related declaration code (header file).
  • -gen-directive-gen β€” generates directive related implementation code part.
  • -gen-directive-impl β€” generates directive related implementation code.
  • -gen-disassembler β€” generates disassembler.
  • -gen-emitter β€” generates machine code emitter.
  • -gen-exegesis β€” generates llvm-exegesis tables.
  • -gen-fast-isel β€” generates a "fast" instruction selector.
  • -gen-global-isel β€” generates GlobalISel selector.
  • -gisel-coverage-file=filename β€” specifies the file from which to retrieve coverage information.
  • -instrument-gisel-coverage β€” makes -gen-global-isel generate coverage instrumentation.
  • -optimize-match-table β€” makes -gen-global-isel generate an optimized version of the match table.
  • -warn-on-skipped-patterns β€” makes -gen-global-isel explain why a pattern was skipped for inclusion.

and that's the first half of the tea, bestie β€” there's more where that came from, don't go anywhere 🫢

  • -gen-global-isel-combiner β€” spits out the GlobalISel combiner. slay πŸ’…
  • -combiners=list β€” tells -gen-global-isel-combiner which specific combiners to actually emit, from that list.
  • -gicombiner-debug-cxxpreds β€” drops debug comments on every single C++ predicate that -gen-global-isel-combiner emits. yes, all of them 🫢
  • -gicombiner-stop-after-parse β€” makes -gen-global-isel-combiner stop once it's done parsing rules, and dump the state. mid-character energy, honestly.
  • -gen-instr-info β€” generates instruction descriptions.
  • -gen-instr-docs β€” generates instruction documentation.
  • -gen-intrinsic-enums β€” generates intrinsic enums.
  • -intrinsic-prefix=prefix β€” makes -gen-intrinsic-enums generate intrinsics using this target prefix.
  • -gen-intrinsic-impl β€” generates intrinsic information.
  • -gen-opt-parser-defs β€” generates options definitions.
  • -gen-opt-rst β€” generates option RST.
  • -gen-pseudo-lowering β€” generates pseudo instruction lowering.
  • -gen-register-bank β€” generates register bank descriptions.
  • -gen-register-info β€” generates registers and register classes info.
  • -register-info-debug β€” makes -gen-register-info dump register information for debugging. detective mode πŸ”
  • -gen-searchable-tables β€” generates generic searchable tables. peek at TableGen BackEnds for the full deets.
  • -gen-subtarget β€” generates subtarget enumerations.
  • -gen-x86-EVEX2VEX-tables β€” generates X86 EVEX to VEX compress tables.
  • -gen-x86-fold-tables β€” generates X86 fold tables.
  • -long-string-literals β€” when emitting big string tables, it prefers string literals over comma-separated char literals. this can be a readability and compile-time performance win, but it upsets some compilers 😭 (yes, fr, they get mad).
  • -print-enums β€” prints enumeration values for a class.
  • -class=classname β€” makes -print-enums print the enumeration list for that specific classname.
  • -print-sets β€” prints expanded sets, for testing DAG exprs.

mlir-tblgen Options 🌈

  • -gen-avail-interface-decls β€” generates availability interface declarations.
  • -gen-avail-interface-defs β€” generates op interface definitions.
  • -gen-dialect-doc β€” generates dialect documentation.
  • -dialect β€” the dialect to generate. the one and only πŸŽ€
  • -gen-directive-decl β€” generates declarations for directives (OpenMP, etc.).
  • -gen-enum-decls β€” generates enum utility declarations.
  • -gen-enum-defs β€” generates enum utility definitions.
  • -gen-enum-from-llvmir-conversions β€” generates conversions of EnumAttrs from LLVM IR.
  • -gen-enum-to-llvmir-conversions β€” generates conversions of EnumAttrs to LLVM IR.
  • -gen-llvmir-conversions β€” generates LLVM IR conversions.
  • -gen-llvmir-intrinsics β€” generates LLVM IR intrinsics.
  • -llvmir-intrinsics-filter β€” only keeps the intrinsics whose record name contains the specified substring. filter them, bestie ✨
  • -dialect-opclass-base β€” the base class for the ops in the dialect we're about to emit.
  • -gen-op-decls β€” generates operation declarations.
  • -gen-op-defs β€” generates operation definitions.
  • -asmformat-error-is-fatal β€” emits a fatal error if format parsing fails. dramatic, but valid πŸ’€
  • -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 β€” generates operation documentation.
  • -gen-pass-decls β€” generates operation documentation.
  • -name namestring β€” the name of this group of passes.
  • -gen-pass-doc β€” generates pass documentation.
  • -gen-rewriters β€” generates pattern rewriters.
  • -gen-spirv-avail-impls β€” generates SPIR-V operation utility definitions.
  • -gen-spirv-capability-implication β€” generates a utility function to return implied capabilities for a given capability.
  • -gen-spirv-enum-avail-decls β€” generates SPIR-V enum availability declarations.
  • -gen-spirv-enum-avail-defs β€” generates SPIR-V enum availability definitions.
  • -gen-spirv-op-utils β€” generates SPIR-V operation utility definitions.
  • -gen-spirv-serialization β€” generates SPIR-V (de)serialization utilities and functions.
  • -gen-struct-attr-decls β€” generates struct utility declarations.
  • -gen-struct-attr-defs β€” generates struct utility definitions.
  • -gen-typedef-decls β€” generates TypeDef declarations.
  • -gen-typedef-defs β€” generates TypeDef definitions.
  • -typedefs-dialect name β€” generate types for this dialect.

EXIT STATUS πŸ’œ

If -tblgen succeeds, it exits with 0 ✨. Otherwise, if an error happens, it exits with a non-zero value. simple as that, no notes.


AUTHOR 🫢

Maintained by the LLVM Team (https://llvm.org/). they're doing the lord's work, ngl.


2003-2026, LLVM Project


and that's the whole thing bestie, you officially understand TBLGEN(1) πŸ’– this page came straight from the LLVM Project's own docs, dated 2026-07-22, and it's version 21 energy all the way through. go generate something iconic πŸ‘‘βœ¨

πŸ“¦ where this page comes from