@@ -127,8 +127,8 @@ AllocExistentialBoxInst *AllocExistentialBoxInst::create(
127127 SILType ConcreteLoweredType, ArrayRef<ProtocolConformance *> Conformances,
128128 SILFunction *F) {
129129 SILModule &Mod = F->getModule ();
130- void *Buffer = Mod.allocate (sizeof (AllocExistentialBoxInst),
131- alignof (AllocExistentialBoxInst));
130+ void *Buffer = Mod.allocateInst (sizeof (AllocExistentialBoxInst),
131+ alignof (AllocExistentialBoxInst));
132132 for (ProtocolConformance *C : Conformances)
133133 declareWitnessTable (Mod, C);
134134 return ::new (Buffer) AllocExistentialBoxInst (Loc,
@@ -143,7 +143,7 @@ BuiltinInst *BuiltinInst::create(SILDebugLocation *Loc, Identifier Name,
143143 ArrayRef<Substitution> Substitutions,
144144 ArrayRef<SILValue> Args,
145145 SILFunction &F) {
146- void *Buffer = F.getModule ().allocate (
146+ void *Buffer = F.getModule ().allocateInst (
147147 sizeof (BuiltinInst)
148148 + decltype (Operands)::getExtraSize (Args.size ())
149149 + sizeof (Substitution) * Substitutions.size (),
@@ -190,7 +190,7 @@ bool swift::doesApplyCalleeHaveSemantics(SILValue callee, StringRef semantics) {
190190}
191191
192192void *swift::allocateApplyInst (SILFunction &F, size_t size, size_t alignment) {
193- return F.getModule ().allocate (size, alignment);
193+ return F.getModule ().allocateInst (size, alignment);
194194}
195195
196196PartialApplyInst::PartialApplyInst (SILDebugLocation *Loc, SILValue Callee,
@@ -276,14 +276,14 @@ static unsigned getWordsForBitWidth(unsigned bits) {
276276
277277template <typename INST>
278278static void *allocateLiteralInstWithTextSize (SILFunction &F, unsigned length) {
279- return F.getModule ().allocate (sizeof (INST) + length, alignof (INST));
279+ return F.getModule ().allocateInst (sizeof (INST) + length, alignof (INST));
280280}
281281
282282template <typename INST>
283283static void *allocateLiteralInstWithBitSize (SILFunction &F, unsigned bits) {
284284 unsigned words = getWordsForBitWidth (bits);
285- return F.getModule ().allocate ( sizeof (INST) + sizeof (llvm::integerPart)*words,
286- alignof (INST));
285+ return F.getModule ().allocateInst (
286+ sizeof (INST) + sizeof (llvm::integerPart)*words, alignof (INST));
287287}
288288
289289IntegerLiteralInst::IntegerLiteralInst (SILDebugLocation *Loc, SILType Ty,
@@ -409,7 +409,7 @@ AssignInst::AssignInst(SILDebugLocation *Loc, SILValue Src, SILValue Dest)
409409MarkFunctionEscapeInst *
410410MarkFunctionEscapeInst::create (SILDebugLocation *Loc,
411411 ArrayRef<SILValue> Elements, SILFunction &F) {
412- void *Buffer = F.getModule ().allocate (sizeof (MarkFunctionEscapeInst) +
412+ void *Buffer = F.getModule ().allocateInst (sizeof (MarkFunctionEscapeInst) +
413413 decltype (Operands)::getExtraSize (Elements.size ()),
414414 alignof (MarkFunctionEscapeInst));
415415 return ::new (Buffer) MarkFunctionEscapeInst (Loc, Elements);
@@ -452,7 +452,7 @@ UnconditionalCheckedCastAddrInst::UnconditionalCheckedCastAddrInst(
452452
453453StructInst *StructInst::create (SILDebugLocation *Loc, SILType Ty,
454454 ArrayRef<SILValue> Elements, SILFunction &F) {
455- void *Buffer = F.getModule ().allocate (sizeof (StructInst) +
455+ void *Buffer = F.getModule ().allocateInst (sizeof (StructInst) +
456456 decltype (Operands)::getExtraSize (Elements.size ()),
457457 alignof (StructInst));
458458 return ::new (Buffer) StructInst (Loc, Ty, Elements);
@@ -466,7 +466,7 @@ StructInst::StructInst(SILDebugLocation *Loc, SILType Ty,
466466
467467TupleInst *TupleInst::create (SILDebugLocation *Loc, SILType Ty,
468468 ArrayRef<SILValue> Elements, SILFunction &F) {
469- void *Buffer = F.getModule ().allocate (sizeof (TupleInst) +
469+ void *Buffer = F.getModule ().allocateInst (sizeof (TupleInst) +
470470 decltype (Operands)::getExtraSize (Elements.size ()),
471471 alignof (TupleInst));
472472 return ::new (Buffer) TupleInst (Loc, Ty, Elements);
@@ -669,7 +669,7 @@ BranchInst *BranchInst::create(SILDebugLocation *Loc, SILBasicBlock *DestBB,
669669BranchInst *BranchInst::create (SILDebugLocation *Loc,
670670 SILBasicBlock *DestBB, ArrayRef<SILValue> Args,
671671 SILFunction &F) {
672- void *Buffer = F.getModule ().allocate (sizeof (BranchInst) +
672+ void *Buffer = F.getModule ().allocateInst (sizeof (BranchInst) +
673673 decltype (Operands)::getExtraSize (Args.size ()),
674674 alignof (BranchInst));
675675 return ::new (Buffer) BranchInst (Loc, DestBB, Args);
@@ -703,7 +703,7 @@ CondBranchInst::create(SILDebugLocation *Loc, SILValue Condition,
703703 Args.append (TrueArgs.begin (), TrueArgs.end ());
704704 Args.append (FalseArgs.begin (), FalseArgs.end ());
705705
706- void *Buffer = F.getModule ().allocate (sizeof (CondBranchInst) +
706+ void *Buffer = F.getModule ().allocateInst (sizeof (CondBranchInst) +
707707 decltype (Operands)::getExtraSize (Args.size ()),
708708 alignof (CondBranchInst));
709709 return ::new (Buffer) CondBranchInst (Loc, Condition, TrueBB, FalseBB, Args,
@@ -853,7 +853,7 @@ SwitchValueInst *SwitchValueInst::create(
853853 size_t bufSize = sizeof (SwitchValueInst) +
854854 decltype (Operands)::getExtraSize (Cases.size ()) +
855855 sizeof (SILSuccessor) * numSuccessors;
856- void *buf = F.getModule ().allocate (bufSize, alignof (SwitchValueInst));
856+ void *buf = F.getModule ().allocateInst (bufSize, alignof (SwitchValueInst));
857857 return ::new (buf) SwitchValueInst (Loc, Operand, DefaultBB, Cases, BBs);
858858}
859859
@@ -901,7 +901,7 @@ SelectValueInst::create(SILDebugLocation *Loc, SILValue Operand, SILType Type,
901901
902902 size_t bufSize = sizeof (SelectValueInst) + decltype (Operands)::getExtraSize (
903903 CaseValuesAndResults.size ());
904- void *buf = F.getModule ().allocate (bufSize, alignof (SelectValueInst));
904+ void *buf = F.getModule ().allocateInst (bufSize, alignof (SelectValueInst));
905905 return ::new (buf)
906906 SelectValueInst (Loc, Operand, Type, DefaultResult, CaseValuesAndResults);
907907}
@@ -942,7 +942,7 @@ SELECT_ENUM_INST *SelectEnumInstBase::createSelectEnum(
942942 // and `CaseBBs.size() + (DefaultBB ? 1 : 0)` values.
943943 unsigned numCases = CaseValues.size ();
944944
945- void *buf = F.getModule ().allocate (
945+ void *buf = F.getModule ().allocateInst (
946946 sizeof (SELECT_ENUM_INST) + sizeof (EnumElementDecl*) * numCases
947947 + TailAllocatedOperandList<1 >::getExtraSize (numCases + (bool )DefaultValue),
948948 alignof (SELECT_ENUM_INST));
@@ -1063,7 +1063,7 @@ SWITCH_ENUM_INST *SwitchEnumInstBase::createSwitchEnum(
10631063 unsigned numCases = CaseBBs.size ();
10641064 unsigned numSuccessors = numCases + (DefaultBB ? 1 : 0 );
10651065
1066- void *buf = F.getModule ().allocate (sizeof (SWITCH_ENUM_INST)
1066+ void *buf = F.getModule ().allocateInst (sizeof (SWITCH_ENUM_INST)
10671067 + sizeof (EnumElementDecl*) * numCases
10681068 + sizeof (SILSuccessor) * numSuccessors,
10691069 alignof (SWITCH_ENUM_INST));
@@ -1129,8 +1129,8 @@ DynamicMethodBranchInst *
11291129DynamicMethodBranchInst::create (SILDebugLocation *Loc, SILValue Operand,
11301130 SILDeclRef Member, SILBasicBlock *HasMethodBB,
11311131 SILBasicBlock *NoMethodBB, SILFunction &F) {
1132- void *Buffer = F.getModule ().allocate (sizeof (DynamicMethodBranchInst),
1133- alignof (DynamicMethodBranchInst));
1132+ void *Buffer = F.getModule ().allocateInst (sizeof (DynamicMethodBranchInst),
1133+ alignof (DynamicMethodBranchInst));
11341134 return ::new (Buffer)
11351135 DynamicMethodBranchInst (Loc, Operand, Member, HasMethodBB, NoMethodBB);
11361136}
@@ -1172,7 +1172,7 @@ WitnessMethodInst::create(SILDebugLocation *Loc, CanType LookupType,
11721172 SILValue OpenedExistential, bool Volatile) {
11731173 SILModule &Mod = F->getModule ();
11741174 void *Buffer =
1175- Mod.allocate (sizeof (WitnessMethodInst), alignof (WitnessMethodInst));
1175+ Mod.allocateInst (sizeof (WitnessMethodInst), alignof (WitnessMethodInst));
11761176
11771177 declareWitnessTable (Mod, Conformance);
11781178 return ::new (Buffer) WitnessMethodInst (Loc, LookupType, Conformance, Member,
@@ -1184,8 +1184,8 @@ InitExistentialAddrInst *InitExistentialAddrInst::create(
11841184 SILType ConcreteLoweredType, ArrayRef<ProtocolConformance *> Conformances,
11851185 SILFunction *F) {
11861186 SILModule &Mod = F->getModule ();
1187- void *Buffer = Mod.allocate (sizeof (InitExistentialAddrInst),
1188- alignof (InitExistentialAddrInst));
1187+ void *Buffer = Mod.allocateInst (sizeof (InitExistentialAddrInst),
1188+ alignof (InitExistentialAddrInst));
11891189 for (ProtocolConformance *C : Conformances)
11901190 declareWitnessTable (Mod, C);
11911191 return ::new (Buffer) InitExistentialAddrInst (Loc, Existential,
@@ -1200,8 +1200,8 @@ InitExistentialRefInst::create(SILDebugLocation *Loc, SILType ExistentialType,
12001200 ArrayRef<ProtocolConformance *> Conformances,
12011201 SILFunction *F) {
12021202 SILModule &Mod = F->getModule ();
1203- void *Buffer = Mod.allocate (sizeof (InitExistentialRefInst),
1204- alignof (InitExistentialRefInst));
1203+ void *Buffer = Mod.allocateInst (sizeof (InitExistentialRefInst),
1204+ alignof (InitExistentialRefInst));
12051205 for (ProtocolConformance *C : Conformances) {
12061206 if (!C)
12071207 continue ;
@@ -1235,7 +1235,7 @@ InitExistentialMetatypeInst *InitExistentialMetatypeInst::create(
12351235 unsigned size = sizeof (InitExistentialMetatypeInst);
12361236 size += conformances.size () * sizeof (ProtocolConformance *);
12371237
1238- void *buffer = M.allocate (size, alignof (InitExistentialMetatypeInst));
1238+ void *buffer = M.allocateInst (size, alignof (InitExistentialMetatypeInst));
12391239 for (ProtocolConformance *conformance : conformances)
12401240 if (!M.lookUpWitnessTable (conformance, false ).first )
12411241 declareWitnessTable (M, conformance);
0 commit comments