<commit_before><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>TableGen Fundamentals</title>
  <link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>

<div class="doc_title">TableGen Fundamentals</div>

<div class="doc_text">
<ul>
  <li><a href="#introduction">Introduction</a>
  <ol>
    <li><a href="#concepts">Basic concepts</a></li>
    <li><a href="#example">An example record</a></li>
    <li><a href="#running">Running TableGen</a></li>
  </ol></li>
  <li><a href="#syntax">TableGen syntax</a>
  <ol>
    <li><a href="#primitives">TableGen primitives</a>
    <ol>
      <li><a href="#comments">TableGen comments</a></li>
      <li><a href="#types">The TableGen type system</a></li>
      <li><a href="#values">TableGen values and expressions</a></li>
    </ol></li>
    <li><a href="#classesdefs">Classes and definitions</a>
    <ol>
      <li><a href="#valuedef">Value definitions</a></li>
      <li><a href="#recordlet">'let' expressions</a></li>
      <li><a href="#templateargs">Class template arguments</a></li>
      <li><a href="#multiclass">Multiclass definitions and instances</a></li>
    </ol></li>
    <li><a href="#filescope">File scope entities</a>
    <ol>
      <li><a href="#include">File inclusion</a></li>
      <li><a href="#globallet">'let' expressions</a></li>
    </ol></li>
  </ol></li>
  <li><a href="#backends">TableGen backends</a>
  <ol>
    <li><a href="#">todo</a></li>
  </ol></li>
</ul>
</div>

<div class="doc_author">
  <p>Written by <a href="mailto:<EMAIL>"><NAME></a></p>
</div>

<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<!-- *********************************************************************** -->

<div class="doc_text">

<p>TableGen's purpose is to help a human develop and maintain records of
domain-specific information.  Because there may be a large number of these
records, it is specifically designed to allow writing flexible descriptions and
for common features of these records to be factored out.  This reduces the
amount of duplication in the description, reduces the chance of error, and
makes it easier to structure domain specific information.</p>

<p>The core part of TableGen <a href="#syntax">parses a file</a>, instantiates
the declarations, and hands the result off to a domain-specific "<a
href="#backends">TableGen backend</a>" for processing.  The current major user
of TableGen is the <a href="CodeGenerator.html">LLVM code generator</a>.</p>

<p>Note that if you work on TableGen much, and use emacs or vim, that you can
find an emacs "TableGen mode" and a vim language file in
<tt>llvm/utils/emacs</tt> and <tt>llvm/utils/vim</tt> directory of your LLVM
distribution, respectively.</p>

</div>

<!-- ======================================================================= -->
<div class="doc_subsection"><a name="running">Basic concepts</a></div>

<div class="doc_text">

<p>TableGen files consist of two key parts: 'classes' and 'definitions', both
of which are considered 'records'.</p>

<p><b>TableGen records</b> have a unique name, a list of values, and a list of
superclasses.  The list of values is main data that TableGen builds for each
record, it is this that holds the domain specific information for the
application.  The interpretation of this data is left to a specific <a
href="#backends">TableGen backend</a>, but the structure and format rules are
taken care of and fixed by TableGen.</p>

<p><b>TableGen definitions</b> are the concrete form of 'records'.  These
generally do not have any undefined values, and are marked with the
'<tt>def</tt>' keyword.</p>

<p><b>TableGen classes</b> are abstract records that are used to build and
describe other records.  These 'classes' allow the end-user to build
abstractions for either the domain they are targetting (such as "Register",
"RegisterClass", and "Instruction" in the LLVM code generator) or for the
implementor to help factor out common properties of records (such as "FPInst",
which is used to represent floating point instructions in the X86 backend).
TableGen keeps track of all of the classes that are used to build up a
definition, so the backend can find all definitions of a particular class, such
as "Instruction".</p>

<p><b>TableGen multiclasses</b> are groups of abstract records that are
instantiated all at once.  Each instantiation can result in multiple TableGen
definitions.</p>
<commit_msg>Missing anchor<commit_after><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>TableGen Fundamentals</title>
  <link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>

<div class="doc_title">TableGen Fundamentals</div>

<div class="doc_text">
<ul>
  <li><a href="#introduction">Introduction</a>
  <ol>
    <li><a href="#concepts">Basic concepts</a></li>
    <li><a href="#example">An example record</a></li>
    <li><a href="#running">Running TableGen</a></li>
  </ol></li>
  <li><a href="#syntax">TableGen syntax</a>
  <ol>
    <li><a href="#primitives">TableGen primitives</a>
    <ol>
      <li><a href="#comments">TableGen comments</a></li>
      <li><a href="#types">The TableGen type system</a></li>
      <li><a href="#values">TableGen values and expressions</a></li>
    </ol></li>
    <li><a href="#classesdefs">Classes and definitions</a>
    <ol>
      <li><a href="#valuedef">Value definitions</a></li>
      <li><a href="#recordlet">'let' expressions</a></li>
      <li><a href="#templateargs">Class template arguments</a></li>
      <li><a href="#multiclass">Multiclass definitions and instances</a></li>
    </ol></li>
    <li><a href="#filescope">File scope entities</a>
    <ol>
      <li><a href="#include">File inclusion</a></li>
      <li><a href="#globallet">'let' expressions</a></li>
    </ol></li>
  </ol></li>
  <li><a href="#backends">TableGen backends</a>
  <ol>
    <li><a href="#">todo</a></li>
  </ol></li>
</ul>
</div>

<div class="doc_author">
  <p>Written by <a href="mailto:<EMAIL>"><NAME></a></p>
</div>

<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<!-- *********************************************************************** -->

<div class="doc_text">

<p>TableGen's purpose is to help a human develop and maintain records of
domain-specific information.  Because there may be a large number of these
records, it is specifically designed to allow writing flexible descriptions and
for common features of these records to be factored out.  This reduces the
amount of duplication in the description, reduces the chance of error, and
makes it easier to structure domain specific information.</p>

<p>The core part of TableGen <a href="#syntax">parses a file</a>, instantiates
the declarations, and hands the result off to a domain-specific "<a
href="#backends">TableGen backend</a>" for processing.  The current major user
of TableGen is the <a href="CodeGenerator.html">LLVM code generator</a>.</p>

<p>Note that if you work on TableGen much, and use emacs or vim, that you can
find an emacs "TableGen mode" and a vim language file in
<tt>llvm/utils/emacs</tt> and <tt>llvm/utils/vim</tt> directory of your LLVM
distribution, respectively.</p>

</div>

<!-- ======================================================================= -->
<div class="doc_subsection"><a name="concepts">Basic concepts</a></div>

<div class="doc_text">

<p>TableGen files consist of two key parts: 'classes' and 'definitions', both
of which are considered 'records'.</p>

<p><b>TableGen records</b> have a unique name, a list of values, and a list of
superclasses.  The list of values is main data that TableGen builds for each
record, it is this that holds the domain specific information for the
application.  The interpretation of this data is left to a specific <a
href="#backends">TableGen backend</a>, but the structure and format rules are
taken care of and fixed by TableGen.</p>

<p><b>TableGen definitions</b> are the concrete form of 'records'.  These
generally do not have any undefined values, and are marked with the
'<tt>def</tt>' keyword.</p>

<p><b>TableGen classes</b> are abstract records that are used to build and
describe other records.  These 'classes' allow the end-user to build
abstractions for either the domain they are targetting (such as "Register",
"RegisterClass", and "Instruction" in the LLVM code generator) or for the
implementor to help factor out common properties of records (such as "FPInst",
which is used to represent floating point instructions in the X86 backend).
TableGen keeps track of all of the classes that are used to build up a
definition, so the backend can find all definitions of a particular class, such
as "Instruction".</p>

<p><b>TableGen multiclasses</b> are groups of abstract records that are
instantiated all at once.  Each instantiation can result in multiple TableGen
definitions.</p>

{'fraction_non_alphanumeric': 0.18953819216458745, 'fraction_numerical': 0.0017509301816590063, 'mean_word_length': 4.697630922693267, 'pattern_counts': {'":': 0, '<': 327, '<?xml version=': 0, '>': 327, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2110441', 'n_tokens_mistral': 2738, 'n_tokens_neox': 2658, 'n_words': 971}