@@ -1270,14 +1270,13 @@ class ForwardingInstruction {
1270
1270
// /
1271
1271
// / TODO: This name is extremely misleading because it may apply to an
1272
1272
// / operation that has no operand at all, like `enum .None`.
1273
- class FirstArgOwnershipForwardingSingleValueInst
1274
- : public SingleValueInstruction,
1275
- public ForwardingInstruction {
1273
+ class OwnershipForwardingSingleValueInstruction : public SingleValueInstruction ,
1274
+ public ForwardingInstruction {
1276
1275
protected:
1277
- FirstArgOwnershipForwardingSingleValueInst (SILInstructionKind kind,
1278
- SILDebugLocation debugLoc,
1279
- SILType ty,
1280
- ValueOwnershipKind ownershipKind)
1276
+ OwnershipForwardingSingleValueInstruction (SILInstructionKind kind,
1277
+ SILDebugLocation debugLoc,
1278
+ SILType ty,
1279
+ ValueOwnershipKind ownershipKind)
1281
1280
: SingleValueInstruction(kind, debugLoc, ty),
1282
1281
ForwardingInstruction (kind, ownershipKind) {
1283
1282
assert (classof (kind) && " classof missing new subclass?!" );
@@ -1297,97 +1296,8 @@ class FirstArgOwnershipForwardingSingleValueInst
1297
1296
}
1298
1297
};
1299
1298
1300
- // / An ownership forwarding single value that has a preferred operand of owned
1301
- // / but if its inputs are all none can have OwnershipKind::None as a result. We
1302
- // / assume that we always forward from operand 0.
1303
- class OwnedFirstArgForwardingSingleValueInst
1304
- : public FirstArgOwnershipForwardingSingleValueInst {
1305
- protected:
1306
- OwnedFirstArgForwardingSingleValueInst (SILInstructionKind kind,
1307
- SILDebugLocation debugLoc, SILType ty,
1308
- ValueOwnershipKind resultOwnershipKind)
1309
- : FirstArgOwnershipForwardingSingleValueInst(kind, debugLoc, ty,
1310
- resultOwnershipKind) {
1311
- assert (resultOwnershipKind.isCompatibleWith (OwnershipKind::Owned));
1312
- assert (classof (kind) && " classof missing new subclass?!" );
1313
- }
1314
-
1315
- public:
1316
- ValueOwnershipKind getPreferredOwnership () const {
1317
- return OwnershipKind::Owned;
1318
- }
1319
-
1320
- static bool classof (SILNodePointer node) {
1321
- if (auto *i = dyn_cast<SILInstruction>(node.get ()))
1322
- return classof (i);
1323
- return false ;
1324
- }
1325
-
1326
- static bool classof (SILInstructionKind kind) {
1327
- switch (kind) {
1328
- case SILInstructionKind::MarkUninitializedInst:
1329
- return true ;
1330
- default :
1331
- return false ;
1332
- }
1333
- }
1334
-
1335
- static bool classof (const SILInstruction *inst) {
1336
- return classof (inst->getKind ());
1337
- }
1338
- };
1339
-
1340
- // / An instruction that forwards guaranteed or none ownership. Assumed to always
1341
- // / forward from Operand(0) -> Result(0).
1342
- class GuaranteedFirstArgForwardingSingleValueInst
1343
- : public FirstArgOwnershipForwardingSingleValueInst {
1344
- protected:
1345
- GuaranteedFirstArgForwardingSingleValueInst (
1346
- SILInstructionKind kind, SILDebugLocation debugLoc, SILType ty,
1347
- ValueOwnershipKind resultOwnershipKind)
1348
- : FirstArgOwnershipForwardingSingleValueInst(kind, debugLoc, ty,
1349
- resultOwnershipKind) {
1350
- assert (resultOwnershipKind.isCompatibleWith (OwnershipKind::Guaranteed));
1351
- assert (classof (kind) && " classof missing new subclass?!" );
1352
- }
1353
-
1354
- public:
1355
- ValueOwnershipKind getPreferredOwnership () const {
1356
- return OwnershipKind::Guaranteed;
1357
- }
1358
-
1359
- static bool classof (SILNodePointer node) {
1360
- if (auto *i = dyn_cast<SILInstruction>(node.get ()))
1361
- return classof (i);
1362
- return false ;
1363
- }
1364
-
1365
- static bool classof (SILInstructionKind kind) {
1366
- switch (kind) {
1367
- case SILInstructionKind::TupleExtractInst:
1368
- case SILInstructionKind::StructExtractInst:
1369
- case SILInstructionKind::DifferentiableFunctionExtractInst:
1370
- case SILInstructionKind::LinearFunctionExtractInst:
1371
- case SILInstructionKind::OpenExistentialValueInst:
1372
- case SILInstructionKind::OpenExistentialBoxValueInst:
1373
- return true ;
1374
- default :
1375
- return false ;
1376
- }
1377
- }
1378
-
1379
- static bool classof (const SILInstruction *inst) {
1380
- return classof (inst->getKind ());
1381
- }
1382
- };
1383
-
1384
1299
inline bool
1385
- FirstArgOwnershipForwardingSingleValueInst::classof (SILInstructionKind kind) {
1386
- if (OwnedFirstArgForwardingSingleValueInst::classof (kind))
1387
- return true ;
1388
- if (GuaranteedFirstArgForwardingSingleValueInst::classof (kind))
1389
- return true ;
1390
-
1300
+ OwnershipForwardingSingleValueInstruction::classof (SILInstructionKind kind) {
1391
1301
switch (kind) {
1392
1302
case SILInstructionKind::ObjectInst:
1393
1303
case SILInstructionKind::EnumInst:
@@ -1404,42 +1314,6 @@ FirstArgOwnershipForwardingSingleValueInst::classof(SILInstructionKind kind) {
1404
1314
}
1405
1315
}
1406
1316
1407
- class AllArgOwnershipForwardingSingleValueInst : public SingleValueInstruction ,
1408
- public ForwardingInstruction {
1409
- protected:
1410
- AllArgOwnershipForwardingSingleValueInst (SILInstructionKind kind,
1411
- SILDebugLocation debugLoc,
1412
- SILType ty,
1413
- ValueOwnershipKind ownershipKind)
1414
- : SingleValueInstruction(kind, debugLoc, ty),
1415
- ForwardingInstruction (kind, ownershipKind) {
1416
- assert (classof (kind) && " classof missing new subclass?!" );
1417
- }
1418
-
1419
- public:
1420
- static bool classof (SILNodePointer node) {
1421
- if (auto *i = dyn_cast<SILInstruction>(node.get ()))
1422
- return classof (i);
1423
- return false ;
1424
- }
1425
-
1426
- static bool classof (SILInstructionKind kind) {
1427
- switch (kind) {
1428
- case SILInstructionKind::StructInst:
1429
- case SILInstructionKind::TupleInst:
1430
- case SILInstructionKind::LinearFunctionInst:
1431
- case SILInstructionKind::DifferentiableFunctionInst:
1432
- return true ;
1433
- default :
1434
- return false ;
1435
- }
1436
- }
1437
-
1438
- static bool classof (const SILInstruction *inst) {
1439
- return classof (inst->getKind ());
1440
- }
1441
- };
1442
-
1443
1317
// / A value base result of a multiple value instruction.
1444
1318
// /
1445
1319
// / *NOTE* We want this to be a pure abstract class that does not add /any/ size
@@ -5010,7 +4884,7 @@ class AssignOrInitInst
5010
4884
// / this instruction. This is only valid in Raw SIL.
5011
4885
class MarkUninitializedInst
5012
4886
: public UnaryInstructionBase<SILInstructionKind::MarkUninitializedInst,
5013
- OwnedFirstArgForwardingSingleValueInst > {
4887
+ OwnershipForwardingSingleValueInstruction > {
5014
4888
friend SILBuilder;
5015
4889
5016
4890
public:
@@ -6077,7 +5951,7 @@ class UnconditionalCheckedCastInst final
6077
5951
// / StructInst - Represents a constructed loadable struct.
6078
5952
class StructInst final : public InstructionBaseWithTrailingOperands<
6079
5953
SILInstructionKind::StructInst, StructInst,
6080
- AllArgOwnershipForwardingSingleValueInst > {
5954
+ OwnershipForwardingSingleValueInstruction > {
6081
5955
friend SILBuilder;
6082
5956
6083
5957
// / Because of the storage requirements of StructInst, object
@@ -6331,7 +6205,7 @@ class SetDeallocatingInst
6331
6205
// / static initializer list.
6332
6206
class ObjectInst final : public InstructionBaseWithTrailingOperands<
6333
6207
SILInstructionKind::ObjectInst, ObjectInst,
6334
- FirstArgOwnershipForwardingSingleValueInst > {
6208
+ OwnershipForwardingSingleValueInstruction > {
6335
6209
friend SILBuilder;
6336
6210
6337
6211
unsigned numBaseElements;
@@ -6378,7 +6252,7 @@ class ObjectInst final : public InstructionBaseWithTrailingOperands<
6378
6252
// / TupleInst - Represents a constructed loadable tuple.
6379
6253
class TupleInst final : public InstructionBaseWithTrailingOperands<
6380
6254
SILInstructionKind::TupleInst, TupleInst,
6381
- AllArgOwnershipForwardingSingleValueInst > {
6255
+ OwnershipForwardingSingleValueInstruction > {
6382
6256
friend SILBuilder;
6383
6257
6384
6258
// / Because of the storage requirements of TupleInst, object
@@ -6453,7 +6327,7 @@ class TupleInst final : public InstructionBaseWithTrailingOperands<
6453
6327
// / elements.
6454
6328
class EnumInst
6455
6329
: public InstructionBase<SILInstructionKind::EnumInst,
6456
- FirstArgOwnershipForwardingSingleValueInst > {
6330
+ OwnershipForwardingSingleValueInstruction > {
6457
6331
friend SILBuilder;
6458
6332
enum : unsigned { InvalidCaseIndex = ~unsigned (0 ) };
6459
6333
@@ -6507,7 +6381,7 @@ class EnumInst
6507
6381
// / the tag.
6508
6382
class UncheckedEnumDataInst
6509
6383
: public UnaryInstructionBase<SILInstructionKind::UncheckedEnumDataInst,
6510
- FirstArgOwnershipForwardingSingleValueInst > {
6384
+ OwnershipForwardingSingleValueInstruction > {
6511
6385
friend SILBuilder;
6512
6386
enum : unsigned { InvalidCaseIndex = ~unsigned (0 ) };
6513
6387
@@ -6921,7 +6795,7 @@ class ExistentialMetatypeInst
6921
6795
// / Extract a numbered element out of a value of tuple type.
6922
6796
class TupleExtractInst
6923
6797
: public UnaryInstructionBase<SILInstructionKind::TupleExtractInst,
6924
- GuaranteedFirstArgForwardingSingleValueInst > {
6798
+ OwnershipForwardingSingleValueInstruction > {
6925
6799
friend SILBuilder;
6926
6800
USE_SHARED_UINT32;
6927
6801
@@ -7053,7 +6927,7 @@ class FieldIndexCacheBase : public ParentTy {
7053
6927
class StructExtractInst
7054
6928
: public UnaryInstructionBase<
7055
6929
SILInstructionKind::StructExtractInst,
7056
- FieldIndexCacheBase<GuaranteedFirstArgForwardingSingleValueInst >> {
6930
+ FieldIndexCacheBase<OwnershipForwardingSingleValueInstruction >> {
7057
6931
friend SILBuilder;
7058
6932
7059
6933
StructExtractInst (SILDebugLocation DebugLoc, SILValue Operand, VarDecl *Field,
@@ -7321,7 +7195,7 @@ class OpenExistentialAddrInst
7321
7195
// / captures the (dynamic) conformances.
7322
7196
class OpenExistentialValueInst
7323
7197
: public UnaryInstructionBase<SILInstructionKind::OpenExistentialValueInst,
7324
- GuaranteedFirstArgForwardingSingleValueInst > {
7198
+ OwnershipForwardingSingleValueInstruction > {
7325
7199
friend SILBuilder;
7326
7200
7327
7201
OpenExistentialValueInst (SILDebugLocation debugLoc, SILValue operand,
@@ -7342,7 +7216,7 @@ class OpenExistentialValueInst
7342
7216
// / captures the (dynamic) conformances.
7343
7217
class OpenExistentialRefInst
7344
7218
: public UnaryInstructionBase<SILInstructionKind::OpenExistentialRefInst,
7345
- FirstArgOwnershipForwardingSingleValueInst > {
7219
+ OwnershipForwardingSingleValueInstruction > {
7346
7220
friend SILBuilder;
7347
7221
7348
7222
OpenExistentialRefInst (SILDebugLocation DebugLoc, SILValue Operand,
@@ -7406,7 +7280,7 @@ class OpenExistentialBoxInst
7406
7280
class OpenExistentialBoxValueInst
7407
7281
: public UnaryInstructionBase<
7408
7282
SILInstructionKind::OpenExistentialBoxValueInst,
7409
- GuaranteedFirstArgForwardingSingleValueInst > {
7283
+ OwnershipForwardingSingleValueInstruction > {
7410
7284
friend SILBuilder;
7411
7285
7412
7286
OpenExistentialBoxValueInst (SILDebugLocation DebugLoc, SILValue operand,
@@ -7505,7 +7379,7 @@ class InitExistentialValueInst final
7505
7379
class InitExistentialRefInst final
7506
7380
: public UnaryInstructionWithTypeDependentOperandsBase<
7507
7381
SILInstructionKind::InitExistentialRefInst, InitExistentialRefInst,
7508
- FirstArgOwnershipForwardingSingleValueInst > {
7382
+ OwnershipForwardingSingleValueInstruction > {
7509
7383
friend SILBuilder;
7510
7384
7511
7385
CanType ConcreteType;
@@ -8190,7 +8064,7 @@ class UncheckedOwnershipConversionInst
8190
8064
// / "value"'.
8191
8065
class MarkDependenceInst
8192
8066
: public InstructionBase<SILInstructionKind::MarkDependenceInst,
8193
- FirstArgOwnershipForwardingSingleValueInst > {
8067
+ OwnershipForwardingSingleValueInstruction > {
8194
8068
friend SILBuilder;
8195
8069
8196
8070
FixedOperandList<2 > Operands;
@@ -8530,7 +8404,7 @@ class MarkUnresolvedReferenceBindingInst
8530
8404
class CopyableToMoveOnlyWrapperValueInst
8531
8405
: public UnaryInstructionBase<
8532
8406
SILInstructionKind::CopyableToMoveOnlyWrapperValueInst,
8533
- FirstArgOwnershipForwardingSingleValueInst > {
8407
+ OwnershipForwardingSingleValueInstruction > {
8534
8408
public:
8535
8409
enum InitialKind {
8536
8410
Guaranteed,
@@ -8592,7 +8466,7 @@ class CopyableToMoveOnlyWrapperValueInst
8592
8466
class MoveOnlyWrapperToCopyableValueInst
8593
8467
: public UnaryInstructionBase<
8594
8468
SILInstructionKind::MoveOnlyWrapperToCopyableValueInst,
8595
- FirstArgOwnershipForwardingSingleValueInst > {
8469
+ OwnershipForwardingSingleValueInstruction > {
8596
8470
public:
8597
8471
enum InitialKind {
8598
8472
Guaranteed,
@@ -10436,7 +10310,7 @@ class DifferentiableFunctionInst final
10436
10310
: public InstructionBaseWithTrailingOperands<
10437
10311
SILInstructionKind::DifferentiableFunctionInst,
10438
10312
DifferentiableFunctionInst,
10439
- AllArgOwnershipForwardingSingleValueInst > {
10313
+ OwnershipForwardingSingleValueInstruction > {
10440
10314
private:
10441
10315
friend SILBuilder;
10442
10316
// / Differentiability parameter indices.
@@ -10550,7 +10424,7 @@ class DifferentiableFunctionInst final
10550
10424
class LinearFunctionInst final
10551
10425
: public InstructionBaseWithTrailingOperands<
10552
10426
SILInstructionKind::LinearFunctionInst, LinearFunctionInst,
10553
- AllArgOwnershipForwardingSingleValueInst > {
10427
+ OwnershipForwardingSingleValueInstruction > {
10554
10428
private:
10555
10429
friend SILBuilder;
10556
10430
// / Parameters to differentiate with respect to.
@@ -10615,7 +10489,7 @@ class LinearFunctionInst final
10615
10489
class DifferentiableFunctionExtractInst
10616
10490
: public UnaryInstructionBase<
10617
10491
SILInstructionKind::DifferentiableFunctionExtractInst,
10618
- GuaranteedFirstArgForwardingSingleValueInst > {
10492
+ OwnershipForwardingSingleValueInstruction > {
10619
10493
private:
10620
10494
// / The extractee.
10621
10495
NormalDifferentiableFunctionTypeComponent Extractee;
@@ -10658,7 +10532,7 @@ class DifferentiableFunctionExtractInst
10658
10532
// / extract the specified function.
10659
10533
class LinearFunctionExtractInst
10660
10534
: public UnaryInstructionBase<SILInstructionKind::LinearFunctionExtractInst,
10661
- GuaranteedFirstArgForwardingSingleValueInst > {
10535
+ OwnershipForwardingSingleValueInstruction > {
10662
10536
private:
10663
10537
// / The extractee.
10664
10538
LinearDifferentiableFunctionTypeComponent extractee;
@@ -10941,8 +10815,7 @@ inline bool Operand::isTypeDependent() const {
10941
10815
}
10942
10816
10943
10817
inline bool ForwardingInstruction::isa (SILInstructionKind kind) {
10944
- return FirstArgOwnershipForwardingSingleValueInst::classof (kind) ||
10945
- AllArgOwnershipForwardingSingleValueInst::classof (kind) ||
10818
+ return OwnershipForwardingSingleValueInstruction::classof (kind) ||
10946
10819
OwnershipForwardingTermInst::classof (kind) ||
10947
10820
OwnershipForwardingConversionInst::classof (kind) ||
10948
10821
OwnershipForwardingSelectEnumInstBase::classof (kind) ||
@@ -10956,9 +10829,7 @@ inline ForwardingInstruction *ForwardingInstruction::get(SILInstruction *inst) {
10956
10829
// casting to ForwardingInstruction to ensure that we offset to the
10957
10830
// appropriate offset inside of inst instead of converting inst's current
10958
10831
// location to an ForwardingInstruction which would be incorrect.
10959
- if (auto *result = dyn_cast<FirstArgOwnershipForwardingSingleValueInst>(inst))
10960
- return result;
10961
- if (auto *result = dyn_cast<AllArgOwnershipForwardingSingleValueInst>(inst))
10832
+ if (auto *result = dyn_cast<OwnershipForwardingSingleValueInstruction>(inst))
10962
10833
return result;
10963
10834
if (auto *result = dyn_cast<OwnershipForwardingTermInst>(inst))
10964
10835
return result;
0 commit comments