@@ -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
@@ -171,15 +162,14 @@ class LoweredValue {
171
162
// / A coroutine state.
172
163
CoroutineState,
173
164
};
174
-
165
+
175
166
Kind kind;
176
167
177
168
private:
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>();
@@ -230,23 +219,7 @@ class LoweredValue {
230
219
: kind(Kind::DynamicallyEnforcedAddress) {
231
220
Storage.emplace <DynamicallyEnforcedAddress>(kind, address);
232
221
}
233
-
234
- enum ContainerForUnallocatedAddress_t { ContainerForUnallocatedAddress };
235
222
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,30 +277,13 @@ 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
}
314
283
315
284
const StackAddress &getStackAddress () const {
316
285
return Storage.get <StackAddress>(kind);
317
286
}
318
-
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
287
332
288
const DynamicallyEnforcedAddress &getDynamicallyEnforcedAddress () const {
333
289
return Storage.get <DynamicallyEnforcedAddress>(kind);
@@ -336,8 +292,6 @@ class LoweredValue {
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
}
@@ -500,24 +454,6 @@ class IRGenSILFunction :
500
454
assert (isAddress (v) && " address for non-address value?!" );
501
455
setLoweredValue (v, DynamicallyEnforcedAddress{address, scratch});
502
456
}
503
-
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
457
522
458
// / Create a new Explosion corresponding to the given SIL value.
523
459
void setLoweredExplosion (SILValue v, Explosion &e) {
@@ -1817,7 +1753,6 @@ void LoweredValue::getExplosion(IRGenFunction &IGF, SILType type,
1817
1753
ex.add (Storage.get <StackAddress>(kind).getAddressPointer ());
1818
1754
return ;
1819
1755
1820
- case Kind::ContainedAddress:
1821
1756
case Kind::DynamicallyEnforcedAddress:
1822
1757
case Kind::CoroutineState:
1823
1758
llvm_unreachable (" not a value" );
@@ -1853,7 +1788,6 @@ llvm::Value *LoweredValue::getSingletonExplosion(IRGenFunction &IGF,
1853
1788
SILType type) const {
1854
1789
switch (kind) {
1855
1790
case Kind::StackAddress:
1856
- case Kind::ContainedAddress:
1857
1791
case Kind::DynamicallyEnforcedAddress:
1858
1792
case Kind::CoroutineState:
1859
1793
llvm_unreachable (" not a value" );
@@ -3422,7 +3356,6 @@ Callee LoweredValue::getCallee(IRGenFunction &IGF,
3422
3356
3423
3357
case LoweredValue::Kind::EmptyExplosion:
3424
3358
case LoweredValue::Kind::OwnedAddress:
3425
- case LoweredValue::Kind::ContainedAddress:
3426
3359
case LoweredValue::Kind::StackAddress:
3427
3360
case LoweredValue::Kind::DynamicallyEnforcedAddress:
3428
3361
case LoweredValue::Kind::CoroutineState:
@@ -3847,7 +3780,6 @@ getPartialApplicationFunction(IRGenSILFunction &IGF, SILValue v,
3847
3780
auto fnType = v->getType ().castTo <SILFunctionType>();
3848
3781
3849
3782
switch (lv.kind ) {
3850
- case LoweredValue::Kind::ContainedAddress:
3851
3783
case LoweredValue::Kind::StackAddress:
3852
3784
case LoweredValue::Kind::DynamicallyEnforcedAddress:
3853
3785
case LoweredValue::Kind::OwnedAddress:
@@ -7581,24 +7513,12 @@ void IRGenSILFunction::visitWitnessMethodInst(swift::WitnessMethodInst *i) {
7581
7513
setLoweredFunctionPointer (i, fn);
7582
7514
}
7583
7515
7584
- void IRGenSILFunction::setAllocatedAddressForBuffer (SILValue v,
7585
- const Address &allocedAddress) {
7586
- overwriteAllocatedAddress (v, allocedAddress);
7587
-
7588
- // Emit the debug info for the variable if any.
7589
- if (auto allocStack = dyn_cast<AllocStackInst>(v)) {
7590
- emitDebugInfoForAllocStack (allocStack, getTypeInfo (v->getType ()),
7591
- allocedAddress.getAddress ());
7592
- }
7593
- }
7594
-
7595
7516
void IRGenSILFunction::visitCopyAddrInst (swift::CopyAddrInst *i) {
7596
7517
SILType addrTy = i->getSrc ()->getType ();
7597
7518
const TypeInfo &addrTI = getTypeInfo (addrTy);
7598
7519
Address src = getLoweredAddress (i->getSrc ());
7599
7520
// See whether we have a deferred fixed-size buffer initialization.
7600
7521
auto &loweredDest = getLoweredValue (i->getDest ());
7601
- assert (!loweredDest.isUnallocatedAddressInBuffer ());
7602
7522
Address dest = loweredDest.getAnyAddress ();
7603
7523
if (i->isInitializationOfDest ()) {
7604
7524
if (i->isTakeOfSrc ()) {
@@ -7622,7 +7542,6 @@ void IRGenSILFunction::visitExplicitCopyAddrInst(
7622
7542
Address src = getLoweredAddress (i->getSrc ());
7623
7543
// See whether we have a deferred fixed-size buffer initialization.
7624
7544
auto &loweredDest = getLoweredValue (i->getDest ());
7625
- assert (!loweredDest.isUnallocatedAddressInBuffer ());
7626
7545
Address dest = loweredDest.getAnyAddress ();
7627
7546
if (i->isInitializationOfDest ()) {
7628
7547
if (i->isTakeOfSrc ()) {
0 commit comments