@@ -127,8 +127,8 @@ AllocExistentialBoxInst *AllocExistentialBoxInst::create(
127
127
SILType ConcreteLoweredType, ArrayRef<ProtocolConformance *> Conformances,
128
128
SILFunction *F) {
129
129
SILModule &Mod = F->getModule ();
130
- void *Buffer = Mod.allocate (sizeof (AllocExistentialBoxInst),
131
- alignof (AllocExistentialBoxInst));
130
+ void *Buffer = Mod.allocateInst (sizeof (AllocExistentialBoxInst),
131
+ alignof (AllocExistentialBoxInst));
132
132
for (ProtocolConformance *C : Conformances)
133
133
declareWitnessTable (Mod, C);
134
134
return ::new (Buffer) AllocExistentialBoxInst (Loc,
@@ -143,7 +143,7 @@ BuiltinInst *BuiltinInst::create(SILDebugLocation *Loc, Identifier Name,
143
143
ArrayRef<Substitution> Substitutions,
144
144
ArrayRef<SILValue> Args,
145
145
SILFunction &F) {
146
- void *Buffer = F.getModule ().allocate (
146
+ void *Buffer = F.getModule ().allocateInst (
147
147
sizeof (BuiltinInst)
148
148
+ decltype (Operands)::getExtraSize (Args.size ())
149
149
+ sizeof (Substitution) * Substitutions.size (),
@@ -190,7 +190,7 @@ bool swift::doesApplyCalleeHaveSemantics(SILValue callee, StringRef semantics) {
190
190
}
191
191
192
192
void *swift::allocateApplyInst (SILFunction &F, size_t size, size_t alignment) {
193
- return F.getModule ().allocate (size, alignment);
193
+ return F.getModule ().allocateInst (size, alignment);
194
194
}
195
195
196
196
PartialApplyInst::PartialApplyInst (SILDebugLocation *Loc, SILValue Callee,
@@ -276,14 +276,14 @@ static unsigned getWordsForBitWidth(unsigned bits) {
276
276
277
277
template <typename INST>
278
278
static 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));
280
280
}
281
281
282
282
template <typename INST>
283
283
static void *allocateLiteralInstWithBitSize (SILFunction &F, unsigned bits) {
284
284
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));
287
287
}
288
288
289
289
IntegerLiteralInst::IntegerLiteralInst (SILDebugLocation *Loc, SILType Ty,
@@ -409,7 +409,7 @@ AssignInst::AssignInst(SILDebugLocation *Loc, SILValue Src, SILValue Dest)
409
409
MarkFunctionEscapeInst *
410
410
MarkFunctionEscapeInst::create (SILDebugLocation *Loc,
411
411
ArrayRef<SILValue> Elements, SILFunction &F) {
412
- void *Buffer = F.getModule ().allocate (sizeof (MarkFunctionEscapeInst) +
412
+ void *Buffer = F.getModule ().allocateInst (sizeof (MarkFunctionEscapeInst) +
413
413
decltype (Operands)::getExtraSize (Elements.size ()),
414
414
alignof (MarkFunctionEscapeInst));
415
415
return ::new (Buffer) MarkFunctionEscapeInst (Loc, Elements);
@@ -452,7 +452,7 @@ UnconditionalCheckedCastAddrInst::UnconditionalCheckedCastAddrInst(
452
452
453
453
StructInst *StructInst::create (SILDebugLocation *Loc, SILType Ty,
454
454
ArrayRef<SILValue> Elements, SILFunction &F) {
455
- void *Buffer = F.getModule ().allocate (sizeof (StructInst) +
455
+ void *Buffer = F.getModule ().allocateInst (sizeof (StructInst) +
456
456
decltype (Operands)::getExtraSize (Elements.size ()),
457
457
alignof (StructInst));
458
458
return ::new (Buffer) StructInst (Loc, Ty, Elements);
@@ -466,7 +466,7 @@ StructInst::StructInst(SILDebugLocation *Loc, SILType Ty,
466
466
467
467
TupleInst *TupleInst::create (SILDebugLocation *Loc, SILType Ty,
468
468
ArrayRef<SILValue> Elements, SILFunction &F) {
469
- void *Buffer = F.getModule ().allocate (sizeof (TupleInst) +
469
+ void *Buffer = F.getModule ().allocateInst (sizeof (TupleInst) +
470
470
decltype (Operands)::getExtraSize (Elements.size ()),
471
471
alignof (TupleInst));
472
472
return ::new (Buffer) TupleInst (Loc, Ty, Elements);
@@ -669,7 +669,7 @@ BranchInst *BranchInst::create(SILDebugLocation *Loc, SILBasicBlock *DestBB,
669
669
BranchInst *BranchInst::create (SILDebugLocation *Loc,
670
670
SILBasicBlock *DestBB, ArrayRef<SILValue> Args,
671
671
SILFunction &F) {
672
- void *Buffer = F.getModule ().allocate (sizeof (BranchInst) +
672
+ void *Buffer = F.getModule ().allocateInst (sizeof (BranchInst) +
673
673
decltype (Operands)::getExtraSize (Args.size ()),
674
674
alignof (BranchInst));
675
675
return ::new (Buffer) BranchInst (Loc, DestBB, Args);
@@ -703,7 +703,7 @@ CondBranchInst::create(SILDebugLocation *Loc, SILValue Condition,
703
703
Args.append (TrueArgs.begin (), TrueArgs.end ());
704
704
Args.append (FalseArgs.begin (), FalseArgs.end ());
705
705
706
- void *Buffer = F.getModule ().allocate (sizeof (CondBranchInst) +
706
+ void *Buffer = F.getModule ().allocateInst (sizeof (CondBranchInst) +
707
707
decltype (Operands)::getExtraSize (Args.size ()),
708
708
alignof (CondBranchInst));
709
709
return ::new (Buffer) CondBranchInst (Loc, Condition, TrueBB, FalseBB, Args,
@@ -853,7 +853,7 @@ SwitchValueInst *SwitchValueInst::create(
853
853
size_t bufSize = sizeof (SwitchValueInst) +
854
854
decltype (Operands)::getExtraSize (Cases.size ()) +
855
855
sizeof (SILSuccessor) * numSuccessors;
856
- void *buf = F.getModule ().allocate (bufSize, alignof (SwitchValueInst));
856
+ void *buf = F.getModule ().allocateInst (bufSize, alignof (SwitchValueInst));
857
857
return ::new (buf) SwitchValueInst (Loc, Operand, DefaultBB, Cases, BBs);
858
858
}
859
859
@@ -901,7 +901,7 @@ SelectValueInst::create(SILDebugLocation *Loc, SILValue Operand, SILType Type,
901
901
902
902
size_t bufSize = sizeof (SelectValueInst) + decltype (Operands)::getExtraSize (
903
903
CaseValuesAndResults.size ());
904
- void *buf = F.getModule ().allocate (bufSize, alignof (SelectValueInst));
904
+ void *buf = F.getModule ().allocateInst (bufSize, alignof (SelectValueInst));
905
905
return ::new (buf)
906
906
SelectValueInst (Loc, Operand, Type, DefaultResult, CaseValuesAndResults);
907
907
}
@@ -942,7 +942,7 @@ SELECT_ENUM_INST *SelectEnumInstBase::createSelectEnum(
942
942
// and `CaseBBs.size() + (DefaultBB ? 1 : 0)` values.
943
943
unsigned numCases = CaseValues.size ();
944
944
945
- void *buf = F.getModule ().allocate (
945
+ void *buf = F.getModule ().allocateInst (
946
946
sizeof (SELECT_ENUM_INST) + sizeof (EnumElementDecl*) * numCases
947
947
+ TailAllocatedOperandList<1 >::getExtraSize (numCases + (bool )DefaultValue),
948
948
alignof (SELECT_ENUM_INST));
@@ -1063,7 +1063,7 @@ SWITCH_ENUM_INST *SwitchEnumInstBase::createSwitchEnum(
1063
1063
unsigned numCases = CaseBBs.size ();
1064
1064
unsigned numSuccessors = numCases + (DefaultBB ? 1 : 0 );
1065
1065
1066
- void *buf = F.getModule ().allocate (sizeof (SWITCH_ENUM_INST)
1066
+ void *buf = F.getModule ().allocateInst (sizeof (SWITCH_ENUM_INST)
1067
1067
+ sizeof (EnumElementDecl*) * numCases
1068
1068
+ sizeof (SILSuccessor) * numSuccessors,
1069
1069
alignof (SWITCH_ENUM_INST));
@@ -1129,8 +1129,8 @@ DynamicMethodBranchInst *
1129
1129
DynamicMethodBranchInst::create (SILDebugLocation *Loc, SILValue Operand,
1130
1130
SILDeclRef Member, SILBasicBlock *HasMethodBB,
1131
1131
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));
1134
1134
return ::new (Buffer)
1135
1135
DynamicMethodBranchInst (Loc, Operand, Member, HasMethodBB, NoMethodBB);
1136
1136
}
@@ -1172,7 +1172,7 @@ WitnessMethodInst::create(SILDebugLocation *Loc, CanType LookupType,
1172
1172
SILValue OpenedExistential, bool Volatile) {
1173
1173
SILModule &Mod = F->getModule ();
1174
1174
void *Buffer =
1175
- Mod.allocate (sizeof (WitnessMethodInst), alignof (WitnessMethodInst));
1175
+ Mod.allocateInst (sizeof (WitnessMethodInst), alignof (WitnessMethodInst));
1176
1176
1177
1177
declareWitnessTable (Mod, Conformance);
1178
1178
return ::new (Buffer) WitnessMethodInst (Loc, LookupType, Conformance, Member,
@@ -1184,8 +1184,8 @@ InitExistentialAddrInst *InitExistentialAddrInst::create(
1184
1184
SILType ConcreteLoweredType, ArrayRef<ProtocolConformance *> Conformances,
1185
1185
SILFunction *F) {
1186
1186
SILModule &Mod = F->getModule ();
1187
- void *Buffer = Mod.allocate (sizeof (InitExistentialAddrInst),
1188
- alignof (InitExistentialAddrInst));
1187
+ void *Buffer = Mod.allocateInst (sizeof (InitExistentialAddrInst),
1188
+ alignof (InitExistentialAddrInst));
1189
1189
for (ProtocolConformance *C : Conformances)
1190
1190
declareWitnessTable (Mod, C);
1191
1191
return ::new (Buffer) InitExistentialAddrInst (Loc, Existential,
@@ -1200,8 +1200,8 @@ InitExistentialRefInst::create(SILDebugLocation *Loc, SILType ExistentialType,
1200
1200
ArrayRef<ProtocolConformance *> Conformances,
1201
1201
SILFunction *F) {
1202
1202
SILModule &Mod = F->getModule ();
1203
- void *Buffer = Mod.allocate (sizeof (InitExistentialRefInst),
1204
- alignof (InitExistentialRefInst));
1203
+ void *Buffer = Mod.allocateInst (sizeof (InitExistentialRefInst),
1204
+ alignof (InitExistentialRefInst));
1205
1205
for (ProtocolConformance *C : Conformances) {
1206
1206
if (!C)
1207
1207
continue ;
@@ -1235,7 +1235,7 @@ InitExistentialMetatypeInst *InitExistentialMetatypeInst::create(
1235
1235
unsigned size = sizeof (InitExistentialMetatypeInst);
1236
1236
size += conformances.size () * sizeof (ProtocolConformance *);
1237
1237
1238
- void *buffer = M.allocate (size, alignof (InitExistentialMetatypeInst));
1238
+ void *buffer = M.allocateInst (size, alignof (InitExistentialMetatypeInst));
1239
1239
for (ProtocolConformance *conformance : conformances)
1240
1240
if (!M.lookUpWitnessTable (conformance, false ).first )
1241
1241
declareWitnessTable (M, conformance);
0 commit comments