From a2123490e6abccdff8e351c7f385228149dbfd9d Mon Sep 17 00:00:00 2001 From: AdarshRawat1 Date: Sun, 18 Aug 2024 09:03:27 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20p4lang/p?= =?UTF-8?q?4c@39d9d44473baf387e4b7ce1cdc1d176718733ded=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pr-preview/4850/doxygen_crawl.html | 3 + pr-preview/4850/frontend.html | 154 ++++++ pr-preview/4850/getting_started.html | 4 +- .../4850/intermediate_representation_ir.html | 4 +- pr-preview/4850/menudata.js | 2 + pr-preview/4850/navtreedata.js | 38 +- pr-preview/4850/navtreeindex0.js | 500 +++++++++--------- pr-preview/4850/navtreeindex1.js | 500 +++++++++--------- pr-preview/4850/navtreeindex10.js | 500 +++++++++--------- pr-preview/4850/navtreeindex11.js | 500 +++++++++--------- pr-preview/4850/navtreeindex12.js | 500 +++++++++--------- pr-preview/4850/navtreeindex13.js | 500 +++++++++--------- pr-preview/4850/navtreeindex14.js | 500 +++++++++--------- pr-preview/4850/navtreeindex15.js | 500 +++++++++--------- pr-preview/4850/navtreeindex16.js | 500 +++++++++--------- pr-preview/4850/navtreeindex17.js | 500 +++++++++--------- pr-preview/4850/navtreeindex18.js | 500 +++++++++--------- pr-preview/4850/navtreeindex19.js | 494 ++++++++--------- pr-preview/4850/navtreeindex2.js | 500 +++++++++--------- pr-preview/4850/navtreeindex20.js | 496 ++++++++--------- pr-preview/4850/navtreeindex21.js | 500 +++++++++--------- pr-preview/4850/navtreeindex22.js | 286 +++++----- pr-preview/4850/navtreeindex3.js | 500 +++++++++--------- pr-preview/4850/navtreeindex4.js | 500 +++++++++--------- pr-preview/4850/navtreeindex5.js | 500 +++++++++--------- pr-preview/4850/navtreeindex6.js | 500 +++++++++--------- pr-preview/4850/navtreeindex7.js | 500 +++++++++--------- pr-preview/4850/navtreeindex8.js | 500 +++++++++--------- pr-preview/4850/navtreeindex9.js | 500 +++++++++--------- pr-preview/4850/search/all_18.js | 213 ++++---- pr-preview/4850/search/all_1c.js | 339 ++++++------ pr-preview/4850/search/all_f.js | 2 +- pr-preview/4850/search/pages_4.js | 3 +- 33 files changed, 6102 insertions(+), 5936 deletions(-) create mode 100644 pr-preview/4850/frontend.html diff --git a/pr-preview/4850/doxygen_crawl.html b/pr-preview/4850/doxygen_crawl.html index 05c92928f8..b5284b1a5f 100644 --- a/pr-preview/4850/doxygen_crawl.html +++ b/pr-preview/4850/doxygen_crawl.html @@ -513,6 +513,7 @@ + @@ -3552,6 +3553,7 @@ + @@ -6256,6 +6258,7 @@ + diff --git a/pr-preview/4850/frontend.html b/pr-preview/4850/frontend.html new file mode 100644 index 0000000000..ff65f398a1 --- /dev/null +++ b/pr-preview/4850/frontend.html @@ -0,0 +1,154 @@ + + + + + + + + +P4 Compiler Documentation (P4C): Frontend + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
P4C +
+
The P4 Compiler
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Frontend
+
+
+

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:

+
    +
  • Program Parsing: Converts the P4 source code into an Abstract Syntax Tree (AST).
  • +
  • Validation: Checks the program against P4 language rules and constraints to ensure it is valid.
  • +
  • Name Resolution: Resolves all identifiers, such as variables and functions, to their declarations.
  • +
  • Type Checking/Inference: Uses the Hindley-Milner type inference algorithm to ensure that all types are correctly assigned and compatible.
  • +
  • Making Semantics Explicit: Ensures the program's semantics, such as the order of side effects, are clearly defined and explicit.
  • +
+

+Optimization Tasks

+

The front-end also performs some optimization-related tasks, including:

    +
  • Inlining: Replaces function calls with the function body to reduce overhead.
  • +
  • Compile-Time Evaluation and Specialization: Evaluates expressions and specializes code at compile time for efficiency.
  • +
  • Conversion to P4 Source: Converts the AST back to P4 source code if needed.
  • +
  • Deparser Inference (for P4_14 programs): Automatically infers deparser logic for P4_14 programs.
  • +
+

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.

+
+
+
+ + + + + diff --git a/pr-preview/4850/getting_started.html b/pr-preview/4850/getting_started.html index 4087fd97d2..f4f7ec024f 100644 --- a/pr-preview/4850/getting_started.html +++ b/pr-preview/4850/getting_started.html @@ -226,7 +226,7 @@ Known issues