35 #ifndef LLVM_ANALYSIS_LAZYCALLGRAPH_H
36 #define LLVM_ANALYSIS_LAZYCALLGRAPH_H
54 class PreservedAnalyses;
118 std::forward_iterator_tag, Node> {
129 while (
I != E &&
I->isNull())
136 using iterator_adaptor_base::operator++;
140 }
while (
I != E &&
I->isNull());
146 return *
I->get<
Node *>();
180 void insertEdgeInternal(
Function &Callee);
183 void insertEdgeInternal(
Node &CalleeN);
186 void removeEdgeInternal(
Function &Callee);
220 void insert(
Node &
N);
223 internalDFS(
SmallVectorImpl<std::pair<Node *, Node::iterator>> &DFSStack,
249 return ParentSCCs.count(const_cast<SCC *>(&C));
357 std::forward_iterator_tag, SCC> {
369 C = G.getNextSCCInPostOrder();
374 : G(&G), C(nullptr) {}
378 return G == Arg.G && C == Arg.C;
383 using iterator_facade_base::operator++;
385 C = G->getNextSCCInPostOrder();
434 return insertInto(
F, N);
507 Node &insertInto(
Function &
F, Node *&MappedN);
510 void updateGraphPtrs();
517 SCC *getNextSCCInPostOrder();
544 static void *
ID() {
return (
void *)&PassID; }
SuperClass::iterator iterator
NodeVectorImplT::iterator I
parent_iterator parent_begin() const
SCC * lookupSCC(Node &N) const
Lookup a function's SCC in the graph.
static ChildIteratorType child_end(NodeType *N)
reference operator*() const
A Module instance is used to store all the information related to an LLVM module. ...
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
void insertEdge(Function &Caller, Function &Callee)
Update the call graph after inserting a new edge.
SmallVector< PointerUnion< Function *, Node * >, 4 > NodeVectorT
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
void removeInterSCCEdge(Node &CallerN, Node &CalleeN)
Remove an edge whose source is in this SCC and target is not.
bool isDescendantOf(const SCC &C) const
Test if this SCC is a descendant of C.
static NodeType * getEntryNode(NodeType *N)
A post-order depth-first SCC iterator over the call graph.
Node & get(Function &F)
Get a graph node for a given function, scanning it to populate the graph data as necessary.
static ChildIteratorType child_begin(NodeType *N)
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
static NodeType * getEntryNode(NodeType *N)
A lazy iterator used for both the entry nodes and child nodes.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void insertIntraSCCEdge(Node &CallerN, Node &CalleeN)
Insert an edge from one node in this SCC to another in this SCC.
SmallVector< SCC *, 1 > removeIntraSCCEdge(Node &CallerN, Node &CalleeN)
Remove an edge which is entirely within this SCC.
LazyCallGraph::iterator ChildIteratorType
A lazily constructed view of the call graph of a module.
void insertEdge(Node &Caller, Function &Callee)
Update the call graph after inserting a new edge.
bool operator==(const postorder_scc_iterator &Arg) const
LazyCallGraph & operator=(LazyCallGraph &&RHS)
void insertOutgoingEdge(Node &CallerN, Node &CalleeN)
Insert an edge whose tail is in this SCC and head is in some child SCC.
postorder_scc_iterator postorder_scc_begin()
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
void removeEdge(Node &Caller, Function &Callee)
Update the call graph after deleting an edge.
reference operator*() const
An abstract set of preserved analyses following a transformation pass run.
pointee_iterator< SmallPtrSet< SCC *, 1 >::const_iterator > parent_iterator
CRTP base class for adapting an iterator to a different type.
postorder_scc_iterator & operator++()
PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM)
postorder_scc_iterator postorder_scc_end()
SmallVector< SCC *, 1 > insertIncomingEdge(Node &CallerN, Node &CalleeN)
Insert an edge whose tail is in a descendant SCC and head is in this SCC.
A node in the call graph.
SmallVectorImpl< PointerUnion< Function *, Node * > > NodeVectorImplT
bool isAncestorOf(const SCC &C) const
Test if this SCC is an ancestor of C.
bool operator==(const Node &N) const
Equality is defined as address equality.
LazyCallGraph Result
Inform generic clients of the result type.
Function & getFunction() const
iterator_range< postorder_scc_iterator > postorder_sccs()
void removeEdge(Function &Caller, Function &Callee)
Update the call graph after deleting an edge.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
StringRef getName() const
Short name useful for debugging or logging.
LazyCallGraph::Node NodeType
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
An iterator type that allows iterating over the pointees via some other iterator. ...
A BumpPtrAllocator that allows only elements of a specific type to be allocated.
LazyCallGraph::iterator ChildIteratorType
LazyCallGraph::iterator iterator
parent_iterator parent_end() const
A range adaptor for a pair of iterators.
bool isParentOf(const SCC &C) const
Test if this SCC is a parent of C.
LazyCallGraphPrinterPass(raw_ostream &OS)
Node * lookup(const Function &F) const
Lookup a function in the graph which has already been scanned and added.
iterator_range< parent_iterator > parents() const
A pass which prints the call graph to a raw_ostream.
SmallVectorImpl< Node * >::const_iterator iterator
bool operator!=(const Node &N) const
LazyCallGraph::Node NodeType
An analysis pass which computes the call graph for a module.
bool isChildOf(const SCC &C) const
Test if this SCC is a child of C.
static ChildIteratorType child_end(NodeType *N)
An SCC of the call graph.
LazyCallGraph run(Module &M)
Compute the LazyCallGraph for the module M.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
A generic analysis pass manager with lazy running and caching of results.
This header defines various interfaces for pass management in LLVM.
LazyCallGraph(Module &M)
Construct a graph for the given module.
static ChildIteratorType child_begin(NodeType *N)