1 //===- CallGraphSCCPass.cpp - Pass that operates BU on call graph ---------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file implements the CallGraphSCCPass class, which is used for passes 11 // which are implemented as bottom-up traversals on the call graph. Because 12 // there may be cycles in the call graph, passes of this type operate on the 13 // call-graph in SCC order: that is, they process function bottom-up, except for 14 // recursive functions, which they process all at once. 15 // 16 //===----------------------------------------------------------------------===// 17 18 #include "llvm/Analysis/CallGraphSCCPass.h" 19 #include "llvm/ADT/SCCIterator.h" 20 #include "llvm/ADT/Statistic.h" 21 #include "llvm/Analysis/CallGraph.h" 22 #include "llvm/IR/Function.h" 23 #include "llvm/IR/IntrinsicInst.h" 24 #include "llvm/IR/LLVMContext.h" 25 #include "llvm/IR/LegacyPassManagers.h" 26 #include "llvm/IR/OptBisect.h" 27 #include "llvm/Support/CommandLine.h" 28 #include "llvm/Support/Debug.h" 29 #include "llvm/Support/Timer.h" 30 #include "llvm/Support/raw_ostream.h" 31 using namespace llvm; 32 33 #define DEBUG_TYPE "cgscc-passmgr" 34 35 static cl::opt<unsigned> 36 MaxIterations("max-cg-scc-iterations", cl::ReallyHidden, cl::init(4)); 37 38 STATISTIC(MaxSCCIterations, "Maximum CGSCCPassMgr iterations on one SCC"); 39 40 //===----------------------------------------------------------------------===// 41 // CGPassManager 42 // 43 /// CGPassManager manages FPPassManagers and CallGraphSCCPasses. 44 45 namespace { 46 47 class CGPassManager : public ModulePass, public PMDataManager { 48 public: 49 static char ID; 50 explicit CGPassManager() 51 : ModulePass(ID), PMDataManager() { } 52 53 /// Execute all of the passes scheduled for execution. Keep track of 54 /// whether any of the passes modifies the module, and if so, return true. 55 bool runOnModule(Module &M) override; 56 57 using ModulePass::doInitialization; 58 using ModulePass::doFinalization; 59 60 bool doInitialization(CallGraph &CG); 61 bool doFinalization(CallGraph &CG); 62 63 /// Pass Manager itself does not invalidate any analysis info. 64 void getAnalysisUsage(AnalysisUsage &Info) const override { 65 // CGPassManager walks SCC and it needs CallGraph. 66 Info.addRequired<CallGraphWrapperPass>(); 67 Info.setPreservesAll(); 68 } 69 70 StringRef getPassName() const override { return "CallGraph Pass Manager"; } 71 72 PMDataManager *getAsPMDataManager() override { return this; } 73 Pass *getAsPass() override { return this; } 74 75 // Print passes managed by this manager 76 void dumpPassStructure(unsigned Offset) override { 77 errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; 78 for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { 79 Pass *P = getContainedPass(Index); 80 P->dumpPassStructure(Offset + 1); 81 dumpLastUses(P, Offset+1); 82 } 83 } 84 85 Pass *getContainedPass(unsigned N) { 86 assert(N < PassVector.size() && "Pass number out of range!"); 87 return static_cast<Pass *>(PassVector[N]); 88 } 89 90 PassManagerType getPassManagerType() const override { 91 return PMT_CallGraphPassManager; 92 } 93 94 private: 95 bool RunAllPassesOnSCC(CallGraphSCC &CurSCC, CallGraph &CG, 96 bool &DevirtualizedCall); 97 98 bool RunPassOnSCC(Pass *P, CallGraphSCC &CurSCC, 99 CallGraph &CG, bool &CallGraphUpToDate, 100 bool &DevirtualizedCall); 101 bool RefreshCallGraph(const CallGraphSCC &CurSCC, CallGraph &CG, 102 bool IsCheckingMode); 103 }; 104 105 } // end anonymous namespace. 106 107 char CGPassManager::ID = 0; 108 109 110 bool CGPassManager::RunPassOnSCC(Pass *P, CallGraphSCC &CurSCC, 111 CallGraph &CG, bool &CallGraphUpToDate, 112 bool &DevirtualizedCall) { 113 bool Changed = false; 114 PMDataManager *PM = P->getAsPMDataManager(); 115 116 if (!PM) { 117 CallGraphSCCPass *CGSP = (CallGraphSCCPass*)P; 118 if (!CallGraphUpToDate) { 119 DevirtualizedCall |= RefreshCallGraph(CurSCC, CG, false); 120 CallGraphUpToDate = true; 121 } 122 123 { 124 TimeRegion PassTimer(getPassTimer(CGSP)); 125 Changed = CGSP->runOnSCC(CurSCC); 126 } 127 128 // After the CGSCCPass is done, when assertions are enabled, use 129 // RefreshCallGraph to verify that the callgraph was correctly updated. 130 #ifndef NDEBUG 131 if (Changed) 132 RefreshCallGraph(CurSCC, CG, true); 133 #endif 134 135 return Changed; 136 } 137 138 139 assert(PM->getPassManagerType() == PMT_FunctionPassManager && 140 "Invalid CGPassManager member"); 141 FPPassManager *FPP = (FPPassManager*)P; 142 143 // Run pass P on all functions in the current SCC. 144 for (CallGraphNode *CGN : CurSCC) { 145 if (Function *F = CGN->getFunction()) { 146 dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F->getName()); 147 { 148 TimeRegion PassTimer(getPassTimer(FPP)); 149 Changed |= FPP->runOnFunction(*F); 150 } 151 F->getContext().yield(); 152 } 153 } 154 155 // The function pass(es) modified the IR, they may have clobbered the 156 // callgraph. 157 if (Changed && CallGraphUpToDate) { 158 DEBUG(dbgs() << "CGSCCPASSMGR: Pass Dirtied SCC: " 159 << P->getPassName() << '\n'); 160 CallGraphUpToDate = false; 161 } 162 return Changed; 163 } 164 165 166 /// Scan the functions in the specified CFG and resync the 167 /// callgraph with the call sites found in it. This is used after 168 /// FunctionPasses have potentially munged the callgraph, and can be used after 169 /// CallGraphSCC passes to verify that they correctly updated the callgraph. 170 /// 171 /// This function returns true if it devirtualized an existing function call, 172 /// meaning it turned an indirect call into a direct call. This happens when 173 /// a function pass like GVN optimizes away stuff feeding the indirect call. 174 /// This never happens in checking mode. 175 /// 176 bool CGPassManager::RefreshCallGraph(const CallGraphSCC &CurSCC, CallGraph &CG, 177 bool CheckingMode) { 178 DenseMap<Value*, CallGraphNode*> CallSites; 179 180 DEBUG(dbgs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size() 181 << " nodes:\n"; 182 for (CallGraphNode *CGN : CurSCC) 183 CGN->dump(); 184 ); 185 186 bool MadeChange = false; 187 bool DevirtualizedCall = false; 188 189 // Scan all functions in the SCC. 190 unsigned FunctionNo = 0; 191 for (CallGraphSCC::iterator SCCIdx = CurSCC.begin(), E = CurSCC.end(); 192 SCCIdx != E; ++SCCIdx, ++FunctionNo) { 193 CallGraphNode *CGN = *SCCIdx; 194 Function *F = CGN->getFunction(); 195 if (!F || F->isDeclaration()) continue; 196 197 // Walk the function body looking for call sites. Sync up the call sites in 198 // CGN with those actually in the function. 199 200 // Keep track of the number of direct and indirect calls that were 201 // invalidated and removed. 202 unsigned NumDirectRemoved = 0, NumIndirectRemoved = 0; 203 204 // Get the set of call sites currently in the function. 205 for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ) { 206 // If this call site is null, then the function pass deleted the call 207 // entirely and the WeakVH nulled it out. 208 if (!I->first || 209 // If we've already seen this call site, then the FunctionPass RAUW'd 210 // one call with another, which resulted in two "uses" in the edge 211 // list of the same call. 212 CallSites.count(I->first) || 213 214 // If the call edge is not from a call or invoke, or it is a 215 // instrinsic call, then the function pass RAUW'd a call with 216 // another value. This can happen when constant folding happens 217 // of well known functions etc. 218 !CallSite(I->first) || 219 (CallSite(I->first).getCalledFunction() && 220 CallSite(I->first).getCalledFunction()->isIntrinsic() && 221 Intrinsic::isLeaf( 222 CallSite(I->first).getCalledFunction()->getIntrinsicID()))) { 223 assert(!CheckingMode && 224 "CallGraphSCCPass did not update the CallGraph correctly!"); 225 226 // If this was an indirect call site, count it. 227 if (!I->second->getFunction()) 228 ++NumIndirectRemoved; 229 else 230 ++NumDirectRemoved; 231 232 // Just remove the edge from the set of callees, keep track of whether 233 // I points to the last element of the vector. 234 bool WasLast = I + 1 == E; 235 CGN->removeCallEdge(I); 236 237 // If I pointed to the last element of the vector, we have to bail out: 238 // iterator checking rejects comparisons of the resultant pointer with 239 // end. 240 if (WasLast) 241 break; 242 E = CGN->end(); 243 continue; 244 } 245 246 assert(!CallSites.count(I->first) && 247 "Call site occurs in node multiple times"); 248 249 CallSite CS(I->first); 250 if (CS) { 251 Function *Callee = CS.getCalledFunction(); 252 // Ignore intrinsics because they're not really function calls. 253 if (!Callee || !(Callee->isIntrinsic())) 254 CallSites.insert(std::make_pair(I->first, I->second)); 255 } 256 ++I; 257 } 258 259 // Loop over all of the instructions in the function, getting the callsites. 260 // Keep track of the number of direct/indirect calls added. 261 unsigned NumDirectAdded = 0, NumIndirectAdded = 0; 262 263 for (BasicBlock &BB : *F) 264 for (Instruction &I : BB) { 265 CallSite CS(&I); 266 if (!CS) continue; 267 Function *Callee = CS.getCalledFunction(); 268 if (Callee && Callee->isIntrinsic()) continue; 269 270 // If this call site already existed in the callgraph, just verify it 271 // matches up to expectations and remove it from CallSites. 272 DenseMap<Value*, CallGraphNode*>::iterator ExistingIt = 273 CallSites.find(CS.getInstruction()); 274 if (ExistingIt != CallSites.end()) { 275 CallGraphNode *ExistingNode = ExistingIt->second; 276 277 // Remove from CallSites since we have now seen it. 278 CallSites.erase(ExistingIt); 279 280 // Verify that the callee is right. 281 if (ExistingNode->getFunction() == CS.getCalledFunction()) 282 continue; 283 284 // If we are in checking mode, we are not allowed to actually mutate 285 // the callgraph. If this is a case where we can infer that the 286 // callgraph is less precise than it could be (e.g. an indirect call 287 // site could be turned direct), don't reject it in checking mode, and 288 // don't tweak it to be more precise. 289 if (CheckingMode && CS.getCalledFunction() && 290 ExistingNode->getFunction() == nullptr) 291 continue; 292 293 assert(!CheckingMode && 294 "CallGraphSCCPass did not update the CallGraph correctly!"); 295 296 // If not, we either went from a direct call to indirect, indirect to 297 // direct, or direct to different direct. 298 CallGraphNode *CalleeNode; 299 if (Function *Callee = CS.getCalledFunction()) { 300 CalleeNode = CG.getOrInsertFunction(Callee); 301 // Keep track of whether we turned an indirect call into a direct 302 // one. 303 if (!ExistingNode->getFunction()) { 304 DevirtualizedCall = true; 305 DEBUG(dbgs() << " CGSCCPASSMGR: Devirtualized call to '" 306 << Callee->getName() << "'\n"); 307 } 308 } else { 309 CalleeNode = CG.getCallsExternalNode(); 310 } 311 312 // Update the edge target in CGN. 313 CGN->replaceCallEdge(CS, CS, CalleeNode); 314 MadeChange = true; 315 continue; 316 } 317 318 assert(!CheckingMode && 319 "CallGraphSCCPass did not update the CallGraph correctly!"); 320 321 // If the call site didn't exist in the CGN yet, add it. 322 CallGraphNode *CalleeNode; 323 if (Function *Callee = CS.getCalledFunction()) { 324 CalleeNode = CG.getOrInsertFunction(Callee); 325 ++NumDirectAdded; 326 } else { 327 CalleeNode = CG.getCallsExternalNode(); 328 ++NumIndirectAdded; 329 } 330 331 CGN->addCalledFunction(CS, CalleeNode); 332 MadeChange = true; 333 } 334 335 // We scanned the old callgraph node, removing invalidated call sites and 336 // then added back newly found call sites. One thing that can happen is 337 // that an old indirect call site was deleted and replaced with a new direct 338 // call. In this case, we have devirtualized a call, and CGSCCPM would like 339 // to iteratively optimize the new code. Unfortunately, we don't really 340 // have a great way to detect when this happens. As an approximation, we 341 // just look at whether the number of indirect calls is reduced and the 342 // number of direct calls is increased. There are tons of ways to fool this 343 // (e.g. DCE'ing an indirect call and duplicating an unrelated block with a 344 // direct call) but this is close enough. 345 if (NumIndirectRemoved > NumIndirectAdded && 346 NumDirectRemoved < NumDirectAdded) 347 DevirtualizedCall = true; 348 349 // After scanning this function, if we still have entries in callsites, then 350 // they are dangling pointers. WeakVH should save us for this, so abort if 351 // this happens. 352 assert(CallSites.empty() && "Dangling pointers found in call sites map"); 353 354 // Periodically do an explicit clear to remove tombstones when processing 355 // large scc's. 356 if ((FunctionNo & 15) == 15) 357 CallSites.clear(); 358 } 359 360 DEBUG(if (MadeChange) { 361 dbgs() << "CGSCCPASSMGR: Refreshed SCC is now:\n"; 362 for (CallGraphNode *CGN : CurSCC) 363 CGN->dump(); 364 if (DevirtualizedCall) 365 dbgs() << "CGSCCPASSMGR: Refresh devirtualized a call!\n"; 366 367 } else { 368 dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n"; 369 } 370 ); 371 (void)MadeChange; 372 373 return DevirtualizedCall; 374 } 375 376 /// Execute the body of the entire pass manager on the specified SCC. 377 /// This keeps track of whether a function pass devirtualizes 378 /// any calls and returns it in DevirtualizedCall. 379 bool CGPassManager::RunAllPassesOnSCC(CallGraphSCC &CurSCC, CallGraph &CG, 380 bool &DevirtualizedCall) { 381 bool Changed = false; 382 383 // Keep track of whether the callgraph is known to be up-to-date or not. 384 // The CGSSC pass manager runs two types of passes: 385 // CallGraphSCC Passes and other random function passes. Because other 386 // random function passes are not CallGraph aware, they may clobber the 387 // call graph by introducing new calls or deleting other ones. This flag 388 // is set to false when we run a function pass so that we know to clean up 389 // the callgraph when we need to run a CGSCCPass again. 390 bool CallGraphUpToDate = true; 391 392 // Run all passes on current SCC. 393 for (unsigned PassNo = 0, e = getNumContainedPasses(); 394 PassNo != e; ++PassNo) { 395 Pass *P = getContainedPass(PassNo); 396 397 // If we're in -debug-pass=Executions mode, construct the SCC node list, 398 // otherwise avoid constructing this string as it is expensive. 399 if (isPassDebuggingExecutionsOrMore()) { 400 std::string Functions; 401 #ifndef NDEBUG 402 raw_string_ostream OS(Functions); 403 for (CallGraphSCC::iterator I = CurSCC.begin(), E = CurSCC.end(); 404 I != E; ++I) { 405 if (I != CurSCC.begin()) OS << ", "; 406 (*I)->print(OS); 407 } 408 OS.flush(); 409 #endif 410 dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, Functions); 411 } 412 dumpRequiredSet(P); 413 414 initializeAnalysisImpl(P); 415 416 // Actually run this pass on the current SCC. 417 Changed |= RunPassOnSCC(P, CurSCC, CG, 418 CallGraphUpToDate, DevirtualizedCall); 419 420 if (Changed) 421 dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, ""); 422 dumpPreservedSet(P); 423 424 verifyPreservedAnalysis(P); 425 removeNotPreservedAnalysis(P); 426 recordAvailableAnalysis(P); 427 removeDeadPasses(P, "", ON_CG_MSG); 428 } 429 430 // If the callgraph was left out of date (because the last pass run was a 431 // functionpass), refresh it before we move on to the next SCC. 432 if (!CallGraphUpToDate) 433 DevirtualizedCall |= RefreshCallGraph(CurSCC, CG, false); 434 return Changed; 435 } 436 437 /// Execute all of the passes scheduled for execution. Keep track of 438 /// whether any of the passes modifies the module, and if so, return true. 439 bool CGPassManager::runOnModule(Module &M) { 440 CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph(); 441 bool Changed = doInitialization(CG); 442 443 // Walk the callgraph in bottom-up SCC order. 444 scc_iterator<CallGraph*> CGI = scc_begin(&CG); 445 446 CallGraphSCC CurSCC(CG, &CGI); 447 while (!CGI.isAtEnd()) { 448 // Copy the current SCC and increment past it so that the pass can hack 449 // on the SCC if it wants to without invalidating our iterator. 450 const std::vector<CallGraphNode *> &NodeVec = *CGI; 451 CurSCC.initialize(NodeVec); 452 ++CGI; 453 454 // At the top level, we run all the passes in this pass manager on the 455 // functions in this SCC. However, we support iterative compilation in the 456 // case where a function pass devirtualizes a call to a function. For 457 // example, it is very common for a function pass (often GVN or instcombine) 458 // to eliminate the addressing that feeds into a call. With that improved 459 // information, we would like the call to be an inline candidate, infer 460 // mod-ref information etc. 461 // 462 // Because of this, we allow iteration up to a specified iteration count. 463 // This only happens in the case of a devirtualized call, so we only burn 464 // compile time in the case that we're making progress. We also have a hard 465 // iteration count limit in case there is crazy code. 466 unsigned Iteration = 0; 467 bool DevirtualizedCall = false; 468 do { 469 DEBUG(if (Iteration) 470 dbgs() << " SCCPASSMGR: Re-visiting SCC, iteration #" 471 << Iteration << '\n'); 472 DevirtualizedCall = false; 473 Changed |= RunAllPassesOnSCC(CurSCC, CG, DevirtualizedCall); 474 } while (Iteration++ < MaxIterations && DevirtualizedCall); 475 476 if (DevirtualizedCall) 477 DEBUG(dbgs() << " CGSCCPASSMGR: Stopped iteration after " << Iteration 478 << " times, due to -max-cg-scc-iterations\n"); 479 480 if (Iteration > MaxSCCIterations) 481 MaxSCCIterations = Iteration; 482 483 } 484 Changed |= doFinalization(CG); 485 return Changed; 486 } 487 488 489 /// Initialize CG 490 bool CGPassManager::doInitialization(CallGraph &CG) { 491 bool Changed = false; 492 for (unsigned i = 0, e = getNumContainedPasses(); i != e; ++i) { 493 if (PMDataManager *PM = getContainedPass(i)->getAsPMDataManager()) { 494 assert(PM->getPassManagerType() == PMT_FunctionPassManager && 495 "Invalid CGPassManager member"); 496 Changed |= ((FPPassManager*)PM)->doInitialization(CG.getModule()); 497 } else { 498 Changed |= ((CallGraphSCCPass*)getContainedPass(i))->doInitialization(CG); 499 } 500 } 501 return Changed; 502 } 503 504 /// Finalize CG 505 bool CGPassManager::doFinalization(CallGraph &CG) { 506 bool Changed = false; 507 for (unsigned i = 0, e = getNumContainedPasses(); i != e; ++i) { 508 if (PMDataManager *PM = getContainedPass(i)->getAsPMDataManager()) { 509 assert(PM->getPassManagerType() == PMT_FunctionPassManager && 510 "Invalid CGPassManager member"); 511 Changed |= ((FPPassManager*)PM)->doFinalization(CG.getModule()); 512 } else { 513 Changed |= ((CallGraphSCCPass*)getContainedPass(i))->doFinalization(CG); 514 } 515 } 516 return Changed; 517 } 518 519 //===----------------------------------------------------------------------===// 520 // CallGraphSCC Implementation 521 //===----------------------------------------------------------------------===// 522 523 /// This informs the SCC and the pass manager that the specified 524 /// Old node has been deleted, and New is to be used in its place. 525 void CallGraphSCC::ReplaceNode(CallGraphNode *Old, CallGraphNode *New) { 526 assert(Old != New && "Should not replace node with self"); 527 for (unsigned i = 0; ; ++i) { 528 assert(i != Nodes.size() && "Node not in SCC"); 529 if (Nodes[i] != Old) continue; 530 Nodes[i] = New; 531 break; 532 } 533 534 // Update the active scc_iterator so that it doesn't contain dangling 535 // pointers to the old CallGraphNode. 536 scc_iterator<CallGraph*> *CGI = (scc_iterator<CallGraph*>*)Context; 537 CGI->ReplaceNode(Old, New); 538 } 539 540 541 //===----------------------------------------------------------------------===// 542 // CallGraphSCCPass Implementation 543 //===----------------------------------------------------------------------===// 544 545 /// Assign pass manager to manage this pass. 546 void CallGraphSCCPass::assignPassManager(PMStack &PMS, 547 PassManagerType PreferredType) { 548 // Find CGPassManager 549 while (!PMS.empty() && 550 PMS.top()->getPassManagerType() > PMT_CallGraphPassManager) 551 PMS.pop(); 552 553 assert(!PMS.empty() && "Unable to handle Call Graph Pass"); 554 CGPassManager *CGP; 555 556 if (PMS.top()->getPassManagerType() == PMT_CallGraphPassManager) 557 CGP = (CGPassManager*)PMS.top(); 558 else { 559 // Create new Call Graph SCC Pass Manager if it does not exist. 560 assert(!PMS.empty() && "Unable to create Call Graph Pass Manager"); 561 PMDataManager *PMD = PMS.top(); 562 563 // [1] Create new Call Graph Pass Manager 564 CGP = new CGPassManager(); 565 566 // [2] Set up new manager's top level manager 567 PMTopLevelManager *TPM = PMD->getTopLevelManager(); 568 TPM->addIndirectPassManager(CGP); 569 570 // [3] Assign manager to manage this new manager. This may create 571 // and push new managers into PMS 572 Pass *P = CGP; 573 TPM->schedulePass(P); 574 575 // [4] Push new manager into PMS 576 PMS.push(CGP); 577 } 578 579 CGP->add(this); 580 } 581 582 /// For this class, we declare that we require and preserve the call graph. 583 /// If the derived class implements this method, it should 584 /// always explicitly call the implementation here. 585 void CallGraphSCCPass::getAnalysisUsage(AnalysisUsage &AU) const { 586 AU.addRequired<CallGraphWrapperPass>(); 587 AU.addPreserved<CallGraphWrapperPass>(); 588 } 589 590 591 //===----------------------------------------------------------------------===// 592 // PrintCallGraphPass Implementation 593 //===----------------------------------------------------------------------===// 594 595 namespace { 596 /// PrintCallGraphPass - Print a Module corresponding to a call graph. 597 /// 598 class PrintCallGraphPass : public CallGraphSCCPass { 599 std::string Banner; 600 raw_ostream &Out; // raw_ostream to print on. 601 602 public: 603 static char ID; 604 PrintCallGraphPass(const std::string &B, raw_ostream &o) 605 : CallGraphSCCPass(ID), Banner(B), Out(o) {} 606 607 void getAnalysisUsage(AnalysisUsage &AU) const override { 608 AU.setPreservesAll(); 609 } 610 611 bool runOnSCC(CallGraphSCC &SCC) override { 612 Out << Banner; 613 for (CallGraphNode *CGN : SCC) { 614 if (CGN->getFunction()) { 615 if (isFunctionInPrintList(CGN->getFunction()->getName())) 616 CGN->getFunction()->print(Out); 617 } else 618 Out << "\nPrinting <null> Function\n"; 619 } 620 return false; 621 } 622 }; 623 624 } // end anonymous namespace. 625 626 char PrintCallGraphPass::ID = 0; 627 628 Pass *CallGraphSCCPass::createPrinterPass(raw_ostream &O, 629 const std::string &Banner) const { 630 return new PrintCallGraphPass(Banner, O); 631 } 632 633 bool CallGraphSCCPass::skipSCC(CallGraphSCC &SCC) const { 634 return !SCC.getCallGraph().getModule() 635 .getContext() 636 .getOptBisect() 637 .shouldRunPass(this, SCC); 638 } 639 640 char DummyCGSCCPass::ID = 0; 641 INITIALIZE_PASS(DummyCGSCCPass, "DummyCGSCCPass", "DummyCGSCCPass", false, 642 false) 643