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

Public Member Functions

 DoFlattenHeaderUnionStack (P4::ReferenceMap *refMap, P4::TypeMap *typeMap)
 
bool hasHeaderUnionStackField (IR::Type_Struct *s)
 
const IR::Node * postorder (IR::ArrayIndex *e) override
 
const IR::Node * postorder (IR::Declaration_Variable *dv) override
 
const IR::Node * postorder (IR::Type_Struct *sf) override
 
- Public Member Functions inherited from P4::DoFlattenHeaderUnion
 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
 

Additional Inherited Members

- Protected Attributes inherited from P4::DoFlattenHeaderUnion
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 stack variabls into its individual elements. All occurrences of the header union stack variables are replaced by the elements in the stack. For ex: header_union U { Hdr1 h1; Hdr2 h2; }

struct Headers { Hdr1 h1; U[2] u; }

is replaced by struct Headers { Hdr1 h1; U u0; U u1; } References to u[0] are replaced by u0. Likewise for all stack elements.

This pass assumes that HSIndexSimplifier, ParsersUnroll passes are run before this and all indices for header union stack variables are constants.