Expand description
Pretty-printing anything in the IR, from whole Module
s to their leaves.
Usage
To start, create a Plan
(through e.g. Plan::for_root
or Plan::for_module
),
which will track the entire (transitive) set of (interned/entity) dependencies
required to produce complete pretty-printing outputs.
On a Plan
, use .pretty_print()
to print everything,
and get a “pretty document”, with layout (inline-vs-multi-line decisions,
auto-indentation, etc.) already performed, and which supports outputting:
- plain text:
fmt::Display
({}
formatting) or.to_string()
- HTML (styled and hyperlinked):
.render_to_html()
(returning apretty::HtmlSnippet
)
Modules
- Multi-version pretty-printing support (e.g. for comparing the IR between passes).
- pretty 🔒Pretty-printing functionality (such as automatic indentation).
Structs
- Error type used when tracking
OpName
uniqueness. - A
Print
Output
type that splits the attributes from the main body of the definition, allowing additional processing before they get concatenated. - “Definitions-before-uses” / “topo-sorted” printing plan.
- One version of a multi-version
Plan
(see also itsversions
field), or the sole one (in the single-version mode).
Enums
- Anything interned in
Context
, that might need to be printed once (as part ofNode::AllCxInterned
) and referenced multiple times. - Node 🔒Print
Plan
top-level entry, an effective reification of SPIR-T’s implicit DAG. - NodeDef 🔒
- Use 🔒
- UseStyle 🔒How an
Use
of a definition should be printed.