P4C
The P4 Compiler
Loading...
Searching...
No Matches
deparser_zero.h
1
19
#ifndef BF_P4C_PHV_ANALYSIS_DEPARSER_ZERO_H_
20
#define BF_P4C_PHV_ANALYSIS_DEPARSER_ZERO_H_
21
22
#include <optional>
23
24
#include "backends/tofino/bf-p4c/common/field_defuse.h"
25
#include "backends/tofino/bf-p4c/mau/action_analysis.h"
26
#include "backends/tofino/bf-p4c/parde/clot/clot_info.h"
27
#include "backends/tofino/bf-p4c/phv/phv_fields.h"
28
#include "backends/tofino/bf-p4c/phv/pragma/pa_deparser_zero.h"
29
#include "backends/tofino/bf-p4c/phv/utils/utils.h"
30
#include "ir/ir.h"
31
40
class
IdentifyDeparserZeroCandidates
:
public
Inspector
{
41
private
:
42
PhvInfo
&phv;
43
const
FieldDefUse
&defuse;
44
const
ReductionOrInfo
&red_info;
45
const
PragmaDeparserZero
&pragmaFields;
46
ordered_set<const PHV::Field *>
&candidateFields;
47
49
bitvec
mauReadFields;
51
bitvec
mauWrittenFields;
53
bitvec
mauWrittenToZeroFields;
55
bitvec
mauWrittenToNonZeroFields;
57
bitvec
mauWrittenByNonSets;
58
60
void
eliminateNonByteAlignedFields();
61
62
profile_t
init_apply(
const
IR::Node
*root)
override
;
63
bool
preorder(
const
IR::MAU::Action *act)
override
;
64
bool
preorder(
const
IR::BFN::DigestFieldList *)
override
;
65
void
end_apply()
override
;
66
67
public
:
68
explicit
IdentifyDeparserZeroCandidates
(
PhvInfo
&p,
const
FieldDefUse
&d,
69
const
ReductionOrInfo
&ri,
const
PragmaDeparserZero
&f,
70
ordered_set<const PHV::Field *>
&c)
71
: phv(p), defuse(d), red_info(ri), pragmaFields(f), candidateFields(c) {}
72
};
73
76
class
ImplementDeparserZero
:
public
Transform
{
77
private
:
78
PhvInfo
&phv;
79
const
ordered_set<const PHV::Field *>
&candidateFields;
80
const
ClotInfo
&clots;
81
82
IR::Node
*preorder(IR::BFN::Extract *extract)
override
;
83
IR::Node
*preorder(IR::MAU::Instruction *inst)
override
;
84
85
public
:
86
explicit
ImplementDeparserZero
(
PhvInfo
&p,
const
ordered_set<const PHV::Field *>
&c,
87
const
ClotInfo
&ci)
88
: phv(p), candidateFields(c), clots(ci) {}
89
};
90
91
class
DeparserZeroOptimization
:
public
PassManager
{
92
private
:
93
ordered_set<const PHV::Field *>
candidateFields;
94
95
public
:
96
explicit
DeparserZeroOptimization
(
PhvInfo
&p,
const
FieldDefUse
&d,
const
ReductionOrInfo
&ri,
97
const
PragmaDeparserZero
&pf,
const
ClotInfo
&c);
98
};
99
100
#endif
/* BF_P4C_PHV_ANALYSIS_DEPARSER_ZERO_H_ */
ClotInfo
Definition
clot_info.h:41
DeparserZeroOptimization
Definition
deparser_zero.h:91
IdentifyDeparserZeroCandidates
Definition
deparser_zero.h:40
ImplementDeparserZero
Definition
deparser_zero.h:76
P4::IR::Node
Definition
node.h:94
P4::Inspector
Definition
visitor.h:400
P4::PassManager
Definition
ir/pass_manager.h:40
P4::Transform
Definition
visitor.h:424
P4::Visitor::profile_t
Definition
visitor.h:78
P4::bitvec
Definition
bitvec.h:120
P4::ordered_set
Definition
ordered_set.h:32
PhvInfo
Definition
phv_fields.h:1095
PragmaDeparserZero
Definition
pa_deparser_zero.h:30
FieldDefUse
Definition
field_defuse.h:77
ReductionOrInfo
Definition
reduction_or.h:47
backends
tofino
bf-p4c
phv
analysis
deparser_zero.h
Generated by
1.12.0