|
MimIR 0.1
MimIR is my Intermediate Representation
|
Namespaces | |
| namespace | ast |
| namespace | dl |
| namespace | lct |
| namespace | ll |
| namespace | plug |
| namespace | sys |
Classes | |
| struct | Annex |
| Holds info about an entity defined within a Plugin (called Annex). More... | |
| class | App |
| class | Arr |
| A (possibly paramterized) Array. More... | |
| class | Axm |
| class | BetaRed |
| Optimistically performs β-reduction (aka inlining). More... | |
| class | BetaRedPhase |
| Inlines in post-order all Lams that occur exactly once in the program. More... | |
| class | BitSet |
| class | Bound |
| Common base for TBound. More... | |
| class | Branch |
Matches (ff, tt)#cond arg. More... | |
| class | BranchNormalizePhase |
| Inlines in post-order all Lams that occur exactly once in the program. More... | |
| class | Checker |
| class | Cleanup |
Removes unreachable and dead code by rebuilding the whole World into a new one and swapping them afterwards. More... | |
| class | ClosedMutPhase |
| Transitively visits all reachable, closed mutables in the World. More... | |
| struct | Dbg |
| class | Def |
| Base class for all Defs. More... | |
| class | Driver |
| Some "global" variables needed all over the place. More... | |
| struct | Elem |
Use with print to output complicated std::ranges::ranges. More... | |
| class | Emitter |
| class | Error |
| class | EtaExp |
Performs η-expansion: f -> λx.f x, if f is a Lam with more than one user and does not appear in callee position. More... | |
| class | EtaExpPhase |
| This phase takes care that Lamdas appear either only in callee position (Known) or not (Unknown). More... | |
| class | EtaRed |
| Performs η-reduction. More... | |
| class | EtaRedPhase |
| Inlines in post-order all Lams that occur exactly once in the program. More... | |
| class | Ext |
| Common base for TExtremum. More... | |
| class | Extract |
| Extracts from a Sigma or Array-typed Extract::tuple the element at position Extract::index. More... | |
| struct | Flags |
| Compiler switches that must be saved and looked up in later phases of compilation. More... | |
| struct | FNV1 |
| struct | FNV1< 4 > |
| struct | FNV1< 8 > |
| class | FPPass |
| Inherit from this class using CRTP, if you do need a Pass with a state and a fixed-point. More... | |
| struct | GIDHash |
| struct | GIDLt |
| class | Global |
| class | Hole |
| This node is a hole in the IR that is inferred by its context later on. More... | |
| class | Idx |
A built-in constant of type Nat -> *. More... | |
| class | Inj |
| Constructs a Join value. More... | |
| class | Insert |
| Creates a new Tuple / Pack by inserting Insert::value at position Insert::index into Insert::tuple. More... | |
| class | Lam |
| A function. More... | |
| class | LamSpec |
| class | Lit |
| class | Log |
| Facility to log what you are doing. More... | |
| class | Match |
| Scrutinize Match::scrutinee() and dispatch to Match::arms. More... | |
| class | Merge |
| Constructs a Meet value. More... | |
| class | Nat |
| class | Nest |
| Builds a nesting tree of all immutables/binders. More... | |
| class | NestPhase |
| Like ClosedMutPhase but computes a Nest for each NestPhase::visit. More... | |
| class | Pack |
| A (possibly paramterized) Tuple. More... | |
| class | Pass |
| All Passes that want to be registered in the PassMan must implement this interface. More... | |
| class | PassMan |
| An optimizer that combines several optimizations in an optimal way. More... | |
| class | PassManPhase |
| Wraps a PassMan pipeline as a Phase. More... | |
| class | Phase |
| As opposed to a Pass, a Phase does one thing at a time and does not mix with other Phases. More... | |
| class | PhaseMan |
| Organizes several Phases in a a pipeline. More... | |
| class | Pi |
| A dependent function type. More... | |
| struct | Plugin |
| Basic info and registration function pointer to be returned from a specific plugin. More... | |
| class | PrefixCleanup |
| class | Prod |
| Base class for Sigma and Tuple. More... | |
| class | Proxy |
| class | Reform |
| Type formation of a rewrite Rule. More... | |
| class | Repl |
| Simple Stage that searches for a pattern and replaces it. More... | |
| class | ReplMan |
| class | ReplManPhase |
| class | Res |
| Utility class when folding constants in normalizers. More... | |
| class | RetWrap |
| class | Rewriter |
| Recurseivly rebuilds part of a program into the provided World w.r.t. Rewriter::map. More... | |
| class | Rule |
| A rewrite rule. More... | |
| class | RWPass |
| Inherit from this class using CRTP, if your Pass does not need state and a fixed-point iteration. More... | |
| class | RWPhase |
Rewrites the RWPhase::old_world into the RWPhase::new_world and swaps them afterwards. More... | |
| class | Scalarize |
| Perform Scalarization (= Argument simplification). More... | |
| class | Scheduler |
| class | Select |
Matches (ff, tt)#cond - where cond is not a Literal. More... | |
| class | Seq |
| Base class for Arr and Pack. More... | |
| class | Sets |
| class | Setters |
| CRTP-based mixin to declare setters for Def::loc & Def::name using a covariant return type. More... | |
| class | Sigma |
| A dependent tuple type. More... | |
| class | Span |
This is a thin wrapper for std::span<T, N> with the following additional features: More... | |
| class | Split |
| Picks the aspect of a Meet [value](Pick::value) by its [type](Def::type). More... | |
| class | Stage |
| Common base for Phase and Pass. More... | |
| class | Tab |
| Keeps track of indentation level. More... | |
| class | TailRecElim |
| class | TBound |
Specific Bound depending on Up. More... | |
| class | TExt |
Extremum. Either Top (Up) or Bottom. More... | |
| class | Tuple |
| Data constructor for a Sigma. More... | |
| class | Type |
| class | UInc |
| class | UMax |
| class | Uniq |
| A singleton wraps a type into a higher order type. More... | |
| class | unique_queue |
| class | unique_stack |
| class | Univ |
| class | Use |
| const Def*erences a user. More... | |
| struct | UseEq |
| struct | UseHash |
| class | Var |
| A variable introduced by a binder (mutable). More... | |
| class | VarRewriter |
| class | Vector |
This is a thin wrapper for absl::InlinedVector<T, N, A> which is a drop-in replacement for std::vector<T, A>. More... | |
| class | World |
| The World represents the whole program and manages creation of MimIR nodes (Defs). More... | |
| class | Zonker |
Concepts | |
| concept | annex_with_subs |
| concept | annex_without_subs |
| concept | Vectorlike |
Something which behaves like std::vector or std::array. | |
Typedefs | |
| using | NormalizeFn = const Def* (*)(const Def*, const Def*, const Def*) |
| using | Passes = std::deque<std::unique_ptr<Pass>> |
| using | Repls = std::deque<std::unique_ptr<Repl>> |
| using | Phases = std::deque<std::unique_ptr<Phase>> |
| using | Uses = absl::flat_hash_set<Use, UseHash, UseEq> |
| template<class T, size_t N = std::dynamic_extent> | |
| using | View = Span<const T, N> |
Def | |
| template<class To> | |
| using | DefMap = GIDMap<const Def*, To> |
| using | DefSet = GIDSet<const Def*> |
| using | Def2Def = DefMap<const Def*> |
| using | Defs = View<const Def*> |
| using | DefVec = Vector<const Def*> |
Def (Mutable) | |
| template<class To> | |
| using | MutMap = GIDMap<Def*, To> |
| using | MutSet = GIDSet<Def*> |
| using | Mut2Mut = MutMap<Def*> |
| using | Muts = Sets<Def>::Set |
Var | |
| template<class To> | |
| using | VarMap = GIDMap<const Var*, To> |
| using | VarSet = GIDSet<const Var*> |
| using | Var2Var = VarMap<const Var*> |
| using | Vars = Sets<const Var>::Set |
Lam | |
| template<class To> | |
| using | LamMap = GIDMap<Lam*, To> |
| using | LamSet = GIDSet<Lam*> |
| using | Lam2Lam = LamMap<Lam*> |
Lattice | |
| using | Bot = TExt<false> |
| using | Top = TExt<true> |
| using | Meet = TBound<false> |
| AKA intersection. | |
| using | Join = TBound<true> |
| AKA union. | |
Aliases for some Base Types | |
| using | s8 = int8_t |
| using | u8 = uint8_t |
| using | s16 = int16_t |
| using | u16 = uint16_t |
| using | s32 = int32_t |
| using | u32 = uint32_t |
| using | s64 = int64_t |
| using | u64 = uint64_t |
| using | u1 = bool |
| using | f16 = half |
| using | f32 = float |
| using | f64 = double |
| using | level_t = u64 |
| using | nat_t = u64 |
| using | node_t = u8 |
| using | flags_t = u64 |
| using | plugin_t = u64 |
| using | tag_t = u8 |
| using | sub_t = u8 |
Width to Signed/Unsigned/Float | |
| template<int w> | |
| using | w2u = typename detail::w2u_<w>::type |
| template<int w> | |
| using | w2s = typename detail::w2s_<w>::type |
| template<int w> | |
| using | w2f = typename detail::w2f_<w>::type |
GID | |
| template<class K, class V> | |
| using | GIDMap = absl::flat_hash_map<K, V, GIDHash<K>> |
| template<class K> | |
| using | GIDSet = absl::flat_hash_set<K, GIDHash<K>> |
| template<class K, class V> | |
| using | GIDNodeMap = absl::node_hash_map<K, V, GIDHash<K>> |
| template<class K> | |
| using | GIDNodeSet = absl::node_hash_set<K, GIDHash<K>> |
Functions | |
| void | optimize (World &) |
| template<size_t I, class T, size_t N> requires (N != std::dynamic_extent) | |
| constexpr decltype(auto) | get (Span< T, N > span) noexcept |
| std::ostream & | operator<< (std::ostream &os, const Def *def) |
This will stream def as an operand. | |
| static const App * | eta_rule (Lam *lam) |
| std::tuple< const Var *, const Def * > | tuple_of_dict (World &world, Def2Def &v2v) |
| static void | post_order (const Nest &nest, const Nest::Node *node, Scheduler::Schedule &res, MutSet &done) |
| static void | flatten_umax (DefVec &ops, const Def *def) |
is_commutative/is_associative | |
| template<class Id> | |
| constexpr bool | is_commutative (Id) |
| template<class Id> | |
| constexpr bool | is_associative (Id id) |
| constexpr bool | is_commutative (plug::core::nat id) |
| constexpr bool | is_commutative (plug::core::ncmp id) |
| constexpr bool | is_commutative (plug::core::wrap id) |
| constexpr bool | is_commutative (plug::core::icmp id) |
| constexpr bool | is_commutative (plug::core::bit2 id) |
| constexpr bool | is_associative (plug::core::bit2 id) |
| constexpr bool | is_associative (plug::core::nat id) |
| constexpr bool | is_associative (plug::core::ncmp id) |
| constexpr bool | is_associative (plug::core::icmp id) |
| constexpr bool | is_associative (plug::core::wrap id) |
| constexpr bool | is_commutative (plug::math::extrema) |
| constexpr bool | is_commutative (plug::math::arith id) |
| constexpr bool | is_commutative (plug::math::cmp id) |
| constexpr bool | is_associative (plug::math::arith id) |
Helpers to work with Functions | |
| const App * | isa_callee (const Def *def, size_t i) |
| Lam * | isa_workable (Lam *lam) |
These are Lams that are neither nullptr, nor Lam::is_external, nor Lam::is_unset. | |
| std::pair< const App *, Lam * > | isa_apped_mut_lam (const Def *def) |
| const Def * | compose_cn (const Def *f, const Def *g) |
| The high level view is: | |
Helpers to work with Tulpes/Sigmas/Arrays/Packs | |
| bool | is_unit (const Def *) |
| std::string | tuple2str (const Def *) |
| const Def * | flatten (const Def *def) |
| Flattens a sigma/array/pack/tuple. | |
| size_t | flatten (DefVec &ops, const Def *def, bool flatten_sigmas=true) |
| Same as unflatten, but uses the operands of a flattened Pack / Tuple directly. | |
| const Def * | unflatten (const Def *def, const Def *type) |
| Applies the reverse transformation on a Pack / Tuple, given the original type. | |
| const Def * | unflatten (Defs ops, const Def *type, bool flatten_muts=true) |
| Same as unflatten, but uses the operands of a flattened Pack / Tuple directly. | |
| const Def * | tuple_of_types (const Def *t) |
Concatenation | |
| DefVec | cat (Defs, Defs) |
| DefVec | cat (const Def *a, Defs bs) |
| DefVec | cat (Defs as, const Def *b) |
| DefVec | cat (nat_t n, nat_t m, const Def *a, const Def *b) |
| const Def * | cat_tuple (nat_t n, nat_t m, const Def *a, const Def *b) |
| const Def * | cat_sigma (nat_t n, nat_t m, const Def *a, const Def *b) |
| const Def * | cat_tuple (World &, Defs, Defs) |
| const Def * | cat_sigma (World &, Defs, Defs) |
| const Def * | cat_tuple (const Def *a, Defs bs) |
| const Def * | cat_tuple (Defs as, const Def *b) |
| const Def * | cat_sigma (const Def *a, Defs bs) |
| const Def * | cat_sigma (Defs as, const Def *b) |
Formatted Output | |
Provides a Use
| |
| template<class... Args> | |
| void | error (Loc loc, const char *f, Args &&... args) |
| std::ostream & | print (std::ostream &os, const char *s) |
| Base case. | |
| template<class T, class... Args> | |
| std::ostream & | print (std::ostream &os, const char *s, T &&t, Args &&... args) |
| template<class... Args> | |
| std::ostream & | println (std::ostream &os, const char *fmt, Args &&... args) |
As above but end with std::endl. | |
| template<class... Args> | |
| std::string | fmt (const char *s, Args &&... args) |
Wraps mim::print to output a formatted std:string. | |
| template<class T = std::logic_error, class... Args> | |
| void | error (const char *fmt, Args &&... args) |
Wraps mim::print to throw T with a formatted message. | |
Simple Hash | |
See Wikipedia. | |
| constexpr uint32_t | murmur3 (uint32_t h) noexcept |
| constexpr uint64_t | splitmix64 (uint64_t h) noexcept |
| constexpr size_t | hash (size_t h) noexcept |
FNV-1 Hash | |
See Wikipedia. | |
| template<class T> | |
| constexpr size_t | hash_combine (size_t seed, T v) noexcept |
| consteval size_t | hash_begin () noexcept |
| template<class T> | |
| constexpr size_t | hash_begin (T val) noexcept |
out/err | |
mim::prints to | |
| template<class... Args> | |
| std::ostream & | outf (const char *fmt, Args &&... args) |
| template<class... Args> | |
| std::ostream & | errf (const char *fmt, Args &&... args) |
| template<class... Args> | |
| std::ostream & | outln (const char *fmt, Args &&... args) |
| template<class... Args> | |
| std::ostream & | errln (const char *fmt, Args &&... args) |
Deduction Guides | |
| template<class I, class E> | |
| Span (I, E) -> Span< std::remove_reference_t< std::iter_reference_t< I > > > | |
| template<class T, size_t N> | |
| Span (T(&)[N]) -> Span< T, N > | |
| template<class T, size_t N> | |
| Span (std::array< T, N > &) -> Span< T, N > | |
| template<class T, size_t N> | |
| Span (const std::array< T, N > &) -> Span< const T, N > | |
| template<class R> | |
| Span (R &&) -> Span< std::remove_reference_t< std::ranges::range_reference_t< R > > > | |
| template<Vectorlike Vec> | |
| Span (Vec &) -> Span< typename Vec::value_type, std::dynamic_extent > | |
| template<Vectorlike Vec> | |
| Span (const Vec &) -> Span< const typename Vec::value_type, std::dynamic_extent > | |
| template<class I, class A = std::allocator<typename std::iterator_traits<I>::value_type>> | |
| Vector (I, I, A=A()) -> Vector< typename std::iterator_traits< I >::value_type, Default_Inlined_Size< typename std::iterator_traits< I >::value_type >, A > | |
User-Defined Literals | |
| constexpr s8 | operator""_s8 (unsigned long long int s) |
| constexpr u8 | operator""_u8 (unsigned long long int u) |
| constexpr s16 | operator""_s16 (unsigned long long int s) |
| constexpr u16 | operator""_u16 (unsigned long long int u) |
| constexpr s32 | operator""_s32 (unsigned long long int s) |
| constexpr u32 | operator""_u32 (unsigned long long int u) |
| constexpr s64 | operator""_s64 (unsigned long long int s) |
| constexpr u64 | operator""_u64 (unsigned long long int u) |
| constexpr size_t | operator""_s (unsigned long long int i) |
A size_t literal. Use 0_s to disambiguate 0 from nullptr. | |
| constexpr nat_t | operator""_n (unsigned long long int i) |
| f16 | operator""_f16 (long double d) |
| constexpr f32 | operator""_f32 (long double d) |
| constexpr f64 | operator""_f64 (long double d) |
rem | |
| half | rem (half a, half b) |
| float | rem (float a, float b) |
| double | rem (double a, double b) |
| long double | rem (long double a, long double b) |
Utility Functions | |
| template<class D, class S> | |
| D | bitcast (const S &src) |
A bitcast from src of type S to D. | |
| template<class T> | |
| bool | get_sign (T val) |
| u64 | pad (u64 offset, u64 align) |
Algorithms | |
| template<class I, class T, class L> | |
| I | binary_find (I begin, I end, T val, L lt) |
| std::string_view | subview (std::string_view s, size_t i, size_t n=std::string_view::npos) |
Like std::string::substr, but works on std::string_view instead. | |
| void | find_and_replace (std::string &str, std::string_view what, std::string_view repl) |
Replaces all occurrences of what with repl. | |
Helpers for Containers | |
| template<class S> | |
| auto | pop (S &s) -> decltype(s.top(), typename S::value_type()) |
| template<class Q> | |
| auto | pop (Q &q) -> decltype(q.front(), typename Q::value_type()) |
| template<class C, class K> | |
| auto | lookup (const C &container, const K &key) |
Yields pointer to element (or the element itself if it is already a pointer), if found and nullptr otherwise. | |
| template<class C, class K> | |
| auto | assert_lookup (C &container, const K &key) |
Looks up key in container, asserts that it exists, and returns the mapped value. | |
| template<class C, class... Args> | |
| auto | assert_emplace (C &container, Args &&... args) |
Invokes emplace on container, asserts that insertion actually happened, and returns the iterator. | |
erase | |
| template<class T, size_t N, class A, class U> | |
| Vector< T, N, A >::size_type | erase (Vector< T, N, A > &c, const U &value) noexcept |
| template<class T, size_t N, class A, class Pred> | |
| Vector< T, N, A >::size_type | erase_if (Vector< T, N, A > &c, Pred pred) noexcept |
Variables | |
| template<class T> | |
| static constexpr size_t | Default_Inlined_Size = std::max((size_t)1, 4 * sizeof(size_t) / sizeof(T)) |
| Use up to 4 words (i.e., 4 * sizeof(size_t)) of inlined storage, rounded up. | |
Enums that classify certain aspects of Defs. | |
| enum class | Node : node_t { CODE , Lit , Axm , Var , Global , Proxy , Hole , Type , Univ , UMax , UInc , Pi , Lam , App , Sigma , Tuple , Extract , Insert , Arr , Pack , Join , Inj , Match , Top , Meet , Merge , Split , Bot , Reform , Rule , Uniq , Nat , Idx } |
| enum class | Dep : unsigned { None = 0 , Mut = 1 << 0 , Var = 1 << 1 , Hole = 1 << 2 , Proxy = 1 << 3 } |
| Tracks a dependency to certain Defs transitively through the Def::deps() up to but excliding mutables. More... | |
| enum class | Judge : u32 { Form = 1 << 0 , Intro = 1 << 1 , Elim = 1 << 2 , Meta = 1 << 3 , Hole = 1 << 4 } |
| Judgement. More... | |
| enum class | Mut { Mut = 1 << 0 , Imm = 1 << 1 } |
| Judgement. More... | |
| static constexpr size_t | Num_Nodes = size_t(0) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) +size_t(1) |
Undo | |
Used by FPPass::analyze to indicate where to backtrack to. | |
| using | undo_t = size_t |
| static constexpr undo_t | No_Undo = std::numeric_limits<undo_t>::max() |
Plugin Interface | |
| |
| using | Normalizers = absl::flat_hash_map<flags_t, NormalizeFn> |
| using | Flags2Stages = absl::flat_hash_map<flags_t, std::function<std::unique_ptr<Stage>(World&)>> |
| Maps an an axiom of a Stage to a function that creates one. | |
| using | Backends = absl::btree_map<std::string, void (*)(World&, std::ostream&)> |
| mim::Plugin | mim_get_plugin () |
| struct mim::Flags |
Compiler switches that must be saved and looked up in later phases of compilation.
| struct mim::FNV1 |
Magic numbers for FNV-1 hash.
| using mim::Backends = absl::btree_map<std::string, void (*)(World&, std::ostream&)> |
| using mim::Def2Def = DefMap<const Def*> |
| using mim::DefMap = GIDMap<const Def*, To> |
| using mim::DefSet = GIDSet<const Def*> |
| using mim::DefVec = Vector<const Def*> |
| using mim::Flags2Stages = absl::flat_hash_map<flags_t, std::function<std::unique_ptr<Stage>(World&)>> |
| using mim::flags_t = u64 |
| using mim::GIDMap = absl::flat_hash_map<K, V, GIDHash<K>> |
| using mim::GIDNodeMap = absl::node_hash_map<K, V, GIDHash<K>> |
| using mim::GIDNodeSet = absl::node_hash_set<K, GIDHash<K>> |
| using mim::GIDSet = absl::flat_hash_set<K, GIDHash<K>> |
| using mim::Lam2Lam = LamMap<Lam*> |
| using mim::LamMap = GIDMap<Lam*, To> |
| using mim::LamSet = GIDSet<Lam*> |
| using mim::level_t = u64 |
| using mim::Mut2Mut = MutMap<Def*> |
| using mim::MutMap = GIDMap<Def*, To> |
| using mim::MutSet = GIDSet<Def*> |
| using mim::nat_t = u64 |
| using mim::node_t = u8 |
| using mim::NormalizeFn = const Def* (*)(const Def*, const Def*, const Def*) |
| using mim::Normalizers = absl::flat_hash_map<flags_t, NormalizeFn> |
| using mim::Passes = std::deque<std::unique_ptr<Pass>> |
| using mim::Phases = std::deque<std::unique_ptr<Phase>> |
| using mim::plugin_t = u64 |
| using mim::Repls = std::deque<std::unique_ptr<Repl>> |
| using mim::sub_t = u8 |
| using mim::tag_t = u8 |
| using mim::undo_t = size_t |
Definition at line 42 of file schedule.h.
| using mim::Var2Var = VarMap<const Var*> |
| using mim::VarMap = GIDMap<const Var*, To> |
| using mim::VarSet = GIDSet<const Var*> |
|
strong |
Tracks a dependency to certain Defs transitively through the Def::deps() up to but excliding mutables.
| Enumerator | |
|---|---|
| None | |
| Mut | |
| Var | |
| Hole | |
| Proxy | |
|
strong |
| Enumerator | |
|---|---|
| Form | Type Formation like |
| Intro | Term Introduction like |
| Elim | Term Elimination like |
| Meta | |
| Hole | Special rule for Hole. |
|
strong |
| auto mim::assert_emplace | ( | C & | container, |
| Args &&... | args ) |
Invokes emplace on container, asserts that insertion actually happened, and returns the iterator.
Definition at line 118 of file util.h.
Referenced by mim::World::app(), mim::World::Externals::externalize(), mim::Stage::hook(), mim::Driver::load(), mim::World::reduce(), reg_stages(), mim::World::register_annex(), and mim::Scheduler::Scheduler().
| auto mim::assert_lookup | ( | C & | container, |
| const K & | key ) |
| I mim::binary_find | ( | I | begin, |
| I | end, | ||
| T | val, | ||
| L | lt ) |
Definition at line 57 of file util.h.
Referenced by mim::Bound::find().
|
inline |
A bitcast from src of type S to D.
Definition at line 23 of file util.h.
Referenced by mim::ll::Emitter::emit_bb(), mim::Lit::get(), mim::plug::math::lit_f(), and mim::Res::Res().
Definition at line 130 of file tuple.cpp.
Referenced by cat(), cat(), cat_sigma(), cat_sigma(), cat_tuple(), and cat_tuple().
Definition at line 138 of file tuple.cpp.
References mim::Def::proj().
Definition at line 332 of file tuple.h.
References cat_sigma().
Definition at line 333 of file tuple.h.
References cat_sigma(), and mim::Def::world().
Definition at line 150 of file tuple.cpp.
References cat().
Referenced by cat_sigma(), and cat_sigma().
Definition at line 153 of file tuple.cpp.
References cat(), and mim::World::sigma().
Definition at line 330 of file tuple.h.
References cat_tuple().
Definition at line 331 of file tuple.h.
References cat_tuple(), and mim::Def::world().
Definition at line 149 of file tuple.cpp.
References cat().
Referenced by cat_tuple(), cat_tuple(), mim::plug::tuple::normalize_cat(), and mim::plug::vec::normalize_cat().
Definition at line 152 of file tuple.cpp.
References cat(), and mim::World::tuple().
The high level view is:
In CPS the types look like:
Definition at line 62 of file lam.cpp.
References mim::Pi::dom(), mim::Pi::isa_returning(), and mim::Pi::ret_dom().
Referenced by mim::plug::autodiff::Eval::augment_app().
|
noexcept |
Definition at line 70 of file vector.h.
Referenced by mim::plug::regex::normalize_disj().
| std::ostream & mim::errf | ( | const char * | fmt, |
| Args &&... | args ) |
| std::ostream & mim::errln | ( | const char * | fmt, |
| Args &&... | args ) |
| void mim::error | ( | const char * | fmt, |
| Args &&... | args ) |
Wraps mim::print to throw T with a formatted message.
| void mim::error | ( | Loc | loc, |
| const char * | f, | ||
| Args &&... | args ) |
Single Error that throws immediately.
Definition at line 125 of file dbg.h.
References error(), and fmt().
Referenced by mim::PassMan::add(), mim::World::annex(), mim::ast::AxmDecl::bind(), mim::Arr::check(), mim::Pi::check(), mim::Reform::check(), mim::Rule::check(), mim::dl::close(), mim::ll::compile_and_run(), mim::Stage::create(), dfa2matcher(), mim::ast::AxmDecl::emit(), mim::ast::ExtractExpr::emit_(), mim::ast::RetExpr::emit_(), mim::ll::Emitter::emit_bb(), error(), mim::sys::exec(), mim::World::extract(), mim::dl::get(), mim::World::insert(), mim::World::lit(), mim::Driver::load(), main(), mim::World::match(), mim::plug::refly::normalize_equiv(), mim::dl::open(), mim::World::seq(), mim::World::tuple(), mim::World::type(), mim::World::uinc(), and mim::World::umax().
Definition at line 5 of file eta_red.cpp.
References mim::Lam::body(), and mim::Def::var().
Referenced by mim::EtaRed::rewrite().
|
inline |
Replaces all occurrences of what with repl.
Definition at line 74 of file util.h.
Referenced by mim::plug::autodiff::Eval::augment_().
Flattens a sigma/array/pack/tuple.
Definition at line 110 of file tuple.cpp.
References flatten(), mim::Def::is_intro(), mim::World::sigma(), mim::World::tuple(), mim::Def::type(), and mim::Def::world().
Referenced by flatten(), flatten(), and mim::Scalarize::rewrite().
Same as unflatten, but uses the operands of a flattened Pack / Tuple directly.
Definition at line 98 of file tuple.cpp.
References mim::Def::arity(), flatten(), mim::Lit::isa(), and mim::Def::proj().
Definition at line 128 of file world.cpp.
References flatten_umax().
Referenced by flatten_umax(), and mim::World::umax().
| std::string mim::fmt | ( | const char * | s, |
| Args &&... | args ) |
Wraps mim::print to output a formatted std:string.
Definition at line 163 of file print.h.
References print().
Referenced by mim::ll::compile(), errf(), errln(), mim::ast::AST::error(), error(), error(), mim::Driver::load(), mim::Log::log(), mim::Log::log(), mim::Error::msg(), mim::ast::AST::note(), outf(), outln(), println(), and mim::ast::AST::warn().
|
constexprnoexcept |
Definition at line 115 of file span.h.
Referenced by mim::ast::ExtractExpr::emit_(), mim::Lit::rebuild_(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm_App(), mim::Rewriter::Rewriter(), and tuple_of_dict().
|
inlineconstexprnoexcept |
Definition at line 32 of file hash.h.
References murmur3(), and splitmix64().
Referenced by mim::Def::Def(), mim::GIDHash< T >::operator()(), and mim::UseHash::operator()().
|
inlineconstevalnoexcept |
Definition at line 75 of file hash.h.
Referenced by mim::Def::Def(), hash_begin(), and mim::UseHash::operator()().
|
constexprnoexcept |
Definition at line 78 of file hash.h.
References hash_begin(), and hash_combine().
|
constexprnoexcept |
Definition at line 62 of file hash.h.
Referenced by hash_begin(), and mim::UseHash::operator()().
|
constexpr |
Definition at line 158 of file axm.h.
References is_commutative().
|
constexpr |
Definition at line 107 of file core.h.
References mim::plug::core::and_, mim::plug::core::f, mim::plug::core::fst, mim::plug::core::nxor, mim::plug::core::or_, mim::plug::core::snd, mim::plug::core::t, and mim::plug::core::xor_.
|
constexpr |
Definition at line 124 of file core.h.
References is_commutative().
|
constexpr |
Definition at line 122 of file core.h.
References is_commutative().
|
constexpr |
Definition at line 123 of file core.h.
References is_commutative().
|
constexpr |
Definition at line 125 of file core.h.
References is_commutative().
|
constexpr |
Definition at line 128 of file math.h.
References is_commutative().
|
constexpr |
Definition at line 152 of file axm.h.
Referenced by is_associative(), is_associative(), is_associative(), is_associative(), is_associative(), is_associative(), mim::plug::core::normalize_bit2(), mim::plug::core::normalize_nat(), and mim::plug::core::normalize_ncmp().
|
constexpr |
|
constexpr |
Definition at line 99 of file core.h.
References mim::plug::core::ne.
|
constexpr |
|
constexpr |
Definition at line 97 of file core.h.
References mim::plug::core::ne.
|
constexpr |
Definition at line 98 of file core.h.
References mim::plug::core::add, and mim::plug::core::mul.
|
constexpr |
Definition at line 126 of file math.h.
References mim::plug::math::add, and mim::plug::math::mul.
|
constexpr |
|
constexpr |
| bool mim::is_unit | ( | const Def * | def | ) |
Definition at line 76 of file tuple.cpp.
References mim::World::sigma(), mim::Def::type(), and mim::Def::world().
Definition at line 354 of file lam.h.
Referenced by mim::TailRecElim::analyze(), mim::BetaRed::rewrite(), mim::LamSpec::rewrite(), mim::plug::mem::pass::CopyProp::rewrite(), mim::plug::mem::pass::SSA::rewrite(), and mim::TailRecElim::rewrite().
Definition at line 346 of file lam.h.
Referenced by mim::EtaExp::analyze(), mim::plug::mem::pass::SSA::analyze(), mim::EtaExp::rewrite(), and mim::EtaRed::rewrite().
These are Lams that are neither nullptr, nor Lam::is_external, nor Lam::is_unset.
Definition at line 349 of file lam.h.
References mim::Def::is_external(), and mim::Def::is_set().
Referenced by mim::BetaRed::analyze(), mim::plug::mem::pass::SSA::analyze(), mim::BetaRed::rewrite(), mim::LamSpec::rewrite(), mim::plug::mem::pass::CopyProp::rewrite(), and mim::plug::mem::pass::SSA::rewrite().
| auto mim::lookup | ( | const C & | container, |
| const K & | key ) |
Yields pointer to element (or the element itself if it is already a pointer), if found and nullptr otherwise.
absl::flat_hash_map will invalidate this pointer. Definition at line 100 of file util.h.
Referenced by mim::Driver::backend(), mim::Driver::get_fun_ptr(), mim::Driver::is_loaded(), mim::EtaExp::new2old(), mim::Driver::normalizer(), mim::World::Externals::operator[](), mim::EtaExp::rewrite(), and mim::Driver::stage().
| mim::Plugin mim::mim_get_plugin | ( | ) |
To be implemented and exported by a plugin.
References MIM_EXPORT.
Referenced by mim::Driver::load().
|
inlineconstexprnoexcept |
|
constexpr |
| std::ostream & mim::operator<< | ( | std::ostream & | os, |
| const Def * | def ) |
| void mim::optimize | ( | World & | world | ) |
Definition at line 8 of file optimize.cpp.
References mim::Stage::apply(), mim::World::driver(), mim::World::externals(), mim::Def::internalize(), mim::World::Externals::mutate(), mim::Driver::stage(), mim::World::sym(), mim::Def::type(), and mim::App::uncurry_callee().
Referenced by main().
| std::ostream & mim::outf | ( | const char * | fmt, |
| Args &&... | args ) |
| std::ostream & mim::outln | ( | const char * | fmt, |
| Args &&... | args ) |
Definition at line 47 of file util.h.
Referenced by mim::plug::core::normalize_trait().
| auto mim::pop | ( | Q & | q | ) | -> decltype(q.front(), typename Q::value_type()) |
| auto mim::pop | ( | S & | s | ) | -> decltype(s.top(), typename S::value_type()) |
Definition at line 83 of file util.h.
Referenced by mim::plug::clos::free_defs(), mim::unique_queue< Set >::pop(), mim::unique_stack< Set >::pop(), and mim::PassMan::run().
|
static |
Definition at line 105 of file schedule.cpp.
References mim::Def::deps(), mim::Def::local_muts(), mim::Nest::Node::mut(), and post_order().
Referenced by post_order(), and mim::Scheduler::schedule().
| std::ostream & mim::print | ( | std::ostream & | os, |
| const char * | s ) |
Base case.
Definition at line 5 of file print.cpp.
Referenced by mim::Error::ack(), mim::ll::BB::assign(), mim::ast::AST::bootstrap(), mim::ll::Emitter::declare(), mim::World::dump(), mim::ll::Emitter::emit_bb(), mim::ll::Emitter::emit_epilogue(), mim::ll::Emitter::emit_imported(), errf(), error(), mim::ll::Emitter::finalize(), fmt(), mim::Log::log(), mim::Error::Msg::operator<<, outf(), mim::ll::Emitter::prepare(), print(), mim::Tab::print(), println(), mim::ast::AliasPtrn::stream(), mim::ast::AppExpr::stream(), mim::ast::ArrowExpr::stream(), mim::ast::AxmDecl::stream(), mim::ast::CDecl::stream(), mim::ast::DeclExpr::stream(), mim::ast::ExtractExpr::stream(), mim::ast::IdExpr::stream(), mim::ast::IdPtrn::stream(), mim::ast::InjExpr::stream(), mim::ast::InsertExpr::stream(), mim::ast::LamDecl::Dom::stream(), mim::ast::LamDecl::stream(), mim::ast::LamExpr::stream(), mim::ast::LetDecl::stream(), mim::ast::LitExpr::stream(), mim::ast::MatchExpr::Arm::stream(), mim::ast::PiExpr::Dom::stream(), mim::ast::PiExpr::stream(), mim::ast::PrimaryExpr::stream(), mim::ast::RecDecl::stream(), mim::ast::RuleDecl::stream(), mim::ast::SeqExpr::stream(), mim::ast::TupleExpr::stream(), mim::ast::TuplePtrn::stream(), mim::ast::TypeExpr::stream(), mim::ast::UnionExpr::stream(), mim::ast::UniqExpr::stream(), and mim::ll::BB::tail().
| std::ostream & mim::print | ( | std::ostream & | os, |
| const char * | s, | ||
| T && | t, | ||
| Args &&... | args ) |
| std::ostream & mim::println | ( | std::ostream & | os, |
| const char * | fmt, | ||
| Args &&... | args ) |
As above but end with std::endl.
Definition at line 157 of file print.h.
References fmt(), and print().
Referenced by mim::Nest::dot(), and mim::ast::RetExpr::stream().
|
inline |
Definition at line 95 of file types.h.
Referenced by mim::BitSet::operator>>=().
| mim::Span | ( | const std::array< T, N > & | ) | -> Span< const T, N > |
| mim::Span | ( | const Vec & | ) | -> Span< const typename Vec::value_type, std::dynamic_extent > |
| mim::Span | ( | I | , |
| E | ) -> Span< std::remove_reference_t< std::iter_reference_t< I > > > |
| mim::Span | ( | R && | ) | -> Span< std::remove_reference_t< std::ranges::range_reference_t< R > > > |
| mim::Span | ( | std::array< T, N > & | ) | -> Span< T, N > |
| mim::Span | ( | T(&) | [N] | ) | -> Span< T, N > |
| mim::Span | ( | Vec & | ) | -> Span< typename Vec::value_type, std::dynamic_extent > |
|
inlineconstexprnoexcept |
|
inline |
Like std::string::substr, but works on std::string_view instead.
Definition at line 68 of file util.h.
Referenced by mim::Annex::split().
| std::string mim::tuple2str | ( | const Def * | def | ) |
Definition at line 78 of file tuple.cpp.
References mim::Def::arity(), mim::Lit::isa(), mim::Def::proj(), and mim::Def::world().
Referenced by mim::PrefixCleanup::apply(), mim::plug::refly::normalize_check(), and mim::plug::compile::normalize_is_loaded().
Definition at line 12 of file rule.cpp.
References get(), mim::World::mut_hole(), mim::World::mut_hole_type(), and mim::World::tuple().
Referenced by mim::Rule::replace().
Definition at line 155 of file tuple.cpp.
Referenced by mim::plug::mem::op_lea().
Applies the reverse transformation on a Pack / Tuple, given the original type.
Definition at line 124 of file tuple.cpp.
References mim::Def::arity(), mim::Lit::as(), mim::Def::projs(), and unflatten().
Referenced by unflatten(), and unflatten().
Same as unflatten, but uses the operands of a flattened Pack / Tuple directly.
Definition at line 117 of file tuple.cpp.
References unflatten().
| mim::Vector | ( | I | , |
| I | , | ||
| A | = A() ) -> Vector< typename std::iterator_traits< I >::value_type, Default_Inlined_Size< typename std::iterator_traits< I >::value_type >, A > |
References Default_Inlined_Size.
Referenced by mim::Sets< Def >::Set< Def >::erase(), mim::Sets< Def >::Set< Def >::merge(), and mim::Def::projs().
|
staticconstexpr |
Definition at line 22 of file pass.h.
Referenced by mim::BetaRed::analyze(), mim::BetaRed::analyze(), mim::EtaExp::analyze(), mim::EtaExp::analyze(), mim::EtaRed::analyze(), mim::Pass::analyze(), mim::Pass::analyze(), mim::Pass::analyze(), mim::plug::clos::LowerTypedClosPrep::analyze(), mim::plug::mem::pass::CopyProp::analyze(), mim::plug::mem::pass::SSA::analyze(), mim::plug::mem::pass::SSA::analyze(), mim::TailRecElim::analyze(), mim::PassMan::run(), mim::FPPass< P, M >::undo_enter(), and mim::FPPass< P, M >::undo_visit().
|
staticconstexpr |