@@ -192,12 +192,6 @@ class MinimalConformances {
192
192
// minimization domain.
193
193
llvm::DenseSet<unsigned > &RedundantConformances;
194
194
195
- void decomposeTermIntoConformanceRuleLeftHandSides (
196
- MutableTerm term,
197
- SmallVectorImpl<unsigned > &result) const ;
198
- void decomposeTermIntoConformanceRuleLeftHandSides (
199
- MutableTerm term, unsigned ruleID,
200
- SmallVectorImpl<unsigned > &result) const ;
201
195
202
196
bool isConformanceRuleRecoverable (
203
197
llvm::SmallDenseSet<unsigned , 4 > &visited,
@@ -252,18 +246,18 @@ class MinimalConformances {
252
246
// /
253
247
// / The term should be irreducible, except for a protocol symbol at the end.
254
248
void
255
- MinimalConformances ::decomposeTermIntoConformanceRuleLeftHandSides (
249
+ RewriteSystem ::decomposeTermIntoConformanceRuleLeftHandSides (
256
250
MutableTerm term, SmallVectorImpl<unsigned > &result) const {
257
251
assert (term.back ().getKind () == Symbol::Kind::Protocol);
258
252
259
253
// If T is canonical and T.[P] => T, then by confluence, T.[P]
260
254
// reduces to T in a single step, via a rule V.[P] => V, where
261
255
// T == U.V.
262
256
RewritePath steps;
263
- bool simplified = System. simplify (term, &steps);
257
+ bool simplified = simplify (term, &steps);
264
258
if (!simplified) {
265
259
llvm::errs () << " Term does not conform to protocol: " << term << " \n " ;
266
- System. dump (llvm::errs ());
260
+ dump (llvm::errs ());
267
261
abort ();
268
262
}
269
263
@@ -273,7 +267,7 @@ MinimalConformances::decomposeTermIntoConformanceRuleLeftHandSides(
273
267
const auto &step = *steps.begin ();
274
268
275
269
#ifndef NDEBUG
276
- const auto &rule = System. getRule (step.getRuleID ());
270
+ const auto &rule = getRule (step.getRuleID ());
277
271
assert (rule.isAnyConformanceRule ());
278
272
assert (!rule.isIdentityConformanceRule ());
279
273
#endif
@@ -296,13 +290,13 @@ MinimalConformances::decomposeTermIntoConformanceRuleLeftHandSides(
296
290
}
297
291
298
292
// / Given a term U and a rule (V.[P] => V), write U.[domain(V)] as a
299
- // / product of left hand sdies of conformance rules. The term U should
293
+ // / product of left hand sides of conformance rules. The term U should
300
294
// / be irreducible.
301
295
void
302
- MinimalConformances ::decomposeTermIntoConformanceRuleLeftHandSides (
296
+ RewriteSystem ::decomposeTermIntoConformanceRuleLeftHandSides (
303
297
MutableTerm term, unsigned ruleID,
304
298
SmallVectorImpl<unsigned > &result) const {
305
- const auto &rule = System. getRule (ruleID);
299
+ const auto &rule = getRule (ruleID);
306
300
assert (rule.isAnyConformanceRule ());
307
301
assert (!rule.isIdentityConformanceRule ());
308
302
@@ -416,7 +410,8 @@ void MinimalConformances::collectConformanceRules() {
416
410
mutTerm.add (Symbol::forProtocol (parentProto, Context));
417
411
418
412
// Get a conformance path for X.[P] and record it.
419
- decomposeTermIntoConformanceRuleLeftHandSides (mutTerm, ParentPaths[ruleID]);
413
+ System.decomposeTermIntoConformanceRuleLeftHandSides (
414
+ mutTerm, ParentPaths[ruleID]);
420
415
}
421
416
}
422
417
@@ -604,8 +599,8 @@ void MinimalConformances::computeCandidateConformancePaths() {
604
599
605
600
// Write U'.[domain(V)] as a product of left hand sides of protocol
606
601
// conformance rules.
607
- decomposeTermIntoConformanceRuleLeftHandSides (term, pair. second ,
608
- conformancePath);
602
+ System. decomposeTermIntoConformanceRuleLeftHandSides (
603
+ term, pair. second , conformancePath);
609
604
610
605
// This decomposition defines a conformance access path for each
611
606
// conformance rule we saw in empty context.
@@ -947,7 +942,7 @@ void MinimalConformances::dumpMinimalConformances(
947
942
// / already eliminated all redundant rewrite rules that are not
948
943
// / conformance rules.
949
944
void RewriteSystem::computeMinimalConformances (
950
- llvm::DenseSet<unsigned > &redundantConformances) {
945
+ llvm::DenseSet<unsigned > &redundantConformances) const {
951
946
MinimalConformances builder (*this , redundantConformances);
952
947
953
948
builder.collectConformanceRules ();
0 commit comments