SIL: Add DeallocExistentialInst.

Needed to represent deinitializing a partially-initialized existential in which the value witness table has been populated by alloc_existential but the value has not been initialized yet.

Swift SVN r3565
This commit is contained in:
Joe Groff
2012-12-20 20:18:54 +00:00
parent 662861fd66
commit c2f9b197ad
7 changed files with 47 additions and 6 deletions

View File

@@ -121,18 +121,18 @@ public:
"invalid integer literal type");
}
void visitLoadInst(LoadInst *LI) {
assert(!LI->getType().isAddress() && "Load should produce rvalue");
assert(!LI->getType().isAddress() && "Can't load an address");
assert(LI->getLValue().getType().isAddress() &&
"Load op should be lvalue");
"Load operand must be an address");
assert(LI->getLValue().getType().getObjectType() == LI->getType() &&
"Load operand type and result type mismatch");
}
void visitStoreInst(StoreInst *SI) {
assert(!SI->getSrc().getType().isAddress() &&
"Src value should be rvalue");
"Can't store from an address source");
assert(SI->getDest().getType().isAddress() &&
"Dest address should be lvalue");
"Must store to an address dest");
assert(SI->getDest().getType().getObjectType() == SI->getSrc().getType() &&
"Store operand type and dest type mismatch");
}
@@ -290,6 +290,16 @@ public:
#endif
}
void visitDeallocExistentialInst(DeallocExistentialInst *DEI) {
#ifndef NDEBUG
SILType exType = DEI->getExistential().getType();
assert(exType.isAddress() &&
"dealloc_existential must be applied to an address");
assert(exType.isExistentialType() &&
"dealloc_existential must be applied to address of existential");
#endif
}
void visitArchetypeToSuperInst(ArchetypeToSuperInst *ASI) {
// FIXME: archetypes should be address-only
assert(ASI->getOperand().getType().is<ArchetypeType>() &&