48 enum phv_types_t { NORMAL = 1, MOCHA = (1 << 1), DARK = (1 << 2), TPHV = (1 << 3) };
50 enum field_types_t { HEADER = 1, METADATA = (1 << 1), POV = (1 << 2) };
52 enum use_types_t { MATCH = 1, READ = (1 << 1), WRITE = (1 << 2) };
58 std::vector<const IR::MAU::Table *> tableStack;
74 bool preorder(
const IR::MAU::Table *tbl)
override;
75 bool preorder(
const IR::MAU::TableKey *read)
override;
76 bool preorder(
const IR::MAU::Action *act)
override;
77 void postorder(
const IR::MAU::Table *tbl)
override;
78 void end_apply()
override;
80 size_t totalBits()
const;
81 size_t totalAllocatedBits()
const;
82 size_t totalPhvBits()
const;
83 size_t totalTPhvBits();
84 size_t totalHeaderBits()
const;
85 size_t totalMetadataBits()
const;
86 size_t totalPOVBits()
const;
88 size_t usedInPardeMetadata()
const;
90 size_t usedInMau()
const;
91 size_t usedInPardeHeader()
const;
92 size_t usedInPardePOV()
const;
94 size_t ingressPhvBits()
const;
95 size_t egressPhvBits()
const;
96 size_t ingressTPhvBits()
const;
97 size_t egressTPhvBits()
const;
100 size_t aluUseBitsHeader()
const;
101 size_t aluUseBitsMetadata()
const;
102 size_t aluUseBitsPOV()
const;
104 size_t matchingBitsTotal();
106 size_t determineDarkCandidates();
107 size_t determineMochaCandidates();
109 int longestDependenceChain()
const;
110 void printFieldLiveness(
int maxStages);
112 void assessCandidacy(
const PHV::Field *f,
int maxStages);
113 void printCandidacy(
int maxStages);
114 void printStagewiseStats(
int maxStages);
115 void fixPHVAllocation(
const PHV::Field *f,
int maxStages);
116 void fixMochaAllocation(
const PHV::Field *f,
int maxStages);
120 bool isGress(
const PHV::Field *f, gress_t gress)
const;
125 : phv(p), uses(u), dg(g), actions(a) {}