Module spirt::print

source ·
Expand description

Pretty-printing anything in the IR, from whole Modules 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:

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 its versions field), or the sole one (in the single-version mode).

Enums§

  • CxInterned 🔒
    Anything interned in Context, that might need to be printed once (as part of Node::AllCxInterned) and referenced multiple times.
  • Node 🔒
    Print Plan top-level entry, an effective reification of SPIR-T’s implicit DAG.
  • NodeDef 🔒
    Definition of a Node (i.e. a reference pointing into a Module).
  • Use 🔒
  • UseStyle 🔒
    How an Use of a definition should be printed.

Constants§

Traits§