
Public Member Functions | |
| ReplaceStructs (NestedStructMap *sm) | |
| const IR::Node * | postorder (IR::Member *expression) override |
| const IR::Node * | postorder (IR::Type_Struct *type) override |
| const IR::Node * | preorder (IR::P4Control *control) override |
| const IR::Node * | preorder (IR::P4Parser *parser) override |
| const IR::Node * | preorder (IR::P4Program *program) override |
This pass transforms the type signatures of instantiated controls, parsers, and packages. It does not transform methods, functions or actions. It starts from package instantiations: every type argument that is a nested structure is replaced with "simpler" flat type.
This pass cannot handle methods or functions that return structs, or that take an out argument of type struct. If there are such structures the pass will report an error.
Should be run after the NestedStructs pass.
struct S { bit b; } struct T { S s; }
control c(inout T arg) { apply { ... arg.s.b ... } }
control proto<V>(inout V arg); package top<V>(proto<V> ctrl);
top<T>(c()) main;
This is transformed into:
struct S { bit b; } struct T { bit _s_b0; }
control c(inout T arg) { apply { ... arg._s_b0; ... } }
top<TFlat>(c()) main;