Skip to content

kirin.analysis.callgraph.CallGraph

← Module overview

classCallGraphsource

kirin.analysis.callgraph.CallGraph

Bases: Printable

Call graph for a given [`ir.Method`][kirin.ir.Method].

class CallGraph(mt: ir.Method)

This class implements the kirin.graph.Graph protocol.

!!! note “Pretty Printing” This object is pretty printable via .print() method.

Parameters

NameTypeDescription
mtir.Method

Attributes

NameTypeDefaultDescription
edgesdict[ir.Method, set[ir.Method]]{}Mapping from symbol names to edges (caller -> callee).
backedgesdict[ir.Method, set[ir.Method]]{}Mapping from symbol names to backedges (callee -> caller).
defs—{}

methodget_neighborssource

kirin.analysis.callgraph.CallGraph.get_neighbors

def get_neighbors(node: ir.Method) -> Iterable[ir.Method]

Get the neighbors of a node in the call graph.

Parameters

NameTypeDescription
nodeir.Method

Returns

Iterable[ir.Method]

source

methodget_edgessource

kirin.analysis.callgraph.CallGraph.get_edges

def get_edges() -> Iterable[tuple[ir.Method, ir.Method]]

Get the edges of the call graph.

Returns

Iterable[tuple[ir.Method, ir.Method]]

source

methodget_nodessource

kirin.analysis.callgraph.CallGraph.get_nodes

def get_nodes() -> Iterable[ir.Method]

Get the nodes of the call graph.

Returns

Iterable[ir.Method]

source

methodprint_implsource

kirin.analysis.callgraph.CallGraph.print_impl

def print_impl(printer: Printer) -> None

Parameters

NameTypeDescription
printerPrinter
source