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
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:
69 const ReductionOrInfo &ri, const PragmaDeparserZero &f,
71 : phv(p), defuse(d), red_info(ri), pragmaFields(f), candidateFields(c) {}
72};
73
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:
87 const ClotInfo &ci)
88 : phv(p), candidateFields(c), clots(ci) {}
89};
90
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_ */
Definition clot_info.h:41
Definition deparser_zero.h:91
Definition deparser_zero.h:40
Definition deparser_zero.h:76
Definition node.h:94
Definition visitor.h:400
Definition ir/pass_manager.h:40
Definition visitor.h:424
Definition visitor.h:78
Definition bitvec.h:120
Definition ordered_set.h:32
Definition phv_fields.h:1095
Definition pa_deparser_zero.h:30
Definition field_defuse.h:77
Definition reduction_or.h:47