@@ -2145,6 +2145,26 @@ class AllocRefInstBase : public AllocationInst {
21452145 bool isObjC () const {
21462146 return SILNode::Bits.AllocRefInstBase .ObjC ;
21472147 }
2148+
2149+ static bool classof (SILNodePointer node) {
2150+ if (auto *i = dyn_cast<SILInstruction>(node.get ()))
2151+ return classof (i);
2152+ return false ;
2153+ }
2154+
2155+ static bool classof (const SILInstruction *inst) {
2156+ return classof (inst->getKind ());
2157+ }
2158+
2159+ static bool classof (SILInstructionKind kind) {
2160+ switch (kind) {
2161+ case SILInstructionKind::AllocRefInst:
2162+ case SILInstructionKind::AllocRefDynamicInst:
2163+ return true ;
2164+ default :
2165+ return false ;
2166+ }
2167+ }
21482168};
21492169
21502170// / AllocRefInst - This represents the primitive allocation of an instance
@@ -2205,10 +2225,11 @@ class AllocRefDynamicInst final
22052225 AllocRefDynamicInst (SILDebugLocation DebugLoc,
22062226 SILType ty,
22072227 bool objc,
2228+ bool canBeOnStack,
22082229 ArrayRef<SILType> ElementTypes,
22092230 ArrayRef<SILValue> AllOperands)
22102231 : InstructionBaseWithTrailingOperands(AllOperands, DebugLoc, ty, objc,
2211- false , ElementTypes) {
2232+ canBeOnStack , ElementTypes) {
22122233 assert (AllOperands.size () >= ElementTypes.size () + 1 );
22132234 std::uninitialized_copy (ElementTypes.begin (), ElementTypes.end (),
22142235 getTrailingObjects<SILType>());
@@ -2217,6 +2238,7 @@ class AllocRefDynamicInst final
22172238 static AllocRefDynamicInst *
22182239 create (SILDebugLocation DebugLoc, SILFunction &F,
22192240 SILValue metatypeOperand, SILType ty, bool objc,
2241+ bool canBeOnStack,
22202242 ArrayRef<SILType> ElementTypes,
22212243 ArrayRef<SILValue> ElementCountOperands);
22222244
@@ -2232,6 +2254,9 @@ class AllocRefDynamicInst final
22322254 MutableArrayRef<Operand> getTypeDependentOperands () {
22332255 return getAllOperands ().slice (getNumTailTypes () + 1 );
22342256 }
2257+ // Is the deinit and the size of the dynamic type known to be equivalent to
2258+ // the the base type (i.e `this->getType()`).
2259+ bool isDynamicTypeDeinitAndSizeKnownEquivalentToBaseType () const ;
22352260};
22362261
22372262// / This represents the allocation of a heap box for a Swift value of some type.
@@ -7692,7 +7717,9 @@ class DeallocStackRefInst
76927717 DeallocStackRefInst (SILDebugLocation DebugLoc, SILValue Operand)
76937718 : UnaryInstructionBase(DebugLoc, Operand) {}
76947719public:
7695- AllocRefInst *getAllocRef () { return cast<AllocRefInst>(getOperand ()); }
7720+ AllocRefInstBase *getAllocRef () {
7721+ return cast<AllocRefInstBase>(getOperand ());
7722+ }
76967723};
76977724
76987725// / Deallocate memory for a reference type instance from a destructor or
0 commit comments