2012-05-09 00:50:35 +08:00
|
|
|
tblgen - Target Description To C++ Code Generator
|
|
|
|
=================================================
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
:program:`tblgen` [*options*] [*filename*]
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
:program:`tblgen` translates from target description (``.td``) files into C++
|
|
|
|
code that can be included in the definition of an LLVM target library. Most
|
|
|
|
users of LLVM will not need to use this program. It is only for assisting with
|
|
|
|
writing an LLVM target backend.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
The input and output of :program:`tblgen` is beyond the scope of this short
|
2014-04-08 06:46:40 +08:00
|
|
|
introduction; please see the :doc:`introduction to TableGen
|
|
|
|
<../TableGen/index>`.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
The *filename* argument specifies the name of a Target Description (``.td``)
|
|
|
|
file to read as input.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-------
|
|
|
|
|
2013-04-28 00:34:24 +08:00
|
|
|
.. program:: tblgen
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -help
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Print a summary of command line options.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -o filename
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
Specify the output file name. If ``filename`` is ``-``, then
|
|
|
|
:program:`tblgen` sends its output to standard output.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -I directory
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
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.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -asmparsernum N
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
Make -gen-asm-parser emit assembly writer number ``N``.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -asmwriternum N
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
Make -gen-asm-writer emit assembly writer number ``N``.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -class className
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Print the enumeration list for this class.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -print-records
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Print all records to standard output (default).
|
|
|
|
|
[TableGen] Add a general-purpose JSON backend.
The aim of this backend is to output everything TableGen knows about
the record set, similarly to the default -print-records backend. But
where -print-records produces output in TableGen's input syntax
(convenient for humans to read), this backend produces it as
structured JSON data, which is convenient for loading into standard
scripting languages such as Python, in order to extract information
from the data set in an automated way.
The output data contains a JSON representation of the variable
definitions in output 'def' records, and a few pieces of metadata such
as which of those definitions are tagged with the 'field' prefix and
which defs are derived from which classes. It doesn't dump out
absolutely every piece of knowledge it _could_ produce, such as type
information and complicated arithmetic operator nodes in abstract
superclasses; the main aim is to allow consumers of this JSON dump to
essentially act as new backends, and backends don't generally need to
depend on that kind of data.
The new backend is implemented as an EmitJSON() function similar to
all of llvm-tblgen's other EmitFoo functions, except that it lives in
lib/TableGen instead of utils/TableGen on the basis that I'm expecting
to add it to clang-tblgen too in a future patch.
To test it, I've written a Python script that loads the JSON output
and tests properties of it based on comments in the .td source - more
or less like FileCheck, except that the CHECK: lines have Python
expressions after them instead of textual pattern matches.
Reviewers: nhaehnle
Reviewed By: nhaehnle
Subscribers: arichardson, labath, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D46054
llvm-svn: 336771
2018-07-11 16:40:19 +08:00
|
|
|
.. option:: -dump-json
|
|
|
|
|
|
|
|
Print a JSON representation of all records, suitable for further
|
|
|
|
automated processing.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -print-enums
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2013-04-28 00:34:24 +08:00
|
|
|
Print enumeration values for a class.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -print-sets
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Print expanded sets for testing DAG exprs.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-emitter
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate machine code emitter.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-register-info
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate registers and register classes info.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-instr-info
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate instruction descriptions.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-asm-writer
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate the assembly writer.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-disassembler
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate disassembler.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-pseudo-lowering
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate pseudo instruction lowering.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-dag-isel
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate a DAG (Directed Acycle Graph) instruction selector.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-asm-matcher
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate assembly instruction matcher.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-dfa-packetizer
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate DFA Packetizer for VLIW targets.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-fast-isel
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate a "fast" instruction selector.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-subtarget
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate subtarget enumerations.
|
|
|
|
|
2018-06-26 03:40:08 +08:00
|
|
|
.. option:: -gen-intrinsic-enums
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2018-06-26 03:40:08 +08:00
|
|
|
Generate intrinsic enums.
|
|
|
|
|
|
|
|
.. option:: -gen-intrinsic-impl
|
|
|
|
|
|
|
|
Generate intrinsic implementation.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-tgt-intrinsic
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate target intrinsic information.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -gen-enhanced-disassembly-info
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Generate enhanced disassembly info.
|
|
|
|
|
2018-10-25 15:44:01 +08:00
|
|
|
.. option:: -gen-exegesis
|
|
|
|
|
|
|
|
Generate llvm-exegesis tables.
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
.. option:: -version
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Show the version number of this program.
|
|
|
|
|
|
|
|
EXIT STATUS
|
|
|
|
-----------
|
|
|
|
|
2012-11-30 01:41:05 +08:00
|
|
|
If :program:`tblgen` succeeds, it will exit with 0. Otherwise, if an error
|
2012-05-09 00:50:35 +08:00
|
|
|
occurs, it will exit with a non-zero value.
|