@@ -61,21 +61,23 @@ enum class IdKind { Symbol, Local, Domain, Range, SetDim = Range };
61
61
// / be implemented as a space with zero domain. IdKind::SetDim should be used
62
62
// / to refer to dimensions in such spaces.
63
63
// /
64
- // / PresburgerSpace does not allow identifiers of kind Local. See
65
- // / PresburgerLocalSpace for an extension that does allow local identifiers.
64
+ // / Compatibility of two spaces implies that number of identifiers of each kind
65
+ // / other than Locals are equal. Equality of two spaces implies that number of
66
+ // / identifiers of each kind are equal.
66
67
class PresburgerSpace {
67
- friend PresburgerLocalSpace;
68
-
69
68
public:
70
- PresburgerSpace (unsigned numDomain, unsigned numRange, unsigned numSymbols)
71
- : PresburgerSpace(numDomain, numRange, numSymbols, 0 ) {}
69
+ PresburgerSpace (unsigned numDomain = 0 , unsigned numRange = 0 ,
70
+ unsigned numSymbols = 0 , unsigned numLocals = 0 )
71
+ : numDomain(numDomain), numRange(numRange), numSymbols(numSymbols),
72
+ numLocals (numLocals) {}
72
73
73
74
virtual ~PresburgerSpace () = default ;
74
75
75
76
unsigned getNumDomainIds () const { return numDomain; }
76
77
unsigned getNumRangeIds () const { return numRange; }
77
- unsigned getNumSymbolIds () const { return numSymbols; }
78
78
unsigned getNumSetDimIds () const { return numRange; }
79
+ unsigned getNumSymbolIds () const { return numSymbols; }
80
+ unsigned getNumLocalIds () const { return numLocals; }
79
81
80
82
unsigned getNumDimIds () const { return numDomain + numRange; }
81
83
unsigned getNumDimAndSymbolIds () const {
@@ -113,9 +115,14 @@ class PresburgerSpace {
113
115
// / some ids at the end. `num` must be less than the current number.
114
116
void truncateIdKind (IdKind kind, unsigned num);
115
117
116
- // / Returns true if both the spaces are equal i.e. if both spaces have the
117
- // / same number of identifiers of each kind (excluding Local Identifiers).
118
- bool isEqual (const PresburgerSpace &other) const ;
118
+ // / Returns true if both the spaces are compatible i.e. if both spaces have
119
+ // / the same number of identifiers of each kind (excluding locals).
120
+ bool isSpaceCompatible (const PresburgerSpace &other) const ;
121
+
122
+ // / Returns true if both the spaces are equal including local identifiers i.e.
123
+ // / if both spaces have the same number of identifiers of each kind (including
124
+ // / locals).
125
+ bool isSpaceEqual (const PresburgerSpace &other) const ;
119
126
120
127
// / Changes the partition between dimensions and symbols. Depending on the new
121
128
// / symbol count, either a chunk of dimensional identifiers immediately before
@@ -127,11 +134,6 @@ class PresburgerSpace {
127
134
void dump () const ;
128
135
129
136
private:
130
- PresburgerSpace (unsigned numDomain, unsigned numRange, unsigned numSymbols,
131
- unsigned numLocals)
132
- : numDomain(numDomain), numRange(numRange), numSymbols(numSymbols),
133
- numLocals (numLocals) {}
134
-
135
137
// Number of identifiers corresponding to domain identifiers.
136
138
unsigned numDomain;
137
139
@@ -147,32 +149,6 @@ class PresburgerSpace {
147
149
unsigned numLocals;
148
150
};
149
151
150
- // / Extension of PresburgerSpace supporting Local identifiers.
151
- class PresburgerLocalSpace : public PresburgerSpace {
152
- public:
153
- PresburgerLocalSpace (unsigned numDomain, unsigned numRange,
154
- unsigned numSymbols, unsigned numLocals)
155
- : PresburgerSpace(numDomain, numRange, numSymbols, numLocals) {}
156
-
157
- unsigned getNumLocalIds () const { return numLocals; }
158
-
159
- // / Insert `num` identifiers of the specified kind at position `pos`.
160
- // / Positions are relative to the kind of identifier. Return the absolute
161
- // / column position (i.e., not relative to the kind of identifier) of the
162
- // / first added identifier.
163
- unsigned insertId (IdKind kind, unsigned pos, unsigned num = 1 ) override ;
164
-
165
- // / Removes identifiers in the column range [idStart, idLimit).
166
- void removeIdRange (IdKind kind, unsigned idStart, unsigned idLimit) override ;
167
-
168
- // / Returns true if both the spaces are equal i.e. if both spaces have the
169
- // / same number of identifiers of each kind.
170
- bool isEqual (const PresburgerLocalSpace &other) const ;
171
-
172
- void print (llvm::raw_ostream &os) const ;
173
- void dump () const ;
174
- };
175
-
176
152
} // namespace presburger
177
153
} // namespace mlir
178
154
0 commit comments