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

Public Member Functions

 ConvertToDpdkProgram (P4::ReferenceMap *refmap, P4::TypeMap *typemap, DpdkProgramStructure *structure, DpdkOptions &options)
 
const IR::DpdkAsmProgram * create (IR::P4Program *prog)
 
IR::IndexedVector< IR::DpdkAsmStatement > create_pna_postamble ()
 
IR::IndexedVector< IR::DpdkAsmStatement > create_pna_preamble ()
 
IR::IndexedVector< IR::DpdkAsmStatement > create_psa_postamble ()
 
IR::IndexedVector< IR::DpdkAsmStatement > create_psa_preamble ()
 
const IR::DpdkAsmProgram * getDpdkProgram ()
 
const IR::Node * preorder (IR::P4Program *p) override
 
IR::IndexedVector< IR::DpdkStructType > UpdateHeaderMetadata (IR::P4Program *prog, IR::Type_Struct *metadata)
 

Member Function Documentation

◆ create()

const IR::DpdkAsmProgram * DPDK::ConvertToDpdkProgram::create ( IR::P4Program * prog)

UpdateHeaderMetadata returns IndexedVector filled with following 3 types of structs:

  • main metadata structure (whose name is stored in structure->local_metadata_type)
  • structures for action arguments created internally by compiler (stored in structure->args_struct_map)
  • main structure which holds all headers (whose name is stored in structure->header_type)

Only the first one (main metadata structure) can be present in structure->metadata_types map. Main metadata structure is added to the map when it contains metadata whose type is a structure. It happens during InspectDpdkProgram pass which visits IR::Parameter nodes in InspectDpdkProgram::preorder(const IR::Parameter* param). During that pass the visitor only visits the parameter in the statement from architecture. Structures internally created for action arguments are not visited in that pass, so they are not added to structure->metadata_types. As they are created internally by compiler they are not used as types of fields in main metadata structure neither. Main headers structure contains only headers so it is not added to structure->metadata_types map neither. InspectDpdkProgram adds there only the structures which contain some field with structure type.