LLVM  16.0.0git
CallGraph.cpp
Go to the documentation of this file.
1 //===- CallGraph.cpp - Build a Module's call graph ------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/STLExtras.h"
11 #include "llvm/ADT/SmallVector.h"
12 #include "llvm/Config/llvm-config.h"
14 #include "llvm/IR/Function.h"
15 #include "llvm/IR/IntrinsicInst.h"
16 #include "llvm/IR/Intrinsics.h"
17 #include "llvm/IR/Module.h"
18 #include "llvm/IR/PassManager.h"
19 #include "llvm/InitializePasses.h"
20 #include "llvm/Pass.h"
21 #include "llvm/Support/Compiler.h"
22 #include "llvm/Support/Debug.h"
24 #include <cassert>
25 
26 using namespace llvm;
27 
28 //===----------------------------------------------------------------------===//
29 // Implementations of the CallGraph class methods.
30 //
31 
33  : M(M), ExternalCallingNode(getOrInsertFunction(nullptr)),
34  CallsExternalNode(std::make_unique<CallGraphNode>(this, nullptr)) {
35  // Add every interesting function to the call graph.
36  for (Function &F : M)
37  if (!isDbgInfoIntrinsic(F.getIntrinsicID()))
38  addToCallGraph(&F);
39 }
40 
42  : M(Arg.M), FunctionMap(std::move(Arg.FunctionMap)),
43  ExternalCallingNode(Arg.ExternalCallingNode),
44  CallsExternalNode(std::move(Arg.CallsExternalNode)) {
45  Arg.FunctionMap.clear();
46  Arg.ExternalCallingNode = nullptr;
47 
48  // Update parent CG for all call graph's nodes.
49  CallsExternalNode->CG = this;
50  for (auto &P : FunctionMap)
51  P.second->CG = this;
52 }
53 
55  // CallsExternalNode is not in the function map, delete it explicitly.
56  if (CallsExternalNode)
57  CallsExternalNode->allReferencesDropped();
58 
59 // Reset all node's use counts to zero before deleting them to prevent an
60 // assertion from firing.
61 #ifndef NDEBUG
62  for (auto &I : FunctionMap)
63  I.second->allReferencesDropped();
64 #endif
65 }
66 
69  // Check whether the analysis, all analyses on functions, or the function's
70  // CFG have been preserved.
71  auto PAC = PA.getChecker<CallGraphAnalysis>();
72  return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>());
73 }
74 
77 
78  // If this function has external linkage or has its address taken and
79  // it is not a callback, then anything could call it.
80  if (!F->hasLocalLinkage() ||
81  F->hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/true,
82  /* IgnoreAssumeLikeCalls */ true,
83  /* IgnoreLLVMUsed */ false))
84  ExternalCallingNode->addCalledFunction(nullptr, Node);
85 
87 }
88 
90  Function *F = Node->getFunction();
91 
92  // If this function is not defined in this translation unit, it could call
93  // anything.
94  if (F->isDeclaration() && !F->isIntrinsic())
95  Node->addCalledFunction(nullptr, CallsExternalNode.get());
96 
97  // Look for calls by this function.
98  for (BasicBlock &BB : *F)
99  for (Instruction &I : BB) {
100  if (auto *Call = dyn_cast<CallBase>(&I)) {
101  const Function *Callee = Call->getCalledFunction();
102  if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
103  // Indirect calls of intrinsics are not allowed so no need to check.
104  // We can be more precise here by using TargetArg returned by
105  // Intrinsic::isLeaf.
106  Node->addCalledFunction(Call, CallsExternalNode.get());
107  else if (!Callee->isIntrinsic())
108  Node->addCalledFunction(Call, getOrInsertFunction(Callee));
109 
110  // Add reference to callback functions.
111  forEachCallbackFunction(*Call, [=](Function *CB) {
112  Node->addCalledFunction(nullptr, getOrInsertFunction(CB));
113  });
114  }
115  }
116 }
117 
118 void CallGraph::print(raw_ostream &OS) const {
119  // Print in a deterministic order by sorting CallGraphNodes by name. We do
120  // this here to avoid slowing down the non-printing fast path.
121 
123  Nodes.reserve(FunctionMap.size());
124 
125  for (const auto &I : *this)
126  Nodes.push_back(I.second.get());
127 
129  if (Function *LF = LHS->getFunction())
130  if (Function *RF = RHS->getFunction())
131  return LF->getName() < RF->getName();
132 
133  return RHS->getFunction() != nullptr;
134  });
135 
136  for (CallGraphNode *CN : Nodes)
137  CN->print(OS);
138 }
139 
140 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
142 #endif
143 
145  CallGraphNode *New) {
146  for (auto &CR : ExternalCallingNode->CalledFunctions)
147  if (CR.second == Old) {
148  CR.second->DropRef();
149  CR.second = New;
150  CR.second->AddRef();
151  }
152 }
153 
154 // removeFunctionFromModule - Unlink the function from this module, returning
155 // it. Because this removes the function from the module, the call graph node
156 // is destroyed. This is only valid if the function does not call any other
157 // functions (ie, there are no edges in it's CGN). The easiest way to do this
158 // is to dropAllReferences before calling this.
159 //
161  assert(CGN->empty() && "Cannot remove function from call "
162  "graph if it references other functions!");
163  Function *F = CGN->getFunction(); // Get the function for the call graph node
164  FunctionMap.erase(F); // Remove the call graph node from the map
165 
166  M.getFunctionList().remove(F);
167  return F;
168 }
169 
170 // getOrInsertFunction - This method is identical to calling operator[], but
171 // it will insert a new CallGraphNode for the specified function if one does
172 // not already exist.
174  auto &CGN = FunctionMap[F];
175  if (CGN)
176  return CGN.get();
177 
178  assert((!F || F->getParent() == &M) && "Function not in current module!");
179  CGN = std::make_unique<CallGraphNode>(this, const_cast<Function *>(F));
180  return CGN.get();
181 }
182 
183 //===----------------------------------------------------------------------===//
184 // Implementations of the CallGraphNode class methods.
185 //
186 
188  if (Function *F = getFunction())
189  OS << "Call graph node for function: '" << F->getName() << "'";
190  else
191  OS << "Call graph node <<null function>>";
192 
193  OS << "<<" << this << ">> #uses=" << getNumReferences() << '\n';
194 
195  for (const auto &I : *this) {
196  OS << " CS<" << I.first << "> calls ";
197  if (Function *FI = I.second->getFunction())
198  OS << "function '" << FI->getName() <<"'\n";
199  else
200  OS << "external node\n";
201  }
202  OS << '\n';
203 }
204 
205 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
207 #endif
208 
209 /// removeCallEdgeFor - This method removes the edge in the node for the
210 /// specified call site. Note that this method takes linear time, so it
211 /// should be used sparingly.
213  for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
214  assert(I != CalledFunctions.end() && "Cannot find callsite to remove!");
215  if (I->first && *I->first == &Call) {
216  I->second->DropRef();
217  *I = CalledFunctions.back();
218  CalledFunctions.pop_back();
219 
220  // Remove all references to callback functions if there are any.
221  forEachCallbackFunction(Call, [=](Function *CB) {
223  });
224  return;
225  }
226  }
227 }
228 
229 // removeAnyCallEdgeTo - This method removes any call edges from this node to
230 // the specified callee function. This takes more time to execute than
231 // removeCallEdgeTo, so it should not be used unless necessary.
233  for (unsigned i = 0, e = CalledFunctions.size(); i != e; ++i)
234  if (CalledFunctions[i].second == Callee) {
235  Callee->DropRef();
236  CalledFunctions[i] = CalledFunctions.back();
237  CalledFunctions.pop_back();
238  --i; --e;
239  }
240 }
241 
242 /// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite
243 /// from this node to the specified callee function.
245  for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
246  assert(I != CalledFunctions.end() && "Cannot find callee to remove!");
247  CallRecord &CR = *I;
248  if (CR.second == Callee && !CR.first) {
249  Callee->DropRef();
250  *I = CalledFunctions.back();
251  CalledFunctions.pop_back();
252  return;
253  }
254  }
255 }
256 
257 /// replaceCallEdge - This method replaces the edge in the node for the
258 /// specified call site with a new one. Note that this method takes linear
259 /// time, so it should be used sparingly.
261  CallGraphNode *NewNode) {
262  for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
263  assert(I != CalledFunctions.end() && "Cannot find callsite to remove!");
264  if (I->first && *I->first == &Call) {
265  I->second->DropRef();
266  I->first = &NewCall;
267  I->second = NewNode;
268  NewNode->AddRef();
269 
270  // Refresh callback references. Do not resize CalledFunctions if the
271  // number of callbacks is the same for new and old call sites.
274  forEachCallbackFunction(Call, [this, &OldCBs](Function *CB) {
275  OldCBs.push_back(CG->getOrInsertFunction(CB));
276  });
277  forEachCallbackFunction(NewCall, [this, &NewCBs](Function *CB) {
278  NewCBs.push_back(CG->getOrInsertFunction(CB));
279  });
280  if (OldCBs.size() == NewCBs.size()) {
281  for (unsigned N = 0; N < OldCBs.size(); ++N) {
282  CallGraphNode *OldNode = OldCBs[N];
283  CallGraphNode *NewNode = NewCBs[N];
284  for (auto J = CalledFunctions.begin();; ++J) {
285  assert(J != CalledFunctions.end() &&
286  "Cannot find callsite to update!");
287  if (!J->first && J->second == OldNode) {
288  J->second = NewNode;
289  OldNode->DropRef();
290  NewNode->AddRef();
291  break;
292  }
293  }
294  }
295  } else {
296  for (auto *CGN : OldCBs)
298  for (auto *CGN : NewCBs)
299  addCalledFunction(nullptr, CGN);
300  }
301  return;
302  }
303  }
304 }
305 
306 // Provide an explicit template instantiation for the static ID.
307 AnalysisKey CallGraphAnalysis::Key;
308 
310  ModuleAnalysisManager &AM) {
312  return PreservedAnalyses::all();
313 }
314 
315 //===----------------------------------------------------------------------===//
316 // Out-of-line definitions of CallGraphAnalysis class members.
317 //
318 
319 //===----------------------------------------------------------------------===//
320 // Implementations of the CallGraphWrapperPass class methods.
321 //
322 
325 }
326 
328 
330  AU.setPreservesAll();
331 }
332 
334  // All the real work is done in the constructor for the CallGraph.
335  G.reset(new CallGraph(M));
336  return false;
337 }
338 
339 INITIALIZE_PASS(CallGraphWrapperPass, "basiccg", "CallGraph Construction",
340  false, true)
341 
342 char CallGraphWrapperPass::ID = 0;
343 
344 void CallGraphWrapperPass::releaseMemory() { G.reset(); }
345 
347  if (!G) {
348  OS << "No call graph has been built!\n";
349  return;
350  }
351 
352  // Just delegate.
353  G->print(OS);
354 }
355 
356 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
358 void CallGraphWrapperPass::dump() const { print(dbgs(), nullptr); }
359 #endif
360 
361 namespace {
362 
363 struct CallGraphPrinterLegacyPass : public ModulePass {
364  static char ID; // Pass ID, replacement for typeid
365 
366  CallGraphPrinterLegacyPass() : ModulePass(ID) {
368  }
369 
370  void getAnalysisUsage(AnalysisUsage &AU) const override {
371  AU.setPreservesAll();
373  }
374 
375  bool runOnModule(Module &M) override {
376  getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
377  return false;
378  }
379 };
380 
381 } // end anonymous namespace
382 
384 
385 INITIALIZE_PASS_BEGIN(CallGraphPrinterLegacyPass, "print-callgraph",
386  "Print a call graph", true, true)
388 INITIALIZE_PASS_END(CallGraphPrinterLegacyPass, "print-callgraph",
llvm::CallGraphNode::removeAnyCallEdgeTo
void removeAnyCallEdgeTo(CallGraphNode *Callee)
Removes all call edges from this node to the specified callee function.
Definition: CallGraph.cpp:232
i
i
Definition: README.txt:29
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:492
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::CallGraphWrapperPass::~CallGraphWrapperPass
~CallGraphWrapperPass() override
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::CallGraphAnalysis
An analysis pass to compute the CallGraph for a Module.
Definition: CallGraph.h:304
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition: ArchiveWriter.cpp:189
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:248
IntrinsicInst.h
llvm::AnalysisManager::getResult
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:774
llvm::Function
Definition: Function.h:60
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
Pass.h
llvm::CallGraphNode::CallRecord
std::pair< Optional< WeakTrackingVH >, CallGraphNode * > CallRecord
A pair of the calling instruction (a call or invoke) and the call graph node being called.
Definition: CallGraph.h:178
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1182
llvm::CallGraphNode::removeCallEdgeFor
void removeCallEdgeFor(CallBase &Call)
Removes the edge in the node for the specified call site.
Definition: CallGraph.cpp:212
llvm::AllAnalysesOn
This templated class represents "all analyses that operate over <a particular IR unit>" (e....
Definition: PassManager.h:90
llvm::CallGraph
The basic data container for the call graph of a Module of IR.
Definition: CallGraph.h:72
llvm::CallGraph::dump
void dump() const
Definition: CallGraph.cpp:141
Module.h
llvm::CallGraph::~CallGraph
~CallGraph()
Definition: CallGraph.cpp:54
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:891
STLExtras.h
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::CallGraphNode::addCalledFunction
void addCalledFunction(CallBase *Call, CallGraphNode *M)
Adds a function to the list of functions called by this one.
Definition: CallGraph.h:242
true
print Print a call true
Definition: CallGraph.cpp:389
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
a
=0.0 ? 0.0 :(a > 0.0 ? 1.0 :-1.0) a
Definition: README.txt:489
llvm::CallGraph::invalidate
bool invalidate(Module &, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &)
Definition: CallGraph.cpp:67
llvm::CallGraphPrinterPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: CallGraph.cpp:309
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::CallGraph::getOrInsertFunction
CallGraphNode * getOrInsertFunction(const Function *F)
Similar to operator[], but this will insert a new CallGraphNode for F if one does not already exist.
Definition: CallGraph.cpp:173
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:186
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::CallGraphWrapperPass::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: CallGraph.cpp:329
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:24
llvm::CallGraphNode::getNumReferences
unsigned getNumReferences() const
Returns the number of other CallGraphNodes in this CallGraph that reference this node in their callee...
Definition: CallGraph.h:208
Intrinsics.h
llvm::CallGraphNode::dump
void dump() const
Print out this call graph node.
Definition: CallGraph.cpp:206
INITIALIZE_PASS
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:37
callgraph
print callgraph
Definition: CallGraph.cpp:388
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::Instruction
Definition: Instruction.h:42
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::CallGraphNode
A node in the call graph for a module.
Definition: CallGraph.h:166
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:661
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
INITIALIZE_PASS_END
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:58
llvm::CallGraph::ReplaceExternalCallEdge
void ReplaceExternalCallEdge(CallGraphNode *Old, CallGraphNode *New)
Old node has been deleted, and New is to be used in its place, update the ExternalCallingNode.
Definition: CallGraph.cpp:144
llvm::CallGraphWrapperPass::print
void print(raw_ostream &o, const Module *) const override
print - Print out the internal state of the pass.
Definition: CallGraph.cpp:346
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1538
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
llvm::CallGraph::print
void print(raw_ostream &OS) const
Definition: CallGraph.cpp:118
llvm::CallGraph::populateCallGraphNode
void populateCallGraphNode(CallGraphNode *CGN)
Populate CGN based on the calls inside the associated function.
Definition: CallGraph.cpp:89
llvm::CallGraphNode::empty
bool empty() const
Definition: CallGraph.h:203
INITIALIZE_PASS_DEPENDENCY
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:54
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:69
llvm::CallGraphWrapperPass
The ModulePass which wraps up a CallGraph and the logic to build it.
Definition: CallGraph.h:336
I
#define I(x, y, z)
Definition: MD5.cpp:58
call
S is passed via registers r2 But gcc stores them to the and then reload them to and r3 before issuing the call(r0 contains the address of the format string)
Definition: README.txt:190
llvm::Intrinsic::isLeaf
bool isLeaf(ID id)
Returns true if the intrinsic is a leaf, i.e.
Definition: Function.cpp:1404
llvm::initializeCallGraphPrinterLegacyPassPass
void initializeCallGraphPrinterLegacyPassPass(PassRegistry &)
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1666
llvm::CallGraph::removeFunctionFromModule
Function * removeFunctionFromModule(CallGraphNode *CGN)
Unlink the function from this module, returning it.
Definition: CallGraph.cpp:160
llvm::CallGraphWrapperPass::runOnModule
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition: CallGraph.cpp:333
llvm::initializeCallGraphWrapperPassPass
void initializeCallGraphWrapperPassPass(PassRegistry &)
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
INITIALIZE_PASS_BEGIN
INITIALIZE_PASS_BEGIN(CallGraphPrinterLegacyPass, "print-callgraph", "Print a call graph", true, true) INITIALIZE_PASS_END(CallGraphPrinterLegacyPass
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
if
if(llvm_vc STREQUAL "") set(fake_version_inc "$
Definition: CMakeLists.txt:14
Compiler.h
llvm::rdf::Print
Print(const T &, const DataFlowGraph &) -> Print< T >
llvm::CallGraph::addToCallGraph
void addToCallGraph(Function *F)
Add a function to the call graph, and link the node to all of the functions that it calls.
Definition: CallGraph.cpp:75
llvm::Module::getFunctionList
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
Definition: Module.h:559
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:308
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:186
llvm::CallGraphNode::getFunction
Function * getFunction() const
Returns the function that this call graph node represents.
Definition: CallGraph.h:197
llvm::CallGraphWrapperPass::CallGraphWrapperPass
CallGraphWrapperPass()
Definition: CallGraph.cpp:323
llvm::CallGraphNode::removeOneAbstractEdgeTo
void removeOneAbstractEdgeTo(CallGraphNode *Callee)
Removes one edge associated with a null callsite from this node to the specified callee function.
Definition: CallGraph.cpp:244
llvm::CallGraph::CallGraph
CallGraph(Module &M)
Definition: CallGraph.cpp:32
std
Definition: BitVector.h:851
llvm::AnalysisUsage::setPreservesAll
void setPreservesAll()
Set by analyses that do not transform their input at all.
Definition: PassAnalysisSupport.h:130
llvm::PreservedAnalyses::all
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:158
Function.h
llvm::isDbgInfoIntrinsic
static bool isDbgInfoIntrinsic(Intrinsic::ID ID)
Check if ID corresponds to a debug info intrinsic.
Definition: IntrinsicInst.h:126
PassManager.h
llvm::forEachCallbackFunction
void forEachCallbackFunction(const CallBase &CB, UnaryFunction Func)
Apply function Func to each CB's callback function.
Definition: AbstractCallSite.h:238
CallGraph.h
llvm::CallGraphNode::print
void print(raw_ostream &OS) const
Definition: CallGraph.cpp:187
SmallVector.h
N
#define N
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1174
llvm::AnalysisUsage::addRequiredTransitive
AnalysisUsage & addRequiredTransitive()
Definition: PassAnalysisSupport.h:81
llvm::PreservedAnalyses::getChecker
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
Definition: PassManager.h:310
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::CallGraphWrapperPass::dump
void dump() const
Definition: CallGraph.cpp:358
AbstractCallSite.h
graph
print Print a call graph
Definition: CallGraph.cpp:389
raw_ostream.h
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:650
InitializePasses.h
Debug.h
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::CallGraphNode::replaceCallEdge
void replaceCallEdge(CallBase &Call, CallBase &NewCall, CallGraphNode *NewNode)
Replaces the edge in the node for the specified call site with a new one.
Definition: CallGraph.cpp:260