mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add instructions to allocate and deallocate packs.
Having added these, I'm not entirely sure we couldn't just use alloc_stack and dealloc_stack. Well, if we find ourselves adding a lot of redundancy with those instructions (e.g. around DI), we can always go back and rip these out.
This commit is contained in:
@@ -296,6 +296,21 @@ DeallocStackInst *AllocStackInst::getSingleDeallocStack() const {
|
||||
return Dealloc;
|
||||
}
|
||||
|
||||
AllocPackInst *AllocPackInst::create(SILDebugLocation loc,
|
||||
SILType packType,
|
||||
SILFunction &F) {
|
||||
assert(packType.isObject());
|
||||
assert(packType.is<SILPackType>() && "pack type must be lowered");
|
||||
auto resultType = packType.getAddressType();
|
||||
|
||||
SmallVector<SILValue, 8> allOperands;
|
||||
collectTypeDependentOperands(allOperands, F, packType);
|
||||
|
||||
auto size = totalSizeToAlloc<swift::Operand>(allOperands.size());
|
||||
auto buffer = F.getModule().allocateInst(size, alignof(AllocPackInst));
|
||||
return ::new (buffer) AllocPackInst(loc, resultType, allOperands);
|
||||
}
|
||||
|
||||
AllocRefInstBase::AllocRefInstBase(SILInstructionKind Kind,
|
||||
SILDebugLocation Loc,
|
||||
SILType ObjectType,
|
||||
|
||||
Reference in New Issue
Block a user