Lines Matching full:call

1 //===- CallGraphSCCPass.cpp - Pass that operates BU on call graph ---------===//
10 // which are implemented as bottom-up traversals on the call graph. Because
11 // there may be cycles in the call graph, passes of this type operate on the
12 // call-graph in SCC order: that is, they process function bottom-up, except for
89 errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; in dumpPassStructure()
196 /// callgraph with the call sites found in it. This is used after
200 /// This function returns true if it devirtualized an existing function call,
201 /// meaning it turned an indirect call into a direct call. This happens when
202 /// a function pass like GVN optimizes away stuff feeding the indirect call.
224 // Walk the function body looking for call sites. Sync up the call sites in in RefreshCallGraph()
249 // Get the set of call sites currently in the function. in RefreshCallGraph()
251 // Delete "reference" call records that do not have call instruction. We in RefreshCallGraph()
263 // If this call site is null, then the function pass deleted the call in RefreshCallGraph()
265 auto *Call = dyn_cast_or_null<CallBase>(*I->first); in RefreshCallGraph() local
266 if (!Call || in RefreshCallGraph()
267 // If we've already seen this call site, then the FunctionPass RAUW'd in RefreshCallGraph()
268 // one call with another, which resulted in two "uses" in the edge in RefreshCallGraph()
269 // list of the same call. in RefreshCallGraph()
270 Calls.count(Call)) { in RefreshCallGraph()
274 // If this was an indirect call site, count it. in RefreshCallGraph()
285 assert(!Calls.count(Call) && "Call site occurs in node multiple times"); in RefreshCallGraph()
287 if (Call) { in RefreshCallGraph()
288 Function *Callee = Call->getCalledFunction(); in RefreshCallGraph()
291 Calls.insert(std::make_pair(Call, I->second)); in RefreshCallGraph()
302 auto *Call = dyn_cast<CallBase>(&I); in RefreshCallGraph() local
303 if (!Call) in RefreshCallGraph()
305 Function *Callee = Call->getCalledFunction(); in RefreshCallGraph()
313 forEachCallbackFunction(*Call, [&](Function *CB) { in RefreshCallGraph()
318 // If this call site already existed in the callgraph, just verify it in RefreshCallGraph()
321 Calls.find(Call); in RefreshCallGraph()
329 if (ExistingNode->getFunction() == Call->getCalledFunction()) in RefreshCallGraph()
334 // callgraph is less precise than it could be (e.g. an indirect call in RefreshCallGraph()
337 if (CheckingMode && Call->getCalledFunction() && in RefreshCallGraph()
344 // If not, we either went from a direct call to indirect, indirect to in RefreshCallGraph()
347 if (Function *Callee = Call->getCalledFunction()) { in RefreshCallGraph()
349 // Keep track of whether we turned an indirect call into a direct in RefreshCallGraph()
353 LLVM_DEBUG(dbgs() << " CGSCCPASSMGR: Devirtualized call to '" in RefreshCallGraph()
361 CGN->replaceCallEdge(*Call, *Call, CalleeNode); in RefreshCallGraph()
369 // If the call site didn't exist in the CGN yet, add it. in RefreshCallGraph()
371 if (Function *Callee = Call->getCalledFunction()) { in RefreshCallGraph()
379 CGN->addCalledFunction(Call, CalleeNode); in RefreshCallGraph()
383 // We scanned the old callgraph node, removing invalidated call sites and in RefreshCallGraph()
384 // then added back newly found call sites. One thing that can happen is in RefreshCallGraph()
385 // that an old indirect call site was deleted and replaced with a new direct in RefreshCallGraph()
386 // call. In this case, we have devirtualized a call, and CGSCCPM would like in RefreshCallGraph()
391 // (e.g. DCE'ing an indirect call and duplicating an unrelated block with a in RefreshCallGraph()
392 // direct call) but this is close enough. in RefreshCallGraph()
401 assert(Calls.empty() && "Dangling pointers found in call sites map"); in RefreshCallGraph()
414 dbgs() << "CGSCCPASSMGR: Refresh devirtualized a call!\n"; in RefreshCallGraph()
416 dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n"; in RefreshCallGraph()
434 // call graph by introducing new calls or deleting other ones. This flag in RunAllPassesOnSCC()
516 // case where a function pass devirtualizes a call to a function. For in runOnModule()
518 // to eliminate the addressing that feeds into a call. With that improved in runOnModule()
519 // information, we would like the call to be an inline candidate, infer in runOnModule()
523 // This only happens in the case of a devirtualized call, so we only burn in runOnModule()
617 assert(!PMS.empty() && "Unable to handle Call Graph Pass"); in assignPassManager()
623 // Create new Call Graph SCC Pass Manager if it does not exist. in assignPassManager()
624 assert(!PMS.empty() && "Unable to create Call Graph Pass Manager"); in assignPassManager()
627 // [1] Create new Call Graph Pass Manager in assignPassManager()
646 /// For this class, we declare that we require and preserve the call graph.
648 /// always explicitly call the implementation here.
660 /// PrintCallGraphPass - Print a Module corresponding to a call graph.