@@ -2115,6 +2115,35 @@ class AllocStackInst final
21152115 DeallocStackInst *getSingleDeallocStack () const ;
21162116};
21172117
2118+ // / AllocVectorInst - Like AllocStackInst, but allocates a vector of elements.
2119+ class AllocVectorInst final
2120+ : public UnaryInstructionWithTypeDependentOperandsBase<
2121+ SILInstructionKind::AllocVectorInst, AllocVectorInst, AllocationInst> {
2122+ friend SILBuilder;
2123+
2124+ AllocVectorInst (SILDebugLocation loc, SILValue capacity, SILType resultType,
2125+ ArrayRef<SILValue> typeDependentOperands)
2126+ : UnaryInstructionWithTypeDependentOperandsBase(loc, capacity,
2127+ typeDependentOperands,
2128+ resultType) {
2129+ }
2130+
2131+ static AllocVectorInst *create (SILDebugLocation Loc, SILValue capacity,
2132+ SILType elementType, SILFunction &F);
2133+
2134+ static AllocVectorInst *createInInitializer (SILDebugLocation Loc,
2135+ SILValue capacity, SILType elementType, SILModule &M);
2136+
2137+ public:
2138+ // / getElementType - Get the type of the allocated memory (as opposed to the
2139+ // / type of the instruction itself, which will be an address type).
2140+ SILType getElementType () const {
2141+ return getType ().getObjectType ();
2142+ }
2143+
2144+ SILValue getCapacity () const { return getOperand (); }
2145+ };
2146+
21182147// / AllocPackInst - This represents the allocation of a value pack
21192148// / in stack memory. The memory is provided uninitialized.
21202149class AllocPackInst final
@@ -6294,6 +6323,28 @@ class ObjectInst final : public InstructionBaseWithTrailingOperands<
62946323 }
62956324};
62966325
6326+ // / VectorInst - Represents a vector value type.
6327+ // /
6328+ // / This instruction can only appear at the end of a global variable's
6329+ // / static initializer list.
6330+ class VectorInst final : public InstructionBaseWithTrailingOperands<
6331+ SILInstructionKind::VectorInst, VectorInst,
6332+ SingleValueInstruction> {
6333+ friend SILBuilder;
6334+
6335+ VectorInst (SILDebugLocation DebugLoc, ArrayRef<SILValue> Elements)
6336+ : InstructionBaseWithTrailingOperands(Elements, DebugLoc,
6337+ Elements[0 ]->getType ()) {}
6338+
6339+ static VectorInst *create (SILDebugLocation DebugLoc,
6340+ ArrayRef<SILValue> Elements,
6341+ SILModule &M);
6342+ public:
6343+ OperandValueArrayRef getElements () const {
6344+ return OperandValueArrayRef (getAllOperands ());
6345+ }
6346+ };
6347+
62976348// / TupleInst - Represents a constructed loadable tuple.
62986349class TupleInst final : public InstructionBaseWithTrailingOperands<
62996350 SILInstructionKind::TupleInst, TupleInst,
0 commit comments