LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
llzk::CallGraph Class Reference

This is a port of mlir::CallGraph that has been adapted to use the custom symbol lookup helpers (see SymbolHelper.h). More...

#include <CallGraph.h>

Public Types

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

Public Member Functions

 CallGraph (mlir::Operation *op)
 
CallGraphNodegetOrAddNode (mlir::Region *region, CallGraphNode *parentNode)
 Get or add a call graph node for the given region.
 
CallGraphNodelookupNode (mlir::Region *region) const
 Lookup a call graph node for the given region, or nullptr if none is registered.
 
CallGraphNodegetExternalCallerNode () const
 Return the callgraph node representing an external caller.
 
CallGraphNodegetUnknownCalleeNode () const
 Return the callgraph node representing an indirect callee.
 
CallGraphNoderesolveCallable (mlir::CallOpInterface call, mlir::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.
 
void eraseNode (CallGraphNode *node)
 Erase the given node from the callgraph.
 
iterator begin () const
 
iterator end () const
 
size_t size () const
 
void dump () const
 Dump the graph in a human readable format.
 
void print (llvm::raw_ostream &os) const
 

Detailed Description

This is a port of mlir::CallGraph that has been adapted to use the custom symbol lookup helpers (see SymbolHelper.h).

Unfortunately the mlir::CallGraph is not readily extensible, so we will define our own with a similar interface.

Definition at line 167 of file CallGraph.h.

Member Typedef Documentation

◆ iterator

using llzk::CallGraph::iterator = NodeIterator

An iterator over the nodes of the graph.

Definition at line 219 of file CallGraph.h.

Constructor & Destructor Documentation

◆ CallGraph()

llzk::CallGraph::CallGraph ( mlir::Operation * op)

Definition at line 110 of file CallGraph.cpp.

Member Function Documentation

◆ begin()

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

Definition at line 220 of file CallGraph.h.

◆ dump()

void llzk::CallGraph::dump ( ) const

Dump the graph in a human readable format.

Definition at line 199 of file CallGraph.cpp.

◆ end()

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

Definition at line 221 of file CallGraph.h.

◆ eraseNode()

void llzk::CallGraph::eraseNode ( CallGraphNode * node)

Erase the given node from the callgraph.

Definition at line 177 of file CallGraph.cpp.

◆ getExternalCallerNode()

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

Return the callgraph node representing an external caller.

Definition at line 199 of file CallGraph.h.

◆ getOrAddNode()

CallGraphNode * llzk::CallGraph::getOrAddNode ( mlir::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 128 of file CallGraph.cpp.

◆ getUnknownCalleeNode()

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

Return the callgraph node representing an indirect callee.

Definition at line 204 of file CallGraph.h.

◆ lookupNode()

CallGraphNode * llzk::CallGraph::lookupNode ( mlir::Region * region) const

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

Definition at line 155 of file CallGraph.cpp.

◆ print()

void llzk::CallGraph::print ( llvm::raw_ostream & os) const

Definition at line 200 of file CallGraph.cpp.

◆ resolveCallable()

CallGraphNode * llzk::CallGraph::resolveCallable ( mlir::CallOpInterface call,
mlir::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.

This function has been modified to work with LLZK.

Definition at line 163 of file CallGraph.cpp.

◆ size()

size_t llzk::CallGraph::size ( ) const
inline

Definition at line 223 of file CallGraph.h.


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