mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SIL] Added strong_copy_weak_value.
The new instruction unwraps an `@sil_weak` box and produces an owned value. It is only legal in opaque values mode and is transformed by `AddressLowering` to `load_weak`.
This commit is contained in:
@@ -175,6 +175,18 @@ ManagedValue SILGenBuilder::createCopyValue(SILLocation loc,
|
||||
return SGF.emitManagedRValueWithCleanup(result, lowering);
|
||||
}
|
||||
|
||||
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
|
||||
ManagedValue SILGenBuilder::createStrongCopy##Name##Value( \
|
||||
SILLocation loc, ManagedValue originalValue) { \
|
||||
assert(!SGF.useLoweredAddresses()); \
|
||||
auto ty = originalValue.getType(); \
|
||||
assert(ty.isAddressOnly(SGF.F)); \
|
||||
auto storageTy = originalValue.getType().castTo<Name##StorageType>(); \
|
||||
(void)storageTy; \
|
||||
SILValue result = \
|
||||
createStrongCopy##Name##Value(loc, originalValue.getValue()); \
|
||||
return SGF.emitManagedRValueWithCleanup(result); \
|
||||
}
|
||||
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
|
||||
ManagedValue SILGenBuilder::createStrongCopy##Name##Value( \
|
||||
SILLocation loc, ManagedValue originalValue) { \
|
||||
|
||||
Reference in New Issue
Block a user