P4C
The P4 Compiler
Loading...
Searching...
No Matches
headerMetrics.h
1
/*
2
Collects global and per-definition header metrics. For each
3
header definition, it loops over each field and unwraps
4
its type, until the field's bit width can be extracted.
5
*/
6
7
#ifndef FRONTENDS_P4_METRICS_HEADERMETRICS_H_
8
#define FRONTENDS_P4_METRICS_HEADERMETRICS_H_
9
10
#include "frontends/p4/metrics/metricsStructure.h"
11
#include "frontends/p4/typeMap.h"
12
#include "ir/ir.h"
13
14
namespace
P4
{
15
16
class
HeaderMetricsPass :
public
Inspector
{
17
private
:
18
TypeMap
*typeMap;
19
HeaderMetrics
&metrics;
20
unsigned
totalFieldsNum = 0;
21
unsigned
totalFieldsSize = 0;
22
23
public
:
24
explicit
HeaderMetricsPass(
TypeMap
*typeMap,
Metrics
&metricsRef)
25
: typeMap(typeMap), metrics(metricsRef.headerMetrics) {
26
setName(
"HeaderMetricsPass"
);
27
}
28
29
void
postorder(
const
IR::Type_Header *header)
override
;
30
void
postorder(
const
IR::P4Program *
/*program*/
)
override
;
31
};
32
33
}
// namespace P4
34
35
#endif
/* FRONTENDS_P4_METRICS_HEADERMETRICS_H_ */
P4::Inspector
Definition
visitor.h:413
P4::TypeMap
Definition
typeMap.h:41
P4
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition
applyOptionsPragmas.cpp:24
P4::HeaderMetrics
Definition
metricsStructure.h:110
P4::Metrics
Definition
metricsStructure.h:119
frontends
p4
metrics
headerMetrics.h
Generated by
1.13.2