@@ -131,12 +131,23 @@ class MemoryLocations {
131
131
// / \endcode
132
132
int parentIdx;
133
133
134
+ private:
135
+ friend class MemoryLocations ;
136
+
134
137
// / Used to decide if a location is completely covered by its sub-locations.
135
138
// /
136
139
// / -1 means: not yet initialized.
137
140
int numFieldsNotCoveredBySubfields = -1 ;
138
141
142
+ // / The same as ``numFieldsNotCoveredBySubfields``, just for non-trivial
143
+ // / fields.
144
+ // /
145
+ // / -1 means: not yet initialized.
146
+ int numNonTrivialFieldsNotCovered = -1 ;
147
+
139
148
Location (SILValue val, unsigned index, int parentIdx = -1 );
149
+
150
+ void updateFieldCounters (SILType ty, int increment);
140
151
};
141
152
142
153
private:
@@ -156,6 +167,9 @@ class MemoryLocations {
156
167
// / small. They can be handled separately with handleSingleBlockLocations().
157
168
llvm::SmallVector<SingleValueInstruction *, 16 > singleBlockLocations;
158
169
170
+ // / The bit-set of locations for which numNonTrivialFieldsNotCovered is > 0.
171
+ Bits nonTrivialLocations;
172
+
159
173
public:
160
174
MemoryLocations () {}
161
175
@@ -220,6 +234,10 @@ class MemoryLocations {
220
234
void handleSingleBlockLocations (
221
235
std::function<void (SILBasicBlock *block)> handlerFunc);
222
236
237
+ // / Returns the set of locations for which have non trivial fields which are
238
+ // / not covered by sub-fields.
239
+ const Bits &getNonTrivialLocations ();
240
+
223
241
// / Debug dump the MemoryLifetime internals.
224
242
void dump () const ;
225
243
@@ -249,11 +267,6 @@ class MemoryLocations {
249
267
250
268
// / Calculates Location::numFieldsNotCoveredBySubfields
251
269
void initFieldsCounter (Location &loc);
252
-
253
- // / Only memory locations which store a non-trivial type are considered.
254
- bool shouldTrackLocation (SILType type, SILFunction *inFunction) {
255
- return !type.isTrivial (*inFunction);
256
- }
257
270
};
258
271
259
272
// / The MemoryDataflow utility calculates global dataflow of memory locations.
0 commit comments