@@ -136,8 +136,8 @@ AllocExistentialBoxInst::create(SILLocation Loc,
136
136
ArrayRef<ProtocolConformance *> Conformances,
137
137
SILFunction *F) {
138
138
SILModule &Mod = F->getModule ();
139
- void *Buffer = Mod.allocateInst (sizeof (AllocExistentialBoxInst),
140
- alignof (AllocExistentialBoxInst));
139
+ void *Buffer = Mod.allocate (sizeof (AllocExistentialBoxInst),
140
+ alignof (AllocExistentialBoxInst));
141
141
for (ProtocolConformance *C : Conformances)
142
142
declareWitnessTable (Mod, C);
143
143
return ::new (Buffer) AllocExistentialBoxInst (Loc,
@@ -152,7 +152,7 @@ BuiltinInst *BuiltinInst::create(SILLocation Loc, Identifier Name,
152
152
ArrayRef<Substitution> Substitutions,
153
153
ArrayRef<SILValue> Args,
154
154
SILFunction &F) {
155
- void *Buffer = F.getModule ().allocateInst (
155
+ void *Buffer = F.getModule ().allocate (
156
156
sizeof (BuiltinInst)
157
157
+ decltype (Operands)::getExtraSize (Args.size ())
158
158
+ sizeof (Substitution) * Substitutions.size (),
@@ -209,7 +209,7 @@ bool swift::doesApplyCalleeHaveSemantics(SILValue callee, StringRef semantics) {
209
209
}
210
210
211
211
void *swift::allocateApplyInst (SILFunction &F, size_t size, size_t alignment) {
212
- return F.getModule ().allocateInst (size, alignment);
212
+ return F.getModule ().allocate (size, alignment);
213
213
}
214
214
215
215
PartialApplyInst::PartialApplyInst (SILLocation Loc, SILValue Callee,
@@ -303,14 +303,14 @@ static unsigned getWordsForBitWidth(unsigned bits) {
303
303
304
304
template <typename INST>
305
305
static void *allocateLiteralInstWithTextSize (SILFunction &F, unsigned length) {
306
- return F.getModule ().allocateInst (sizeof (INST) + length, alignof (INST));
306
+ return F.getModule ().allocate (sizeof (INST) + length, alignof (INST));
307
307
}
308
308
309
309
template <typename INST>
310
310
static void *allocateLiteralInstWithBitSize (SILFunction &F, unsigned bits) {
311
311
unsigned words = getWordsForBitWidth (bits);
312
- return F.getModule ().allocateInst (
313
- sizeof (INST) + sizeof (llvm::integerPart)*words, alignof (INST));
312
+ return F.getModule ().allocate ( sizeof (INST) + sizeof (llvm::integerPart)*words,
313
+ alignof (INST));
314
314
}
315
315
316
316
IntegerLiteralInst::IntegerLiteralInst (SILLocation Loc, SILType Ty,
@@ -442,7 +442,7 @@ AssignInst::AssignInst(SILLocation Loc, SILValue Src, SILValue Dest)
442
442
MarkFunctionEscapeInst *
443
443
MarkFunctionEscapeInst::create (SILLocation Loc,
444
444
ArrayRef<SILValue> Elements, SILFunction &F) {
445
- void *Buffer = F.getModule ().allocateInst (sizeof (MarkFunctionEscapeInst) +
445
+ void *Buffer = F.getModule ().allocate (sizeof (MarkFunctionEscapeInst) +
446
446
decltype (Operands)::getExtraSize (Elements.size ()),
447
447
alignof (MarkFunctionEscapeInst));
448
448
return ::new (Buffer) MarkFunctionEscapeInst (Loc, Elements);
@@ -499,7 +499,7 @@ UnconditionalCheckedCastAddrInst(SILLocation loc,
499
499
500
500
StructInst *StructInst::create (SILLocation Loc, SILType Ty,
501
501
ArrayRef<SILValue> Elements, SILFunction &F) {
502
- void *Buffer = F.getModule ().allocateInst (sizeof (StructInst) +
502
+ void *Buffer = F.getModule ().allocate (sizeof (StructInst) +
503
503
decltype (Operands)::getExtraSize (Elements.size ()),
504
504
alignof (StructInst));
505
505
return ::new (Buffer) StructInst (Loc, Ty, Elements);
@@ -512,7 +512,7 @@ StructInst::StructInst(SILLocation Loc, SILType Ty, ArrayRef<SILValue> Elems)
512
512
513
513
TupleInst *TupleInst::create (SILLocation Loc, SILType Ty,
514
514
ArrayRef<SILValue> Elements, SILFunction &F) {
515
- void *Buffer = F.getModule ().allocateInst (sizeof (TupleInst) +
515
+ void *Buffer = F.getModule ().allocate (sizeof (TupleInst) +
516
516
decltype (Operands)::getExtraSize (Elements.size ()),
517
517
alignof (TupleInst));
518
518
return ::new (Buffer) TupleInst (Loc, Ty, Elements);
@@ -717,7 +717,7 @@ BranchInst *BranchInst::create(SILLocation Loc,
717
717
BranchInst *BranchInst::create (SILLocation Loc,
718
718
SILBasicBlock *DestBB, ArrayRef<SILValue> Args,
719
719
SILFunction &F) {
720
- void *Buffer = F.getModule ().allocateInst (sizeof (BranchInst) +
720
+ void *Buffer = F.getModule ().allocate (sizeof (BranchInst) +
721
721
decltype (Operands)::getExtraSize (Args.size ()),
722
722
alignof (BranchInst));
723
723
return ::new (Buffer) BranchInst (Loc, DestBB, Args);
@@ -752,7 +752,7 @@ CondBranchInst *CondBranchInst::create(SILLocation Loc, SILValue Condition,
752
752
Args.append (TrueArgs.begin (), TrueArgs.end ());
753
753
Args.append (FalseArgs.begin (), FalseArgs.end ());
754
754
755
- void *Buffer = F.getModule ().allocateInst (sizeof (CondBranchInst) +
755
+ void *Buffer = F.getModule ().allocate (sizeof (CondBranchInst) +
756
756
decltype (Operands)::getExtraSize (Args.size ()),
757
757
alignof (CondBranchInst));
758
758
return ::new (Buffer) CondBranchInst (Loc, Condition, TrueBB, FalseBB, Args,
@@ -905,7 +905,7 @@ SwitchValueInst *SwitchValueInst::create(
905
905
size_t bufSize = sizeof (SwitchValueInst) +
906
906
decltype (Operands)::getExtraSize (Cases.size ()) +
907
907
sizeof (SILSuccessor) * numSuccessors;
908
- void *buf = F.getModule ().allocateInst (bufSize, alignof (SwitchValueInst));
908
+ void *buf = F.getModule ().allocate (bufSize, alignof (SwitchValueInst));
909
909
return ::new (buf) SwitchValueInst (Loc, Operand, DefaultBB, Cases, BBs);
910
910
}
911
911
@@ -956,7 +956,7 @@ SelectValueInst::create(SILLocation Loc, SILValue Operand, SILType Type,
956
956
957
957
size_t bufSize = sizeof (SelectValueInst) + decltype (Operands)::getExtraSize (
958
958
CaseValuesAndResults.size ());
959
- void *buf = F.getModule ().allocateInst (bufSize, alignof (SelectValueInst));
959
+ void *buf = F.getModule ().allocate (bufSize, alignof (SelectValueInst));
960
960
return ::new (buf)
961
961
SelectValueInst (Loc, Operand, Type, DefaultResult, CaseValuesAndResults);
962
962
}
@@ -999,7 +999,7 @@ SelectEnumInstBase::createSelectEnum(SILLocation Loc, SILValue Operand,
999
999
// and `CaseBBs.size() + (DefaultBB ? 1 : 0)` values.
1000
1000
unsigned numCases = CaseValues.size ();
1001
1001
1002
- void *buf = F.getModule ().allocateInst (
1002
+ void *buf = F.getModule ().allocate (
1003
1003
sizeof (SELECT_ENUM_INST) + sizeof (EnumElementDecl*) * numCases
1004
1004
+ TailAllocatedOperandList<1 >::getExtraSize (numCases + (bool )DefaultValue),
1005
1005
alignof (SELECT_ENUM_INST));
@@ -1125,7 +1125,7 @@ SwitchEnumInstBase::createSwitchEnum(SILLocation Loc, SILValue Operand,
1125
1125
unsigned numCases = CaseBBs.size ();
1126
1126
unsigned numSuccessors = numCases + (DefaultBB ? 1 : 0 );
1127
1127
1128
- void *buf = F.getModule ().allocateInst (sizeof (SWITCH_ENUM_INST)
1128
+ void *buf = F.getModule ().allocate (sizeof (SWITCH_ENUM_INST)
1129
1129
+ sizeof (EnumElementDecl*) * numCases
1130
1130
+ sizeof (SILSuccessor) * numSuccessors,
1131
1131
alignof (SWITCH_ENUM_INST));
@@ -1195,8 +1195,8 @@ DynamicMethodBranchInst *DynamicMethodBranchInst::create(
1195
1195
SILBasicBlock *HasMethodBB,
1196
1196
SILBasicBlock *NoMethodBB,
1197
1197
SILFunction &F) {
1198
- void *Buffer = F.getModule ().allocateInst (sizeof (DynamicMethodBranchInst),
1199
- alignof (DynamicMethodBranchInst));
1198
+ void *Buffer = F.getModule ().allocate (sizeof (DynamicMethodBranchInst),
1199
+ alignof (DynamicMethodBranchInst));
1200
1200
return ::new (Buffer) DynamicMethodBranchInst (Loc, Operand, Member,
1201
1201
HasMethodBB, NoMethodBB);
1202
1202
}
@@ -1238,7 +1238,7 @@ WitnessMethodInst::create(SILLocation Loc, CanType LookupType,
1238
1238
SILValue OpenedExistential, bool Volatile) {
1239
1239
SILModule &Mod = F->getModule ();
1240
1240
void *Buffer =
1241
- Mod.allocateInst (sizeof (WitnessMethodInst), alignof (WitnessMethodInst));
1241
+ Mod.allocate (sizeof (WitnessMethodInst), alignof (WitnessMethodInst));
1242
1242
1243
1243
declareWitnessTable (Mod, Conformance);
1244
1244
return ::new (Buffer) WitnessMethodInst (Loc, LookupType, Conformance, Member,
@@ -1252,8 +1252,8 @@ InitExistentialAddrInst::create(SILLocation Loc, SILValue Existential,
1252
1252
ArrayRef<ProtocolConformance *> Conformances,
1253
1253
SILFunction *F) {
1254
1254
SILModule &Mod = F->getModule ();
1255
- void *Buffer = Mod.allocateInst (sizeof (InitExistentialAddrInst),
1256
- alignof (InitExistentialAddrInst));
1255
+ void *Buffer = Mod.allocate (sizeof (InitExistentialAddrInst),
1256
+ alignof (InitExistentialAddrInst));
1257
1257
for (ProtocolConformance *C : Conformances)
1258
1258
declareWitnessTable (Mod, C);
1259
1259
return ::new (Buffer) InitExistentialAddrInst (Loc, Existential,
@@ -1269,8 +1269,8 @@ InitExistentialRefInst::create(SILLocation Loc, SILType ExistentialType,
1269
1269
ArrayRef<ProtocolConformance *> Conformances,
1270
1270
SILFunction *F) {
1271
1271
SILModule &Mod = F->getModule ();
1272
- void *Buffer = Mod.allocateInst (sizeof (InitExistentialRefInst),
1273
- alignof (InitExistentialRefInst));
1272
+ void *Buffer = Mod.allocate (sizeof (InitExistentialRefInst),
1273
+ alignof (InitExistentialRefInst));
1274
1274
for (ProtocolConformance *C : Conformances) {
1275
1275
if (!C)
1276
1276
continue ;
@@ -1307,7 +1307,7 @@ InitExistentialMetatypeInst::create(SILLocation loc,
1307
1307
unsigned size = sizeof (InitExistentialMetatypeInst);
1308
1308
size += conformances.size () * sizeof (ProtocolConformance *);
1309
1309
1310
- void *buffer = M.allocateInst (size, alignof (InitExistentialMetatypeInst));
1310
+ void *buffer = M.allocate (size, alignof (InitExistentialMetatypeInst));
1311
1311
for (ProtocolConformance *conformance : conformances)
1312
1312
if (!M.lookUpWitnessTable (conformance, false ).first )
1313
1313
declareWitnessTable (M, conformance);
0 commit comments