
Public Member Functions | |
| FixExtracts (ProgramStructure *structure) | |
| const IR::Node * | postorder (IR::MethodCallStatement *statement) override |
| const IR::Node * | postorder (IR::P4Parser *parser) override |
| const IR::Node * | postorder (IR::P4Program *program) override |
This pass uses the @length annotation set by the v1 front-end on varbit fields and converts extracts for headers with varbit fields. This only supports headers with a single varbit field. (The @length annotation is inserted as a conversion from the length header property.) For example:
header H { bit<8> len; @length(len) varbit<64> data; } ... H h; pkt.extract(h);
is converted to:
header H { bit<8> len; varbit<64> data; // annotation removed } ... H h;
Fixed-length size of H header H_0 { bit<8> len; }
H_0 h_0; h_0 = pkt.lookahead<H_0>(); pkt.extract(h, h_0.len);