Lines Matching +full:self +full:- +full:refresh
1 //===- CallGraphSCCPass.cpp - Pass that operates BU on call graph ---------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 // which are implemented as bottom-up traversals on the call graph. Because
12 // call-graph in SCC order: that is, they process function bottom-up, except for
15 //===----------------------------------------------------------------------===//
44 #define DEBUG_TYPE "cgscc-passmgr"
47 cl::opt<unsigned> MaxDevirtIterations("max-devirt-iterations", cl::ReallyHidden,
53 //===----------------------------------------------------------------------===//
93 P->dumpPassStructure(Offset + 1); in dumpPassStructure()
126 PMDataManager *PM = P->getAsPMDataManager(); in RunPassOnSCC()
143 Changed = CGSP->runOnSCC(CurSCC); in RunPassOnSCC()
152 static_cast<int64_t>(SCCCount) - static_cast<int64_t>(InstrCount); in RunPassOnSCC()
170 assert(PM->getPassManagerType() == PMT_FunctionPassManager && in RunPassOnSCC()
176 if (Function *F = CGN->getFunction()) { in RunPassOnSCC()
177 dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F->getName()); in RunPassOnSCC()
180 Changed |= FPP->runOnFunction(*F); in RunPassOnSCC()
182 F->getContext().yield(); in RunPassOnSCC()
189 LLVM_DEBUG(dbgs() << "CGSCCPASSMGR: Pass Dirtied SCC: " << P->getPassName() in RunPassOnSCC()
212 : CurSCC) CGN->dump();); in RefreshCallGraph()
222 Function *F = CGN->getFunction(); in RefreshCallGraph()
223 if (!F || F->isDeclaration()) continue; in RefreshCallGraph()
232 CallGraphNode::iterator CGNEnd = CGN->end(); in RefreshCallGraph()
238 CGN->removeCallEdge(I); in RefreshCallGraph()
246 CGNEnd = CGN->end(); in RefreshCallGraph()
251 for (CallGraphNode::iterator I = CGN->begin(); I != CGNEnd;) { in RefreshCallGraph()
254 if (!I->first) { in RefreshCallGraph()
266 auto *Call = dyn_cast_or_null<CallBase>(*I->first); in RefreshCallGraph()
276 if (!I->second->getFunction()) in RefreshCallGraph()
289 Function *Callee = Call->getCalledFunction(); in RefreshCallGraph()
291 if (!Callee || !(Callee->isIntrinsic())) in RefreshCallGraph()
292 Calls.insert(std::make_pair(Call, I->second)); in RefreshCallGraph()
306 Function *Callee = Call->getCalledFunction(); in RefreshCallGraph()
307 if (Callee && Callee->isIntrinsic()) in RefreshCallGraph()
315 CGN->addCalledFunction(nullptr, CG.getOrInsertFunction(CB)); in RefreshCallGraph()
324 CallGraphNode *ExistingNode = ExistingIt->second; in RefreshCallGraph()
330 if (ExistingNode->getFunction() == Call->getCalledFunction()) in RefreshCallGraph()
338 if (CheckingMode && Call->getCalledFunction() && in RefreshCallGraph()
339 ExistingNode->getFunction() == nullptr) in RefreshCallGraph()
348 if (Function *Callee = Call->getCalledFunction()) { in RefreshCallGraph()
352 if (!ExistingNode->getFunction()) { in RefreshCallGraph()
355 << Callee->getName() << "'\n"); in RefreshCallGraph()
362 CGN->replaceCallEdge(*Call, *Call, CalleeNode); in RefreshCallGraph()
372 if (Function *Callee = Call->getCalledFunction()) { in RefreshCallGraph()
380 CGN->addCalledFunction(Call, CalleeNode); in RefreshCallGraph()
413 CGN->dump(); in RefreshCallGraph()
415 dbgs() << "CGSCCPASSMGR: Refresh devirtualized a call!\n"; in RefreshCallGraph()
417 dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n"; in RefreshCallGraph()
431 // Keep track of whether the callgraph is known to be up-to-date or not. in RunAllPassesOnSCC()
445 // If we're in -debug-pass=Executions mode, construct the SCC node list, in RunAllPassesOnSCC()
454 CGN->print(OS); in RunAllPassesOnSCC()
465 uint64_t RefHash = P->structuralHash(CG.getModule()); in RunAllPassesOnSCC()
475 if (!LocalChanged && (RefHash != P->structuralHash(CG.getModule()))) { in RunAllPassesOnSCC()
477 << P->getPassName() << "\n"; in RunAllPassesOnSCC()
493 // functionpass), refresh it before we move on to the next SCC. in RunAllPassesOnSCC()
505 // Walk the callgraph in bottom-up SCC order. in runOnModule()
522 // mod-ref information etc. in runOnModule()
532 << " SCCPASSMGR: Re-visiting SCC, iteration #" << Iteration in runOnModule()
541 << " times, due to -max-devirt-iterations\n"); in runOnModule()
553 if (PMDataManager *PM = getContainedPass(i)->getAsPMDataManager()) { in doInitialization()
554 assert(PM->getPassManagerType() == PMT_FunctionPassManager && in doInitialization()
556 Changed |= ((FPPassManager*)PM)->doInitialization(CG.getModule()); in doInitialization()
558 Changed |= ((CallGraphSCCPass*)getContainedPass(i))->doInitialization(CG); in doInitialization()
568 if (PMDataManager *PM = getContainedPass(i)->getAsPMDataManager()) { in doFinalization()
569 assert(PM->getPassManagerType() == PMT_FunctionPassManager && in doFinalization()
571 Changed |= ((FPPassManager*)PM)->doFinalization(CG.getModule()); in doFinalization()
573 Changed |= ((CallGraphSCCPass*)getContainedPass(i))->doFinalization(CG); in doFinalization()
579 //===----------------------------------------------------------------------===//
581 //===----------------------------------------------------------------------===//
586 assert(Old != New && "Should not replace node with self"); in ReplaceNode()
600 CGI->ReplaceNode(Old, New); in ReplaceNode()
607 //===----------------------------------------------------------------------===//
609 //===----------------------------------------------------------------------===//
616 PMS.top()->getPassManagerType() > PMT_CallGraphPassManager) in assignPassManager()
622 if (PMS.top()->getPassManagerType() == PMT_CallGraphPassManager) in assignPassManager()
633 PMTopLevelManager *TPM = PMD->getTopLevelManager(); in assignPassManager()
634 TPM->addIndirectPassManager(CGP); in assignPassManager()
639 TPM->schedulePass(P); in assignPassManager()
645 CGP->add(this); in assignPassManager()
656 //===----------------------------------------------------------------------===//
658 //===----------------------------------------------------------------------===//
662 /// PrintCallGraphPass - Print a Module corresponding to a call graph.
696 if (Function *F = CGN->getFunction()) { in runOnSCC()
697 if (!F->isDeclaration() && isFunctionInPrintList(F->getName())) { in runOnSCC()
701 F->print(OS); in runOnSCC()
734 Function *F = CGN->getFunction(); in getDescription()
736 Desc += F->getName(); in getDescription()
748 !Gate.shouldRunPass(this->getPassName(), getDescription(SCC)); in skipSCC()