P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
P4::DoFlattenHeaderUnion Class Reference
Inheritance diagram for P4::DoFlattenHeaderUnion:

Public Member Functions

 DoFlattenHeaderUnion (P4::ReferenceMap *refMap, P4::TypeMap *typeMap)
 
bool hasHeaderUnionField (IR::Type_Struct *s)
 
const IR::Node * postorder (IR::Declaration_Variable *dv) override
 
const IR::Node * postorder (IR::Member *m) override
 
const IR::Node * postorder (IR::P4Action *action) override
 
const IR::Node * postorder (IR::P4Control *control) override
 
const IR::Node * postorder (IR::P4Parser *parser) override
 
const IR::Node * postorder (IR::Type_Struct *sf) override
 

Protected Attributes

P4::ReferenceMaprefMap
 
std::map< IR::Declaration_Variable *, IR::IndexedVector< IR::Declaration > > replaceDVMap
 
std::map< cstring, std::map< cstring, cstring > > replacementMap
 
P4::TypeMaptypeMap
 

Detailed Description

Flatten header union into its individual element. All occurrences of the header union variables are replaced by the new header type variables. For ex: header_union U { Hdr1 h1; Hdr2 h2; }

struct Headers { Hdr1 h1; U u; }

is replaced by struct Headers { Hdr1 h1; Hdr1 u_h1; Hdr2 u_h2; }