LLVM 20.0.0git
CallGraph.h
Go to the documentation of this file.
1//===- CallGraph.h - Build a Module's call graph ----------------*- C++ -*-===//
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/// \file
9///
10/// This file provides interfaces used to build and manipulate a call graph,
11/// which is a very useful tool for interprocedural optimization.
12///
13/// Every function in a module is represented as a node in the call graph. The
14/// callgraph node keeps track of which functions are called by the function
15/// corresponding to the node.
16///
17/// A call graph may contain nodes where the function that they correspond to
18/// is null. These 'external' nodes are used to represent control flow that is
19/// not represented (or analyzable) in the module. In particular, this
20/// analysis builds one external node such that:
21/// 1. All functions in the module without internal linkage will have edges
22/// from this external node, indicating that they could be called by
23/// functions outside of the module.
24/// 2. All functions whose address is used for something more than a direct
25/// call, for example being stored into a memory location will also have
26/// an edge from this external node. Since they may be called by an
27/// unknown caller later, they must be tracked as such.
28///
29/// There is a second external node added for calls that leave this module.
30/// Functions have a call edge to the external node iff:
31/// 1. The function is external, reflecting the fact that they could call
32/// anything without internal linkage or that has its address taken.
33/// 2. The function contains an indirect function call.
34///
35/// As an extension in the future, there may be multiple nodes with a null
36/// function. These will be used when we can prove (through pointer analysis)
37/// that an indirect call site can call only a specific set of functions.
38///
39/// Because of these properties, the CallGraph captures a conservative superset
40/// of all of the caller-callee relationships, which is useful for
41/// transformations.
42///
43//===----------------------------------------------------------------------===//
44
45#ifndef LLVM_ANALYSIS_CALLGRAPH_H
46#define LLVM_ANALYSIS_CALLGRAPH_H
47
48#include "llvm/IR/InstrTypes.h"
49#include "llvm/IR/PassManager.h"
50#include "llvm/IR/ValueHandle.h"
51#include "llvm/Pass.h"
52#include <cassert>
53#include <map>
54#include <memory>
55#include <utility>
56#include <vector>
57
58namespace llvm {
59
60template <class GraphType> struct GraphTraits;
61class CallGraphNode;
62class Function;
63class Module;
64class raw_ostream;
65
66/// The basic data container for the call graph of a \c Module of IR.
67///
68/// This class exposes both the interface to the call graph for a module of IR.
69///
70/// The core call graph itself can also be updated to reflect changes to the IR.
71class CallGraph {
72 Module &M;
73
74 using FunctionMapTy =
75 std::map<const Function *, std::unique_ptr<CallGraphNode>>;
76
77 /// A map from \c Function* to \c CallGraphNode*.
78 FunctionMapTy FunctionMap;
79
80 /// This node has edges to all external functions and those internal
81 /// functions that have their address taken.
82 CallGraphNode *ExternalCallingNode;
83
84 /// This node has edges to it from all functions making indirect calls
85 /// or calling an external function.
86 std::unique_ptr<CallGraphNode> CallsExternalNode;
87
88public:
89 explicit CallGraph(Module &M);
90 CallGraph(CallGraph &&Arg);
91 ~CallGraph();
92
93 void print(raw_ostream &OS) const;
94 void dump() const;
95
96 using iterator = FunctionMapTy::iterator;
97 using const_iterator = FunctionMapTy::const_iterator;
98
99 /// Returns the module the call graph corresponds to.
100 Module &getModule() const { return M; }
101
102 bool invalidate(Module &, const PreservedAnalyses &PA,
104
105 inline iterator begin() { return FunctionMap.begin(); }
106 inline iterator end() { return FunctionMap.end(); }
107 inline const_iterator begin() const { return FunctionMap.begin(); }
108 inline const_iterator end() const { return FunctionMap.end(); }
109
110 /// Returns the call graph node for the provided function.
111 inline const CallGraphNode *operator[](const Function *F) const {
112 const_iterator I = FunctionMap.find(F);
113 assert(I != FunctionMap.end() && "Function not in callgraph!");
114 return I->second.get();
115 }
116
117 /// Returns the call graph node for the provided function.
119 const_iterator I = FunctionMap.find(F);
120 assert(I != FunctionMap.end() && "Function not in callgraph!");
121 return I->second.get();
122 }
123
124 /// Returns the \c CallGraphNode which is used to represent
125 /// undetermined calls into the callgraph.
126 CallGraphNode *getExternalCallingNode() const { return ExternalCallingNode; }
127
129 return CallsExternalNode.get();
130 }
131
132 /// Old node has been deleted, and New is to be used in its place, update the
133 /// ExternalCallingNode.
135
136 //===---------------------------------------------------------------------
137 // Functions to keep a call graph up to date with a function that has been
138 // modified.
139 //
140
141 /// Unlink the function from this module, returning it.
142 ///
143 /// Because this removes the function from the module, the call graph node is
144 /// destroyed. This is only valid if the function does not call any other
145 /// functions (ie, there are no edges in it's CGN). The easiest way to do
146 /// this is to dropAllReferences before calling this.
148
149 /// Similar to operator[], but this will insert a new CallGraphNode for
150 /// \c F if one does not already exist.
152
153 /// Populate \p CGN based on the calls inside the associated function.
155
156 /// Add a function to the call graph, and link the node to all of the
157 /// functions that it calls.
159};
160
161/// A node in the call graph for a module.
162///
163/// Typically represents a function in the call graph. There are also special
164/// "null" nodes used to represent theoretical entries in the call graph.
166public:
167 /// A pair of the calling instruction (a call or invoke)
168 /// and the call graph node being called.
169 /// Call graph node may have two types of call records which represent an edge
170 /// in the call graph - reference or a call edge. Reference edges are not
171 /// associated with any call instruction and are created with the first field
172 /// set to `None`, while real call edges have instruction address in this
173 /// field. Therefore, all real call edges are expected to have a value in the
174 /// first field and it is not supposed to be `nullptr`.
175 /// Reference edges, for example, are used for connecting broker function
176 /// caller to the callback function for callback call sites.
177 using CallRecord = std::pair<std::optional<WeakTrackingVH>, CallGraphNode *>;
178
179public:
180 using CalledFunctionsVector = std::vector<CallRecord>;
181
182 /// Creates a node for the specified function.
183 inline CallGraphNode(CallGraph *CG, Function *F) : CG(CG), F(F) {}
184
185 CallGraphNode(const CallGraphNode &) = delete;
187
189 assert(NumReferences == 0 && "Node deleted while references remain");
190 }
191
192 using iterator = std::vector<CallRecord>::iterator;
193 using const_iterator = std::vector<CallRecord>::const_iterator;
194
195 /// Returns the function that this call graph node represents.
196 Function *getFunction() const { return F; }
197
198 inline iterator begin() { return CalledFunctions.begin(); }
199 inline iterator end() { return CalledFunctions.end(); }
200 inline const_iterator begin() const { return CalledFunctions.begin(); }
201 inline const_iterator end() const { return CalledFunctions.end(); }
202 inline bool empty() const { return CalledFunctions.empty(); }
203 inline unsigned size() const { return (unsigned)CalledFunctions.size(); }
204
205 /// Returns the number of other CallGraphNodes in this CallGraph that
206 /// reference this node in their callee list.
207 unsigned getNumReferences() const { return NumReferences; }
208
209 /// Returns the i'th called function.
210 CallGraphNode *operator[](unsigned i) const {
211 assert(i < CalledFunctions.size() && "Invalid index");
212 return CalledFunctions[i].second;
213 }
214
215 /// Print out this call graph node.
216 void dump() const;
217 void print(raw_ostream &OS) const;
218
219 //===---------------------------------------------------------------------
220 // Methods to keep a call graph up to date with a function that has been
221 // modified
222 //
223
224 /// Removes all edges from this CallGraphNode to any functions it
225 /// calls.
227 while (!CalledFunctions.empty()) {
228 CalledFunctions.back().second->DropRef();
229 CalledFunctions.pop_back();
230 }
231 }
232
233 /// Moves all the callee information from N to this node.
235 assert(CalledFunctions.empty() &&
236 "Cannot steal callsite information if I already have some");
237 std::swap(CalledFunctions, N->CalledFunctions);
238 }
239
240 /// Adds a function to the list of functions called by this one.
242 CalledFunctions.emplace_back(Call ? std::optional<WeakTrackingVH>(Call)
243 : std::optional<WeakTrackingVH>(),
244 M);
245 M->AddRef();
246 }
247
249 I->second->DropRef();
250 *I = CalledFunctions.back();
251 CalledFunctions.pop_back();
252 }
253
254 /// Removes the edge in the node for the specified call site.
255 ///
256 /// Note that this method takes linear time, so it should be used sparingly.
257 void removeCallEdgeFor(CallBase &Call);
258
259 /// Removes all call edges from this node to the specified callee
260 /// function.
261 ///
262 /// This takes more time to execute than removeCallEdgeTo, so it should not
263 /// be used unless necessary.
265
266 /// Removes one edge associated with a null callsite from this node to
267 /// the specified callee function.
269
270 /// Replaces the edge in the node for the specified call site with a
271 /// new one.
272 ///
273 /// Note that this method takes linear time, so it should be used sparingly.
274 void replaceCallEdge(CallBase &Call, CallBase &NewCall,
275 CallGraphNode *NewNode);
276
277private:
278 friend class CallGraph;
279
280 CallGraph *CG;
281 Function *F;
282
283 std::vector<CallRecord> CalledFunctions;
284
285 /// The number of times that this CallGraphNode occurs in the
286 /// CalledFunctions array of this or other CallGraphNodes.
287 unsigned NumReferences = 0;
288
289 void DropRef() { --NumReferences; }
290 void AddRef() { ++NumReferences; }
291
292 /// A special function that should only be used by the CallGraph class.
293 void allReferencesDropped() { NumReferences = 0; }
294};
295
296/// An analysis pass to compute the \c CallGraph for a \c Module.
297///
298/// This class implements the concept of an analysis pass used by the \c
299/// ModuleAnalysisManager to run an analysis over a module and cache the
300/// resulting data.
301class CallGraphAnalysis : public AnalysisInfoMixin<CallGraphAnalysis> {
303
304 static AnalysisKey Key;
305
306public:
307 /// A formulaic type to inform clients of the result type.
309
310 /// Compute the \c CallGraph for the module \c M.
311 ///
312 /// The real work here is done in the \c CallGraph constructor.
314};
315
316/// Printer pass for the \c CallGraphAnalysis results.
317class CallGraphPrinterPass : public PassInfoMixin<CallGraphPrinterPass> {
318 raw_ostream &OS;
319
320public:
322
324
325 static bool isRequired() { return true; }
326};
327
328/// Printer pass for the summarized \c CallGraphAnalysis results.
330 : public PassInfoMixin<CallGraphSCCsPrinterPass> {
331 raw_ostream &OS;
332
333public:
335
337
338 static bool isRequired() { return true; }
339};
340
341/// The \c ModulePass which wraps up a \c CallGraph and the logic to
342/// build it.
343///
344/// This class exposes both the interface to the call graph container and the
345/// module pass which runs over a module of IR and produces the call graph. The
346/// call graph interface is entirelly a wrapper around a \c CallGraph object
347/// which is stored internally for each module.
349 std::unique_ptr<CallGraph> G;
350
351public:
352 static char ID; // Class identification, replacement for typeinfo
353
356
357 /// The internal \c CallGraph around which the rest of this interface
358 /// is wrapped.
359 const CallGraph &getCallGraph() const { return *G; }
360 CallGraph &getCallGraph() { return *G; }
361
364
365 /// Returns the module the call graph corresponds to.
366 Module &getModule() const { return G->getModule(); }
367
368 inline iterator begin() { return G->begin(); }
369 inline iterator end() { return G->end(); }
370 inline const_iterator begin() const { return G->begin(); }
371 inline const_iterator end() const { return G->end(); }
372
373 /// Returns the call graph node for the provided function.
374 inline const CallGraphNode *operator[](const Function *F) const {
375 return (*G)[F];
376 }
377
378 /// Returns the call graph node for the provided function.
379 inline CallGraphNode *operator[](const Function *F) { return (*G)[F]; }
380
381 /// Returns the \c CallGraphNode which is used to represent
382 /// undetermined calls into the callgraph.
384 return G->getExternalCallingNode();
385 }
386
388 return G->getCallsExternalNode();
389 }
390
391 //===---------------------------------------------------------------------
392 // Functions to keep a call graph up to date with a function that has been
393 // modified.
394 //
395
396 /// Unlink the function from this module, returning it.
397 ///
398 /// Because this removes the function from the module, the call graph node is
399 /// destroyed. This is only valid if the function does not call any other
400 /// functions (ie, there are no edges in it's CGN). The easiest way to do
401 /// this is to dropAllReferences before calling this.
403 return G->removeFunctionFromModule(CGN);
404 }
405
406 /// Similar to operator[], but this will insert a new CallGraphNode for
407 /// \c F if one does not already exist.
409 return G->getOrInsertFunction(F);
410 }
411
412 //===---------------------------------------------------------------------
413 // Implementation of the ModulePass interface needed here.
414 //
415
416 void getAnalysisUsage(AnalysisUsage &AU) const override;
417 bool runOnModule(Module &M) override;
418 void releaseMemory() override;
419
420 void print(raw_ostream &o, const Module *) const override;
421 void dump() const;
422};
423
424//===----------------------------------------------------------------------===//
425// GraphTraits specializations for call graphs so that they can be treated as
426// graphs by the generic graph algorithms.
427//
428
429// Provide graph traits for traversing call graphs using standard graph
430// traversals.
431template <> struct GraphTraits<CallGraphNode *> {
434
435 static NodeRef getEntryNode(CallGraphNode *CGN) { return CGN; }
436 static CallGraphNode *CGNGetValue(CGNPairTy P) { return P.second; }
437
439 mapped_iterator<CallGraphNode::iterator, decltype(&CGNGetValue)>;
440
442 return ChildIteratorType(N->begin(), &CGNGetValue);
443 }
444
446 return ChildIteratorType(N->end(), &CGNGetValue);
447 }
448};
449
450template <> struct GraphTraits<const CallGraphNode *> {
451 using NodeRef = const CallGraphNode *;
454
455 static NodeRef getEntryNode(const CallGraphNode *CGN) { return CGN; }
456 static const CallGraphNode *CGNGetValue(CGNPairTy P) { return P.second; }
457
459 mapped_iterator<CallGraphNode::const_iterator, decltype(&CGNGetValue)>;
461
463 return ChildIteratorType(N->begin(), &CGNGetValue);
464 }
465
467 return ChildIteratorType(N->end(), &CGNGetValue);
468 }
469
471 return N->begin();
472 }
473 static ChildEdgeIteratorType child_edge_end(NodeRef N) { return N->end(); }
474
475 static NodeRef edge_dest(EdgeRef E) { return E.second; }
476};
477
478template <>
480 using PairTy =
481 std::pair<const Function *const, std::unique_ptr<CallGraphNode>>;
482
484 return CGN->getExternalCallingNode(); // Start at the external node!
485 }
486
488 return P.second.get();
489 }
490
491 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
493 mapped_iterator<CallGraph::iterator, decltype(&CGGetValuePtr)>;
494
496 return nodes_iterator(CG->begin(), &CGGetValuePtr);
497 }
498
500 return nodes_iterator(CG->end(), &CGGetValuePtr);
501 }
502};
503
504template <>
506 const CallGraphNode *> {
507 using PairTy =
508 std::pair<const Function *const, std::unique_ptr<CallGraphNode>>;
509
510 static NodeRef getEntryNode(const CallGraph *CGN) {
511 return CGN->getExternalCallingNode(); // Start at the external node!
512 }
513
514 static const CallGraphNode *CGGetValuePtr(const PairTy &P) {
515 return P.second.get();
516 }
517
518 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
520 mapped_iterator<CallGraph::const_iterator, decltype(&CGGetValuePtr)>;
521
523 return nodes_iterator(CG->begin(), &CGGetValuePtr);
524 }
525
527 return nodes_iterator(CG->end(), &CGGetValuePtr);
528 }
529};
530
531} // end namespace llvm
532
533#endif // LLVM_ANALYSIS_CALLGRAPH_H
aarch64 promote const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
#define G(x, y, z)
Definition: MD5.cpp:56
Machine Check Debug Module
#define P(N)
This header defines various interfaces for pass management in LLVM.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:292
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
Represent the analysis usage information of a pass.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1236
An analysis pass to compute the CallGraph for a Module.
Definition: CallGraph.h:301
CallGraph run(Module &M, ModuleAnalysisManager &)
Compute the CallGraph for the module M.
Definition: CallGraph.h:313
A node in the call graph for a module.
Definition: CallGraph.h:165
void removeCallEdgeFor(CallBase &Call)
Removes the edge in the node for the specified call site.
Definition: CallGraph.cpp:209
void print(raw_ostream &OS) const
Definition: CallGraph.cpp:184
std::vector< CallRecord >::const_iterator const_iterator
Definition: CallGraph.h:193
std::vector< CallRecord > CalledFunctionsVector
Definition: CallGraph.h:180
bool empty() const
Definition: CallGraph.h:202
iterator begin()
Definition: CallGraph.h:198
CallGraphNode(const CallGraphNode &)=delete
void addCalledFunction(CallBase *Call, CallGraphNode *M)
Adds a function to the list of functions called by this one.
Definition: CallGraph.h:241
CallGraphNode(CallGraph *CG, Function *F)
Creates a node for the specified function.
Definition: CallGraph.h:183
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:257
const_iterator end() const
Definition: CallGraph.h:201
CallGraphNode * operator[](unsigned i) const
Returns the i'th called function.
Definition: CallGraph.h:210
void dump() const
Print out this call graph node.
Definition: CallGraph.cpp:203
iterator end()
Definition: CallGraph.h:199
void stealCalledFunctionsFrom(CallGraphNode *N)
Moves all the callee information from N to this node.
Definition: CallGraph.h:234
Function * getFunction() const
Returns the function that this call graph node represents.
Definition: CallGraph.h:196
const_iterator begin() const
Definition: CallGraph.h:200
void removeOneAbstractEdgeTo(CallGraphNode *Callee)
Removes one edge associated with a null callsite from this node to the specified callee function.
Definition: CallGraph.cpp:241
void removeAllCalledFunctions()
Removes all edges from this CallGraphNode to any functions it calls.
Definition: CallGraph.h:226
std::vector< CallRecord >::iterator iterator
Definition: CallGraph.h:192
unsigned getNumReferences() const
Returns the number of other CallGraphNodes in this CallGraph that reference this node in their callee...
Definition: CallGraph.h:207
unsigned size() const
Definition: CallGraph.h:203
void removeAnyCallEdgeTo(CallGraphNode *Callee)
Removes all call edges from this node to the specified callee function.
Definition: CallGraph.cpp:229
CallGraphNode & operator=(const CallGraphNode &)=delete
void removeCallEdge(iterator I)
Definition: CallGraph.h:248
std::pair< std::optional< WeakTrackingVH >, CallGraphNode * > CallRecord
A pair of the calling instruction (a call or invoke) and the call graph node being called.
Definition: CallGraph.h:177
Printer pass for the CallGraphAnalysis results.
Definition: CallGraph.h:317
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: CallGraph.cpp:306
static bool isRequired()
Definition: CallGraph.h:325
CallGraphPrinterPass(raw_ostream &OS)
Definition: CallGraph.h:321
Printer pass for the summarized CallGraphAnalysis results.
Definition: CallGraph.h:330
CallGraphSCCsPrinterPass(raw_ostream &OS)
Definition: CallGraph.h:334
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: CallGraph.cpp:312
The ModulePass which wraps up a CallGraph and the logic to build it.
Definition: CallGraph.h:348
CallGraph::const_iterator const_iterator
Definition: CallGraph.h:363
const CallGraph & getCallGraph() const
The internal CallGraph around which the rest of this interface is wrapped.
Definition: CallGraph.h:359
const_iterator begin() const
Definition: CallGraph.h:370
CallGraphNode * getCallsExternalNode() const
Definition: CallGraph.h:387
const_iterator end() const
Definition: CallGraph.h:371
const CallGraphNode * operator[](const Function *F) const
Returns the call graph node for the provided function.
Definition: CallGraph.h:374
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition: CallGraph.cpp:356
CallGraphNode * operator[](const Function *F)
Returns the call graph node for the provided function.
Definition: CallGraph.h:379
CallGraph::iterator iterator
Definition: CallGraph.h:362
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: CallGraph.cpp:352
void print(raw_ostream &o, const Module *) const override
print - Print out the internal state of the pass.
Definition: CallGraph.cpp:369
Module & getModule() const
Returns the module the call graph corresponds to.
Definition: CallGraph.h:366
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.h:408
CallGraphNode * getExternalCallingNode() const
Returns the CallGraphNode which is used to represent undetermined calls into the callgraph.
Definition: CallGraph.h:383
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Function * removeFunctionFromModule(CallGraphNode *CGN)
Unlink the function from this module, returning it.
Definition: CallGraph.h:402
CallGraph & getCallGraph()
Definition: CallGraph.h:360
The basic data container for the call graph of a Module of IR.
Definition: CallGraph.h:71
Function * removeFunctionFromModule(CallGraphNode *CGN)
Unlink the function from this module, returning it.
Definition: CallGraph.cpp:157
void print(raw_ostream &OS) const
Definition: CallGraph.cpp:115
const CallGraphNode * operator[](const Function *F) const
Returns the call graph node for the provided function.
Definition: CallGraph.h:111
void dump() const
Definition: CallGraph.cpp:138
void populateCallGraphNode(CallGraphNode *CGN)
Populate CGN based on the calls inside the associated function.
Definition: CallGraph.cpp:89
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
const_iterator begin() const
Definition: CallGraph.h:107
iterator end()
Definition: CallGraph.h:106
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:170
iterator begin()
Definition: CallGraph.h:105
bool invalidate(Module &, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &)
Definition: CallGraph.cpp:67
FunctionMapTy::const_iterator const_iterator
Definition: CallGraph.h:97
CallGraphNode * getCallsExternalNode() const
Definition: CallGraph.h:128
Module & getModule() const
Returns the module the call graph corresponds to.
Definition: CallGraph.h:100
FunctionMapTy::iterator iterator
Definition: CallGraph.h:96
CallGraphNode * getExternalCallingNode() const
Returns the CallGraphNode which is used to represent undetermined calls into the callgraph.
Definition: CallGraph.h:126
CallGraphNode * operator[](const Function *F)
Returns the call graph node for the provided function.
Definition: CallGraph.h:118
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:141
const_iterator end() const
Definition: CallGraph.h:108
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:251
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:860
#define N
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:92
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:28
static NodeRef getEntryNode(CallGraphNode *CGN)
Definition: CallGraph.h:435
static ChildIteratorType child_end(NodeRef N)
Definition: CallGraph.h:445
static CallGraphNode * CGNGetValue(CGNPairTy P)
Definition: CallGraph.h:436
CallGraphNode::CallRecord CGNPairTy
Definition: CallGraph.h:433
static ChildIteratorType child_begin(NodeRef N)
Definition: CallGraph.h:441
std::pair< const Function *const, std::unique_ptr< CallGraphNode > > PairTy
Definition: CallGraph.h:481
static CallGraphNode * CGGetValuePtr(const PairTy &P)
Definition: CallGraph.h:487
static nodes_iterator nodes_begin(CallGraph *CG)
Definition: CallGraph.h:495
static nodes_iterator nodes_end(CallGraph *CG)
Definition: CallGraph.h:499
static NodeRef getEntryNode(CallGraph *CGN)
Definition: CallGraph.h:483
static ChildIteratorType child_begin(NodeRef N)
Definition: CallGraph.h:462
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
Definition: CallGraph.h:470
const CallGraphNode::CallRecord & EdgeRef
Definition: CallGraph.h:453
CallGraphNode::CallRecord CGNPairTy
Definition: CallGraph.h:452
static NodeRef edge_dest(EdgeRef E)
Definition: CallGraph.h:475
static ChildIteratorType child_end(NodeRef N)
Definition: CallGraph.h:466
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Definition: CallGraph.h:473
static NodeRef getEntryNode(const CallGraphNode *CGN)
Definition: CallGraph.h:455
CallGraphNode::const_iterator ChildEdgeIteratorType
Definition: CallGraph.h:460
static const CallGraphNode * CGNGetValue(CGNPairTy P)
Definition: CallGraph.h:456
static NodeRef getEntryNode(const CallGraph *CGN)
Definition: CallGraph.h:510
static nodes_iterator nodes_begin(const CallGraph *CG)
Definition: CallGraph.h:522
static const CallGraphNode * CGGetValuePtr(const PairTy &P)
Definition: CallGraph.h:514
static nodes_iterator nodes_end(const CallGraph *CG)
Definition: CallGraph.h:526
std::pair< const Function *const, std::unique_ptr< CallGraphNode > > PairTy
Definition: CallGraph.h:508
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69