MimIR 0.1
MimIR is my Intermediate Representation
|
Namespaces | |
namespace | ast |
namespace | dl |
namespace | ll |
namespace | Node |
namespace | plug |
namespace | sys |
Classes | |
class | Ac |
Constructs a Meet value. More... | |
struct | Annex |
Holds info about an entity defined within a Plugin (called Annex). More... | |
class | App |
class | Arr |
A (possibly paramterized) Array. More... | |
class | Axiom |
class | BetaRed |
Optimistically performs β-reduction (aka inlining). More... | |
class | BitSet |
class | Bound |
Common base for TBound. More... | |
class | CFA |
Control Flow Analysis. More... | |
class | CFG |
A Control-Flow Graph. More... | |
class | CFNode |
A Control-Flow Node. More... | |
class | Check |
class | Cleanup |
Removes unreachable and dead code by rebuilding the whole World into a new one and swap ping afterwards. More... | |
class | ClosedMutPhase |
Transitively visits all reachable closed mutables (Def::is_closed()) in World. More... | |
struct | Dbg |
class | Def |
Base class for all Defs. More... | |
struct | DefDefEq |
struct | DefDefHash |
class | DepNode |
class | DepTree |
class | DomFrontierBase |
A Dominance Frontier Graph. More... | |
class | DomTreeBase |
A Dominance Tree. More... | |
class | Driver |
Some "global" variables needed all over the place. More... | |
struct | Elem |
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 | EtaRed |
Performs η-reduction. 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 |
class | FPPass |
Inherit from this class using CRTP, if you do need a Pass with a state and a fixed-point. More... | |
class | FPPhase |
Like a RWPhase but starts with a fixed-point loop of FPPhase::analyze beforehand. More... | |
struct | GIDEq |
struct | GIDHash |
struct | GIDLt |
class | Global |
class | Idx |
A built-in constant of type Nat -> * . More... | |
class | IndexMap |
class | IndexSet |
class | Infer |
This node is a hole in the IR that is inferred by its context later on. 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 | LoopTree |
Calculates a loop nesting forest rooted at LoopTree::root_. More... | |
class | LoopTreeBuilder |
class | Match |
class | Nat |
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 | PassPhase |
Wraps a Pass 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 | Pi |
A dependent function type. More... | |
class | Pick |
Picks the aspect of a Meet [value](Pick::value) by its [type](Def::type). More... | |
class | Pipeline |
Organizes several Phases as a pipeline. More... | |
class | PipelineBuilder |
struct | Plugin |
Basic info and registration function pointer to be returned from a specific plugin. More... | |
class | Pool |
Maintains PooledSets within a fe::Arena and unifies them in a absl::flat_hash_set . More... | |
class | PooledSet |
Ordered set maintained in a consecutive buffer and unified in Pool. More... | |
class | Proxy |
class | Ref |
Helper class to retrieve Infer::arg if present. More... | |
class | Res |
Utility class when folding constants in normalizers. More... | |
class | RetWrap |
class | Rewriter |
Recurseivly rewrites part of a program into the provided World. More... | |
class | RWPass |
Inherit from this class using CRTP, if your Pass does not need state and a fixed-point iteration. More... | |
class | RWPhase |
Visits the current Phase::world and constructs a new RWPhase::world along the way. More... | |
class | Scalarize |
Perform Scalarization (= Argument simplification). More... | |
class | Scheduler |
class | Scope |
A Scope represents a region of Defs that are live from the view of an entry's Var . More... | |
class | ScopePhase |
Transitively visits all reachable Scopes in World that do not have free variables. More... | |
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 | Singleton |
A singleton wraps a type into a higher order type. More... | |
class | Span |
This is a thin wrapper for std::span<T, N> with the following additional features: More... | |
class | Tab |
Keeps track of indentation level. More... | |
class | TailRecElim |
class | TBound |
Specific Bound depending on Up . More... | |
class | Test |
Test whether Test::value currently holds type Test::probe: 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 | unique_queue |
class | unique_stack |
class | Univ |
class | Use |
References a user. More... | |
struct | UseEq |
struct | UseHash |
class | Var |
class | VarRewriter |
class | Vector |
This is a thin wrapper for absl::InlinedVector<T, N, / A> which in turn is a drop-in replacement for std::vector<T, A> . More... | |
class | Vel |
Constructs a Join value. More... | |
class | World |
The World represents the whole program and manages creation of MimIR nodes (Defs). More... | |
Concepts | |
concept | annex_with_subs |
concept | annex_without_subs |
concept | Vectorlike |
Something which behaves like std::vector or std::array . | |
Typedefs | |
using | NormalizeFn = Ref (*)(Ref, Ref, Ref) |
using | Uses = absl::flat_hash_set<Use, UseHash, UseEq> |
template<class T , size_t N = std::dynamic_extent> | |
using | View = Span<const T, N> |
Control Flow | |
using | CFNodes = GIDSet<const CFNode*> |
using | DomFrontiers = DomFrontierBase<true> |
using | ControlDeps = DomFrontierBase<false> |
using | DomTree = DomTreeBase<true> |
using | PostDomTree = DomTreeBase<false> |
using | F_CFG = CFG<true> |
using | B_CFG = CFG<false> |
Def | |
GIDSet / GIDMap keyed by Def::gid of | |
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) | |
GIDSet / GIDMap keyed by Def::gid of | |
template<class To > | |
using | MutMap = GIDMap<Def*, To> |
using | MutSet = GIDSet<Def*> |
using | Mut2Mut = MutMap<Def*> |
using | Muts = PooledSet<Def*> |
Var | |
GIDSet / GIDMap keyed by Var::gid of | |
template<class To > | |
using | VarMap = GIDMap<const Var*, To> |
using | VarSet = GIDSet<const Var*> |
using | Var2Var = VarMap<const Var*> |
using | Vars = PooledSet<const Var*> |
DefDef | |
using | DefDef = std::tuple<const Def*, const Def*> |
template<class To > | |
using | DefDefMap = absl::flat_hash_map<DefDef, To, DefDefHash, DefDefEq> |
using | DefDefSet = absl::flat_hash_set<DefDef, DefDefHash, DefDefEq> |
Lam | |
GIDSet / GIDMap keyed by Lam::gid of | |
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> |
using | Join = TBound<true> |
Aliases for some Base Types | |
using | hash_t = uint32_t |
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>, GIDEq<K>> |
template<class K > | |
using | GIDSet = absl::flat_hash_set<K, GIDHash<K>, GIDEq<K>> |
template<class K , class V > | |
using | GIDNodeMap = absl::node_hash_map<K, V, GIDHash<K>, GIDEq<K>> |
template<class K > | |
using | GIDNodeSet = absl::node_hash_set<K, GIDHash<K>, GIDEq<K>> |
Enumerations | |
enum class | Sort { Term , Type , Kind , Space , Univ , Level } |
Dep | |
enum class | Dep : unsigned { None = 0 , Axiom = 1 << 0 , Infer = 1 << 1 , Mut = 1 << 2 , Proxy = 1 << 3 , Var = 1 << 4 } |
Functions | |
void | commute (const Def *&a, const Def *&b) |
Swap Lit to left - or smaller Def::gid, if no lit present. | |
void | optimize (World &) |
std::ostream operator | |
std::ostream & | operator<< (std::ostream &, const CFNode *) |
std::ostream & | operator<< (std::ostream &os, const Def *def) |
This will stream def as an operand. | |
std::ostream & | operator<< (std::ostream &, Ref) |
template<bool forward> | |
std::ostream & | operator<< (std::ostream &os, const typename LoopTree< forward >::Base *n) |
match/force | |
template<class Id , bool DynCast = true> | |
auto | match (Ref def) |
template<class Id , bool DynCast = true> | |
auto | match (Id id, Ref def) |
template<class Id > | |
auto | force (Ref def) |
template<class Id > | |
auto | force (Id id, Ref 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) |
std::deque< const App * > | decurry (const Def *) |
Yields curried Apps in a flat std::deque<const App*> . | |
const Def * | compose_cn (const Def *f, const Def *g) |
The high level view is: | |
std::pair< const Def *, std::vector< const Def * > > | collect_args (const Def *def) |
Helper function to cope with the fact that normalizers take all arguments and not only its axiom arguments. | |
Register Pass/Phase | |
template<class A , class P , class... CArgs> | |
void | register_pass (Passes &passes, CArgs &&... args) |
template<class A , class P , class... CArgs> | |
void | register_phase (Passes &passes, CArgs &&... args) |
template<class A , class P , class Q > | |
void | register_pass_with_arg (Passes &passes) |
rewrite | |
Rewrites | |
DefVec | rewrite (Def *mut, Ref arg) |
Ref | rewrite (size_t i, Def *mut, Ref arg) |
As above but only rewrites mut's i^th op. | |
Ref | rewrite (Ref def, Def *mut, Ref arg) |
As above but rewrites def . | |
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. | |
DefVec | merge (Defs, Defs) |
DefVec | merge (const Def *def, Defs defs) |
const Def * | merge_sigma (const Def *def, Defs defs) |
const Def * | merge_tuple (const Def *def, Defs defs) |
Ref | tuple_of_types (Ref t) |
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. | |
Murmur3 Hash | |
See Wikipedia. | |
hash_t | murmur_32_scramble (hash_t k) |
hash_t | murmur3 (hash_t h, uint32_t key) |
hash_t | murmur3 (hash_t h, uint64_t key) |
hash_t | murmur3_rest (hash_t h, uint8_t key) |
hash_t | murmur3_rest (hash_t h, uint16_t key) |
hash_t | murmur3_finalize (hash_t h, hash_t len) |
hash_t | murmur3 (hash_t h) |
Use for a single value to hash. | |
FNV-1 Hash | |
See Wikipedia. | |
template<class T > | |
hash_t | hash_combine (hash_t seed, T v) |
Returns a new hash by combining the hash seed with val . | |
template<class T > | |
hash_t | hash_combine (hash_t seed, T *val) |
template<class T , class... Args> | |
hash_t | hash_combine (hash_t seed, T val, Args &&... args) |
template<class T > | |
hash_t | hash_begin (T val) |
hash_t | hash_begin () |
String Hashing | |
hash_t | hash (const char *) |
hash_t | hash (std::string_view) |
IndexMap find | |
template<class Indexer , class Key , class Value > | |
Value * | find (IndexMap< Indexer, Key, Value * > &map, Key key) |
template<class Indexer , class Key , class Value > | |
const Value * | find (const IndexMap< Indexer, Key, Value * > &map, Key key) |
IndexSet visit | |
template<class Indexer , class Key > | |
bool | visit (IndexSet< Indexer, Key > &set, const Key &key) |
template<class Indexer , class Key > | |
void | visit_first (IndexSet< Indexer, Key > &set, const Key &key) |
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 This , class T > | |
T & | lazy_init (const This *self, std::unique_ptr< T > &ptr) |
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 Cmp > | |
I | binary_find (I begin, I end, T val, Cmp cmp) |
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... 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 > | |
constexpr Vector< T, N, A >::size_type | erase (Vector< T, N, A > &c, const U &value) |
template<class T , size_t N, class A , class Pred > | |
constexpr Vector< T, N, A >::size_type | erase_if (Vector< T, N, A > &c, Pred pred) |
Variables | |
template<class T > | |
static constexpr size_t | SizeOf = sizeof(std::conditional_t<std::is_pointer_v<T>, uintptr_t, T>) |
template<class T > | |
static constexpr size_t | Default_Inlined_Size = std::max((size_t)1, 4 * sizeof(size_t) / sizeof(T)) |
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 | Passes = absl::flat_hash_map<flags_t, std::function<void(World&, PipelineBuilder&, const Def*)>> |
axiom ↦ (pipeline part) × (axiom application) → () The function should inspect Application to construct the Pass/Phase and add it to the pipeline. | |
using | Backends = absl::btree_map<std::string, void (*)(World&, std::ostream&)> |
MIM_EXPORT mim::Plugin | mim_get_plugin () |
struct mim::Flags |
Compiler switches that must be saved and looked up in later phases of compilation.
using mim::B_CFG = CFG<false> |
using mim::Backends = absl::btree_map<std::string, void (*)(World&, std::ostream&)> |
using mim::CFNodes = GIDSet<const CFNode*> |
using mim::ControlDeps = DomFrontierBase<false> |
Definition at line 43 of file domfrontier.h.
using mim::Def2Def = DefMap<const Def*> |
using mim::DefDef = std::tuple<const Def*, const Def*> |
using mim::DefDefMap = absl::flat_hash_map<DefDef, To, DefDefHash, DefDefEq> |
using mim::DefDefSet = absl::flat_hash_set<DefDef, DefDefHash, DefDefEq> |
using mim::DefMap = GIDMap<const Def*, To> |
using mim::DefSet = GIDSet<const Def*> |
using mim::DefVec = Vector<const Def*> |
using mim::DomFrontiers = DomFrontierBase<true> |
Definition at line 42 of file domfrontier.h.
typedef DomTreeBase< true > mim::DomTree = DomTreeBase<true> |
using mim::F_CFG = CFG<true> |
using mim::flags_t = u64 |
using mim::GIDMap = absl::flat_hash_map<K, V, GIDHash<K>, GIDEq<K>> |
using mim::GIDNodeMap = absl::node_hash_map<K, V, GIDHash<K>, GIDEq<K>> |
using mim::GIDNodeSet = absl::node_hash_set<K, GIDHash<K>, GIDEq<K>> |
using mim::GIDSet = absl::flat_hash_set<K, GIDHash<K>, GIDEq<K>> |
using mim::hash_t = uint32_t |
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::Normalizers = absl::flat_hash_map<flags_t, NormalizeFn> |
using mim::Passes = absl::flat_hash_map<flags_t, std::function<void(World&, PipelineBuilder&, const Def*)>> |
using mim::plugin_t = u64 |
using mim::PostDomTree = DomTreeBase<false> |
using mim::sub_t = u8 |
using mim::tag_t = u8 |
using mim::undo_t = size_t |
using mim::Var2Var = VarMap<const Var*> |
using mim::VarMap = GIDMap<const Var*, To> |
using mim::VarSet = GIDSet<const Var*> |
using mim::w2f = typename detail::w2f_<w>::type |
using mim::w2s = typename detail::w2s_<w>::type |
using mim::w2u = typename detail::w2u_<w>::type |
|
strong |
|
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 102 of file util.h.
Referenced by mim::Driver::load(), mim::World::make_external(), mim_get_plugin(), mim::World::register_annex(), register_pass(), register_pass_with_arg(), register_phase(), and mim::Scheduler::Scheduler().
I mim::binary_find | ( | I | begin, |
I | end, | ||
T | val, | ||
Cmp | cmp ) |
Definition at line 58 of file util.h.
Referenced by mim::PooledSet< T >::contains(), mim::Pool< T >::erase(), and mim::Bound::find().
|
inline |
A bitcast from src
of type S
to D
.
Definition at line 26 of file util.h.
Referenced by mim::ll::Emitter::emit_bb(), mim::Lit::get(), and mim::plug::math::lit_f().
Helper function to cope with the fact that normalizers take all arguments and not only its axiom arguments.
Definition at line 86 of file lam.cpp.
References collect_args().
Referenced by collect_args(), mim::plug::compile::handle_optimization_part(), mim_get_plugin(), mim::plug::compile::normalize_combine_pass_list(), mim::plug::compile::normalize_combined_phase(), mim::plug::compile::normalize_pass_phase(), and optimize().
Swap Lit to left - or smaller Def::gid, if no lit present.
Definition at line 25 of file normalize.h.
References mim::Def::gid().
Referenced by mim::plug::core::normalize_bit2(), mim::plug::core::normalize_nat(), and mim::plug::core::normalize_ncmp().
The high level view is:
In CPS the types look like:
Definition at line 53 of file lam.cpp.
References mim::Pi::dom(), mim::Pi::isa_returning(), and mim::Pi::ret_dom().
Referenced by mim::plug::autodiff::AutoDiffEval::augment_app().
Yields curried Apps in a flat std::deque<const App*>
.
Definition at line 44 of file lam.cpp.
Referenced by mim::World::iapp().
|
constexpr |
Definition at line 61 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 throw
s immediately.
Definition at line 122 of file dbg.h.
References fmt().
Referenced by mim::World::annex(), mim::World::arr(), mim::Arr::check(), mim::Lam::check(), mim::Pi::check(), mim::dl::close(), mim::ll::compile_and_run(), dfa2matcher(), mim::ast::AxiomDecl::emit(), mim::ast::ExtractExpr::emit_(), mim::ast::RetExpr::emit_(), mim::ll::Emitter::emit_bb(), mim::sys::exec(), mim::World::extract(), mim::dl::get(), mim::World::insert(), mim::World::lit(), mim::Driver::load(), main(), mim::dl::open(), optimize(), mim::World::pack(), mim::World::tuple(), mim::World::type(), mim::World::uinc(), and mim::World::umax().
|
inline |
Definition at line 73 of file indexmap.h.
References find().
|
inline |
Definition at line 67 of file indexmap.h.
References mim::IndexMap< Indexer, Key, Value >::array(), and mim::IndexMap< Indexer, Key, Value >::indexer().
Referenced by find(), and mim::LoopTree< forward >::operator[]().
|
inline |
Replaces all occurrences of what
with repl
.
Definition at line 70 of file util.h.
Referenced by mim::plug::autodiff::AutoDiffEval::augment_().
Flattens a sigma/array/pack/tuple.
Definition at line 66 of file tuple.cpp.
References flatten(), mim::Def::is_term(), 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 55 of file tuple.cpp.
References flatten(), mim::Def::isa_lit_arity(), and mim::Def::proj().
std::string mim::fmt | ( | const char * | s, |
Args &&... | args ) |
Wraps mim::print to output a formatted std:string
.
Definition at line 155 of file print.h.
References print().
Referenced by mim::ll::compile(), errf(), errln(), mim::ast::AST::error(), error(), error(), mim::Log::log(), mim::Log::log(), mim::Error::msg(), mim::ast::AST::note(), outf(), outln(), println(), and mim::ast::AST::warn().
auto mim::force | ( | Id | id, |
Ref | def ) |
auto mim::force | ( | Ref | def | ) |
Definition at line 133 of file axiom.h.
References match().
Referenced by mim::ll::Emitter::emit_bb(), mim::plug::mem::normalize_lea(), mim::plug::mem::normalize_load(), mim::plug::mem::op_lea(), and mim::plug::mem::op_lea_unsafe().
hash_t mim::hash | ( | const char * | s | ) |
Definition at line 5 of file hash.cpp.
References hash_begin(), and hash_combine().
Referenced by mim::DefDefHash::operator()().
hash_t mim::hash | ( | std::string_view | s | ) |
Definition at line 11 of file hash.cpp.
References hash_begin(), and hash_combine().
|
inline |
Definition at line 102 of file hash.h.
References mim::FNV1::offset.
Referenced by hash(), hash(), and mim::UseHash::operator()().
hash_t mim::hash_begin | ( | T | val | ) |
Definition at line 101 of file hash.h.
References hash_combine(), and mim::FNV1::offset.
Definition at line 95 of file hash.h.
References hash_combine().
Returns a new hash by combining the hash seed
with val
.
Definition at line 82 of file hash.h.
References mim::FNV1::prime.
Referenced by hash(), hash(), hash_begin(), hash_combine(), hash_combine(), and mim::UseHash::operator()().
Definition at line 97 of file hash.h.
References hash_combine().
|
constexpr |
Definition at line 142 of file axiom.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 139 of file axiom.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 46 of file tuple.cpp.
References mim::World::sigma(), mim::Def::type(), and mim::Def::world().
Definition at line 256 of file lam.h.
Referenced by mim::TailRecElim::analyze(), mim::BetaRed::rewrite(), mim::LamSpec::rewrite(), mim::plug::mem::CopyProp::rewrite(), mim::plug::mem::SSAConstr::rewrite(), and mim::TailRecElim::rewrite().
Definition at line 248 of file lam.h.
Referenced by mim::EtaExp::analyze(), mim::plug::mem::SSAConstr::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 251 of file lam.h.
References mim::Def::is_external(), and mim::Def::is_set().
Referenced by mim::BetaRed::analyze(), mim::plug::mem::SSAConstr::analyze(), mim::BetaRed::rewrite(), mim::LamSpec::rewrite(), mim::plug::mem::CopyProp::rewrite(), and mim::plug::mem::SSAConstr::rewrite().
|
inline |
Definition at line 21 of file util.h.
Referenced by mim::CFA::b_cfg(), mim::Scope::cfa(), mim::CFG< bool >::domfrontier(), mim::CFG< bool >::domtree(), mim::CFA::f_cfg(), and mim::CFG< bool >::looptree().
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 93 of file util.h.
Referenced by mim::Driver::backend(), mim::World::external(), mim::Driver::get_fun_ptr(), mim::Driver::is_loaded(), mim::EtaExp::new2old(), mim::Driver::normalizer(), mim::Driver::pass(), and mim::EtaExp::rewrite().
auto mim::match | ( | Id | id, |
Ref | def ) |
Definition at line 122 of file axiom.h.
References mim::Axiom::get().
auto mim::match | ( | Ref | def | ) |
Definition at line 112 of file axiom.h.
References mim::Annex::Base, and mim::Axiom::get().
Referenced by mim::plug::clos::LowerTypedClosPrep::analyze(), mim::plug::autodiff::autodiff_type_fun(), mim::plug::regex::compare_re(), mim::ll::Emitter::emit_bb(), mim::ll::Emitter::emit_epilogue(), mim::ll::Emitter::emit_imported(), mim::plug::regex::equals_any(), mim::plug::regex::equals_any(), mim::plug::regex::flatten_in_arg(), mim::plug::clos::ClosLit::fnc_as_lam(), force(), force(), mim::plug::regex::get_range(), mim::plug::math::isa_f(), mim::plug::math::match_f(), mim::plug::mem::mem_def(), mim::plug::regex::merge_ranges(), mim::plug::autodiff::normalize_add(), mim::plug::core::normalize_bitcast(), mim::plug::regex::normalize_disj(), mim::plug::core::normalize_pe(), mim::plug::regex::normalize_quant(), mim::plug::matrix::normalize_read(), mim::plug::matrix::normalize_shape(), mim::plug::core::normalize_trait(), mim::plug::matrix::op_read(), mim::ll::Emitter::prepare(), mim::plug::mem::replace_mem(), mim::plug::affine::LowerFor::rewrite(), mim::plug::autodiff::AutoDiffEval::rewrite(), mim::plug::autodiff::AutoDiffZero::rewrite(), mim::plug::autodiff::AutoDiffZeroCleanup::rewrite(), mim::plug::clos::ClosConvPrep::rewrite(), mim::plug::clos::LowerTypedClosPrep::rewrite(), mim::plug::mem::Alloc2Malloc::rewrite(), mim::plug::mem::SSAConstr::rewrite(), mim::plug::refly::RemoveDbgPerm::rewrite(), mim::plug::regex::LowerRegex::rewrite(), mim::plug::matrix::LowerMatrixHighLevelMapRed::rewrite_(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), mim::plug::clos::ClosConvPrep::rewrite_arg(), mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm(), mim::plug::mem::strip_mem(), mim::plug::mem::strip_mem_ty(), mim::Lam::test(), and mim::World::test().
Definition at line 86 of file tuple.cpp.
Referenced by merge_sigma(), and merge_tuple().
Definition at line 93 of file tuple.cpp.
References mim::Def::isa_imm(), merge(), mim::World::sigma(), and mim::Def::world().
Definition at line 98 of file tuple.cpp.
References mim::Def::isa_imm(), merge(), mim::World::tuple(), mim::Def::type(), and mim::Def::world().
MIM_EXPORT mim::Plugin mim::mim_get_plugin | ( | ) |
To be implemented and exported by a plugin.
Referenced by mim::Driver::load().
Definition at line 22 of file hash.h.
References murmur_32_scramble().
Referenced by mim::Def::Def(), mim::Def::Def(), mim::DefDefHash::operator()(), and mim::GIDHash< T >::operator()().
Definition at line 29 of file hash.h.
References murmur_32_scramble().
Definition at line 51 of file hash.h.
Referenced by mim::Def::Def(), and mim::DefDefHash::operator()().
Definition at line 46 of file hash.h.
References murmur_32_scramble().
Definition at line 41 of file hash.h.
References murmur_32_scramble().
Referenced by mim::Def::Def().
Definition at line 15 of file hash.h.
Referenced by murmur3(), murmur3(), murmur3_rest(), and murmur3_rest().
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
std::ostream & mim::operator<< | ( | std::ostream & | os, |
const CFNode * | n ) |
Definition at line 22 of file cfg.cpp.
References mim::CFNode::mut().
std::ostream & mim::operator<< | ( | std::ostream & | os, |
Ref | ref ) |
std::ostream & mim::operator<< | ( | std::ostream & | os, |
const Def * | def ) |
This will stream def
as an operand.
This is usually id(def)
unless it can be displayed Inline.
Definition at line 422 of file dump.cpp.
References mim::Def::world().
std::ostream & mim::operator<< | ( | std::ostream & | os, |
const typename LoopTree< forward >::Base * | n ) |
Definition at line 207 of file looptree.cpp.
References print().
void mim::optimize | ( | World & | world | ) |
Definition at line 10 of file optimize.cpp.
References collect_args(), mim::World::driver(), error(), mim::World::external(), mim::World::externals(), mim::Def::flags(), mim::Def::make_internal(), mim::Driver::pass(), mim::PipelineBuilder::run_pipeline(), mim::World::sym(), and mim::Def::type().
Referenced by main().
std::ostream & mim::outf | ( | const char * | fmt, |
Args &&... | args ) |
std::ostream & mim::outln | ( | const char * | fmt, |
Args &&... | args ) |
Definition at line 49 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 78 of file util.h.
Referenced by mim::CFA::CFA(), mim::unique_queue< Set >::pop(), mim::unique_stack< Set >::pop(), and mim::PassMan::run().
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(), operator<<(), outf(), mim::ll::Emitter::prepare(), print(), mim::Tab::print(), println(), mim::ast::AppExpr::stream(), mim::ast::ArrOrPackExpr< arr >::stream(), mim::ast::ArrowExpr::stream(), mim::ast::AxiomDecl::stream(), mim::ast::CDecl::stream(), mim::ast::DeclExpr::stream(), mim::ast::ExtractExpr::stream(), mim::ast::IdExpr::stream(), mim::ast::IdPtrn::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::PiExpr::Dom::stream(), mim::ast::PiExpr::stream(), mim::ast::PrimaryExpr::stream(), mim::ast::RecDecl::stream(), mim::ast::TupleExpr::stream(), mim::ast::TuplePtrn::stream(), mim::ast::TypeExpr::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 150 of file print.h.
References fmt(), and print().
Referenced by mim::ast::RetExpr::stream().
void mim::register_pass | ( | Passes & | passes, |
CArgs &&... | args ) |
Definition at line 47 of file pipelinebuilder.h.
References mim::PipelineBuilder::add_pass(), assert_emplace(), and mim::Annex::Base.
Referenced by mim_get_plugin().
void mim::register_pass_with_arg | ( | Passes & | passes | ) |
Definition at line 61 of file pipelinebuilder.h.
References mim::PipelineBuilder::add_pass(), mim::App::arg(), assert_emplace(), mim::Annex::Base, mim::Def::gid(), and mim::PipelineBuilder::pass().
Referenced by mim_get_plugin().
void mim::register_phase | ( | Passes & | passes, |
CArgs &&... | args ) |
Definition at line 54 of file pipelinebuilder.h.
References mim::PipelineBuilder::add_phase(), assert_emplace(), and mim::Annex::Base.
Referenced by mim_get_plugin().
|
inline |
Definition at line 95 of file types.h.
Referenced by mim::BitSet::operator>>=().
Definition at line 45 of file rewrite.cpp.
References mim::Def::num_ops(), mim::Def::op(), and mim::Def::var().
Referenced by mim::plug::direct::op_cps2ds_dep(), mim::Arr::reduce(), mim::Def::reduce(), and mim::Pack::reduce().
As above but rewrites def
.
Definition at line 69 of file rewrite.h.
References mim::Rewriter::rewrite(), and mim::Def::var().
As above but only rewrites mut's
i^th
op.
Definition at line 66 of file rewrite.h.
References mim::Def::op(), mim::Rewriter::rewrite(), and mim::Def::var().
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 > > > |
Referenced by mim::Vector< T, N, A >::span(), mim::Vector< T, N, A >::span(), and mim::Vector< T, N, A >::view().
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 > |
|
inline |
Like std::string::substr
, but works on std::string_view
instead.
Definition at line 64 of file util.h.
Referenced by mim::Annex::split().
std::string mim::tuple2str | ( | const Def * | def | ) |
Definition at line 48 of file tuple.cpp.
References mim::Def::arity(), mim::Lit::as(), and mim::Def::projs().
Definition at line 109 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 80 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 73 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 > |
Referenced by mim::Def::projs(), and mim::plug::clos::ClosConv::start().
bool mim::visit | ( | IndexSet< Indexer, Key > & | set, |
const Key & | key ) |
Definition at line 95 of file indexset.h.
References mim::IndexSet< Indexer, Key >::insert().
Referenced by visit_first().
void mim::visit_first | ( | IndexSet< Indexer, Key > & | set, |
const Key & | key ) |
Definition at line 97 of file indexset.h.
References mim::IndexSet< Indexer, Key >::contains(), and visit().
|
staticconstexpr |
Definition at line 15 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::CopyProp::analyze(), mim::plug::mem::SSAConstr::analyze(), mim::plug::mem::SSAConstr::analyze(), mim::TailRecElim::analyze(), mim::PassMan::run(), mim::FPPass< P, M >::undo_enter(), and mim::FPPass< P, M >::undo_visit().