63 std::set<int> candidatesToRemove;
65 std::set<int> methodCallStatementsToRemove;
67 class DoFoldConstantHashes :
public Transform {
70 bool checkConstantInput(
const IR::Expression *expr);
71 void foldListToConstant(uint64_t &value,
size_t &shift,
const IR::ListExpression *list);
72 void foldListToConstant(uint64_t &value,
size_t &shift,
const IR::StructExpression *list);
73 const IR::Expression *substituteIdentityHash(
const IR::ListExpression *hash_list,
74 const IR::Type *hash_type);
75 const IR::Expression *substituteIdentityHash(
const IR::StructExpression *hash_list,
76 const IR::Type *hash_type);
79 const IR::ListExpression *hash_list,
const IR::Type *hash_type);
81 const IR::StructExpression *hash_list,
const IR::Type *hash_type);
82 const IR::Expression *substituteCustomHash(
const IR::PathExpression *crc_poly_path,
83 const IR::ListExpression *hash_list,
84 const IR::Type *hash_type);
85 const IR::Expression *substituteCustomHash(
const IR::PathExpression *crc_poly_path,
86 const IR::StructExpression *hash_list,
87 const IR::Type *hash_type);
88 const IR::Expression *substituteOtherHash(
const IR::Expression *hash_algo_expr,
89 const IR::ListExpression *hash_list,
90 const IR::Type *hash_type);
91 const IR::Expression *substituteOtherHash(
const IR::Expression *hash_algo_expr,
92 const IR::StructExpression *hash_list,
93 const IR::Type *hash_type);
97 const IR::Node *preorder(IR::MethodCallExpression *mce)
override;
100 class CheckCandidesToRemove :
public Transform {
105 const IR::Node *preorder(IR::PathExpression *path)
override;
108 class RemoveHangingCandidates :
public Transform {
113 const IR::Node *preorder(IR::Declaration_Instance *decl)
override;
114 const IR::Node *preorder(IR::MethodCallStatement *mcs)
override;
117 const IR::Type *checkHashExtern(
const IR::Declaration_Instance *decl);
122 : refMap(refMap), typeMap(typeMap) {
124 addPasses({typeChecking,
new DoFoldConstantHashes(*
this),
new P4::ClearTypeMap(typeMap),
125 typeChecking,
new CheckCandidesToRemove(*
this),