Skip to content

Commit a2a4d22

Browse files
committed
[NFC] IRGen: Typed this flag.
1 parent c5aa788 commit a2a4d22

File tree

5 files changed

+32
-27
lines changed

5 files changed

+32
-27
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5269,7 +5269,7 @@ StackAddress irgen::emitAllocCoroStaticFrame(IRGenFunction &IGF,
52695269
// respectively.
52705270
auto retval =
52715271
IGF.emitDynamicAlloca(IGF.IGM.Int8Ty, size, Alignment(MaximumAlignment),
5272-
/*allowTaskAlloc*/ true, "caller-coro-frame");
5272+
AllowsTaskAlloc, "caller-coro-frame");
52735273
IGF.Builder.CreateLifetimeStart(retval.getAddress(),
52745274
Size(-1) /*dynamic size*/);
52755275
return retval;

lib/IRGen/GenOpaque.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,13 +559,14 @@ irgen::emitInitializeBufferWithCopyOfBufferCall(IRGenFunction &IGF,
559559
StackAddress IRGenFunction::emitDynamicAlloca(SILType T,
560560
const llvm::Twine &name) {
561561
llvm::Value *size = emitLoadOfSize(*this, T);
562-
return emitDynamicAlloca(IGM.Int8Ty, size, Alignment(16), true, name);
562+
return emitDynamicAlloca(IGM.Int8Ty, size, Alignment(16), AllowsTaskAlloc,
563+
name);
563564
}
564565

565566
StackAddress IRGenFunction::emitDynamicAlloca(llvm::Type *eltTy,
566567
llvm::Value *arraySize,
567568
Alignment align,
568-
bool allowTaskAlloc,
569+
AllowsTaskAlloc_t allowTaskAlloc,
569570
const llvm::Twine &name) {
570571
// Async functions call task alloc.
571572
if (allowTaskAlloc && isAsync()) {

lib/IRGen/GenPack.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,9 @@ irgen::emitTypeMetadataPack(IRGenFunction &IGF, CanPackType packType,
467467
}
468468

469469
assert(packType->containsPackExpansionType());
470-
auto pack = IGF.emitDynamicAlloca(IGF.IGM.TypeMetadataPtrTy, shape,
471-
IGF.IGM.getPointerAlignment(),
472-
/*allowTaskAlloc=*/true);
470+
auto pack =
471+
IGF.emitDynamicAlloca(IGF.IGM.TypeMetadataPtrTy, shape,
472+
IGF.IGM.getPointerAlignment(), AllowsTaskAlloc);
473473

474474
auto visitFn =
475475
[&](CanType eltTy, unsigned staticIndex,
@@ -612,9 +612,9 @@ irgen::emitWitnessTablePack(IRGenFunction &IGF, CanPackType packType,
612612
}
613613

614614
assert(packType->containsPackExpansionType());
615-
auto pack = IGF.emitDynamicAlloca(IGF.IGM.WitnessTablePtrTy, shape,
616-
IGF.IGM.getPointerAlignment(),
617-
/*allowTaskAlloc=*/true);
615+
auto pack =
616+
IGF.emitDynamicAlloca(IGF.IGM.WitnessTablePtrTy, shape,
617+
IGF.IGM.getPointerAlignment(), AllowsTaskAlloc);
618618

619619
auto index = 0;
620620
auto visitFn = [&](CanType eltTy, unsigned staticIndex,
@@ -1184,9 +1184,9 @@ StackAddress irgen::allocatePack(IRGenFunction &IGF, CanSILPackType packType) {
11841184
}
11851185

11861186
assert(packType->containsPackExpansionType());
1187-
auto addr = IGF.emitDynamicAlloca(IGF.IGM.OpaquePtrTy, shape,
1188-
IGF.IGM.getPointerAlignment(),
1189-
/*allowTaskAlloc=*/true);
1187+
auto addr =
1188+
IGF.emitDynamicAlloca(IGF.IGM.OpaquePtrTy, shape,
1189+
IGF.IGM.getPointerAlignment(), AllowsTaskAlloc);
11901190

11911191
return addr;
11921192
}
@@ -1255,10 +1255,9 @@ irgen::emitDynamicTupleTypeLabels(IRGenFunction &IGF, CanTupleType type,
12551255
llvm::ConstantInt::get(IGF.IGM.SizeTy, 1));
12561256

12571257
// Allocate space for the label string; we fill it in below.
1258-
StackAddress labelString = IGF.emitDynamicAlloca(
1259-
IGF.IGM.Int8Ty, labelLength,
1260-
IGF.IGM.getPointerAlignment(),
1261-
/*allowTaskAlloc=*/true);
1258+
StackAddress labelString =
1259+
IGF.emitDynamicAlloca(IGF.IGM.Int8Ty, labelLength,
1260+
IGF.IGM.getPointerAlignment(), AllowsTaskAlloc);
12621261

12631262
// Get the static label string, where each pack expansion is one element.
12641263
auto *staticLabelString = getTupleLabelsString(IGF.IGM, type);
@@ -1371,9 +1370,8 @@ irgen::emitDynamicFunctionParameterFlags(IRGenFunction &IGF,
13711370
AnyFunctionType::CanParamArrayRef params,
13721371
CanPackType packType,
13731372
llvm::Value *shapeExpression) {
1374-
auto array =
1375-
IGF.emitDynamicAlloca(IGF.IGM.Int32Ty, shapeExpression,
1376-
Alignment(4), /*allowTaskAlloc=*/true);
1373+
auto array = IGF.emitDynamicAlloca(IGF.IGM.Int32Ty, shapeExpression,
1374+
Alignment(4), AllowsTaskAlloc);
13771375

13781376
unsigned numExpansions = 0;
13791377

@@ -1431,9 +1429,9 @@ irgen::emitInducedTupleTypeMetadataPack(
14311429
IRGenFunction &IGF, llvm::Value *tupleMetadata) {
14321430
auto *shape = emitTupleTypeMetadataLength(IGF, tupleMetadata);
14331431

1434-
auto pack = IGF.emitDynamicAlloca(IGF.IGM.TypeMetadataPtrTy, shape,
1435-
IGF.IGM.getPointerAlignment(),
1436-
/*allowTaskAlloc=*/true);
1432+
auto pack =
1433+
IGF.emitDynamicAlloca(IGF.IGM.TypeMetadataPtrTy, shape,
1434+
IGF.IGM.getPointerAlignment(), AllowsTaskAlloc);
14371435
auto elementForIndex =
14381436
[&](llvm::Value *index) -> llvm::Value * {
14391437
return irgen::emitTupleTypeMetadataElementType(IGF, tupleMetadata, index);

lib/IRGen/IRGenFunction.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ namespace irgen {
6666
class TypeInfo;
6767
enum class ValueWitness : unsigned;
6868

69+
enum AllowsTaskAlloc_t : bool {
70+
DoesNotAllowTaskAlloc = false,
71+
AllowsTaskAlloc = true,
72+
};
73+
6974
/// IRGenFunction - Primary class for emitting LLVM instructions for a
7075
/// specific function.
7176
class IRGenFunction {
@@ -302,9 +307,10 @@ class IRGenFunction {
302307
const llvm::Twine &name = "");
303308

304309
StackAddress emitDynamicAlloca(SILType type, const llvm::Twine &name = "");
305-
StackAddress emitDynamicAlloca(llvm::Type *eltTy, llvm::Value *arraySize,
306-
Alignment align, bool allowTaskAlloc = true,
307-
const llvm::Twine &name = "");
310+
StackAddress
311+
emitDynamicAlloca(llvm::Type *eltTy, llvm::Value *arraySize, Alignment align,
312+
AllowsTaskAlloc_t allowTaskAlloc = AllowsTaskAlloc,
313+
const llvm::Twine &name = "");
308314
void emitDeallocateDynamicAlloca(StackAddress address,
309315
bool allowTaskDealloc = true,
310316
bool useTaskDeallocThrough = false);

lib/IRGen/IRGenSIL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3721,8 +3721,8 @@ static void emitBuiltinStackAlloc(IRGenSILFunction &IGF,
37213721
return;
37223722
}
37233723

3724-
auto stackAddress = IGF.emitDynamicAlloca(IGF.IGM.Int8Ty, size, align,
3725-
false, "temp_alloc");
3724+
auto stackAddress = IGF.emitDynamicAlloca(
3725+
IGF.IGM.Int8Ty, size, align, DoesNotAllowTaskAlloc, "temp_alloc");
37263726
IGF.setLoweredStackAddress(i, stackAddress);
37273727
}
37283728

0 commit comments

Comments
 (0)