LLVM  10.0.0svn
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/ADT/GraphTraits.h"
49 #include "llvm/ADT/STLExtras.h"
50 #include "llvm/IR/Function.h"
51 #include "llvm/IR/InstrTypes.h"
52 #include "llvm/IR/Intrinsics.h"
53 #include "llvm/IR/PassManager.h"
54 #include "llvm/IR/ValueHandle.h"
55 #include "llvm/Pass.h"
56 #include <cassert>
57 #include <map>
58 #include <memory>
59 #include <utility>
60 #include <vector>
61 
62 namespace llvm {
63 
64 class CallGraphNode;
65 class Module;
66 class raw_ostream;
67 
68 /// The basic data container for the call graph of a \c Module of IR.
69 ///
70 /// This class exposes both the interface to the call graph for a module of IR.
71 ///
72 /// The core call graph itself can also be updated to reflect changes to the IR.
73 class CallGraph {
74  Module &M;
75 
76  using FunctionMapTy =
77  std::map<const Function *, std::unique_ptr<CallGraphNode>>;
78 
79  /// A map from \c Function* to \c CallGraphNode*.
80  FunctionMapTy FunctionMap;
81 
82  /// This node has edges to all external functions and those internal
83  /// functions that have their address taken.
84  CallGraphNode *ExternalCallingNode;
85 
86  /// This node has edges to it from all functions making indirect calls
87  /// or calling an external function.
88  std::unique_ptr<CallGraphNode> CallsExternalNode;
89 
90  /// Replace the function represented by this node by another.
91  ///
92  /// This does not rescan the body of the function, so it is suitable when
93  /// splicing the body of one function to another while also updating all
94  /// callers from the old function to the new.
95  void spliceFunction(const Function *From, const Function *To);
96 
97  /// Add a function to the call graph, and link the node to all of the
98  /// functions that it calls.
99  void addToCallGraph(Function *F);
100 
101 public:
102  explicit CallGraph(Module &M);
104  ~CallGraph();
105 
106  void print(raw_ostream &OS) const;
107  void dump() const;
108 
109  using iterator = FunctionMapTy::iterator;
110  using const_iterator = FunctionMapTy::const_iterator;
111 
112  /// Returns the module the call graph corresponds to.
113  Module &getModule() const { return M; }
114 
115  inline iterator begin() { return FunctionMap.begin(); }
116  inline iterator end() { return FunctionMap.end(); }
117  inline const_iterator begin() const { return FunctionMap.begin(); }
118  inline const_iterator end() const { return FunctionMap.end(); }
119 
120  /// Returns the call graph node for the provided function.
121  inline const CallGraphNode *operator[](const Function *F) const {
122  const_iterator I = FunctionMap.find(F);
123  assert(I != FunctionMap.end() && "Function not in callgraph!");
124  return I->second.get();
125  }
126 
127  /// Returns the call graph node for the provided function.
128  inline CallGraphNode *operator[](const Function *F) {
129  const_iterator I = FunctionMap.find(F);
130  assert(I != FunctionMap.end() && "Function not in callgraph!");
131  return I->second.get();
132  }
133 
134  /// Returns the \c CallGraphNode which is used to represent
135  /// undetermined calls into the callgraph.
136  CallGraphNode *getExternalCallingNode() const { return ExternalCallingNode; }
137 
139  return CallsExternalNode.get();
140  }
141 
142  //===---------------------------------------------------------------------
143  // Functions to keep a call graph up to date with a function that has been
144  // modified.
145  //
146 
147  /// Unlink the function from this module, returning it.
148  ///
149  /// Because this removes the function from the module, the call graph node is
150  /// destroyed. This is only valid if the function does not call any other
151  /// functions (ie, there are no edges in it's CGN). The easiest way to do
152  /// this is to dropAllReferences before calling this.
154 
155  /// Similar to operator[], but this will insert a new CallGraphNode for
156  /// \c F if one does not already exist.
158 };
159 
160 /// A node in the call graph for a module.
161 ///
162 /// Typically represents a function in the call graph. There are also special
163 /// "null" nodes used to represent theoretical entries in the call graph.
165 public:
166  /// A pair of the calling instruction (a call or invoke)
167  /// and the call graph node being called.
168  using CallRecord = std::pair<WeakTrackingVH, CallGraphNode *>;
169 
170 public:
171  using CalledFunctionsVector = std::vector<CallRecord>;
172 
173  /// Creates a node for the specified function.
174  inline CallGraphNode(Function *F) : F(F) {}
175 
176  CallGraphNode(const CallGraphNode &) = delete;
177  CallGraphNode &operator=(const CallGraphNode &) = delete;
178 
180  assert(NumReferences == 0 && "Node deleted while references remain");
181  }
182 
183  using iterator = std::vector<CallRecord>::iterator;
184  using const_iterator = std::vector<CallRecord>::const_iterator;
185 
186  /// Returns the function that this call graph node represents.
187  Function *getFunction() const { return F; }
188 
189  inline iterator begin() { return CalledFunctions.begin(); }
190  inline iterator end() { return CalledFunctions.end(); }
191  inline const_iterator begin() const { return CalledFunctions.begin(); }
192  inline const_iterator end() const { return CalledFunctions.end(); }
193  inline bool empty() const { return CalledFunctions.empty(); }
194  inline unsigned size() const { return (unsigned)CalledFunctions.size(); }
195 
196  /// Returns the number of other CallGraphNodes in this CallGraph that
197  /// reference this node in their callee list.
198  unsigned getNumReferences() const { return NumReferences; }
199 
200  /// Returns the i'th called function.
201  CallGraphNode *operator[](unsigned i) const {
202  assert(i < CalledFunctions.size() && "Invalid index");
203  return CalledFunctions[i].second;
204  }
205 
206  /// Print out this call graph node.
207  void dump() const;
208  void print(raw_ostream &OS) const;
209 
210  //===---------------------------------------------------------------------
211  // Methods to keep a call graph up to date with a function that has been
212  // modified
213  //
214 
215  /// Removes all edges from this CallGraphNode to any functions it
216  /// calls.
218  while (!CalledFunctions.empty()) {
219  CalledFunctions.back().second->DropRef();
220  CalledFunctions.pop_back();
221  }
222  }
223 
224  /// Moves all the callee information from N to this node.
226  assert(CalledFunctions.empty() &&
227  "Cannot steal callsite information if I already have some");
228  std::swap(CalledFunctions, N->CalledFunctions);
229  }
230 
231  /// Adds a function to the list of functions called by this one.
233  assert(!Call || !Call->getCalledFunction() ||
234  !Call->getCalledFunction()->isIntrinsic() ||
236  CalledFunctions.emplace_back(Call, M);
237  M->AddRef();
238  }
239 
241  I->second->DropRef();
242  *I = CalledFunctions.back();
243  CalledFunctions.pop_back();
244  }
245 
246  /// Removes the edge in the node for the specified call site.
247  ///
248  /// Note that this method takes linear time, so it should be used sparingly.
249  void removeCallEdgeFor(CallBase &Call);
250 
251  /// Removes all call edges from this node to the specified callee
252  /// function.
253  ///
254  /// This takes more time to execute than removeCallEdgeTo, so it should not
255  /// be used unless necessary.
256  void removeAnyCallEdgeTo(CallGraphNode *Callee);
257 
258  /// Removes one edge associated with a null callsite from this node to
259  /// the specified callee function.
260  void removeOneAbstractEdgeTo(CallGraphNode *Callee);
261 
262  /// Replaces the edge in the node for the specified call site with a
263  /// new one.
264  ///
265  /// Note that this method takes linear time, so it should be used sparingly.
266  void replaceCallEdge(CallBase &Call, CallBase &NewCall,
267  CallGraphNode *NewNode);
268 
269 private:
270  friend class CallGraph;
271 
272  Function *F;
273 
274  std::vector<CallRecord> CalledFunctions;
275 
276  /// The number of times that this CallGraphNode occurs in the
277  /// CalledFunctions array of this or other CallGraphNodes.
278  unsigned NumReferences = 0;
279 
280  void DropRef() { --NumReferences; }
281  void AddRef() { ++NumReferences; }
282 
283  /// A special function that should only be used by the CallGraph class.
284  void allReferencesDropped() { NumReferences = 0; }
285 };
286 
287 /// An analysis pass to compute the \c CallGraph for a \c Module.
288 ///
289 /// This class implements the concept of an analysis pass used by the \c
290 /// ModuleAnalysisManager to run an analysis over a module and cache the
291 /// resulting data.
292 class CallGraphAnalysis : public AnalysisInfoMixin<CallGraphAnalysis> {
294 
295  static AnalysisKey Key;
296 
297 public:
298  /// A formulaic type to inform clients of the result type.
299  using Result = CallGraph;
300 
301  /// Compute the \c CallGraph for the module \c M.
302  ///
303  /// The real work here is done in the \c CallGraph constructor.
305 };
306 
307 /// Printer pass for the \c CallGraphAnalysis results.
308 class CallGraphPrinterPass : public PassInfoMixin<CallGraphPrinterPass> {
309  raw_ostream &OS;
310 
311 public:
312  explicit CallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
313 
315 };
316 
317 /// The \c ModulePass which wraps up a \c CallGraph and the logic to
318 /// build it.
319 ///
320 /// This class exposes both the interface to the call graph container and the
321 /// module pass which runs over a module of IR and produces the call graph. The
322 /// call graph interface is entirelly a wrapper around a \c CallGraph object
323 /// which is stored internally for each module.
325  std::unique_ptr<CallGraph> G;
326 
327 public:
328  static char ID; // Class identification, replacement for typeinfo
329 
331  ~CallGraphWrapperPass() override;
332 
333  /// The internal \c CallGraph around which the rest of this interface
334  /// is wrapped.
335  const CallGraph &getCallGraph() const { return *G; }
336  CallGraph &getCallGraph() { return *G; }
337 
340 
341  /// Returns the module the call graph corresponds to.
342  Module &getModule() const { return G->getModule(); }
343 
344  inline iterator begin() { return G->begin(); }
345  inline iterator end() { return G->end(); }
346  inline const_iterator begin() const { return G->begin(); }
347  inline const_iterator end() const { return G->end(); }
348 
349  /// Returns the call graph node for the provided function.
350  inline const CallGraphNode *operator[](const Function *F) const {
351  return (*G)[F];
352  }
353 
354  /// Returns the call graph node for the provided function.
355  inline CallGraphNode *operator[](const Function *F) { return (*G)[F]; }
356 
357  /// Returns the \c CallGraphNode which is used to represent
358  /// undetermined calls into the callgraph.
360  return G->getExternalCallingNode();
361  }
362 
364  return G->getCallsExternalNode();
365  }
366 
367  //===---------------------------------------------------------------------
368  // Functions to keep a call graph up to date with a function that has been
369  // modified.
370  //
371 
372  /// Unlink the function from this module, returning it.
373  ///
374  /// Because this removes the function from the module, the call graph node is
375  /// destroyed. This is only valid if the function does not call any other
376  /// functions (ie, there are no edges in it's CGN). The easiest way to do
377  /// this is to dropAllReferences before calling this.
379  return G->removeFunctionFromModule(CGN);
380  }
381 
382  /// Similar to operator[], but this will insert a new CallGraphNode for
383  /// \c F if one does not already exist.
385  return G->getOrInsertFunction(F);
386  }
387 
388  //===---------------------------------------------------------------------
389  // Implementation of the ModulePass interface needed here.
390  //
391 
392  void getAnalysisUsage(AnalysisUsage &AU) const override;
393  bool runOnModule(Module &M) override;
394  void releaseMemory() override;
395 
396  void print(raw_ostream &o, const Module *) const override;
397  void dump() const;
398 };
399 
400 //===----------------------------------------------------------------------===//
401 // GraphTraits specializations for call graphs so that they can be treated as
402 // graphs by the generic graph algorithms.
403 //
404 
405 // Provide graph traits for tranversing call graphs using standard graph
406 // traversals.
407 template <> struct GraphTraits<CallGraphNode *> {
410 
411  static NodeRef getEntryNode(CallGraphNode *CGN) { return CGN; }
412  static CallGraphNode *CGNGetValue(CGNPairTy P) { return P.second; }
413 
414  using ChildIteratorType =
416 
418  return ChildIteratorType(N->begin(), &CGNGetValue);
419  }
420 
422  return ChildIteratorType(N->end(), &CGNGetValue);
423  }
424 };
425 
426 template <> struct GraphTraits<const CallGraphNode *> {
427  using NodeRef = const CallGraphNode *;
430 
431  static NodeRef getEntryNode(const CallGraphNode *CGN) { return CGN; }
432  static const CallGraphNode *CGNGetValue(CGNPairTy P) { return P.second; }
433 
434  using ChildIteratorType =
437 
439  return ChildIteratorType(N->begin(), &CGNGetValue);
440  }
441 
443  return ChildIteratorType(N->end(), &CGNGetValue);
444  }
445 
447  return N->begin();
448  }
450 
451  static NodeRef edge_dest(EdgeRef E) { return E.second; }
452 };
453 
454 template <>
456  using PairTy =
457  std::pair<const Function *const, std::unique_ptr<CallGraphNode>>;
458 
460  return CGN->getExternalCallingNode(); // Start at the external node!
461  }
462 
464  return P.second.get();
465  }
466 
467  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
468  using nodes_iterator =
470 
472  return nodes_iterator(CG->begin(), &CGGetValuePtr);
473  }
474 
476  return nodes_iterator(CG->end(), &CGGetValuePtr);
477  }
478 };
479 
480 template <>
482  const CallGraphNode *> {
483  using PairTy =
484  std::pair<const Function *const, std::unique_ptr<CallGraphNode>>;
485 
486  static NodeRef getEntryNode(const CallGraph *CGN) {
487  return CGN->getExternalCallingNode(); // Start at the external node!
488  }
489 
490  static const CallGraphNode *CGGetValuePtr(const PairTy &P) {
491  return P.second.get();
492  }
493 
494  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
495  using nodes_iterator =
497 
499  return nodes_iterator(CG->begin(), &CGGetValuePtr);
500  }
501 
502  static nodes_iterator nodes_end(const CallGraph *CG) {
503  return nodes_iterator(CG->end(), &CGGetValuePtr);
504  }
505 };
506 
507 } // end namespace llvm
508 
509 #endif // LLVM_ANALYSIS_CALLGRAPH_H
static const CallGraphNode * CGNGetValue(CGNPairTy P)
Definition: CallGraph.h:432
bool isIntrinsic() const
isIntrinsic - Returns true if the function&#39;s name starts with "llvm.".
Definition: Function.h:198
static CallGraphNode * CGNGetValue(CGNPairTy P)
Definition: CallGraph.h:412
This class represents lattice values for constants.
Definition: AllocatorList.h:23
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
FunctionMapTy::iterator iterator
Definition: CallGraph.h:109
const CallGraphNode::CallRecord & EdgeRef
Definition: CallGraph.h:429
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1100
F(f)
A node in the call graph for a module.
Definition: CallGraph.h:164
Module & getModule() const
Returns the module the call graph corresponds to.
Definition: CallGraph.h:113
unsigned getNumReferences() const
Returns the number of other CallGraphNodes in this CallGraph that reference this node in their callee...
Definition: CallGraph.h:198
unsigned size() const
Definition: CallGraph.h:194
static ChildIteratorType child_end(NodeRef N)
Definition: CallGraph.h:421
static nodes_iterator nodes_end(const CallGraph *CG)
Definition: CallGraph.h:502
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:384
iterator end()
Definition: CallGraph.h:190
CallGraph::const_iterator const_iterator
Definition: CallGraph.h:339
Function * removeFunctionFromModule(CallGraphNode *CGN)
Unlink the function from this module, returning it.
Definition: CallGraph.cpp:120
CallGraphNode * getCallsExternalNode() const
Definition: CallGraph.h:363
CallGraphNode * operator[](const Function *F)
Returns the call graph node for the provided function.
Definition: CallGraph.h:128
static nodes_iterator nodes_begin(const CallGraph *CG)
Definition: CallGraph.h:498
static const CallGraphNode * CGGetValuePtr(const PairTy &P)
Definition: CallGraph.h:490
Module & getModule() const
Returns the module the call graph corresponds to.
Definition: CallGraph.h:342
CallGraphNode * operator[](unsigned i) const
Returns the i&#39;th called function.
Definition: CallGraph.h:201
std::vector< CallRecord > CalledFunctionsVector
Definition: CallGraph.h:171
static ChildIteratorType child_begin(NodeRef N)
Definition: CallGraph.h:438
Key
PAL metadata keys.
static NodeRef getEntryNode(CallGraph *CGN)
Definition: CallGraph.h:459
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:372
static NodeRef getEntryNode(CallGraphNode *CGN)
Definition: CallGraph.h:411
const CallGraphNode * operator[](const Function *F) const
Returns the call graph node for the provided function.
Definition: CallGraph.h:350
std::pair< const Function *const, std::unique_ptr< CallGraphNode > > PairTy
Definition: CallGraph.h:484
#define P(N)
typename CallGraphNode *::UnknownGraphTypeError NodeRef
Definition: GraphTraits.h:78
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:153
The ModulePass which wraps up a CallGraph and the logic to build it.
Definition: CallGraph.h:324
bool isLeaf(ID id)
Returns true if the intrinsic is a leaf, i.e.
Definition: Function.cpp:1026
CallGraphNode * getCallsExternalNode() const
Definition: CallGraph.h:138
CallGraphNode * operator[](const Function *F)
Returns the call graph node for the provided function.
Definition: CallGraph.h:355
static nodes_iterator nodes_end(CallGraph *CG)
Definition: CallGraph.h:475
static nodes_iterator nodes_begin(CallGraph *CG)
Definition: CallGraph.h:471
FunctionMapTy::const_iterator const_iterator
Definition: CallGraph.h:110
void stealCalledFunctionsFrom(CallGraphNode *N)
Moves all the callee information from N to this node.
Definition: CallGraph.h:225
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const_iterator begin() const
Definition: CallGraph.h:346
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:389
const_iterator begin() const
Definition: CallGraph.h:117
Represent the analysis usage information of a pass.
CallGraph(Module &M)
Definition: CallGraph.cpp:30
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
CallGraph run(Module &M, ModuleAnalysisManager &)
Compute the CallGraph for the module M.
Definition: CallGraph.h:304
static ChildIteratorType child_begin(NodeRef N)
Definition: CallGraph.h:417
std::pair< const Function *const, std::unique_ptr< CallGraphNode > > PairTy
Definition: CallGraph.h:457
static ChildIteratorType child_end(NodeRef N)
Definition: CallGraph.h:442
const CallGraph & getCallGraph() const
The internal CallGraph around which the rest of this interface is wrapped.
Definition: CallGraph.h:335
static NodeRef getEntryNode(const CallGraph *CGN)
Definition: CallGraph.h:486
Function * getFunction() const
Returns the function that this call graph node represents.
Definition: CallGraph.h:187
BlockVerifier::State From
CallGraphNode(Function *F)
Creates a node for the specified function.
Definition: CallGraph.h:174
CallGraphNode::const_iterator ChildEdgeIteratorType
Definition: CallGraph.h:436
static NodeRef getEntryNode(const CallGraphNode *CGN)
Definition: CallGraph.h:431
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
bool empty() const
Definition: CallGraph.h:193
const_iterator begin() const
Definition: CallGraph.h:191
Function * removeFunctionFromModule(CallGraphNode *CGN)
Unlink the function from this module, returning it.
Definition: CallGraph.h:378
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
Definition: Function.h:193
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Definition: CallGraph.h:449
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:940
CallGraph::iterator iterator
Definition: CallGraph.h:338
amdgpu Simplify well known AMD library false FunctionCallee Callee
void removeCallEdge(iterator I)
Definition: CallGraph.h:240
An analysis pass to compute the CallGraph for a Module.
Definition: CallGraph.h:292
static NodeRef edge_dest(EdgeRef E)
Definition: CallGraph.h:451
The basic data container for the call graph of a Module of IR.
Definition: CallGraph.h:73
void removeAllCalledFunctions()
Removes all edges from this CallGraphNode to any functions it calls.
Definition: CallGraph.h:217
const_iterator end() const
Definition: CallGraph.h:347
CallGraph & getCallGraph()
Definition: CallGraph.h:336
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
Definition: InstrTypes.h:1287
std::pair< WeakTrackingVH, CallGraphNode * > CallRecord
A pair of the calling instruction (a call or invoke) and the call graph node being called...
Definition: CallGraph.h:168
#define I(x, y, z)
Definition: MD5.cpp:58
#define N
Printer pass for the CallGraphAnalysis results.
Definition: CallGraph.h:308
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:224
CallGraphNode * getExternalCallingNode() const
Returns the CallGraphNode which is used to represent undetermined calls into the callgraph.
Definition: CallGraph.h:359
CallGraphNode::CallRecord CGNPairTy
Definition: CallGraph.h:409
const_iterator end() const
Definition: CallGraph.h:118
std::vector< CallRecord >::iterator iterator
Definition: CallGraph.h:183
std::vector< CallRecord >::const_iterator const_iterator
Definition: CallGraph.h:184
iterator end()
Definition: CallGraph.h:116
CallGraphNode * getExternalCallingNode() const
Returns the CallGraphNode which is used to represent undetermined calls into the callgraph.
Definition: CallGraph.h:136
CallGraphPrinterPass(raw_ostream &OS)
Definition: CallGraph.h:312
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static CallGraphNode * CGGetValuePtr(const PairTy &P)
Definition: CallGraph.h:463
aarch64 promote const
CallGraphNode::CallRecord CGNPairTy
Definition: CallGraph.h:428
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:147
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
const_iterator end() const
Definition: CallGraph.h:192
iterator begin()
Definition: CallGraph.h:189
A container for analyses that lazily runs them and caches their results.
void dump() const
Definition: CallGraph.cpp:111
This header defines various interfaces for pass management in LLVM.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:70
void print(raw_ostream &OS) const
Definition: CallGraph.cpp:88
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
Definition: CallGraph.h:446
iterator begin()
Definition: CallGraph.h:115
void addCalledFunction(CallBase *Call, CallGraphNode *M)
Adds a function to the list of functions called by this one.
Definition: CallGraph.h:232
const CallGraphNode * operator[](const Function *F) const
Returns the call graph node for the provided function.
Definition: CallGraph.h:121