P4C
The P4 Compiler
|
Overview of backend passes.
Overview of backend passes.
Copyright (C) 2024 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
The back-end performs a series of passes that can possibly introduce some backtracking - returning to a given point in the sequence of passes to re-run it again, possibly with new information. This usually happens when PHV or table allocation fails.
The back-end starts with IR that was already transformed from front-end/mid-end IR into back-end IR (via BackendConverter). Also the back-end works on individual pipes in the program, not the entire program at once. This means that the input of the back-end is a back-end IR of a pipe and the output is a assembly file for this pipe.
There are currently two top-level flows. Changing between them can be done by setting options.alt_phv_alloc. These two flows are:
There are two special types of passes: