MimIR 0.1
MimIR is my Intermediate Representation
|
The World represents the whole program and manages creation of MimIR nodes (Defs). More...
#include <mim/world.h>
Classes | |
struct | Freezer |
Use to World::freeze and automatically unfreeze at the end of scope. More... | |
struct | ScopedLoc |
struct | State |
Public Member Functions | |
Construction & Destruction | |
World & | operator= (World)=delete |
World (Driver *) | |
World (Driver *, const State &) | |
World (World &&other) noexcept | |
World | inherit () |
Inherits the state into the new World. | |
~World () | |
Getters/Setters | |
const State & | state () const |
const Driver & | driver () const |
Driver & | driver () |
Sym | name () const |
void | set (Sym name) |
void | set (std::string_view name) |
u32 | curr_gid () const |
Manage global identifier - a unique number for each Def. | |
u32 | next_gid () |
u32 | next_run () |
Flags & | flags () |
Retrieve compile Flags. | |
Loc | |
Loc | get_loc () const |
void | set_loc (Loc loc={}) |
ScopedLoc | push (Loc loc) |
Sym | |
Sym | sym (std::string_view) |
Sym | sym (const char *) |
Sym | sym (const std::string &) |
Sym | append_suffix (Sym name, std::string suffix) |
Appends a suffix or an increasing number if the suffix already exists. | |
Freeze | |
In frozen state the World does not create any nodes. | |
bool | is_frozen () const |
bool | freeze (bool on=true) const |
Yields old frozen state. | |
Debugging Features | |
const auto & | breakpoints () |
const Def * | gid2def (u32 gid) |
Lookup Def by gid . | |
void | breakpoint (u32 gid) |
Trigger breakpoint in your debugger when creating Def with Def::gid gid . | |
World & | verify () |
Verifies that all externals() and annexes() are Def::is_closed(), if MIM_ENABLE_CHECKS . | |
Annexes | |
const auto & | flags2annex () const |
auto | annexes () const |
template<class Id> | |
const Def * | annex (Id id) |
Lookup annex by Axiom::id. | |
template<annex_without_subs id> | |
const Def * | annex () |
Get Axiom from a plugin. | |
const Def * | register_annex (flags_t f, const Def *) |
const Def * | register_annex (plugin_t p, tag_t t, sub_t s, const Def *def) |
Externals | |
const auto & | sym2external () const |
Def * | external (Sym name) |
Lookup by name . | |
auto | externals () const |
Vector< Def * > | copy_externals () const |
void | make_external (Def *) |
void | make_internal (Def *) |
Univ, Type, Var, Proxy, Hole | |
const Univ * | univ () |
const Def * | uinc (const Def *op, level_t offset=1) |
template<Sort = Sort::Univ> | |
const Def * | umax (Defs) |
const Type * | type (const Def *level) |
const Type * | type_infer_univ () |
template<level_t level = 0> | |
const Type * | type () |
const Def * | var (const Def *type, Def *mut) |
const Proxy * | proxy (const Def *type, Defs ops, u32 index, u32 tag) |
Hole * | mut_hole (const Def *type) |
Hole * | mut_hole_univ () |
Hole * | mut_hole_type () |
Hole * | mut_hole_infer_entity () |
Either a value ?:?:Type ? or a type ?:Type ?:Type ? . | |
Axiom | |
const Axiom * | axiom (NormalizeFn n, u8 curry, u8 trip, const Def *type, plugin_t p, tag_t t, sub_t s) |
const Axiom * | axiom (const Def *type, plugin_t p, tag_t t, sub_t s) |
const Axiom * | axiom (NormalizeFn n, u8 curry, u8 trip, const Def *type) |
Builds a fresh Axiom with descending Axiom::sub. | |
const Axiom * | axiom (const Def *type) |
See above. | |
Pi | |
const Pi * | pi (const Def *dom, const Def *codom, bool implicit=false) |
const Pi * | pi (Defs dom, const Def *codom, bool implicit=false) |
const Pi * | pi (const Def *dom, Defs codom, bool implicit=false) |
const Pi * | pi (Defs dom, Defs codom, bool implicit=false) |
Pi * | mut_pi (const Def *type, bool implicit=false) |
Cn | |
const Pi * | cn () |
const Pi * | cn (const Def *dom, bool implicit=false) |
const Pi * | cn (Defs dom, bool implicit=false) |
const Pi * | fn (const Def *dom, const Def *codom, bool implicit=false) |
const Pi * | fn (Defs dom, const Def *codom, bool implicit=false) |
const Pi * | fn (const Def *dom, Defs codom, bool implicit=false) |
const Pi * | fn (Defs dom, Defs codom, bool implicit=false) |
Lam | |
const Def * | filter (Lam::Filter filter) |
const Lam * | lam (const Pi *pi, Lam::Filter f, const Def *body) |
Lam * | mut_lam (const Pi *pi) |
const Lam * | con (const Def *dom, Lam::Filter f, const Def *body) |
const Lam * | con (Defs dom, Lam::Filter f, const Def *body) |
const Lam * | lam (const Def *dom, const Def *codom, Lam::Filter f, const Def *body) |
const Lam * | lam (Defs dom, const Def *codom, Lam::Filter f, const Def *body) |
const Lam * | lam (const Def *dom, Defs codom, Lam::Filter f, const Def *body) |
const Lam * | lam (Defs dom, Defs codom, Lam::Filter f, const Def *body) |
const Lam * | fun (const Def *dom, const Def *codom, Lam::Filter f, const Def *body) |
const Lam * | fun (Defs dom, const Def *codom, Lam::Filter f, const Def *body) |
const Lam * | fun (const Def *dom, Defs codom, Lam::Filter f, const Def *body) |
const Lam * | fun (Defs dom, Defs codom, Lam::Filter f, const Def *body) |
Lam * | mut_con (const Def *dom) |
Lam * | mut_con (Defs dom) |
Lam * | mut_lam (const Def *dom, const Def *codom) |
Lam * | mut_lam (Defs dom, const Def *codom) |
Lam * | mut_lam (const Def *dom, Defs codom) |
Lam * | mut_lam (Defs dom, Defs codom) |
Lam * | mut_fun (const Def *dom, const Def *codom) |
Lam * | mut_fun (Defs dom, const Def *codom) |
Lam * | mut_fun (const Def *dom, Defs codom) |
Lam * | mut_fun (Defs dom, Defs codom) |
App | |
template<bool Normalize = true> | |
const Def * | app (const Def *callee, const Def *arg) |
template<bool Normalize = true> | |
const Def * | app (const Def *callee, Defs args) |
const Def * | raw_app (const Axiom *axiom, u8 curry, u8 trip, const Def *type, const Def *callee, const Def *arg) |
const Def * | raw_app (const Def *type, const Def *callee, const Def *arg) |
const Def * | raw_app (const Def *type, const Def *callee, Defs args) |
Sigma | |
Sigma * | mut_sigma (const Def *type, size_t size) |
template<level_t level = 0> | |
Sigma * | mut_sigma (size_t size) |
A *mut*able Sigma of type level . | |
const Def * | sigma (Defs ops) |
const Sigma * | sigma () |
The unit type within Type 0. | |
Arr | |
Arr * | mut_arr (const Def *type) |
template<level_t level = 0> | |
Arr * | mut_arr () |
const Def * | arr (const Def *shape, const Def *body) |
const Def * | arr (Defs shape, const Def *body) |
const Def * | arr (u64 n, const Def *body) |
const Def * | arr (View< u64 > shape, const Def *body) |
const Def * | arr_unsafe (const Def *body) |
Tuple | |
const Def * | tuple (Defs ops) |
const Def * | tuple (const Def *type, Defs ops) |
Ascribes type to this tuple - needed for dependently typed and mutable Sigmas. | |
const Tuple * | tuple () |
the unit value of type [] | |
const Def * | tuple (Sym sym) |
Converts sym to a tuple of type '«n; I8»'. | |
Pack | |
Pack * | mut_pack (const Def *type) |
const Def * | pack (const Def *arity, const Def *body) |
const Def * | pack (Defs shape, const Def *body) |
const Def * | pack (u64 n, const Def *body) |
const Def * | pack (View< u64 > shape, const Def *body) |
Extract | |
| |
const Def * | extract (const Def *d, const Def *i) |
const Def * | extract (const Def *d, u64 a, u64 i) |
const Def * | extract (const Def *d, u64 i) |
const Def * | select (const Def *cond, const Def *t, const Def *f) |
Builds (f, t)#cond . | |
Insert | |
| |
const Def * | insert (const Def *d, const Def *i, const Def *val) |
const Def * | insert (const Def *d, u64 a, u64 i, const Def *val) |
const Def * | insert (const Def *d, u64 i, const Def *val) |
Lit | |
const Lit * | lit (const Def *type, u64 val) |
const Lit * | lit_univ (u64 level) |
const Lit * | lit_univ_0 () |
const Lit * | lit_univ_1 () |
const Lit * | lit_nat (nat_t a) |
const Lit * | lit_nat_0 () |
const Lit * | lit_nat_1 () |
const Lit * | lit_nat_max () |
const Lit * | lit_0_1 () |
const Lit * | lit_i1 () |
const Lit * | lit_i8 () |
const Lit * | lit_i16 () |
const Lit * | lit_i32 () |
const Lit * | lit_i64 () |
const Lit * | lit_idx (nat_t size, u64 val) |
Constructs a Lit of type Idx of size size . | |
template<class I> | |
const Lit * | lit_idx (I val) |
const Lit * | lit_int (nat_t width, u64 val) |
Constructs a Lit of type Idx of size 2^width. | |
const Lit * | lit_i1 (bool val) |
const Lit * | lit_i2 (u8 val) |
const Lit * | lit_i4 (u8 val) |
const Lit * | lit_i8 (u8 val) |
const Lit * | lit_i16 (u16 val) |
const Lit * | lit_i32 (u32 val) |
const Lit * | lit_i64 (u64 val) |
const Lit * | lit_idx_mod (nat_t mod, u64 val) |
Constructs a Lit of type Idx of size mod . | |
const Lit * | lit_bool (bool val) |
const Lit * | lit_ff () |
const Lit * | lit_tt () |
Lattice | |
template<bool Up> | |
const Def * | ext (const Def *type) |
const Def * | bot (const Def *type) |
const Def * | top (const Def *type) |
const Def * | type_bot () |
const Def * | type_top () |
const Def * | top_nat () |
template<bool Up> | |
TBound< Up > * | mut_bound (const Def *type, size_t size) |
template<bool Up, level_t l = 0> | |
TBound< Up > * | mut_bound (size_t size) |
A *mut*able Bound of Type level . | |
template<bool Up> | |
const Def * | bound (Defs ops) |
Join * | mut_join (const Def *type, size_t size) |
Meet * | mut_meet (const Def *type, size_t size) |
template<level_t l = 0> | |
Join * | mut_join (size_t size) |
template<level_t l = 0> | |
Meet * | mut_meet (size_t size) |
const Def * | join (Defs ops) |
const Def * | meet (Defs ops) |
const Def * | ac (const Def *type, Defs ops) |
const Def * | ac (Defs ops) |
Infers the type using an immutable Meet. | |
const Def * | vel (const Def *type, const Def *value) |
const Def * | pick (const Def *type, const Def *value) |
const Def * | test (const Def *value, const Def *probe, const Def *match, const Def *clash) |
const Def * | uniq (const Def *inhabitant) |
Globals | |
| |
Global * | global (const Def *type, bool is_mutable=true) |
Types | |
const Nat * | type_nat () |
const Idx * | type_idx () |
const Def * | type_idx (const Def *size) |
const Def * | type_idx (nat_t size) |
const Def * | type_int (nat_t width) |
Constructs a type Idx of size 2^width. | |
const Def * | type_bool () |
const Def * | type_i1 () |
const Def * | type_i2 () |
const Def * | type_i4 () |
const Def * | type_i8 () |
const Def * | type_i16 () |
const Def * | type_i32 () |
const Def * | type_i64 () |
Cope with implicit Arguments | |
template<bool Normalize = true> | |
const Def * | implicit_app (const Def *callee, const Def *arg) |
Places Holes as demanded by Pi::is_implicit() and then apps arg . | |
template<bool Normalize = true> | |
const Def * | implicit_app (const Def *callee, Defs args) |
template<bool Normalize = true> | |
const Def * | implicit_app (const Def *callee, nat_t arg) |
template<bool Normalize = true, class E> requires std::is_enum_v<E> && std::is_same_v<std::underlying_type_t<E>, nat_t> | |
const Def * | implicit_app (const Def *callee, E arg) |
template<class Id, bool Normalize = true, class... Args> | |
const Def * | call (Id id, Args &&... args) |
Complete curried call of annexes obeying implicits. | |
template<class Id, bool Normalize = true, class... Args> | |
const Def * | call (Args &&... args) |
Vars & Muts | |
auto & | vars () |
auto & | muts () |
const auto & | vars () const |
const auto & | muts () const |
dump/log | |
Log & | log () |
void | dummy () |
void | dump (std::ostream &os) |
Dump to os . | |
void | dump () |
Dump to std::cout . | |
void | debug_dump () |
Dump in Debug build if World::log::level is Log::Level::Debug. | |
void | write (const char *file) |
Write to a file named file . | |
void | write () |
Same above but file name defaults to World::name. | |
dot | |
GraphViz output. | |
void | dot (std::ostream &os, bool annexes=false, bool types=false) const |
Dumps DOT to os . | |
void | dot (const char *file=nullptr, bool annexes=false, bool types=false) const |
Same as above but write to file or std::cout if file is nullptr . | |
Friends | |
void | swap (World &w1, World &w2) noexcept |
DefVec | Def::reduce (const Def *) |
The World represents the whole program and manages creation of MimIR nodes (Defs).
Defs are hashed into an internal HashSet. The World's factory methods just calculate a hash and lookup the Def, if it is already present, or create a new one otherwise. This corresponds to value numbering.
You can create several worlds. All worlds are completely independent from each other.
Note that types are also just Defs and will be hashed as well.
|
explicit |
Definition at line 59 of file world.cpp.
References driver(), and World().
Referenced by mim::World::Freezer::Freezer(), inherit(), operator=(), mim::World::ScopedLoc::ScopedLoc(), swap, verify(), World(), and World().
Definition at line 35 of file world.cpp.
References driver(), insert(), lit_idx(), lit_nat(), lit_univ(), lit_univ_0(), lit_univ_1(), pi(), sigma(), state(), type(), type_idx(), and type_nat().
|
inlinenoexcept |
|
inline |
|
inline |
Lookup annex by Axiom::id.
Definition at line 171 of file world.h.
References mim::Annex::demangle(), driver(), mim::error(), and flags().
Referenced by call(), dot(), and mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
|
inline |
Definition at line 181 of file world.cpp.
References mim::Checker::assignable(), axiom(), DLOG, mim::Error::error(), mim::Axiom::get(), mim::Def::isa_imm(), mim::Def::isa_mut(), lam(), lit_ff(), lit_tt(), mim::Def::loc(), mim::Error::note(), pi(), raw_app(), mim::Axiom::Trip_End, mim::Def::type(), type(), and mim::Def::zonk().
Referenced by app(), mim::plug::autodiff::AutoDiffEval::augment_app(), mim::plug::autodiff::AutoDiffEval::augment_pack(), implicit_app(), mim::plug::autodiff::op_sum(), mim::LamSpec::rewrite(), mim::plug::affine::LowerFor::rewrite(), mim::plug::direct::DS2CPS::rewrite(), mim::plug::mem::CopyProp::rewrite(), mim::TailRecElim::rewrite(), mim::plug::matrix::LowerMatrixHighLevelMapRed::rewrite_(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), and type_idx().
Sym mim::World::append_suffix | ( | Sym | name, |
std::string | suffix ) |
Definition at line 407 of file world.cpp.
References arr(), mim::error(), extract(), mim::Lit::isa(), pack(), sigma(), tuple(), tuple(), and mim::Def::unfold_type().
Referenced by arr(), arr(), arr(), arr_unsafe(), ext(), extract(), pack(), and sigma().
|
inline |
Builds a fresh Axiom with descending Axiom::sub.
This is useful during testing to come up with some entity of a specific type. It uses the plugin Axiom::Global_Plugin and starts with 0
for Axiom::sub and counts up from there. The Axiom::tag is set to 0
and the Axiom::normalizer to nullptr
.
Definition at line 242 of file world.h.
References axiom(), mim::Annex::Global_Plugin, and type().
Definition at line 431 of file world.h.
Referenced by mim::plug::autodiff::AutoDiffZeroCleanup::rewrite(), and mim::plug::clos::LowerTypedClos::start().
void mim::World::breakpoint | ( | u32 | gid | ) |
|
inline |
Complete curried call of annexes obeying implicits.
Definition at line 506 of file world.h.
References annex().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_lam(), mim::plug::clos::ClosConvPrep::eta_wrap(), mim::plug::compile::normalize_single_pass_phase(), mim::plug::affine::LowerFor::rewrite(), mim::plug::clos::LowerTypedClosPrep::rewrite(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), and mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm().
|
inline |
Definition at line 264 of file world.h.
References pi(), and type_bot().
|
inline |
|
inline |
|
inline |
void mim::World::debug_dump | ( | ) |
Dump in Debug build if World::log::level is Log::Level::Debug.
Definition at line 486 of file dump.cpp.
References mim::Log::Debug, dump(), and log().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_app(), DebugDump::prepare(), and mim::PassMan::run().
Dumps DOT to os
.
os | Output stream |
annexes | If true , include all annexes - even if unused. |
types | Follow type dependencies? |
Definition at line 147 of file dot.cpp.
References annex(), annexes(), dot(), external(), and externals().
|
inline |
Definition at line 80 of file world.h.
Referenced by annex(), mim::ast::AST::driver(), mim::ast::Emitter::driver(), dump(), flags(), inherit(), mim::ast::load_plugins(), log(), mim::optimize(), register_annex(), sym(), sym(), sym(), World(), and World().
void mim::World::dump | ( | ) |
void mim::World::dump | ( | std::ostream & | os | ) |
Dump to os
.
Definition at line 464 of file dump.cpp.
References assertf, curr_gid(), driver(), externals(), flags(), name(), and mim::print().
Referenced by debug_dump(), dump(), main(), and write().
|
inline |
Lookup by name
.
Definition at line 191 of file world.h.
References mim::lookup(), and name().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_(), dot(), mim::optimize(), and mim::plug::matrix::LowerMatrixHighLevelMapRed::rewrite_().
|
inline |
Definition at line 301 of file world.cpp.
References mim::Checker::alpha(), arr(), mim::Lit::as(), mim::Def::as_lit_arity(), mim::error(), extract(), insert(), mim::Idx::isa(), mim::Lit::isa(), mim::Def::loc(), mut_sigma(), mim::Def::num_ops(), mim::Def::op(), mim::Def::ops(), pack(), mim::Rewriter::rewrite(), sigma(), tuple(), tuple(), mim::Def::type(), type(), and WLOG.
Referenced by arr(), mim::plug::autodiff::AutoDiffEval::augment_extract(), extract(), select(), and tuple().
|
inline |
Flags & mim::World::flags | ( | ) |
Retrieve compile Flags.
Definition at line 71 of file world.cpp.
References driver(), and mim::Driver::flags().
Referenced by annex(), dump(), insert(), and mim::Def::num_tprojs().
Yields old frozen state.
Definition at line 133 of file world.h.
Referenced by mim::World::Freezer::Freezer().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
const Def * mim::World::implicit_app | ( | const Def * | callee, |
const Def * | arg ) |
Places Holes as demanded by Pi::is_implicit() and then apps arg
.
Definition at line 176 of file world.cpp.
References app(), mim::Pi::isa_implicit(), mut_hole(), pi(), and mim::Def::type().
Referenced by implicit_app(), implicit_app(), and implicit_app().
|
inline |
Definition at line 491 of file world.h.
References implicit_app(), and tuple().
|
inline |
Definition at line 498 of file world.h.
References implicit_app(), and lit_nat().
|
inline |
Definition at line 494 of file world.h.
References implicit_app(), and lit_nat().
|
inline |
Definition at line 363 of file world.cpp.
References mim::Checker::alpha(), mim::Checker::assignable(), mim::error(), mim::Error::error(), flags(), insert(), mim::Idx::isa(), mim::Lit::isa(), mim::Def::loc(), mim::Error::note(), pack(), tuple(), mim::Def::type(), and type().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_extract(), extract(), global(), insert(), mut_arr(), mut_bound(), mut_con(), mut_con(), mut_fun(), mut_fun(), mut_fun(), mut_fun(), mut_hole(), mut_lam(), mut_lam(), mut_lam(), mut_lam(), mut_lam(), mut_pack(), mut_pi(), mut_sigma(), and World().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 464 of file world.cpp.
References mim::error(), mim::Idx::isa(), mim::Lit::isa(), and type().
Referenced by lit_idx(), lit_nat(), lit_univ(), and mim::plug::demo::normalize_const().
|
inline |
|
inline |
|
inline |
Definition at line 390 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 392 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 393 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 394 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by mim::plug::mem::op_lea_unsafe().
|
inline |
Definition at line 391 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by tuple().
|
inline |
Definition at line 399 of file world.h.
References mim::Idx::bitwidth2size(), and lit_idx().
Constructs a Lit of
type Idx of size 2^width.
val = 64
will be automatically converted to size 0
- the encoding for 2^64.
Definition at line 406 of file world.h.
References mim::Idx::bitwidth2size(), and lit_idx().
Referenced by lit_i1(), lit_i16(), lit_i2(), lit_i32(), lit_i4(), lit_i64(), and lit_i8().
Definition at line 384 of file world.h.
References lit(), and type_nat().
Referenced by mim::Def::arity(), arr(), implicit_app(), implicit_app(), lit_i1(), lit_i16(), lit_i32(), lit_i64(), lit_i8(), mim::plug::refly::normalize_gid(), pack(), type_idx(), type_int(), and World().
|
inline |
Definition at line 385 of file world.h.
Referenced by mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm(), and mim::Pack::shape().
|
inline |
Definition at line 386 of file world.h.
Referenced by mim::Def::arity(), and mim::Pack::shape().
|
inline |
Definition at line 423 of file world.h.
Referenced by app(), and mim::plug::core::normalize_ncmp().
|
inline |
|
inline |
Log & mim::World::log | ( | ) |
Definition at line 70 of file world.cpp.
References driver(), and mim::Driver::log().
Referenced by debug_dump().
void mim::World::make_external | ( | Def * | def | ) |
Definition at line 87 of file world.cpp.
References mim::assert_emplace(), mim::Def::is_closed(), mim::Def::is_external(), and mim::Def::sym().
Referenced by mim::Def::make_external().
void mim::World::make_internal | ( | Def * | def | ) |
Definition at line 94 of file world.cpp.
References mim::Def::is_external(), and mim::Def::sym().
Referenced by mim::Def::make_internal().
Definition at line 436 of file world.h.
References insert(), and type().
Referenced by mut_bound(), mut_join(), and mut_meet().
Definition at line 292 of file world.h.
References cn(), and insert().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_lam(), and mim::plug::affine::LowerFor::rewrite().
Definition at line 298 of file world.h.
References fn(), and insert().
Referenced by mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
Definition at line 218 of file world.h.
References insert(), and type().
Referenced by implicit_app(), mut_hole_infer_entity(), mut_hole_type(), and mut_hole_univ().
|
inline |
Either a value ?:?:Type ?
or a type ?:Type ?:Type ?
.
Definition at line 223 of file world.h.
References mut_hole(), and type_infer_univ().
|
inline |
Definition at line 220 of file world.h.
References mut_hole(), and type_infer_univ().
|
inline |
Definition at line 219 of file world.h.
References mut_hole(), and univ().
Referenced by type_infer_univ().
Definition at line 440 of file world.h.
References mut_bound(), and type().
Definition at line 442 of file world.h.
References mut_join(), and type().
Referenced by mut_join().
Definition at line 280 of file world.h.
References insert(), and pi().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_app(), mim::plug::autodiff::AutoDiffEval::augment_extract(), mim::plug::autodiff::AutoDiffEval::augment_pack(), mim::plug::autodiff::AutoDiffEval::augment_tuple(), mim::plug::autodiff::AutoDiffEval::derive_(), and mim::RetWrap::enter().
Definition at line 441 of file world.h.
References mut_bound(), and type().
Definition at line 443 of file world.h.
References mut_meet(), and type().
Referenced by mut_meet().
Definition at line 349 of file world.h.
References insert(), and type().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_pack().
A *mut*able Sigma of type level
.
Definition at line 320 of file world.h.
References mut_sigma(), and type().
Referenced by mut_sigma().
|
inline |
Definition at line 83 of file world.h.
Referenced by append_suffix(), dump(), external(), set(), set(), and write().
|
inline |
Definition at line 89 of file world.h.
Referenced by mim::Def::Def().
Definition at line 434 of file world.cpp.
References arr(), mim::error(), mim::Lit::isa(), pack(), tuple(), tuple(), mim::Def::type(), and type().
Referenced by arr(), mim::plug::autodiff::AutoDiffEval::augment_pack(), ext(), extract(), insert(), pack(), pack(), pack(), and tuple().
Definition at line 251 of file world.h.
References mim::Pi::infer().
Referenced by app(), cn(), mim::Pi::immutabilize(), implicit_app(), lam(), lam(), lam(), lam(), lam(), mut_lam(), mut_lam(), mut_lam(), mut_lam(), mut_lam(), mim::plug::mem::CopyProp::rewrite(), test(), and World().
|
inline |
Definition at line 224 of file world.cpp.
References axiom(), mim::Axiom::get(), raw_app(), mim::Axiom::Trip_End, and type().
Definition at line 77 of file world.cpp.
References mim::assert_emplace(), mim::Annex::demangle(), DLOG, and driver().
Referenced by mim::ast::Emitter::register_annex(), and register_annex().
Definition at line 183 of file world.h.
References register_annex().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 238 of file world.cpp.
References arr(), mim::Sigma::infer(), mim::Checker::is_uniform(), and sigma().
Referenced by ext(), extract(), mim::flatten(), mim::Sigma::immutabilize(), mim::is_unit(), mim::merge_sigma(), mim::plug::affine::LowerFor::rewrite(), mim::plug::mem::CopyProp::rewrite(), and tuple().
|
inline |
Sym mim::World::sym | ( | const std::string & | s | ) |
Sym mim::World::sym | ( | std::string_view | s | ) |
Definition at line 74 of file world.cpp.
References driver().
Referenced by append_suffix(), mim::plug::autodiff::AutoDiffEval::augment_(), main(), mim::optimize(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), set(), mim::Def::sym(), mim::Def::sym(), mim::Def::sym(), and tuple().
const Def * mim::World::test | ( | const Def * | value, |
const Def * | probe, | ||
const Def * | match, | ||
const Def * | clash ) |
Definition at line 530 of file world.cpp.
References mim::Checker::alpha(), mim::Pi::codom(), mim::Pi::dom(), join(), mim::match(), pi(), and mim::Def::type().
|
inline |
Definition at line 435 of file world.h.
Referenced by arr_unsafe().
|
inline |
Ascribes type
to this tuple - needed for dependently typed and mutable Sigmas.
Definition at line 260 of file world.cpp.
References extract(), mim::Checker::is_uniform(), mim::Lit::isa(), pack(), tuple(), and type().
Definition at line 246 of file world.cpp.
References mim::Checker::assignable(), mim::error(), mim::Tuple::infer(), sigma(), and tuple().
Referenced by arr(), mim::plug::autodiff::AutoDiffEval::augment_tuple(), mim::plug::matrix::counting_for(), mim::plug::autodiff::AutoDiffEval::derive_(), mim::RetWrap::enter(), extract(), mim::flatten(), mim::merge_tuple(), pack(), mim::plug::affine::LowerFor::rewrite(), mim::plug::mem::SSAConstr::rewrite(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), and mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm().
const Def * mim::World::tuple | ( | Sym | sym | ) |
Definition at line 205 of file world.h.
References lit_univ(), and type().
Referenced by type(), type_infer_univ(), umax(), and World().
Definition at line 105 of file world.cpp.
References mim::error(), mim::Def::loc(), and mim::Def::type().
Referenced by ac(), app(), mim::plug::autodiff::AutoDiffEval::augment_app(), axiom(), axiom(), axiom(), axiom(), bot(), ext(), extract(), global(), insert(), lit(), mut_arr(), mut_arr(), mut_bound(), mut_bound(), mut_hole(), mut_join(), mut_join(), mut_meet(), mut_meet(), mut_pack(), mut_pi(), mut_sigma(), mut_sigma(), pack(), pick(), proxy(), raw_app(), raw_app(), raw_app(), mim::plug::affine::LowerFor::rewrite(), top(), tuple(), umax(), var(), and vel().
|
inline |
|
inline |
Definition at line 480 of file world.h.
References type_int().
|
inline |
Definition at line 477 of file world.h.
References type_int().
|
inline |
Definition at line 481 of file world.h.
References type_int().
Referenced by mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
|
inline |
Definition at line 478 of file world.h.
References type_int().
|
inline |
Definition at line 482 of file world.h.
References type_int().
|
inline |
Definition at line 479 of file world.h.
References type_int().
|
inline |
Definition at line 465 of file world.h.
Referenced by lit_idx(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), type_int(), and World().
size = 0
means 2^64
. Definition at line 467 of file world.h.
References app(), and type_idx().
Referenced by type_idx().
size = 0
means 2^64
. Definition at line 469 of file world.h.
References lit_nat(), and type_idx().
Referenced by type_idx().
|
inline |
Definition at line 204 of file world.h.
References mut_hole_univ(), and type().
Referenced by mut_hole_infer_entity(), and mut_hole_type().
Constructs a type Idx of size 2^width.
width = 64
will be automatically converted to size 0
- the encoding for 2^64.
Definition at line 473 of file world.h.
References mim::Idx::bitwidth2size(), lit_nat(), and type_idx().
Referenced by type_i16(), type_i2(), type_i32(), type_i4(), type_i64(), and type_i8().
|
inline |
Definition at line 112 of file world.cpp.
References mim::error(), mim::Lit::isa(), lit_univ(), mim::Def::loc(), and mim::Def::type().
Definition at line 121 of file world.cpp.
References mim::error(), mim::Lit::isa(), mim::Kind, lit_univ(), mim::Term, mim::Type, type(), type(), and mim::Univ.
Definition at line 544 of file world.cpp.
References mim::Def::type(), and mim::Def::unfold_type().
|
inline |
Definition at line 200 of file world.h.
Referenced by lit_univ(), mut_hole_univ(), and mim::Rewriter::rewrite().
Definition at line 167 of file world.cpp.
References mim::Idx::isa(), mim::Lit::isa(), lit_0_1(), type(), and var().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_extract(), mim::plug::autodiff::AutoDiffEval::augment_tuple(), mim::plug::autodiff::AutoDiffEval::derive_(), mim::plug::affine::LowerFor::rewrite(), and var().
|
inlinenodiscard |
Definition at line 514 of file world.h.
Referenced by mim::Def::free_vars(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), and mim::VarRewriter::rewrite_mut().
World & mim::World::verify | ( | ) |
Verifies that all externals() and annexes() are Def::is_closed(), if MIM_ENABLE_CHECKS
.
Definition at line 580 of file world.cpp.
References annexes(), externals(), and World().
Referenced by mim::PassMan::run(), and mim::Phase::run().
void mim::World::write | ( | ) |
Same above but file name defaults to World::name.
void mim::World::write | ( | const char * | file | ) |
|
friend |