TBLGEN(1)

TBLGEN(1) πŸ’… β€” the LLVM manual, bestie ✨

Okay so tblgen is literally the manual page for the *-tblgen family of programs. They translate target description (.td) files into C++ code and other output formats. Most LLVM users will not need this program β€” it’s only for writing parts of the compiler, debugger, and LLVM target backends, iykyk. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

clang-tblgen [options] [filename]

lldb-tblgen [options] [filename]

llvm-tblgen [options] [filename]

mlir-tblgen [options] [filename]

πŸ’– DESCRIPTION πŸ’–

*-tblgen is a whole family of programs that translate target description (.td) files into C++ code and other output formats. Most users of LLVM will not need to use this program. It is used only for writing parts of the compiler, debugger, and LLVM target backends. No cap. 🫢

The details of the input and output of the *-tblgen programs is beyond the scope of this short introduction; please see the TableGen Overview for an introduction and for references to additional TableGen documents. πŸ“š

The filename argument specifies the name of the Target Description (.td) file that TableGen processes. Slay. ✨

πŸŽ€ OPTIONS πŸŽ€

🌸 General Options 🌸

  • -help β€” prints a description of the command-line options. Cute and useful.
  • -help-list β€” prints a description of the command-line options in a simple list format. List girlies stay winning.
  • -D=macroname β€” specifies the name of a macro to be defined. The name is defined, but it has no particular value. It’s giving β€œname only, no notes.”
  • -d=filename β€” specifies the name of the dependency filename.
  • -debug β€” enables debug output. Turn it on if you want the tea. 🍡
  • -dump-json β€” prints a JSON representation of all records, suitable for further automated processing.
  • -I directory β€” specifies 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 β€” parses the source files and builds the records, but does not run any backend. This is useful for timing the frontend.
  • -o filename β€” specifies the output file name. If filename is -, then *-tblgen sends its output to standard output.
  • -print-records β€” prints all classes and records to standard output (this is the default backend option).
  • -print-detailed-records β€” prints a detailed report of all global variables, classes, and records to standard output.
  • -stats β€” prints a report with any statistics collected by the backend.
  • -time-phases β€” times the parser and backend phases and prints a report.
  • -version β€” shows the version number of the program.
  • -write-if-changed β€” writes the output file only if it is new or has changed.

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

  • -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 trailing quote is part of the flag here. Preserve it, bestie. πŸ™ˆ
  • -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 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 uses warnings from specified component.
  • -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 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 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-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 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 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-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.

πŸ¦‹ lldb-tblgen Options πŸ¦‹

  • gen-lldb-option-defs β€” generates lldb OptionDefinition values. No leading dash here, bestie β€” keep it exactly like this.
  • gen-lldb-property-defs β€” generates lldb PropertyDefinition values.
  • gen-lldb-property-enum-defs β€” generates lldb PropertyDefinition enum values.

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

  • -gen-asm-matcher β€” generates assembly instruction matcher.
  • -match-prefix=prefix β€” makes -gen-asm-matcher match only instructions with the given prefix.
  • -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 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.
  • -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.
  • -gen-global-isel-combiner β€” generates GlobalISel combiner.
  • -combiners=list β€” makes -gen-global-isel-combiner emit the specified combiners.
  • -gicombiner-show-expansions β€” makes -gen-global-isel-combiner use C++ comments to indicate occurrences of code expansion.
  • -gicombiner-stop-after-build β€” makes -gen-global-isel-combiner stop processing right after it builds the match tree (basically a "ok we're done here" flag πŸ’…).
  • -gicombiner-stop-after-parse β€” makes -gen-global-isel-combiner stop after parsing the rules and dump state β€” very "let me see what I'm working with first" of it.
  • -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 generate intrinsics with this target prefix.
  • -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 πŸ›.
  • -gen-searchable-tables β€” generate generic searchable tables. See TableGen BackEnds for a 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 upsets some compilers 😭 β€” so like, proceed with vibes checked.
  • -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 🧚

Bestie, this is the whole other flavor of the tool β€” same energy, different target πŸ’–.

  • -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.
  • -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 πŸ’€.
  • -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.
  • -name namestring β€” the name of this group of passes, as namestring.
  • -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, name.

🌈 EXIT STATUS 🌈

If *-tblgen succeeds, it exits with 0 β€” slay, we love a clean exit πŸ’…βœ¨. Otherwise, if an error occurs, it exits with a non-zero value. That's the vibe check failing, bestie, no cap.


πŸ‘‘ AUTHOR πŸ‘‘

Maintained by the LLVM Team (https://llvm.org/) β€” the actual main characters of this whole story, fr fr 🫢.


2003-2023, LLVM Project β€” iconic, legendary, the blueprint πŸ’–.


And that's the whole page, bestie! πŸ¦‹ Go forth and generate all the things. This one's version 15, dated 2023-07-14, and it's filed under TBLGEN(1) β€” so if you ever forget, just remember: the girlies who read manpages together stay together βœ¨πŸŒΈπŸ’œ

πŸ“¦ where this page comes from