Skip to content

Commit

Permalink
Deploying to gh-pages from @ 54d4b9d 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed Aug 22, 2024
1 parent b87b417 commit c695f76
Show file tree
Hide file tree
Showing 50 changed files with 2,679 additions and 2,805 deletions.
109 changes: 29 additions & 80 deletions behavioral_model_backend.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,57 +133,9 @@
</li>
<li class="level1">
<a href="#bmv2-pna_nic-backend">BMv2 &quot;pna_nic&quot; Backend</a>
<ul>
<li class="level2 empty">
<ul>
<li class="level3 empty">
<ul>
<li class="level4">
<a href="#pnaprogramstructureh-pnaprogramstructurecpp">pnaProgramStructure.h, pnaProgramStructure.cpp</a>
<ul>
<li class="level5">
<a href="#midendh-midendcpp">midend.h, midend.cpp</a>
</li>
<li class="level5">
<a href="#optionsh-optionscpp-1">options.h, options.cpp</a>
</li>
<li class="level5">
<a href="#pnanich-pnaniccpp">pnaNic.h, pnaNic.cpp</a>
</li>
<li class="level5">
<a href="#maincpp">main.cpp</a>
</li>
<li class="level5">
<a href="#versionhcmake">version.h.cmake</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1">
<a href="#portable_common">portable_common</a>
<ul>
<li class="level2 empty">
<ul>
<li class="level3">
<a href="#midendh-midendcpp-1">midend.h, midend.cpp</a>
</li>
<li class="level3">
<a href="#optionsh-optionscpp-2">options.h, options.cpp</a>
</li>
<li class="level3">
<a href="#portableh-portablecpp">portable.h, portable.cpp</a>
</li>
<li class="level3">
<a href="#portableprogramstructureh-portableprogramstructurecpp">portableProgramStructure.h, portableProgramStructure.cpp</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
Expand Down Expand Up @@ -220,40 +172,37 @@ <h1><a class="anchor" id="bmv2-pna_nic-backend"></a>
BMv2 "pna_nic" Backend</h1>
<p>The <a href="https://github.com/p4lang/p4c/tree/main/backends/bmv2/pna_nic"><code>backends/bmv2/pna_nic</code> directory</a> contains components specific to the BMv2's PNA NIC (Portable NIC Architecture) backend in the P4C compiler. The files in this folder depend on each other, on the files in the <code>bmv2/common</code> and <code>portable_common</code> directories. Most of the classes are inherited from the classes in the <code>portable_common</code> directory.</p>
<p>Output Binary: <code>p4c-bm2-pna</code></p>
<h4><a class="anchor" id="pnaprogramstructureh-pnaprogramstructurecpp"></a>
pnaProgramStructure.h, pnaProgramStructure.cpp</h4>
<p>Defines and implements the program structure (metadata, parsers, controls, and deparsers) and parsing logic specific to the BMv2's PNA NIC backend.</p>
<h5><a class="anchor" id="midendh-midendcpp"></a>
midend.h, midend.cpp</h5>
<p>Defines the mid-end processing of the PNA NIC compiler. Performs various transformations and optimizations on the program's Intermediate Representation (IR).</p>
<h5><a class="anchor" id="optionsh-optionscpp-1"></a>
options.h, options.cpp</h5>
<p>Manages the command-line options for the PNA NIC compiler.</p>
<h5><a class="anchor" id="pnanich-pnaniccpp"></a>
pnaNic.h, pnaNic.cpp</h5>
<p>Provides backend implementation to the BMv2's PNA NIC compiler.</p>
<h5><a class="anchor" id="maincpp"></a>
main.cpp</h5>
<p>Sets up compilation environment, integrates various components, and executes the PNA NIC compiler.</p>
<h5><a class="anchor" id="versionhcmake"></a>
version.h.cmake</h5>
<p>Defines macros containing version information for the PNA NIC compiler. </p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">File(s) </th><th class="markdownTableHeadNone">Description </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><code>pnaProgramStructure.h</code>, <code>pnaProgramStructure.cpp</code> </td><td class="markdownTableBodyNone">Defines and implements the program structure (metadata, parsers, controls, and deparsers) and parsing logic specific to the BMv2's PNA NIC backend. </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><code>midend.h</code>, <code>midend.cpp</code> </td><td class="markdownTableBodyNone">Defines the mid-end processing of the PNA NIC compiler. Performs various transformations and optimizations on the program's Intermediate Representation (IR). </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><code>options.h</code>, <code>options.cpp</code> </td><td class="markdownTableBodyNone">Manages the command-line options for the PNA NIC compiler. </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><code>pnaNic.h</code>, <code>pnaNic.cpp</code> </td><td class="markdownTableBodyNone">Provides backend implementation to the BMv2's PNA NIC compiler. </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><code>main.cpp</code> </td><td class="markdownTableBodyNone">Sets up compilation environment, integrates various components, and executes the PNA NIC compiler. </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><code>version.h.cmake</code> </td><td class="markdownTableBodyNone">Defines macros containing version information for the PNA NIC compiler. </td></tr>
</table>
<h1><a class="anchor" id="portable_common"></a>
portable_common</h1>
<p>This directory contains reusable components common to both the <code>psa_switch</code> and <code>pna_nic</code> backends.</p>
<h3><a class="anchor" id="midendh-midendcpp-1"></a>
midend.h, midend.cpp</h3>
<p>Defines the common mid-end processing of both the <code>psa_switch</code> and <code>pna_nic</code> backends.</p>
<h3><a class="anchor" id="optionsh-optionscpp-2"></a>
options.h, options.cpp</h3>
<p>Defines the common command-line options of both the <code>psa_switch</code> and <code>pna_nic</code> backends.</p>
<h3><a class="anchor" id="portableh-portablecpp"></a>
portable.h, portable.cpp</h3>
<p>Defines common functionalities that generate representations of P4 programs.</p>
<p>The files <code>portableProgramStructure.h</code> and <code>portableProgramStructure.cpp</code> are in the <code>backends/common</code> directory.</p>
<h3><a class="anchor" id="portableprogramstructureh-portableprogramstructurecpp"></a>
portableProgramStructure.h, portableProgramStructure.cpp</h3>
<p>Defines and implements the common program structure of both the <code>psa_switch</code> and <code>pna_nic</code> backends. </p>
<p>The <a href="https://github.com/p4lang/p4c/tree/main/backends/bmv2/portable_common"><code>portable_common</code> directory</a> contains reusable components common to both the <code>psa_switch</code> and <code>pna_nic</code> backends.</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone"><b>File Name</b> </th><th class="markdownTableHeadNone"><b>Description</b> </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><b>midend.h, midend.cpp</b> </td><td class="markdownTableBodyNone">Defines the common mid-end processing of both the <code>psa_switch</code> and <code>pna_nic</code> backends. </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><b>options.h, options.cpp</b> </td><td class="markdownTableBodyNone">Defines the common command-line options of both the <code>psa_switch</code> and <code>pna_nic</code> backends. </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><b>portable.h, portable.cpp</b> </td><td class="markdownTableBodyNone">Defines common functionalities that generate representations of P4 programs. </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><b>portableProgramStructure.h, portableProgramStructure.cpp</b> </td><td class="markdownTableBodyNone">Defines and implements the common program structure of both the <code>psa_switch</code> and <code>pna_nic</code> backends. _These files are located in the <code>backends/common</code> directory. </td></tr>
</table>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
Expand Down
3 changes: 2 additions & 1 deletion doxygen_crawl.html
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@
<a href="repository_structure.html"/>
<a href="frontend.html"/>
<a href="getting_started.html"/>
<a href="midend.html"/>
<a href="intermediate_representation_ir.html"/>
<a href="behavioral_model_backend.html"/>
<a href="dpdk_backend.html"/>
Expand Down Expand Up @@ -3559,7 +3560,6 @@
<a href="functions_rela.html"/>
<a href="functions_rela.html"/>
<a href="functions_rela.html"/>
<a href="@ref midend"/>
<a href="annotated.html"/>
<a href="behavioral_model_backend.html"/>
<a href="changelog.html"/>
Expand Down Expand Up @@ -6357,6 +6357,7 @@
<a href="hierarchy.html"/>
<a href="index.html"/>
<a href="intermediate_representation_ir.html"/>
<a href="midend.html"/>
<a href="namespace_p4.html"/>
<a href="namespace_p4.html#a002cab4524c2e05cb9767bfc9c0ef17a"/>
<a href="namespace_p4.html#a0e819dcdecc9b11a4df0244d8657256b"/>
Expand Down
19 changes: 18 additions & 1 deletion frontend.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,24 @@
<div class="headertitle"><div class="title">Frontend</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"></div></div><!-- contents -->
<div class="textblock"><p>The front end of the P4 compiler translates P4 source code into the P4 Intermediate Representation (P4C-IR), performs type-checking, and ensures that the P4 program complies with the P4 specification. The front end also applies architecture-independent optimizations such as Strength Reduction, Constant Folding, Inlining, or Dead-Code Elimination. This is a non-exhaustive list of passes:</p>
<ul>
<li><b>Program Parsing:</b> Converts the P4 source code into an Abstract Syntax Tree (AST).</li>
<li><b>Validation:</b> Checks the program against P4 language rules and constraints to ensure it is valid.</li>
<li><b>Name Resolution:</b> Resolves all identifiers, such as variables and functions, to their declarations.</li>
<li><b>Type Checking/Inference:</b> Uses the Hindley-Milner type inference algorithm to ensure that all types are correctly assigned and compatible.</li>
<li><b>Making Semantics Explicit:</b> Ensures the program's semantics, such as the order of side effects, are clearly defined and explicit. </li>
</ul>
<h2><a class="anchor" id="optimization-tasks"></a>
Optimization Tasks</h2>
<p>The front-end also performs some optimization-related tasks, including:</p><ul>
<li><b>Inlining:</b> Replaces function calls with the function body to reduce overhead.</li>
<li><b>Compile-Time Evaluation and Specialization:</b> Evaluates expressions and specializes code at compile time for efficiency.</li>
<li><b>Conversion to P4 Source:</b> Converts the AST back to P4 source code if needed.</li>
<li><b>Deparser Inference (for P4_14 programs):</b> Automatically infers deparser logic for P4_14 programs.</li>
</ul>
<p>After completing these passes, the front-end generates the control-plane API, which is essential for the interaction between the control plane and the data plane. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.12.0-->
Expand Down
Loading

0 comments on commit c695f76

Please sign in to comment.