xref: /openbsd-src/gnu/llvm/llvm/docs/CommandGuide/tblgen.rst (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1tblgen - Description to C++ Code
2================================
3
4.. program:: tblgen
5
6SYNOPSIS
7--------
8
9:program:`clang-tblgen` [*options*] [*filename*]
10
11:program:`lldb-tblgen` [*options*] [*filename*]
12
13:program:`llvm-tblgen` [*options*] [*filename*]
14
15:program:`mlir-tblgen` [*options*] [*filename*]
16
17DESCRIPTION
18-----------
19
20:program:`*-tblgen` is a family of programs that translates target
21description (``.td``) files into C++ code and other output formats. Most
22users of LLVM will not need to use this program. It is used only for
23writing parts of the compiler, debugger, and LLVM target backends.
24
25The details of the input and output of the :program:`*-tblgen` programs is
26beyond the scope of this short introduction; please see the :doc:`TableGen
27Overview <../TableGen/index>` for an introduction and for references to
28additional TableGen documents.
29
30The *filename* argument specifies the name of the Target Description (``.td``)
31file that TableGen processes.
32
33OPTIONS
34-------
35
36General Options
37~~~~~~~~~~~~~~~
38
39.. option:: -help
40
41 Print a description of the command line options.
42
43.. option:: -help-list
44
45  Print a description of the command line options in a simple list format.
46
47.. option:: -D=macroname
48
49  Specify the name of a macro to be defined. The name is defined, but it
50  has no particular value.
51
52.. option:: -d=filename
53
54  Specify the name of the dependency filename.
55
56.. option:: -debug
57
58  Enable debug output.
59
60.. option:: -dump-json
61
62 Print a JSON representation of all records, suitable for further
63 automated processing.
64
65.. option:: -I directory
66
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.
70
71.. option:: -null-backend
72
73  Parse the source files and build the records, but do not run any
74  backend. This is useful for timing the frontend.
75
76.. option:: -o filename
77
78 Specify the output file name.  If ``filename`` is ``-``, then
79 :program:`*-tblgen` sends its output to standard output.
80
81.. option:: -print-records
82
83 Print all classes and records to standard output (default backend option).
84
85.. option:: -print-detailed-records
86
87  Print a detailed report of all global variables, classes, and records
88  to standard output.
89
90.. option:: -stats
91
92  Print a report with any statistics collected by the backend.
93
94.. option:: -time-phases
95
96  Time the parser and backend phases and print a report.
97
98.. option:: -version
99
100 Show the version number of the program.
101
102.. option:: -write-if-changed
103
104  Write the output file only if it is new or has changed.
105
106
107clang-tblgen Options
108~~~~~~~~~~~~~~~~~~~~
109
110.. option:: -gen-clang-attr-classes
111
112  Generate Clang attribute clases.
113
114.. option:: -gen-clang-attr-parser-string-switches
115
116  Generate all parser-related attribute string switches.
117
118.. option:: -gen-clang-attr-subject-match-rules-parser-string-switches
119
120  Generate all parser-related attribute subject match rule string switches.
121
122.. option:: -gen-clang-attr-impl
123
124  Generate Clang attribute implementations.
125
126.. option:: -gen-clang-attr-list"
127
128  Generate a Clang attribute list.
129
130.. option:: -gen-clang-attr-subject-match-rule-list
131
132  Generate a Clang attribute subject match rule list.
133
134.. option:: -gen-clang-attr-pch-read
135
136  Generate Clang PCH attribute reader.
137
138.. option:: -gen-clang-attr-pch-write
139
140  Generate Clang PCH attribute writer.
141
142.. option:: -gen-clang-attr-has-attribute-impl
143
144  Generate a Clang attribute spelling list.
145
146.. option:: -gen-clang-attr-spelling-index
147
148  Generate a Clang attribute spelling index.
149
150.. option:: -gen-clang-attr-ast-visitor
151
152  Generate a recursive AST visitor for Clang attributes.
153
154.. option:: -gen-clang-attr-template-instantiate
155
156  Generate a Clang template instantiate code.
157
158.. option:: -gen-clang-attr-parsed-attr-list
159
160  Generate a Clang parsed attribute list.
161
162.. option:: -gen-clang-attr-parsed-attr-impl
163
164  Generate the Clang parsed attribute helpers.
165
166.. option:: -gen-clang-attr-parsed-attr-kinds
167
168  Generate a Clang parsed attribute kinds.
169
170.. option:: -gen-clang-attr-text-node-dump
171
172  Generate Clang attribute text node dumper.
173
174.. option:: -gen-clang-attr-node-traverse
175
176  Generate Clang attribute traverser.
177
178.. option:: -gen-clang-diags-defs
179
180  Generate Clang diagnostics definitions.
181
182.. option:: -clang-component component
183
184  Only use warnings from specified component.
185
186.. option:: -gen-clang-diag-groups
187
188  Generate Clang diagnostic groups.
189
190.. option:: -gen-clang-diags-index-name
191
192  Generate Clang diagnostic name index.
193
194.. option:: -gen-clang-basic-reader
195
196  Generate Clang BasicReader classes.
197
198.. option:: -gen-clang-basic-writer
199
200  Generate Clang BasicWriter classes.
201
202.. option:: -gen-clang-comment-nodes
203
204  Generate Clang AST comment nodes.
205
206.. option:: -gen-clang-decl-nodes
207
208  Generate Clang AST declaration nodes.
209
210.. option:: -gen-clang-stmt-nodes
211
212  Generate Clang AST statement nodes.
213
214.. option:: -gen-clang-type-nodes
215
216  Generate Clang AST type nodes.
217
218.. option:: -gen-clang-type-reader
219
220  Generate Clang AbstractTypeReader class.
221
222.. option:: -gen-clang-type-writer
223
224  Generate Clang AbstractTypeWriter class.
225
226.. option:: -gen-clang-opcodes
227
228  Generate Clang constexpr interpreter opcodes.
229
230.. option:: -gen-clang-sa-checkers
231
232  Generate Clang static analyzer checkers.
233
234.. option:: -gen-clang-comment-html-tags
235
236  Generate efficient matchers for HTML tag names that are used in
237  documentation comments.
238
239.. option:: -gen-clang-comment-html-tags-properties
240
241  Generate efficient matchers for HTML tag properties.
242
243.. option:: -gen-clang-comment-html-named-character-references
244
245  Generate function to translate named character references to UTF-8 sequences.
246
247.. option:: -gen-clang-comment-command-info
248
249  Generate command properties for commands that are used in documentation comments.
250
251.. option:: -gen-clang-comment-command-list
252
253  Generate list of commands that are used in documentation comments.
254
255.. option:: -gen-clang-opencl-builtins
256
257  Generate OpenCL builtin declaration handlers.
258
259.. option:: -gen-arm-neon
260
261  Generate ``arm_neon.h`` for Clang.
262
263.. option:: -gen-arm-fp16
264
265  Generate ``arm_fp16.h`` for Clang.
266
267.. option:: -gen-arm-bf16
268
269  Generate ``arm_bf16.h`` for Clang.
270
271.. option:: -gen-arm-neon-sema
272
273  Generate ARM NEON sema support for Clang.
274
275.. option:: -gen-arm-neon-test
276
277  Generate ARM NEON tests for Clang.
278
279.. option:: -gen-arm-sve-header
280
281  Generate ``arm_sve.h`` for Clang.
282
283.. option:: -gen-arm-sve-builtins
284
285  Generate ``arm_sve_builtins.inc`` for Clang.
286
287.. option:: -gen-arm-sve-builtin-codegen
288
289  Generate ``arm_sve_builtin_cg_map.inc`` for Clang.
290
291.. option:: -gen-arm-sve-typeflags
292
293  Generate ``arm_sve_typeflags.inc`` for Clang.
294
295.. option:: -gen-arm-sve-sema-rangechecks
296
297  Generate ``arm_sve_sema_rangechecks.inc`` for Clang.
298
299.. option:: -gen-arm-mve-header
300
301  Generate ``arm_mve.h`` for Clang.
302
303.. option:: -gen-arm-mve-builtin-def
304
305  Generate ARM MVE builtin definitions for Clang.
306
307.. option:: -gen-arm-mve-builtin-sema
308
309  Generate ARM MVE builtin sema checks for Clang.
310
311.. option:: -gen-arm-mve-builtin-codegen
312
313  Generate ARM MVE builtin code-generator for Clang.
314
315.. option:: -gen-arm-mve-builtin-aliases
316
317  Generate list of valid ARM MVE builtin aliases for Clang.
318
319.. option:: -gen-arm-cde-header
320
321  Generate ``arm_cde.h`` for Clang.
322
323.. option:: -gen-arm-cde-builtin-def
324
325  Generate ARM CDE builtin definitions for Clang.
326
327.. option:: -gen-arm-cde-builtin-sema
328
329  Generate ARM CDE builtin sema checks for Clang.
330
331.. option:: -gen-arm-cde-builtin-codegen
332
333  Generate ARM CDE builtin code-generator for Clang.
334
335.. option:: -gen-arm-cde-builtin-aliases
336
337  Generate list of valid ARM CDE builtin aliases for Clang.
338
339.. option:: -gen-riscv-vector-header
340
341  Generate ``riscv_vector.h`` for Clang.
342
343.. option:: -gen-riscv-vector-builtins
344
345  Generate ``riscv_vector_builtins.inc`` for Clang.
346
347.. option:: -gen-riscv-vector-builtin-codegen
348
349  Generate ``riscv_vector_builtin_cg.inc`` for Clang.
350
351.. option:: -gen-attr-docs
352
353  Generate attribute documentation.
354
355.. option:: -gen-diag-docs
356
357  Generate diagnostic documentation.
358
359.. option:: -gen-opt-docs
360
361  Generate option documentation.
362
363.. option:: -gen-clang-data-collectors
364
365  Generate data collectors for AST nodes.
366
367.. option:: -gen-clang-test-pragma-attribute-supported-attributes
368
369  Generate a list of attributes supported by ``#pragma`` Clang attribute for
370  testing purposes.
371
372
373lldb-tblgen Options
374~~~~~~~~~~~~~~~~~~~
375
376.. option:: gen-lldb-option-defs
377
378  Generate lldb OptionDefinition values.
379
380.. option:: gen-lldb-property-defs
381
382  Generate lldb PropertyDefinition values.
383
384.. option:: gen-lldb-property-enum-defs
385
386  Generate lldb PropertyDefinition enum values.
387
388
389llvm-tblgen Options
390~~~~~~~~~~~~~~~~~~~
391
392.. option:: -gen-asm-matcher
393
394 Generate assembly instruction matcher.
395
396.. option:: -match-prefix=prefix
397
398  Make -gen-asm-matcher match only instructions with the given *prefix*.
399
400.. option:: -gen-asm-parser
401
402 Generate assembly instruction parser.
403
404.. option:: -asmparsernum=n
405
406 Make -gen-asm-parser emit assembly parser number *n*.
407
408.. option:: -gen-asm-writer
409
410 Generate assembly writer.
411
412.. option:: -asmwriternum=n
413
414 Make -gen-asm-writer emit assembly writer number *n*.
415
416.. option:: -gen-attrs
417
418  Generate attributes.
419
420.. option:: -gen-automata
421
422  Generate generic automata.
423
424.. option:: -gen-callingconv
425
426  Generate calling convention descriptions.
427
428.. option:: -gen-compress-inst-emitter
429
430  Generate RISC-V compressed instructions.
431
432.. option:: -gen-ctags
433
434  Generate ctags-compatible index.
435
436.. option:: -gen-dag-isel
437
438 Generate a DAG (directed acyclic graph) instruction selector.
439
440.. option:: -instrument-coverage
441
442  Make -gen-dag-isel generate tables to help identify the patterns matched.
443
444.. option:: -omit-comments
445
446  Make -gen-dag-isel omit comments. The default is false.
447
448.. option:: -gen-dfa-packetizer
449
450 Generate DFA Packetizer for VLIW targets.
451
452.. option:: -gen-directive-decl
453
454  Generate directive related declaration code (header file).
455
456.. option:: -gen-directive-gen
457
458  Generate directive related implementation code part.
459
460.. option:: -gen-directive-impl
461
462  Generate directive related implementation code.
463
464.. option:: -gen-disassembler
465
466  Generate disassembler.
467
468.. option:: -gen-emitter
469
470 Generate machine code emitter.
471
472.. option:: -gen-exegesis
473
474  Generate llvm-exegesis tables.
475
476.. option:: -gen-fast-isel
477
478  Generate a "fast" instruction selector.
479
480.. option:: -gen-global-isel
481
482  Generate GlobalISel selector.
483
484.. option:: -gisel-coverage-file=filename
485
486  Specify the file from which to retrieve coverage information.
487
488.. option:: -instrument-gisel-coverage
489
490  Make -gen-global-isel generate coverage instrumentation.
491
492.. option:: -optimize-match-table
493
494  Make -gen-global-isel generate an optimized version of the match table.
495
496.. option:: -warn-on-skipped-patterns
497
498  Make -gen-global-isel explain why a pattern was skipped for inclusion.
499
500.. option:: -gen-global-isel-combiner
501
502  Generate GlobalISel combiner.
503
504.. option:: -combiners=list
505
506  Make -gen-global-isel-combiner emit the specified combiners.
507
508.. option:: -gicombiner-show-expansions
509
510  Make -gen-global-isel-combiner use C++ comments to indicate occurrences
511  of code expansion.
512
513.. option:: -gicombiner-stop-after-build
514
515  Make -gen-global-isel-combiner stop processing after building the match tree.
516
517.. option:: -gicombiner-stop-after-parse
518
519  Make -gen-global-isel-combiner stop processing after parsing rules
520  and dump state.
521
522.. option:: -gen-instr-info
523
524 Generate instruction descriptions.
525
526.. option:: -gen-instr-docs
527
528 Generate instruction documentation.
529
530.. option:: -gen-intrinsic-enums
531
532 Generate intrinsic enums.
533
534.. option:: -intrinsic-prefix=prefix
535
536  Make -gen-intrinsic-enums generate intrinsics with this target *prefix*.
537
538.. option:: -gen-intrinsic-impl
539
540 Generate intrinsic information.
541
542.. option:: -gen-opt-parser-defs
543
544  Generate options definitions.
545
546.. option:: -gen-opt-rst
547
548  Generate option RST.
549
550.. option:: -gen-pseudo-lowering
551
552 Generate pseudo instruction lowering.
553
554.. option:: -gen-register-bank
555
556  Generate register bank descriptions.
557
558.. option:: -gen-register-info
559
560  Generate registers and register classes info.
561
562.. option:: -register-info-debug
563
564  Make -gen-register-info dump register information for debugging.
565
566.. option:: -gen-searchable-tables
567
568  Generate generic searchable tables. See :doc:`TableGen BackEnds <../TableGen/BackEnds>`
569  for a detailed description.
570
571.. option:: -gen-subtarget
572
573 Generate subtarget enumerations.
574
575.. option:: -gen-x86-EVEX2VEX-tables
576
577  Generate X86 EVEX to VEX compress tables.
578
579.. option:: -gen-x86-fold-tables
580
581  Generate X86 fold tables.
582
583.. option:: -long-string-literals
584
585  When emitting large string tables, prefer string literals over
586  comma-separated char literals. This can be a readability and
587  compile-time performance win, but upsets some compilers.
588
589.. option:: -print-enums
590
591 Print enumeration values for a class.
592
593.. option:: -class=classname
594
595 Make -print-enums print the enumeration list for the specified class.
596
597.. option:: -print-sets
598
599 Print expanded sets for testing DAG exprs.
600
601
602mlir-tblgen Options
603~~~~~~~~~~~~~~~~~~~
604
605.. option:: -gen-avail-interface-decls
606
607  Generate availability interface declarations.
608
609.. option:: -gen-avail-interface-defs
610
611  Generate op interface definitions.
612
613.. option:: -gen-dialect-doc
614
615  Generate dialect documentation.
616
617.. option:: -dialect
618
619  The dialect to generate.
620
621.. option:: -gen-directive-decl
622
623  Generate declarations for directives (OpenMP, etc.).
624
625.. option:: -gen-enum-decls
626
627  Generate enum utility declarations.
628
629.. option:: -gen-enum-defs
630
631  Generate enum utility definitions.
632
633.. option:: -gen-enum-from-llvmir-conversions
634
635  Generate conversions of EnumAttrs from LLVM IR.
636
637.. option:: -gen-enum-to-llvmir-conversions
638
639  Generate conversions of EnumAttrs to LLVM IR.
640
641.. option:: -gen-llvmir-conversions
642
643  Generate LLVM IR conversions.
644
645.. option:: -gen-llvmir-intrinsics
646
647  Generate LLVM IR intrinsics.
648
649.. option:: -llvmir-intrinsics-filter
650
651  Only keep the intrinsics with the specified substring in their record name.
652
653.. option:: -dialect-opclass-base
654
655  The base class for the ops in the dialect we are to emit.
656
657.. option:: -gen-op-decls
658
659  Generate operation declarations.
660
661.. option:: -gen-op-defs
662
663  Generate operation definitions.
664
665.. option:: -asmformat-error-is-fatal
666
667  Emit a fatal error if format parsing fails.
668
669.. option:: -op-exclude-regex
670
671  Regular expression of name of ops to exclude (no filter if empty).
672
673.. option:: -op-include-regex
674
675  Regular expression of name of ops to include (no filter if empty).
676
677.. option:: -gen-op-doc
678
679  Generate operation documentation.
680
681.. option:: -gen-pass-decls
682
683  Generate operation documentation.
684
685.. option:: -name namestring
686
687  The name of this group of passes.
688
689.. option:: -gen-pass-doc
690
691  Generate pass documentation.
692
693.. option:: -gen-rewriters
694
695  Generate pattern rewriters.
696
697.. option:: -gen-spirv-avail-impls
698
699  Generate SPIR-V operation utility definitions.
700
701.. option:: -gen-spirv-capability-implication
702
703  Generate utility function to return implied capabilities for a given capability.
704
705.. option:: -gen-spirv-enum-avail-decls
706
707  Generate SPIR-V enum availability declarations.
708
709.. option:: -gen-spirv-enum-avail-defs
710
711  Generate SPIR-V enum availability definitions.
712
713.. option:: -gen-spirv-op-utils
714
715  Generate SPIR-V operation utility definitions.
716
717.. option:: -gen-spirv-serialization
718
719  Generate SPIR-V (de)serialization utilities and functions.
720
721.. option:: -gen-struct-attr-decls
722
723  Generate struct utility declarations.
724
725.. option:: -gen-struct-attr-defs
726
727  Generate struct utility definitions.
728
729.. option:: -gen-typedef-decls
730
731  Generate TypeDef declarations.
732
733.. option:: -gen-typedef-defs
734
735  Generate TypeDef definitions.
736
737.. option:: -typedefs-dialect name
738
739  Generate types for this dialect.
740
741EXIT STATUS
742-----------
743
744If :program:`*-tblgen` succeeds, it will exit with 0.  Otherwise, if an error
745occurs, it will exit with a non-zero value.
746