P4C
The P4 Compiler
Loading...
Searching...
No Matches
matchActionTableMetrics.h
1/*
2Collects match-action table metrics by inspecting each table's
3properties and extracting the number of actions, as well as unwrapping
4each key field and extracting its bit width.
5*/
6
7#ifndef FRONTENDS_P4_METRICS_MATCHACTIONTABLEMETRICS_H_
8#define FRONTENDS_P4_METRICS_MATCHACTIONTABLEMETRICS_H_
9
10#include "frontends/p4/metrics/metricsStructure.h"
11#include "frontends/p4/typeChecking/typeChecker.h"
12#include "ir/ir.h"
13
14namespace P4 {
15
16class MatchActionTableMetricsPass : public Inspector {
17 private:
18 unsigned keySize(const IR::KeyElement *keyElement);
19 TypeMap *typeMap;
21
22 public:
23 explicit MatchActionTableMetricsPass(TypeMap *map, Metrics &metricsRef)
24 : typeMap(map), metrics(metricsRef.matchActionTableMetrics) {
25 setName("MatchActionTableMetricsPass");
26 }
27
28 void postorder(const IR::P4Table *table) override;
29 void postorder(const IR::P4Program * /*program*/) override;
30};
31
32} // namespace P4
33
34#endif /* FRONTENDS_P4_METRICS_MATCHACTIONTABLEMETRICS_H_ */
Definition visitor.h:413
Definition typeMap.h:41
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
Definition metricsStructure.h:68
Definition metricsStructure.h:119