10
10
//
11
11
// ===----------------------------------------------------------------------===//
12
12
//
13
- //
14
13
// This file implements the algorithm for computing a minimal set of rules from
15
14
// a confluent rewrite system. A minimal set of rules is:
16
15
//
@@ -76,7 +75,10 @@ using namespace rewriting;
76
75
llvm::SmallVector<unsigned , 1 >
77
76
RewriteLoop::findRulesAppearingOnceInEmptyContext (
78
77
const RewriteSystem &system) const {
78
+ // Rules appearing in empty context (possibly more than once).
79
79
llvm::SmallDenseSet<unsigned , 2 > rulesInEmptyContext;
80
+
81
+ // The number of times each rule appears (with or without context).
80
82
llvm::SmallDenseMap<unsigned , unsigned , 2 > ruleMultiplicity;
81
83
82
84
RewritePathEvaluator evaluator (Basepoint);
@@ -100,6 +102,7 @@ RewriteLoop::findRulesAppearingOnceInEmptyContext(
100
102
step.apply (evaluator, system);
101
103
}
102
104
105
+ // Collect all rules that we saw exactly once in empty context.
103
106
SmallVector<unsigned , 1 > result;
104
107
for (auto rule : rulesInEmptyContext) {
105
108
auto found = ruleMultiplicity.find (rule);
@@ -759,8 +762,10 @@ void RewriteSystem::minimizeRewriteSystem() {
759
762
// Now find a minimal set of generating conformances.
760
763
//
761
764
// FIXME: For now this just produces a set of redundant conformances, but
762
- // it should actually compute the full generating conformance basis, since
763
- // we want to use the same information for finding conformance access paths.
765
+ // it should actually output the canonical generating conformance equation
766
+ // for each non-generating conformance. We can then use information to
767
+ // compute conformance access paths, instead of the current "brute force"
768
+ // algorithm used for that purpose.
764
769
llvm::DenseSet<unsigned > redundantConformances;
765
770
computeGeneratingConformances (redundantConformances);
766
771
0 commit comments