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*-tblgensends 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β generatesarm_neon.hfor Clang.-gen-arm-fp16β generatesarm_fp16.hfor Clang.-gen-arm-bf16β generatesarm_bf16.hfor 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β generatesarm_immcheck_types.incfor Clang.-gen-arm-sve-headerβ generatesarm_sve.hfor Clang.-gen-arm-sve-builtinsβ generatesarm_sve_builtins.incfor Clang.-gen-arm-sve-builtin-codegenβ generatesarm_sve_builtin_cg_map.incfor Clang.-gen-arm-sve-typeflagsβ generatesarm_sve_typeflags.incfor Clang.-gen-arm-sve-sema-rangechecksβ generatesarm_sve_sema_rangechecks.incfor Clang.-gen-arm-mve-headerβ generatesarm_mve.hfor 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β generatesarm_cde.hfor 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β generatesriscv_vector.hfor Clang.-gen-riscv-vector-builtinsβ generatesriscv_vector_builtins.incfor Clang.-gen-riscv-vector-builtin-codegenβ generatesriscv_vector_builtin_cg.incfor Clang.-gen-riscv-sifive-vector-builtinsβ generatesriscv_sifive_vector_builtins.incfor Clang.-gen-riscv-sifive-vector-builtin-codegenβ generatesriscv_sifive_vector_builtin_cg.incfor 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 attributefor 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 lldbOptionDefinitionvalues.gen-lldb-property-defsβ generates lldbPropertyDefinitionvalues.gen-lldb-property-enum-defsβ generates lldbPropertyDefinitionenum 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-matchermatch only instructions with the given prefix. filter, bestie, filter.-gen-asm-parserβ generates assembly instruction parser.-asmparsernum=nβ makes-gen-asm-parseremit assembly parser number n.-gen-asm-writerβ generates assembly writer.-asmwriternum=nβ makes-gen-asm-writeremit 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-iselgenerate tables to help identify the patterns matched.-omit-commentsβ makes-gen-dag-iselomit comments. the default isfalse. (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β generatesllvm-exegesistables.-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-iselgenerate coverage instrumentation.-optimize-match-tableβ makes-gen-global-iselgenerate an optimized version of the match table.-warn-on-skipped-patternsβ makes-gen-global-iselexplain 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-combinerwhich specific combiners to actually emit, from that list.-gicombiner-debug-cxxpredsβ drops debug comments on every single C++ predicate that-gen-global-isel-combineremits. yes, all of them π«Ά-gicombiner-stop-after-parseβ makes-gen-global-isel-combinerstop 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-enumsgenerate 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-infodump 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-enumsprint 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.
COPYRIGHT πΈ
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
- epel 10: llvm21 21.1.8-8.el10_3 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 43: llvm 21.1.8-6.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 43: llvm 21.1.8-6.fc43 Β· 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