@@ -125,16 +125,7 @@ struct CoroutineState {
125
125
class LoweredValue {
126
126
public:
127
127
enum class Kind {
128
- // / The first two LoweredValue kinds correspond to a SIL address value.
129
- // /
130
- // / The LoweredValue of an existential alloc_stack keeps an owning container
131
- // / in addition to the address of the allocated buffer.
132
- // / Depending on the allocated type, the container may be equal to the
133
- // / buffer itself (for types with known sizes) or it may be the address
134
- // / of a fixed-size container which points to the heap-allocated buffer.
135
- // / In this case the address-part may be null, which means that the buffer
136
- // / is not allocated yet.
137
- ContainedAddress,
128
+ // / The first three LoweredValue kinds correspond to a SIL address value.
138
129
139
130
// / The LoweredValue of a resilient, generic, or loadable typed alloc_stack
140
131
// / keeps an optional stackrestore point in addition to the address of the
@@ -178,8 +169,7 @@ class LoweredValue {
178
169
using ExplosionVector = SmallVector<llvm::Value *, 4 >;
179
170
using SingletonExplosion = llvm::Value*;
180
171
181
- using Members = ExternalUnionMembers<ContainedAddress,
182
- StackAddress,
172
+ using Members = ExternalUnionMembers<StackAddress,
183
173
OwnedAddress,
184
174
DynamicallyEnforcedAddress,
185
175
ExplosionVector,
@@ -191,7 +181,6 @@ class LoweredValue {
191
181
192
182
static Members::Index getMemberIndexForKind (Kind kind) {
193
183
switch (kind) {
194
- case Kind::ContainedAddress: return Members::indexOf<ContainedAddress>();
195
184
case Kind::StackAddress: return Members::indexOf<StackAddress>();
196
185
case Kind::OwnedAddress: return Members::indexOf<OwnedAddress>();
197
186
case Kind::DynamicallyEnforcedAddress: return Members::indexOf<DynamicallyEnforcedAddress>();
@@ -231,22 +220,6 @@ class LoweredValue {
231
220
Storage.emplace <DynamicallyEnforcedAddress>(kind, address);
232
221
}
233
222
234
- enum ContainerForUnallocatedAddress_t { ContainerForUnallocatedAddress };
235
-
236
- // / Create an address value for an alloc_stack, consisting of a container and
237
- // / a not yet allocated buffer.
238
- LoweredValue (const Address &container, ContainerForUnallocatedAddress_t)
239
- : kind(Kind::ContainedAddress) {
240
- Storage.emplace <ContainedAddress>(kind, container, Address ());
241
- }
242
-
243
- // / Create an address value for an alloc_stack, consisting of a container and
244
- // / the address of the allocated buffer.
245
- LoweredValue (const ContainedAddress &address)
246
- : kind(Kind::ContainedAddress) {
247
- Storage.emplace <ContainedAddress>(kind, address);
248
- }
249
-
250
223
LoweredValue (const FunctionPointer &fn)
251
224
: kind(Kind::FunctionPointer) {
252
225
Storage.emplace <FunctionPointer>(kind, fn);
@@ -304,10 +277,6 @@ class LoweredValue {
304
277
return (kind == Kind::StackAddress ||
305
278
kind == Kind::DynamicallyEnforcedAddress);
306
279
}
307
- bool isUnallocatedAddressInBuffer () const {
308
- return kind == Kind::ContainedAddress &&
309
- !Storage.get <ContainedAddress>(kind).getAddress ().isValid ();
310
- }
311
280
bool isBoxWithAddress () const {
312
281
return kind == Kind::OwnedAddress;
313
282
}
@@ -316,28 +285,13 @@ class LoweredValue {
316
285
return Storage.get <StackAddress>(kind);
317
286
}
318
287
319
- Address getContainerOfAddress () const {
320
- const auto &containedAddress = Storage.get <ContainedAddress>(kind);
321
- assert (containedAddress.getContainer ().isValid () && " address has no container" );
322
- return containedAddress.getContainer ();
323
- }
324
-
325
- Address getAddressInContainer () const {
326
- const auto &containedAddress = Storage.get <ContainedAddress>(kind);
327
- assert (containedAddress.getContainer ().isValid () &&
328
- " address has no container" );
329
- return containedAddress.getAddress ();
330
- }
331
-
332
288
const DynamicallyEnforcedAddress &getDynamicallyEnforcedAddress () const {
333
289
return Storage.get <DynamicallyEnforcedAddress>(kind);
334
290
}
335
291
336
292
Address getAnyAddress () const {
337
293
if (kind == LoweredValue::Kind::StackAddress) {
338
294
return Storage.get <StackAddress>(kind).getAddress ();
339
- } else if (kind == LoweredValue::Kind::ContainedAddress) {
340
- return getAddressInContainer ();
341
295
} else {
342
296
return getDynamicallyEnforcedAddress ().Addr ;
343
297
}
@@ -501,24 +455,6 @@ class IRGenSILFunction :
501
455
setLoweredValue (v, DynamicallyEnforcedAddress{address, scratch});
502
456
}
503
457
504
- void setContainerOfUnallocatedAddress (SILValue v,
505
- const Address &buffer) {
506
- assert (isAddress (v) && " address for non-address value?!" );
507
- setLoweredValue (v,
508
- LoweredValue (buffer, LoweredValue::ContainerForUnallocatedAddress));
509
- }
510
-
511
- void overwriteAllocatedAddress (SILValue v, const Address &address) {
512
- assert (isAddress (v) && " address for non-address value?!" );
513
- auto it = LoweredValues.find (v);
514
- assert (it != LoweredValues.end () && " no existing entry for overwrite?" );
515
- assert (it->second .isUnallocatedAddressInBuffer () &&
516
- " not an unallocated address" );
517
- it->second = ContainedAddress (it->second .getContainerOfAddress (), address);
518
- }
519
-
520
- void setAllocatedAddressForBuffer (SILValue v, const Address &allocedAddress);
521
-
522
458
// / Create a new Explosion corresponding to the given SIL value.
523
459
void setLoweredExplosion (SILValue v, Explosion &e) {
524
460
assert (v->getType ().isObject () && " explosion for address value?!" );
@@ -1813,7 +1749,6 @@ void LoweredValue::getExplosion(IRGenFunction &IGF, SILType type,
1813
1749
ex.add (Storage.get <StackAddress>(kind).getAddressPointer ());
1814
1750
return ;
1815
1751
1816
- case Kind::ContainedAddress:
1817
1752
case Kind::DynamicallyEnforcedAddress:
1818
1753
case Kind::CoroutineState:
1819
1754
llvm_unreachable (" not a value" );
@@ -1849,7 +1784,6 @@ llvm::Value *LoweredValue::getSingletonExplosion(IRGenFunction &IGF,
1849
1784
SILType type) const {
1850
1785
switch (kind) {
1851
1786
case Kind::StackAddress:
1852
- case Kind::ContainedAddress:
1853
1787
case Kind::DynamicallyEnforcedAddress:
1854
1788
case Kind::CoroutineState:
1855
1789
llvm_unreachable (" not a value" );
@@ -3418,7 +3352,6 @@ Callee LoweredValue::getCallee(IRGenFunction &IGF,
3418
3352
3419
3353
case LoweredValue::Kind::EmptyExplosion:
3420
3354
case LoweredValue::Kind::OwnedAddress:
3421
- case LoweredValue::Kind::ContainedAddress:
3422
3355
case LoweredValue::Kind::StackAddress:
3423
3356
case LoweredValue::Kind::DynamicallyEnforcedAddress:
3424
3357
case LoweredValue::Kind::CoroutineState:
@@ -3842,7 +3775,6 @@ getPartialApplicationFunction(IRGenSILFunction &IGF, SILValue v,
3842
3775
auto fnType = v->getType ().castTo <SILFunctionType>();
3843
3776
3844
3777
switch (lv.kind ) {
3845
- case LoweredValue::Kind::ContainedAddress:
3846
3778
case LoweredValue::Kind::StackAddress:
3847
3779
case LoweredValue::Kind::DynamicallyEnforcedAddress:
3848
3780
case LoweredValue::Kind::OwnedAddress:
@@ -7541,24 +7473,12 @@ void IRGenSILFunction::visitWitnessMethodInst(swift::WitnessMethodInst *i) {
7541
7473
setLoweredFunctionPointer (i, fn);
7542
7474
}
7543
7475
7544
- void IRGenSILFunction::setAllocatedAddressForBuffer (SILValue v,
7545
- const Address &allocedAddress) {
7546
- overwriteAllocatedAddress (v, allocedAddress);
7547
-
7548
- // Emit the debug info for the variable if any.
7549
- if (auto allocStack = dyn_cast<AllocStackInst>(v)) {
7550
- emitDebugInfoForAllocStack (allocStack, getTypeInfo (v->getType ()),
7551
- allocedAddress.getAddress ());
7552
- }
7553
- }
7554
-
7555
7476
void IRGenSILFunction::visitCopyAddrInst (swift::CopyAddrInst *i) {
7556
7477
SILType addrTy = i->getSrc ()->getType ();
7557
7478
const TypeInfo &addrTI = getTypeInfo (addrTy);
7558
7479
Address src = getLoweredAddress (i->getSrc ());
7559
7480
// See whether we have a deferred fixed-size buffer initialization.
7560
7481
auto &loweredDest = getLoweredValue (i->getDest ());
7561
- assert (!loweredDest.isUnallocatedAddressInBuffer ());
7562
7482
Address dest = loweredDest.getAnyAddress ();
7563
7483
if (i->isInitializationOfDest ()) {
7564
7484
if (i->isTakeOfSrc ()) {
@@ -7582,7 +7502,6 @@ void IRGenSILFunction::visitExplicitCopyAddrInst(
7582
7502
Address src = getLoweredAddress (i->getSrc ());
7583
7503
// See whether we have a deferred fixed-size buffer initialization.
7584
7504
auto &loweredDest = getLoweredValue (i->getDest ());
7585
- assert (!loweredDest.isUnallocatedAddressInBuffer ());
7586
7505
Address dest = loweredDest.getAnyAddress ();
7587
7506
if (i->isInitializationOfDest ()) {
7588
7507
if (i->isTakeOfSrc ()) {
0 commit comments