mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[StackNesting] Handle stackAlloc builtins.
Both stackAlloc and unprotectedStackAlloc are paired with stackDealloc builtins.
This commit is contained in:
@@ -219,6 +219,17 @@ static SILInstruction *createDealloc(SILInstruction *Alloc,
|
|||||||
return B.createDeallocStackRef(Location, cast<AllocRefInstBase>(Alloc));
|
return B.createDeallocStackRef(Location, cast<AllocRefInstBase>(Alloc));
|
||||||
case SILInstructionKind::AllocPackInst:
|
case SILInstructionKind::AllocPackInst:
|
||||||
return B.createDeallocPack(Location, cast<AllocPackInst>(Alloc));
|
return B.createDeallocPack(Location, cast<AllocPackInst>(Alloc));
|
||||||
|
case SILInstructionKind::BuiltinInst: {
|
||||||
|
auto *bi = cast<BuiltinInst>(Alloc);
|
||||||
|
assert(bi->getBuiltinKind() == BuiltinValueKind::StackAlloc ||
|
||||||
|
bi->getBuiltinKind() == BuiltinValueKind::UnprotectedStackAlloc);
|
||||||
|
auto &context = Alloc->getFunction()->getModule().getASTContext();
|
||||||
|
auto identifier =
|
||||||
|
context.getIdentifier(getBuiltinName(BuiltinValueKind::StackDealloc));
|
||||||
|
return B.createBuiltin(Location, identifier,
|
||||||
|
SILType::getEmptyTupleType(context),
|
||||||
|
SubstitutionMap(), {bi});
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("unknown stack allocation");
|
llvm_unreachable("unknown stack allocation");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user