File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ class Rule final {
38
38
// / The written requirement ID, which can be used to index into the
39
39
// / \c WrittenRequirements array in the rewrite system to retrieve
40
40
// / the structural requirement.
41
- Optional<unsigned > requirementID;
41
+ // /
42
+ // / This uses a biased representation where an ID of 0 means 'no ID',
43
+ // / otherwise the value is the actual ID plus one.
44
+ unsigned RequirementID : 16 ;
42
45
43
46
// / A 'permanent' rule cannot be deleted by homotopy reduction. These
44
47
// / do not correspond to generic requirements and are re-added when the
@@ -83,6 +86,7 @@ class Rule final {
83
86
public:
84
87
Rule (Term lhs, Term rhs)
85
88
: LHS(lhs), RHS(rhs) {
89
+ RequirementID = 0 ;
86
90
Permanent = false ;
87
91
Explicit = false ;
88
92
LHSSimplified = false ;
@@ -97,12 +101,18 @@ class Rule final {
97
101
const Term &getRHS () const { return RHS; }
98
102
99
103
Optional<unsigned > getRequirementID () const {
100
- return requirementID;
104
+ if (RequirementID == 0 )
105
+ return None;
106
+ else
107
+ return RequirementID - 1 ;
101
108
}
102
109
103
110
void setRequirementID (Optional<unsigned > requirementID) {
104
111
assert (!Frozen);
105
- this ->requirementID = requirementID;
112
+ if (!requirementID)
113
+ RequirementID = 0 ;
114
+ else
115
+ RequirementID = *requirementID + 1 ;
106
116
}
107
117
108
118
Optional<Symbol> isPropertyRule () const ;
@@ -209,7 +219,7 @@ class Rule final {
209
219
210
220
void freeze () {
211
221
Redundant = false ;
212
- requirementID = None ;
222
+ RequirementID = 0 ;
213
223
Frozen = true ;
214
224
}
215
225
You can’t perform that action at this time.
0 commit comments