1 tblgen - Description to C++ Code
2 ================================
9 :program:`clang-tblgen` [*options*] [*filename*]
11 :program:`lldb-tblgen` [*options*] [*filename*]
13 :program:`llvm-tblgen` [*options*] [*filename*]
15 :program:`mlir-tblgen` [*options*] [*filename*]
20 :program:`*-tblgen` is a family of programs that translates target
21 description (``.td``) files into C++ code and other output formats. Most
22 users of LLVM will not need to use this program. It is used only for
23 writing parts of the compiler, debugger, and LLVM target backends.
25 The details of the input and output of the :program:`*-tblgen` programs is
26 beyond the scope of this short introduction; please see the :doc:`TableGen
27 Overview <../TableGen/index>` for an introduction and for references to
28 additional TableGen documents.
30 The *filename* argument specifies the name of the Target Description (``.td``)
31 file that TableGen processes.
41 Print a description of the command line options.
43 .. option:: -help-list
45 Print a description of the command line options in a simple list format.
47 .. option:: -D=macroname
49 Specify the name of a macro to be defined. The name is defined, but it
50 has no particular value.
52 .. option:: -d=filename
54 Specify the name of the dependency filename.
60 .. option:: -dump-json
62 Print a JSON representation of all records, suitable for further
65 .. option:: -I directory
67 Specify where to find other target description files for inclusion. The
68 ``directory`` value should be a full or partial path to a directory that
69 contains target description files.
71 .. option:: -null-backend
73 Parse the source files and build the records, but do not run any
74 backend. This is useful for timing the frontend.
76 .. option:: -o filename
78 Specify the output file name. If ``filename`` is ``-``, then
79 :program:`*-tblgen` sends its output to standard output.
81 .. option:: -print-records
83 Print all classes and records to standard output (default backend option).
85 .. option:: -print-detailed-records
87 Print a detailed report of all global variables, classes, and records
92 Print a report with any statistics collected by the backend.
94 .. option:: -time-phases
96 Time the parser and backend phases and print a report.
100 Show the version number of the program.
102 .. option:: -write-if-changed
104 Write the output file only if it is new or has changed.
110 .. option:: -gen-clang-attr-classes
112 Generate Clang attribute classes.
114 .. option:: -gen-clang-attr-parser-string-switches
116 Generate all parser-related attribute string switches.
118 .. option:: -gen-clang-attr-subject-match-rules-parser-string-switches
120 Generate all parser-related attribute subject match rule string switches.
122 .. option:: -gen-clang-attr-impl
124 Generate Clang attribute implementations.
126 .. option:: -gen-clang-attr-list"
128 Generate a Clang attribute list.
130 .. option:: -gen-clang-attr-subject-match-rule-list
132 Generate a Clang attribute subject match rule list.
134 .. option:: -gen-clang-attr-pch-read
136 Generate Clang PCH attribute reader.
138 .. option:: -gen-clang-attr-pch-write
140 Generate Clang PCH attribute writer.
142 .. option:: -gen-clang-attr-has-attribute-impl
144 Generate a Clang attribute spelling list.
146 .. option:: -gen-clang-attr-spelling-index
148 Generate a Clang attribute spelling index.
150 .. option:: -gen-clang-attr-ast-visitor
152 Generate a recursive AST visitor for Clang attributes.
154 .. option:: -gen-clang-attr-template-instantiate
156 Generate a Clang template instantiate code.
158 .. option:: -gen-clang-attr-parsed-attr-list
160 Generate a Clang parsed attribute list.
162 .. option:: -gen-clang-attr-parsed-attr-impl
164 Generate the Clang parsed attribute helpers.
166 .. option:: -gen-clang-attr-parsed-attr-kinds
168 Generate a Clang parsed attribute kinds.
170 .. option:: -gen-clang-attr-text-node-dump
172 Generate Clang attribute text node dumper.
174 .. option:: -gen-clang-attr-node-traverse
176 Generate Clang attribute traverser.
178 .. option:: -gen-clang-diags-defs
180 Generate Clang diagnostics definitions.
182 .. option:: -clang-component component
184 Only use warnings from specified component.
186 .. option:: -gen-clang-diag-groups
188 Generate Clang diagnostic groups.
190 .. option:: -gen-clang-diags-index-name
192 Generate Clang diagnostic name index.
194 .. option:: -gen-clang-basic-reader
196 Generate Clang BasicReader classes.
198 .. option:: -gen-clang-basic-writer
200 Generate Clang BasicWriter classes.
202 .. option:: -gen-clang-comment-nodes
204 Generate Clang AST comment nodes.
206 .. option:: -gen-clang-decl-nodes
208 Generate Clang AST declaration nodes.
210 .. option:: -gen-clang-stmt-nodes
212 Generate Clang AST statement nodes.
214 .. option:: -gen-clang-type-nodes
216 Generate Clang AST type nodes.
218 .. option:: -gen-clang-type-reader
220 Generate Clang AbstractTypeReader class.
222 .. option:: -gen-clang-type-writer
224 Generate Clang AbstractTypeWriter class.
226 .. option:: -gen-clang-opcodes
228 Generate Clang constexpr interpreter opcodes.
230 .. option:: -gen-clang-sa-checkers
232 Generate Clang static analyzer checkers.
234 .. option:: -gen-clang-comment-html-tags
236 Generate efficient matchers for HTML tag names that are used in
237 documentation comments.
239 .. option:: -gen-clang-comment-html-tags-properties
241 Generate efficient matchers for HTML tag properties.
243 .. option:: -gen-clang-comment-html-named-character-references
245 Generate function to translate named character references to UTF-8 sequences.
247 .. option:: -gen-clang-comment-command-info
249 Generate command properties for commands that are used in documentation comments.
251 .. option:: -gen-clang-comment-command-list
253 Generate list of commands that are used in documentation comments.
255 .. option:: -gen-clang-opencl-builtins
257 Generate OpenCL builtin declaration handlers.
259 .. option:: -gen-arm-neon
261 Generate ``arm_neon.h`` for Clang.
263 .. option:: -gen-arm-fp16
265 Generate ``arm_fp16.h`` for Clang.
267 .. option:: -gen-arm-bf16
269 Generate ``arm_bf16.h`` for Clang.
271 .. option:: -gen-arm-neon-sema
273 Generate ARM NEON sema support for Clang.
275 .. option:: -gen-arm-neon-test
277 Generate ARM NEON tests for Clang.
279 .. option:: -gen-arm-sve-header
281 Generate ``arm_sve.h`` for Clang.
283 .. option:: -gen-arm-sve-builtins
285 Generate ``arm_sve_builtins.inc`` for Clang.
287 .. option:: -gen-arm-sve-builtin-codegen
289 Generate ``arm_sve_builtin_cg_map.inc`` for Clang.
291 .. option:: -gen-arm-sve-typeflags
293 Generate ``arm_sve_typeflags.inc`` for Clang.
295 .. option:: -gen-arm-sve-sema-rangechecks
297 Generate ``arm_sve_sema_rangechecks.inc`` for Clang.
299 .. option:: -gen-arm-mve-header
301 Generate ``arm_mve.h`` for Clang.
303 .. option:: -gen-arm-mve-builtin-def
305 Generate ARM MVE builtin definitions for Clang.
307 .. option:: -gen-arm-mve-builtin-sema
309 Generate ARM MVE builtin sema checks for Clang.
311 .. option:: -gen-arm-mve-builtin-codegen
313 Generate ARM MVE builtin code-generator for Clang.
315 .. option:: -gen-arm-mve-builtin-aliases
317 Generate list of valid ARM MVE builtin aliases for Clang.
319 .. option:: -gen-arm-cde-header
321 Generate ``arm_cde.h`` for Clang.
323 .. option:: -gen-arm-cde-builtin-def
325 Generate ARM CDE builtin definitions for Clang.
327 .. option:: -gen-arm-cde-builtin-sema
329 Generate ARM CDE builtin sema checks for Clang.
331 .. option:: -gen-arm-cde-builtin-codegen
333 Generate ARM CDE builtin code-generator for Clang.
335 .. option:: -gen-arm-cde-builtin-aliases
337 Generate list of valid ARM CDE builtin aliases for Clang.
339 .. option:: -gen-riscv-vector-header
341 Generate ``riscv_vector.h`` for Clang.
343 .. option:: -gen-riscv-vector-builtins
345 Generate ``riscv_vector_builtins.inc`` for Clang.
347 .. option:: -gen-riscv-vector-builtin-codegen
349 Generate ``riscv_vector_builtin_cg.inc`` for Clang.
351 .. option:: -gen-riscv-sifive-vector-builtins
353 Generate ``riscv_sifive_vector_builtins.inc`` for Clang.
355 .. option:: -gen-riscv-sifive-vector-builtin-codegen
357 Generate ``riscv_sifive_vector_builtin_cg.inc`` for Clang.
359 .. option:: -gen-attr-docs
361 Generate attribute documentation.
363 .. option:: -gen-diag-docs
365 Generate diagnostic documentation.
367 .. option:: -gen-opt-docs
369 Generate option documentation.
371 .. option:: -gen-clang-data-collectors
373 Generate data collectors for AST nodes.
375 .. option:: -gen-clang-test-pragma-attribute-supported-attributes
377 Generate a list of attributes supported by ``#pragma`` Clang attribute for
384 .. option:: gen-lldb-option-defs
386 Generate lldb OptionDefinition values.
388 .. option:: gen-lldb-property-defs
390 Generate lldb PropertyDefinition values.
392 .. option:: gen-lldb-property-enum-defs
394 Generate lldb PropertyDefinition enum values.
400 .. option:: -gen-asm-matcher
402 Generate assembly instruction matcher.
404 .. option:: -match-prefix=prefix
406 Make -gen-asm-matcher match only instructions with the given *prefix*.
408 .. option:: -gen-asm-parser
410 Generate assembly instruction parser.
412 .. option:: -asmparsernum=n
414 Make -gen-asm-parser emit assembly parser number *n*.
416 .. option:: -gen-asm-writer
418 Generate assembly writer.
420 .. option:: -asmwriternum=n
422 Make -gen-asm-writer emit assembly writer number *n*.
424 .. option:: -gen-attrs
428 .. option:: -gen-automata
430 Generate generic automata.
432 .. option:: -gen-callingconv
434 Generate calling convention descriptions.
436 .. option:: -gen-compress-inst-emitter
438 Generate RISC-V compressed instructions.
440 .. option:: -gen-ctags
442 Generate ctags-compatible index.
444 .. option:: -gen-dag-isel
446 Generate a DAG (directed acyclic graph) instruction selector.
448 .. option:: -instrument-coverage
450 Make -gen-dag-isel generate tables to help identify the patterns matched.
452 .. option:: -omit-comments
454 Make -gen-dag-isel omit comments. The default is false.
456 .. option:: -gen-dfa-packetizer
458 Generate DFA Packetizer for VLIW targets.
460 .. option:: -gen-directive-decl
462 Generate directive related declaration code (header file).
464 .. option:: -gen-directive-gen
466 Generate directive related implementation code part.
468 .. option:: -gen-directive-impl
470 Generate directive related implementation code.
472 .. option:: -gen-disassembler
474 Generate disassembler.
476 .. option:: -gen-emitter
478 Generate machine code emitter.
480 .. option:: -gen-exegesis
482 Generate llvm-exegesis tables.
484 .. option:: -gen-fast-isel
486 Generate a "fast" instruction selector.
488 .. option:: -gen-global-isel
490 Generate GlobalISel selector.
492 .. option:: -gisel-coverage-file=filename
494 Specify the file from which to retrieve coverage information.
496 .. option:: -instrument-gisel-coverage
498 Make -gen-global-isel generate coverage instrumentation.
500 .. option:: -optimize-match-table
502 Make -gen-global-isel generate an optimized version of the match table.
504 .. option:: -warn-on-skipped-patterns
506 Make -gen-global-isel explain why a pattern was skipped for inclusion.
508 .. option:: -gen-global-isel-combiner
510 Generate GlobalISel combiner.
512 .. option:: -combiners=list
514 Make -gen-global-isel-combiner emit the specified combiners.
516 .. option:: -gicombiner-debug-cxxpreds
518 Add debug comments to all C++ predicates emitted by -gen-global-isel-combiner
520 .. option:: -gicombiner-stop-after-parse
522 Make -gen-global-isel-combiner stop processing after parsing rules and dump state.
524 .. option:: -gen-instr-info
526 Generate instruction descriptions.
528 .. option:: -gen-instr-docs
530 Generate instruction documentation.
532 .. option:: -gen-intrinsic-enums
534 Generate intrinsic enums.
536 .. option:: -intrinsic-prefix=prefix
538 Make -gen-intrinsic-enums generate intrinsics with this target *prefix*.
540 .. option:: -gen-intrinsic-impl
542 Generate intrinsic information.
544 .. option:: -gen-opt-parser-defs
546 Generate options definitions.
548 .. option:: -gen-opt-rst
552 .. option:: -gen-pseudo-lowering
554 Generate pseudo instruction lowering.
556 .. option:: -gen-register-bank
558 Generate register bank descriptions.
560 .. option:: -gen-register-info
562 Generate registers and register classes info.
564 .. option:: -register-info-debug
566 Make -gen-register-info dump register information for debugging.
568 .. option:: -gen-searchable-tables
570 Generate generic searchable tables. See :doc:`TableGen BackEnds <../TableGen/BackEnds>`
571 for a detailed description.
573 .. option:: -gen-subtarget
575 Generate subtarget enumerations.
577 .. option:: -gen-x86-EVEX2VEX-tables
579 Generate X86 EVEX to VEX compress tables.
581 .. option:: -gen-x86-fold-tables
583 Generate X86 fold tables.
585 .. option:: -long-string-literals
587 When emitting large string tables, prefer string literals over
588 comma-separated char literals. This can be a readability and
589 compile-time performance win, but upsets some compilers.
591 .. option:: -print-enums
593 Print enumeration values for a class.
595 .. option:: -class=classname
597 Make -print-enums print the enumeration list for the specified class.
599 .. option:: -print-sets
601 Print expanded sets for testing DAG exprs.
607 .. option:: -gen-avail-interface-decls
609 Generate availability interface declarations.
611 .. option:: -gen-avail-interface-defs
613 Generate op interface definitions.
615 .. option:: -gen-dialect-doc
617 Generate dialect documentation.
621 The dialect to generate.
623 .. option:: -gen-directive-decl
625 Generate declarations for directives (OpenMP, etc.).
627 .. option:: -gen-enum-decls
629 Generate enum utility declarations.
631 .. option:: -gen-enum-defs
633 Generate enum utility definitions.
635 .. option:: -gen-enum-from-llvmir-conversions
637 Generate conversions of EnumAttrs from LLVM IR.
639 .. option:: -gen-enum-to-llvmir-conversions
641 Generate conversions of EnumAttrs to LLVM IR.
643 .. option:: -gen-llvmir-conversions
645 Generate LLVM IR conversions.
647 .. option:: -gen-llvmir-intrinsics
649 Generate LLVM IR intrinsics.
651 .. option:: -llvmir-intrinsics-filter
653 Only keep the intrinsics with the specified substring in their record name.
655 .. option:: -dialect-opclass-base
657 The base class for the ops in the dialect we are to emit.
659 .. option:: -gen-op-decls
661 Generate operation declarations.
663 .. option:: -gen-op-defs
665 Generate operation definitions.
667 .. option:: -asmformat-error-is-fatal
669 Emit a fatal error if format parsing fails.
671 .. option:: -op-exclude-regex
673 Regular expression of name of ops to exclude (no filter if empty).
675 .. option:: -op-include-regex
677 Regular expression of name of ops to include (no filter if empty).
679 .. option:: -gen-op-doc
681 Generate operation documentation.
683 .. option:: -gen-pass-decls
685 Generate operation documentation.
687 .. option:: -name namestring
689 The name of this group of passes.
691 .. option:: -gen-pass-doc
693 Generate pass documentation.
695 .. option:: -gen-rewriters
697 Generate pattern rewriters.
699 .. option:: -gen-spirv-avail-impls
701 Generate SPIR-V operation utility definitions.
703 .. option:: -gen-spirv-capability-implication
705 Generate utility function to return implied capabilities for a given capability.
707 .. option:: -gen-spirv-enum-avail-decls
709 Generate SPIR-V enum availability declarations.
711 .. option:: -gen-spirv-enum-avail-defs
713 Generate SPIR-V enum availability definitions.
715 .. option:: -gen-spirv-op-utils
717 Generate SPIR-V operation utility definitions.
719 .. option:: -gen-spirv-serialization
721 Generate SPIR-V (de)serialization utilities and functions.
723 .. option:: -gen-struct-attr-decls
725 Generate struct utility declarations.
727 .. option:: -gen-struct-attr-defs
729 Generate struct utility definitions.
731 .. option:: -gen-typedef-decls
733 Generate TypeDef declarations.
735 .. option:: -gen-typedef-defs
737 Generate TypeDef definitions.
739 .. option:: -typedefs-dialect name
741 Generate types for this dialect.
746 If :program:`*-tblgen` succeeds, it will exit with 0. Otherwise, if an error
747 occurs, it will exit with a non-zero value.