P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::ControlPlaneAPI::P4RuntimeAnalyzer Class Reference

Public Member Functions

void addAction (const IR::P4Action *actionDeclaration)
 
void addControllerHeader (const IR::Type_Header *type)
 
void addExtern (const IR::ExternBlock *externBlock)
 
void addPkgInfo (const IR::ToplevelBlock *evaluatedProgram, cstring arch) const
 
void addTable (const IR::TableBlock *tableBlock)
 
void addValueSet (const IR::P4ValueSet *inst)
 
void analyzeControl (const IR::ControlBlock *controlBlock)
 
void postAdd () const
 

Static Public Member Functions

static P4RuntimeAPI analyze (const IR::P4Program *program, const IR::ToplevelBlock *evaluatedProgram, ReferenceMap *refMap, TypeMap *typeMap, P4RuntimeArchHandlerIface *archHandler, cstring arch)
 

Detailed Description

An analyzer which translates the information available in the P4 IR into a representation of the control plane API which is consumed by P4Runtime.

Member Function Documentation

◆ addPkgInfo()

void P4::ControlPlaneAPI::P4RuntimeAnalyzer::addPkgInfo ( const IR::ToplevelBlock * evaluatedProgram,
cstring arch ) const
inline

Sets the pkg_info field of the P4Info message, using the annotations on the P4 program package.

◆ addValueSet()

void P4::ControlPlaneAPI::P4RuntimeAnalyzer::addValueSet ( const IR::P4ValueSet * inst)
inline

Look for a @match annotation on the struct field and set the match type of the match field appropriately.

◆ analyze()

P4RuntimeAPI P4::ControlPlaneAPI::P4RuntimeAnalyzer::analyze ( const IR::P4Program * program,
const IR::ToplevelBlock * evaluatedProgram,
ReferenceMap * refMap,
TypeMap * typeMap,
P4RuntimeArchHandlerIface * archHandler,
cstring arch )
static

Analyze a P4 program and generate a P4Runtime control plane API.

Parameters
programThe P4 program to analyze.
evaluatedProgramAn up-to-date evaluated version of the program.
refMapAn up-to-date reference map.
refMapAn up-to-date type map.
archHandlerAn implementation of P4RuntimeArchHandlerIface which handles architecture-specific constructs (e.g. externs).
archThe name of the P4_16 architecture the program was written against.
Returns
a P4Info message representing the program's control plane API. Never returns null.

◆ postAdd()

void P4::ControlPlaneAPI::P4RuntimeAnalyzer::postAdd ( ) const
inline

To be called after all objects have been added to P4Info. Calls the architecture-specific postAdd method for post-processing.