1616#include " llvm/IR/InstIterator.h"
1717#include " llvm/Transforms/Utils/BasicBlockUtils.h"
1818
19- namespace llvm {
20-
21- namespace coro {
22-
23- namespace {
19+ using namespace llvm ;
20+ using namespace llvm ::coro;
2421
2522typedef SmallPtrSet<BasicBlock *, 8 > VisitedBlocksSet;
2623
@@ -71,7 +68,7 @@ static bool isLocalAlloca(CoroAllocaAllocInst *AI) {
7168// / This happens during the all-instructions iteration, so it must not
7269// / delete the call.
7370static Instruction *
74- lowerNonLocalAlloca (CoroAllocaAllocInst *AI, const coro:: Shape &Shape,
71+ lowerNonLocalAlloca (CoroAllocaAllocInst *AI, const Shape &Shape,
7572 SmallVectorImpl<Instruction *> &DeadInsts) {
7673 IRBuilder<> Builder (AI);
7774 auto Alloc = Shape.emitAlloc (Builder, AI->getSize (), nullptr );
@@ -450,18 +447,16 @@ static void collectFrameAlloca(AllocaInst *AI, const coro::Shape &Shape,
450447 Visitor.getMayWriteBeforeCoroBegin ());
451448}
452449
453- } // namespace
454-
455- void collectSpillsFromArgs (SpillInfo &Spills, Function &F,
456- const SuspendCrossingInfo &Checker) {
450+ void coro::collectSpillsFromArgs (SpillInfo &Spills, Function &F,
451+ const SuspendCrossingInfo &Checker) {
457452 // Collect the spills for arguments and other not-materializable values.
458453 for (Argument &A : F.args ())
459454 for (User *U : A.users ())
460455 if (Checker.isDefinitionAcrossSuspend (A, U))
461456 Spills[&A].push_back (cast<Instruction>(U));
462457}
463458
464- void collectSpillsAndAllocasFromInsts (
459+ void coro:: collectSpillsAndAllocasFromInsts (
465460 SpillInfo &Spills, SmallVector<AllocaInfo, 8 > &Allocas,
466461 SmallVector<Instruction *, 4 > &DeadInstructions,
467462 SmallVector<CoroAllocaAllocInst *, 4 > &LocalAllocas, Function &F,
@@ -516,8 +511,8 @@ void collectSpillsAndAllocasFromInsts(
516511 }
517512}
518513
519- void collectSpillsFromDbgInfo (SpillInfo &Spills, Function &F,
520- const SuspendCrossingInfo &Checker) {
514+ void coro:: collectSpillsFromDbgInfo (SpillInfo &Spills, Function &F,
515+ const SuspendCrossingInfo &Checker) {
521516 // We don't want the layout of coroutine frame to be affected
522517 // by debug information. So we only choose to salvage dbg.values for
523518 // whose value is already in the frame.
@@ -535,10 +530,9 @@ void collectSpillsFromDbgInfo(SpillInfo &Spills, Function &F,
535530
536531// / Async and Retcon{Once} conventions assume that all spill uses can be sunk
537532// / after the coro.begin intrinsic.
538- void sinkSpillUsesAfterCoroBegin (const DominatorTree &Dom,
539- CoroBeginInst *CoroBegin,
540- coro::SpillInfo &Spills,
541- SmallVectorImpl<coro::AllocaInfo> &Allocas) {
533+ void coro::sinkSpillUsesAfterCoroBegin (
534+ const DominatorTree &Dom, CoroBeginInst *CoroBegin, coro::SpillInfo &Spills,
535+ SmallVectorImpl<coro::AllocaInfo> &Allocas) {
542536 SmallSetVector<Instruction *, 32 > ToMove;
543537 SmallVector<Instruction *, 32 > Worklist;
544538
@@ -582,8 +576,9 @@ void sinkSpillUsesAfterCoroBegin(const DominatorTree &Dom,
582576 Inst->moveBefore (InsertPt->getIterator ());
583577}
584578
585- BasicBlock::iterator getSpillInsertionPt (const coro::Shape &Shape, Value *Def,
586- const DominatorTree &DT) {
579+ BasicBlock::iterator coro::getSpillInsertionPt (const coro::Shape &Shape,
580+ Value *Def,
581+ const DominatorTree &DT) {
587582 BasicBlock::iterator InsertPt;
588583 if (auto *Arg = dyn_cast<Argument>(Def)) {
589584 // For arguments, we will place the store instruction right after
@@ -625,7 +620,3 @@ BasicBlock::iterator getSpillInsertionPt(const coro::Shape &Shape, Value *Def,
625620
626621 return InsertPt;
627622}
628-
629- } // End namespace coro.
630-
631- } // End namespace llvm.
0 commit comments