MLIR  20.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...
 
CallGraphNodegetExternalCallerNode () const
 Return the callgraph node representing an external caller. More...
 
CallGraphNodegetUnknownCalleeNode () const
 Return the callgraph node representing an indirect 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 208 of file CallGraph.h.

Constructor & Destructor Documentation

◆ CallGraph()

CallGraph::CallGraph ( Operation op)

Definition at line 99 of file CallGraph.cpp.

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 178 of file CallGraph.cpp.

References print().

◆ end()

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

◆ eraseNode()

void CallGraph::eraseNode ( CallGraphNode node)

Erase the given node from the callgraph.

Definition at line 158 of file CallGraph.cpp.

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

◆ getExternalCallerNode()

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

Return the callgraph node representing an external caller.

Definition at line 188 of file CallGraph.h.

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

◆ 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 113 of file CallGraph.cpp.

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

◆ getUnknownCalleeNode()

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

Return the callgraph node representing an indirect callee.

Definition at line 193 of file CallGraph.h.

Referenced by print(), and resolveCallable().

◆ 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 139 of file CallGraph.cpp.

Referenced by resolveCallable().

◆ 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.

Resolve the callable for given callee to a node in the callgraph, or the unknown callee 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 147 of file CallGraph.cpp.

References getUnknownCalleeNode(), and lookupNode().


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