MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::Nest Class Reference

Builds a nesting tree for all mutables/binders. More...

#include <mim/nest.h>

Classes

class  Node

Public Member Functions

Constructors
 Nest (Def *root)
 Nest (World &, fe::View< Def * > muts, bool transitive=false)
 Virtual root with muts as children; transitive also adds the closed mutables they reach.
 Nest (World &)
 Virtual root with all World::externals as children.
 Nest (const Nest &)=delete
 Nest (Nest &&)=delete
Nest & operator= (Nest)=delete
Getters
World & world () const
const Node * root () const
Vars vars () const
 All Vars occurring in this Nest.
bool contains (const Def *def) const
bool is_recursive () const
Nodes
auto muts () const
auto nodes () const
const Node * operator[] (Def *mut) const
const Node * inest (const Def *def) const
 The innermost Node binding a free Var of def, or the root() if there is none.
Iterators
auto begin () const
auto end () const
dot

GraphViz output.

void dot (std::ostream &os, DotConfig cfg={}) const
void dot (const char *file=nullptr, DotConfig cfg={}) const
void dot (std::string s, DotConfig cfg={}) const

Static Public Member Functions

static const Node * lca (const Node *n, const Node *m)
 Least common ancestor of n and m.

Detailed Description

Builds a nesting tree for all mutables/binders.

The constructor also computes sibling dependencies, SCCs, loop depths, and dominance. A Nest is immutable afterwards.

Definition at line 25 of file nest.h.

Constructor & Destructor Documentation

◆ Nest() [1/5]

mim::Nest::Nest ( Def * root)

◆ Nest() [2/5]

mim::Nest::Nest ( World & world,
fe::View< Def * > muts,
bool transitive = false )

Virtual root with muts as children; transitive also adds the closed mutables they reach.

Definition at line 16 of file nest.cpp.

References muts(), and world().

◆ Nest() [3/5]

mim::Nest::Nest ( World & world)

Virtual root with all World::externals as children.

Definition at line 25 of file nest.cpp.

References Nest(), and world().

◆ Nest() [4/5]

mim::Nest::Nest ( const Nest & )
delete

References Nest().

◆ Nest() [5/5]

mim::Nest::Nest ( Nest && )
delete

References Nest().

Member Function Documentation

◆ begin()

auto mim::Nest::begin ( ) const
inline

Definition at line 216 of file nest.h.

◆ contains()

bool mim::Nest::contains ( const Def * def) const
inline

Definition at line 197 of file nest.h.

References mim::Def::has_free_vars_in(), and vars().

Referenced by mim::Scheduler::Scheduler().

◆ dot() [1/3]

void mim::Nest::dot ( const char * file = nullptr,
DotConfig cfg = {} ) const

Definition at line 279 of file dot.cpp.

◆ dot() [2/3]

void mim::Nest::dot ( std::ostream & os,
DotConfig cfg = {} ) const

Definition at line 281 of file dot.cpp.

References mim::DotConfig::dark, and root().

◆ dot() [3/3]

void mim::Nest::dot ( std::string s,
DotConfig cfg = {} ) const
inline

Definition at line 227 of file nest.h.

◆ end()

auto mim::Nest::end ( ) const
inline

Definition at line 217 of file nest.h.

◆ inest()

const Node * mim::Nest::inest ( const Def * def) const
inline

The innermost Node binding a free Var of def, or the root() if there is none.

For a mutable in this Nest, that is its Node::inest.

Definition at line 211 of file nest.h.

◆ is_recursive()

bool mim::Nest::is_recursive ( ) const
inline

Definition at line 198 of file nest.h.

Referenced by mim::LamSpec::rewrite_imm_App().

◆ lca()

const Nest::Node * mim::Nest::lca ( const Node * n,
const Node * m )
static

Least common ancestor of n and m.

Definition at line 174 of file nest.cpp.

References mim::Nest::Node::inest().

Referenced by mim::Scheduler::late().

◆ muts()

auto mim::Nest::muts ( ) const
inline

Definition at line 204 of file nest.h.

Referenced by Nest(), and mim::Scheduler::Scheduler().

◆ nodes()

auto mim::Nest::nodes ( ) const
inline

Definition at line 205 of file nest.h.

◆ operator=()

Nest & mim::Nest::operator= ( Nest )
delete

References Nest().

◆ operator[]()

const Node * mim::Nest::operator[] ( Def * mut) const
inline

Definition at line 208 of file nest.h.

◆ root()

const Node * mim::Nest::root ( ) const
inline

Definition at line 195 of file nest.h.

Referenced by dot(), mim::Scheduler::early(), mim::Scheduler::late(), and mim::Scheduler::schedule().

◆ vars()

Vars mim::Nest::vars ( ) const
inline

All Vars occurring in this Nest.

Definition at line 196 of file nest.h.

Referenced by contains().

◆ world()

World & mim::Nest::world ( ) const
inline

Definition at line 194 of file nest.h.

Referenced by Nest(), Nest(), Nest(), and mim::Scheduler::world().


The documentation for this class was generated from the following files: