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:
@@ -1525,6 +1525,12 @@ public:
|
||||
// It's illegal code but the compiler should not crash on it.
|
||||
}
|
||||
|
||||
void checkAllocPackInst(AllocPackInst *AI) {
|
||||
requireAddressType(SILPackType, AI->getType(),
|
||||
"result of alloc_pack must be an address of "
|
||||
"lowered pack type");
|
||||
}
|
||||
|
||||
void checkAllocRefBase(AllocRefInstBase *ARI) {
|
||||
requireReferenceValue(ARI, "Result of alloc_ref");
|
||||
verifyLocalArchetype(ARI, ARI->getType().getASTType());
|
||||
@@ -3130,6 +3136,11 @@ public:
|
||||
"Operand of dealloc_stack must be an alloc_stack or partial_apply "
|
||||
"[stack]");
|
||||
}
|
||||
void checkDeallocPackInst(DeallocPackInst *DI) {
|
||||
require(isa<SILUndef>(DI->getOperand()) ||
|
||||
isa<AllocPackInst>(DI->getOperand()),
|
||||
"Operand of dealloc_pack must be an alloc_pack");
|
||||
}
|
||||
void checkDeallocRefInst(DeallocRefInst *DI) {
|
||||
require(DI->getOperand()->getType().isObject(),
|
||||
"Operand of dealloc_ref must be object");
|
||||
|
||||
Reference in New Issue
Block a user