TableGen Language Reference
===========================
-.. sectionauthor:: Sean Silva <silvas@purdue.edu>
-
.. contents::
:local:
.. warning::
This document is extremely rough. If you find something lacking, please
- fix it, file a documentation bug, or ask about it on llvmdev.
+ fix it, file a documentation bug, or ask about it on llvm-dev.
Introduction
============
in and of itself (i.e. how to understand a given construct in terms of how
it affects the final set of records represented by the TableGen file). If
you are unsure if this document is really what you are looking for, please
-read :doc:`/TableGenFundamentals` first.
+read the :doc:`introduction to TableGen <index>` first.
Notation
========
``+`` or ``-``, as opposed to having ``+`` and ``-`` be unary operators as
most languages do.
+Also note that :token:`BinInteger` creates a value of type ``bits<n>``
+(where ``n`` is the number of bits). This will implicitly convert to
+integers when needed.
+
TableGen has identifier-like tokens:
.. productionlist::
TokString: '"' <non-'"' characters and C-like escapes> '"'
TokCodeFragment: "[{" <shortest text not containing "}]"> "}]"
+:token:`TokCodeFragment` is essentially a multiline string literal
+delimited by ``[{`` and ``}]``.
+
.. note::
The current implementation accepts the following C-like escapes::
.. productionlist::
BangOperator: one of
:!eq !if !head !tail !con
- :!add !shl !sra !srl
- :!cast !empty !subst !foreach !strconcat
+ :!add !shl !sra !srl !and
+ :!cast !empty !subst !foreach !listconcat !strconcat
Syntax
======
.. productionlist::
SimpleValue: "(" `DagArg` `DagArgList` ")"
DagArgList: `DagArg` ("," `DagArg`)*
- DagArg: `Value` [":" `TokVarName`]
+ DagArg: `Value` [":" `TokVarName`] | `TokVarName`
The initial :token:`DagArg` is called the "operator" of the dag.
--------
.. productionlist::
- Defm: "defm" `TokIdentifier` ":" `BaseClassList` ";"
+ Defm: "defm" `TokIdentifier` ":" `BaseClassListNE` ";"
Note that in the :token:`BaseClassList`, all of the ``multiclass``'s must
precede any ``class``'s that appear.