mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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));
|
||||
case SILInstructionKind::AllocPackInst:
|
||||
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:
|
||||
llvm_unreachable("unknown stack allocation");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user