P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::ControlPlaneAPI::P4RuntimeArchHandlerIface Class Referenceabstract

#include <p4RuntimeArchHandler.h>

Inheritance diagram for P4::ControlPlaneAPI::P4RuntimeArchHandlerIface:
[legend]

Public Member Functions

virtual void addExternEntries (const p4::v1::WriteRequest *entries, const P4RuntimeSymbolTableIface &symbols, const IR::ExternBlock *externBlock)=0
 This method is called to add target specific extern entries.
 
virtual void addExternFunction (const P4RuntimeSymbolTableIface &symbols, ::p4::config::v1::P4Info *p4info, const P4::ExternFunction *externFunction)=0
 
virtual void addExternInstance (const P4RuntimeSymbolTableIface &symbols, ::p4::config::v1::P4Info *p4info, const IR::ExternBlock *externBlock)=0
 
virtual void addTableProperties (const P4RuntimeSymbolTableIface &symbols, ::p4::config::v1::P4Info *p4info, ::p4::config::v1::Table *table, const IR::TableBlock *tableBlock)=0
 
virtual void collectAssignmentStatement (P4RuntimeSymbolTableIface *symbols, const IR::AssignmentStatement *assign)=0
 Collects architecture-specific used in assignment statements.
 
virtual void collectExternFunction (P4RuntimeSymbolTableIface *symbols, const P4::ExternFunction *externFunction)=0
 
virtual void collectExternInstance (P4RuntimeSymbolTableIface *symbols, const IR::ExternBlock *externBlock)=0
 Collects architecture-specific @externBlock instance in @symbols table.
 
virtual void collectExternMethod (P4RuntimeSymbolTableIface *symbols, const P4::ExternMethod *externMethod)=0
 Collects architecture-specific @externMethod instance in @symbols table.
 
virtual void collectExtra (P4RuntimeSymbolTableIface *symbols)=0
 
virtual void collectTableProperties (P4RuntimeSymbolTableIface *symbols, const IR::TableBlock *tableBlock)=0
 
virtual bool filterAnnotations (cstring anno)=0
 called when processing annotations via setPreamble
 
virtual cstring getControlPlaneName (const IR::Block *block)
 Get control plane name for @block.
 
virtual google::protobuf::util::JsonPrintOptions getJsonPrintOptions ()=0
 Control how JSON is output.
 
virtual void postAdd (const P4RuntimeSymbolTableIface &symbols, ::p4::config::v1::P4Info *p4info)=0
 
virtual void postCollect (const P4RuntimeSymbolTableIface &symbols)=0
 

Detailed Description

The interface for defining the P4Info serialization logic for a specific P4 architecture. The goal is to reduce code duplication between architectures. The P4RuntimeSerializer will call these methods when generating the P4Info message to handle architecture-specific parts. P4RuntimeSerializer generates the P4Info in two passes: first it collects all the control-plane visible symbols from the program into the symbol table, then it builds the P4Info message by adding each collected entity to the Protobuf message. The collect* methods are called in the first pass, the add* methods are called in the second pass.

Member Function Documentation

◆ addExternEntries()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::addExternEntries ( const p4::v1::WriteRequest * entries,
const P4RuntimeSymbolTableIface & symbols,
const IR::ExternBlock * externBlock )
pure virtual

◆ addExternFunction()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::addExternFunction ( const P4RuntimeSymbolTableIface & symbols,
::p4::config::v1::P4Info * p4info,
const P4::ExternFunction * externFunction )
pure virtual

Adds relevant information about @externFunction method call - if it needs to be exposed to the control-plane - to @p4info message.

◆ addExternInstance()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::addExternInstance ( const P4RuntimeSymbolTableIface & symbols,
::p4::config::v1::P4Info * p4info,
const IR::ExternBlock * externBlock )
pure virtual

Adds relevant information about @externBlock instance to the @p4info message.

◆ addTableProperties()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::addTableProperties ( const P4RuntimeSymbolTableIface & symbols,
::p4::config::v1::P4Info * p4info,
::p4::config::v1::Table * table,
const IR::TableBlock * tableBlock )
pure virtual

Adds architecture-specific properties for @tableBlock to the @table Protobuf message.

◆ collectAssignmentStatement()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::collectAssignmentStatement ( P4RuntimeSymbolTableIface * symbols,
const IR::AssignmentStatement * assign )
pure virtual

◆ collectExternFunction()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::collectExternFunction ( P4RuntimeSymbolTableIface * symbols,
const P4::ExternFunction * externFunction )
pure virtual

◆ collectExternInstance()

◆ collectExternMethod()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::collectExternMethod ( P4RuntimeSymbolTableIface * symbols,
const P4::ExternMethod * externMethod )
pure virtual

◆ collectExtra()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::collectExtra ( P4RuntimeSymbolTableIface * symbols)
pure virtual

Collects any extra symbols you may want to include in the symbol table and that are not covered by the above collection methods.

Implemented in P4::ControlPlaneAPI::Standard::P4RuntimeArchHandlerCommon< arch >, P4::ControlPlaneAPI::Standard::P4RuntimeArchHandlerCommon< Arch::PSA >, and P4::ControlPlaneAPI::Standard::P4RuntimeArchHandlerCommon< Arch::V1MODEL >.

◆ collectTableProperties()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::collectTableProperties ( P4RuntimeSymbolTableIface * symbols,
const IR::TableBlock * tableBlock )
pure virtual

◆ filterAnnotations()

virtual bool P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::filterAnnotations ( cstring anno)
pure virtual

◆ getJsonPrintOptions()

virtual google::protobuf::util::JsonPrintOptions P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::getJsonPrintOptions ( )
pure virtual

◆ postAdd()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::postAdd ( const P4RuntimeSymbolTableIface & symbols,
::p4::config::v1::P4Info * p4info )
pure virtual

◆ postCollect()

virtual void P4::ControlPlaneAPI::P4RuntimeArchHandlerIface::postCollect ( const P4RuntimeSymbolTableIface & symbols)
pure virtual

This method is called between the two passes (collect and add) in case the architecture requires some logic to be performed then.

Implemented in P4::ControlPlaneAPI::Standard::P4RuntimeArchHandlerCommon< arch >, P4::ControlPlaneAPI::Standard::P4RuntimeArchHandlerCommon< Arch::PSA >, and P4::ControlPlaneAPI::Standard::P4RuntimeArchHandlerCommon< Arch::V1MODEL >.