Rendering API Reference
- class numba_scfg.rendering.rendering.BaseRenderer
Base Renderer class.
This is the base class for all types of graph renderers. It defines two methods render_block and render_edges that define how the blocks and edges of the graph are rendered respectively.
- render_block(digraph: Digraph, name: str, block: BasicBlock) None
Function that defines how the BasicBlocks in a graph should be rendered.
- Parameters:
digraph (Digraph) – The graphviz Digraph object that represents the graph/subgraph upon which the current blocks are to be rendered.
name (str) – Name of the block to be rendered.
block (BasicBlock) – The BasicBlock to be rendered.
- class numba_scfg.rendering.rendering.ByteFlowRenderer
The ByteFlowRenderer class is used to render the visual representation of a ByteFlow object.
- g
The graphviz Digraph object that represents the entire graph upon which the current ByteFlow is to be rendered.
- Type:
Digraph
- bcmap
Mapping of bytecode offset to instruction.
- Type:
Dict[int, dis.Instruction]
- class numba_scfg.rendering.rendering.SCFGRenderer(scfg: SCFG)
The SCFGRenderer class is used to render the visual representation of a SCFG object.
- g
The graphviz Digraph object that represents the entire graph upon which the current SCFG is to be rendered.
- Type:
Digraph
- render_scfg() Digraph
Return the graphviz Digraph that contains the rendered SCFG.
- view(name: str | None = None) None
Method used to view the current SCFG as an external graphviz generated PDF file.
- Parameters:
name (str) – Name to be given to the external graphviz generated PDF file.
- numba_scfg.rendering.rendering.render_flow(flow: ByteFlow) None
Renders multiple ByteFlow representations across various SCFG transformations.
The render_flow` function takes a flow parameter as the ByteFlow to be transformed and rendered and performs the following operations:
Renders the pure ByteFlow representation of the function using ByteFlowRenderer and displays it as a document named “before”.
Joins the return blocks in the ByteFlow object graph and renders the graph, displaying it as a document named “closed”.
Restructures the loops recursively in the ByteFlow object graph and renders the graph, displaying it as named “loop restructured”.
Restructures the branch recursively in the ByteFlow object graph and renders the graph, displaying it as named “branch restructured”.
- Parameters:
flow (ByteFlow) – The ByteFlow object to be trnasformed and rendered.
- numba_scfg.rendering.rendering.render_func(func) None
The render_func` function takes a func parameter as the Python function to be transformed and rendered and renders the byte flow representation of the bytecode of the function.
- Parameters:
func (Python function) – The Python function for which bytecode is to be rendered.