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 () |
Ref | 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 *def) |
void | make_internal (Def *def) |
Univ, Type, Var, Proxy, Infer | |
const Univ * | univ () |
Ref | uinc (Ref op, level_t offset=1) |
template<Sort = Sort::Univ> | |
Ref | umax (Defs) |
const Type * | type (Ref level) |
const Type * | type_infer_univ () |
template<level_t level = 0> | |
const Type * | type () |
Ref | var (Ref type, Def *mut) |
const Proxy * | proxy (Ref type, Defs ops, u32 index, u32 tag) |
Infer * | mut_infer (Ref type) |
Infer * | mut_infer_univ () |
Infer * | mut_infer_type () |
Infer * | mut_infer_entity () |
Either a value ?:?:Type ? or a type ?:Type ?:Type ? . | |
Axiom | |
const Axiom * | axiom (NormalizeFn n, u8 curry, u8 trip, Ref type, plugin_t p, tag_t t, sub_t s) |
const Axiom * | axiom (Ref type, plugin_t p, tag_t t, sub_t s) |
const Axiom * | axiom (NormalizeFn n, u8 curry, u8 trip, Ref type) |
Builds a fresh Axiom with descending Axiom::sub. | |
const Axiom * | axiom (Ref type) |
See above. | |
Pi | |
const Pi * | pi (Ref dom, Ref codom, bool implicit=false) |
const Pi * | pi (Defs dom, Ref codom, bool implicit=false) |
const Pi * | pi (Ref dom, Defs codom, bool implicit=false) |
const Pi * | pi (Defs dom, Defs codom, bool implicit=false) |
Pi * | mut_pi (Ref type, bool implicit=false) |
Cn | |
const Pi * | cn () |
const Pi * | cn (Ref dom, bool implicit=false) |
const Pi * | cn (Defs dom, bool implicit=false) |
const Pi * | fn (Ref dom, Ref codom, bool implicit=false) |
const Pi * | fn (Defs dom, Ref codom, bool implicit=false) |
const Pi * | fn (Ref dom, Defs codom, bool implicit=false) |
const Pi * | fn (Defs dom, Defs codom, bool implicit=false) |
Lam | |
Ref | filter (Lam::Filter filter) |
const Lam * | lam (const Pi *pi, Lam::Filter f, Ref body) |
Lam * | mut_lam (const Pi *pi) |
const Lam * | con (Ref dom, Lam::Filter f, Ref body) |
const Lam * | con (Defs dom, Lam::Filter f, Ref body) |
const Lam * | lam (Ref dom, Ref codom, Lam::Filter f, Ref body) |
const Lam * | lam (Defs dom, Ref codom, Lam::Filter f, Ref body) |
const Lam * | lam (Ref dom, Defs codom, Lam::Filter f, Ref body) |
const Lam * | lam (Defs dom, Defs codom, Lam::Filter f, Ref body) |
const Lam * | fun (Ref dom, Ref codom, Lam::Filter f, Ref body) |
const Lam * | fun (Defs dom, Ref codom, Lam::Filter f, Ref body) |
const Lam * | fun (Ref dom, Defs codom, Lam::Filter f, Ref body) |
const Lam * | fun (Defs dom, Defs codom, Lam::Filter f, Ref body) |
Lam * | mut_con (Ref dom) |
Lam * | mut_con (Defs dom) |
Lam * | mut_lam (Ref dom, Ref codom) |
Lam * | mut_lam (Defs dom, Ref codom) |
Lam * | mut_lam (Ref dom, Defs codom) |
Lam * | mut_lam (Defs dom, Defs codom) |
Lam * | mut_fun (Ref dom, Ref codom) |
Lam * | mut_fun (Defs dom, Ref codom) |
Lam * | mut_fun (Ref dom, Defs codom) |
Lam * | mut_fun (Defs dom, Defs codom) |
App | |
template<bool Normalize = true> | |
Ref | app (Ref callee, Ref arg) |
template<bool Normalize = true> | |
Ref | app (Ref callee, Defs args) |
Ref | raw_app (const Axiom *axiom, u8 curry, u8 trip, Ref type, Ref callee, Ref arg) |
Ref | raw_app (Ref type, Ref callee, Ref arg) |
Ref | raw_app (Ref type, Ref callee, Defs args) |
Sigma | |
Sigma * | mut_sigma (Ref type, size_t size) |
template<level_t level = 0> | |
Sigma * | mut_sigma (size_t size) |
A *mut*able Sigma of type level . | |
Ref | sigma (Defs ops) |
const Sigma * | sigma () |
The unit type within Type 0. | |
Arr | |
Arr * | mut_arr (Ref type) |
template<level_t level = 0> | |
Arr * | mut_arr () |
Ref | arr (Ref shape, Ref body) |
Ref | arr (Defs shape, Ref body) |
Ref | arr (u64 n, Ref body) |
Ref | arr (View< u64 > shape, Ref body) |
Ref | arr_unsafe (Ref body) |
Tuple | |
Ref | tuple (Defs ops) |
Ref | tuple (Ref type, Defs ops) |
Ascribes type to this tuple - needed for dependently typed and mutable Sigmas. | |
const Tuple * | tuple () |
the unit value of type [] | |
Ref | tuple (Sym sym) |
Converts sym to a tuple of type '«n; I8»'. | |
Pack | |
Pack * | mut_pack (Ref type) |
Ref | pack (Ref arity, Ref body) |
Ref | pack (Defs shape, Ref body) |
Ref | pack (u64 n, Ref body) |
Ref | pack (View< u64 > shape, Ref body) |
Extract | |
| |
Ref | extract (Ref d, Ref i) |
Ref | extract (Ref d, u64 a, u64 i) |
Ref | extract (Ref d, u64 i) |
Ref | select (Ref cond, Ref t, Ref f) |
Builds (f, t)#cond . | |
Insert | |
| |
Ref | insert (Ref d, Ref i, Ref val) |
Ref | insert (Ref d, u64 a, u64 i, Ref val) |
Ref | insert (Ref d, u64 i, Ref val) |
Lit | |
const Lit * | lit (Ref 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> | |
Ref | ext (Ref type) |
Ref | bot (Ref type) |
Ref | top (Ref type) |
Ref | type_bot () |
Ref | type_top () |
Ref | top_nat () |
template<bool Up> | |
TBound< Up > * | mut_bound (Ref 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> | |
Ref | bound (Defs ops) |
Join * | mut_join (Ref type, size_t size) |
Meet * | mut_meet (Ref 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) |
Ref | join (Defs ops) |
Ref | meet (Defs ops) |
Ref | ac (Ref type, Defs ops) |
Ref | ac (Defs ops) |
Infers the type using an immutable Meet. | |
Ref | vel (Ref type, Ref value) |
Ref | pick (Ref type, Ref value) |
Ref | test (Ref value, Ref probe, Ref match, Ref clash) |
Ref | uniq (Ref inhabitant) |
Globals | |
| |
Global * | global (Ref type, bool is_mutable=true) |
Types | |
const Nat * | type_nat () |
const Idx * | type_idx () |
Ref | type_idx (Ref size) |
Ref | type_idx (nat_t size) |
Ref | type_int (nat_t width) |
Constructs a type Idx of size 2^width. | |
Ref | type_bool () |
Ref | type_i1 () |
Ref | type_i2 () |
Ref | type_i4 () |
Ref | type_i8 () |
Ref | type_i16 () |
Ref | type_i32 () |
Ref | type_i64 () |
Cope with implicit Arguments | |
template<bool Normalize = true> | |
Ref | implicit_app (Ref callee, Ref arg) |
Places Infer arguments as demanded by Pi::implicit and then apps arg . | |
template<bool Normalize = true> | |
Ref | implicit_app (Ref callee, Defs args) |
template<bool Normalize = true> | |
Ref | implicit_app (Ref 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> | |
Ref | implicit_app (Ref 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 | |
Manges sets of Vars and 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 (Ref) |
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 37 of file world.cpp.
References insert(), lit_idx(), lit_nat(), lit_univ(), lit_univ_0(), lit_univ_1(), pi(), sigma(), 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 mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
|
inline |
Definition at line 168 of file world.cpp.
References mim::Checker::assignable(), axiom(), mim::Lam::body(), DLOG, mim::Pi::dom(), mim::Error::error(), mim::Lam::filter(), mim::Axiom::get(), mim::Def::is_set(), mim::Def::isa_imm(), mim::Def::isa_mut(), lam(), lit_ff(), lit_tt(), mim::Def::loc(), mim::Axiom::normalizer(), mim::Error::note(), pi(), raw_app(), mim::Pi::reduce(), mim::Rewriter::rewrite(), mim::Axiom::Trip_End, mim::Def::type(), type(), mim::Def::var(), 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 390 of file world.cpp.
References arr(), mim::error(), extract(), mim::Lit::isa(), mim::Def::ops(), pack(), sigma(), 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 253 of file world.h.
References axiom(), mim::World::State::POD::curr_sub, mim::Annex::Global_Plugin, mim::World::State::pod, and type().
Definition at line 440 of file world.h.
Referenced by mim::plug::autodiff::AutoDiffZeroCleanup::rewrite(), and mim::plug::clos::LowerTypedClos::start().
void mim::World::breakpoint | ( | u32 | gid | ) |
|
inline |
Definition at line 154 of file world.h.
References mim::World::State::breakpoints.
|
inline |
Complete curried call of annexes obeying implicits.
Definition at line 514 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 275 of file world.h.
References pi(), and type_bot().
|
inline |
|
inline |
|
inline |
Manage global identifier - a unique number for each Def.
Definition at line 88 of file world.h.
References mim::World::State::POD::curr_gid, and mim::World::State::pod.
void mim::World::debug_dump | ( | ) |
Dump in Debug build if World::log::level is Log::Level::Debug.
Definition at line 488 of file dump.cpp.
References mim::Log::Debug.
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 146 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(), flags(), inherit(), mim::ast::load_plugins(), log(), mim::optimize(), register_annex(), sym(), sym(), and sym().
void mim::World::dump | ( | std::ostream & | os | ) |
Dump to os
.
Definition at line 466 of file dump.cpp.
References assertf, and mim::print().
Referenced by main().
|
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 192 of file world.h.
Referenced by copy_externals(), dot(), and verify().
Definition at line 284 of file world.cpp.
References mim::Checker::alpha(), mim::Def::arity(), arr(), mim::Lit::as(), mim::Def::as_lit_arity(), mim::error(), extract(), insert(), mim::Idx::isa(), mim::Lit::isa(), mim::Def::isa_mut(), mim::Def::loc(), mut_sigma(), mim::Def::num_ops(), mim::Def::op(), mim::Def::ops(), pack(), mim::Def::reduce(), mim::Rewriter::rewrite(), sigma(), tuple(), mim::Def::type(), type(), mim::Def::var(), 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 73 of file world.cpp.
References driver(), and mim::Driver::flags().
Referenced by annex(), insert(), and mim::Def::num_tprojs().
Yields old frozen state.
Definition at line 133 of file world.h.
References mim::World::State::POD::frozen, and mim::World::State::pod.
Referenced by mim::World::Freezer::~Freezer().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 109 of file world.h.
References mim::World::State::POD::loc, and mim::World::State::pod.
Referenced by push().
Definition at line 500 of file world.h.
References implicit_app(), and tuple().
|
inline |
Definition at line 507 of file world.h.
References implicit_app(), and lit_nat().
Definition at line 503 of file world.h.
References implicit_app(), and lit_nat().
Places Infer arguments as demanded by Pi::implicit and then apps arg
.
Definition at line 163 of file world.cpp.
References app(), mim::Pi::dom(), mim::Pi::isa_implicit(), mut_infer(), pi(), and mim::Def::type().
Referenced by implicit_app(), implicit_app(), and implicit_app().
|
inline |
Definition at line 346 of file world.cpp.
References mim::Checker::alpha(), mim::Def::arity(), mim::Checker::assignable(), mim::error(), mim::Error::error(), flags(), insert(), mim::Idx::isa(), mim::Lit::isa(), mim::Def::isa_lit_arity(), mim::Def::loc(), mim::Error::note(), pack(), mim::Def::proj(), 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_infer(), mut_lam(), mut_lam(), mut_lam(), mut_lam(), mut_lam(), mut_pack(), mut_pi(), mut_sigma(), and World().
|
inline |
Definition at line 130 of file world.h.
References mim::World::State::POD::frozen, and mim::World::State::pod.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 447 of file world.cpp.
References mim::error(), mim::Idx::isa(), mim::Lit::isa(), mim::Def::loc(), and type().
Referenced by lit_idx(), lit_nat(), lit_univ(), and mim::plug::demo::normalize_const().
|
inline |
|
inline |
|
inline |
Definition at line 399 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 401 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 402 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 403 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by mim::plug::mem::op_lea_unsafe().
|
inline |
Definition at line 400 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by tuple().
|
inline |
Definition at line 408 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 415 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 393 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 394 of file world.h.
Referenced by mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm(), and mim::Pack::shape().
|
inline |
Definition at line 395 of file world.h.
Referenced by mim::Def::arity(), and mim::Pack::shape().
|
inline |
Definition at line 432 of file world.h.
Referenced by app(), and mim::plug::core::normalize_ncmp().
|
inline |
|
inline |
Log & mim::World::log | ( | ) |
Definition at line 72 of file world.cpp.
References driver(), and mim::Driver::log().
|
inline |
Definition at line 195 of file world.h.
References mim::assert_emplace(), mim::Def::is_closed(), mim::Def::is_external(), and mim::Def::sym().
Referenced by mim::Def::make_external().
|
inline |
Definition at line 201 of file world.h.
References mim::Def::is_external(), and mim::Def::sym().
Referenced by mim::Def::make_internal().
Definition at line 445 of file world.h.
References insert(), and type().
Referenced by mut_bound(), mut_join(), and mut_meet().
Definition at line 303 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 309 of file world.h.
References fn(), and insert().
Referenced by mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
Definition at line 229 of file world.h.
References insert(), and type().
Referenced by implicit_app(), mut_infer_entity(), mut_infer_type(), mut_infer_univ(), and mim::Infer::tuplefy().
|
inline |
Either a value ?:?:Type ?
or a type ?:Type ?:Type ?
.
Definition at line 234 of file world.h.
References mut_infer(), and type_infer_univ().
|
inline |
Definition at line 231 of file world.h.
References mut_infer(), and type_infer_univ().
|
inline |
Definition at line 230 of file world.h.
References mut_infer(), and univ().
Referenced by type_infer_univ().
Definition at line 449 of file world.h.
References mut_bound(), and type().
Definition at line 451 of file world.h.
References mut_join(), and type().
Referenced by mut_join().
Definition at line 291 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 450 of file world.h.
References mut_bound(), and type().
Definition at line 452 of file world.h.
References mut_meet(), and type().
Referenced by mut_meet().
Definition at line 358 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 329 of file world.h.
References mut_sigma(), and type().
Referenced by mut_sigma().
|
inlinenodiscard |
Definition at line 523 of file world.h.
Referenced by mim::Def::Def(), mim::Def::local_muts(), and mim::Def::mut_local_muts().
|
inline |
Definition at line 83 of file world.h.
References mim::World::State::POD::name, and mim::World::State::pod.
Referenced by append_suffix(), external(), set(), and set().
|
inline |
Definition at line 89 of file world.h.
References mim::World::State::POD::curr_gid, and mim::World::State::pod.
Referenced by mim::Def::Def().
|
inline |
Definition at line 90 of file world.h.
Referenced by mim::Def::free_vars().
Definition at line 417 of file world.cpp.
References arr(), mim::error(), mim::Lit::isa(), mim::Def::ops(), pack(), 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 262 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 209 of file world.cpp.
References axiom(), mim::Axiom::get(), raw_app(), mim::Axiom::Trip_End, and type().
Definition at line 79 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 |
Definition at line 85 of file world.h.
References name(), mim::World::State::POD::name, mim::World::State::pod, and sym().
|
inline |
Definition at line 84 of file world.h.
References name(), mim::World::State::POD::name, and mim::World::State::pod.
Referenced by main().
|
inline |
Definition at line 110 of file world.h.
Referenced by push(), and mim::World::ScopedLoc::~ScopedLoc().
|
inline |
Definition at line 223 of file world.cpp.
References arr(), mim::Sigma::infer(), mim::Checker::is_uniform(), and sigma().
Referenced by mim::flatten(), mim::Sigma::immutabilize(), mim::is_unit(), mim::merge_sigma(), mim::plug::affine::LowerFor::rewrite(), and mim::plug::mem::CopyProp::rewrite().
|
inline |
Sym mim::World::sym | ( | const std::string & | s | ) |
Sym mim::World::sym | ( | std::string_view | s | ) |
Definition at line 76 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().
Definition at line 513 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 444 of file world.h.
Referenced by arr_unsafe().
|
inline |
Definition at line 231 of file world.cpp.
References mim::Checker::assignable(), mim::error(), sigma(), and tuple().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_tuple(), mim::plug::matrix::counting_for(), mim::plug::autodiff::AutoDiffEval::derive_(), mim::RetWrap::enter(), mim::flatten(), mim::merge_tuple(), mim::plug::affine::LowerFor::rewrite(), mim::plug::mem::SSAConstr::rewrite(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm(), and mim::Infer::tuplefy().
Ascribes type
to this tuple - needed for dependently typed and mutable Sigmas.
Definition at line 243 of file world.cpp.
References extract(), mim::Checker::is_uniform(), mim::Lit::isa(), mim::Def::isa_mut(), pack(), tuple(), mim::Def::type(), and type().
Ref mim::World::tuple | ( | Sym | sym | ) |
Definition at line 216 of file world.h.
References lit_univ(), and type().
Referenced by ac(), app(), axiom(), axiom(), axiom(), axiom(), bot(), ext(), extract(), global(), insert(), lit(), mut_arr(), mut_arr(), mut_bound(), mut_bound(), mut_infer(), 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(), top(), tuple(), type(), type_infer_univ(), umax(), var(), vel(), and World().
Definition at line 92 of file world.cpp.
References mim::error(), mim::Def::loc(), and mim::Def::type().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_app(), mim::plug::affine::LowerFor::rewrite(), and mim::Def::unfold_type().
|
inline |
Definition at line 489 of file world.h.
References type_int().
|
inline |
Definition at line 486 of file world.h.
References type_int().
|
inline |
Definition at line 490 of file world.h.
References type_int().
Referenced by mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
|
inline |
Definition at line 487 of file world.h.
References type_int().
|
inline |
Definition at line 491 of file world.h.
References type_int().
|
inline |
Definition at line 488 of file world.h.
References type_int().
|
inline |
Definition at line 474 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 478 of file world.h.
References lit_nat(), and type_idx().
Referenced by type_idx().
size = 0
means 2^64
. Definition at line 476 of file world.h.
References app(), and type_idx().
Referenced by type_idx().
|
inline |
Definition at line 215 of file world.h.
References mut_infer_univ(), and type().
Referenced by mut_infer_entity(), and mut_infer_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 482 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 99 of file world.cpp.
References mim::error(), mim::Lit::isa(), lit_univ(), mim::Def::loc(), and mim::Def::type().
Definition at line 108 of file world.cpp.
References mim::error(), mim::Lit::isa(), mim::Kind, mim::Type::level(), lit_univ(), mim::Term, mim::Type, type(), and mim::Univ.
Definition at line 527 of file world.cpp.
References mim::Def::type(), and mim::Def::unfold_type().
|
inline |
Definition at line 211 of file world.h.
Referenced by lit_univ(), mut_infer_univ(), and mim::Rewriter::rewrite().
Definition at line 154 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::affine::LowerFor::rewrite(), and var().
|
inlinenodiscard |
Definition at line 522 of file world.h.
Referenced by mim::Def::Def(), mim::Def::free_vars(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), mim::VarRewriter::rewrite_mut(), and mim::VarRewriter::VarRewriter().
World & mim::World::verify | ( | ) |
Verifies that all externals() and annexes() are Def::is_closed(), if MIM_ENABLE_CHECKS
.
Definition at line 563 of file world.cpp.
References annexes(), and externals().
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 |