Lines Matching +full:self +full:- +full:refresh
1 //===- CallGraph.cpp - Build a Module's call graph ------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 #include "llvm/Config/llvm-config.h"
28 //===----------------------------------------------------------------------===//
49 CallsExternalNode->CG = this; in CallGraph()
51 P.second->CG = this; in CallGraph()
57 CallsExternalNode->allReferencesDropped(); in ~CallGraph()
63 I.second->allReferencesDropped(); in ~CallGraph()
80 if (!F->hasLocalLinkage() || in addToCallGraph()
81 F->hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/true, in addToCallGraph()
84 ExternalCallingNode->addCalledFunction(nullptr, Node); in addToCallGraph()
90 Function *F = Node->getFunction(); in populateCallGraphNode()
94 if (F->isDeclaration() && !F->hasFnAttribute(Attribute::NoCallback)) in populateCallGraphNode()
95 Node->addCalledFunction(nullptr, CallsExternalNode.get()); in populateCallGraphNode()
101 const Function *Callee = Call->getCalledFunction(); in populateCallGraphNode()
103 Node->addCalledFunction(Call, CallsExternalNode.get()); in populateCallGraphNode()
104 else if (!isDbgInfoIntrinsic(Callee->getIntrinsicID())) in populateCallGraphNode()
105 Node->addCalledFunction(Call, getOrInsertFunction(Callee)); in populateCallGraphNode()
109 Node->addCalledFunction(nullptr, getOrInsertFunction(CB)); in populateCallGraphNode()
117 // this here to avoid slowing down the non-printing fast path. in print()
126 if (Function *LF = LHS->getFunction()) in print()
127 if (Function *RF = RHS->getFunction()) in print()
128 return LF->getName() < RF->getName(); in print()
130 return RHS->getFunction() != nullptr; in print()
134 CN->print(OS); in print()
143 for (auto &CR : ExternalCallingNode->CalledFunctions) in ReplaceExternalCallEdge()
145 CR.second->DropRef(); in ReplaceExternalCallEdge()
147 CR.second->AddRef(); in ReplaceExternalCallEdge()
151 // removeFunctionFromModule - Unlink the function from this module, returning
158 assert(CGN->empty() && "Cannot remove function from call " in removeFunctionFromModule()
160 Function *F = CGN->getFunction(); // Get the function for the call graph node in removeFunctionFromModule()
167 // getOrInsertFunction - This method is identical to calling operator[], but
175 assert((!F || F->getParent() == &M) && "Function not in current module!"); in getOrInsertFunction()
180 //===----------------------------------------------------------------------===//
186 OS << "Call graph node for function: '" << F->getName() << "'"; in print()
194 if (Function *FI = I.second->getFunction()) in print()
195 OS << "function '" << FI->getName() <<"'\n"; in print()
206 /// removeCallEdgeFor - This method removes the edge in the node for the
212 if (I->first && *I->first == &Call) { in removeCallEdgeFor()
213 I->second->DropRef(); in removeCallEdgeFor()
219 removeOneAbstractEdgeTo(CG->getOrInsertFunction(CB)); in removeCallEdgeFor()
226 // removeAnyCallEdgeTo - This method removes any call edges from this node to
232 Callee->DropRef(); in removeAnyCallEdgeTo()
235 --i; --e; in removeAnyCallEdgeTo()
239 /// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite
246 Callee->DropRef(); in removeOneAbstractEdgeTo()
254 /// replaceCallEdge - This method replaces the edge in the node for the
261 if (I->first && *I->first == &Call) { in replaceCallEdge()
262 I->second->DropRef(); in replaceCallEdge()
263 I->first = &NewCall; in replaceCallEdge()
264 I->second = NewNode; in replaceCallEdge()
265 NewNode->AddRef(); in replaceCallEdge()
267 // Refresh callback references. Do not resize CalledFunctions if the in replaceCallEdge()
272 OldCBs.push_back(CG->getOrInsertFunction(CB)); in replaceCallEdge()
275 NewCBs.push_back(CG->getOrInsertFunction(CB)); in replaceCallEdge()
284 if (!J->first && J->second == OldNode) { in replaceCallEdge()
285 J->second = NewNode; in replaceCallEdge()
286 OldNode->DropRef(); in replaceCallEdge()
287 NewNode->AddRef(); in replaceCallEdge()
327 OS << (CGN->getFunction() ? CGN->getFunction()->getName() in run()
332 OS << " (Has self-loop)."; in run()
338 //===----------------------------------------------------------------------===//
339 // Out-of-line definitions of CallGraphAnalysis class members.
342 //===----------------------------------------------------------------------===//
376 G->print(OS); in print()