MLIR  15.0.0git
Classes | Public Types | Public Member Functions | List of all members
mlir::CallGraph Class Reference

#include "mlir/Analysis/CallGraph.h"

Public Types

using iterator = NodeIterator
 An iterator over the nodes of the graph. More...
 

Public Member Functions

 CallGraph (Operation *op)
 
CallGraphNodegetOrAddNode (Region *region, CallGraphNode *parentNode)
 Get or add a call graph node for the given region. More...
 
CallGraphNodelookupNode (Region *region) const
 Lookup a call graph node for the given region, or nullptr if none is registered. More...
 
CallGraphNodegetExternalNode () const
 Return the callgraph node representing the indirect-external callee. More...
 
CallGraphNoderesolveCallable (CallOpInterface call, SymbolTableCollection &symbolTable) const
 Resolve the callable for given callee to a node in the callgraph, or the external node if a valid node was not resolved. More...
 
void eraseNode (CallGraphNode *node)
 Erase the given node from the callgraph. More...
 
iterator begin () const
 
iterator end () const
 
void dump () const
 Dump the graph in a human readable format. More...
 
void print (raw_ostream &os) const
 

Detailed Description

Definition at line 154 of file CallGraph.h.

Member Typedef Documentation

◆ iterator

using mlir::CallGraph::iterator = NodeIterator

An iterator over the nodes of the graph.

Definition at line 203 of file CallGraph.h.

Constructor & Destructor Documentation

◆ CallGraph()

CallGraph::CallGraph ( Operation op)

Definition at line 95 of file CallGraph.cpp.

References computeCallGraph().

Member Function Documentation

◆ begin()

iterator mlir::CallGraph::begin ( ) const
inline

◆ dump()

void CallGraph::dump ( ) const

Dump the graph in a human readable format.

Definition at line 173 of file CallGraph.cpp.

References print().

◆ end()

iterator mlir::CallGraph::end ( ) const
inline

Definition at line 205 of file CallGraph.h.

References print().

Referenced by llvm::GraphTraits< const mlir::CallGraph * >::nodes_end().

◆ eraseNode()

void CallGraph::eraseNode ( CallGraphNode node)

Erase the given node from the callgraph.

Definition at line 153 of file CallGraph.cpp.

References mlir::CallGraphNode::getCallableRegion(), mlir::CallGraphNode::Edge::getTarget(), and mlir::CallGraphNode::hasChildren().

◆ getExternalNode()

CallGraphNode* mlir::CallGraph::getExternalNode ( ) const
inline

Return the callgraph node representing the indirect-external callee.

Definition at line 188 of file CallGraph.h.

Referenced by llvm::GraphTraits< const mlir::CallGraph * >::getEntryNode(), and resolveCallable().

◆ getOrAddNode()

CallGraphNode * CallGraph::getOrAddNode ( Region region,
CallGraphNode parentNode 
)

Get or add a call graph node for the given region.

parentNode corresponds to the direct node in the callgraph that contains the parent operation of region, or nullptr if there is no parent node.

Definition at line 107 of file CallGraph.cpp.

References mlir::CallGraphNode::addAbstractEdge(), mlir::CallGraphNode::addChildEdge(), and mlir::Region::getParentOp().

Referenced by computeCallGraph().

◆ lookupNode()

CallGraphNode * CallGraph::lookupNode ( Region region) const

Lookup a call graph node for the given region, or nullptr if none is registered.

Definition at line 133 of file CallGraph.cpp.

Referenced by collectCallOps(), inlineHistoryIncludes(), resolveCallable(), and walkReferencedSymbolNodes().

◆ print()

void CallGraph::print ( raw_ostream &  os) const

◆ resolveCallable()

CallGraphNode * CallGraph::resolveCallable ( CallOpInterface  call,
SymbolTableCollection symbolTable 
) const

Resolve the callable for given callee to a node in the callgraph, or the external node if a valid node was not resolved.

The provided symbol table is used when resolving calls that reference callables via a symbol reference.

Definition at line 141 of file CallGraph.cpp.

References getExternalNode(), and lookupNode().

Referenced by collectCallOps(), and computeCallGraph().


The documentation for this class was generated from the following files: