60 unsigned no_of_instances;
64 enum CounterType { PACKETS, BYTES, PACKETS_AND_BYTES };
65 const IR::ToplevelBlock *tlb;
66 IR::TCPipeline *tcPipeline;
70 unsigned int tableCount = 0;
71 unsigned int actionCount = 0;
72 unsigned int metadataCount = 0;
73 unsigned int labelCount = 0;
74 unsigned int externCount = 0;
76 cstring mainParserName =
nullptr;
89 : tlb(tlb), tcPipeline(pipe), refMap(refMap), typeMap(typeMap), options(options) {}
90 void setPipelineName();
91 cstring getPipelineName() {
return pipelineName; };
92 bool preorder(
const IR::P4Program *p)
override;
93 void postorder(
const IR::P4Action *a)
override;
94 void postorder(
const IR::P4Table *t)
override;
95 void postorder(
const IR::P4Program *p)
override;
96 void postorder(
const IR::Declaration_Instance *d)
override;
97 void postorder(
const IR::Type_Struct *ts)
override;
98 safe_vector<const IR::TCKey *> processExternConstructor(
const IR::Type_Extern *extn,
99 const IR::Declaration_Instance *decl,
100 struct ExternInstance *instance);
101 safe_vector<const IR::TCKey *> processExternControlPath(
const IR::Type_Extern *extn,
102 const IR::Declaration_Instance *decl,
104 cstring getControlPathKeyAnnotation(
const IR::StructField *field);
105 unsigned GetAccessNumericValue(std::string_view access);
106 bool isDuplicateAction(
const IR::P4Action *action);
107 bool isDuplicateOrNoAction(
const IR::P4Action *action);
108 void updateDefaultHitAction(
const IR::P4Table *t, IR::TCTable *tdef);
109 void updateDefaultMissAction(
const IR::P4Table *t, IR::TCTable *tdef);
110 void updateConstEntries(
const IR::P4Table *t, IR::TCTable *tdef);
111 void updateMatchType(
const IR::P4Table *t, IR::TCTable *tabledef);
112 void updateTimerProfiles(IR::TCTable *tabledef);
113 void updatePnaDirectCounter(
const IR::P4Table *t, IR::TCTable *tabledef,
unsigned tentries);
114 void updatePnaDirectMeter(
const IR::P4Table *t, IR::TCTable *tabledef,
unsigned tentries);
116 bool isPnaMainInputMeta(
const IR::Member *mem);
117 bool isPnaMainOutputMeta(
const IR::Member *mem);
118 unsigned int findMappedKernelMeta(
const IR::Member *mem);
119 const IR::Expression *ExtractExpFromCast(
const IR::Expression *exp);
120 unsigned getTcType(
const IR::StringLiteral *sl);
121 unsigned getTableId(cstring tableName)
const;
122 unsigned getActionId(cstring actionName)
const;
123 cstring getExternId(cstring externName)
const;
124 unsigned getExternInstanceId(cstring externName, cstring instanceName)
const;
125 cstring processExternPermission(
const IR::Type_Extern *ext);
126 unsigned getTableKeysize(
unsigned tableId)
const;
127 cstring externalName(
const IR::IDeclaration *declaration)
const;
128 cstring HandleTableAccessPermission(
const IR::P4Table *t);
129 std::pair<cstring, cstring> *GetAnnotatedAccessPath(
const IR::Annotation *anno);
130 void updateAddOnMissTable(
const IR::P4Table *t);
131 bool checkParameterDirection(
const IR::TCAction *tcAction);
132 bool hasExecuteMethod(
const IR::Type_Extern *extn);
133 void addExternTypeInstance(
const IR::Declaration_Instance *decl,
134 IR::TCExternInstance *tcExternInstance, cstring eName);
135 safe_vector<const IR::TCKey *> HandleTypeNameStructField(
const IR::StructField *field,
136 const IR::Type_Extern *extn,
137 const IR::Declaration_Instance *decl,
138 int &kId, cstring annoName);
139 safe_vector<const IR::TCKey *> processCounterControlPathKeys(
140 const IR::Type_Struct *extern_control_path,
const IR::Type_Extern *extn,
141 const IR::Declaration_Instance *decl);
142 CounterType toCounterType(
const int type);