The World represents the whole program and manages creation of MimIR nodes (Defs). More...
#include <mim/world.h>
Classes | |
| struct | CurrLoc |
| World::get_loc together with its interned DbgKey, so pushing/popping a Loc never re-interns it. More... | |
| struct | State |
| class | Externals |
| class | Annexes |
Public Types | |
| using | ScopedLoc = fe::Restore<CurrLoc> |
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 |
| Driver & | driver () |
| const Driver & | driver () const |
| fe::Error & | error () |
| const fe::Error & | error () const |
| 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 |
| DbgKey | dbg_key () const |
| World::get_loc, already interned. | |
| ScopedLoc | push (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 |
| auto | freeze () const |
| Freezes the World until the end of the scope and restores the previous frozen state afterwards: | |
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, flags_t 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 (fe::View< u64 > shape, const Def *body) |
| const Def * | pack (fe::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, fe::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) |
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> requires std::is_enum_v<Id> | |
| 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 | |
| const fe::Log & | log () const |
| Log via log().e("...", args) etc.; owned by the Driver. | |
| 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 fe::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, DotConfig cfg={}) const |
Dumps DOT to os, configured via cfg (see DotConfig). | |
| void | dot (const char *file=nullptr, DotConfig cfg={}) const |
Same as above but write to file or std::cout if file is nullptr. | |
Friends | |
| void | swap (World &w1, World &w2) noexcept |
Lit | |
| static constexpr nat_t | Num_Lit_Nats = 64 |
| Def::arity of a Sigma is lit_nat(num_ops()) and Def::num_projs reads it straight back out, so a plain World::lit would hash-cons a Lit just to launder an integer. | |
| 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 () |
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::CurrLoc |
World::get_loc together with its interned DbgKey, so pushing/popping a Loc never re-interns it.
| Class Members | ||
|---|---|---|
| DbgKey | key = {} | |
| Loc | loc = {} | |
| using mim::World::ScopedLoc = fe::Restore<CurrLoc> |
|
explicit |
Definition at line 87 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 |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 281 of file world.h.
Referenced by annex(), annex(), mim::ast::Emitter::attach(), dot(), mim::InplaceRWPhase::rewrite_annex(), mim::RWPhase::rewrite_annex(), roots(), mim::Unload::start(), and verify().
Definition at line 237 of file world.cpp.
References mim::Checker::assignable(), axm(), mim::Def::blame(), mim::Lam::body(), mim::Pi::dom(), mim::Lam::filter(), filter(), mim::Def::has_var(), mim::Def::is_set(), mim::Def::isa_imm(), mim::Def::isa_mut(), mim::Def::isa_type(), lam(), lit_ff(), lit_tt(), mim::Def::loc(), log(), mim::Axm::next(), mim::Axm::normalizer(), pi(), raw_app(), mim::Pi::reduce(), type(), mim::type_of(), var(), mim::VarRewriter::VarRewriter(), and mim::Def::zonk().
Referenced by mim::Lam::app(), app(), implicit_app(), match(), mim::plug::autodiff::op_sum(), mim::EtaConv::rewrite_imm_App(), mim::plug::affine::phase::LowerFor::rewrite_imm_App(), mim::plug::clos::phase::ClosConv::rewrite_imm_App(), mim::plug::cps::Conv::rewrite_imm_App(), mim::Scalarize::rewrite_imm_App(), mim::StaticArgOpt::rewrite_imm_App(), and type_idx().
| Sym mim::World::append_suffix | ( | Sym | name, |
| std::string | suffix ) |
Definition at line 478 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 364 of file world.h.
References axm(), mim::Annex::Global_Plugin, and type().
| void mim::World::breakpoint | ( | u32 | gid | ) |
|
inline |
|
inline |
Definition at line 662 of file world.h.
References call(), and implicit_app().
Referenced by call(), call(), call(), call(), mim::plug::affine::phase::LowerFor::rewrite_imm_App(), and mim::plug::clos::phase::LowerTypedClosPrep::rewrite_imm_Tuple().
|
inline |
|
inline |
Definition at line 386 of file world.h.
References pi(), and type_bot().
|
inline |
|
inline |
|
inline |
Manage global identifier - a unique number for each Def.
Definition at line 114 of file world.h.
Referenced by dump(), and mim::RWBase::start().
|
inline |
Manage run - used to track fixed-point iterations to compute Def::free_vars.
|
inline |
World::get_loc, already interned.
| void mim::World::debug_dump | ( | ) |
| void mim::World::dot | ( | const char * | file = nullptr, |
| DotConfig | cfg = {} ) const |
| void mim::World::dot | ( | std::ostream & | os, |
| DotConfig | cfg = {} ) const |
Dumps DOT to os, configured via cfg (see DotConfig).
Definition at line 223 of file dot.cpp.
References mim::DotConfig::all_annexes, annex(), annexes(), dot(), externals(), mim::DotConfig::max, and muts().
|
inline |
Definition at line 103 of file world.h.
Referenced by mim::Def::dbg(), mim::ast::AST::driver(), mim::ast::Emitter::driver(), mim::Def::driver(), mim::Phase::driver(), dump(), mim::plug::ll::Emitter::Emitter(), error(), error(), flags(), inherit(), mim::ast::load_plugins(), log(), mim::plug::compile::normalize_aggr(), mim::plug::compile::normalize_cond(), mim::plug::compile::normalize_is_loaded(), mim::optimize(), push(), mim::plug::gpu::phase::run_stage(), mim::Def::set_dbg(), sym(), sym(), sym(), World(), and World().
| void mim::World::dump | ( | ) |
| void mim::World::dump | ( | std::ostream & | os | ) |
Dump to os.
Definition at line 594 of file dump.cpp.
References curr_gid(), driver(), mim::ast::Lexer::escape(), externals(), flags(), freeze(), muts(), mim::Nest::Nest(), and sym().
Referenced by debug_dump(), dump(), and write().
| const fe::Error & mim::World::error | ( | ) | const |
|
inline |
Definition at line 278 of file world.h.
Referenced by dot(), dump(), mim::Def::externalize(), for_each(), mim::Def::internalize(), mim::optimize(), roots(), and verify().
Definition at line 373 of file world.cpp.
References mim::Checker::alpha(), mim::Def::arity(), arr(), mim::Idx::as_lit(), mim::Def::blame(), extract(), mim::Def::has_var(), insert(), is_frozen(), mim::Idx::isa(), mim::Lit::isa(), mim::Def::isa_imm(), mim::Def::isa_mut(), mim::Hole::isa_unset(), join(), lit_idx(), log(), mut_hole(), mim::Def::num_ops(), mim::Def::op(), mim::Def::ops(), pack(), mim::Def::reduce(), sigma(), tuple(), type(), mim::type_of(), mim::Def::unfold_type(), var(), mim::VarRewriter::VarRewriter(), and mim::Def::zonk().
Referenced by extract(), mim::Def::proj(), and select().
Definition at line 515 of file world.h.
References mim::Lit::as(), and extract().
Referenced by extract().
|
inline |
| Flags & mim::World::flags | ( | ) |
Retrieve compile Flags.
Definition at line 130 of file world.cpp.
References driver(), and mim::Driver::flags().
Referenced by annex(), annex(), mim::World::Annexes::attach(), mim::World::Annexes::attach_alias(), dump(), insert(), mim::Def::num_tprojs(), and mim::World::Annexes::reattach().
| void mim::World::for_each | ( | bool | elide_empty, |
| std::function< void(Def *)> | f, | ||
| bool | schedule = false ) |
Definition at line 739 of file world.cpp.
References externals(), mim::Def::is_closed(), mim::Def::is_set(), muts(), mim::Nest::Nest(), and mim::Scheduler::schedule().
Referenced by for_each(), and mim::Nest::Nest().
|
inline |
Definition at line 711 of file world.h.
References for_each().
|
inlinenodiscard |
Freezes the World until the end of the scope and restores the previous frozen state afterwards:
Definition at line 154 of file world.h.
Referenced by dump(), and mim::Def::operator<<.
|
inline |
|
inline |
|
inline |
|
inline |
| const Def * mim::World::implicit_app | ( | const Def * | callee, |
| const Def * | arg ) |
Definition at line 230 of file world.cpp.
References app(), mim::Pi::dom(), mim::Pi::isa_implicit(), mut_hole(), pi(), and mim::Def::unfold_type().
Referenced by call(), call(), implicit_app(), implicit_app(), and implicit_app().
|
inline |
Definition at line 644 of file world.h.
References implicit_app(), and tuple().
|
inline |
Definition at line 652 of file world.h.
References implicit_app(), and lit_nat().
|
inline |
Definition at line 648 of file world.h.
References implicit_app(), and lit_nat().
|
inline |
Definition at line 636 of file world.cpp.
References type(), and mim::Def::zonk().
Referenced by match().
Definition at line 482 of file world.cpp.
References mim::Checker::alpha(), mim::Def::arity(), mim::Checker::assignable(), mim::Def::blame(), flags(), insert(), mim::Idx::isa(), mim::Lit::isa(), pack(), mim::Def::proj(), tuple(), type(), mim::type_of(), mim::Def::unfold_type(), and mim::Def::zonk().
Referenced by 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 527 of file world.h.
References mim::Lit::as(), and insert().
Referenced by insert().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 564 of file world.cpp.
References 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 550 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
|
inline |
Definition at line 552 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 553 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 554 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by mim::plug::mem::op_lea_unsafe().
|
inline |
Definition at line 551 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by tuple().
|
inline |
Definition at line 560 of file world.h.
References mim::Idx::bitwidth2size(), and lit_idx().
|
inline |
Definition at line 558 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 567 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(), Num_Lit_Nats, and type_nat().
Referenced by mim::Def::arity(), implicit_app(), implicit_app(), lit_i1(), lit_i16(), lit_i32(), lit_i64(), lit_i8(), mim::plug::refly::normalize_gid(), seq(), seq(), type_idx(), type_int(), and World().
|
inline |
Definition at line 545 of file world.h.
Referenced by mim::Def::arity().
|
inline |
Definition at line 546 of file world.h.
Referenced by mim::Def::arity().
|
inline |
|
inline |
|
inline |
| const fe::Log & mim::World::log | ( | ) | const |
Log via log().e("...", args) etc.; owned by the Driver.
Definition at line 129 of file world.cpp.
References driver(), and mim::Driver::log().
Referenced by annex(), app(), mim::Phase::create(), debug_dump(), extract(), mim::plug::ll::Emitter::load_rt_module(), mim::optimize(), mim::Phase::run(), mim::Scheduler::smart(), mim::plug::ll::Emit::start(), and mim::plug::ll_nvptx::Emit::start().
Definition at line 651 of file world.cpp.
References mim::Checker::alpha(), app(), mim::Def::blame(), mim::Pi::codom(), mim::Pi::dom(), inj(), mim::Def::isa_type(), join(), mim::Def::num_ops(), mim::Def::op(), pi(), type(), mim::type_of(), mim::Def::unfold_type(), and mim::Def::zonk().
Definition at line 414 of file world.h.
References cn(), and insert().
Referenced by mim::plug::affine::phase::LowerFor::rewrite_imm_App().
Definition at line 340 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 345 of file world.h.
References mut_hole(), and type_infer_univ().
|
inline |
Definition at line 342 of file world.h.
References mut_hole(), and type_infer_univ().
Referenced by mim::tuple_of_dict().
|
inline |
Definition at line 341 of file world.h.
References mut_hole(), and univ().
Referenced by type_infer_univ().
Definition at line 402 of file world.h.
References insert(), and pi().
Referenced by mim::plug::cps::Conv::rewrite_mut_Lam(), mim::plug::mem::phase::AddMem::rewrite_mut_Lam(), and mim::RetWrap::rewrite_mut_Lam().
Definition at line 491 of file world.h.
References insert(), and type().
Referenced by mut_arr(), mut_pack(), and mim::Rewriter::rewrite_mut_Seq().
A mutable Sigma of type level.
Definition at line 454 of file world.h.
References mut_sigma(), and type().
|
inlinenodiscard |
Definition at line 695 of file world.h.
Referenced by mim::Def::Def(), dot(), dump(), for_each(), roots(), and verify().
|
inline |
Definition at line 109 of file world.h.
Referenced by append_suffix(), operator=(), mim::World::Externals::operator[](), set(), set(), mim::plug::ll::Emit::start(), mim::plug::ll_nvptx::Emit::start(), mim::World::State::State(), World(), and write().
|
inline |
Definition at line 115 of file world.h.
Referenced by mim::Def::Def(), and mim::Def::Def().
Definition at line 479 of file world.h.
References seq_unsafe().
|
inline |
Definition at line 481 of file world.h.
References sigma(), and tuple().
Referenced by mim::Rewriter::rewrite_imm_Seq(), and mim::Rewriter::rewrite_mut_Seq().
|
nodiscard |
Definition at line 303 of file world.cpp.
References axm(), mim::Axm::next(), raw_app(), 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 729 of file world.cpp.
References mim::Var::binder(), mim::Def::num_ops(), mim::Def::reduction_offset(), var(), and mim::VarRewriter::VarRewriter().
Definition at line 429 of file world.h.
References mim::Reform::infer().
|
inline |
annexes() + externals().muts() in this order.
Definition at line 285 of file world.h.
References annexes(), externals(), and muts().
Referenced by mim::plug::tensor::count_consumers().
Definition at line 535 of file world.cpp.
References arr(), mim::Def::blame(), mim::Lit::isa(), mim::Def::proj(), seq(), tuple(), 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 498 of file world.h.
References seq(), and top_nat().
Referenced by arr_unsafe(), and pack_unsafe().
|
inline |
|
inline |
Definition at line 316 of file world.cpp.
References arr(), mim::Sigma::infer(), mim::Checker::is_uniform(), sigma(), and mim::Def::zonk().
Referenced by mim::Def::arity(), mim::cat_sigma(), cn(), cn(), ext(), extract(), fn(), fn(), fn(), mim::is_unit(), pi(), pi(), pi(), prod(), prod(), mim::plug::affine::phase::LowerFor::rewrite_imm_App(), sigma(), tuple(), unit(), and World().
Definition at line 644 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 133 of file world.cpp.
References driver().
Referenced by annex(), append_suffix(), mim::World::Annexes::attach(), mim::World::Annexes::attach(), mim::World::Annexes::attach_alias(), mim::World::Annexes::attach_alias(), dump(), mim::optimize(), set(), mim::Def::sym(), mim::Def::sym(), mim::Def::sym(), tuple(), and write().
Definition at line 592 of file world.h.
Referenced by lit_idx_unsafe().
|
inline |
Definition at line 595 of file world.h.
Referenced by seq_unsafe().
|
inline |
Ascribes type to this tuple - needed for dependently typed and mutable Sigmas.
Definition at line 341 of file world.cpp.
References mim::Checker::is_uniform(), mim::Lit::isa(), pack(), tuple(), type(), and mim::Def::zonk().
Definition at line 326 of file world.cpp.
References mim::Checker::assignable(), mim::Tuple::infer(), sigma(), tuple(), mim::type_of(), and mim::Def::zonk().
Referenced by app(), mim::plug::clos::apply_closure(), mim::cat_tuple(), ext(), extract(), implicit_app(), insert(), mim::Rewriter::map(), mim::Rewriter::map(), mim::Rewriter::map(), prod(), prod(), raw_app(), mim::plug::affine::phase::LowerFor::rewrite_imm_App(), mim::plug::mem::phase::SEO::rewrite_imm_App(), select(), seq(), tuple(), tuple(), tuple(), mim::tuple_of_dict(), unit(), and var().
| const Def * mim::World::tuple | ( | Sym | sym | ) |
Definition at line 329 of file world.h.
References lit_univ(), and type().
Definition at line 140 of file world.cpp.
References mim::Def::blame(), mim::Def::isa_type(), mim::type_of(), 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(), split(), top(), tuple(), type(), type_infer_univ(), umax(), and World().
|
inline |
|
inline |
Definition at line 632 of file world.h.
References type_int().
|
inline |
Definition at line 629 of file world.h.
References type_int().
|
inline |
Definition at line 633 of file world.h.
References type_int().
|
inline |
Definition at line 630 of file world.h.
References type_int().
|
inline |
Definition at line 634 of file world.h.
References type_int().
Referenced by mim::plug::affine::phase::LowerIndex::rewrite().
|
inline |
Definition at line 631 of file world.h.
References type_int().
|
inline |
Definition at line 617 of file world.h.
Referenced by lit_idx(), lit_idx_unsafe(), type_int(), mim::Def::var_type(), and World().
Definition at line 619 of file world.h.
References app(), and type_idx().
Referenced by type_idx().
Definition at line 621 of file world.h.
References lit_nat(), and type_idx().
Referenced by type_idx().
|
inline |
Definition at line 327 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 625 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 616 of file world.h.
Referenced by lit_idx_unsafe(), lit_nat(), and World().
Definition at line 151 of file world.cpp.
References mim::Lit::isa(), lit_univ(), and mim::type_of().
Definition at line 171 of file world.cpp.
References mim::flatten_umax(), mim::Lit::isa(), mim::UMax::Kind, mim::Type::level(), lit_univ(), mim::UMax::Term, mim::UMax::Type, type(), mim::type_of(), umax(), and mim::UMax::Univ.
Referenced by bound(), mim::drop_self(), merge(), and umax().
Definition at line 701 of file world.cpp.
References mim::Def::blame(), mim::Def::unfold_type(), and mim::Def::zonk().
|
inline |
|
inline |
Definition at line 322 of file world.h.
Referenced by lit_univ(), and mut_hole_univ().
Definition at line 216 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::EtaConv::rewrite_imm_Var(), mim::Def::var(), and var().
|
inlinenodiscard |
Definition at line 694 of file world.h.
Referenced by mim::Def::Def(), 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 784 of file world.cpp.
References annexes(), externals(), muts(), and World().
Referenced by mim::Phase::run().
| void mim::World::watchpoint | ( | u32 | gid | ) |
| void mim::World::write | ( | ) |
| void mim::World::write | ( | const char * | file | ) |
|
inline |
Definition at line 107 of file world.h.
Referenced by mim::Def::zonk(), and mim::Def::zonk_mut().
|
staticconstexpr |
Def::arity of a Sigma is lit_nat(num_ops()) and Def::num_projs reads it straight back out, so a plain World::lit would hash-cons a Lit just to launder an integer.
Worth ~4% of an -Og Debug compile.
Definition at line 538 of file world.h.
Referenced by lit_nat().