@@ -170,6 +170,8 @@ struct SILDeclRef {
170170 unsigned isForeign : 1 ;
171171 // / True if this references a distributed function.
172172 unsigned isDistributed : 1 ;
173+ // / True if this references a back deployed entry point for the referenced decl.
174+ unsigned isBackDeployed : 1 ;
173175 // / The default argument index for a default argument getter.
174176 unsigned defaultArgIndex : 10 ;
175177
@@ -204,13 +206,15 @@ struct SILDeclRef {
204206
205207 // / Produces a null SILDeclRef.
206208 SILDeclRef ()
207- : loc(), kind(Kind::Func), isForeign(0 ), isDistributed(0 ), defaultArgIndex(0 ) {}
209+ : loc(), kind(Kind::Func), isForeign(0 ), isDistributed(0 ),
210+ isBackDeployed (0 ), defaultArgIndex(0 ) {}
208211
209212 // / Produces a SILDeclRef of the given kind for the given decl.
210213 explicit SILDeclRef (
211214 ValueDecl *decl, Kind kind,
212215 bool isForeign = false ,
213216 bool isDistributed = false ,
217+ bool isBackDeployed = false ,
214218 AutoDiffDerivativeFunctionIdentifier *derivativeId = nullptr );
215219
216220 // / Produces a SILDeclRef for the given ValueDecl or
@@ -224,7 +228,11 @@ struct SILDeclRef {
224228 // / for the containing ClassDecl.
225229 // / - If 'loc' is a global VarDecl, this returns its GlobalAccessor
226230 // / SILDeclRef.
227- explicit SILDeclRef (Loc loc, bool isForeign = false , bool isDistributed = false );
231+ explicit SILDeclRef (
232+ Loc loc,
233+ bool isForeign = false ,
234+ bool isDistributed = false ,
235+ bool isBackDeployed = false );
228236
229237 // / See above put produces a prespecialization according to the signature.
230238 explicit SILDeclRef (Loc loc, GenericSignature prespecializationSig);
@@ -360,6 +368,7 @@ struct SILDeclRef {
360368 return loc.getOpaqueValue () == rhs.loc .getOpaqueValue () &&
361369 kind == rhs.kind && isForeign == rhs.isForeign &&
362370 isDistributed == rhs.isDistributed &&
371+ isBackDeployed == rhs.isBackDeployed &&
363372 defaultArgIndex == rhs.defaultArgIndex &&
364373 pointer == rhs.pointer ;
365374 }
@@ -378,6 +387,7 @@ struct SILDeclRef {
378387 return SILDeclRef (loc.getOpaqueValue (), kind,
379388 /* foreign=*/ foreign,
380389 /* distributed=*/ false ,
390+ /* backDeployed=*/ false ,
381391 defaultArgIndex,
382392 pointer.get <AutoDiffDerivativeFunctionIdentifier *>());
383393 }
@@ -387,6 +397,17 @@ struct SILDeclRef {
387397 return SILDeclRef (loc.getOpaqueValue (), kind,
388398 /* foreign=*/ false ,
389399 /* distributed=*/ distributed,
400+ /* backDeployed=*/ false ,
401+ defaultArgIndex,
402+ pointer.get <AutoDiffDerivativeFunctionIdentifier *>());
403+ }
404+ // / Returns the back deployment entry point corresponding to the same
405+ // / decl.
406+ SILDeclRef asBackDeployed (bool backDeployed = true ) const {
407+ return SILDeclRef (loc.getOpaqueValue (), kind,
408+ /* foreign=*/ false ,
409+ /* distributed=*/ false ,
410+ /* backDeployed=*/ backDeployed,
390411 defaultArgIndex,
391412 pointer.get <AutoDiffDerivativeFunctionIdentifier *>());
392413 }
@@ -431,6 +452,10 @@ struct SILDeclRef {
431452 // / True if the decl ref references a thunk handling potentially distributed actor functions
432453 bool isDistributedThunk () const ;
433454
455+ // / True if the decl ref references a thunk handling a call to a back deployed
456+ // / function.
457+ bool isBackDeployedThunk () const ;
458+
434459 // / True if the decl ref references a method which introduces a new vtable
435460 // / entry.
436461 bool requiresNewVTableEntry () const ;
@@ -508,11 +533,12 @@ struct SILDeclRef {
508533 explicit SILDeclRef (void *opaqueLoc, Kind kind,
509534 bool isForeign,
510535 bool isDistributed,
536+ bool isBackDeployed,
511537 unsigned defaultArgIndex,
512538 AutoDiffDerivativeFunctionIdentifier *derivativeId)
513539 : loc(Loc::getFromOpaqueValue(opaqueLoc)), kind(kind),
514540 isForeign(isForeign), isDistributed(isDistributed),
515- defaultArgIndex(defaultArgIndex),
541+ isBackDeployed(isBackDeployed), defaultArgIndex(defaultArgIndex),
516542 pointer(derivativeId) {}
517543};
518544
@@ -534,12 +560,12 @@ template<> struct DenseMapInfo<swift::SILDeclRef> {
534560 using UnsignedInfo = DenseMapInfo<unsigned >;
535561
536562 static SILDeclRef getEmptyKey () {
537- return SILDeclRef (PointerInfo::getEmptyKey (), Kind::Func, false , false , 0 ,
538- nullptr );
563+ return SILDeclRef (PointerInfo::getEmptyKey (), Kind::Func, false , false ,
564+ false , 0 , nullptr );
539565 }
540566 static SILDeclRef getTombstoneKey () {
541567 return SILDeclRef (PointerInfo::getTombstoneKey (), Kind::Func, false , false ,
542- 0 , nullptr );
568+ false , 0 , nullptr );
543569 }
544570 static unsigned getHashValue (swift::SILDeclRef Val) {
545571 unsigned h1 = PointerInfo::getHashValue (Val.loc .getOpaqueValue ());
@@ -550,7 +576,9 @@ template<> struct DenseMapInfo<swift::SILDeclRef> {
550576 unsigned h4 = UnsignedInfo::getHashValue (Val.isForeign );
551577 unsigned h5 = PointerInfo::getHashValue (Val.pointer .getOpaqueValue ());
552578 unsigned h6 = UnsignedInfo::getHashValue (Val.isDistributed );
553- return h1 ^ (h2 << 4 ) ^ (h3 << 9 ) ^ (h4 << 7 ) ^ (h5 << 11 ) ^ (h6 << 8 );
579+ unsigned h7 = UnsignedInfo::getHashValue (Val.isBackDeployed );
580+ return h1 ^ (h2 << 4 ) ^ (h3 << 9 ) ^ (h4 << 7 ) ^ (h5 << 11 ) ^ (h6 << 8 ) ^
581+ (h7 << 10 );
554582 }
555583 static bool isEqual (swift::SILDeclRef const &LHS,
556584 swift::SILDeclRef const &RHS) {
0 commit comments