-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ 39d9d44 🚀
- Loading branch information
1 parent
2985de3
commit a212349
Showing
33 changed files
with
6,102 additions
and
5,936 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<!-- HTML header for doxygen 1.12.0--> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> | ||
<meta http-equiv="X-UA-Compatible" content="IE=11"/> | ||
<meta name="generator" content="Doxygen 1.12.0"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<title>P4 Compiler Documentation (P4C): Frontend</title> | ||
<link rel="icon" href="p4-fav.svg" type="image/x-icon" /> | ||
<link href="tabs.css" rel="stylesheet" type="text/css"/> | ||
<script type="text/javascript" src="jquery.js"></script> | ||
<script type="text/javascript" src="dynsections.js"></script> | ||
<!-- Add link to paragraphs --> | ||
<script type="text/javascript" src="doxygen-awesome-paragraph-link.js"></script> | ||
<script type="text/javascript"> | ||
DoxygenAwesomeParagraphLink.init() | ||
</script> | ||
<!-- Add copy button to code fragments --> | ||
<script type="text/javascript" src="doxygen-awesome-fragment-copy-button.js"></script> | ||
<script type="text/javascript"> | ||
DoxygenAwesomeFragmentCopyButton.init() | ||
</script> | ||
<!-- Add dark mode toggle --> | ||
<script type="text/javascript" src="doxygen-awesome-darkmode-toggle.js"></script> | ||
<script type="text/javascript"> | ||
DoxygenAwesomeDarkModeToggle.init() | ||
</script> | ||
<link href="navtree.css" rel="stylesheet" type="text/css"/> | ||
<script type="text/javascript" src="navtreedata.js"></script> | ||
<script type="text/javascript" src="navtree.js"></script> | ||
<script type="text/javascript" src="resize.js"></script> | ||
<script type="text/javascript" src="cookie.js"></script> | ||
<link href="search/search.css" rel="stylesheet" type="text/css"/> | ||
<script type="text/javascript" src="search/searchdata.js"></script> | ||
<script type="text/javascript" src="search/search.js"></script> | ||
<link href="doxygen.css" rel="stylesheet" type="text/css" /> | ||
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/> | ||
<link href="doxygen-awesome-sidebar-only.css" rel="stylesheet" type="text/css"/> | ||
<link href="doxygen-awesome-sidebar-only-darkmode-toggle.css" rel="stylesheet" type="text/css"/> | ||
<link href="cards.css" rel="stylesheet" type="text/css"/> | ||
<link href="flow.css" rel="stylesheet" type="text/css"/> | ||
<link href="p4c_custom.css" rel="stylesheet" type="text/css"/> | ||
</head> | ||
<body> | ||
<div id="top"><!-- do not remove this div, it is closed by doxygen! --> | ||
<div id="titlearea"> | ||
<table cellspacing="0" cellpadding="0"> | ||
<tbody> | ||
<tr id="projectrow"> | ||
<td id="projectlogo"><img alt="Logo" src="p4-logo.png"/></td> | ||
<td id="projectalign"> | ||
<div id="projectname">P4C | ||
</div> | ||
<div id="projectbrief">The P4 Compiler</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<!-- end header part --> | ||
<!-- Generated by Doxygen 1.12.0 --> | ||
<script type="text/javascript"> | ||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ | ||
var searchBox = new SearchBox("searchBox", "search/",'.html'); | ||
/* @license-end */ | ||
</script> | ||
<script type="text/javascript"> | ||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ | ||
$(function() { codefold.init(0); }); | ||
/* @license-end */ | ||
</script> | ||
<script type="text/javascript" src="menudata.js"></script> | ||
<script type="text/javascript" src="menu.js"></script> | ||
<script type="text/javascript"> | ||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ | ||
$(function() { | ||
initMenu('',true,false,'search.php','Search',true); | ||
$(function() { init_search(); }); | ||
}); | ||
/* @license-end */ | ||
</script> | ||
<div id="main-nav"></div> | ||
</div><!-- top --> | ||
<div id="side-nav" class="ui-resizable side-nav-resizable"> | ||
<div id="nav-tree"> | ||
<div id="nav-tree-contents"> | ||
<div id="nav-sync" class="sync"></div> | ||
</div> | ||
</div> | ||
<div id="splitbar" style="-moz-user-select:none;" | ||
class="ui-resizable-handle"> | ||
</div> | ||
</div> | ||
<script type="text/javascript"> | ||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ | ||
$(function(){initNavTree('frontend.html',''); initResizable(true); }); | ||
/* @license-end */ | ||
</script> | ||
<div id="doc-content"> | ||
<!-- window showing the filter options --> | ||
<div id="MSearchSelectWindow" | ||
onmouseover="return searchBox.OnSearchSelectShow()" | ||
onmouseout="return searchBox.OnSearchSelectHide()" | ||
onkeydown="return searchBox.OnSearchSelectKey(event)"> | ||
</div> | ||
|
||
<!-- iframe showing the search results (closed by default) --> | ||
<div id="MSearchResultsWindow"> | ||
<div id="MSearchResults"> | ||
<div class="SRPage"> | ||
<div id="SRIndex"> | ||
<div id="SRResults"></div> | ||
<div class="SRStatus" id="Loading">Loading...</div> | ||
<div class="SRStatus" id="Searching">Searching...</div> | ||
<div class="SRStatus" id="NoMatches">No Matches</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div><div class="header"> | ||
<div class="headertitle"><div class="title">Frontend</div></div> | ||
</div><!--header--> | ||
<div class="contents"> | ||
<div class="textblock"><p>The front-end of the P4 compiler is responsible for transforming the high-level P4 source code into an Intermediate Representation (IR) while ensuring that the code is valid and optimized. This stage is entirely architecture-independent and consists of several critical 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--> | ||
<!-- start footer part --> | ||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> | ||
<ul> | ||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.