P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
DPDK::ConvertLookahead::Collect Class Reference
Inheritance diagram for DPDK::ConvertLookahead::Collect:

Public Member Functions

 Collect (P4::ReferenceMap *refMap, P4::TypeMap *typeMap, ReplacementMap *repl)
 
void postorder (const IR::AssignmentStatement *statement) override
 

Member Function Documentation

◆ postorder()

void DPDK::ConvertLookahead::Collect::postorder ( const IR::AssignmentStatement * statement)
override

Store new header in following format in the map:

header lookahead_tmp_hdr { T f; }

Store following declaration of new local variable which is of new header type in the map:

lookahead_tmp_hdr lookahead_tmp;

Replace current statement with 2 new statements:

  • assignment statement with lookahead method using newly created header definiton
  • assignment statement which assigns the field from newly created header into the original variable

lookahead_tmp = pkt.lookahead<lookahead_tmp_hdr>(); var_name = lookahead_tmp.f;