TBLGEN(1)

🌸 NAME 🌸

tblgen β€” turning descriptions into C++ code, bestie πŸ’…


✨ SYNOPSIS ✨

clang-tblgen [options] [filename]

lldb-tblgen [options] [filename]

llvm-tblgen [options] [filename]

mlir-tblgen [options] [filename]

πŸ’– DESCRIPTION πŸ’–

Okay so picture this: *-tblgen is literally a whole family of programs πŸ‘‘ and what they do is translate target description files (.td files) into C++ code and other output formats. That's it, that's the job.

Lowkey important heads up though: most people using LLVM will never need this program. Not even a little. πŸ™ˆ

It's used only for writing parts of the compiler, the debugger, and the LLVM target backends. So if you're not out here building compiler guts, you can respectfully close this tab, no shade.

The details of what these *-tblgen programs eat and what they spit out are beyond the scope of this short introduction β€” so like, fr fr, please go read the TableGen Overview for an intro, and it'll point you at more TableGen docs from there. Iykyk πŸ“šβœ¨

The filename argument specifies the name of the Target Description (.td) file that TableGen processes. That's the vibe check on that one.


πŸŽ€ OPTIONS πŸŽ€

⭐ General Options ⭐

  • -help β€” Print a description of the command line options. Your lil cheat sheet 🫢
  • -help-list β€” Print a description of the command line options, but in a simple list format. Same tea, tidier cup.
  • -D=macroname β€” Specify the name of a macro to be defined. The name is defined, but it has no particular value β€” so it exists, it's just not saying anything. Iconic honestly.
  • -d=filename β€” Specify the name of the dependency filename.
  • -debug β€” Enable debug output. Buckle up, it's chatty πŸ’€
  • -dump-json β€” Print a JSON representation of all records, suitable for further automated processing. Feed it to your lil scripts, slay πŸ€–
  • -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. Basically "bestie lives over here, go look" 🏠
  • -null-backend β€” Parse the source files and build the records, but do not run any backend. This is useful for timing the frontend. All the parsing, none of the follow-through πŸ™ˆ
  • -o filename β€” Specify the output file name. If filename is -, then *-tblgen sends its output to standard output. Dash means "just say it out loud to the terminal," periodt.
  • -print-records β€” Print all classes and records to standard output (this is the default backend option).
  • -print-detailed-records β€” Print a detailed report of all global variables, classes, and records to standard output. The deluxe extended cut 🌈
  • -stats β€” Print a report with any statistics collected by the backend.
  • -time-phases β€” Time the parser and backend phases and print a report. Stopwatch energy ⏱️
  • -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're being efficient πŸ’…

πŸ¦‹ clang-tblgen Options πŸ¦‹

  • -gen-clang-attr-classes β€” Generate Clang attribute clases.
  • -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.
  • -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. Filtered, bestie 🧚
  • -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-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 πŸ’œ

  • 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 the ones that start right, bestie ✨
  • -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. Receipts, we love to see it 🫢
  • -gen-global-isel-combiner β€” Generate GlobalISel combiner.
  • -combiners=list β€” Make -gen-global-isel-combiner emit the specified combiners.
  • -gicombiner-show-expansions β€” Make -gen-global-isel-combiner use C++ comments to indicate occurrences of code expansion.

  • -gicombiner-stop-after-build β€” makes -gen-global-isel-combiner dip out right after it's built the match tree, no further processing πŸ’…
  • -gicombiner-stop-after-parse β€” makes -gen-global-isel-combiner stop once it's parsed the rules and dump the state, that's it, that's the whole job 🫢
  • -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 with this target prefix, okurrr
  • -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, for when you gotta snoop πŸ‘€
  • -gen-searchable-tables β€” generate generic searchable tables. See TableGen BackEnds for the detailed description, iykyk πŸ“š
  • -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. This can be a readability and compile-time performance win, but it upsets some compilers 😭 (the compilers are being dramatic, not us)
  • -print-enums β€” print enumeration values for a class πŸ’…
  • -class=classname β€” makes -print-enums print the enumeration list for the specified class πŸ‘‘
  • -print-sets β€” print expanded sets for testing DAG exprs 🧚

✨ mlir-tblgen Options ✨

okay bestie, new subsection, same energy, we're still in OPTIONS πŸ’–

  • -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, very picky, love that for us πŸ™ˆ
  • -dialect-opclass-base β€” the base class for the ops in the dialect we are 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 πŸ’€ no chill whatsoever
  • -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 fr, that's what it says, we're just relaying the message)
  • -name namestring β€” the name of this group of passes 🏷️
  • -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 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 πŸšͺ

If -tblgen succeeds, it will exit with 0 ✨. Otherwise, if an error occurs, it will exit with a non-zero value 😭. That's the whole vibe check.


πŸ‘‘ AUTHOR πŸ‘‘

Maintained by the LLVM Team (<https://llvm.org/>). They're the main characters fr fr 🫢


2003-2025, LLVM Project πŸ’œ


and that's a wrap on TBLGEN(1), bestie!! this page is from the LLVM source, dated 2025-05-22, and it lives in section 14 of the manual πŸŽ€ go forth and tblgen responsibly, mwah πŸ’…βœ¨πŸ¦‹
πŸ“¦ where this page comes from