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 | |
template<class Id , class... Args> | |
const Def * | call (Id id, Args &&... args) |
template<class Id , class... Args> | |
const Def * | call (Args &&... args) |
template<class T , class... Args> | |
const Def * | call_ (Ref callee, T arg, Args &&... args) |
template<class T > | |
const Def * | call_ (Ref callee, T arg) |
C'tor and D'tor | |
World & | operator= (World)=delete |
World (Driver *) | |
Inherits the state into the new World. | |
World (Driver *, const State &) | |
World (World &&other) noexcept | |
World | inherit () |
~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 () |
Flags & | flags () |
Retrive 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 . | |
Manage Nodes | |
const auto & | annexes () const |
const auto & | externals () const |
void | make_external (Def *def) |
void | make_internal (Def *def) |
Def * | external (Sym name) |
Lookup by name . | |
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) |
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) |
Lam * | exit () |
Used as a dummy exit node within Scope. | |
App | |
Ref | app (Ref callee, Ref arg) |
Ref | app (Ref callee, Defs args) |
template<bool Normalize = false> | |
Ref | raw_app (Ref type, Ref callee, Ref arg) |
template<bool Normalize = false> | |
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 | singleton (Ref inner_type) |
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 | |
Ref | iapp (Ref callee, Ref arg) |
Ref | iapp (Ref callee, Defs args) |
Ref | iapp (Ref callee, nat_t arg) |
template<class E > requires std::is_enum_v<E> && std::is_same_v<std::underlying_type_t<E>, nat_t> | |
Ref | iapp (Ref callee, E arg) |
Vars & Muts | |
Manges sets of Vars and Muts. | |
Vars | vars (const Var *var) |
Muts | muts (Def *mut) |
Vars | merge (Vars a, Vars b) |
Muts | merge (Muts a, Muts b) |
Vars | insert (Vars vars, const Var *var) |
Muts | insert (Muts muts, Def *mut) |
Vars | erase (Vars vars, const Var *var) |
Muts | erase (Muts muts, Def *mut) |
bool | has_intersection (Vars v1, Vars v2) |
bool | has_intersection (Muts m1, Muts m2) |
Helpers | |
Ref | iinfer (Ref def) |
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 | |
Dumps DOT to | |
void | dot (std::ostream &os, bool annexes=false, bool types=false) const |
void | dot (const char *file=nullptr, bool annexes=false, bool types=false) const |
Same as above but write to file or std::cout if file is nullptr . | |
Friends | |
void | swap (World &w1, World &w2) noexcept |
DefVec | Def::reduce (const Def *) |
The World represents the whole program and manages creation of MimIR nodes (Defs).
Defs are hashed into an internal HashSet. The World's factory methods just calculate a hash and lookup the Def, if it is already present, or create a new one otherwise. This corresponds to value numbering.
You can create several worlds. All worlds are completely independent from each other.
Note that types are also just Defs and will be hashed as well.
|
explicit |
Definition at line 37 of file world.cpp.
References cn(), insert(), lit_idx(), lit_nat(), lit_univ(), lit_univ_0(), lit_univ_1(), mut_lam(), pi(), mim::Lam::set(), sigma(), sym(), type(), type_bot(), type_idx(), and type_nat().
|
inlinenoexcept |
|
inline |
|
inline |
Lookup annex by Axiom::id.
Definition at line 185 of file world.h.
References mim::Annex::demangle(), driver(), mim::error(), and flags().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_pack(), and mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
|
inline |
Definition at line 186 of file world.cpp.
References mim::Check::assignable(), mim::Lam::body(), DLOG, mim::Pi::dom(), mim::Infer::eliminate(), mim::Error::error(), mim::Lam::filter(), mim::Def::is_set(), mim::Def::isa_imm(), mim::Def::isa_mut(), lam(), lit_ff(), lit_tt(), mim::Def::loc(), mim::Error::note(), pi(), raw_app(), mim::Def::reduce(), mim::Rewriter::rewrite(), mim::Def::type(), type(), and mim::Def::var().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_app(), mim::plug::autodiff::AutoDiffEval::augment_pack(), iapp(), 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 394 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(), mim::plug::autodiff::AutoDiffEval::augment_pack(), ext(), extract(), pack(), and sigma().
|
inline |
Builds a fresh Axiom with descending Axiom::sub.
This is useful during testing to come up with some entitiy 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 246 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 435 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 |
|
inline |
Definition at line 518 of file world.h.
References annex(), and call_().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_extract(), 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 268 of file world.h.
References pi(), and type_bot().
|
inline |
|
inline |
|
inline |
Manage global identifier - a unique number for each Def.
Definition at line 89 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 489 of file dump.cpp.
References mim::Log::Debug.
Referenced by mim::plug::autodiff::AutoDiffEval::augment_app(), DebugDump::prepare(), and mim::PassMan::run().
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 |
os | Output stream |
annexes | If true , include all annexes - even if unused. |
types | Follow type dependencies? |
Definition at line 140 of file dot.cpp.
References annex(), annexes(), dot(), external(), and externals().
|
inline |
Definition at line 81 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 467 of file dump.cpp.
References assertf, and mim::print().
Referenced by main().
|
inline |
|
inline |
Lookup by name
.
Definition at line 182 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 168 of file world.h.
Referenced by dot(), mim::optimize(), mim::PassMan::run(), mim::RWPhase::start(), and verify().
Definition at line 290 of file world.cpp.
References mim::Check::alpha(), mim::Def::arity(), arr(), mim::Lit::as(), mim::Def::as_lit_arity(), mim::error(), extract(), insert(), 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(), mim::Idx::size(), tuple(), mim::Def::type(), type(), mim::Def::var(), and WLOG.
Referenced by arr(), mim::plug::autodiff::AutoDiffEval::augment_extract(), mim::plug::autodiff::AutoDiffEval::augment_pack(), extract(), select(), and tuple().
|
inline |
Flags & mim::World::flags | ( | ) |
Retrive compile Flags.
Definition at line 74 of file world.cpp.
References driver(), and mim::Driver::flags().
Referenced by annex(), insert(), and mim::Def::num_tprojs().
|
inline |
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().
Places Infer arguments as demanded by Pi::implicit and then apps arg
.
Definition at line 165 of file world.cpp.
References app(), mim::Check::assignable(), mim::decurry(), mim::Pi::dom(), mim::Pi::is_implicit(), mut_infer(), pi(), mim::Ref::refer(), and mim::Def::type().
Definition at line 527 of file world.h.
References mim::Idx::size(), and mim::Def::type().
|
inline |
Definition at line 352 of file world.cpp.
References mim::Check::alpha(), mim::Def::arity(), mim::Check::assignable(), mim::error(), mim::Error::error(), flags(), insert(), mim::Lit::isa(), mim::Def::isa_lit_arity(), mim::Def::loc(), mim::Error::note(), pack(), mim::Def::proj(), mim::Idx::size(), 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(), mim::VarRewriter::rewrite_mut(), 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 451 of file world.cpp.
References mim::error(), mim::Lit::isa(), mim::Def::loc(), mim::Idx::size(), and type().
Referenced by lit_idx(), lit_nat(), lit_univ(), and mim::plug::demo::normalize_const().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 394 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
|
inline |
Definition at line 396 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 397 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
|
inline |
Definition at line 398 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by mim::plug::mem::op_lea_unsafe().
|
inline |
Definition at line 395 of file world.h.
References mim::Idx::bitwidth2size(), and lit_nat().
Referenced by tuple().
|
inline |
Definition at line 403 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 410 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 388 of file world.h.
References lit(), and type_nat().
Referenced by mim::Def::arity(), arr(), iapp(), iapp(), 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 389 of file world.h.
Referenced by mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm(), and mim::Pack::shape().
|
inline |
Definition at line 390 of file world.h.
Referenced by mim::Def::arity(), and mim::Pack::shape().
|
inline |
Definition at line 427 of file world.h.
Referenced by app(), and mim::plug::core::normalize_ncmp().
|
inline |
|
inline |
Log & mim::World::log | ( | ) |
Definition at line 73 of file world.cpp.
References driver(), and mim::Driver::log().
|
inline |
Definition at line 169 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 175 of file world.h.
References mim::Def::is_external(), and mim::Def::sym().
Referenced by mim::Def::make_internal().
Definition at line 507 of file world.h.
Referenced by mim::Def::Def(), and mim::Def::free_vars().
Definition at line 440 of file world.h.
References insert(), and type().
Referenced by mut_bound(), mut_join(), and mut_meet().
Definition at line 296 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 302 of file world.h.
References fn(), and insert().
Referenced by mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
Definition at line 222 of file world.h.
References insert(), and type().
Referenced by iapp(), mut_infer_entity(), mut_infer_type(), and mut_infer_univ().
|
inline |
Either a value ?:?:Type ?
or a type ?:Type ?:Type ?
.
Definition at line 227 of file world.h.
References mut_infer(), and type_infer_univ().
|
inline |
Definition at line 224 of file world.h.
References mut_infer(), and type_infer_univ().
|
inline |
Definition at line 223 of file world.h.
References mut_infer(), and univ().
Referenced by type_infer_univ().
Definition at line 444 of file world.h.
References mut_bound(), and type().
Definition at line 446 of file world.h.
References mut_join(), and type().
Referenced by mut_join().
Definition at line 284 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_(), mim::RetWrap::enter(), and World().
Definition at line 445 of file world.h.
References mut_bound(), and type().
Definition at line 447 of file world.h.
References mut_meet(), and type().
Referenced by mut_meet().
Definition at line 353 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 324 of file world.h.
References mut_sigma(), and type().
Referenced by mut_sigma().
Definition at line 506 of file world.h.
Referenced by erase(), insert(), and mim::Def::local_muts().
|
inline |
Definition at line 84 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 90 of file world.h.
References mim::World::State::POD::curr_gid, and mim::World::State::pod.
Referenced by mim::Def::Def(), and mim::Def::Def().
Definition at line 421 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().
|
inline |
Definition at line 217 of file world.cpp.
References axiom(), mim::Axiom::get(), mim::Axiom::normalizer(), mim::Axiom::Trip_End, and type().
Referenced by app(), mim::plug::autodiff::normalize_ad(), mim::plug::regex::normalize_conj(), mim::plug::matrix::normalize_insert(), mim::plug::matrix::normalize_map_reduce(), mim::plug::regex::normalize_not(), mim::plug::core::normalize_pe(), mim::plug::matrix::normalize_prod(), mim::plug::mem::normalize_remem(), mim::plug::core::normalize_trait(), mim::plug::matrix::normalize_transpose(), mim::plug::autodiff::normalize_zero(), and raw_app().
Definition at line 80 of file world.cpp.
References mim::assert_emplace(), mim::Annex::demangle(), and driver().
Referenced by mim::ast::Emitter::register_annex(), and register_annex().
Definition at line 197 of file world.h.
References register_annex().
|
inline |
Definition at line 86 of file world.h.
References name(), mim::World::State::POD::name, mim::World::State::pod, and sym().
|
inline |
Definition at line 85 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 230 of file world.cpp.
References arr(), mim::Sigma::infer(), mim::Check::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 77 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(), tuple(), and World().
Definition at line 517 of file world.cpp.
References mim::Check::alpha(), mim::Pi::codom(), mim::Pi::dom(), join(), mim::match(), pi(), and mim::Def::type().
|
inline |
Definition at line 439 of file world.h.
Referenced by arr_unsafe().
|
inline |
Definition at line 238 of file world.cpp.
References mim::Check::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_(), and mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm().
Ascribes type
to this tuple - needed for dependently typed and mutable Sigmas.
Definition at line 249 of file world.cpp.
References extract(), mim::Check::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 209 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(), singleton(), top(), tuple(), type(), type_infer_univ(), umax(), var(), vel(), and World().
Definition at line 94 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 |
|
inline |
Definition at line 484 of file world.h.
References type_int().
|
inline |
Definition at line 481 of file world.h.
References type_int().
|
inline |
Definition at line 485 of file world.h.
References type_int().
Referenced by mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().
|
inline |
Definition at line 482 of file world.h.
References type_int().
|
inline |
Definition at line 486 of file world.h.
References type_int().
|
inline |
Definition at line 483 of file world.h.
References type_int().
|
inline |
Definition at line 469 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 473 of file world.h.
References lit_nat(), and type_idx().
Referenced by type_idx().
size = 0
means 2^64
. Definition at line 471 of file world.h.
References app(), and type_idx().
Referenced by type_idx().
|
inline |
Definition at line 208 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 477 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 101 of file world.cpp.
References mim::error(), mim::Lit::isa(), lit_univ(), mim::Def::loc(), and mim::Def::type().
Definition at line 110 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.
|
inline |
Definition at line 204 of file world.h.
Referenced by lit_univ(), mut_infer_univ(), and mim::Rewriter::rewrite().
Definition at line 156 of file world.cpp.
References mim::Lit::isa(), lit_0_1(), mim::Idx::size(), type(), and var().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_extract(), mim::plug::autodiff::AutoDiffEval::augment_tuple(), erase(), insert(), mim::plug::affine::LowerFor::rewrite(), var(), and vars().
Definition at line 505 of file world.h.
References var().
Referenced by mim::Def::Def(), erase(), insert(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), 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 567 of file world.cpp.
References annex(), annexes(), externals(), and mim::Def::is_closed().
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 |