Add support for unconditional checked cast instruction for opaque value types + SILGen support for it

This commit is contained in:
Joe Shajrawi
2017-02-22 16:17:00 -08:00
parent 20bdedf17e
commit ec1e3ee20e
20 changed files with 158 additions and 15 deletions

View File

@@ -1301,6 +1301,18 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
llvm::makeArrayRef(listOfValues));
break;
}
case ValueKind::UnconditionalCheckedCastOpaqueInst: {
auto CI = cast<UnconditionalCheckedCastOpaqueInst>(&SI);
SILInstCastLayout::emitRecord(
Out, ScratchRecord, SILAbbrCodes[SILInstCastLayout::Code],
(unsigned)SI.getKind(), /*attr*/ 0,
S.addTypeRef(CI->getType().getSwiftRValueType()),
(unsigned)CI->getType().getCategory(),
S.addTypeRef(CI->getOperand()->getType().getSwiftRValueType()),
(unsigned)CI->getOperand()->getType().getCategory(),
addValueRef(CI->getOperand()));
break;
}
case ValueKind::UncheckedRefCastAddrInst: {
auto CI = cast<UncheckedRefCastAddrInst>(&SI);
ValueID listOfValues[] = {