Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > d635a8cd705396ade48f1d2b830a115d > files > 2074

libllvm-devel-8.0.0-1.1.mga7.i586.rpm



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>TableGen BackEnds &#8212; LLVM 8 documentation</title>
    <link rel="stylesheet" href="../_static/llvm-theme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="TableGen Language Reference" href="LangRef.html" />
    <link rel="prev" title="TableGen" href="index.html" />
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head><body>
<div class="logo">
  <a href="../index.html">
    <img src="../_static/logo.png"
         alt="LLVM Logo" width="250" height="88"/></a>
</div>

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="LangRef.html" title="TableGen Language Reference"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="TableGen"
             accesskey="P">previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="../index.html">Documentation</a>&raquo;</li>

          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">TableGen</a> &#187;</li> 
      </ul>
    </div>


    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <div class="section" id="tablegen-backends">
<h1>TableGen BackEnds<a class="headerlink" href="#tablegen-backends" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
<li><a class="reference internal" href="#llvm-backends" id="id2">LLVM BackEnds</a><ul>
<li><a class="reference internal" href="#codeemitter" id="id3">CodeEmitter</a></li>
<li><a class="reference internal" href="#registerinfo" id="id4">RegisterInfo</a></li>
<li><a class="reference internal" href="#instrinfo" id="id5">InstrInfo</a></li>
<li><a class="reference internal" href="#asmwriter" id="id6">AsmWriter</a></li>
<li><a class="reference internal" href="#asmmatcher" id="id7">AsmMatcher</a></li>
<li><a class="reference internal" href="#disassembler" id="id8">Disassembler</a></li>
<li><a class="reference internal" href="#pseudolowering" id="id9">PseudoLowering</a></li>
<li><a class="reference internal" href="#callingconv" id="id10">CallingConv</a></li>
<li><a class="reference internal" href="#dagisel" id="id11">DAGISel</a></li>
<li><a class="reference internal" href="#dfapacketizer" id="id12">DFAPacketizer</a></li>
<li><a class="reference internal" href="#fastisel" id="id13">FastISel</a></li>
<li><a class="reference internal" href="#subtarget" id="id14">Subtarget</a></li>
<li><a class="reference internal" href="#intrinsic" id="id15">Intrinsic</a></li>
<li><a class="reference internal" href="#optparserdefs" id="id16">OptParserDefs</a></li>
<li><a class="reference internal" href="#searchabletables" id="id17">SearchableTables</a></li>
<li><a class="reference internal" href="#ctags" id="id18">CTags</a></li>
<li><a class="reference internal" href="#x86evex2vex" id="id19">X86EVEX2VEX</a></li>
</ul>
</li>
<li><a class="reference internal" href="#clang-backends" id="id20">Clang BackEnds</a><ul>
<li><a class="reference internal" href="#clangattrclasses" id="id21">ClangAttrClasses</a></li>
<li><a class="reference internal" href="#clangattrparserstringswitches" id="id22">ClangAttrParserStringSwitches</a></li>
<li><a class="reference internal" href="#clangattrimpl" id="id23">ClangAttrImpl</a></li>
<li><a class="reference internal" href="#clangattrlist" id="id24">ClangAttrList</a></li>
<li><a class="reference internal" href="#clangattrpchread" id="id25">ClangAttrPCHRead</a></li>
<li><a class="reference internal" href="#clangattrpchwrite" id="id26">ClangAttrPCHWrite</a></li>
<li><a class="reference internal" href="#clangattrspellings" id="id27">ClangAttrSpellings</a></li>
<li><a class="reference internal" href="#clangattrspellinglistindex" id="id28">ClangAttrSpellingListIndex</a></li>
<li><a class="reference internal" href="#clangattrvisitor" id="id29">ClangAttrVisitor</a></li>
<li><a class="reference internal" href="#clangattrtemplateinstantiate" id="id30">ClangAttrTemplateInstantiate</a></li>
<li><a class="reference internal" href="#clangattrparsedattrlist" id="id31">ClangAttrParsedAttrList</a></li>
<li><a class="reference internal" href="#clangattrparsedattrimpl" id="id32">ClangAttrParsedAttrImpl</a></li>
<li><a class="reference internal" href="#clangattrparsedattrkinds" id="id33">ClangAttrParsedAttrKinds</a></li>
<li><a class="reference internal" href="#clangattrdump" id="id34">ClangAttrDump</a></li>
<li><a class="reference internal" href="#clangdiagsdefs" id="id35">ClangDiagsDefs</a></li>
<li><a class="reference internal" href="#clangdiaggroups" id="id36">ClangDiagGroups</a></li>
<li><a class="reference internal" href="#clangdiagsindexname" id="id37">ClangDiagsIndexName</a></li>
<li><a class="reference internal" href="#clangcommentnodes" id="id38">ClangCommentNodes</a></li>
<li><a class="reference internal" href="#clangdeclnodes" id="id39">ClangDeclNodes</a></li>
<li><a class="reference internal" href="#clangstmtnodes" id="id40">ClangStmtNodes</a></li>
<li><a class="reference internal" href="#clangsacheckers" id="id41">ClangSACheckers</a></li>
<li><a class="reference internal" href="#clangcommenthtmltags" id="id42">ClangCommentHTMLTags</a></li>
<li><a class="reference internal" href="#clangcommenthtmltagsproperties" id="id43">ClangCommentHTMLTagsProperties</a></li>
<li><a class="reference internal" href="#clangcommenthtmlnamedcharacterreferences" id="id44">ClangCommentHTMLNamedCharacterReferences</a></li>
<li><a class="reference internal" href="#clangcommentcommandinfo" id="id45">ClangCommentCommandInfo</a></li>
<li><a class="reference internal" href="#clangcommentcommandlist" id="id46">ClangCommentCommandList</a></li>
<li><a class="reference internal" href="#armneon" id="id47">ArmNeon</a></li>
<li><a class="reference internal" href="#armneonsema" id="id48">ArmNeonSema</a></li>
<li><a class="reference internal" href="#armneontest" id="id49">ArmNeonTest</a></li>
<li><a class="reference internal" href="#attrdocs" id="id50">AttrDocs</a></li>
</ul>
</li>
<li><a class="reference internal" href="#general-backends" id="id51">General BackEnds</a><ul>
<li><a class="reference internal" href="#json" id="id52">JSON</a></li>
</ul>
</li>
<li><a class="reference internal" href="#how-to-write-a-back-end" id="id53">How to write a back-end</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#id1">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>TableGen backends are at the core of TableGen’s functionality. The source files
provide the semantics to a generated (in memory) structure, but it’s up to the
backend to print this out in a way that is meaningful to the user (normally a
C program including a file or a textual list of warnings, options and error
messages).</p>
<p>TableGen is used by both LLVM and Clang with very different goals. LLVM uses it
as a way to automate the generation of massive amounts of information regarding
instructions, schedules, cores and architecture features. Some backends generate
output that is consumed by more than one source file, so they need to be created
in a way that is easy to use pre-processor tricks. Some backends can also print
C code structures, so that they can be directly included as-is.</p>
<p>Clang, on the other hand, uses it mainly for diagnostic messages (errors,
warnings, tips) and attributes, so more on the textual end of the scale.</p>
</div>
<div class="section" id="llvm-backends">
<h2><a class="toc-backref" href="#id2">LLVM BackEnds</a><a class="headerlink" href="#llvm-backends" title="Permalink to this headline">¶</a></h2>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This document is raw. Each section below needs three sub-sections: description
of its purpose with a list of users, output generated from generic input, and
finally why it needed a new backend (in case there’s something similar).</p>
</div>
<p>Overall, each backend will take the same TableGen file type and transform into
similar output for different targets/uses. There is an implicit contract between
the TableGen files, the back-ends and their users.</p>
<p>For instance, a global contract is that each back-end produces macro-guarded
sections. Based on whether the file is included by a header or a source file,
or even in which context of each file the include is being used, you have
todefine a macro just before including it, to get the right output:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="cp">#define GET_REGINFO_TARGET_DESC</span>
<span class="cp">#include</span> <span class="cpf">&quot;ARMGenRegisterInfo.inc&quot;</span><span class="cp"></span>
</pre></div>
</div>
<p>And just part of the generated file would be included. This is useful if
you need the same information in multiple formats (instantiation, initialization,
getter/setter functions, etc) from the same source TableGen file without having
to re-compile the TableGen file multiple times.</p>
<p>Sometimes, multiple macros might be defined before the same include file to
output multiple blocks:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="cp">#define GET_REGISTER_MATCHER</span>
<span class="cp">#define GET_SUBTARGET_FEATURE_NAME</span>
<span class="cp">#define GET_MATCHER_IMPLEMENTATION</span>
<span class="cp">#include</span> <span class="cpf">&quot;ARMGenAsmMatcher.inc&quot;</span><span class="cp"></span>
</pre></div>
</div>
<p>The macros will be undef’d automatically as they’re used, in the include file.</p>
<p>On all LLVM back-ends, the <code class="docutils literal notranslate"><span class="pre">llvm-tblgen</span></code> binary will be executed on the root
TableGen file <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;.td</span></code>, which should include all others. This guarantees
that all information needed is accessible, and that no duplication is needed
in the TableGen files.</p>
<div class="section" id="codeemitter">
<h3><a class="toc-backref" href="#id3">CodeEmitter</a><a class="headerlink" href="#codeemitter" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: CodeEmitterGen uses the descriptions of instructions and their fields to
construct an automated code emitter: a function that, given a MachineInstr,
returns the (currently, 32-bit unsigned) value of the instruction.</p>
<p><strong>Output</strong>: C++ code, implementing the target’s CodeEmitter
class by overriding the virtual functions as <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;CodeEmitter::function()</span></code>.</p>
<p><strong>Usage</strong>: Used to include directly at the end of <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;MCCodeEmitter.cpp</span></code>.</p>
</div>
<div class="section" id="registerinfo">
<h3><a class="toc-backref" href="#id4">RegisterInfo</a><a class="headerlink" href="#registerinfo" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: This tablegen backend is responsible for emitting a description of a target
register file for a code generator.  It uses instances of the Register,
RegisterAliases, and RegisterClass classes to gather this information.</p>
<p><strong>Output</strong>: C++ code with enums and structures representing the register mappings,
properties, masks, etc.</p>
<p><strong>Usage</strong>: Both on <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;BaseRegisterInfo</span></code> and <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;MCTargetDesc</span></code> (headers
and source files) with macros defining in which they are for declaration vs.
initialization issues.</p>
</div>
<div class="section" id="instrinfo">
<h3><a class="toc-backref" href="#id5">InstrInfo</a><a class="headerlink" href="#instrinfo" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: This tablegen backend is responsible for emitting a description of the target
instruction set for the code generator. (what are the differences from CodeEmitter?)</p>
<p><strong>Output</strong>: C++ code with enums and structures representing the instruction mappings,
properties, masks, etc.</p>
<p><strong>Usage</strong>: Both on <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;BaseInstrInfo</span></code> and <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;MCTargetDesc</span></code> (headers
and source files) with macros defining in which they are for declaration vs.
initialization issues.</p>
</div>
<div class="section" id="asmwriter">
<h3><a class="toc-backref" href="#id6">AsmWriter</a><a class="headerlink" href="#asmwriter" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Emits an assembly printer for the current target.</p>
<p><strong>Output</strong>: Implementation of <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;InstPrinter::printInstruction()</span></code>, among
other things.</p>
<p><strong>Usage</strong>: Included directly into <code class="docutils literal notranslate"><span class="pre">InstPrinter/&lt;Target&gt;InstPrinter.cpp</span></code>.</p>
</div>
<div class="section" id="asmmatcher">
<h3><a class="toc-backref" href="#id7">AsmMatcher</a><a class="headerlink" href="#asmmatcher" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Emits a target specifier matcher for
converting parsed assembly operands in the MCInst structures. It also
emits a matcher for custom operand parsing. Extensive documentation is
written on the <code class="docutils literal notranslate"><span class="pre">AsmMatcherEmitter.cpp</span></code> file.</p>
<p><strong>Output</strong>: Assembler parsers’ matcher functions, declarations, etc.</p>
<p><strong>Usage</strong>: Used in back-ends’ <code class="docutils literal notranslate"><span class="pre">AsmParser/&lt;Target&gt;AsmParser.cpp</span></code> for
building the AsmParser class.</p>
</div>
<div class="section" id="disassembler">
<h3><a class="toc-backref" href="#id8">Disassembler</a><a class="headerlink" href="#disassembler" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Contains disassembler table emitters for various
architectures. Extensive documentation is written on the
<code class="docutils literal notranslate"><span class="pre">DisassemblerEmitter.cpp</span></code> file.</p>
<p><strong>Output</strong>: Decoding tables, static decoding functions, etc.</p>
<p><strong>Usage</strong>: Directly included in <code class="docutils literal notranslate"><span class="pre">Disassembler/&lt;Target&gt;Disassembler.cpp</span></code>
to cater for all default decodings, after all hand-made ones.</p>
</div>
<div class="section" id="pseudolowering">
<h3><a class="toc-backref" href="#id9">PseudoLowering</a><a class="headerlink" href="#pseudolowering" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Generate pseudo instruction lowering.</p>
<p><strong>Output</strong>: Implements <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;AsmPrinter::emitPseudoExpansionLowering()</span></code>.</p>
<p><strong>Usage</strong>: Included directly into <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;AsmPrinter.cpp</span></code>.</p>
</div>
<div class="section" id="callingconv">
<h3><a class="toc-backref" href="#id10">CallingConv</a><a class="headerlink" href="#callingconv" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Responsible for emitting descriptions of the calling
conventions supported by this target.</p>
<p><strong>Output</strong>: Implement static functions to deal with calling conventions
chained by matching styles, returning false on no match.</p>
<p><strong>Usage</strong>: Used in ISelLowering and FastIsel as function pointers to
implementation returned by a CC selection function.</p>
</div>
<div class="section" id="dagisel">
<h3><a class="toc-backref" href="#id11">DAGISel</a><a class="headerlink" href="#dagisel" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Generate a DAG instruction selector.</p>
<p><strong>Output</strong>: Creates huge functions for automating DAG selection.</p>
<p><strong>Usage</strong>: Included in <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;ISelDAGToDAG.cpp</span></code> inside the target’s
implementation of <code class="docutils literal notranslate"><span class="pre">SelectionDAGISel</span></code>.</p>
</div>
<div class="section" id="dfapacketizer">
<h3><a class="toc-backref" href="#id12">DFAPacketizer</a><a class="headerlink" href="#dfapacketizer" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: This class parses the Schedule.td file and produces an API that
can be used to reason about whether an instruction can be added to a packet
on a VLIW architecture. The class internally generates a deterministic finite
automaton (DFA) that models all possible mappings of machine instructions
to functional units as instructions are added to a packet.</p>
<p><strong>Output</strong>: Scheduling tables for GPU back-ends (Hexagon, AMD).</p>
<p><strong>Usage</strong>: Included directly on <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;InstrInfo.cpp</span></code>.</p>
</div>
<div class="section" id="fastisel">
<h3><a class="toc-backref" href="#id13">FastISel</a><a class="headerlink" href="#fastisel" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: This tablegen backend emits code for use by the “fast”
instruction selection algorithm. See the comments at the top of
lib/CodeGen/SelectionDAG/FastISel.cpp for background. This file
scans through the target’s tablegen instruction-info files
and extracts instructions with obvious-looking patterns, and it emits
code to look up these instructions by type and operator.</p>
<p><strong>Output</strong>: Generates <code class="docutils literal notranslate"><span class="pre">Predicate</span></code> and <code class="docutils literal notranslate"><span class="pre">FastEmit</span></code> methods.</p>
<p><strong>Usage</strong>: Implements private methods of the targets’ implementation
of <code class="docutils literal notranslate"><span class="pre">FastISel</span></code> class.</p>
</div>
<div class="section" id="subtarget">
<h3><a class="toc-backref" href="#id14">Subtarget</a><a class="headerlink" href="#subtarget" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Generate subtarget enumerations.</p>
<p><strong>Output</strong>: Enums, globals, local tables for sub-target information.</p>
<p><strong>Usage</strong>: Populates <code class="docutils literal notranslate"><span class="pre">&lt;Target&gt;Subtarget</span></code> and
<code class="docutils literal notranslate"><span class="pre">MCTargetDesc/&lt;Target&gt;MCTargetDesc</span></code> files (both headers and source).</p>
</div>
<div class="section" id="intrinsic">
<h3><a class="toc-backref" href="#id15">Intrinsic</a><a class="headerlink" href="#intrinsic" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Generate (target) intrinsic information.</p>
</div>
<div class="section" id="optparserdefs">
<h3><a class="toc-backref" href="#id16">OptParserDefs</a><a class="headerlink" href="#optparserdefs" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Print enum values for a class.</p>
</div>
<div class="section" id="searchabletables">
<h3><a class="toc-backref" href="#id17">SearchableTables</a><a class="headerlink" href="#searchabletables" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Generate custom searchable tables.</p>
<p><strong>Output</strong>: Enums, global tables and lookup helper functions.</p>
<p><strong>Usage</strong>: This backend allows generating free-form, target-specific tables
from TableGen records. The ARM and AArch64 targets use this backend to generate
tables of system registers; the AMDGPU target uses it to generate meta-data
about complex image and memory buffer instructions.</p>
<p>More documentation is available in <code class="docutils literal notranslate"><span class="pre">include/llvm/TableGen/SearchableTable.td</span></code>,
which also contains the definitions of TableGen classes which must be
instantiated in order to define the enums and tables emitted by this backend.</p>
</div>
<div class="section" id="ctags">
<h3><a class="toc-backref" href="#id18">CTags</a><a class="headerlink" href="#ctags" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: This tablegen backend emits an index of definitions in ctags(1)
format. A helper script, utils/TableGen/tdtags, provides an easier-to-use
interface; run ‘tdtags -H’ for documentation.</p>
</div>
<div class="section" id="x86evex2vex">
<h3><a class="toc-backref" href="#id19">X86EVEX2VEX</a><a class="headerlink" href="#x86evex2vex" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: This X86 specific tablegen backend emits tables that map EVEX
encoded instructions to their VEX encoded identical instruction.</p>
</div>
</div>
<div class="section" id="clang-backends">
<h2><a class="toc-backref" href="#id20">Clang BackEnds</a><a class="headerlink" href="#clang-backends" title="Permalink to this headline">¶</a></h2>
<div class="section" id="clangattrclasses">
<h3><a class="toc-backref" href="#id21">ClangAttrClasses</a><a class="headerlink" href="#clangattrclasses" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates Attrs.inc, which contains semantic attribute class
declarations for any attribute in <code class="docutils literal notranslate"><span class="pre">Attr.td</span></code> that has not set <code class="docutils literal notranslate"><span class="pre">ASTNode</span> <span class="pre">=</span> <span class="pre">0</span></code>.
This file is included as part of <code class="docutils literal notranslate"><span class="pre">Attr.h</span></code>.</p>
</div>
<div class="section" id="clangattrparserstringswitches">
<h3><a class="toc-backref" href="#id22">ClangAttrParserStringSwitches</a><a class="headerlink" href="#clangattrparserstringswitches" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrParserStringSwitches.inc, which contains
StringSwitch::Case statements for parser-related string switches. Each switch
is given its own macro (such as <code class="docutils literal notranslate"><span class="pre">CLANG_ATTR_ARG_CONTEXT_LIST</span></code>, or
<code class="docutils literal notranslate"><span class="pre">CLANG_ATTR_IDENTIFIER_ARG_LIST</span></code>), which is expected to be defined before
including AttrParserStringSwitches.inc, and undefined after.</p>
</div>
<div class="section" id="clangattrimpl">
<h3><a class="toc-backref" href="#id23">ClangAttrImpl</a><a class="headerlink" href="#clangattrimpl" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrImpl.inc, which contains semantic attribute class
definitions for any attribute in <code class="docutils literal notranslate"><span class="pre">Attr.td</span></code> that has not set <code class="docutils literal notranslate"><span class="pre">ASTNode</span> <span class="pre">=</span> <span class="pre">0</span></code>.
This file is included as part of <code class="docutils literal notranslate"><span class="pre">AttrImpl.cpp</span></code>.</p>
</div>
<div class="section" id="clangattrlist">
<h3><a class="toc-backref" href="#id24">ClangAttrList</a><a class="headerlink" href="#clangattrlist" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrList.inc, which is used when a list of semantic
attribute identifiers is required. For instance, <code class="docutils literal notranslate"><span class="pre">AttrKinds.h</span></code> includes this
file to generate the list of <code class="docutils literal notranslate"><span class="pre">attr::Kind</span></code> enumeration values. This list is
separated out into multiple categories: attributes, inheritable attributes, and
inheritable parameter attributes. This categorization happens automatically
based on information in <code class="docutils literal notranslate"><span class="pre">Attr.td</span></code> and is used to implement the <code class="docutils literal notranslate"><span class="pre">classof</span></code>
functionality required for <code class="docutils literal notranslate"><span class="pre">dyn_cast</span></code> and similar APIs.</p>
</div>
<div class="section" id="clangattrpchread">
<h3><a class="toc-backref" href="#id25">ClangAttrPCHRead</a><a class="headerlink" href="#clangattrpchread" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrPCHRead.inc, which is used to deserialize attributes
in the <code class="docutils literal notranslate"><span class="pre">ASTReader::ReadAttributes</span></code> function.</p>
</div>
<div class="section" id="clangattrpchwrite">
<h3><a class="toc-backref" href="#id26">ClangAttrPCHWrite</a><a class="headerlink" href="#clangattrpchwrite" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrPCHWrite.inc, which is used to serialize attributes in
the <code class="docutils literal notranslate"><span class="pre">ASTWriter::WriteAttributes</span></code> function.</p>
</div>
<div class="section" id="clangattrspellings">
<h3><a class="toc-backref" href="#id27">ClangAttrSpellings</a><a class="headerlink" href="#clangattrspellings" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrSpellings.inc, which is used to implement the
<code class="docutils literal notranslate"><span class="pre">__has_attribute</span></code> feature test macro.</p>
</div>
<div class="section" id="clangattrspellinglistindex">
<h3><a class="toc-backref" href="#id28">ClangAttrSpellingListIndex</a><a class="headerlink" href="#clangattrspellinglistindex" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrSpellingListIndex.inc, which is used to map parsed
attribute spellings (including which syntax or scope was used) to an attribute
spelling list index. These spelling list index values are internal
implementation details exposed via
<code class="docutils literal notranslate"><span class="pre">AttributeList::getAttributeSpellingListIndex</span></code>.</p>
</div>
<div class="section" id="clangattrvisitor">
<h3><a class="toc-backref" href="#id29">ClangAttrVisitor</a><a class="headerlink" href="#clangattrvisitor" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrVisitor.inc, which is used when implementing
recursive AST visitors.</p>
</div>
<div class="section" id="clangattrtemplateinstantiate">
<h3><a class="toc-backref" href="#id30">ClangAttrTemplateInstantiate</a><a class="headerlink" href="#clangattrtemplateinstantiate" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrTemplateInstantiate.inc, which implements the
<code class="docutils literal notranslate"><span class="pre">instantiateTemplateAttribute</span></code> function, used when instantiating a template
that requires an attribute to be cloned.</p>
</div>
<div class="section" id="clangattrparsedattrlist">
<h3><a class="toc-backref" href="#id31">ClangAttrParsedAttrList</a><a class="headerlink" href="#clangattrparsedattrlist" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrParsedAttrList.inc, which is used to generate the
<code class="docutils literal notranslate"><span class="pre">AttributeList::Kind</span></code> parsed attribute enumeration.</p>
</div>
<div class="section" id="clangattrparsedattrimpl">
<h3><a class="toc-backref" href="#id32">ClangAttrParsedAttrImpl</a><a class="headerlink" href="#clangattrparsedattrimpl" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrParsedAttrImpl.inc, which is used by
<code class="docutils literal notranslate"><span class="pre">AttributeList.cpp</span></code> to implement several functions on the <code class="docutils literal notranslate"><span class="pre">AttributeList</span></code>
class. This functionality is implemented via the <code class="docutils literal notranslate"><span class="pre">AttrInfoMap</span> <span class="pre">ParsedAttrInfo</span></code>
array, which contains one element per parsed attribute object.</p>
</div>
<div class="section" id="clangattrparsedattrkinds">
<h3><a class="toc-backref" href="#id33">ClangAttrParsedAttrKinds</a><a class="headerlink" href="#clangattrparsedattrkinds" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrParsedAttrKinds.inc, which is used to implement the
<code class="docutils literal notranslate"><span class="pre">AttributeList::getKind</span></code> function, mapping a string (and syntax) to a parsed
attribute <code class="docutils literal notranslate"><span class="pre">AttributeList::Kind</span></code> enumeration.</p>
</div>
<div class="section" id="clangattrdump">
<h3><a class="toc-backref" href="#id34">ClangAttrDump</a><a class="headerlink" href="#clangattrdump" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates AttrDump.inc, which dumps information about an attribute.
It is used to implement <code class="docutils literal notranslate"><span class="pre">ASTDumper::dumpAttr</span></code>.</p>
</div>
<div class="section" id="clangdiagsdefs">
<h3><a class="toc-backref" href="#id35">ClangDiagsDefs</a><a class="headerlink" href="#clangdiagsdefs" title="Permalink to this headline">¶</a></h3>
<p>Generate Clang diagnostics definitions.</p>
</div>
<div class="section" id="clangdiaggroups">
<h3><a class="toc-backref" href="#id36">ClangDiagGroups</a><a class="headerlink" href="#clangdiaggroups" title="Permalink to this headline">¶</a></h3>
<p>Generate Clang diagnostic groups.</p>
</div>
<div class="section" id="clangdiagsindexname">
<h3><a class="toc-backref" href="#id37">ClangDiagsIndexName</a><a class="headerlink" href="#clangdiagsindexname" title="Permalink to this headline">¶</a></h3>
<p>Generate Clang diagnostic name index.</p>
</div>
<div class="section" id="clangcommentnodes">
<h3><a class="toc-backref" href="#id38">ClangCommentNodes</a><a class="headerlink" href="#clangcommentnodes" title="Permalink to this headline">¶</a></h3>
<p>Generate Clang AST comment nodes.</p>
</div>
<div class="section" id="clangdeclnodes">
<h3><a class="toc-backref" href="#id39">ClangDeclNodes</a><a class="headerlink" href="#clangdeclnodes" title="Permalink to this headline">¶</a></h3>
<p>Generate Clang AST declaration nodes.</p>
</div>
<div class="section" id="clangstmtnodes">
<h3><a class="toc-backref" href="#id40">ClangStmtNodes</a><a class="headerlink" href="#clangstmtnodes" title="Permalink to this headline">¶</a></h3>
<p>Generate Clang AST statement nodes.</p>
</div>
<div class="section" id="clangsacheckers">
<h3><a class="toc-backref" href="#id41">ClangSACheckers</a><a class="headerlink" href="#clangsacheckers" title="Permalink to this headline">¶</a></h3>
<p>Generate Clang Static Analyzer checkers.</p>
</div>
<div class="section" id="clangcommenthtmltags">
<h3><a class="toc-backref" href="#id42">ClangCommentHTMLTags</a><a class="headerlink" href="#clangcommenthtmltags" title="Permalink to this headline">¶</a></h3>
<p>Generate efficient matchers for HTML tag names that are used in documentation comments.</p>
</div>
<div class="section" id="clangcommenthtmltagsproperties">
<h3><a class="toc-backref" href="#id43">ClangCommentHTMLTagsProperties</a><a class="headerlink" href="#clangcommenthtmltagsproperties" title="Permalink to this headline">¶</a></h3>
<p>Generate efficient matchers for HTML tag properties.</p>
</div>
<div class="section" id="clangcommenthtmlnamedcharacterreferences">
<h3><a class="toc-backref" href="#id44">ClangCommentHTMLNamedCharacterReferences</a><a class="headerlink" href="#clangcommenthtmlnamedcharacterreferences" title="Permalink to this headline">¶</a></h3>
<p>Generate function to translate named character references to UTF-8 sequences.</p>
</div>
<div class="section" id="clangcommentcommandinfo">
<h3><a class="toc-backref" href="#id45">ClangCommentCommandInfo</a><a class="headerlink" href="#clangcommentcommandinfo" title="Permalink to this headline">¶</a></h3>
<p>Generate command properties for commands that are used in documentation comments.</p>
</div>
<div class="section" id="clangcommentcommandlist">
<h3><a class="toc-backref" href="#id46">ClangCommentCommandList</a><a class="headerlink" href="#clangcommentcommandlist" title="Permalink to this headline">¶</a></h3>
<p>Generate list of commands that are used in documentation comments.</p>
</div>
<div class="section" id="armneon">
<h3><a class="toc-backref" href="#id47">ArmNeon</a><a class="headerlink" href="#armneon" title="Permalink to this headline">¶</a></h3>
<p>Generate arm_neon.h for clang.</p>
</div>
<div class="section" id="armneonsema">
<h3><a class="toc-backref" href="#id48">ArmNeonSema</a><a class="headerlink" href="#armneonsema" title="Permalink to this headline">¶</a></h3>
<p>Generate ARM NEON sema support for clang.</p>
</div>
<div class="section" id="armneontest">
<h3><a class="toc-backref" href="#id49">ArmNeonTest</a><a class="headerlink" href="#armneontest" title="Permalink to this headline">¶</a></h3>
<p>Generate ARM NEON tests for clang.</p>
</div>
<div class="section" id="attrdocs">
<h3><a class="toc-backref" href="#id50">AttrDocs</a><a class="headerlink" href="#attrdocs" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Creates <code class="docutils literal notranslate"><span class="pre">AttributeReference.rst</span></code> from <code class="docutils literal notranslate"><span class="pre">AttrDocs.td</span></code>, and is
used for documenting user-facing attributes.</p>
</div>
</div>
<div class="section" id="general-backends">
<h2><a class="toc-backref" href="#id51">General BackEnds</a><a class="headerlink" href="#general-backends" title="Permalink to this headline">¶</a></h2>
<div class="section" id="json">
<h3><a class="toc-backref" href="#id52">JSON</a><a class="headerlink" href="#json" title="Permalink to this headline">¶</a></h3>
<p><strong>Purpose</strong>: Output all the values in every <code class="docutils literal notranslate"><span class="pre">def</span></code>, as a JSON data
structure that can be easily parsed by a variety of languages. Useful
for writing custom backends without having to modify TableGen itself,
or for performing auxiliary analysis on the same TableGen data passed
to a built-in backend.</p>
<p><strong>Output</strong>:</p>
<p>The root of the output file is a JSON object (i.e. dictionary),
containing the following fixed keys:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">!tablegen_json_version</span></code>: a numeric version field that will
increase if an incompatible change is ever made to the structure of
this data. The format described here corresponds to version 1.</li>
<li><code class="docutils literal notranslate"><span class="pre">!instanceof</span></code>: a dictionary whose keys are the class names defined
in the TableGen input. For each key, the corresponding value is an
array of strings giving the names of <code class="docutils literal notranslate"><span class="pre">def</span></code> records that derive
from that class. So <code class="docutils literal notranslate"><span class="pre">root[&quot;!instanceof&quot;][&quot;Instruction&quot;]</span></code>, for
example, would list the names of all the records deriving from the
class <code class="docutils literal notranslate"><span class="pre">Instruction</span></code>.</li>
</ul>
<p>For each <code class="docutils literal notranslate"><span class="pre">def</span></code> record, the root object also has a key for the record
name. The corresponding value is a subsidiary object containing the
following fixed keys:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">!superclasses</span></code>: an array of strings giving the names of all the
classes that this record derives from.</li>
<li><code class="docutils literal notranslate"><span class="pre">!fields</span></code>: an array of strings giving the names of all the variables
in this record that were defined with the <code class="docutils literal notranslate"><span class="pre">field</span></code> keyword.</li>
<li><code class="docutils literal notranslate"><span class="pre">!name</span></code>: a string giving the name of the record. This is always
identical to the key in the JSON root object corresponding to this
record’s dictionary. (If the record is anonymous, the name is
arbitrary.)</li>
<li><code class="docutils literal notranslate"><span class="pre">!anonymous</span></code>: a boolean indicating whether the record’s name was
specified by the TableGen input (if it is <code class="docutils literal notranslate"><span class="pre">false</span></code>), or invented by
TableGen itself (if <code class="docutils literal notranslate"><span class="pre">true</span></code>).</li>
</ul>
<p>For each variable defined in a record, the <code class="docutils literal notranslate"><span class="pre">def</span></code> object for that
record also has a key for the variable name. The corresponding value
is a translation into JSON of the variable’s value, using the
conventions described below.</p>
<p>Some TableGen data types are translated directly into the
corresponding JSON type:</p>
<ul class="simple">
<li>A completely undefined value (e.g. for a variable declared without
initializer in some superclass of this record, and never initialized
by the record itself or any other superclass) is emitted as the JSON
<code class="docutils literal notranslate"><span class="pre">null</span></code> value.</li>
<li><code class="docutils literal notranslate"><span class="pre">int</span></code> and <code class="docutils literal notranslate"><span class="pre">bit</span></code> values are emitted as numbers. Note that
TableGen <code class="docutils literal notranslate"><span class="pre">int</span></code> values are capable of holding integers too large to
be exactly representable in IEEE double precision. The integer
literal in the JSON output will show the full exact integer value.
So if you need to retrieve large integers with full precision, you
should use a JSON reader capable of translating such literals back
into 64-bit integers without losing precision, such as Python’s
standard <code class="docutils literal notranslate"><span class="pre">json</span></code> module.</li>
<li><code class="docutils literal notranslate"><span class="pre">string</span></code> and <code class="docutils literal notranslate"><span class="pre">code</span></code> values are emitted as JSON strings.</li>
<li><code class="docutils literal notranslate"><span class="pre">list&lt;T&gt;</span></code> values, for any element type <code class="docutils literal notranslate"><span class="pre">T</span></code>, are emitted as JSON
arrays. Each element of the array is represented in turn using these
same conventions.</li>
<li><code class="docutils literal notranslate"><span class="pre">bits</span></code> values are also emitted as arrays. A <code class="docutils literal notranslate"><span class="pre">bits</span></code> array is
ordered from least-significant bit to most-significant. So the
element with index <code class="docutils literal notranslate"><span class="pre">i</span></code> corresponds to the bit described as
<code class="docutils literal notranslate"><span class="pre">x{i}</span></code> in TableGen source. However, note that this means that
scripting languages are likely to <em>display</em> the array in the
opposite order from the way it appears in the TableGen source or in
the diagnostic <code class="docutils literal notranslate"><span class="pre">-print-records</span></code> output.</li>
</ul>
<p>All other TableGen value types are emitted as a JSON object,
containing two standard fields: <code class="docutils literal notranslate"><span class="pre">kind</span></code> is a discriminator describing
which kind of value the object represents, and <code class="docutils literal notranslate"><span class="pre">printable</span></code> is a
string giving the same representation of the value that would appear
in <code class="docutils literal notranslate"><span class="pre">-print-records</span></code>.</p>
<ul class="simple">
<li>A reference to a <code class="docutils literal notranslate"><span class="pre">def</span></code> object has <code class="docutils literal notranslate"><span class="pre">kind==&quot;def&quot;</span></code>, and has an
extra field <code class="docutils literal notranslate"><span class="pre">def</span></code> giving the name of the object referred to.</li>
<li>A reference to another variable in the same record has
<code class="docutils literal notranslate"><span class="pre">kind==&quot;var&quot;</span></code>, and has an extra field <code class="docutils literal notranslate"><span class="pre">var</span></code> giving the name of
the variable referred to.</li>
<li>A reference to a specific bit of a <code class="docutils literal notranslate"><span class="pre">bits</span></code>-typed variable in the
same record has <code class="docutils literal notranslate"><span class="pre">kind==&quot;varbit&quot;</span></code>, and has two extra fields:
<code class="docutils literal notranslate"><span class="pre">var</span></code> gives the name of the variable referred to, and <code class="docutils literal notranslate"><span class="pre">index</span></code>
gives the index of the bit.</li>
<li>A value of type <code class="docutils literal notranslate"><span class="pre">dag</span></code> has <code class="docutils literal notranslate"><span class="pre">kind==&quot;dag&quot;</span></code>, and has two extra
fields. <code class="docutils literal notranslate"><span class="pre">operator</span></code> gives the initial value after the opening
parenthesis of the dag initializer; <code class="docutils literal notranslate"><span class="pre">args</span></code> is an array giving the
following arguments. The elements of <code class="docutils literal notranslate"><span class="pre">args</span></code> are arrays of length
2, giving the value of each argument followed by its colon-suffixed
name (if any). For example, in the JSON representation of the dag
value <code class="docutils literal notranslate"><span class="pre">(Op</span> <span class="pre">22,</span> <span class="pre">&quot;hello&quot;:$foo)</span></code> (assuming that <code class="docutils literal notranslate"><span class="pre">Op</span></code> is the name of
a record defined elsewhere with a <code class="docutils literal notranslate"><span class="pre">def</span></code> statement):<ul>
<li><code class="docutils literal notranslate"><span class="pre">operator</span></code> will be an object in which <code class="docutils literal notranslate"><span class="pre">kind==&quot;def&quot;</span></code> and
<code class="docutils literal notranslate"><span class="pre">def==&quot;Op&quot;</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">args</span></code> will be the array <code class="docutils literal notranslate"><span class="pre">[[22,</span> <span class="pre">null],</span> <span class="pre">[&quot;hello&quot;,</span> <span class="pre">&quot;foo&quot;]]</span></code>.</li>
</ul>
</li>
<li>If any other kind of value or complicated expression appears in the
output, it will have <code class="docutils literal notranslate"><span class="pre">kind==&quot;complex&quot;</span></code>, and no additional fields.
These values are not expected to be needed by backends. The standard
<code class="docutils literal notranslate"><span class="pre">printable</span></code> field can be used to extract a representation of them
in TableGen source syntax if necessary.</li>
</ul>
</div>
</div>
<div class="section" id="how-to-write-a-back-end">
<h2><a class="toc-backref" href="#id53">How to write a back-end</a><a class="headerlink" href="#how-to-write-a-back-end" title="Permalink to this headline">¶</a></h2>
<p>TODO.</p>
<p>Until we get a step-by-step HowTo for writing TableGen backends, you can at
least grab the boilerplate (build system, new files, etc.) from Clang’s
r173931.</p>
<p>TODO: How they work, how to write one.  This section should not contain details
about any particular backend, except maybe <code class="docutils literal notranslate"><span class="pre">-print-enums</span></code> as an example.  This
should highlight the APIs in <code class="docutils literal notranslate"><span class="pre">TableGen/Record.h</span></code>.</p>
</div>
</div>


          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="LangRef.html" title="TableGen Language Reference"
             >next</a> |</li>
        <li class="right" >
          <a href="index.html" title="TableGen"
             >previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="../index.html">Documentation</a>&raquo;</li>

          <li class="nav-item nav-item-1"><a href="index.html" >TableGen</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2003-2020, LLVM Project.
      Last updated on 2020-09-07.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.4.
    </div>
  </body>
</html>