Add a copy_block_without_escaping %block withoutEscaping %closure instruction

Mandatory pass will clean it up and replace it by a copy_block and
is_escaping/cond_fail/release combination on the %closure in follow-up
patches.

The instruction marks the dependence of a block on a closure that is
used as an 'withoutActuallyEscaping' sentinel.

rdar://39682865
This commit is contained in:
Arnold Schwaighofer
2018-04-25 16:01:34 -07:00
parent c45d659e1f
commit 678a99e76a
18 changed files with 138 additions and 2 deletions

View File

@@ -1312,13 +1312,18 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
break;
}
case SILInstructionKind::CopyBlockWithoutEscapingInst:
case SILInstructionKind::DeallocPartialRefInst:
case SILInstructionKind::MarkDependenceInst:
case SILInstructionKind::IndexAddrInst:
case SILInstructionKind::IndexRawPointerInst: {
SILValue operand, operand2;
unsigned Attr = 0;
if (SI.getKind() == SILInstructionKind::DeallocPartialRefInst) {
if (SI.getKind() == SILInstructionKind::CopyBlockWithoutEscapingInst) {
const CopyBlockWithoutEscapingInst *C = cast<CopyBlockWithoutEscapingInst>(&SI);
operand = C->getBlock();
operand2 = C->getClosure();
} else if (SI.getKind() == SILInstructionKind::DeallocPartialRefInst) {
const DeallocPartialRefInst *DPRI = cast<DeallocPartialRefInst>(&SI);
operand = DPRI->getInstance();
operand2 = DPRI->getMetatype();