@@ -125,16 +125,7 @@ struct CoroutineState {
125125class LoweredValue {
126126public:
127127 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.
138129
139130 // / The LoweredValue of a resilient, generic, or loadable typed alloc_stack
140131 // / keeps an optional stackrestore point in addition to the address of the
@@ -171,15 +162,14 @@ class LoweredValue {
171162 // / A coroutine state.
172163 CoroutineState,
173164 };
174-
165+
175166 Kind kind;
176167
177168private:
178169 using ExplosionVector = SmallVector<llvm::Value *, 4 >;
179170 using SingletonExplosion = llvm::Value*;
180171
181- using Members = ExternalUnionMembers<ContainedAddress,
182- StackAddress,
172+ using Members = ExternalUnionMembers<StackAddress,
183173 OwnedAddress,
184174 DynamicallyEnforcedAddress,
185175 ExplosionVector,
@@ -191,7 +181,6 @@ class LoweredValue {
191181
192182 static Members::Index getMemberIndexForKind (Kind kind) {
193183 switch (kind) {
194- case Kind::ContainedAddress: return Members::indexOf<ContainedAddress>();
195184 case Kind::StackAddress: return Members::indexOf<StackAddress>();
196185 case Kind::OwnedAddress: return Members::indexOf<OwnedAddress>();
197186 case Kind::DynamicallyEnforcedAddress: return Members::indexOf<DynamicallyEnforcedAddress>();
@@ -230,23 +219,7 @@ class LoweredValue {
230219 : kind(Kind::DynamicallyEnforcedAddress) {
231220 Storage.emplace <DynamicallyEnforcedAddress>(kind, address);
232221 }
233-
234- enum ContainerForUnallocatedAddress_t { ContainerForUnallocatedAddress };
235222
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-
250223 LoweredValue (const FunctionPointer &fn)
251224 : kind(Kind::FunctionPointer) {
252225 Storage.emplace <FunctionPointer>(kind, fn);
@@ -304,30 +277,13 @@ class LoweredValue {
304277 return (kind == Kind::StackAddress ||
305278 kind == Kind::DynamicallyEnforcedAddress);
306279 }
307- bool isUnallocatedAddressInBuffer () const {
308- return kind == Kind::ContainedAddress &&
309- !Storage.get <ContainedAddress>(kind).getAddress ().isValid ();
310- }
311280 bool isBoxWithAddress () const {
312281 return kind == Kind::OwnedAddress;
313282 }
314283
315284 const StackAddress &getStackAddress () const {
316285 return Storage.get <StackAddress>(kind);
317286 }
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- }
331287
332288 const DynamicallyEnforcedAddress &getDynamicallyEnforcedAddress () const {
333289 return Storage.get <DynamicallyEnforcedAddress>(kind);
@@ -336,8 +292,6 @@ class LoweredValue {
336292 Address getAnyAddress () const {
337293 if (kind == LoweredValue::Kind::StackAddress) {
338294 return Storage.get <StackAddress>(kind).getAddress ();
339- } else if (kind == LoweredValue::Kind::ContainedAddress) {
340- return getAddressInContainer ();
341295 } else {
342296 return getDynamicallyEnforcedAddress ().Addr ;
343297 }
@@ -500,24 +454,6 @@ class IRGenSILFunction :
500454 assert (isAddress (v) && " address for non-address value?!" );
501455 setLoweredValue (v, DynamicallyEnforcedAddress{address, scratch});
502456 }
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);
521457
522458 // / Create a new Explosion corresponding to the given SIL value.
523459 void setLoweredExplosion (SILValue v, Explosion &e) {
@@ -1817,7 +1753,6 @@ void LoweredValue::getExplosion(IRGenFunction &IGF, SILType type,
18171753 ex.add (Storage.get <StackAddress>(kind).getAddressPointer ());
18181754 return ;
18191755
1820- case Kind::ContainedAddress:
18211756 case Kind::DynamicallyEnforcedAddress:
18221757 case Kind::CoroutineState:
18231758 llvm_unreachable (" not a value" );
@@ -1853,7 +1788,6 @@ llvm::Value *LoweredValue::getSingletonExplosion(IRGenFunction &IGF,
18531788 SILType type) const {
18541789 switch (kind) {
18551790 case Kind::StackAddress:
1856- case Kind::ContainedAddress:
18571791 case Kind::DynamicallyEnforcedAddress:
18581792 case Kind::CoroutineState:
18591793 llvm_unreachable (" not a value" );
@@ -3422,7 +3356,6 @@ Callee LoweredValue::getCallee(IRGenFunction &IGF,
34223356
34233357 case LoweredValue::Kind::EmptyExplosion:
34243358 case LoweredValue::Kind::OwnedAddress:
3425- case LoweredValue::Kind::ContainedAddress:
34263359 case LoweredValue::Kind::StackAddress:
34273360 case LoweredValue::Kind::DynamicallyEnforcedAddress:
34283361 case LoweredValue::Kind::CoroutineState:
@@ -3847,7 +3780,6 @@ getPartialApplicationFunction(IRGenSILFunction &IGF, SILValue v,
38473780 auto fnType = v->getType ().castTo <SILFunctionType>();
38483781
38493782 switch (lv.kind ) {
3850- case LoweredValue::Kind::ContainedAddress:
38513783 case LoweredValue::Kind::StackAddress:
38523784 case LoweredValue::Kind::DynamicallyEnforcedAddress:
38533785 case LoweredValue::Kind::OwnedAddress:
@@ -7581,24 +7513,12 @@ void IRGenSILFunction::visitWitnessMethodInst(swift::WitnessMethodInst *i) {
75817513 setLoweredFunctionPointer (i, fn);
75827514}
75837515
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-
75957516void IRGenSILFunction::visitCopyAddrInst (swift::CopyAddrInst *i) {
75967517 SILType addrTy = i->getSrc ()->getType ();
75977518 const TypeInfo &addrTI = getTypeInfo (addrTy);
75987519 Address src = getLoweredAddress (i->getSrc ());
75997520 // See whether we have a deferred fixed-size buffer initialization.
76007521 auto &loweredDest = getLoweredValue (i->getDest ());
7601- assert (!loweredDest.isUnallocatedAddressInBuffer ());
76027522 Address dest = loweredDest.getAnyAddress ();
76037523 if (i->isInitializationOfDest ()) {
76047524 if (i->isTakeOfSrc ()) {
@@ -7622,7 +7542,6 @@ void IRGenSILFunction::visitExplicitCopyAddrInst(
76227542 Address src = getLoweredAddress (i->getSrc ());
76237543 // See whether we have a deferred fixed-size buffer initialization.
76247544 auto &loweredDest = getLoweredValue (i->getDest ());
7625- assert (!loweredDest.isUnallocatedAddressInBuffer ());
76267545 Address dest = loweredDest.getAnyAddress ();
76277546 if (i->isInitializationOfDest ()) {
76287547 if (i->isTakeOfSrc ()) {
0 commit comments