@@ -402,7 +402,7 @@ static void replaceCoroEnd(AnyCoroEndInst *End, const coro::Shape &Shape,
402
402
// is possible since the coroutine is considered suspended at the final suspend
403
403
// point if promise.unhandled_exception() exits via an exception), we can
404
404
// remove the last case.
405
- void CoroCloner ::handleFinalSuspend () {
405
+ void coro::BaseCloner ::handleFinalSuspend () {
406
406
assert (Shape.ABI == coro::ABI::Switch &&
407
407
Shape.SwitchLowering .HasFinalSuspend );
408
408
@@ -466,7 +466,7 @@ static Function *createCloneDeclaration(Function &OrigF, coro::Shape &Shape,
466
466
// / arguments to the continuation function.
467
467
// /
468
468
// / This assumes that the builder has a meaningful insertion point.
469
- void CoroCloner ::replaceRetconOrAsyncSuspendUses () {
469
+ void coro::BaseCloner ::replaceRetconOrAsyncSuspendUses () {
470
470
assert (Shape.ABI == coro::ABI::Retcon || Shape.ABI == coro::ABI::RetconOnce ||
471
471
Shape.ABI == coro::ABI::Async);
472
472
@@ -514,7 +514,7 @@ void CoroCloner::replaceRetconOrAsyncSuspendUses() {
514
514
NewS->replaceAllUsesWith (Aggr);
515
515
}
516
516
517
- void CoroCloner ::replaceCoroSuspends () {
517
+ void coro::BaseCloner ::replaceCoroSuspends () {
518
518
Value *SuspendResult;
519
519
520
520
switch (Shape.ABI ) {
@@ -551,7 +551,7 @@ void CoroCloner::replaceCoroSuspends() {
551
551
}
552
552
}
553
553
554
- void CoroCloner ::replaceCoroEnds () {
554
+ void coro::BaseCloner ::replaceCoroEnds () {
555
555
for (AnyCoroEndInst *CE : Shape.CoroEnds ) {
556
556
// We use a null call graph because there's no call graph node for
557
557
// the cloned function yet. We'll just be rebuilding that later.
@@ -630,11 +630,11 @@ collectDbgVariableIntrinsics(Function &F) {
630
630
return {Intrinsics, DbgVariableRecords};
631
631
}
632
632
633
- void CoroCloner ::replaceSwiftErrorOps () {
633
+ void coro::BaseCloner ::replaceSwiftErrorOps () {
634
634
::replaceSwiftErrorOps (*NewF, Shape, &VMap);
635
635
}
636
636
637
- void CoroCloner ::salvageDebugInfo () {
637
+ void coro::BaseCloner ::salvageDebugInfo () {
638
638
auto [Worklist, DbgVariableRecords] = collectDbgVariableIntrinsics (*NewF);
639
639
SmallDenseMap<Argument *, AllocaInst *, 4 > ArgToAllocaMap;
640
640
@@ -671,7 +671,7 @@ void CoroCloner::salvageDebugInfo() {
671
671
for_each (DbgVariableRecords, RemoveOne);
672
672
}
673
673
674
- void CoroCloner ::replaceEntryBlock () {
674
+ void coro::BaseCloner ::replaceEntryBlock () {
675
675
// In the original function, the AllocaSpillBlock is a block immediately
676
676
// following the allocation of the frame object which defines GEPs for
677
677
// all the allocas that have been moved into the frame, and it ends by
@@ -739,7 +739,7 @@ void CoroCloner::replaceEntryBlock() {
739
739
}
740
740
741
741
// / Derive the value of the new frame pointer.
742
- Value *CoroCloner ::deriveNewFramePointer () {
742
+ Value *coro::BaseCloner ::deriveNewFramePointer () {
743
743
// Builder should be inserting to the front of the new entry block.
744
744
745
745
switch (Shape.ABI ) {
@@ -863,7 +863,7 @@ static void addSwiftSelfAttrs(AttributeList &Attrs, LLVMContext &Context,
863
863
864
864
// / Clone the body of the original function into a resume function of
865
865
// / some sort.
866
- void CoroCloner ::create () {
866
+ void coro::BaseCloner ::create () {
867
867
assert (NewF);
868
868
869
869
// Replace all args with dummy instructions. If an argument is the old frame
@@ -1090,18 +1090,18 @@ void CoroCloner::create() {
1090
1090
salvageDebugInfo ();
1091
1091
}
1092
1092
1093
- void CoroSwitchCloner ::create () {
1093
+ void coro::SwitchCloner ::create () {
1094
1094
// Create a new function matching the original type
1095
1095
NewF = createCloneDeclaration (OrigF, Shape, Suffix, OrigF.getParent ()->end (),
1096
1096
ActiveSuspend);
1097
1097
1098
1098
// Clone the function
1099
- CoroCloner ::create ();
1099
+ coro::BaseCloner ::create ();
1100
1100
1101
1101
// Eliminate coro.free from the clones, replacing it with 'null' in cleanup,
1102
1102
// to suppress deallocation code.
1103
1103
coro::replaceCoroFree (cast<CoroIdInst>(VMap[Shape.CoroBegin ->getId ()]),
1104
- /* Elide=*/ FKind == CoroCloner::Kind ::SwitchCleanup);
1104
+ /* Elide=*/ FKind == coro::CloneKind ::SwitchCleanup);
1105
1105
}
1106
1106
1107
1107
static void updateAsyncFuncPointerContextSize (coro::Shape &Shape) {
@@ -1378,12 +1378,12 @@ struct SwitchCoroutineSplitter {
1378
1378
// setting new entry block and replacing coro.suspend an appropriate value
1379
1379
// to force resume or cleanup pass for every suspend point.
1380
1380
createResumeEntryBlock (F, Shape);
1381
- auto *ResumeClone = CoroSwitchCloner ::createClone (
1382
- F, " .resume" , Shape, CoroCloner::Kind ::SwitchResume, TTI);
1383
- auto *DestroyClone = CoroSwitchCloner ::createClone (
1384
- F, " .destroy" , Shape, CoroCloner::Kind ::SwitchUnwind, TTI);
1385
- auto *CleanupClone = CoroSwitchCloner ::createClone (
1386
- F, " .cleanup" , Shape, CoroCloner::Kind ::SwitchCleanup, TTI);
1381
+ auto *ResumeClone = coro::SwitchCloner ::createClone (
1382
+ F, " .resume" , Shape, coro::CloneKind ::SwitchResume, TTI);
1383
+ auto *DestroyClone = coro::SwitchCloner ::createClone (
1384
+ F, " .destroy" , Shape, coro::CloneKind ::SwitchUnwind, TTI);
1385
+ auto *CleanupClone = coro::SwitchCloner ::createClone (
1386
+ F, " .cleanup" , Shape, coro::CloneKind ::SwitchCleanup, TTI);
1387
1387
1388
1388
postSplitCleanup (*ResumeClone);
1389
1389
postSplitCleanup (*DestroyClone);
@@ -1772,8 +1772,8 @@ void coro::AsyncABI::splitCoroutine(Function &F, coro::Shape &Shape,
1772
1772
auto *Suspend = CS;
1773
1773
auto *Clone = Clones[Idx];
1774
1774
1775
- CoroCloner:: createClone (F, " resume." + Twine (Idx), Shape, Clone, Suspend ,
1776
- TTI);
1775
+ coro::BaseCloner:: createClone (F, " resume." + Twine (Idx), Shape, Clone,
1776
+ Suspend, TTI);
1777
1777
}
1778
1778
}
1779
1779
@@ -1903,8 +1903,8 @@ void coro::AnyRetconABI::splitCoroutine(Function &F, coro::Shape &Shape,
1903
1903
auto Suspend = CS;
1904
1904
auto Clone = Clones[Idx];
1905
1905
1906
- CoroCloner:: createClone (F, " resume." + Twine (Idx), Shape, Clone, Suspend ,
1907
- TTI);
1906
+ coro::BaseCloner:: createClone (F, " resume." + Twine (Idx), Shape, Clone,
1907
+ Suspend, TTI);
1908
1908
}
1909
1909
}
1910
1910
0 commit comments