handle upcast instructions in statically initialized globals

This allows statically initialized multi-dimensional arrays in embedded swift.
This commit is contained in:
Erik Eckstein
2024-05-21 13:33:06 +02:00
parent 1a32cfe426
commit 941a7427d8
5 changed files with 21 additions and 0 deletions

View File

@@ -2714,6 +2714,15 @@ MetatypeInst *MetatypeInst::create(SILDebugLocation Loc, SILType Ty,
return ::new (Buffer) MetatypeInst(Loc, Ty, TypeDependentOperands);
}
UpcastInst *UpcastInst::create(SILDebugLocation DebugLoc, SILValue Operand,
SILType Ty, SILModule &Mod,
ValueOwnershipKind forwardingOwnershipKind) {
unsigned size = totalSizeToAlloc<swift::Operand>(1);
void *Buffer = Mod.allocateInst(size, alignof(UpcastInst));
return ::new (Buffer) UpcastInst(DebugLoc, Operand, {}, Ty,
forwardingOwnershipKind);
}
UpcastInst *UpcastInst::create(SILDebugLocation DebugLoc, SILValue Operand,
SILType Ty, SILFunction &F,
ValueOwnershipKind forwardingOwnershipKind) {