@@ -402,7 +402,7 @@ static void replaceCoroEnd(AnyCoroEndInst *End, const coro::Shape &Shape,
402402// is possible since the coroutine is considered suspended at the final suspend
403403// point if promise.unhandled_exception() exits via an exception), we can
404404// remove the last case.
405- void CoroCloner ::handleFinalSuspend () {
405+ void coro::BaseCloner ::handleFinalSuspend () {
406406 assert (Shape.ABI == coro::ABI::Switch &&
407407 Shape.SwitchLowering .HasFinalSuspend );
408408
@@ -466,7 +466,7 @@ static Function *createCloneDeclaration(Function &OrigF, coro::Shape &Shape,
466466// / arguments to the continuation function.
467467// /
468468// / This assumes that the builder has a meaningful insertion point.
469- void CoroCloner ::replaceRetconOrAsyncSuspendUses () {
469+ void coro::BaseCloner ::replaceRetconOrAsyncSuspendUses () {
470470 assert (Shape.ABI == coro::ABI::Retcon || Shape.ABI == coro::ABI::RetconOnce ||
471471 Shape.ABI == coro::ABI::Async);
472472
@@ -514,7 +514,7 @@ void CoroCloner::replaceRetconOrAsyncSuspendUses() {
514514 NewS->replaceAllUsesWith (Aggr);
515515}
516516
517- void CoroCloner ::replaceCoroSuspends () {
517+ void coro::BaseCloner ::replaceCoroSuspends () {
518518 Value *SuspendResult;
519519
520520 switch (Shape.ABI ) {
@@ -551,7 +551,7 @@ void CoroCloner::replaceCoroSuspends() {
551551 }
552552}
553553
554- void CoroCloner ::replaceCoroEnds () {
554+ void coro::BaseCloner ::replaceCoroEnds () {
555555 for (AnyCoroEndInst *CE : Shape.CoroEnds ) {
556556 // We use a null call graph because there's no call graph node for
557557 // the cloned function yet. We'll just be rebuilding that later.
@@ -630,11 +630,11 @@ collectDbgVariableIntrinsics(Function &F) {
630630 return {Intrinsics, DbgVariableRecords};
631631}
632632
633- void CoroCloner ::replaceSwiftErrorOps () {
633+ void coro::BaseCloner ::replaceSwiftErrorOps () {
634634 ::replaceSwiftErrorOps (*NewF, Shape, &VMap);
635635}
636636
637- void CoroCloner ::salvageDebugInfo () {
637+ void coro::BaseCloner ::salvageDebugInfo () {
638638 auto [Worklist, DbgVariableRecords] = collectDbgVariableIntrinsics (*NewF);
639639 SmallDenseMap<Argument *, AllocaInst *, 4 > ArgToAllocaMap;
640640
@@ -671,7 +671,7 @@ void CoroCloner::salvageDebugInfo() {
671671 for_each (DbgVariableRecords, RemoveOne);
672672}
673673
674- void CoroCloner ::replaceEntryBlock () {
674+ void coro::BaseCloner ::replaceEntryBlock () {
675675 // In the original function, the AllocaSpillBlock is a block immediately
676676 // following the allocation of the frame object which defines GEPs for
677677 // all the allocas that have been moved into the frame, and it ends by
@@ -739,7 +739,7 @@ void CoroCloner::replaceEntryBlock() {
739739}
740740
741741// / Derive the value of the new frame pointer.
742- Value *CoroCloner ::deriveNewFramePointer () {
742+ Value *coro::BaseCloner ::deriveNewFramePointer () {
743743 // Builder should be inserting to the front of the new entry block.
744744
745745 switch (Shape.ABI ) {
@@ -863,7 +863,7 @@ static void addSwiftSelfAttrs(AttributeList &Attrs, LLVMContext &Context,
863863
864864// / Clone the body of the original function into a resume function of
865865// / some sort.
866- void CoroCloner ::create () {
866+ void coro::BaseCloner ::create () {
867867 assert (NewF);
868868
869869 // Replace all args with dummy instructions. If an argument is the old frame
@@ -1090,18 +1090,18 @@ void CoroCloner::create() {
10901090 salvageDebugInfo ();
10911091}
10921092
1093- void CoroSwitchCloner ::create () {
1093+ void coro::SwitchCloner ::create () {
10941094 // Create a new function matching the original type
10951095 NewF = createCloneDeclaration (OrigF, Shape, Suffix, OrigF.getParent ()->end (),
10961096 ActiveSuspend);
10971097
10981098 // Clone the function
1099- CoroCloner ::create ();
1099+ coro::BaseCloner ::create ();
11001100
11011101 // Eliminate coro.free from the clones, replacing it with 'null' in cleanup,
11021102 // to suppress deallocation code.
11031103 coro::replaceCoroFree (cast<CoroIdInst>(VMap[Shape.CoroBegin ->getId ()]),
1104- /* Elide=*/ FKind == CoroCloner::Kind ::SwitchCleanup);
1104+ /* Elide=*/ FKind == coro::CloneKind ::SwitchCleanup);
11051105}
11061106
11071107static void updateAsyncFuncPointerContextSize (coro::Shape &Shape) {
@@ -1378,12 +1378,12 @@ struct SwitchCoroutineSplitter {
13781378 // setting new entry block and replacing coro.suspend an appropriate value
13791379 // to force resume or cleanup pass for every suspend point.
13801380 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);
13871387
13881388 postSplitCleanup (*ResumeClone);
13891389 postSplitCleanup (*DestroyClone);
@@ -1772,8 +1772,8 @@ void coro::AsyncABI::splitCoroutine(Function &F, coro::Shape &Shape,
17721772 auto *Suspend = CS;
17731773 auto *Clone = Clones[Idx];
17741774
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);
17771777 }
17781778}
17791779
@@ -1903,8 +1903,8 @@ void coro::AnyRetconABI::splitCoroutine(Function &F, coro::Shape &Shape,
19031903 auto Suspend = CS;
19041904 auto Clone = Clones[Idx];
19051905
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);
19081908 }
19091909}
19101910
0 commit comments