P4C
The P4 Compiler
Loading...
Searching...
No Matches
DeparseGraph Class Reference

#include <deparse_graph.h>

Classes

struct  NodeInfo
 

Public Types

using Node = typename Graph::vertex_descriptor
 

Public Member Functions

Node addConst (const IR::Constant *c)
 
bool addEdge (Node src, Node dst)
 Adds an edge from src to dst.
 
Node addField (const PHV::Field *f)
 
bool canReach (const PHV::Field *f1, const PHV::Field *f2) const
 Determines whether f1 might be deparsed before f2.
 
void clear ()
 
const std::vector< NodeInfonodesBetween (const PHV::Field *f1, const PHV::Field *f2) const
 

Detailed Description

Encodes adjacency information for the deparser. Nodes represent fields or constants that get deparsed. A forward edge from n1 to n2 (and a back edge from n2 to n1) exists if n1 is deparsed right before n2 is deparsed.

Member Function Documentation

◆ addConst()

DeparseGraph::Node DeparseGraph::addConst ( const IR::Constant * c)
Returns
a fresh internal node for representing a deparsed constant.

◆ addEdge()

bool DeparseGraph::addEdge ( Node src,
Node dst )

Adds an edge from src to dst.

Returns
true if a new edge is created as a result.

◆ addField()

DeparseGraph::Node DeparseGraph::addField ( const PHV::Field * f)
Returns
the internal node corresponding to the given field, creating the node if one doesn't already exist.

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

◆ nodesBetween()

const std::vector< DeparseGraph::NodeInfo > DeparseGraph::nodesBetween ( const PHV::Field * f1,
const PHV::Field * f2 ) const
Returns
a description of all nodes that might be deparsed between f1 and f2.