Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit cb2002f

Browse files
committed
temp
1 parent 0d4e7c6 commit cb2002f

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tools/generalize.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,9 @@ void Generalize(InstContext &IC, Solver *S, ParsedReplacement Input) {
6565
}
6666

6767
void SymbolizeAndGeneralize(InstContext &IC,
68-
Solver *S, ParsedReplacement Input) {
69-
std::vector<Inst *> LHSConsts, RHSConsts;
70-
auto Pred = [](Inst *I) {return I->K == Inst::Const;};
71-
findInsts(Input.Mapping.LHS, LHSConsts, Pred);
72-
findInsts(Input.Mapping.RHS, RHSConsts, Pred);
73-
68+
Solver *S, ParsedReplacement Input,
69+
std::vector<Inst *> LHSConsts,
70+
std::vector<Inst *> RHSConsts) {
7471
if (RHSConsts.size() != 1) {
7572
return;
7673
// TODO: Relax this restriction later
@@ -182,6 +179,23 @@ void SymbolizeAndGeneralize(InstContext &IC,
182179
}
183180
}
184181

182+
void SymbolizeAndGeneralize(InstContext &IC,
183+
Solver *S, ParsedReplacement Input) {
184+
std::vector<Inst *> LHSConsts, RHSConsts;
185+
auto Pred = [](Inst *I) {return I->K == Inst::Const;};
186+
findInsts(Input.Mapping.LHS, LHSConsts, Pred);
187+
findInsts(Input.Mapping.RHS, RHSConsts, Pred);
188+
// One LHS const at a time
189+
for (auto LHSConst : LHSConsts) {
190+
SymbolizeAndGeneralize(IC, S, Input, {LHSConst}, RHSConsts);
191+
}
192+
193+
// All at once
194+
SymbolizeAndGeneralize(IC, S, Input, LHSConsts, RHSConsts);
195+
196+
// TODO Find other useful configurations
197+
}
198+
185199
// TODO: Return modified instructions instead of just printing out
186200
void RemoveLeafAndGeneralize(InstContext &IC,
187201
Solver *S, ParsedReplacement Input) {

0 commit comments

Comments
 (0)