SIL: Add an UpcastExistentialInst.

Converting from a protocol type to a more general protocol type is different at the implementation level from converting a concrete type to a protocol type, since the witness tables and concrete value can be copied directly from the original existential container to the new without adding another indirection. This instruction represents that operation.

Swift SVN r3887
This commit is contained in:
Joe Groff
2013-01-28 20:02:52 +00:00
parent a076d54858
commit 2ccfbdcf1a
8 changed files with 161 additions and 50 deletions

View File

@@ -342,6 +342,13 @@ public:
OS << "init_existential " << getID(AEI->getExistential()) << ", $";
AEI->getConcreteType()->print(OS);
}
void visitUpcastExistentialInst(UpcastExistentialInst *UEI) {
OS << "upcast_existential ";
if (UEI->isTakeOfSrc())
OS << "[take] ";
OS << getID(UEI->getSrcExistential())
<< " to " << getID(UEI->getDestExistential());
}
void visitDeinitExistentialInst(DeinitExistentialInst *DEI) {
OS << "deinit_existential " << getID(DEI->getExistential());
}