19 unsigned scalars_width = 0;
21 std::map<const IR::StructField *, cstring> scalarMetadataFields;
50 std::map<const cstring, IR::IndexedVector<IR::Parameter> *> args_struct_map;
51 std::map<const IR::Declaration_Instance *, cstring> csum_map;
52 std::map<cstring, int> error_map;
53 std::vector<const IR::Declaration_Instance *> externDecls;
54 std::map<cstring, std::vector<std::pair<cstring, cstring>>> key_map;
55 std::map<cstring, const IR::P4Table *> group_tables;
56 std::map<cstring, const IR::P4Table *> member_tables;
58 std::set<cstring> pipeline_controls;
59 std::set<cstring> non_pipeline_controls;
61 IR::Type_Struct *metadataStruct;
62 IR::Expression *ipsec_header;
63 cstring local_metadata_type = cstring::empty;
64 cstring header_type = cstring::empty;
71 void push_variable(
const IR::DpdkDeclaration *d) { variables.push_back(d); }
74 void addHeaderInstances(
const IR::DpdkHeaderInstance *d) {
75 if (header_instances.find(d->name->toString()) == header_instances.end()) {
76 header_instances.emplace(d->name->toString(), d);
80 bool hasVisited(
const IR::Type_StructLike *st) {
81 if (
auto h = st->to<IR::Type_Header>())
82 return header_types.count(h->getName());
83 else if (
auto s = st->to<IR::Type_Struct>())
84 return metadata_types.count(s->getName());
85 else if (
auto u = st->to<IR::Type_HeaderUnion>())
86 return header_union_types.count(u->getName());
96 bool isPSA(
void) {
return (p4arch ==
"psa") ? true :
false; }
104 bool isPNA(
void) {
return (p4arch ==
"pna") ? true :
false; }
131 CHECK_NULL(structure);
134 bool preorder(
const IR::ToplevelBlock *block)
override;
135 bool preorder(
const IR::PackageBlock *block)
override;
136 void parse_psa_block(
const IR::PackageBlock *);
137 void parse_pna_block(
const IR::PackageBlock *);
140 structure->variables.clear();
141 structure->header_types.clear();
142 structure->metadata_types.clear();
143 structure->parsers.clear();
144 structure->deparsers.clear();
145 structure->pipelines.clear();
146 structure->actions.clear();
147 return Inspector::init_apply(root);
159 : refMap(refMap), typeMap(typeMap), structure(structure) {
160 CHECK_NULL(structure);
163 bool isHeaders(
const IR::Type_StructLike *st);
164 void addTypesAndInstances(
const IR::Type_StructLike *type,
bool meta);
165 void addHeaderType(
const IR::Type_StructLike *st);
166 void addHeaderInstance(
const IR::Type_StructLike *st,
cstring name);
167 bool preorder(
const IR::Declaration_Variable *dv)
override;
168 bool preorder(
const IR::Parameter *parameter)
override;
169 bool preorder(
const IR::P4Action *)
override;
170 bool isStandardMetadata(
cstring);
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24