P4C
The P4 Compiler
Loading...
Searching...
No Matches
dark.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_DARK_H_
20#define BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_DARK_H_
21
22#include "backends/tofino/bf-p4c/common/field_defuse.h"
23#include "backends/tofino/bf-p4c/mau/mau_visitor.h"
24#include "backends/tofino/bf-p4c/phv/analysis/mocha.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
34 private:
35 const PhvInfo &phv;
36 const ReductionOrInfo &red_info;
37 bitvec nonDarkMauUses;
38
39 profile_t init_apply(const IR::Node *root) override;
40 bool preorder(const IR::MAU::Table *) override;
41 bool preorder(const IR::Expression *) override;
42 bool preorder(const IR::MAU::Action *) override;
43 bool contextNeedsIXBar();
44
45 public:
46 CollectNonDarkUses(const PhvInfo &p, const ReductionOrInfo &ri) : phv(p), red_info(ri) {}
47
48 bool hasNonDarkUse(const PHV::Field *f) const;
49};
50
62 private:
63 PhvInfo &phv;
64 const PhvUse &uses;
65 const CollectNonDarkUses &nonDarkUses;
66
69 bitvec nonDarkMauUses;
70
72 size_t darkCount;
74 size_t darkSize;
75
76 profile_t init_apply(const IR::Node *root) override;
77 void end_apply() override;
78
79 public:
80 explicit MarkDarkCandidates(PhvInfo &p, const PhvUse &u, const CollectNonDarkUses &d)
81 : phv(p), uses(u), nonDarkUses(d), darkCount(0), darkSize(0) {}
82};
83
85 private:
86 CollectNonDarkUses nonDarkUses;
87
88 public:
89 CollectDarkCandidates(PhvInfo &p, PhvUse &u, const ReductionOrInfo &ri) : nonDarkUses(p, ri) {
90 addPasses({&nonDarkUses, new MarkDarkCandidates(p, u, nonDarkUses)});
91 }
92};
93
94#endif /* BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_DARK_H_ */
Definition dark.h:84
Definition dark.h:33
Definition dark.h:61
Definition mau_visitor.h:29
Definition node.h:94
Definition visitor.h:400
Definition ir/pass_manager.h:40
Definition visitor.h:78
Definition bitvec.h:120
Definition phv_fields.h:154
Definition phv_fields.h:1095
Definition phv_parde_mau_use.h:154
Definition reduction_or.h:47