The World represents the whole program and manages creation of MimIR nodes (Defs). More...
#include <mim/world.h>
Classes | |
| struct | State |
| struct | ScopedLoc |
| struct | Freezer |
| Use to World::freeze and automatically unfreeze at the end of scope. More... | |
| class | Externals |
| class | Annexes |
| struct | Move.arena |
Public Member Functions | |
Construction & Destruction | |
| World & | operator= (World)=delete |
| World (Driver *, Sym name) | |
| World (Driver *, const State &) | |
| World (World &&other) noexcept | |
| ~World () | |
| std::unique_ptr< World > | inherit () |
| Inherits the State into the new World. | |
Getters/Setters | |
| const State & | state () const |
| const Driver & | driver () const |
| Driver & | driver () |
| Zonker & | zonker () |
| 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 | curr_run () const |
| Manage run - used to track fixed-point iterations to compute Def::free_vars. | |
| 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 | do_freeze (bool on=true) const |
| Yields old frozen state. | |
| Freezer | freeze () |
| Use like this to freeze and automatically unfreeze: | |
Debugging Features | |
| const auto & | breakpoints () |
| const auto & | watchpoints () |
| const Def * | gid2def (u32 gid) |
Lookup Def by gid. | |
| void | breakpoint (u32 gid) |
Trigger breakpoint in your debugger when creating a Def with this gid. | |
| void | watchpoint (u32 gid) |
Trigger breakpoint in your debugger when Def::setting a Def with this gid. | |
| World & | verify () |
| Verifies that all externals() and annexes() are Def::is_closed(), if MIM_ENABLE_CHECKS. | |
Externals & Annexes | |
| const Externals & | externals () const |
| Externals & | externals () |
| Annexes & | annexes () |
| const Annexes & | annexes () const |
| auto | roots () const |
| annexes() + externals().muts() in this order. | |
| const Def * | annex (Sym sym) |
| Lookup annex by Sym. | |
| const Def * | annex (flags_t flags) |
| Lookup annex by flags. | |
| template<class Id> | |
| const Def * | annex (Id id) |
| Lookup annex by Axm::id. | |
| template<annex_without_subs id> | |
| const Def * | annex () |
| Get Axm from a plugin. | |
Univ, Type, Var, Proxy, Hole | |
| const Univ * | univ () |
| const Def * | uinc (const Def *op, level_t offset=1) |
| template<int sort = UMax::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 (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 ?. | |
Axm | |
| const Axm * | axm (NormalizeFn n, u8 curry, u8 trip, const Def *type, plugin_t p, tag_t t, sub_t s) |
| const Axm * | axm (const Def *type, plugin_t p, tag_t t, sub_t s) |
| const Axm * | axm (NormalizeFn n, u8 curry, u8 trip, const Def *type) |
| Builds a fresh Axm with descending Axm::sub. | |
| const Axm * | axm (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) |
Rewrite Rules | |
| const Reform * | reform (const Def *dom) |
| Rule * | mut_rule (const Reform *type) |
| const Rule * | rule (const Reform *type, const Def *lhs, const Def *rhs, const Def *guard) |
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 Axm *axm, 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 mutable Sigma of type level. | |
| const Def * | sigma (Defs ops) |
| const Sigma * | sigma () |
| The unit type within Type 0. | |
Arr & Pack | |
| template<level_t level = 0> | |
| Arr * | mut_arr () |
| Arr * | mut_arr (const Def *type) |
| Pack * | mut_pack (const Def *type) |
| const Def * | arr (const Def *arity, const Def *body) |
| const Def * | pack (const Def *arity, const Def *body) |
| const Def * | arr (Defs shape, const Def *body) |
| const Def * | pack (Defs shape, const Def *body) |
| const Def * | arr (u64 n, const Def *body) |
| const Def * | pack (u64 n, const Def *body) |
| const Def * | arr (View< u64 > shape, const Def *body) |
| const Def * | pack (View< u64 > shape, const Def *body) |
| const Def * | arr_unsafe (const Def *body) |
| const Def * | pack_unsafe (const Def *body) |
| const Def * | prod (bool term, Defs ops) |
| const Def * | prod (bool term) |
Seq | |
| const Def * | unit (bool is_pack) |
| Seq * | mut_seq (bool is_pack, const Def *type) |
| const Def * | seq (bool is_pack, const Def *arity, const Def *body) |
| const Def * | seq (bool is_pack, Defs shape, const Def *body) |
| const Def * | seq (bool is_pack, u64 n, const Def *body) |
| const Def * | seq (bool is_pack, View< u64 > shape, const Def *body) |
| const Def * | seq_unsafe (bool is_pack, 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»'. | |
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_idx_1_0 () |
| 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. | |
| const Lit * | lit_idx_unsafe (u64 val) |
| 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> | |
| const Def * | bound (Defs ops) |
| const Def * | join (Defs ops) |
| const Def * | meet (Defs ops) |
| const Def * | merge (const Def *type, Defs ops) |
| const Def * | merge (Defs ops) |
| Infers the type using a Meet. | |
| const Def * | inj (const Def *type, const Def *value) |
| const Def * | split (const Def *type, const Def *value) |
| const Def * | match (Defs) |
| 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 () |
implicit_app - Cope with implicit Arguments | |
Places Holes as demanded by Pi::is_implicit() and then apps | |
| template<bool Normalize = true> | |
| const Def * | implicit_app (const Def *callee, const Def *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) |
call | |
Complete curried call of | |
| template<bool Normalize = true, class T, class... Args> | |
| const Def * | call (const Def *callee, T &&arg, Args &&... args) |
| template<bool Normalize = true, class T> | |
| const Def * | call (const Def *callee, T &&arg) |
| Base case. | |
| template<Enum Id, bool Normalize = true, class... Args> | |
| const Def * | call (Id id, Args &&... args) |
| Annex overload with enum instance as first argument. | |
| template<class Id, bool Normalize = true, class... Args> | |
| const Def * | call (Args &&... args) |
Annex overload with enum tempalte argument Id for annexes w/o subtag. | |
| template<bool Normalize = true, class... Args> | |
| const Def * | call (flags_t id, Args &&... args) |
| Annex overload with flags_t as first argument. | |
Vars & Muts | |
| auto & | vars () |
| auto & | muts () |
| const auto & | vars () const |
| const auto & | muts () const |
| Defs | reduce (const Var *var, const Def *arg) |
| Yields the new body of [mut->var() -> arg]mut. | |
for_each | |
Visits all closed mutables in this World. | |
| void | for_each (bool elide_empty, std::function< void(Def *)>, bool schedule=false) |
| template<class M> | |
| void | for_each (bool elide_empty, std::function< void(M *)> f, bool schedule=false) |
dump/log | |
| Log & | log () const |
| 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 |
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.
| struct mim::World::Move.arena |
|
explicit |
Definition at line 89 of file world.cpp.
References driver(), name(), and World().
Referenced by mim::World::Freezer::Freezer(), operator=(), mim::World::ScopedLoc::ScopedLoc(), swap, verify(), World(), and World().
Definition at line 63 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 |
Lookup annex by flags.
Definition at line 304 of file world.h.
References annexes(), mim::Annex::demangle(), driver(), ELOG, flags(), and mim::lookup().
|
inline |
|
inline |
|
inline |
Definition at line 285 of file world.h.
Referenced by annex(), annex(), mim::ast::Emitter::attach(), dot(), dot(), mim::EtaExpPhase::rewrite_annex(), mim::RWPhase::rewrite_annex(), roots(), and verify().
Definition at line 205 of file world.cpp.
References mim::assert_emplace(), mim::Checker::assignable(), axm(), DLOG, mim::Error::error(), filter(), mim::Axm::get(), mim::Def::isa_imm(), mim::Def::isa_mut(), lam(), lit_ff(), lit_tt(), mim::Def::loc(), mim::Error::note(), pi(), raw_app(), mim::Axm::Trip_End, mim::Def::type(), type(), var(), and mim::Def::zonk().
Referenced by mim::Lam::app(), app(), mim::plug::autodiff::Eval::augment_app(), mim::plug::autodiff::Eval::augment_pack(), implicit_app(), mim::plug::autodiff::op_sum(), mim::LamSpec::rewrite(), mim::TailRecElim::rewrite(), mim::plug::matrix::LowerMatrixHighLevelMapRed::rewrite_(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), mim::EtaExpPhase::rewrite_imm_App(), mim::plug::affine::phase::LowerFor::rewrite_imm_App(), mim::plug::direct::DS2CPS::rewrite_imm_App(), and type_idx().
| Sym mim::World::append_suffix | ( | Sym | name, |
| std::string | suffix ) |
Definition at line 482 of file world.h.
References seq_unsafe().
|
inline |
Builds a fresh Axm with descending Axm::sub.
This is useful during testing to come up with some entity of a specific type. It uses the plugin Axm::Global_Plugin and starts with 0 for Axm::sub and counts up from there. The Axm::tag is set to 0 and the Axm::normalizer to nullptr.
Definition at line 368 of file world.h.
References axm(), mim::Annex::Global_Plugin, and type().
Definition at line 587 of file world.h.
Referenced by mim::plug::clos::LowerTypedClos::start().
| void mim::World::breakpoint | ( | u32 | gid | ) |
|
inline |
|
inline |
Definition at line 659 of file world.h.
References call(), and implicit_app().
Referenced by mim::plug::autodiff::Eval::augment_lam(), call(), call(), call(), call(), mim::plug::clos::ClosConvPrep::eta_wrap(), mim::plug::clos::LowerTypedClosPrep::rewrite(), mim::plug::mem::pass::SSA::rewrite(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), and mim::plug::affine::phase::LowerFor::rewrite_imm_App().
|
inline |
|
inline |
Definition at line 390 of file world.h.
References pi(), and type_bot().
|
inline |
|
inline |
|
inline |
|
inline |
Manage run - used to track fixed-point iterations to compute Def::free_vars.
| void mim::World::debug_dump | ( | ) |
Dump in Debug build if World::log::level is Log::Level::Debug.
Definition at line 590 of file dump.cpp.
References mim::Log::Debug, dump(), and log().
Referenced by mim::plug::autodiff::Eval::augment_app(), mim::PassMan::run(), mim::plug::direct::CPS2DSPhase::start(), and mim::ReplManPhase::start().
|
inline |
Yields old frozen state.
Definition at line 161 of file world.h.
Referenced by mim::World::Freezer::Freezer().
| void mim::World::dot | ( | const char * | file = nullptr, |
| bool | annexes = false, | ||
| bool | types = false ) const |
| void mim::World::dot | ( | std::ostream & | os, |
| bool | annexes = false, | ||
| bool | types = false ) const |
|
inline |
Definition at line 93 of file world.h.
Referenced by annex(), mim::World::Annexes::attach(), mim::ast::AST::driver(), mim::ast::Emitter::driver(), mim::Stage::driver(), dump(), flags(), inherit(), mim::ast::load_plugins(), log(), mim::plug::compile::normalize_cond_phase(), mim::plug::compile::normalize_is_loaded(), mim::optimize(), sym(), sym(), sym(), World(), and World().
| void mim::World::dump | ( | ) |
| void mim::World::dump | ( | std::ostream & | os | ) |
Dump to os.
Definition at line 566 of file dump.cpp.
References curr_gid(), driver(), externals(), flags(), muts(), and sym().
Referenced by debug_dump(), dump(), main(), and write().
|
inline |
Definition at line 282 of file world.h.
Referenced by mim::plug::autodiff::Eval::augment_(), dot(), dump(), mim::Def::externalize(), for_each(), mim::Def::internalize(), mim::optimize(), mim::plug::matrix::LowerMatrixHighLevelMapRed::rewrite_(), roots(), and verify().
Definition at line 362 of file world.cpp.
References mim::Checker::alpha(), arr(), mim::Idx::as_lit(), mim::error(), extract(), insert(), is_frozen(), mim::Idx::isa(), mim::Lit::isa(), mim::isa_indicies(), mim::Hole::isa_unset(), join(), lit_idx(), mut_hole(), mim::Def::ops(), pack(), mim::VarRewriter::rewrite(), sigma(), tuple(), type(), var(), and WLOG.
Referenced by mim::plug::autodiff::Eval::augment_extract(), extract(), select(), and tuple().
Definition at line 519 of file world.h.
References mim::Lit::as(), and extract().
Referenced by extract().
|
inline |
| Flags & mim::World::flags | ( | ) |
Retrieve compile Flags.
Definition at line 102 of file world.cpp.
References driver(), and mim::Driver::flags().
Referenced by annex(), annex(), mim::World::Annexes::attach(), dump(), insert(), and mim::Def::num_tprojs().
| void mim::World::for_each | ( | bool | elide_empty, |
| std::function< void(Def *)> | f, | ||
| bool | schedule = false ) |
Definition at line 699 of file world.cpp.
References mim::unique_queue< Set >::empty(), externals(), mim::Def::is_closed(), mim::Def::is_set(), muts(), mim::unique_queue< Set >::pop(), mim::unique_queue< Set >::push(), and mim::Scheduler::schedule().
Referenced by for_each(), and mim::plug::direct::CPS2DSPhase::start().
|
inline |
Definition at line 709 of file world.h.
References for_each().
|
inline |
Use like this to freeze and automatically unfreeze:
Definition at line 174 of file world.h.
Referenced by mim::Def::operator<<.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| const Def * mim::World::implicit_app | ( | const Def * | callee, |
| const Def * | arg ) |
Definition at line 198 of file world.cpp.
References app(), mim::Pi::isa_implicit(), mut_hole(), pi(), and mim::Def::type().
Referenced by call(), call(), implicit_app(), implicit_app(), and implicit_app().
|
inline |
Definition at line 640 of file world.h.
References implicit_app(), and tuple().
|
inline |
Definition at line 648 of file world.h.
References implicit_app(), and lit_nat().
|
inline |
Definition at line 644 of file world.h.
References implicit_app(), and lit_nat().
|
inline |
Definition at line 607 of file world.cpp.
References type(), and mim::Def::zonk().
Definition at line 452 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(), type(), and mim::Def::zonk().
Referenced by mim::plug::autodiff::Eval::augment_extract(), extract(), global(), insert(), 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_pi(), mut_rule(), mut_seq(), mut_sigma(), and World().
Definition at line 531 of file world.h.
References mim::Lit::as(), and insert().
Referenced by insert().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 534 of file world.cpp.
References mim::error(), mim::Idx::isa(), mim::Lit::isa(), and type().
Referenced by lit_idx(), lit_idx_unsafe(), lit_nat(), and lit_univ().
|
inline |
|
inline |
|
inline |
Definition at line 546 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
|
inline |
Definition at line 548 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 549 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 550 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by mim::plug::mem::op_lea_unsafe().
|
inline |
Definition at line 547 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by tuple().
|
inline |
Definition at line 556 of file world.h.
References mim::Idx::bitwidth2size(), and lit_idx().
|
inline |
Definition at line 554 of file world.h.
References lit(), top(), type_idx(), and type_nat().
Referenced by mim::plug::core::normalize_idx_unsafe().
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 563 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 540 of file world.h.
References lit(), and type_nat().
Referenced by mim::Sigma::arity(), implicit_app(), implicit_app(), lit_i1(), lit_i16(), lit_i32(), lit_i64(), lit_i8(), mim::plug::refly::normalize_gid(), seq(), type_idx(), type_int(), and World().
|
inline |
Definition at line 541 of file world.h.
Referenced by mim::Pack::arity().
|
inline |
Definition at line 542 of file world.h.
Referenced by mim::Def::arity(), and mim::Pack::arity().
|
inline |
|
inline |
|
inline |
| Log & mim::World::log | ( | ) | const |
Definition at line 101 of file world.cpp.
References driver(), and mim::Driver::log().
Referenced by debug_dump().
Definition at line 622 of file world.cpp.
References mim::Checker::alpha(), mim::error(), mim::Def::gid(), join(), pi(), mim::Def::type(), type(), and mim::Def::zonk().
Definition at line 418 of file world.h.
References cn(), and insert().
Referenced by mim::plug::autodiff::Eval::augment_lam(), and mim::plug::affine::phase::LowerFor::rewrite_imm_App().
Definition at line 424 of file world.h.
References fn(), and insert().
Referenced by mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
Definition at line 344 of file world.h.
References insert(), and type().
Referenced by extract(), implicit_app(), mut_hole_infer_entity(), mut_hole_type(), mut_hole_univ(), and mim::tuple_of_dict().
|
inline |
Either a value ?:?:Type ? or a type ?:Type ?:Type ?.
Definition at line 349 of file world.h.
References mut_hole(), and type_infer_univ().
|
inline |
Definition at line 346 of file world.h.
References mut_hole(), and type_infer_univ().
Referenced by mim::tuple_of_dict().
|
inline |
Definition at line 345 of file world.h.
References mut_hole(), and univ().
Referenced by type_infer_univ().
Definition at line 406 of file world.h.
References insert(), and pi().
Referenced by mim::plug::autodiff::Eval::augment_app(), mim::plug::autodiff::Eval::augment_extract(), mim::plug::autodiff::Eval::augment_pack(), mim::plug::autodiff::Eval::augment_tuple(), mim::plug::autodiff::Eval::derive_(), mim::SymExprOpt::rewrite_imm_App(), and mim::RetWrap::rewrite_mut_Lam().
Definition at line 473 of file world.h.
References mut_seq(), and type().
Referenced by mim::plug::autodiff::Eval::augment_pack().
A mutable Sigma of type level.
Definition at line 458 of file world.h.
References mut_sigma(), and type().
|
inlinenodiscard |
|
inline |
Definition at line 97 of file world.h.
Referenced by append_suffix(), operator=(), mim::World::Externals::operator[](), set(), set(), mim::plug::ll::Emit::start(), mim::World::State::State(), World(), and write().
|
inline |
Definition at line 103 of file world.h.
Referenced by mim::Def::Def().
Definition at line 483 of file world.h.
References seq_unsafe().
Definition at line 377 of file world.h.
References mim::Pi::infer().
Referenced by app(), cn(), mim::Pi::immutabilize(), implicit_app(), lam(), lam(), lam(), lam(), lam(), match(), mut_lam(), mut_lam(), mut_lam(), mut_lam(), mut_lam(), mim::plug::mem::pass::CopyProp::rewrite(), and World().
|
inline |
Definition at line 485 of file world.h.
References sigma(), and tuple().
Referenced by mim::Rewriter::rewrite_imm_Seq(), and mim::Rewriter::rewrite_mut_Seq().
|
inline |
Definition at line 269 of file world.cpp.
References axm(), mim::Axm::get(), raw_app(), mim::Axm::Trip_End, type(), and mim::Def::zonk().
Yields the new body of [mut->var() -> arg]mut.
The new body may have fewer elements as mut->num_ops() according to Def::reduction_offset. E.g. a Pi has a Pi::reduction_offset of 1, and only Pi::dom will be reduced - not Pi::codom.
Definition at line 683 of file world.cpp.
References mim::assert_emplace(), and var().
Definition at line 433 of file world.h.
References mim::Reform::infer().
|
inline |
annexes() + externals().muts() in this order.
Definition at line 289 of file world.h.
References annexes(), externals(), and muts().
Definition at line 501 of file world.cpp.
References arr(), mim::error(), mim::Lit::isa(), mim::Def::loc(), mim::Def::proj(), seq(), tuple(), mim::Def::type(), type(), mim::Def::unfold_type(), unit(), and mim::Def::zonk().
Referenced by arr(), arr(), arr(), arr(), pack(), pack(), pack(), pack(), mim::Rewriter::rewrite_imm_Seq(), seq(), seq(), seq(), and seq_unsafe().
Definition at line 502 of file world.h.
References seq(), and top_nat().
Referenced by arr_unsafe(), and pack_unsafe().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 287 of file world.cpp.
References arr(), mim::Sigma::infer(), mim::Checker::is_uniform(), sigma(), and mim::Def::zonk().
Referenced by mim::cat_sigma(), ext(), extract(), mim::flatten(), mim::Sigma::immutabilize(), mim::is_unit(), mim::plug::mem::pass::CopyProp::rewrite(), mim::plug::affine::phase::LowerFor::rewrite_imm_App(), and tuple().
Definition at line 615 of file world.cpp.
References type(), and mim::Def::zonk().
|
inline |
| Sym mim::World::sym | ( | const char * | s | ) |
| Sym mim::World::sym | ( | const std::string & | s | ) |
| Sym mim::World::sym | ( | std::string_view | s | ) |
Definition at line 105 of file world.cpp.
References driver().
Referenced by annex(), append_suffix(), mim::World::Annexes::attach(), mim::World::Annexes::attach(), mim::plug::autodiff::Eval::augment_(), dump(), main(), mim::optimize(), mim::plug::matrix::LowerMatrixHighLevelMapRed::rewrite_(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), set(), mim::Def::sym(), mim::Def::sym(), mim::Def::sym(), tuple(), and write().
Definition at line 588 of file world.h.
Referenced by lit_idx_unsafe().
|
inline |
Definition at line 591 of file world.h.
Referenced by seq_unsafe().
|
inline |
Ascribes type to this tuple - needed for dependently typed and mutable Sigmas.
Definition at line 312 of file world.cpp.
References extract(), mim::Checker::is_uniform(), mim::Lit::isa(), pack(), tuple(), type(), and mim::Def::zonk().
Definition at line 297 of file world.cpp.
References mim::Checker::assignable(), mim::error(), mim::Tuple::infer(), sigma(), tuple(), and mim::Def::zonk().
Referenced by mim::plug::autodiff::Eval::augment_tuple(), mim::cat_tuple(), mim::plug::matrix::counting_for(), mim::plug::autodiff::Eval::derive_(), extract(), mim::flatten(), mim::Rewriter::map(), mim::Rewriter::map(), mim::Rewriter::map(), mim::plug::mem::pass::SSA::rewrite(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), mim::plug::affine::phase::LowerFor::rewrite_imm_App(), and mim::tuple_of_dict().
| const Def * mim::World::tuple | ( | Sym | sym | ) |
Definition at line 333 of file world.h.
References lit_univ(), and type().
Referenced by type(), type_infer_univ(), umax(), and World().
Definition at line 112 of file world.cpp.
References mim::error(), mim::Def::loc(), mim::Def::type(), and mim::Def::zonk().
Referenced by app(), axm(), axm(), axm(), axm(), bot(), ext(), extract(), global(), inj(), insert(), lit(), match(), merge(), mut_arr(), mut_arr(), mut_hole(), mut_pack(), mut_pi(), mut_rule(), mut_seq(), mut_sigma(), mut_sigma(), proxy(), raw_app(), raw_app(), raw_app(), rule(), seq(), split(), top(), tuple(), and umax().
|
inline |
|
inline |
Definition at line 628 of file world.h.
References type_int().
|
inline |
Definition at line 625 of file world.h.
References type_int().
|
inline |
Definition at line 629 of file world.h.
References type_int().
Referenced by mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
|
inline |
Definition at line 626 of file world.h.
References type_int().
|
inline |
Definition at line 630 of file world.h.
References type_int().
Referenced by mim::plug::affine::phase::LowerIndex::rewrite().
|
inline |
Definition at line 627 of file world.h.
References type_int().
|
inline |
Definition at line 613 of file world.h.
Referenced by lit_idx(), lit_idx_unsafe(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), type_int(), and World().
Definition at line 615 of file world.h.
References app(), and type_idx().
Referenced by type_idx().
Definition at line 617 of file world.h.
References lit_nat(), and type_idx().
Referenced by type_idx().
|
inline |
Definition at line 331 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 621 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 612 of file world.h.
Referenced by lit_idx_unsafe(), lit_nat(), and World().
Definition at line 122 of file world.cpp.
References mim::error(), mim::Lit::isa(), and lit_univ().
Definition at line 142 of file world.cpp.
References mim::error(), mim::flatten_umax(), mim::Lit::isa(), mim::UMax::Kind, lit_univ(), mim::UMax::Term, mim::UMax::Type, type(), type(), umax(), and mim::UMax::Univ.
Definition at line 658 of file world.cpp.
References mim::Def::type(), mim::Def::unfold_type(), and mim::Def::zonk().
|
inline |
|
inline |
Definition at line 326 of file world.h.
Referenced by lit_univ(), and mut_hole_univ().
Definition at line 184 of file world.cpp.
References mim::Idx::isa(), mim::Lit::isa(), lit_idx_1_0(), tuple(), var(), and mim::Def::var_type().
Referenced by app(), extract(), reduce(), mim::EtaExpPhase::rewrite_imm_Var(), mim::EtaRedPhase::rewrite_imm_Var(), mim::Def::var(), and var().
|
inlinenodiscard |
Definition at line 692 of file world.h.
Referenced by mim::Def::free_vars(), 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 744 of file world.cpp.
References annexes(), externals(), muts(), and World().
Referenced by mim::PassMan::run(), mim::Phase::run(), and mim::ReplManPhase::start().
| void mim::World::watchpoint | ( | u32 | gid | ) |
| void mim::World::write | ( | ) |
| void mim::World::write | ( | const char * | file | ) |
|
inline |
Definition at line 95 of file world.h.
Referenced by mim::Def::zonk(), and mim::Def::zonk_mut().