@@ -126,8 +126,8 @@ AllocExistentialBoxInst *AllocExistentialBoxInst::create(
126
126
SILType ConcreteLoweredType, ArrayRef<ProtocolConformance *> Conformances,
127
127
SILFunction *F) {
128
128
SILModule &Mod = F->getModule ();
129
- void *Buffer = Mod.allocate (sizeof (AllocExistentialBoxInst),
130
- alignof (AllocExistentialBoxInst));
129
+ void *Buffer = Mod.allocateInst (sizeof (AllocExistentialBoxInst),
130
+ alignof (AllocExistentialBoxInst));
131
131
for (ProtocolConformance *C : Conformances)
132
132
declareWitnessTable (Mod, C);
133
133
return ::new (Buffer) AllocExistentialBoxInst (Loc,
@@ -142,7 +142,7 @@ BuiltinInst *BuiltinInst::create(SILDebugLocation *Loc, Identifier Name,
142
142
ArrayRef<Substitution> Substitutions,
143
143
ArrayRef<SILValue> Args,
144
144
SILFunction &F) {
145
- void *Buffer = F.getModule ().allocate (
145
+ void *Buffer = F.getModule ().allocateInst (
146
146
sizeof (BuiltinInst)
147
147
+ decltype (Operands)::getExtraSize (Args.size ())
148
148
+ sizeof (Substitution) * Substitutions.size (),
@@ -189,7 +189,7 @@ bool swift::doesApplyCalleeHaveSemantics(SILValue callee, StringRef semantics) {
189
189
}
190
190
191
191
void *swift::allocateApplyInst (SILFunction &F, size_t size, size_t alignment) {
192
- return F.getModule ().allocate (size, alignment);
192
+ return F.getModule ().allocateInst (size, alignment);
193
193
}
194
194
195
195
PartialApplyInst::PartialApplyInst (SILDebugLocation *Loc, SILValue Callee,
@@ -275,14 +275,14 @@ static unsigned getWordsForBitWidth(unsigned bits) {
275
275
276
276
template <typename INST>
277
277
static void *allocateLiteralInstWithTextSize (SILFunction &F, unsigned length) {
278
- return F.getModule ().allocate (sizeof (INST) + length, alignof (INST));
278
+ return F.getModule ().allocateInst (sizeof (INST) + length, alignof (INST));
279
279
}
280
280
281
281
template <typename INST>
282
282
static void *allocateLiteralInstWithBitSize (SILFunction &F, unsigned bits) {
283
283
unsigned words = getWordsForBitWidth (bits);
284
- return F.getModule ().allocate ( sizeof (INST) + sizeof (llvm::integerPart)*words,
285
- alignof (INST));
284
+ return F.getModule ().allocateInst (
285
+ sizeof (INST) + sizeof (llvm::integerPart)*words, alignof (INST));
286
286
}
287
287
288
288
IntegerLiteralInst::IntegerLiteralInst (SILDebugLocation *Loc, SILType Ty,
@@ -408,7 +408,7 @@ AssignInst::AssignInst(SILDebugLocation *Loc, SILValue Src, SILValue Dest)
408
408
MarkFunctionEscapeInst *
409
409
MarkFunctionEscapeInst::create (SILDebugLocation *Loc,
410
410
ArrayRef<SILValue> Elements, SILFunction &F) {
411
- void *Buffer = F.getModule ().allocate (sizeof (MarkFunctionEscapeInst) +
411
+ void *Buffer = F.getModule ().allocateInst (sizeof (MarkFunctionEscapeInst) +
412
412
decltype (Operands)::getExtraSize (Elements.size ()),
413
413
alignof (MarkFunctionEscapeInst));
414
414
return ::new (Buffer) MarkFunctionEscapeInst (Loc, Elements);
@@ -456,7 +456,7 @@ UnconditionalCheckedCastAddrInst::UnconditionalCheckedCastAddrInst(
456
456
457
457
StructInst *StructInst::create (SILDebugLocation *Loc, SILType Ty,
458
458
ArrayRef<SILValue> Elements, SILFunction &F) {
459
- void *Buffer = F.getModule ().allocate (sizeof (StructInst) +
459
+ void *Buffer = F.getModule ().allocateInst (sizeof (StructInst) +
460
460
decltype (Operands)::getExtraSize (Elements.size ()),
461
461
alignof (StructInst));
462
462
return ::new (Buffer) StructInst (Loc, Ty, Elements);
@@ -470,7 +470,7 @@ StructInst::StructInst(SILDebugLocation *Loc, SILType Ty,
470
470
471
471
TupleInst *TupleInst::create (SILDebugLocation *Loc, SILType Ty,
472
472
ArrayRef<SILValue> Elements, SILFunction &F) {
473
- void *Buffer = F.getModule ().allocate (sizeof (TupleInst) +
473
+ void *Buffer = F.getModule ().allocateInst (sizeof (TupleInst) +
474
474
decltype (Operands)::getExtraSize (Elements.size ()),
475
475
alignof (TupleInst));
476
476
return ::new (Buffer) TupleInst (Loc, Ty, Elements);
@@ -673,7 +673,7 @@ BranchInst *BranchInst::create(SILDebugLocation *Loc, SILBasicBlock *DestBB,
673
673
BranchInst *BranchInst::create (SILDebugLocation *Loc,
674
674
SILBasicBlock *DestBB, ArrayRef<SILValue> Args,
675
675
SILFunction &F) {
676
- void *Buffer = F.getModule ().allocate (sizeof (BranchInst) +
676
+ void *Buffer = F.getModule ().allocateInst (sizeof (BranchInst) +
677
677
decltype (Operands)::getExtraSize (Args.size ()),
678
678
alignof (BranchInst));
679
679
return ::new (Buffer) BranchInst (Loc, DestBB, Args);
@@ -707,7 +707,7 @@ CondBranchInst::create(SILDebugLocation *Loc, SILValue Condition,
707
707
Args.append (TrueArgs.begin (), TrueArgs.end ());
708
708
Args.append (FalseArgs.begin (), FalseArgs.end ());
709
709
710
- void *Buffer = F.getModule ().allocate (sizeof (CondBranchInst) +
710
+ void *Buffer = F.getModule ().allocateInst (sizeof (CondBranchInst) +
711
711
decltype (Operands)::getExtraSize (Args.size ()),
712
712
alignof (CondBranchInst));
713
713
return ::new (Buffer) CondBranchInst (Loc, Condition, TrueBB, FalseBB, Args,
@@ -857,7 +857,7 @@ SwitchValueInst *SwitchValueInst::create(
857
857
size_t bufSize = sizeof (SwitchValueInst) +
858
858
decltype (Operands)::getExtraSize (Cases.size ()) +
859
859
sizeof (SILSuccessor) * numSuccessors;
860
- void *buf = F.getModule ().allocate (bufSize, alignof (SwitchValueInst));
860
+ void *buf = F.getModule ().allocateInst (bufSize, alignof (SwitchValueInst));
861
861
return ::new (buf) SwitchValueInst (Loc, Operand, DefaultBB, Cases, BBs);
862
862
}
863
863
@@ -905,7 +905,7 @@ SelectValueInst::create(SILDebugLocation *Loc, SILValue Operand, SILType Type,
905
905
906
906
size_t bufSize = sizeof (SelectValueInst) + decltype (Operands)::getExtraSize (
907
907
CaseValuesAndResults.size ());
908
- void *buf = F.getModule ().allocate (bufSize, alignof (SelectValueInst));
908
+ void *buf = F.getModule ().allocateInst (bufSize, alignof (SelectValueInst));
909
909
return ::new (buf)
910
910
SelectValueInst (Loc, Operand, Type, DefaultResult, CaseValuesAndResults);
911
911
}
@@ -946,7 +946,7 @@ SELECT_ENUM_INST *SelectEnumInstBase::createSelectEnum(
946
946
// and `CaseBBs.size() + (DefaultBB ? 1 : 0)` values.
947
947
unsigned numCases = CaseValues.size ();
948
948
949
- void *buf = F.getModule ().allocate (
949
+ void *buf = F.getModule ().allocateInst (
950
950
sizeof (SELECT_ENUM_INST) + sizeof (EnumElementDecl*) * numCases
951
951
+ TailAllocatedOperandList<1 >::getExtraSize (numCases + (bool )DefaultValue),
952
952
alignof (SELECT_ENUM_INST));
@@ -1067,7 +1067,7 @@ SWITCH_ENUM_INST *SwitchEnumInstBase::createSwitchEnum(
1067
1067
unsigned numCases = CaseBBs.size ();
1068
1068
unsigned numSuccessors = numCases + (DefaultBB ? 1 : 0 );
1069
1069
1070
- void *buf = F.getModule ().allocate (sizeof (SWITCH_ENUM_INST)
1070
+ void *buf = F.getModule ().allocateInst (sizeof (SWITCH_ENUM_INST)
1071
1071
+ sizeof (EnumElementDecl*) * numCases
1072
1072
+ sizeof (SILSuccessor) * numSuccessors,
1073
1073
alignof (SWITCH_ENUM_INST));
@@ -1133,8 +1133,8 @@ DynamicMethodBranchInst *
1133
1133
DynamicMethodBranchInst::create (SILDebugLocation *Loc, SILValue Operand,
1134
1134
SILDeclRef Member, SILBasicBlock *HasMethodBB,
1135
1135
SILBasicBlock *NoMethodBB, SILFunction &F) {
1136
- void *Buffer = F.getModule ().allocate (sizeof (DynamicMethodBranchInst),
1137
- alignof (DynamicMethodBranchInst));
1136
+ void *Buffer = F.getModule ().allocateInst (sizeof (DynamicMethodBranchInst),
1137
+ alignof (DynamicMethodBranchInst));
1138
1138
return ::new (Buffer)
1139
1139
DynamicMethodBranchInst (Loc, Operand, Member, HasMethodBB, NoMethodBB);
1140
1140
}
@@ -1176,7 +1176,7 @@ WitnessMethodInst::create(SILDebugLocation *Loc, CanType LookupType,
1176
1176
SILValue OpenedExistential, bool Volatile) {
1177
1177
SILModule &Mod = F->getModule ();
1178
1178
void *Buffer =
1179
- Mod.allocate (sizeof (WitnessMethodInst), alignof (WitnessMethodInst));
1179
+ Mod.allocateInst (sizeof (WitnessMethodInst), alignof (WitnessMethodInst));
1180
1180
1181
1181
declareWitnessTable (Mod, Conformance);
1182
1182
return ::new (Buffer) WitnessMethodInst (Loc, LookupType, Conformance, Member,
@@ -1188,8 +1188,8 @@ InitExistentialAddrInst *InitExistentialAddrInst::create(
1188
1188
SILType ConcreteLoweredType, ArrayRef<ProtocolConformance *> Conformances,
1189
1189
SILFunction *F) {
1190
1190
SILModule &Mod = F->getModule ();
1191
- void *Buffer = Mod.allocate (sizeof (InitExistentialAddrInst),
1192
- alignof (InitExistentialAddrInst));
1191
+ void *Buffer = Mod.allocateInst (sizeof (InitExistentialAddrInst),
1192
+ alignof (InitExistentialAddrInst));
1193
1193
for (ProtocolConformance *C : Conformances)
1194
1194
declareWitnessTable (Mod, C);
1195
1195
return ::new (Buffer) InitExistentialAddrInst (Loc, Existential,
@@ -1204,8 +1204,8 @@ InitExistentialRefInst::create(SILDebugLocation *Loc, SILType ExistentialType,
1204
1204
ArrayRef<ProtocolConformance *> Conformances,
1205
1205
SILFunction *F) {
1206
1206
SILModule &Mod = F->getModule ();
1207
- void *Buffer = Mod.allocate (sizeof (InitExistentialRefInst),
1208
- alignof (InitExistentialRefInst));
1207
+ void *Buffer = Mod.allocateInst (sizeof (InitExistentialRefInst),
1208
+ alignof (InitExistentialRefInst));
1209
1209
for (ProtocolConformance *C : Conformances) {
1210
1210
if (!C)
1211
1211
continue ;
@@ -1239,7 +1239,7 @@ InitExistentialMetatypeInst *InitExistentialMetatypeInst::create(
1239
1239
unsigned size = sizeof (InitExistentialMetatypeInst);
1240
1240
size += conformances.size () * sizeof (ProtocolConformance *);
1241
1241
1242
- void *buffer = M.allocate (size, alignof (InitExistentialMetatypeInst));
1242
+ void *buffer = M.allocateInst (size, alignof (InitExistentialMetatypeInst));
1243
1243
for (ProtocolConformance *conformance : conformances)
1244
1244
if (!M.lookUpWitnessTable (conformance, false ).first )
1245
1245
declareWitnessTable (M, conformance);
0 commit comments