@@ -90,7 +90,7 @@ struct DenseMapInfo<swift::PartitionPrimitives::Region> {
90
90
91
91
namespace swift {
92
92
93
- class IsolationRegionInfo {
93
+ class SILIsolationInfo {
94
94
public:
95
95
// / The lattice is:
96
96
// /
@@ -117,15 +117,14 @@ class IsolationRegionInfo {
117
117
> data;
118
118
// clang-format on
119
119
120
- IsolationRegionInfo (Kind kind, std::optional<ActorIsolation> actorIsolation)
120
+ SILIsolationInfo (Kind kind, std::optional<ActorIsolation> actorIsolation)
121
121
: kind(kind), data(actorIsolation) {}
122
- IsolationRegionInfo (Kind kind, NominalTypeDecl *decl)
123
- : kind(kind), data(decl) {}
122
+ SILIsolationInfo (Kind kind, NominalTypeDecl *decl) : kind(kind), data(decl) {}
124
123
125
- IsolationRegionInfo (Kind kind, SILValue value) : kind(kind), data(value) {}
124
+ SILIsolationInfo (Kind kind, SILValue value) : kind(kind), data(value) {}
126
125
127
126
public:
128
- IsolationRegionInfo () : kind(Kind::Unknown), data() {}
127
+ SILIsolationInfo () : kind(Kind::Unknown), data() {}
129
128
130
129
operator bool () const { return kind != Kind::Unknown; }
131
130
@@ -215,7 +214,7 @@ class IsolationRegionInfo {
215
214
return nullptr ;
216
215
}
217
216
218
- [[nodiscard]] IsolationRegionInfo merge (IsolationRegionInfo other) const {
217
+ [[nodiscard]] SILIsolationInfo merge (SILIsolationInfo other) const {
219
218
// If we are greater than the other kind, then we are further along the
220
219
// lattice. We ignore the change.
221
220
if (unsigned (other.kind ) < unsigned (kind))
@@ -230,21 +229,19 @@ class IsolationRegionInfo {
230
229
return other;
231
230
}
232
231
233
- IsolationRegionInfo withActorIsolated (ActorIsolation isolation) {
234
- return IsolationRegionInfo ::getActorIsolated (isolation);
232
+ SILIsolationInfo withActorIsolated (ActorIsolation isolation) {
233
+ return SILIsolationInfo ::getActorIsolated (isolation);
235
234
}
236
235
237
- static IsolationRegionInfo getDisconnected () {
238
- return {Kind::Disconnected, {}};
239
- }
236
+ static SILIsolationInfo getDisconnected () { return {Kind::Disconnected, {}}; }
240
237
241
- static IsolationRegionInfo getActorIsolated (ActorIsolation actorIsolation) {
238
+ static SILIsolationInfo getActorIsolated (ActorIsolation actorIsolation) {
242
239
return {Kind::Actor, actorIsolation};
243
240
}
244
241
245
242
// / Sometimes we may have something that is actor isolated or that comes from
246
243
// / a type. First try getActorIsolation and otherwise, just use the type.
247
- static IsolationRegionInfo getActorIsolated (NominalTypeDecl *nomDecl) {
244
+ static SILIsolationInfo getActorIsolated (NominalTypeDecl *nomDecl) {
248
245
auto actorIsolation = swift::getActorIsolation (nomDecl);
249
246
if (actorIsolation.isActorIsolated ())
250
247
return getActorIsolated (actorIsolation);
@@ -253,14 +250,14 @@ class IsolationRegionInfo {
253
250
return {};
254
251
}
255
252
256
- static IsolationRegionInfo getTaskIsolated (SILValue value) {
253
+ static SILIsolationInfo getTaskIsolated (SILValue value) {
257
254
return {Kind::Task, value};
258
255
}
259
256
260
257
// / Attempt to infer the isolation region info for \p inst.
261
- static IsolationRegionInfo get (SILInstruction *inst);
258
+ static SILIsolationInfo get (SILInstruction *inst);
262
259
263
- bool operator ==(const IsolationRegionInfo &other) const {
260
+ bool operator ==(const SILIsolationInfo &other) const {
264
261
if (getKind () != other.getKind ())
265
262
return false ;
266
263
@@ -1239,16 +1236,17 @@ struct PartitionOpEvaluator {
1239
1236
}
1240
1237
1241
1238
// / Call handleTransferNonTransferrable on our CRTP subclass.
1242
- void handleTransferNonTransferrable (
1243
- const PartitionOp &op, Element elt,
1244
- IsolationRegionInfo isolationRegionInfo) const {
1239
+ void
1240
+ handleTransferNonTransferrable ( const PartitionOp &op, Element elt,
1241
+ SILIsolationInfo isolationRegionInfo) const {
1245
1242
return asImpl ().handleTransferNonTransferrable (op, elt,
1246
1243
isolationRegionInfo);
1247
1244
}
1248
1245
// / Just call our CRTP subclass.
1249
- void handleTransferNonTransferrable (
1250
- const PartitionOp &op, Element elt, Element otherElement,
1251
- IsolationRegionInfo isolationRegionInfo) const {
1246
+ void
1247
+ handleTransferNonTransferrable (const PartitionOp &op, Element elt,
1248
+ Element otherElement,
1249
+ SILIsolationInfo isolationRegionInfo) const {
1252
1250
return asImpl ().handleTransferNonTransferrable (op, elt, otherElement,
1253
1251
isolationRegionInfo);
1254
1252
}
@@ -1258,18 +1256,18 @@ struct PartitionOpEvaluator {
1258
1256
return asImpl ().isActorDerived (elt);
1259
1257
}
1260
1258
1261
- IsolationRegionInfo getIsolationRegionInfo (Element elt) const {
1259
+ SILIsolationInfo getIsolationRegionInfo (Element elt) const {
1262
1260
return asImpl ().getIsolationRegionInfo (elt);
1263
1261
}
1264
1262
1265
1263
// / Compute the isolation region info for all elements in \p region.
1266
1264
// /
1267
1265
// / The bool result is if it is captured by a closure element. That only is
1268
1266
// / computed if \p sourceOp is non-null.
1269
- std::pair<IsolationRegionInfo , bool >
1267
+ std::pair<SILIsolationInfo , bool >
1270
1268
getIsolationRegionInfo (Region region, Operand *sourceOp) const {
1271
1269
bool isClosureCapturedElt = false ;
1272
- IsolationRegionInfo isolationRegionInfo;
1270
+ SILIsolationInfo isolationRegionInfo;
1273
1271
1274
1272
for (const auto &pair : p.range ()) {
1275
1273
if (pair.second == region) {
@@ -1284,7 +1282,7 @@ struct PartitionOpEvaluator {
1284
1282
}
1285
1283
1286
1284
// / Overload of \p getIsolationRegionInfo without an Operand.
1287
- IsolationRegionInfo getIsolationRegionInfo (Region region) const {
1285
+ SILIsolationInfo getIsolationRegionInfo (Region region) const {
1288
1286
return getIsolationRegionInfo (region, nullptr ).first ;
1289
1287
}
1290
1288
@@ -1352,7 +1350,7 @@ struct PartitionOpEvaluator {
1352
1350
Element transferredElement = op.getOpArgs ()[0 ];
1353
1351
Region transferredRegion = p.getRegion (transferredElement);
1354
1352
bool isClosureCapturedElt = false ;
1355
- IsolationRegionInfo transferredRegionIsolation;
1353
+ SILIsolationInfo transferredRegionIsolation;
1356
1354
std::tie (transferredRegionIsolation, isClosureCapturedElt) =
1357
1355
getIsolationRegionInfo (transferredRegion, op.getSourceOp ());
1358
1356
@@ -1464,11 +1462,12 @@ struct PartitionOpEvaluatorBaseImpl : PartitionOpEvaluator<Subclass> {
1464
1462
// / This is called if we detect a never transferred element that was passed to
1465
1463
// / a transfer instruction.
1466
1464
void handleTransferNonTransferrable (const PartitionOp &op, Element elt,
1467
- IsolationRegionInfo regionInfo) const {}
1465
+ SILIsolationInfo regionInfo) const {}
1468
1466
1469
- void handleTransferNonTransferrable (
1470
- const PartitionOp &op, Element elt, Element otherElement,
1471
- IsolationRegionInfo isolationRegionInfo) const {}
1467
+ void
1468
+ handleTransferNonTransferrable (const PartitionOp &op, Element elt,
1469
+ Element otherElement,
1470
+ SILIsolationInfo isolationRegionInfo) const {}
1472
1471
1473
1472
// / This is used to determine if an element is actor derived. If we determine
1474
1473
// / that a region containing such an element is transferred, we emit an error
@@ -1481,8 +1480,8 @@ struct PartitionOpEvaluatorBaseImpl : PartitionOpEvaluator<Subclass> {
1481
1480
1482
1481
// / Returns the information about \p elt's isolation that we ascertained from
1483
1482
// / SIL and the AST.
1484
- IsolationRegionInfo getIsolationRegionInfo (Element elt) const {
1485
- return IsolationRegionInfo ();
1483
+ SILIsolationInfo getIsolationRegionInfo (Element elt) const {
1484
+ return SILIsolationInfo ();
1486
1485
}
1487
1486
1488
1487
// / Check if the representative value of \p elt is closure captured at \p
0 commit comments