LLVM  14.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 <algorithm>
25 #include <cassert>
26 
27 using namespace llvm;
28 
29 //===----------------------------------------------------------------------===//
30 // Implementations of the CallGraph class methods.
31 //
32 
34  : M(M), ExternalCallingNode(getOrInsertFunction(nullptr)),
35  CallsExternalNode(std::make_unique<CallGraphNode>(this, nullptr)) {
36  // Add every interesting function to the call graph.
37  for (Function &F : M)
38  if (!isDbgInfoIntrinsic(F.getIntrinsicID()))
39  addToCallGraph(&F);
40 }
41 
43  : M(Arg.M), FunctionMap(std::move(Arg.FunctionMap)),
44  ExternalCallingNode(Arg.ExternalCallingNode),
45  CallsExternalNode(std::move(Arg.CallsExternalNode)) {
46  Arg.FunctionMap.clear();
47  Arg.ExternalCallingNode = nullptr;
48 
49  // Update parent CG for all call graph's nodes.
50  CallsExternalNode->CG = this;
51  for (auto &P : FunctionMap)
52  P.second->CG = this;
53 }
54 
56  // CallsExternalNode is not in the function map, delete it explicitly.
57  if (CallsExternalNode)
58  CallsExternalNode->allReferencesDropped();
59 
60 // Reset all node's use counts to zero before deleting them to prevent an
61 // assertion from firing.
62 #ifndef NDEBUG
63  for (auto &I : FunctionMap)
64  I.second->allReferencesDropped();
65 #endif
66 }
67 
70  // Check whether the analysis, all analyses on functions, or the function's
71  // CFG have been preserved.
72  auto PAC = PA.getChecker<CallGraphAnalysis>();
73  return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>() ||
74  PAC.preservedSet<CFGAnalyses>());
75 }
76 
79 
80  // If this function has external linkage or has its address taken and
81  // it is not a callback, then anything could call it.
82  if (!F->hasLocalLinkage() ||
83  F->hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/true,
84  /* IgnoreAssumeLikeCalls */ true,
85  /* IgnoreLLVMUsed */ false))
86  ExternalCallingNode->addCalledFunction(nullptr, Node);
87 
89 }
90 
92  Function *F = Node->getFunction();
93 
94  // If this function is not defined in this translation unit, it could call
95  // anything.
96  if (F->isDeclaration() && !F->isIntrinsic())
97  Node->addCalledFunction(nullptr, CallsExternalNode.get());
98 
99  // Look for calls by this function.
100  for (BasicBlock &BB : *F)
101  for (Instruction &I : BB) {
102  if (auto *Call = dyn_cast<CallBase>(&I)) {
103  const Function *Callee = Call->getCalledFunction();
104  if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
105  // Indirect calls of intrinsics are not allowed so no need to check.
106  // We can be more precise here by using TargetArg returned by
107  // Intrinsic::isLeaf.
108  Node->addCalledFunction(Call, CallsExternalNode.get());
109  else if (!Callee->isIntrinsic())
110  Node->addCalledFunction(Call, getOrInsertFunction(Callee));
111 
112  // Add reference to callback functions.
113  forEachCallbackFunction(*Call, [=](Function *CB) {
114  Node->addCalledFunction(nullptr, getOrInsertFunction(CB));
115  });
116  }
117  }
118 }
119 
120 void CallGraph::print(raw_ostream &OS) const {
121  // Print in a deterministic order by sorting CallGraphNodes by name. We do
122  // this here to avoid slowing down the non-printing fast path.
123 
125  Nodes.reserve(FunctionMap.size());
126 
127  for (const auto &I : *this)
128  Nodes.push_back(I.second.get());
129 
130  llvm::sort(Nodes, [](CallGraphNode *LHS, CallGraphNode *RHS) {
131  if (Function *LF = LHS->getFunction())
132  if (Function *RF = RHS->getFunction())
133  return LF->getName() < RF->getName();
134 
135  return RHS->getFunction() != nullptr;
136  });
137 
138  for (CallGraphNode *CN : Nodes)
139  CN->print(OS);
140 }
141 
142 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
144 #endif
145 
147  CallGraphNode *New) {
148  for (auto &CR : ExternalCallingNode->CalledFunctions)
149  if (CR.second == Old) {
150  CR.second->DropRef();
151  CR.second = New;
152  CR.second->AddRef();
153  }
154 }
155 
156 // removeFunctionFromModule - Unlink the function from this module, returning
157 // it. Because this removes the function from the module, the call graph node
158 // is destroyed. This is only valid if the function does not call any other
159 // functions (ie, there are no edges in it's CGN). The easiest way to do this
160 // is to dropAllReferences before calling this.
161 //
163  assert(CGN->empty() && "Cannot remove function from call "
164  "graph if it references other functions!");
165  Function *F = CGN->getFunction(); // Get the function for the call graph node
166  FunctionMap.erase(F); // Remove the call graph node from the map
167 
168  M.getFunctionList().remove(F);
169  return F;
170 }
171 
172 // getOrInsertFunction - This method is identical to calling operator[], but
173 // it will insert a new CallGraphNode for the specified function if one does
174 // not already exist.
176  auto &CGN = FunctionMap[F];
177  if (CGN)
178  return CGN.get();
179 
180  assert((!F || F->getParent() == &M) && "Function not in current module!");
181  CGN = std::make_unique<CallGraphNode>(this, const_cast<Function *>(F));
182  return CGN.get();
183 }
184 
185 //===----------------------------------------------------------------------===//
186 // Implementations of the CallGraphNode class methods.
187 //
188 
190  if (Function *F = getFunction())
191  OS << "Call graph node for function: '" << F->getName() << "'";
192  else
193  OS << "Call graph node <<null function>>";
194 
195  OS << "<<" << this << ">> #uses=" << getNumReferences() << '\n';
196 
197  for (const auto &I : *this) {
198  OS << " CS<" << I.first << "> calls ";
199  if (Function *FI = I.second->getFunction())
200  OS << "function '" << FI->getName() <<"'\n";
201  else
202  OS << "external node\n";
203  }
204  OS << '\n';
205 }
206 
207 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
209 #endif
210 
211 /// removeCallEdgeFor - This method removes the edge in the node for the
212 /// specified call site. Note that this method takes linear time, so it
213 /// should be used sparingly.
215  for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
216  assert(I != CalledFunctions.end() && "Cannot find callsite to remove!");
217  if (I->first && *I->first == &Call) {
218  I->second->DropRef();
219  *I = CalledFunctions.back();
220  CalledFunctions.pop_back();
221 
222  // Remove all references to callback functions if there are any.
223  forEachCallbackFunction(Call, [=](Function *CB) {
225  });
226  return;
227  }
228  }
229 }
230 
231 // removeAnyCallEdgeTo - This method removes any call edges from this node to
232 // the specified callee function. This takes more time to execute than
233 // removeCallEdgeTo, so it should not be used unless necessary.
235  for (unsigned i = 0, e = CalledFunctions.size(); i != e; ++i)
236  if (CalledFunctions[i].second == Callee) {
237  Callee->DropRef();
238  CalledFunctions[i] = CalledFunctions.back();
239  CalledFunctions.pop_back();
240  --i; --e;
241  }
242 }
243 
244 /// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite
245 /// from this node to the specified callee function.
247  for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
248  assert(I != CalledFunctions.end() && "Cannot find callee to remove!");
249  CallRecord &CR = *I;
250  if (CR.second == Callee && !CR.first) {
251  Callee->DropRef();
252  *I = CalledFunctions.back();
253  CalledFunctions.pop_back();
254  return;
255  }
256  }
257 }
258 
259 /// replaceCallEdge - This method replaces the edge in the node for the
260 /// specified call site with a new one. Note that this method takes linear
261 /// time, so it should be used sparingly.
263  CallGraphNode *NewNode) {
264  for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
265  assert(I != CalledFunctions.end() && "Cannot find callsite to remove!");
266  if (I->first && *I->first == &Call) {
267  I->second->DropRef();
268  I->first = &NewCall;
269  I->second = NewNode;
270  NewNode->AddRef();
271 
272  // Refresh callback references. Do not resize CalledFunctions if the
273  // number of callbacks is the same for new and old call sites.
276  forEachCallbackFunction(Call, [this, &OldCBs](Function *CB) {
277  OldCBs.push_back(CG->getOrInsertFunction(CB));
278  });
279  forEachCallbackFunction(NewCall, [this, &NewCBs](Function *CB) {
280  NewCBs.push_back(CG->getOrInsertFunction(CB));
281  });
282  if (OldCBs.size() == NewCBs.size()) {
283  for (unsigned N = 0; N < OldCBs.size(); ++N) {
284  CallGraphNode *OldNode = OldCBs[N];
285  CallGraphNode *NewNode = NewCBs[N];
286  for (auto J = CalledFunctions.begin();; ++J) {
287  assert(J != CalledFunctions.end() &&
288  "Cannot find callsite to update!");
289  if (!J->first && J->second == OldNode) {
290  J->second = NewNode;
291  OldNode->DropRef();
292  NewNode->AddRef();
293  break;
294  }
295  }
296  }
297  } else {
298  for (auto *CGN : OldCBs)
300  for (auto *CGN : NewCBs)
301  addCalledFunction(nullptr, CGN);
302  }
303  return;
304  }
305  }
306 }
307 
308 // Provide an explicit template instantiation for the static ID.
309 AnalysisKey CallGraphAnalysis::Key;
310 
312  ModuleAnalysisManager &AM) {
314  return PreservedAnalyses::all();
315 }
316 
317 //===----------------------------------------------------------------------===//
318 // Out-of-line definitions of CallGraphAnalysis class members.
319 //
320 
321 //===----------------------------------------------------------------------===//
322 // Implementations of the CallGraphWrapperPass class methods.
323 //
324 
327 }
328 
330 
332  AU.setPreservesAll();
333 }
334 
336  // All the real work is done in the constructor for the CallGraph.
337  G.reset(new CallGraph(M));
338  return false;
339 }
340 
341 INITIALIZE_PASS(CallGraphWrapperPass, "basiccg", "CallGraph Construction",
342  false, true)
343 
344 char CallGraphWrapperPass::ID = 0;
345 
346 void CallGraphWrapperPass::releaseMemory() { G.reset(); }
347 
349  if (!G) {
350  OS << "No call graph has been built!\n";
351  return;
352  }
353 
354  // Just delegate.
355  G->print(OS);
356 }
357 
358 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
360 void CallGraphWrapperPass::dump() const { print(dbgs(), nullptr); }
361 #endif
362 
363 namespace {
364 
365 struct CallGraphPrinterLegacyPass : public ModulePass {
366  static char ID; // Pass ID, replacement for typeid
367 
368  CallGraphPrinterLegacyPass() : ModulePass(ID) {
370  }
371 
372  void getAnalysisUsage(AnalysisUsage &AU) const override {
373  AU.setPreservesAll();
375  }
376 
377  bool runOnModule(Module &M) override {
378  getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
379  return false;
380  }
381 };
382 
383 } // end anonymous namespace
384 
386 
387 INITIALIZE_PASS_BEGIN(CallGraphPrinterLegacyPass, "print-callgraph",
388  "Print a call graph", true, true)
390 INITIALIZE_PASS_END(CallGraphPrinterLegacyPass, "print-callgraph",
391  "Print a call graph", true, true)
llvm::CallGraphNode::removeAnyCallEdgeTo
void removeAnyCallEdgeTo(CallGraphNode *Callee)
Removes all call edges from this node to the specified callee function.
Definition: CallGraph.cpp:234
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:155
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:491
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
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:305
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition: ArchiveWriter.cpp:147
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:238
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:779
llvm::Function
Definition: Function.h:61
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:179
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::CallGraphNode::removeCallEdgeFor
void removeCallEdgeFor(CallBase &Call)
Removes the edge in the node for the specified call site.
Definition: CallGraph.cpp:214
llvm::AllAnalysesOn
This templated class represents "all analyses that operate over <a particular IR unit>" (e....
Definition: PassManager.h:93
llvm::CallGraph
The basic data container for the call graph of a Module of IR.
Definition: CallGraph.h:73
llvm::CallGraph::dump
void dump() const
Definition: CallGraph.cpp:143
Module.h
llvm::CallGraph::~CallGraph
~CallGraph()
Definition: CallGraph.cpp:55
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:892
STLExtras.h
llvm::CallGraphNode::addCalledFunction
void addCalledFunction(CallBase *Call, CallGraphNode *M)
Adds a function to the list of functions called by this one.
Definition: CallGraph.h:243
true
print Print a call true
Definition: CallGraph.cpp:391
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
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:68
llvm::CallGraphPrinterPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: CallGraph.cpp:311
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:175
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:206
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:331
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
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:209
Intrinsics.h
llvm::CallGraphNode::dump
void dump() const
Print out this call graph node.
Definition: CallGraph.cpp:208
INITIALIZE_PASS
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:37
callgraph
print callgraph
Definition: CallGraph.cpp:390
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::Instruction
Definition: Instruction.h:45
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::CallGraphNode
A node in the call graph for a module.
Definition: CallGraph.h:167
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:666
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:146
llvm::CallGraphWrapperPass::print
void print(raw_ostream &o, const Module *) const override
print - Print out the internal state of the pass.
Definition: CallGraph.cpp:348
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
llvm::CallGraph::print
void print(raw_ostream &OS) const
Definition: CallGraph.cpp:120
llvm::CallGraph::populateCallGraphNode
void populateCallGraphNode(CallGraphNode *CGN)
Populate CGN based on the calls inside the associated function.
Definition: CallGraph.cpp:91
llvm::CallGraphNode::empty
bool empty() const
Definition: CallGraph.h:204
INITIALIZE_PASS_DEPENDENCY
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:72
llvm::CallGraphWrapperPass
The ModulePass which wraps up a CallGraph and the logic to build it.
Definition: CallGraph.h:337
I
#define I(x, y, z)
Definition: MD5.cpp:59
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:1362
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:1609
llvm::CallGraph::removeFunctionFromModule
Function * removeFunctionFromModule(CallGraphNode *CGN)
Unlink the function from this module, returning it.
Definition: CallGraph.cpp:162
llvm::CallGraphWrapperPass::runOnModule
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition: CallGraph.cpp:335
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:67
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
llvm::CFGAnalyses
Represents analyses that only rely on functions' control flow.
Definition: PassManager.h:116
Compiler.h
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:77
llvm::Module::getFunctionList
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
Definition: Module.h:556
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:206
llvm::CallGraphNode::getFunction
Function * getFunction() const
Returns the function that this call graph node represents.
Definition: CallGraph.h:198
llvm::CallGraphWrapperPass::CallGraphWrapperPass
CallGraphWrapperPass()
Definition: CallGraph.cpp:325
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:246
llvm::CallGraph::CallGraph
CallGraph(Module &M)
Definition: CallGraph.cpp:33
std
Definition: BitVector.h:838
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:161
Function.h
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1492
llvm::isDbgInfoIntrinsic
static bool isDbgInfoIntrinsic(Intrinsic::ID ID)
Check if ID corresponds to a debug info intrinsic.
Definition: IntrinsicInst.h:121
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:189
SmallVector.h
N
#define N
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1161
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:313
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
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:360
AbstractCallSite.h
graph
print Print a call graph
Definition: CallGraph.cpp:391
raw_ostream.h
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:624
InitializePasses.h
Debug.h
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37
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:262