P4C
The P4 Compiler
Loading...
Searching...
No Matches
non_mocha_dark_fields.h
1
19#ifndef P4C_BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_NON_MOCHA_DARK_FIELDS_H_
20#define P4C_BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_NON_MOCHA_DARK_FIELDS_H_
21
22#include "backends/tofino/bf-p4c/common/field_defuse.h"
23#include "backends/tofino/bf-p4c/mau/action_analysis.h"
24#include "backends/tofino/bf-p4c/phv/phv.h"
25#include "backends/tofino/bf-p4c/phv/phv_fields.h"
26#include "backends/tofino/bf-p4c/phv/pragma/phv_pragmas.h"
27#include "ir/ir.h"
28
30 public:
31 using FieldMap = std::map<const int, std::map<const IR::MAU::Table *, PHV::FieldUse>>;
32
33 private:
34 static const PHV::FieldUse READ;
35 static const PHV::FieldUse WRITE;
36
37 const PhvInfo &phv;
38 const PhvUse &uses;
39 const FieldDefUse &defuse;
40 const ReductionOrInfo &red_info;
41
44 const ordered_set<const PHV::Field *> &noInitFields;
46 const ordered_set<const PHV::Field *> &notParsedFields;
48 const ordered_set<const PHV::Field *> &notDeparsedFields;
49
50 FieldMap nonDark;
51 FieldMap nonMocha;
52
53 profile_t init_apply(const IR::Node *root) override;
54 bool preorder(const IR::MAU::Action *act) override;
55 void end_apply() override;
56
57 public:
58 NonMochaDarkFields(const PhvInfo &phv, const PhvUse &uses, const FieldDefUse &defuse,
59 const ReductionOrInfo &ri, const PHV::Pragmas &pragmas)
60 : phv(phv),
61 uses(uses),
62 defuse(defuse),
63 red_info(ri),
64 noInitFields(pragmas.pa_no_init().getFields()),
65 notParsedFields(pragmas.pa_deparser_zero().getNotDeparsedFields()),
66 notDeparsedFields(pragmas.pa_deparser_zero().getNotDeparsedFields()) {}
67
68 PHV::FieldUse isNotMocha(const PHV::Field *field, const IR::MAU::Table *tbl = nullptr) const;
69
70 PHV::FieldUse isNotDark(const PHV::Field *field, const IR::MAU::Table *tbl = nullptr) const;
71
72 const FieldMap &getNonMocha() const { return nonMocha; }
73
74 const FieldMap &getNonDark() const { return nonDark; }
75};
76
77#endif /* P4C_BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_NON_MOCHA_DARK_FIELDS_H_ */
Definition non_mocha_dark_fields.h:29
Definition node.h:94
Definition visitor.h:400
Definition visitor.h:78
Definition ordered_set.h:32
Definition phv_fields.h:154
Definition phv.h:248
Definition phv_pragmas.h:46
Definition phv_fields.h:1095
Definition phv_parde_mau_use.h:154
const ordered_set< const PHV::Field * > & getNotDeparsedFields() const
Definition pa_deparser_zero.h:57
const ordered_set< const PHV::Field * > & getFields() const
Definition pa_no_init.h:61
Definition field_defuse.h:77
Definition reduction_or.h:47