LazyCallGraph.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. //===- LazyCallGraph.h - Analysis of a Module's call graph ------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. /// \file
  10. ///
  11. /// Implements a lazy call graph analysis and related passes for the new pass
  12. /// manager.
  13. ///
  14. /// NB: This is *not* a traditional call graph! It is a graph which models both
  15. /// the current calls and potential calls. As a consequence there are many
  16. /// edges in this call graph that do not correspond to a 'call' or 'invoke'
  17. /// instruction.
  18. ///
  19. /// The primary use cases of this graph analysis is to facilitate iterating
  20. /// across the functions of a module in ways that ensure all callees are
  21. /// visited prior to a caller (given any SCC constraints), or vice versa. As
  22. /// such is it particularly well suited to organizing CGSCC optimizations such
  23. /// as inlining, outlining, argument promotion, etc. That is its primary use
  24. /// case and motivates the design. It may not be appropriate for other
  25. /// purposes. The use graph of functions or some other conservative analysis of
  26. /// call instructions may be interesting for optimizations and subsequent
  27. /// analyses which don't work in the context of an overly specified
  28. /// potential-call-edge graph.
  29. ///
  30. /// To understand the specific rules and nature of this call graph analysis,
  31. /// see the documentation of the \c LazyCallGraph below.
  32. ///
  33. //===----------------------------------------------------------------------===//
  34. #ifndef LLVM_ANALYSIS_LAZYCALLGRAPH_H
  35. #define LLVM_ANALYSIS_LAZYCALLGRAPH_H
  36. #include "llvm/ADT/DenseMap.h"
  37. #include "llvm/ADT/PointerUnion.h"
  38. #include "llvm/ADT/STLExtras.h"
  39. #include "llvm/ADT/SetVector.h"
  40. #include "llvm/ADT/SmallPtrSet.h"
  41. #include "llvm/ADT/SmallVector.h"
  42. #include "llvm/ADT/iterator.h"
  43. #include "llvm/ADT/iterator_range.h"
  44. #include "llvm/IR/BasicBlock.h"
  45. #include "llvm/IR/Function.h"
  46. #include "llvm/IR/Module.h"
  47. #include "llvm/IR/PassManager.h"
  48. #include "llvm/Support/Allocator.h"
  49. #include <iterator>
  50. namespace llvm {
  51. class PreservedAnalyses;
  52. class raw_ostream;
  53. /// \brief A lazily constructed view of the call graph of a module.
  54. ///
  55. /// With the edges of this graph, the motivating constraint that we are
  56. /// attempting to maintain is that function-local optimization, CGSCC-local
  57. /// optimizations, and optimizations transforming a pair of functions connected
  58. /// by an edge in the graph, do not invalidate a bottom-up traversal of the SCC
  59. /// DAG. That is, no optimizations will delete, remove, or add an edge such
  60. /// that functions already visited in a bottom-up order of the SCC DAG are no
  61. /// longer valid to have visited, or such that functions not yet visited in
  62. /// a bottom-up order of the SCC DAG are not required to have already been
  63. /// visited.
  64. ///
  65. /// Within this constraint, the desire is to minimize the merge points of the
  66. /// SCC DAG. The greater the fanout of the SCC DAG and the fewer merge points
  67. /// in the SCC DAG, the more independence there is in optimizing within it.
  68. /// There is a strong desire to enable parallelization of optimizations over
  69. /// the call graph, and both limited fanout and merge points will (artificially
  70. /// in some cases) limit the scaling of such an effort.
  71. ///
  72. /// To this end, graph represents both direct and any potential resolution to
  73. /// an indirect call edge. Another way to think about it is that it represents
  74. /// both the direct call edges and any direct call edges that might be formed
  75. /// through static optimizations. Specifically, it considers taking the address
  76. /// of a function to be an edge in the call graph because this might be
  77. /// forwarded to become a direct call by some subsequent function-local
  78. /// optimization. The result is that the graph closely follows the use-def
  79. /// edges for functions. Walking "up" the graph can be done by looking at all
  80. /// of the uses of a function.
  81. ///
  82. /// The roots of the call graph are the external functions and functions
  83. /// escaped into global variables. Those functions can be called from outside
  84. /// of the module or via unknowable means in the IR -- we may not be able to
  85. /// form even a potential call edge from a function body which may dynamically
  86. /// load the function and call it.
  87. ///
  88. /// This analysis still requires updates to remain valid after optimizations
  89. /// which could potentially change the set of potential callees. The
  90. /// constraints it operates under only make the traversal order remain valid.
  91. ///
  92. /// The entire analysis must be re-computed if full interprocedural
  93. /// optimizations run at any point. For example, globalopt completely
  94. /// invalidates the information in this analysis.
  95. ///
  96. /// FIXME: This class is named LazyCallGraph in a lame attempt to distinguish
  97. /// it from the existing CallGraph. At some point, it is expected that this
  98. /// will be the only call graph and it will be renamed accordingly.
  99. class LazyCallGraph {
  100. public:
  101. class Node;
  102. class SCC;
  103. typedef SmallVector<PointerUnion<Function *, Node *>, 4> NodeVectorT;
  104. typedef SmallVectorImpl<PointerUnion<Function *, Node *>> NodeVectorImplT;
  105. /// \brief A lazy iterator used for both the entry nodes and child nodes.
  106. ///
  107. /// When this iterator is dereferenced, if not yet available, a function will
  108. /// be scanned for "calls" or uses of functions and its child information
  109. /// will be constructed. All of these results are accumulated and cached in
  110. /// the graph.
  111. class iterator
  112. : public iterator_adaptor_base<iterator, NodeVectorImplT::iterator,
  113. std::forward_iterator_tag, Node> {
  114. friend class LazyCallGraph;
  115. friend class LazyCallGraph::Node;
  116. LazyCallGraph *G;
  117. NodeVectorImplT::iterator E;
  118. // Build the iterator for a specific position in a node list.
  119. iterator(LazyCallGraph &G, NodeVectorImplT::iterator NI,
  120. NodeVectorImplT::iterator E)
  121. : iterator_adaptor_base(NI), G(&G), E(E) {
  122. while (I != E && I->isNull())
  123. ++I;
  124. }
  125. public:
  126. iterator() {}
  127. using iterator_adaptor_base::operator++;
  128. iterator &operator++() {
  129. do {
  130. ++I;
  131. } while (I != E && I->isNull());
  132. return *this;
  133. }
  134. reference operator*() const {
  135. if (I->is<Node *>())
  136. return *I->get<Node *>();
  137. Function *F = I->get<Function *>();
  138. Node &ChildN = G->get(*F);
  139. *I = &ChildN;
  140. return ChildN;
  141. }
  142. };
  143. /// \brief A node in the call graph.
  144. ///
  145. /// This represents a single node. It's primary roles are to cache the list of
  146. /// callees, de-duplicate and provide fast testing of whether a function is
  147. /// a callee, and facilitate iteration of child nodes in the graph.
  148. class Node {
  149. friend class LazyCallGraph;
  150. friend class LazyCallGraph::SCC;
  151. LazyCallGraph *G;
  152. Function &F;
  153. // We provide for the DFS numbering and Tarjan walk lowlink numbers to be
  154. // stored directly within the node.
  155. int DFSNumber;
  156. int LowLink;
  157. mutable NodeVectorT Callees;
  158. DenseMap<Function *, size_t> CalleeIndexMap;
  159. /// \brief Basic constructor implements the scanning of F into Callees and
  160. /// CalleeIndexMap.
  161. Node(LazyCallGraph &G, Function &F);
  162. /// \brief Internal helper to insert a callee.
  163. void insertEdgeInternal(Function &Callee);
  164. /// \brief Internal helper to insert a callee.
  165. void insertEdgeInternal(Node &CalleeN);
  166. /// \brief Internal helper to remove a callee from this node.
  167. void removeEdgeInternal(Function &Callee);
  168. public:
  169. typedef LazyCallGraph::iterator iterator;
  170. Function &getFunction() const {
  171. return F;
  172. };
  173. iterator begin() const {
  174. return iterator(*G, Callees.begin(), Callees.end());
  175. }
  176. iterator end() const { return iterator(*G, Callees.end(), Callees.end()); }
  177. /// Equality is defined as address equality.
  178. bool operator==(const Node &N) const { return this == &N; }
  179. bool operator!=(const Node &N) const { return !operator==(N); }
  180. };
  181. /// \brief An SCC of the call graph.
  182. ///
  183. /// This represents a Strongly Connected Component of the call graph as
  184. /// a collection of call graph nodes. While the order of nodes in the SCC is
  185. /// stable, it is not any particular order.
  186. class SCC {
  187. friend class LazyCallGraph;
  188. friend class LazyCallGraph::Node;
  189. LazyCallGraph *G;
  190. SmallPtrSet<SCC *, 1> ParentSCCs;
  191. SmallVector<Node *, 1> Nodes;
  192. SCC(LazyCallGraph &G) : G(&G) {}
  193. void insert(Node &N);
  194. void
  195. internalDFS(SmallVectorImpl<std::pair<Node *, Node::iterator>> &DFSStack,
  196. SmallVectorImpl<Node *> &PendingSCCStack, Node *N,
  197. SmallVectorImpl<SCC *> &ResultSCCs);
  198. public:
  199. typedef SmallVectorImpl<Node *>::const_iterator iterator;
  200. typedef pointee_iterator<SmallPtrSet<SCC *, 1>::const_iterator> parent_iterator;
  201. iterator begin() const { return Nodes.begin(); }
  202. iterator end() const { return Nodes.end(); }
  203. parent_iterator parent_begin() const { return ParentSCCs.begin(); }
  204. parent_iterator parent_end() const { return ParentSCCs.end(); }
  205. iterator_range<parent_iterator> parents() const {
  206. return iterator_range<parent_iterator>(parent_begin(), parent_end());
  207. }
  208. /// \brief Test if this SCC is a parent of \a C.
  209. bool isParentOf(const SCC &C) const { return C.isChildOf(*this); }
  210. /// \brief Test if this SCC is an ancestor of \a C.
  211. bool isAncestorOf(const SCC &C) const { return C.isDescendantOf(*this); }
  212. /// \brief Test if this SCC is a child of \a C.
  213. bool isChildOf(const SCC &C) const {
  214. return ParentSCCs.count(const_cast<SCC *>(&C));
  215. }
  216. /// \brief Test if this SCC is a descendant of \a C.
  217. bool isDescendantOf(const SCC &C) const;
  218. /// \brief Short name useful for debugging or logging.
  219. ///
  220. /// We use the name of the first function in the SCC to name the SCC for
  221. /// the purposes of debugging and logging.
  222. StringRef getName() const { return (*begin())->getFunction().getName(); }
  223. ///@{
  224. /// \name Mutation API
  225. ///
  226. /// These methods provide the core API for updating the call graph in the
  227. /// presence of a (potentially still in-flight) DFS-found SCCs.
  228. ///
  229. /// Note that these methods sometimes have complex runtimes, so be careful
  230. /// how you call them.
  231. /// \brief Insert an edge from one node in this SCC to another in this SCC.
  232. ///
  233. /// By the definition of an SCC, this does not change the nature or make-up
  234. /// of any SCCs.
  235. void insertIntraSCCEdge(Node &CallerN, Node &CalleeN);
  236. /// \brief Insert an edge whose tail is in this SCC and head is in some
  237. /// child SCC.
  238. ///
  239. /// There must be an existing path from the caller to the callee. This
  240. /// operation is inexpensive and does not change the set of SCCs in the
  241. /// graph.
  242. void insertOutgoingEdge(Node &CallerN, Node &CalleeN);
  243. /// \brief Insert an edge whose tail is in a descendant SCC and head is in
  244. /// this SCC.
  245. ///
  246. /// There must be an existing path from the callee to the caller in this
  247. /// case. NB! This is has the potential to be a very expensive function. It
  248. /// inherently forms a cycle in the prior SCC DAG and we have to merge SCCs
  249. /// to resolve that cycle. But finding all of the SCCs which participate in
  250. /// the cycle can in the worst case require traversing every SCC in the
  251. /// graph. Every attempt is made to avoid that, but passes must still
  252. /// exercise caution calling this routine repeatedly.
  253. ///
  254. /// FIXME: We could possibly optimize this quite a bit for cases where the
  255. /// caller and callee are very nearby in the graph. See comments in the
  256. /// implementation for details, but that use case might impact users.
  257. SmallVector<SCC *, 1> insertIncomingEdge(Node &CallerN, Node &CalleeN);
  258. /// \brief Remove an edge whose source is in this SCC and target is *not*.
  259. ///
  260. /// This removes an inter-SCC edge. All inter-SCC edges originating from
  261. /// this SCC have been fully explored by any in-flight DFS SCC formation,
  262. /// so this is always safe to call once you have the source SCC.
  263. ///
  264. /// This operation does not change the set of SCCs or the members of the
  265. /// SCCs and so is very inexpensive. It may change the connectivity graph
  266. /// of the SCCs though, so be careful calling this while iterating over
  267. /// them.
  268. void removeInterSCCEdge(Node &CallerN, Node &CalleeN);
  269. /// \brief Remove an edge which is entirely within this SCC.
  270. ///
  271. /// Both the \a Caller and the \a Callee must be within this SCC. Removing
  272. /// such an edge make break cycles that form this SCC and thus this
  273. /// operation may change the SCC graph significantly. In particular, this
  274. /// operation will re-form new SCCs based on the remaining connectivity of
  275. /// the graph. The following invariants are guaranteed to hold after
  276. /// calling this method:
  277. ///
  278. /// 1) This SCC is still an SCC in the graph.
  279. /// 2) This SCC will be the parent of any new SCCs. Thus, this SCC is
  280. /// preserved as the root of any new SCC directed graph formed.
  281. /// 3) No SCC other than this SCC has its member set changed (this is
  282. /// inherent in the definition of removing such an edge).
  283. /// 4) All of the parent links of the SCC graph will be updated to reflect
  284. /// the new SCC structure.
  285. /// 5) All SCCs formed out of this SCC, excluding this SCC, will be
  286. /// returned in a vector.
  287. /// 6) The order of the SCCs in the vector will be a valid postorder
  288. /// traversal of the new SCCs.
  289. ///
  290. /// These invariants are very important to ensure that we can build
  291. /// optimization pipeliens on top of the CGSCC pass manager which
  292. /// intelligently update the SCC graph without invalidating other parts of
  293. /// the SCC graph.
  294. ///
  295. /// The runtime complexity of this method is, in the worst case, O(V+E)
  296. /// where V is the number of nodes in this SCC and E is the number of edges
  297. /// leaving the nodes in this SCC. Note that E includes both edges within
  298. /// this SCC and edges from this SCC to child SCCs. Some effort has been
  299. /// made to minimize the overhead of common cases such as self-edges and
  300. /// edge removals which result in a spanning tree with no more cycles.
  301. SmallVector<SCC *, 1> removeIntraSCCEdge(Node &CallerN, Node &CalleeN);
  302. ///@}
  303. };
  304. /// \brief A post-order depth-first SCC iterator over the call graph.
  305. ///
  306. /// This iterator triggers the Tarjan DFS-based formation of the SCC DAG for
  307. /// the call graph, walking it lazily in depth-first post-order. That is, it
  308. /// always visits SCCs for a callee prior to visiting the SCC for a caller
  309. /// (when they are in different SCCs).
  310. class postorder_scc_iterator
  311. : public iterator_facade_base<postorder_scc_iterator,
  312. std::forward_iterator_tag, SCC> {
  313. friend class LazyCallGraph;
  314. friend class LazyCallGraph::Node;
  315. /// \brief Nonce type to select the constructor for the end iterator.
  316. struct IsAtEndT {};
  317. LazyCallGraph *G;
  318. SCC *C;
  319. // Build the begin iterator for a node.
  320. postorder_scc_iterator(LazyCallGraph &G) : G(&G) {
  321. C = G.getNextSCCInPostOrder();
  322. }
  323. // Build the end iterator for a node. This is selected purely by overload.
  324. postorder_scc_iterator(LazyCallGraph &G, IsAtEndT /*Nonce*/)
  325. : G(&G), C(nullptr) {}
  326. public:
  327. bool operator==(const postorder_scc_iterator &Arg) const {
  328. return G == Arg.G && C == Arg.C;
  329. }
  330. reference operator*() const { return *C; }
  331. using iterator_facade_base::operator++;
  332. postorder_scc_iterator &operator++() {
  333. C = G->getNextSCCInPostOrder();
  334. return *this;
  335. }
  336. };
  337. /// \brief Construct a graph for the given module.
  338. ///
  339. /// This sets up the graph and computes all of the entry points of the graph.
  340. /// No function definitions are scanned until their nodes in the graph are
  341. /// requested during traversal.
  342. LazyCallGraph(Module &M);
  343. LazyCallGraph(LazyCallGraph &&G);
  344. LazyCallGraph &operator=(LazyCallGraph &&RHS);
  345. iterator begin() {
  346. return iterator(*this, EntryNodes.begin(), EntryNodes.end());
  347. }
  348. iterator end() { return iterator(*this, EntryNodes.end(), EntryNodes.end()); }
  349. postorder_scc_iterator postorder_scc_begin() {
  350. return postorder_scc_iterator(*this);
  351. }
  352. postorder_scc_iterator postorder_scc_end() {
  353. return postorder_scc_iterator(*this, postorder_scc_iterator::IsAtEndT());
  354. }
  355. iterator_range<postorder_scc_iterator> postorder_sccs() {
  356. return iterator_range<postorder_scc_iterator>(postorder_scc_begin(),
  357. postorder_scc_end());
  358. }
  359. /// \brief Lookup a function in the graph which has already been scanned and
  360. /// added.
  361. Node *lookup(const Function &F) const { return NodeMap.lookup(&F); }
  362. /// \brief Lookup a function's SCC in the graph.
  363. ///
  364. /// \returns null if the function hasn't been assigned an SCC via the SCC
  365. /// iterator walk.
  366. SCC *lookupSCC(Node &N) const { return SCCMap.lookup(&N); }
  367. /// \brief Get a graph node for a given function, scanning it to populate the
  368. /// graph data as necessary.
  369. Node &get(Function &F) {
  370. Node *&N = NodeMap[&F];
  371. if (N)
  372. return *N;
  373. return insertInto(F, N);
  374. }
  375. ///@{
  376. /// \name Pre-SCC Mutation API
  377. ///
  378. /// These methods are only valid to call prior to forming any SCCs for this
  379. /// call graph. They can be used to update the core node-graph during
  380. /// a node-based inorder traversal that precedes any SCC-based traversal.
  381. ///
  382. /// Once you begin manipulating a call graph's SCCs, you must perform all
  383. /// mutation of the graph via the SCC methods.
  384. /// \brief Update the call graph after inserting a new edge.
  385. void insertEdge(Node &Caller, Function &Callee);
  386. /// \brief Update the call graph after inserting a new edge.
  387. void insertEdge(Function &Caller, Function &Callee) {
  388. return insertEdge(get(Caller), Callee);
  389. }
  390. /// \brief Update the call graph after deleting an edge.
  391. void removeEdge(Node &Caller, Function &Callee);
  392. /// \brief Update the call graph after deleting an edge.
  393. void removeEdge(Function &Caller, Function &Callee) {
  394. return removeEdge(get(Caller), Callee);
  395. }
  396. ///@}
  397. private:
  398. /// \brief Allocator that holds all the call graph nodes.
  399. SpecificBumpPtrAllocator<Node> BPA;
  400. /// \brief Maps function->node for fast lookup.
  401. DenseMap<const Function *, Node *> NodeMap;
  402. /// \brief The entry nodes to the graph.
  403. ///
  404. /// These nodes are reachable through "external" means. Put another way, they
  405. /// escape at the module scope.
  406. NodeVectorT EntryNodes;
  407. /// \brief Map of the entry nodes in the graph to their indices in
  408. /// \c EntryNodes.
  409. DenseMap<Function *, size_t> EntryIndexMap;
  410. /// \brief Allocator that holds all the call graph SCCs.
  411. SpecificBumpPtrAllocator<SCC> SCCBPA;
  412. /// \brief Maps Function -> SCC for fast lookup.
  413. DenseMap<Node *, SCC *> SCCMap;
  414. /// \brief The leaf SCCs of the graph.
  415. ///
  416. /// These are all of the SCCs which have no children.
  417. SmallVector<SCC *, 4> LeafSCCs;
  418. /// \brief Stack of nodes in the DFS walk.
  419. SmallVector<std::pair<Node *, iterator>, 4> DFSStack;
  420. /// \brief Set of entry nodes not-yet-processed into SCCs.
  421. SmallVector<Function *, 4> SCCEntryNodes;
  422. /// \brief Stack of nodes the DFS has walked but not yet put into a SCC.
  423. SmallVector<Node *, 4> PendingSCCStack;
  424. /// \brief Counter for the next DFS number to assign.
  425. int NextDFSNumber;
  426. /// \brief Helper to insert a new function, with an already looked-up entry in
  427. /// the NodeMap.
  428. Node &insertInto(Function &F, Node *&MappedN);
  429. /// \brief Helper to update pointers back to the graph object during moves.
  430. void updateGraphPtrs();
  431. /// \brief Helper to form a new SCC out of the top of a DFSStack-like
  432. /// structure.
  433. SCC *formSCC(Node *RootN, SmallVectorImpl<Node *> &NodeStack);
  434. /// \brief Retrieve the next node in the post-order SCC walk of the call graph.
  435. SCC *getNextSCCInPostOrder();
  436. };
  437. // Provide GraphTraits specializations for call graphs.
  438. template <> struct GraphTraits<LazyCallGraph::Node *> {
  439. typedef LazyCallGraph::Node NodeType;
  440. typedef LazyCallGraph::iterator ChildIteratorType;
  441. static NodeType *getEntryNode(NodeType *N) { return N; }
  442. static ChildIteratorType child_begin(NodeType *N) { return N->begin(); }
  443. static ChildIteratorType child_end(NodeType *N) { return N->end(); }
  444. };
  445. template <> struct GraphTraits<LazyCallGraph *> {
  446. typedef LazyCallGraph::Node NodeType;
  447. typedef LazyCallGraph::iterator ChildIteratorType;
  448. static NodeType *getEntryNode(NodeType *N) { return N; }
  449. static ChildIteratorType child_begin(NodeType *N) { return N->begin(); }
  450. static ChildIteratorType child_end(NodeType *N) { return N->end(); }
  451. };
  452. /// \brief An analysis pass which computes the call graph for a module.
  453. class LazyCallGraphAnalysis {
  454. public:
  455. /// \brief Inform generic clients of the result type.
  456. typedef LazyCallGraph Result;
  457. static void *ID() { return (void *)&PassID; }
  458. static StringRef name() { return "Lazy CallGraph Analysis"; }
  459. /// \brief Compute the \c LazyCallGraph for the module \c M.
  460. ///
  461. /// This just builds the set of entry points to the call graph. The rest is
  462. /// built lazily as it is walked.
  463. LazyCallGraph run(Module &M) { return LazyCallGraph(M); }
  464. private:
  465. static char PassID;
  466. };
  467. /// \brief A pass which prints the call graph to a \c raw_ostream.
  468. ///
  469. /// This is primarily useful for testing the analysis.
  470. class LazyCallGraphPrinterPass {
  471. raw_ostream &OS;
  472. public:
  473. explicit LazyCallGraphPrinterPass(raw_ostream &OS);
  474. PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM);
  475. static StringRef name() { return "LazyCallGraphPrinterPass"; }
  476. };
  477. }
  478. #endif