srdatalog.ir.print_iir¶
Print_i — canonical s-expression form for IIR ops.
See docs/stage3a_execution_plan.md §1 for the binding vocabulary.
Print is one of three distinct operations on IR data:
Lowering D1.Op → D2.Op* (data → data, framework-dispatched)
Render D.Op → str (data → target text, codegen-dispatched)
Print D.Op → s-expr (data → canonical text, dialect-owned)
This module is the top-level dispatcher for IIR Print. Each
IIR-contributing dialect (iir.cf, relation.sorted_array, relation.d2l,
parallel.data) ships a print.py with:
OPS: tuple[type, ...] # op classes the module handles
print_op(op, indent: int = 0) -> str # per-dialect dispatcher
print_iir(op, indent) routes by isinstance(op, dialect.OPS) to the
owning dialect’s print_op. Children inside an op recurse through
print_iir so a sub-tree mixing dialects renders cleanly.
Mirrors mir/print.py (the MIR s-expr printer) in style: Racket-canonical
#:keyword form, two-space indent per level, parens-balanced.
Test surface: byte-equal s-expr at the IIR layer. See
tests/test_iir_print.py.
Module Contents¶
Functions¶
Render an IIR op (from any IIR-contributing dialect) as s-expression text. |
Data¶
API¶
- srdatalog.ir.print_iir.__all__¶
[‘print_iir’]
- srdatalog.ir.print_iir.print_iir(op: srdatalog.ir.core.Op, indent: int = 0) str[source]¶
Render an IIR op (from any IIR-contributing dialect) as s-expression text.
Routes by isinstance against each dialect’s
OPStuple. Children recurse through this function, so an IIR tree mixing dialects (e.g. iir.cf.Block containing sorted_array.SaPrefCoop) renders correctly.Raises TypeError on an unknown op kind — useful as the “did the dispatcher get out of sync with a new dialect” signal.